X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index ac785cf..db6ef26 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -28,6 +28,7 @@ import net.sourceforge.phpdt.externaltools.internal.model.ColorManager; import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; import net.sourceforge.phpdt.internal.core.BatchOperation; import net.sourceforge.phpdt.internal.core.JavaModelManager; +import net.sourceforge.phpdt.internal.core.util.Util; import net.sourceforge.phpdt.internal.corext.template.php.CodeTemplateContextType; import net.sourceforge.phpdt.internal.corext.template.php.HTMLContextType; import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType; @@ -77,6 +78,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; @@ -120,7 +122,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * The id of the PHP plugin (value "net.sourceforge.phpeclipse"). */ public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$ - +IWorkspace w; /** * id of builder - matches plugin.xml (concatenate pluginid.builderid) */ @@ -609,7 +611,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * @return */ public IdentifierIndexManager getIndexManager(IProject iProject) { - String indexFilename = iProject.getLocation() + File.separator + "project.index"; + IPath path = iProject.getWorkingLocation(PHPeclipsePlugin.PLUGIN_ID); + path = path.append("project.index"); + String indexFilename = path.toString(); +// System.out.println(indexFilename); IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap.get(indexFilename); if (indexManager == null) { indexManager = new IdentifierIndexManager(indexFilename); @@ -1162,9 +1167,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // JavaCore.getPlugin().getStateLocation(); getStateLocation(); // retrieve variable values - //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new - // JavaModelManager.PluginPreferencesListener()); - // manager.loadVariablesAndContainers(); + PHPeclipsePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new + JavaModelManager.PluginPreferencesListener()); +// manager.loadVariablesAndContainers(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.addResourceChangeListener(manager.deltaState, IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_BUILD @@ -1175,33 +1180,33 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // 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, manager); - // 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 - // manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE; - // savedState.processResourceChangeEvents(manager.deltaState); - // } - // } - // }, - // monitor); - // } catch (CoreException e) { - // return e.getStatus(); - // } - // return Status.OK_STATUS; - // } - // }; - // processSavedState.setSystem(true); - // processSavedState.setPriority(Job.SHORT); // process asap - // processSavedState.schedule(); + 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, manager); + 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 + manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE; + savedState.processResourceChangeEvents(manager.deltaState); + } + } + }, + monitor); + } catch (CoreException e) { + return e.getStatus(); + } + return Status.OK_STATUS; + } + }; + processSavedState.setSystem(true); + processSavedState.setPriority(Job.SHORT); // process asap + processSavedState.schedule(); } catch (RuntimeException e) { manager.shutdown(); throw e; @@ -1270,7 +1275,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // // JavaModelManager.PluginPreferencesListener()); // getPluginPreferences().addPropertyChangeListener( // new JavaModelManager.PluginPreferencesListener()); - // // TODO khartlage temp-del + // // TODO temp-del // // manager.loadVariablesAndContainers(); // final IWorkspace workspace = ResourcesPlugin.getWorkspace(); // workspace.addResourceChangeListener(