Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-01-20 19:07:38 +0000
committerChristian W. Damus2016-01-22 15:57:13 +0000
commit02b052a140cd3c0499700afd5b8a1fdd31782a71 (patch)
treeeb2cf1b4eb11829dcf6d94ffad7644e318eaa804 /plugins/infra/viewpoints
parent929e9738301b35cef5cc1ab00f47047671940bd5 (diff)
downloadorg.eclipse.papyrus-02b052a140cd3c0499700afd5b8a1fdd31782a71.tar.gz
org.eclipse.papyrus-02b052a140cd3c0499700afd5b8a1fdd31782a71.tar.xz
org.eclipse.papyrus-02b052a140cd3c0499700afd5b8a1fdd31782a71.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Decouple infra bundles from dependencies on UML, especially for access to the semantic model, using new APIs provided by the ILanguageService and IModel and also by the refined and new implementation of the SemanticService APIs defined in previous releases. Provide generalized access to SemanticEMFContentProviders for the semantic model content in the ModelSet by adaptation of IModels (semantic IModels per new Language Service API) to a new ISemanticContentProviderFactory protocol that creates content providers appropriate to the specific semantic model. Move the identifier of the Papyrus toolbar contribution out of the UML namespace: org.eclipse.papyrus.uml.diagram.ui.toolbar is now just org.eclipse.papyrus.ui.toolbar. Add a new XML enablement expression definition named org.eclipse.papyrus.ui.semanticModelActive as a generalization of the org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel for more than just UML Papyrus editors. Tests all still pass (inasmuch as they do in the nightly master builds). Change-Id: I41af229742134428e9e00f41575c14ef1aaf5e09
Diffstat (limited to 'plugins/infra/viewpoints')
-rw-r--r--plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/icons/Profile.gifbin0 -> 154 bytes
-rwxr-xr-xplugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototypeContentProvider.java46
2 files changed, 32 insertions, 14 deletions
diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/icons/Profile.gif b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/icons/Profile.gif
new file mode 100644
index 00000000000..18eed1f5cb9
--- /dev/null
+++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/icons/Profile.gif
Binary files differ
diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototypeContentProvider.java b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototypeContentProvider.java
index e261e130614..6a90c6e5358 100755
--- a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototypeContentProvider.java
+++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototypeContentProvider.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
+ * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +8,7 @@
*
* Contributors:
* Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
package org.eclipse.papyrus.infra.viewpoints.policy;
@@ -24,6 +24,8 @@ import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -41,22 +43,38 @@ import org.eclipse.swt.graphics.Image;
*/
public class ViewPrototypeContentProvider implements ITreeContentProvider {
- private static Image loadImage(String uri) {
+ private static ImageDescriptor loadImage(String uri) {
URL url = null;
try {
url = new URL(uri);
} catch (MalformedURLException e) {
}
- return ImageDescriptor.createFromURL(url).createImage();
+ return ImageDescriptor.createFromURL(url);
}
public static class LP extends LabelProvider {
+ private static final String IMG_CATEGORY = "imageCategory"; //$NON-NLS-1$
+ private static final String IMG_VIEWPOINT = "imageViewpoint"; //$NON-NLS-1$
+ private static final String IMG_PROFILE = "imageProfile"; //$NON-NLS-1$
+ private static final String IMG_MODEL = "imageModel"; //$NON-NLS-1$
+ private static final String IMG_OWNER = "imageOwner"; //$NON-NLS-1$
+
+ private ImageRegistry images = new ImageRegistry(JFaceResources.getResources());
+
+ {
+ images.put(IMG_CATEGORY, loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/PapyrusView.png"));
+ images.put(IMG_VIEWPOINT, loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/PapyrusViewpoint.png"));
+ images.put(IMG_PROFILE, loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/icons/Profile.gif"));
+ images.put(IMG_MODEL, loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/ModelRule.png"));
+ images.put(IMG_OWNER, loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/OwningRule.png"));
+ }
- private Image imageCategory = loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/PapyrusView.png");
- private Image imageViewpoint = loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/PapyrusViewpoint.png");
- private Image imageProfile = loadImage("platform:/plugin/org.eclipse.papyrus.uml.profile/resources/icons/Profile.gif");
- private Image imageModel = loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/ModelRule.png");
- private Image imageOwner = loadImage("platform:/plugin/org.eclipse.papyrus.infra.viewpoints.configuration.edit/icons/full/obj16/OwningRule.png");
+ @Override
+ public void dispose() {
+ super.dispose();
+
+ images.dispose();
+ }
@Override
public String getText(Object element) {
@@ -134,22 +152,22 @@ public class ViewPrototypeContentProvider implements ITreeContentProvider {
@Override
public Image getImage(Object element) {
if (element instanceof Category) {
- return imageCategory;
+ return images.get(IMG_CATEGORY);
}
if (element instanceof ViewPrototype) {
return ((ViewPrototype) element).getIcon();
}
if (element instanceof PapyrusViewpoint) {
- return imageViewpoint;
+ return images.get(IMG_VIEWPOINT);
}
if (element instanceof EPackage) {
- return imageProfile;
+ return images.get(IMG_PROFILE);
}
if (element instanceof ModelRule) {
- return imageModel;
+ return images.get(IMG_MODEL);
}
if (element instanceof OwningRule) {
- return imageOwner;
+ return images.get(IMG_OWNER);
}
return null;
}

Back to the top