1) Fixed issue #764: Ignore strings when looking for single line comments.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
index 69da86c..d3a771d 100644 (file)
@@ -68,6 +68,7 @@ import org.eclipse.core.resources.ISavedState;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdapterManager;
 import org.eclipse.core.runtime.IConfigurationElement;
@@ -161,42 +162,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
         */
        private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$
 
-       /**
-        * The key to store whether the legacy templates have been migrated
-        * 
-        * @since 3.0
-        */
-       // private static final String TEMPLATES_MIGRATION_KEY=
-       // "net.sourceforge.phpdt.ui.text.templates_migrated"; //$NON-NLS-1$
-       /**
-        * The key to store whether the legacy code templates have been migrated
-        * 
-        * @since 3.0
-        */
-       // private static final String CODE_TEMPLATES_MIGRATION_KEY=
-       // "net.sourceforge.phpdt.ui.text.code_templates_migrated";
-       // //$NON-NLS-1$
-       // private static ExternalToolsPlugin externalTools;
-       /**
-        * The Java virtual machine that we are running on.
-        */
-       // private static int jvm;
-       // /** MRJ 2.0 */
-       // private static final int MRJ_2_0 = 0;
-       //
-       // /** MRJ 2.1 or later */
-       // private static final int MRJ_2_1 = 1;
-       //
-       // /** Java on Mac OS X 10.0 (MRJ 3.0) */
-       // private static final int MRJ_3_0 = 3;
-       //
-       // /** MRJ 3.1 */
-       // private static final int MRJ_3_1 = 4;
-       //
-       // /** JVM constant for any other platform */
-       // private static final int OTHER = -1;
-       // public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID +
-       // ".resourcesview.ViewPHPResources"; //$NON-NLS-1$
        public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID
                        + ".ui.CodingActionSet"; //$NON-NLS-1$
 
@@ -829,7 +794,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                JavaCore.initializeDefaultPluginPreferences();
                PreferenceConstants.initializeDefaultValues(store);
                // externalTools.initializeDefaultPreferences(store);
-               MarkerAnnotationPreferences.initializeDefaultValues(store);
+               // MarkerAnnotationPreferences.initializeDefaultValues(store);
        }
 
        private IWorkbenchPage internalGetActivePage() {
@@ -862,7 +827,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                IWorkbenchPage page = window.getActivePage();
                IPath path = new Path(filename);
                // If the file exists in the workspace, open it
-               IFile file = getWorkspace().getRoot().getFileForLocation(path);
+               IFile file = getWorkspace().getRoot().getFile(path);
                IEditorPart editor;
                ITextEditor textEditor;
                if (file != null && file.exists()) {
@@ -1119,32 +1084,48 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                        // process deltas since last activated in indexer thread so that
                        // indexes are up-to-date.
                        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
-                       Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
-                               protected IStatus run(IProgressMonitor monitor) {
-                                       try {
-                                               // add save participant and process delta atomically
-                                               // see
-                                               // https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
-                                               workspace.run(new IWorkspaceRunnable() {
-                                                       public void run(IProgressMonitor progress)
-                                                                       throws CoreException {
-                                                               ISavedState savedState = workspace
-                                                                               .addSaveParticipant(
-                                                                                               PHPeclipsePlugin.this,
-                                                                                               modelManager);
-                                                               if (savedState != null) {
-                                                                       // the event type coming from the saved
-                                                                       // state is always POST_AUTO_BUILD
-                                                                       // force it to be POST_CHANGE so that the
-                                                                       // delta processor can handle it
-                                                                       modelManager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
-                                                                       savedState
-                                                                                       .processResourceChangeEvents(modelManager.deltaState);
-                                                               }
-                                                       }
-                                               }, monitor);
-                                       } catch (CoreException e) {
-                                               return e.getStatus();
+// This causes timeout at EclipseLazyStarter
+//                     Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
+//                             protected IStatus run(IProgressMonitor monitor) {
+//                                     try {
+//                                             // add save participant and process delta atomically
+//                                             // see
+//                                             // https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
+//                                             workspace.run(new IWorkspaceRunnable() {
+//                                                     public void run(IProgressMonitor progress)
+//                                                                     throws CoreException {
+//                                                             ISavedState savedState = workspace
+//                                                                             .addSaveParticipant(
+//                                                                                             PHPeclipsePlugin.this,
+//                                                                                             modelManager);
+//                                                             if (savedState != null) {
+//                                                                     // the event type coming from the saved
+//                                                                     // state is always POST_AUTO_BUILD
+//                                                                     // force it to be POST_CHANGE so that the
+//                                                                     // delta processor can handle it
+//                                                                     modelManager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
+//                                                                     savedState
+//                                                                                     .processResourceChangeEvents(modelManager.deltaState);
+//                                                             }
+//                                                     }
+//                                             }, monitor);
+//                                     } catch (CoreException e) {
+//                                             return e.getStatus();
+//                                     }
+//                                     return Status.OK_STATUS;
+//                             }
+//                     };
+// Replace Job + IWorkspace.run() to WorkspaceJob
+                       WorkspaceJob processSavedState = new WorkspaceJob(
+                                       Util.bind("savedState.jobName")) { //$NON-NLS-1$
+                               public IStatus runInWorkspace(IProgressMonitor monitor)
+                                               throws CoreException {
+                                       ISavedState savedState = workspace.addSaveParticipant(
+                                                       PHPeclipsePlugin.this, modelManager);
+                                       if (savedState != null) {
+                                               modelManager.deltaState.getDeltaProcessor().overridenEventType
+                                                               = IResourceChangeEvent.POST_CHANGE;
+                                               savedState.processResourceChangeEvents(modelManager.deltaState);
                                        }
                                        return Status.OK_STATUS;
                                }