]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.help.base/src/org/simantics/help/base/internal/PDFSearchParticipant.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.help.base / src / org / simantics / help / base / internal / PDFSearchParticipant.java
index d630e113eec31d0f8603c7fd7ede074c94bedb3e..e1c9045ce667046c8a8823a05e1d2b0331607c8b 100644 (file)
@@ -1,54 +1,54 @@
-package org.simantics.help.base.internal;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.net.URL;\r
-import java.net.URLDecoder;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.IPath;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.help.search.IHelpSearchIndex;\r
-import org.eclipse.help.search.ISearchDocument;\r
-import org.eclipse.help.search.SearchParticipant;\r
-import org.osgi.framework.Bundle;\r
-\r
-/**\r
- * An abstract search participants for adding XML documents to the search index. Subclass it\r
- * and implement or override protected methods to handle parsing of the document.\r
- *\r
- * @since 1.20.0\r
- */\r
-public class PDFSearchParticipant extends SearchParticipant {\r
-\r
-    @Override\r
-    public IStatus addDocument(IHelpSearchIndex index, String pluginId, String name, URL url, String id, ISearchDocument doc) {\r
-        try {\r
-            //System.out.println("PDFSearchParticipant.addDocument(" + index + ", " + pluginId + ", " + name + ", " + url + ", " + id + ", " + doc + ")");\r
-            Bundle bundle = Platform.getBundle(pluginId);\r
-            if (bundle == null)\r
-                return new Status(IStatus.ERROR, pluginId, "Failed to find bundle " + bundle + " from the platform.");\r
-\r
-            // Need to decode path because it will fail to resolve if it contains %20 (=' ').\r
-            IPath path = new Path(URLDecoder.decode(name, "UTF-8"));\r
-            path = path.removeFirstSegments(1);\r
-            URL bundleUrl = FileLocator.find(bundle, path, null);\r
-            if (bundleUrl == null)\r
-                return new Status(IStatus.ERROR, pluginId, "Failed to find file " + name + " from bundle " + pluginId + ".");\r
-\r
-            URL fileUrl = FileLocator.toFileURL(bundleUrl);\r
-            if (!fileUrl.getProtocol().equals("file"))\r
-                return new Status(IStatus.ERROR, pluginId, "Failed to make " + url + " available as a file");\r
-\r
-            File f = new File(URLDecoder.decode(fileUrl.getPath(), "UTF-8")).getCanonicalFile();\r
-            PDFUtil.stripText(f, doc);\r
-            return Status.OK_STATUS;\r
-        } catch (IOException e) {\r
-            return new Status(IStatus.ERROR, pluginId, "Failed to strip text from PDF document " + url + ".", e);\r
-        }\r
-    }\r
-\r
-}\r
+package org.simantics.help.base.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLDecoder;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.help.search.IHelpSearchIndex;
+import org.eclipse.help.search.ISearchDocument;
+import org.eclipse.help.search.SearchParticipant;
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstract search participants for adding XML documents to the search index. Subclass it
+ * and implement or override protected methods to handle parsing of the document.
+ *
+ * @since 1.20.0
+ */
+public class PDFSearchParticipant extends SearchParticipant {
+
+    @Override
+    public IStatus addDocument(IHelpSearchIndex index, String pluginId, String name, URL url, String id, ISearchDocument doc) {
+        try {
+            //System.out.println("PDFSearchParticipant.addDocument(" + index + ", " + pluginId + ", " + name + ", " + url + ", " + id + ", " + doc + ")");
+            Bundle bundle = Platform.getBundle(pluginId);
+            if (bundle == null)
+                return new Status(IStatus.ERROR, pluginId, "Failed to find bundle " + bundle + " from the platform.");
+
+            // Need to decode path because it will fail to resolve if it contains %20 (=' ').
+            IPath path = new Path(URLDecoder.decode(name, "UTF-8"));
+            path = path.removeFirstSegments(1);
+            URL bundleUrl = FileLocator.find(bundle, path, null);
+            if (bundleUrl == null)
+                return new Status(IStatus.ERROR, pluginId, "Failed to find file " + name + " from bundle " + pluginId + ".");
+
+            URL fileUrl = FileLocator.toFileURL(bundleUrl);
+            if (!fileUrl.getProtocol().equals("file"))
+                return new Status(IStatus.ERROR, pluginId, "Failed to make " + url + " available as a file");
+
+            File f = new File(URLDecoder.decode(fileUrl.getPath(), "UTF-8")).getCanonicalFile();
+            PDFUtil.stripText(f, doc);
+            return Status.OK_STATUS;
+        } catch (IOException e) {
+            return new Status(IStatus.ERROR, pluginId, "Failed to strip text from PDF document " + url + ".", e);
+        }
+    }
+
+}