Avoid warning message in every startup
authortoshihiro <toshihiro>
Tue, 3 Jul 2007 11:17:08 +0000 (11:17 +0000)
committertoshihiro <toshihiro>
Tue, 3 Jul 2007 11:17:08 +0000 (11:17 +0000)
>!MESSAGE While loading class "net.sourceforge.phpeclipse.PHPeclipsePlugin$3$1", thread "Worker-2" timed out waiting (5000ms) for thread "Worker-0" to finish starting bundle "net.sourceforge.phpeclipse". To avoid deadlock, thread "Worker-2" is proceeding but "net.sourceforge.phpeclipse.PHPeclipsePlugin$3$1" may not be fully initialized.

net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java

index 69da86c..97c36bc 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;
@@ -1119,32 +1120,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;
                                }