diff options
author | Arthur Daussy | 2014-03-19 10:15:55 +0000 |
---|---|---|
committer | Axel Richard | 2014-03-31 16:21:59 +0000 |
commit | 54e2b5480202ca3ba7018648f317064417871835 (patch) | |
tree | 727526bb925adcd006d22849368dba963a3f49a2 /plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java | |
parent | ed126c1f28d9ebff83cea19ea470e748cfe5ec0e (diff) | |
download | org.eclipse.emf.compare-54e2b5480202ca3ba7018648f317064417871835.tar.gz org.eclipse.emf.compare-54e2b5480202ca3ba7018648f317064417871835.tar.xz org.eclipse.emf.compare-54e2b5480202ca3ba7018648f317064417871835.zip |
[430682] Refactoring of IModelResolver
This refactoring aims to make the resolver more UI friendly.
Bug: 430682
Change-Id: I3091b823fedd8803b503cb42f62195c2a2b166ed
Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java')
-rw-r--r-- | plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java index ef86007f1..5edc7b804 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java +++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java @@ -19,8 +19,10 @@ import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.emf.compare.ide.ui.internal.editor.PropertySheetAdapterFactory; import org.eclipse.emf.compare.ide.ui.internal.logical.IModelResolverRegistry; +import org.eclipse.emf.compare.ide.ui.internal.logical.ModelResolverManager; import org.eclipse.emf.compare.ide.ui.internal.logical.ModelResolverRegistryImpl; import org.eclipse.emf.compare.ide.ui.internal.logical.ModelResolverRegistryListener; import org.eclipse.emf.compare.rcp.extension.AbstractRegistryEventListener; @@ -50,6 +52,9 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin { /** Registry of model resolvers. */ private IModelResolverRegistry modelResolverRegistry; + /** Manager of resolver. */ + private ModelResolverManager modelResolverManager; + /** keep track of resources that should be freed when exiting. */ private static Map<String, Image> resourcesMapper = new HashMap<String, Image>(); @@ -59,6 +64,17 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin { } /** + * Instance scope for preferences. + * <p> + * Do not use singleton to respect Helios compatibility + * </p> + * + * @see org.eclipse.core.runtime.preferences.InstanceScope#INSTANCE + */ + @SuppressWarnings("deprecation") + private InstanceScope instanceScope = new InstanceScope(); + + /** * {@inheritDoc} * * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) @@ -69,9 +85,10 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin { plugin = this; final IExtensionRegistry globalRegistry = Platform.getExtensionRegistry(); - modelResolverRegistry = new ModelResolverRegistryImpl(); + modelResolverManager = new ModelResolverManager(instanceScope.getNode(PLUGIN_ID)); + modelResolverRegistry = new ModelResolverRegistryImpl(modelResolverManager); modelResolverRegistryListener = new ModelResolverRegistryListener(PLUGIN_ID, MODEL_RESOLVER_PPID, - getLog(), modelResolverRegistry); + getLog(), modelResolverManager); globalRegistry.addListener(modelResolverRegistryListener); modelResolverRegistryListener.readRegistry(globalRegistry); @@ -88,7 +105,7 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin { final IExtensionRegistry globalRegistry = Platform.getExtensionRegistry(); globalRegistry.removeListener(modelResolverRegistryListener); modelResolverRegistry.clear(); - + modelResolverManager = null; plugin = null; super.stop(context); } @@ -176,4 +193,18 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin { public void log(Throwable e) { getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e)); } + + /** + * Log the given message with the give severity level. Severity is one of {@link IStatus#INFO}, + * {@link IStatus#WARNING} and {@link IStatus#ERROR}. + * + * @param severity + * the severity of the message + * @param message + * the message + */ + public void log(int severity, String message) { + getLog().log(new Status(severity, PLUGIN_ID, message)); + } + } |