Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Notot2013-04-24 07:50:10 +0000
committerCedric Notot2013-04-24 07:51:16 +0000
commitac4cd20590fb90792c53b869f9ef74b2f63bb04e (patch)
tree72f0f15b98e22dd926da228f6d4c8907314061e2
parentbc60fd5e985eafe57efefca5b518474fa70dfa1a (diff)
downloadorg.eclipse.emf.compare-ac4cd20590fb90792c53b869f9ef74b2f63bb04e.tar.gz
org.eclipse.emf.compare-ac4cd20590fb90792c53b869f9ef74b2f63bb04e.tar.xz
org.eclipse.emf.compare-ac4cd20590fb90792c53b869f9ef74b2f63bb04e.zip
Add of the management of GMF styles for the label providers in diagram
structure merge viewer.
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/DiagramCompareItemProviderAdapterFactorySpec.java16
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/StyleItemProviderSpec.java60
2 files changed, 76 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/DiagramCompareItemProviderAdapterFactorySpec.java b/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/DiagramCompareItemProviderAdapterFactorySpec.java
index 42c9adfb4..20fc5d3a4 100644
--- a/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/DiagramCompareItemProviderAdapterFactorySpec.java
+++ b/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/DiagramCompareItemProviderAdapterFactorySpec.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Style;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.provider.NotationItemProviderAdapterFactory;
import org.eclipse.gmf.runtime.notation.provider.ViewItemProvider;
@@ -40,6 +41,12 @@ public class DiagramCompareItemProviderAdapterFactorySpec extends NotationItemPr
*/
protected ViewItemProvider diagramItemProviderSpec;
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.gmf.runtime.notation.Diagram}
+ * instances.
+ */
+ protected Adapter styleItemProviderSpec;
+
/** The Specific switch to create adapters for ALL views and diagrams. */
// CHECKSTYLE:OFF
protected NotationSwitch modelSwitchSpec = new NotationSwitch() {
@@ -67,6 +74,15 @@ public class DiagramCompareItemProviderAdapterFactorySpec extends NotationItemPr
@Override
public Object defaultCase(EObject object) {
+ if (object instanceof Style) {
+ // For all instances of Style
+ if (styleItemProviderSpec == null) {
+ styleItemProviderSpec = new StyleItemProviderSpec(
+ DiagramCompareItemProviderAdapterFactorySpec.this);
+ }
+ return styleItemProviderSpec;
+ }
+
// delegate to the default notational switch
return modelSwitch.doSwitch(object);
}
diff --git a/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/StyleItemProviderSpec.java b/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/StyleItemProviderSpec.java
new file mode 100644
index 000000000..c72ce9baa
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.diagram.edit/src/org/eclipse/emf/compare/diagram/internal/matchs/provider/spec/StyleItemProviderSpec.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.diagram.internal.matchs.provider.spec;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.diagram.internal.extensions.provider.ExtensionsEditPlugin;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.provider.EModelElementItemProvider;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the specific item provider adapter for a {@link org.eclipse.gmf.runtime.notation.View} object.
+ *
+ * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
+ */
+public class StyleItemProviderSpec extends EModelElementItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ *
+ * @param adapterFactory
+ * The adapter factory.
+ */
+ public StyleItemProviderSpec(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.notation.provider.ViewItemProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ return ((EObject)object).eClass().getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getImage(java.lang.Object)
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, ExtensionsEditPlugin.INSTANCE.getImage("full/obj16/Style"));
+ }
+
+}

Back to the top