diff options
author | Ansgar Radermacher | 2017-03-31 14:14:09 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-04-27 13:12:13 +0000 |
commit | 71d46ac5a8601a33b6ff65a425098d42b22cdda0 (patch) | |
tree | 5e634cced0aa3f9f87dc024bab15a29fd0e6c8d0 /plugins/infra/emf | |
parent | 59dad4f4d0ccb1900b1aa3f080c5209d4dc41441 (diff) | |
download | org.eclipse.papyrus-71d46ac5a8601a33b6ff65a425098d42b22cdda0.tar.gz org.eclipse.papyrus-71d46ac5a8601a33b6ff65a425098d42b22cdda0.tar.xz org.eclipse.papyrus-71d46ac5a8601a33b6ff65a425098d42b22cdda0.zip |
Bug 512554 - [Architecture-General] No Disable Workspace Model Indexer facility
- Start indexing in the moment that a first demand for an index (instance of class CrossReferenceIndex) is done.
- The ControlledUnitLabelDecorator is already used earlier (if the project explorer is
open). With the patch, it will only start decorating, once indexing has been started, i.e. a
Papyrus model is opened. This means that decorations are available late, but avoids starting
the indexer almost immediately (for sporadic Papyrus users)
- Increase wait timeout added in bug 512554: otherwise we might run regularly into a
timeout due to class loading delays
Change-Id: I9084f3c4f3023c25d32fa35ade7ae67900439eca
Diffstat (limited to 'plugins/infra/emf')
4 files changed, 15 insertions, 24 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java index 4a59bf3532c..55eac268357 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java @@ -19,11 +19,7 @@ import java.util.List; import org.eclipse.core.resources.ISavedState; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; @@ -32,7 +28,6 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager; import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManagerFactory; import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.papyrus.infra.emf.internal.resource.index.IndexManager; import org.eclipse.papyrus.infra.emf.internal.resource.index.IndexPersistenceManager; import org.eclipse.papyrus.infra.emf.spi.resolver.EObjectResolverService; import org.eclipse.papyrus.infra.emf.spi.resolver.IEObjectResolver; @@ -86,22 +81,6 @@ public class Activator extends Plugin { if ((state != null) && (state.getSaveNumber() != 0)) { saveHelper.initializeSaveDelegates(state, saveDelegates); } - - // Kick off the workspace model indexing system - new Job("Initialize workspace model index") { - { - setSystem(true); - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - // This cannot be done in the IndexManager constructor because - // indices that it loads depend on the instance already being set - IndexManager.getInstance().startManager(); - - return Status.OK_STATUS; - } - }.schedule(); } @Override diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java index 66fbcd84b39..060e500413e 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java @@ -198,13 +198,13 @@ public abstract class AbstractCrossReferenceIndex implements ICrossReferenceInde final <V> V sync(Future<V> future) throws CoreException { try { // use a (long) timeout to avoid eventual deadlocks (in case of resources needing refresh) - return future.get(5, TimeUnit.SECONDS); + return future.get(30, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new CoreException(Status.CANCEL_STATUS); } catch (ExecutionException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to access the resource shard index", e)); + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to access the resource shard index", e)); //$NON-NLS-1$ } catch (TimeoutException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Timeout during access the resource shard index", e)); + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Timeout during access the resource shard index", e)); //$NON-NLS-1$ } } diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/CrossReferenceIndex.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/CrossReferenceIndex.java index 6730912a182..550a189aac6 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/CrossReferenceIndex.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/CrossReferenceIndex.java @@ -32,6 +32,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.util.URI; import org.eclipse.papyrus.infra.emf.Activator; +import org.eclipse.papyrus.infra.emf.internal.resource.index.IndexManager; import org.eclipse.papyrus.infra.emf.resource.index.IWorkspaceModelIndexProvider; import org.eclipse.papyrus.infra.emf.resource.index.WorkspaceModelIndex; import org.eclipse.papyrus.infra.emf.resource.index.WorkspaceModelIndex.PersistentIndexHandler; @@ -84,6 +85,10 @@ public class CrossReferenceIndex extends AbstractCrossReferenceIndex { } public static CrossReferenceIndex getInstance() { + if (!IndexManager.getInstance().isStarted()) { + // start index manager + IndexManager.getInstance().startManager(); + } return INSTANCE; } diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/index/IndexManager.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/index/IndexManager.java index b8798a0c913..6c5748c822c 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/index/IndexManager.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/index/IndexManager.java @@ -105,6 +105,13 @@ public class IndexManager { return INSTANCE; } + /** + * @return true, if the index manager has already been started + */ + public boolean isStarted() { + return indices != null; + } + public void dispose() { if (indices != null) { wsRoot.getWorkspace().removeResourceChangeListener(workspaceListener); |