Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-19 08:22:04 +0000
committerEike Stepper2012-07-19 08:22:04 +0000
commit1460904fd3c193ffaf809913b2983a400fce9d94 (patch)
tree72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo
parent5f360965ae87478e0681899bf310a210cafc2c44 (diff)
downloadcdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java382
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java526
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java336
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java172
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java200
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java194
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java200
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java172
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java200
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java204
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java152
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java214
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java226
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java244
32 files changed, 2712 insertions, 2712 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java
index 920b516978..08903893bd 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Martin Fluegge
- */
-public class Activator extends AbstractUIPlugin
-{
- public static final String PLUGIN_ID = "org.eclipse.emf.cdo.dawn.examples.acore.graphiti"; //$NON-NLS-1$
-
- private static Activator plugin;
-
- public Activator()
- {
- }
-
- @Override
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception
- {
- plugin = null;
- super.stop(context);
- }
-
- public static Activator getDefault()
- {
- return plugin;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Martin Fluegge
+ */
+public class Activator extends AbstractUIPlugin
+{
+ public static final String PLUGIN_ID = "org.eclipse.emf.cdo.dawn.examples.acore.graphiti"; //$NON-NLS-1$
+
+ private static Activator plugin;
+
+ public Activator()
+ {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java
index 0002397f34..39619d7aa9 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
-
-import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.platform.IDiagramEditor;
-import org.eclipse.graphiti.tb.IToolBehaviorProvider;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreDiagramTypeProvider extends AbstractDiagramTypeProvider
-{
- public AcoreDiagramTypeProvider()
- {
- super();
- setFeatureProvider(new AcoreFeatureProvider(this));
- }
-
- @Override
- public boolean isAutoUpdateAtStartup()
- {
- return super.isAutoUpdateAtStartup();
- }
-
- private IToolBehaviorProvider[] toolBehaviorProviders;
-
- @Override
- public IToolBehaviorProvider[] getAvailableToolBehaviorProviders()
- {
- if (toolBehaviorProviders == null)
- {
- toolBehaviorProviders = new IToolBehaviorProvider[] { new AcoreToolBehaviorProvider(this) };
- }
- return toolBehaviorProviders;
- }
-
- @Override
- public void init(Diagram diagram, IDiagramEditor diagramEditor)
- {
- super.init(diagram, diagramEditor);
- DawnGraphitiAcoreResourceUtil.wireDomainModel(diagram, diagram.eResource().getResourceSet(), getDiagramEditor()
- .getEditingDomain());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
+
+import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.platform.IDiagramEditor;
+import org.eclipse.graphiti.tb.IToolBehaviorProvider;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreDiagramTypeProvider extends AbstractDiagramTypeProvider
+{
+ public AcoreDiagramTypeProvider()
+ {
+ super();
+ setFeatureProvider(new AcoreFeatureProvider(this));
+ }
+
+ @Override
+ public boolean isAutoUpdateAtStartup()
+ {
+ return super.isAutoUpdateAtStartup();
+ }
+
+ private IToolBehaviorProvider[] toolBehaviorProviders;
+
+ @Override
+ public IToolBehaviorProvider[] getAvailableToolBehaviorProviders()
+ {
+ if (toolBehaviorProviders == null)
+ {
+ toolBehaviorProviders = new IToolBehaviorProvider[] { new AcoreToolBehaviorProvider(this) };
+ }
+ return toolBehaviorProviders;
+ }
+
+ @Override
+ public void init(Diagram diagram, IDiagramEditor diagramEditor)
+ {
+ super.init(diagram, diagramEditor);
+ DawnGraphitiAcoreResourceUtil.wireDomainModel(diagram, diagram.eResource().getResourceSet(), getDiagramEditor()
+ .getEditingDomain());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java
index ee6eb15809..ce1c77f5f2 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java
@@ -1,191 +1,191 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAInterfaceFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAggregationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAssociationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddCompositionFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddImplementationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddSubClassesFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAInterfaceFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAggregationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAssociationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateCompositionsFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateImplementationFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateSubclassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCopyAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreDirectEditAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcorePasteAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreReconnectionFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreRenameAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreUpdateAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.graphiti.dt.IDiagramTypeProvider;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICopyFeature;
-import org.eclipse.graphiti.features.ICreateConnectionFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IDirectEditingFeature;
-import org.eclipse.graphiti.features.IFeature;
-import org.eclipse.graphiti.features.IPasteFeature;
-import org.eclipse.graphiti.features.IReconnectionFeature;
-import org.eclipse.graphiti.features.IUpdateFeature;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.features.context.ICopyContext;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.context.IDirectEditingContext;
-import org.eclipse.graphiti.features.context.IPasteContext;
-import org.eclipse.graphiti.features.context.IPictogramElementContext;
-import org.eclipse.graphiti.features.context.IReconnectionContext;
-import org.eclipse.graphiti.features.context.IUpdateContext;
-import org.eclipse.graphiti.features.custom.ICustomFeature;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreFeatureProvider extends DefaultFeatureProvider
-{
- public AcoreFeatureProvider(IDiagramTypeProvider dtp)
- {
- super(dtp);
- }
-
- @Override
- public ICreateFeature[] getCreateFeatures()
- {
- return new ICreateFeature[] { new AcoreCreateAClassFeature(this), new AcoreCreateAInterfaceFeature(this) };
- }
-
- @Override
- public ICreateConnectionFeature[] getCreateConnectionFeatures()
- {
- return new ICreateConnectionFeature[] { new AcoreCreateSubclassFeature(this),
- new AcoreCreateImplementationFeature(this), new AcoreCreateAssociationFeature(this),
- new AcoreCreateAggregationFeature(this), new AcoreCreateCompositionsFeature(this) };
- }
-
- @Override
- public IAddFeature getAddFeature(IAddContext context)
- {
- if (context instanceof IAddConnectionContext)
- {
- ConnectionType connectionType = (ConnectionType)context.getProperty(AcoreGraphitiContextUtil.CONNECTTION_TYPE);
- switch (connectionType)
- {
- case SUBCLASSES:
- {
- return new AcoreAddSubClassesFeature(this);
- }
- case IMPLEMENTATIONS:
- {
- return new AcoreAddImplementationFeature(this);
- }
- case AGGREGATIONS:
- {
- return new AcoreAddAggregationFeature(this);
- }
- case ASSOCIATIONS:
- {
- return new AcoreAddAssociationFeature(this);
- }
- case COMPOSITIONS:
- {
- return new AcoreAddCompositionFeature(this);
- }
- default:
- break;
- }
- }
- else
- {
- if (context.getNewObject() instanceof AClass)
- {
- return new AcoreAddAClassFeature(this);
- }
- else if (context.getNewObject() instanceof AInterface)
- {
- return new AcoreAddAInterfaceFeature(this);
- }
- }
-
- return super.getAddFeature(context);
- }
-
- @Override
- public IUpdateFeature getUpdateFeature(IUpdateContext context)
- {
- PictogramElement pictogramElement = context.getPictogramElement();
- if (pictogramElement instanceof ContainerShape)
- {
- Object bo = getBusinessObjectForPictogramElement(pictogramElement);
- if (bo instanceof AClass)
- {
- return new AcoreUpdateAClassFeature(this);
- }
- }
- return super.getUpdateFeature(context);
- }
-
- @Override
- public IFeature[] getDragAndDropFeatures(IPictogramElementContext context)
- {
- // simply return all create connection features
- return getCreateConnectionFeatures();
- }
-
- @Override
- public IReconnectionFeature getReconnectionFeature(IReconnectionContext context)
- {
- return new AcoreReconnectionFeature(this);
- }
-
- @Override
- public IDirectEditingFeature getDirectEditingFeature(IDirectEditingContext context)
- {
- PictogramElement pe = context.getPictogramElement();
- Object bo = getBusinessObjectForPictogramElement(pe);
- if (bo instanceof AClass)
- {
- return new AcoreDirectEditAClassFeature(this);
- }
- return super.getDirectEditingFeature(context);
- }
-
- @Override
- public ICopyFeature getCopyFeature(ICopyContext context)
- {
- return new AcoreCopyAClassFeature(this);
- }
-
- @Override
- public IPasteFeature getPasteFeature(IPasteContext context)
- {
- return new AcorePasteAClassFeature(this);
- }
-
- @Override
- public ICustomFeature[] getCustomFeatures(ICustomContext context)
- {
- return new ICustomFeature[] { new AcoreRenameAClassFeature(this) };
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAInterfaceFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAggregationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAssociationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddCompositionFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddImplementationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddSubClassesFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAInterfaceFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAggregationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAssociationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateCompositionsFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateImplementationFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateSubclassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCopyAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreDirectEditAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcorePasteAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreReconnectionFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreRenameAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreUpdateAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICopyFeature;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IDirectEditingFeature;
+import org.eclipse.graphiti.features.IFeature;
+import org.eclipse.graphiti.features.IPasteFeature;
+import org.eclipse.graphiti.features.IReconnectionFeature;
+import org.eclipse.graphiti.features.IUpdateFeature;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.ICopyContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.features.context.IPasteContext;
+import org.eclipse.graphiti.features.context.IPictogramElementContext;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.graphiti.features.context.IUpdateContext;
+import org.eclipse.graphiti.features.custom.ICustomFeature;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreFeatureProvider extends DefaultFeatureProvider
+{
+ public AcoreFeatureProvider(IDiagramTypeProvider dtp)
+ {
+ super(dtp);
+ }
+
+ @Override
+ public ICreateFeature[] getCreateFeatures()
+ {
+ return new ICreateFeature[] { new AcoreCreateAClassFeature(this), new AcoreCreateAInterfaceFeature(this) };
+ }
+
+ @Override
+ public ICreateConnectionFeature[] getCreateConnectionFeatures()
+ {
+ return new ICreateConnectionFeature[] { new AcoreCreateSubclassFeature(this),
+ new AcoreCreateImplementationFeature(this), new AcoreCreateAssociationFeature(this),
+ new AcoreCreateAggregationFeature(this), new AcoreCreateCompositionsFeature(this) };
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IAddContext context)
+ {
+ if (context instanceof IAddConnectionContext)
+ {
+ ConnectionType connectionType = (ConnectionType)context.getProperty(AcoreGraphitiContextUtil.CONNECTTION_TYPE);
+ switch (connectionType)
+ {
+ case SUBCLASSES:
+ {
+ return new AcoreAddSubClassesFeature(this);
+ }
+ case IMPLEMENTATIONS:
+ {
+ return new AcoreAddImplementationFeature(this);
+ }
+ case AGGREGATIONS:
+ {
+ return new AcoreAddAggregationFeature(this);
+ }
+ case ASSOCIATIONS:
+ {
+ return new AcoreAddAssociationFeature(this);
+ }
+ case COMPOSITIONS:
+ {
+ return new AcoreAddCompositionFeature(this);
+ }
+ default:
+ break;
+ }
+ }
+ else
+ {
+ if (context.getNewObject() instanceof AClass)
+ {
+ return new AcoreAddAClassFeature(this);
+ }
+ else if (context.getNewObject() instanceof AInterface)
+ {
+ return new AcoreAddAInterfaceFeature(this);
+ }
+ }
+
+ return super.getAddFeature(context);
+ }
+
+ @Override
+ public IUpdateFeature getUpdateFeature(IUpdateContext context)
+ {
+ PictogramElement pictogramElement = context.getPictogramElement();
+ if (pictogramElement instanceof ContainerShape)
+ {
+ Object bo = getBusinessObjectForPictogramElement(pictogramElement);
+ if (bo instanceof AClass)
+ {
+ return new AcoreUpdateAClassFeature(this);
+ }
+ }
+ return super.getUpdateFeature(context);
+ }
+
+ @Override
+ public IFeature[] getDragAndDropFeatures(IPictogramElementContext context)
+ {
+ // simply return all create connection features
+ return getCreateConnectionFeatures();
+ }
+
+ @Override
+ public IReconnectionFeature getReconnectionFeature(IReconnectionContext context)
+ {
+ return new AcoreReconnectionFeature(this);
+ }
+
+ @Override
+ public IDirectEditingFeature getDirectEditingFeature(IDirectEditingContext context)
+ {
+ PictogramElement pe = context.getPictogramElement();
+ Object bo = getBusinessObjectForPictogramElement(pe);
+ if (bo instanceof AClass)
+ {
+ return new AcoreDirectEditAClassFeature(this);
+ }
+ return super.getDirectEditingFeature(context);
+ }
+
+ @Override
+ public ICopyFeature getCopyFeature(ICopyContext context)
+ {
+ return new AcoreCopyAClassFeature(this);
+ }
+
+ @Override
+ public IPasteFeature getPasteFeature(IPasteContext context)
+ {
+ return new AcorePasteAClassFeature(this);
+ }
+
+ @Override
+ public ICustomFeature[] getCustomFeatures(ICustomContext context)
+ {
+ return new ICustomFeature[] { new AcoreRenameAClassFeature(this) };
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java
index fe6faf5dbc..d7b386ef7b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java
@@ -1,263 +1,263 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCollapseDummyFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreRenameAClassFeature;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreImageProvider;
-
-import org.eclipse.graphiti.dt.IDiagramTypeProvider;
-import org.eclipse.graphiti.features.ICreateConnectionFeature;
-import org.eclipse.graphiti.features.context.IDoubleClickContext;
-import org.eclipse.graphiti.features.context.IPictogramElementContext;
-import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
-import org.eclipse.graphiti.features.context.impl.CustomContext;
-import org.eclipse.graphiti.features.custom.ICustomFeature;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.tb.ContextButtonEntry;
-import org.eclipse.graphiti.tb.ContextEntryHelper;
-import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider;
-import org.eclipse.graphiti.tb.IContextButtonEntry;
-import org.eclipse.graphiti.tb.IContextButtonPadData;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreToolBehaviorProvider extends DefaultToolBehaviorProvider
-{
- public AcoreToolBehaviorProvider(IDiagramTypeProvider dtp)
- {
- super(dtp);
- }
-
- @Override
- public IContextButtonPadData getContextButtonPad(IPictogramElementContext context)
- {
- IContextButtonPadData data = super.getContextButtonPad(context);
- PictogramElement pe = context.getPictogramElement();
-
- // 1. set the generic context buttons
- // note, that we do not add 'remove' (just as an example)
- setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE | CONTEXT_BUTTON_UPDATE);
-
- // 2. set the collapse button
- // simply use a dummy custom feature (senseless example)
- CustomContext cc = new CustomContext(new PictogramElement[] { pe });
- ICustomFeature[] cf = getFeatureProvider().getCustomFeatures(cc);
- for (int i = 0; i < cf.length; i++)
- {
- ICustomFeature iCustomFeature = cf[i];
- if (iCustomFeature instanceof AcoreCollapseDummyFeature)
- {
- IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true, iCustomFeature, cc);
- data.setCollapseContextButton(collapseButton);
- break;
- }
- }
-
- // 3. add one domain specific context-button, which offers all
- // available connection-features as drag&drop features...
-
- // 3.a. create new CreateConnectionContext
- CreateConnectionContext ccc = new CreateConnectionContext();
- ccc.setSourcePictogramElement(pe);
- Anchor anchor = null;
- if (pe instanceof Anchor)
- {
- anchor = (Anchor)pe;
- }
- else if (pe instanceof AnchorContainer)
- {
- // assume, that our shapes always have chopbox anchors
- anchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer)pe);
- }
- ccc.setSourceAnchor(anchor);
-
- // 3.b. create context button and add all applicable features
- ContextButtonEntry button = new ContextButtonEntry(null, context);
- button.setText("Create connection"); //$NON-NLS-1$
- button.setIconId(AcoreImageProvider.IMG_EREFERENCE);
- ICreateConnectionFeature[] features = getFeatureProvider().getCreateConnectionFeatures();
- for (ICreateConnectionFeature feature : features)
- {
- if (feature.isAvailable(ccc) && feature.canStartConnection(ccc))
- {
- button.addDragAndDropFeature(feature);
- }
- }
-
- // 3.c. add context button, if it contains at least one feature
- if (button.getDragAndDropFeatures().size() > 0)
- {
- data.getDomainSpecificContextButtons().add(button);
- }
-
- return data;
- }
-
- //
- // @Override
- // public IContextMenuEntry[] getContextMenu(ICustomContext context)
- // {
- // // create a sub-menu for all custom features
- // ContextMenuEntry subMenu = new ContextMenuEntry(null, context);
- // subMenu.setText("Cu&stom"); //$NON-NLS-1$
- // subMenu.setDescription("Custom features submenu"); //$NON-NLS-1$
- // // display sub-menu hierarchical or flat
- // subMenu.setSubmenu(true);
- //
- // // create a menu-entry in the sub-menu for each custom feature
- // ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
- // for (int i = 0; i < customFeatures.length; i++)
- // {
- // ICustomFeature customFeature = customFeatures[i];
- // if (customFeature.isAvailable(context))
- // {
- // ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature, context);
- // subMenu.add(menuEntry);
- // }
- // }
- //
- // IContextMenuEntry ret[] = new IContextMenuEntry[] { subMenu };
- // return ret;
- // }
- //
- // @Override
- // public IPaletteCompartmentEntry[] getPalette()
- // {
- // List<IPaletteCompartmentEntry> ret = new ArrayList<IPaletteCompartmentEntry>();
- //
- // // add compartments from super class
- // IPaletteCompartmentEntry[] superCompartments = super.getPalette();
- // for (int i = 0; i < superCompartments.length; i++)
- // {
- // ret.add(superCompartments[i]);
- // }
- //
- // // add new compartment at the end of the existing compartments
- // PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Stacked", null); //$NON-NLS-1$
- // ret.add(compartmentEntry);
- //
- // // add new stack entry to new compartment
- // StackEntry stackEntry = new StackEntry("EObject", "EObject", null); //$NON-NLS-1$ //$NON-NLS-2$
- // compartmentEntry.addToolEntry(stackEntry);
- //
- // // add all create-features to the new stack-entry
- // IFeatureProvider featureProvider = getFeatureProvider();
- // ICreateFeature[] createFeatures = featureProvider.getCreateFeatures();
- // for (ICreateFeature cf : createFeatures)
- // {
- // ObjectCreationToolEntry objectCreationToolEntry = new ObjectCreationToolEntry(cf.getCreateName(),
- // cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId(), cf);
- //
- // stackEntry.addCreationToolEntry(objectCreationToolEntry);
- // }
- //
- // // add all create-connection-features to the new stack-entry
- // ICreateConnectionFeature[] createConnectionFeatures = featureProvider.getCreateConnectionFeatures();
- // for (ICreateConnectionFeature cf : createConnectionFeatures)
- // {
- // ConnectionCreationToolEntry connectionCreationToolEntry = new ConnectionCreationToolEntry(cf.getCreateName(),
- // cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId());
- // connectionCreationToolEntry.addCreateConnectionFeature(cf);
- // stackEntry.addCreationToolEntry(connectionCreationToolEntry);
- // }
- //
- // return ret.toArray(new IPaletteCompartmentEntry[ret.size()]);
- // }
- //
-
- @Override
- public ICustomFeature getDoubleClickFeature(IDoubleClickContext context)
- {
- ICustomFeature customFeature = new AcoreRenameAClassFeature(getFeatureProvider());
- // canExecute() tests especially if the context contains a AClass
- if (customFeature.canExecute(context))
- {
- return customFeature;
- }
-
- return super.getDoubleClickFeature(context);
- }
- //
- // @Override
- // public IDecorator[] getDecorators(PictogramElement pe)
- // {
- // IFeatureProvider featureProvider = getFeatureProvider();
- // Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
- // if (bo instanceof AClass)
- // {
- // AClass AClass = (AClass)bo;
- // String name = AClass.getName();
- // if (name != null && name.length() > 0 && !(name.charAt(0) >= 'A' && name.charAt(0) <= 'Z'))
- // {
- // IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_WARNING_TSK);
- // imageRenderingDecorator.setMessage("Name should start with upper case letter"); //$NON-NLS-1$
- // return new IDecorator[] { imageRenderingDecorator };
- // }
- // }
- //
- // return super.getDecorators(pe);
- // }
- //
- // @Override
- // public GraphicsAlgorithm[] getClickArea(PictogramElement pe)
- // {
- // IFeatureProvider featureProvider = getFeatureProvider();
- // Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
- // if (bo instanceof AClass)
- // {
- // GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
- // GraphicsAlgorithm rectangle = invisible.getGraphicsAlgorithmChildren().get(0);
- // return new GraphicsAlgorithm[] { rectangle };
- // }
- // return super.getClickArea(pe);
- // }
- //
- // @Override
- // public GraphicsAlgorithm getSelectionBorder(PictogramElement pe)
- // {
- // if (pe instanceof ContainerShape)
- // {
- // GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
- // if (!invisible.getLineVisible())
- // {
- // EList<GraphicsAlgorithm> graphicsAlgorithmChildren = invisible.getGraphicsAlgorithmChildren();
- // if (!graphicsAlgorithmChildren.isEmpty())
- // {
- // return graphicsAlgorithmChildren.get(0);
- // }
- // }
- // }
- // return super.getSelectionBorder(pe);
- // }
- //
- // @Override
- // public String getToolTip(GraphicsAlgorithm ga)
- // {
- // PictogramElement pe = ga.getPictogramElement();
- // Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe);
- // if (bo instanceof AClass)
- // {
- // String name = ((AClass)bo).getName();
- // if (name != null && !name.equals(""))
- // {
- // return name;
- // }
- // }
- // return super.getToolTip(ga);
- // }
-
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.diagram;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCollapseDummyFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreRenameAClassFeature;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreImageProvider;
+
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.context.IDoubleClickContext;
+import org.eclipse.graphiti.features.context.IPictogramElementContext;
+import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.CustomContext;
+import org.eclipse.graphiti.features.custom.ICustomFeature;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.tb.ContextButtonEntry;
+import org.eclipse.graphiti.tb.ContextEntryHelper;
+import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider;
+import org.eclipse.graphiti.tb.IContextButtonEntry;
+import org.eclipse.graphiti.tb.IContextButtonPadData;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreToolBehaviorProvider extends DefaultToolBehaviorProvider
+{
+ public AcoreToolBehaviorProvider(IDiagramTypeProvider dtp)
+ {
+ super(dtp);
+ }
+
+ @Override
+ public IContextButtonPadData getContextButtonPad(IPictogramElementContext context)
+ {
+ IContextButtonPadData data = super.getContextButtonPad(context);
+ PictogramElement pe = context.getPictogramElement();
+
+ // 1. set the generic context buttons
+ // note, that we do not add 'remove' (just as an example)
+ setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE | CONTEXT_BUTTON_UPDATE);
+
+ // 2. set the collapse button
+ // simply use a dummy custom feature (senseless example)
+ CustomContext cc = new CustomContext(new PictogramElement[] { pe });
+ ICustomFeature[] cf = getFeatureProvider().getCustomFeatures(cc);
+ for (int i = 0; i < cf.length; i++)
+ {
+ ICustomFeature iCustomFeature = cf[i];
+ if (iCustomFeature instanceof AcoreCollapseDummyFeature)
+ {
+ IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true, iCustomFeature, cc);
+ data.setCollapseContextButton(collapseButton);
+ break;
+ }
+ }
+
+ // 3. add one domain specific context-button, which offers all
+ // available connection-features as drag&drop features...
+
+ // 3.a. create new CreateConnectionContext
+ CreateConnectionContext ccc = new CreateConnectionContext();
+ ccc.setSourcePictogramElement(pe);
+ Anchor anchor = null;
+ if (pe instanceof Anchor)
+ {
+ anchor = (Anchor)pe;
+ }
+ else if (pe instanceof AnchorContainer)
+ {
+ // assume, that our shapes always have chopbox anchors
+ anchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer)pe);
+ }
+ ccc.setSourceAnchor(anchor);
+
+ // 3.b. create context button and add all applicable features
+ ContextButtonEntry button = new ContextButtonEntry(null, context);
+ button.setText("Create connection"); //$NON-NLS-1$
+ button.setIconId(AcoreImageProvider.IMG_EREFERENCE);
+ ICreateConnectionFeature[] features = getFeatureProvider().getCreateConnectionFeatures();
+ for (ICreateConnectionFeature feature : features)
+ {
+ if (feature.isAvailable(ccc) && feature.canStartConnection(ccc))
+ {
+ button.addDragAndDropFeature(feature);
+ }
+ }
+
+ // 3.c. add context button, if it contains at least one feature
+ if (button.getDragAndDropFeatures().size() > 0)
+ {
+ data.getDomainSpecificContextButtons().add(button);
+ }
+
+ return data;
+ }
+
+ //
+ // @Override
+ // public IContextMenuEntry[] getContextMenu(ICustomContext context)
+ // {
+ // // create a sub-menu for all custom features
+ // ContextMenuEntry subMenu = new ContextMenuEntry(null, context);
+ // subMenu.setText("Cu&stom"); //$NON-NLS-1$
+ // subMenu.setDescription("Custom features submenu"); //$NON-NLS-1$
+ // // display sub-menu hierarchical or flat
+ // subMenu.setSubmenu(true);
+ //
+ // // create a menu-entry in the sub-menu for each custom feature
+ // ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
+ // for (int i = 0; i < customFeatures.length; i++)
+ // {
+ // ICustomFeature customFeature = customFeatures[i];
+ // if (customFeature.isAvailable(context))
+ // {
+ // ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature, context);
+ // subMenu.add(menuEntry);
+ // }
+ // }
+ //
+ // IContextMenuEntry ret[] = new IContextMenuEntry[] { subMenu };
+ // return ret;
+ // }
+ //
+ // @Override
+ // public IPaletteCompartmentEntry[] getPalette()
+ // {
+ // List<IPaletteCompartmentEntry> ret = new ArrayList<IPaletteCompartmentEntry>();
+ //
+ // // add compartments from super class
+ // IPaletteCompartmentEntry[] superCompartments = super.getPalette();
+ // for (int i = 0; i < superCompartments.length; i++)
+ // {
+ // ret.add(superCompartments[i]);
+ // }
+ //
+ // // add new compartment at the end of the existing compartments
+ // PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Stacked", null); //$NON-NLS-1$
+ // ret.add(compartmentEntry);
+ //
+ // // add new stack entry to new compartment
+ // StackEntry stackEntry = new StackEntry("EObject", "EObject", null); //$NON-NLS-1$ //$NON-NLS-2$
+ // compartmentEntry.addToolEntry(stackEntry);
+ //
+ // // add all create-features to the new stack-entry
+ // IFeatureProvider featureProvider = getFeatureProvider();
+ // ICreateFeature[] createFeatures = featureProvider.getCreateFeatures();
+ // for (ICreateFeature cf : createFeatures)
+ // {
+ // ObjectCreationToolEntry objectCreationToolEntry = new ObjectCreationToolEntry(cf.getCreateName(),
+ // cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId(), cf);
+ //
+ // stackEntry.addCreationToolEntry(objectCreationToolEntry);
+ // }
+ //
+ // // add all create-connection-features to the new stack-entry
+ // ICreateConnectionFeature[] createConnectionFeatures = featureProvider.getCreateConnectionFeatures();
+ // for (ICreateConnectionFeature cf : createConnectionFeatures)
+ // {
+ // ConnectionCreationToolEntry connectionCreationToolEntry = new ConnectionCreationToolEntry(cf.getCreateName(),
+ // cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId());
+ // connectionCreationToolEntry.addCreateConnectionFeature(cf);
+ // stackEntry.addCreationToolEntry(connectionCreationToolEntry);
+ // }
+ //
+ // return ret.toArray(new IPaletteCompartmentEntry[ret.size()]);
+ // }
+ //
+
+ @Override
+ public ICustomFeature getDoubleClickFeature(IDoubleClickContext context)
+ {
+ ICustomFeature customFeature = new AcoreRenameAClassFeature(getFeatureProvider());
+ // canExecute() tests especially if the context contains a AClass
+ if (customFeature.canExecute(context))
+ {
+ return customFeature;
+ }
+
+ return super.getDoubleClickFeature(context);
+ }
+ //
+ // @Override
+ // public IDecorator[] getDecorators(PictogramElement pe)
+ // {
+ // IFeatureProvider featureProvider = getFeatureProvider();
+ // Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
+ // if (bo instanceof AClass)
+ // {
+ // AClass AClass = (AClass)bo;
+ // String name = AClass.getName();
+ // if (name != null && name.length() > 0 && !(name.charAt(0) >= 'A' && name.charAt(0) <= 'Z'))
+ // {
+ // IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_WARNING_TSK);
+ // imageRenderingDecorator.setMessage("Name should start with upper case letter"); //$NON-NLS-1$
+ // return new IDecorator[] { imageRenderingDecorator };
+ // }
+ // }
+ //
+ // return super.getDecorators(pe);
+ // }
+ //
+ // @Override
+ // public GraphicsAlgorithm[] getClickArea(PictogramElement pe)
+ // {
+ // IFeatureProvider featureProvider = getFeatureProvider();
+ // Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
+ // if (bo instanceof AClass)
+ // {
+ // GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
+ // GraphicsAlgorithm rectangle = invisible.getGraphicsAlgorithmChildren().get(0);
+ // return new GraphicsAlgorithm[] { rectangle };
+ // }
+ // return super.getClickArea(pe);
+ // }
+ //
+ // @Override
+ // public GraphicsAlgorithm getSelectionBorder(PictogramElement pe)
+ // {
+ // if (pe instanceof ContainerShape)
+ // {
+ // GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
+ // if (!invisible.getLineVisible())
+ // {
+ // EList<GraphicsAlgorithm> graphicsAlgorithmChildren = invisible.getGraphicsAlgorithmChildren();
+ // if (!graphicsAlgorithmChildren.isEmpty())
+ // {
+ // return graphicsAlgorithmChildren.get(0);
+ // }
+ // }
+ // }
+ // return super.getSelectionBorder(pe);
+ // }
+ //
+ // @Override
+ // public String getToolTip(GraphicsAlgorithm ga)
+ // {
+ // PictogramElement pe = ga.getPictogramElement();
+ // Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe);
+ // if (bo instanceof AClass)
+ // {
+ // String name = ((AClass)bo).getName();
+ // if (name != null && !name.equals(""))
+ // {
+ // return name;
+ // }
+ // }
+ // return super.getToolTip(ga);
+ // }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java
index ed898ad919..e2a45c275a 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.algorithms.styles.Color;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.util.ColorConstant;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddAClassFeature extends AcoreBasicAddElementFeature
-{
- private static final IColorConstant CLASS_TEXT_FOREGROUND = new ColorConstant(51, 51, 153);
-
- private static final IColorConstant CLASS_FOREGROUND = new ColorConstant(150, 150, 255);
-
- private static final IColorConstant CLASS_BACKGROUND = new ColorConstant(230, 230, 255);
-
- public AcoreAddAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- // check if user wants to add a AClass
- if (context.getNewObject() instanceof AClass)
- {
- // check if user wants to add to a diagram
- if (context.getTargetContainer() instanceof Diagram)
- {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected Color getBackgroundColor()
- {
- return manageColor(CLASS_BACKGROUND);
- }
-
- @Override
- protected Color getForegroundColor()
- {
- return manageColor(CLASS_FOREGROUND);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.util.ColorConstant;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddAClassFeature extends AcoreBasicAddElementFeature
+{
+ private static final IColorConstant CLASS_TEXT_FOREGROUND = new ColorConstant(51, 51, 153);
+
+ private static final IColorConstant CLASS_FOREGROUND = new ColorConstant(150, 150, 255);
+
+ private static final IColorConstant CLASS_BACKGROUND = new ColorConstant(230, 230, 255);
+
+ public AcoreAddAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ // check if user wants to add a AClass
+ if (context.getNewObject() instanceof AClass)
+ {
+ // check if user wants to add to a diagram
+ if (context.getTargetContainer() instanceof Diagram)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected Color getBackgroundColor()
+ {
+ return manageColor(CLASS_BACKGROUND);
+ }
+
+ @Override
+ protected Color getForegroundColor()
+ {
+ return manageColor(CLASS_FOREGROUND);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java
index a5f4905555..72ad983b94 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.algorithms.styles.Color;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.util.ColorConstant;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddAInterfaceFeature extends AcoreBasicAddElementFeature
-{
- private static final IColorConstant CLASS_TEXT_FOREGROUND = new ColorConstant(51, 51, 153);
-
- private static final IColorConstant CLASS_FOREGROUND = new ColorConstant(150, 150, 255);
-
- private static final IColorConstant CLASS_BACKGROUND = new ColorConstant(255, 255, 190);
-
- public AcoreAddAInterfaceFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- // check if user wants to add a AClass
- if (context.getNewObject() instanceof AInterface)
- {
- // check if user wants to add to a diagram
- if (context.getTargetContainer() instanceof Diagram)
- {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected Color getBackgroundColor()
- {
- return manageColor(CLASS_BACKGROUND);
- }
-
- @Override
- protected Color getForegroundColor()
- {
- return manageColor(CLASS_FOREGROUND);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.util.ColorConstant;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddAInterfaceFeature extends AcoreBasicAddElementFeature
+{
+ private static final IColorConstant CLASS_TEXT_FOREGROUND = new ColorConstant(51, 51, 153);
+
+ private static final IColorConstant CLASS_FOREGROUND = new ColorConstant(150, 150, 255);
+
+ private static final IColorConstant CLASS_BACKGROUND = new ColorConstant(255, 255, 190);
+
+ public AcoreAddAInterfaceFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ // check if user wants to add a AClass
+ if (context.getNewObject() instanceof AInterface)
+ {
+ // check if user wants to add to a diagram
+ if (context.getTargetContainer() instanceof Diagram)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected Color getBackgroundColor()
+ {
+ return manageColor(CLASS_BACKGROUND);
+ }
+
+ @Override
+ protected Color getForegroundColor()
+ {
+ return manageColor(CLASS_FOREGROUND);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java
index 4afcf4ee16..7309aaa1d8 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polygon;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddAggregationFeature extends AcoreBasicAddConnectionFeature
-{
- public AcoreAddAggregationFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
- }
-
- @Override
- protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
- {
- IGaService gaService = Graphiti.getGaService();
- Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -30, 0, -15, 10, 0, 0, -15, -10, -30, 0 });
-
- polygon.setForeground(manageColor(IColorConstant.BLACK));
- polygon.setBackground(manageColor(IColorConstant.WHITE));
- polygon.setLineWidth(2);
- return polygon;
- }
-
- @Override
- protected String getConnectionLabel()
- {
- return "association";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddAggregationFeature extends AcoreBasicAddConnectionFeature
+{
+ public AcoreAddAggregationFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
+ }
+
+ @Override
+ protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
+ {
+ IGaService gaService = Graphiti.getGaService();
+ Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -30, 0, -15, 10, 0, 0, -15, -10, -30, 0 });
+
+ polygon.setForeground(manageColor(IColorConstant.BLACK));
+ polygon.setBackground(manageColor(IColorConstant.WHITE));
+ polygon.setLineWidth(2);
+ return polygon;
+ }
+
+ @Override
+ protected String getConnectionLabel()
+ {
+ return "association";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java
index 9fef239ca8..0d3f619240 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddAssociationFeature extends AcoreBasicAddConnectionFeature
-{
- public AcoreAddAssociationFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
- }
-
- @Override
- protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
- {
- return null;
- }
-
- @Override
- protected String getConnectionLabel()
- {
- return "association";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddAssociationFeature extends AcoreBasicAddConnectionFeature
+{
+ public AcoreAddAssociationFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
+ }
+
+ @Override
+ protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
+ {
+ return null;
+ }
+
+ @Override
+ protected String getConnectionLabel()
+ {
+ return "association";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java
index 9c7944e18d..01ddf852ac 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polygon;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddCompositionFeature extends AcoreBasicAddConnectionFeature
-{
- public AcoreAddCompositionFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
- }
-
- @Override
- protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
- {
- IGaService gaService = Graphiti.getGaService();
- Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -30, 0, -15, 10, 0, 0, -15, -10, -30, 0 });
-
- polygon.setForeground(manageColor(IColorConstant.BLACK));
- polygon.setBackground(manageColor(IColorConstant.BLACK));
- polygon.setLineWidth(2);
- return polygon;
- }
-
- @Override
- protected String getConnectionLabel()
- {
- return "composition";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddCompositionFeature extends AcoreBasicAddConnectionFeature
+{
+ public AcoreAddCompositionFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
+ }
+
+ @Override
+ protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
+ {
+ IGaService gaService = Graphiti.getGaService();
+ Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -30, 0, -15, 10, 0, 0, -15, -10, -30, 0 });
+
+ polygon.setForeground(manageColor(IColorConstant.BLACK));
+ polygon.setBackground(manageColor(IColorConstant.BLACK));
+ polygon.setLineWidth(2);
+ return polygon;
+ }
+
+ @Override
+ protected String getConnectionLabel()
+ {
+ return "composition";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java
index fd2027d04c..9b59909959 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java
@@ -1,56 +1,56 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddImplementationFeature extends AcoreBasicAddConnectionFeature
-{
- public AcoreAddImplementationFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- return context instanceof IAddConnectionContext && context.getNewObject() instanceof ABasicClass;
- }
-
- @Override
- protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
- {
- IGaService gaService = Graphiti.getGaService();
- Polyline polyline = gaService.createPolyline(gaContainer, new int[] { -15, 10, 0, 0, -15, -10 });
- polyline.setForeground(manageColor(IColorConstant.BLACK));
- polyline.setLineWidth(2);
- return polyline;
- }
-
- @Override
- protected String getConnectionLabel()
- {
- return "implements";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddImplementationFeature extends AcoreBasicAddConnectionFeature
+{
+ public AcoreAddImplementationFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ return context instanceof IAddConnectionContext && context.getNewObject() instanceof ABasicClass;
+ }
+
+ @Override
+ protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
+ {
+ IGaService gaService = Graphiti.getGaService();
+ Polyline polyline = gaService.createPolyline(gaContainer, new int[] { -15, 10, 0, 0, -15, -10 });
+ polyline.setForeground(manageColor(IColorConstant.BLACK));
+ polyline.setLineWidth(2);
+ return polyline;
+ }
+
+ @Override
+ protected String getConnectionLabel()
+ {
+ return "implements";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java
index abc0979742..c9c99d8fa7 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polygon;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreAddSubClassesFeature extends AcoreBasicAddConnectionFeature
-{
- public AcoreAddSubClassesFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canAdd(IAddContext context)
- {
- return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
- }
-
- @Override
- protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
- {
- IGaService gaService = Graphiti.getGaService();
- Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -15, 10, 0, 0, -15, -10 });
-
- polygon.setForeground(manageColor(IColorConstant.BLACK));
- polygon.setBackground(manageColor(IColorConstant.WHITE));
- polygon.setLineWidth(2);
- return polygon;
- }
-
- @Override
- protected String getConnectionLabel()
- {
- return "extends";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreAddSubClassesFeature extends AcoreBasicAddConnectionFeature
+{
+ public AcoreAddSubClassesFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canAdd(IAddContext context)
+ {
+ return context instanceof IAddConnectionContext && context.getNewObject() instanceof AClass;
+ }
+
+ @Override
+ protected Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer)
+ {
+ IGaService gaService = Graphiti.getGaService();
+ Polygon polygon = gaService.createPolygon(gaContainer, new int[] { -15, 10, 0, 0, -15, -10 });
+
+ polygon.setForeground(manageColor(IColorConstant.BLACK));
+ polygon.setBackground(manageColor(IColorConstant.WHITE));
+ polygon.setLineWidth(2);
+ return polygon;
+ }
+
+ @Override
+ protected String getConnectionLabel()
+ {
+ return "extends";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java
index 12f9582483..c4dc0ef222 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java
@@ -1,81 +1,81 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddConnectionContext;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.features.impl.AbstractAddFeature;
-import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.mm.algorithms.Text;
-import org.eclipse.graphiti.mm.pictograms.Connection;
-import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.services.IPeCreateService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class AcoreBasicAddConnectionFeature extends AbstractAddFeature
-{
- public AcoreBasicAddConnectionFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public PictogramElement add(IAddContext context)
- {
- IAddConnectionContext addConContext = (IAddConnectionContext)context;
- // EReference addedEReference = (EReference)context.getNewObject();
- EObject addedObject = (EObject)context.getNewObject();
- IPeCreateService peCreateService = Graphiti.getPeCreateService();
-
- // CONNECTION WITH POLYLINE
- Connection connection = peCreateService.createFreeFormConnection(getDiagram());
- connection.setStart(addConContext.getSourceAnchor());
- connection.setEnd(addConContext.getTargetAnchor());
-
- IGaService gaService = Graphiti.getGaService();
- Polyline polyline = gaService.createPolyline(connection);
- polyline.setLineWidth(2);
- polyline.setForeground(manageColor(IColorConstant.BLACK));
-
- // we need to put in an object, otherwise the line will be marked dotted
- // link(connection, addedObject);
-
- ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
-
- Text text = gaService.createDefaultText(getDiagram(), textDecorator);
-
- text.setForeground(manageColor(IColorConstant.BLACK));
- gaService.setLocation(text, 10, 0);
-
- text.setValue(getConnectionLabel());
-
- ConnectionDecorator cd;
- cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
- createTargetDecoration(cd);
- return connection;
- }
-
- protected abstract String getConnectionLabel();
-
- public abstract boolean canAdd(IAddContext context);
-
- protected abstract Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddConnectionContext;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.impl.AbstractAddFeature;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeCreateService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class AcoreBasicAddConnectionFeature extends AbstractAddFeature
+{
+ public AcoreBasicAddConnectionFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public PictogramElement add(IAddContext context)
+ {
+ IAddConnectionContext addConContext = (IAddConnectionContext)context;
+ // EReference addedEReference = (EReference)context.getNewObject();
+ EObject addedObject = (EObject)context.getNewObject();
+ IPeCreateService peCreateService = Graphiti.getPeCreateService();
+
+ // CONNECTION WITH POLYLINE
+ Connection connection = peCreateService.createFreeFormConnection(getDiagram());
+ connection.setStart(addConContext.getSourceAnchor());
+ connection.setEnd(addConContext.getTargetAnchor());
+
+ IGaService gaService = Graphiti.getGaService();
+ Polyline polyline = gaService.createPolyline(connection);
+ polyline.setLineWidth(2);
+ polyline.setForeground(manageColor(IColorConstant.BLACK));
+
+ // we need to put in an object, otherwise the line will be marked dotted
+ // link(connection, addedObject);
+
+ ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
+
+ Text text = gaService.createDefaultText(getDiagram(), textDecorator);
+
+ text.setForeground(manageColor(IColorConstant.BLACK));
+ gaService.setLocation(text, 10, 0);
+
+ text.setValue(getConnectionLabel());
+
+ ConnectionDecorator cd;
+ cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
+ createTargetDecoration(cd);
+ return connection;
+ }
+
+ protected abstract String getConnectionLabel();
+
+ public abstract boolean canAdd(IAddContext context);
+
+ protected abstract Polyline createTargetDecoration(GraphicsAlgorithmContainer gaContainer);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java
index 80064f4829..2ba65b865b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java
@@ -1,168 +1,168 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
-
-import org.eclipse.graphiti.features.IDirectEditingInfo;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.features.impl.AbstractAddShapeFeature;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.mm.algorithms.Rectangle;
-import org.eclipse.graphiti.mm.algorithms.RoundedRectangle;
-import org.eclipse.graphiti.mm.algorithms.Text;
-import org.eclipse.graphiti.mm.algorithms.styles.Color;
-import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
-import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.services.IPeCreateService;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class AcoreBasicAddElementFeature extends AbstractAddShapeFeature
-{
- public AcoreBasicAddElementFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public abstract boolean canAdd(IAddContext context);
-
- protected abstract Color getBackgroundColor();
-
- protected abstract Color getForegroundColor();
-
- public PictogramElement add(IAddContext context)
- {
- ABasicClass addedClass = (ABasicClass)context.getNewObject();
- Diagram targetDiagram = (Diagram)context.getTargetContainer();
-
- // CONTAINER SHAPE WITH ROUNDED RECTANGLE
- IPeCreateService peCreateService = Graphiti.getPeCreateService();
- // define a default size for the shape
- int width = 100;
- int height = 50;
- IGaService gaService = Graphiti.getGaService();
-
- addToResourceIfNeeded(addedClass);
-
- ContainerShape containerShape = createContainerShape(context, addedClass, targetDiagram, peCreateService, width,
- height, gaService);
-
- return containerShape;
- }
-
- private ContainerShape createContainerShape(IAddContext context, ABasicClass addedClass, Diagram targetDiagram,
- IPeCreateService peCreateService, int width, int height, IGaService gaService)
- {
- ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);
- // create and set graphics algorithm
- RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(containerShape, 5, 5);
- roundedRectangle.setForeground(getForegroundColor());
- roundedRectangle.setBackground(getBackgroundColor());
- roundedRectangle.setLineWidth(2);
- gaService.setLocationAndSize(roundedRectangle, context.getX(), context.getY(), width, height);
-
- // create link and wire it
- link(containerShape, addedClass);
-
- // SHAPE WITH LINE
- {
- // create shape for line
- Shape shape = peCreateService.createShape(containerShape, false);
-
- // create and set graphics algorithm
- Polyline polyline = gaService.createPolyline(shape, new int[] { 0, 20, width, 20 });
- polyline.setForeground(getForegroundColor());
- polyline.setLineWidth(2);
- }
-
- // SHAPE WITH TEXT
- {
- // create shape for text
- final Shape shape = peCreateService.createShape(containerShape, false);
-
- // create and set text graphics algorithm
- final Text text = gaService.createText(shape, addedClass.getName());
- // text.setStyle(StyleUtil.getStyleForAClassText(getDiagram()));
- text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
- text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
- gaService.setLocationAndSize(text, 0, 0, width, 20);
-
- // create link and wire it
- link(shape, addedClass);
-
- activateDirectEditing(containerShape, shape, text);
- }
-
- // add a chopbox anchor to the shape
- peCreateService.createChopboxAnchor(containerShape);
-
- // create an additional box relative anchor at middle-right
- final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
-
- boxAnchor.setRelativeWidth(1.0);
- boxAnchor.setRelativeHeight(0.5);
-
- // anchor references visible rectangle instead of invisible rectangle
- boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);
-
- // assign a graphics algorithm for the box relative anchor
- Rectangle rectangle = gaService.createRectangle(boxAnchor);
- rectangle.setFilled(true);
-
- // anchor is located on the right border of the visible rectangle
- // and touches the border of the invisible rectangle
-
- int w = 6;
- gaService.setLocationAndSize(rectangle, -2 * w, -w, 2 * w, 2 * w);
- rectangle.setForeground(getForegroundColor());
- rectangle.setBackground(getBackgroundColor());
-
- // call the layout feature
- layoutPictogramElement(containerShape);
- return containerShape;
- }
-
- private void activateDirectEditing(ContainerShape containerShape, final Shape shape, final Text text)
- {
- // provide information to support direct-editing directly
- // after object creation (must be activated additionally)
- final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
- // set container shape for direct editing after object creation
- directEditingInfo.setMainPictogramElement(containerShape);
- // set shape and graphics algorithm where the editor for
- // direct editing shall be opened after object creation
- directEditingInfo.setPictogramElement(shape);
- directEditingInfo.setGraphicsAlgorithm(text);
- }
-
- private void addToResourceIfNeeded(ABasicClass addedClass)
- {
- // if added Class has no resource we add it to the resource
- // of the diagram
- // in a real scenario the business model would have its own resource
- if (addedClass.eResource() == null)
- {
- // getDiagram().eResource().getContents().add(addedClass);
- DawnGraphitiAcoreResourceUtil.addToModelResource(addedClass, getDiagram().eResource().getResourceSet());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
+
+import org.eclipse.graphiti.features.IDirectEditingInfo;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.impl.AbstractAddShapeFeature;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.algorithms.RoundedRectangle;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeCreateService;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class AcoreBasicAddElementFeature extends AbstractAddShapeFeature
+{
+ public AcoreBasicAddElementFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public abstract boolean canAdd(IAddContext context);
+
+ protected abstract Color getBackgroundColor();
+
+ protected abstract Color getForegroundColor();
+
+ public PictogramElement add(IAddContext context)
+ {
+ ABasicClass addedClass = (ABasicClass)context.getNewObject();
+ Diagram targetDiagram = (Diagram)context.getTargetContainer();
+
+ // CONTAINER SHAPE WITH ROUNDED RECTANGLE
+ IPeCreateService peCreateService = Graphiti.getPeCreateService();
+ // define a default size for the shape
+ int width = 100;
+ int height = 50;
+ IGaService gaService = Graphiti.getGaService();
+
+ addToResourceIfNeeded(addedClass);
+
+ ContainerShape containerShape = createContainerShape(context, addedClass, targetDiagram, peCreateService, width,
+ height, gaService);
+
+ return containerShape;
+ }
+
+ private ContainerShape createContainerShape(IAddContext context, ABasicClass addedClass, Diagram targetDiagram,
+ IPeCreateService peCreateService, int width, int height, IGaService gaService)
+ {
+ ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);
+ // create and set graphics algorithm
+ RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(containerShape, 5, 5);
+ roundedRectangle.setForeground(getForegroundColor());
+ roundedRectangle.setBackground(getBackgroundColor());
+ roundedRectangle.setLineWidth(2);
+ gaService.setLocationAndSize(roundedRectangle, context.getX(), context.getY(), width, height);
+
+ // create link and wire it
+ link(containerShape, addedClass);
+
+ // SHAPE WITH LINE
+ {
+ // create shape for line
+ Shape shape = peCreateService.createShape(containerShape, false);
+
+ // create and set graphics algorithm
+ Polyline polyline = gaService.createPolyline(shape, new int[] { 0, 20, width, 20 });
+ polyline.setForeground(getForegroundColor());
+ polyline.setLineWidth(2);
+ }
+
+ // SHAPE WITH TEXT
+ {
+ // create shape for text
+ final Shape shape = peCreateService.createShape(containerShape, false);
+
+ // create and set text graphics algorithm
+ final Text text = gaService.createText(shape, addedClass.getName());
+ // text.setStyle(StyleUtil.getStyleForAClassText(getDiagram()));
+ text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
+ text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
+ gaService.setLocationAndSize(text, 0, 0, width, 20);
+
+ // create link and wire it
+ link(shape, addedClass);
+
+ activateDirectEditing(containerShape, shape, text);
+ }
+
+ // add a chopbox anchor to the shape
+ peCreateService.createChopboxAnchor(containerShape);
+
+ // create an additional box relative anchor at middle-right
+ final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
+
+ boxAnchor.setRelativeWidth(1.0);
+ boxAnchor.setRelativeHeight(0.5);
+
+ // anchor references visible rectangle instead of invisible rectangle
+ boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);
+
+ // assign a graphics algorithm for the box relative anchor
+ Rectangle rectangle = gaService.createRectangle(boxAnchor);
+ rectangle.setFilled(true);
+
+ // anchor is located on the right border of the visible rectangle
+ // and touches the border of the invisible rectangle
+
+ int w = 6;
+ gaService.setLocationAndSize(rectangle, -2 * w, -w, 2 * w, 2 * w);
+ rectangle.setForeground(getForegroundColor());
+ rectangle.setBackground(getBackgroundColor());
+
+ // call the layout feature
+ layoutPictogramElement(containerShape);
+ return containerShape;
+ }
+
+ private void activateDirectEditing(ContainerShape containerShape, final Shape shape, final Text text)
+ {
+ // provide information to support direct-editing directly
+ // after object creation (must be activated additionally)
+ final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
+ // set container shape for direct editing after object creation
+ directEditingInfo.setMainPictogramElement(containerShape);
+ // set shape and graphics algorithm where the editor for
+ // direct editing shall be opened after object creation
+ directEditingInfo.setPictogramElement(shape);
+ directEditingInfo.setGraphicsAlgorithm(text);
+ }
+
+ private void addToResourceIfNeeded(ABasicClass addedClass)
+ {
+ // if added Class has no resource we add it to the resource
+ // of the diagram
+ // in a real scenario the business model would have its own resource
+ if (addedClass.eResource() == null)
+ {
+ // getDiagram().eResource().getContents().add(addedClass);
+ DawnGraphitiAcoreResourceUtil.addToModelResource(addedClass, getDiagram().eResource().getResourceSet());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java
index 3e3ed0792f..9d819eabff 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java
@@ -1,86 +1,86 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
-import org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-import org.eclipse.graphiti.mm.pictograms.Connection;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class AcoreBasicCreateConnectionFeature extends AbstractCreateConnectionFeature
-{
- public AcoreBasicCreateConnectionFeature(IFeatureProvider fp, String name, String description)
- {
- super(fp, name, description);
- }
-
- public boolean canCreate(ICreateConnectionContext context)
- {
- EObject source = getSource(context.getSourceAnchor());
- EObject target = getTarget(context.getTargetAnchor());
- if (source != null && target != null && source != target)
- {
- return true;
- }
- return false;
- }
-
- public abstract boolean canStartConnection(ICreateConnectionContext context);
-
- public Connection create(ICreateConnectionContext context)
- {
- Connection newConnection = null;
-
- // get AClasses which should be connected
- EObject source = getSource(context.getSourceAnchor());
- EObject target = getTarget(context.getTargetAnchor());
-
- if (source != null && target != null)
- {
- // create new business object
- createConnection(source, target);
- // add connection for business object
- AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(), context.getTargetAnchor());
-
- addContext.putProperty(AcoreGraphitiContextUtil.CONNECTTION_TYPE, getConnectionType());
-
- addContext.setNewObject(source);
- newConnection = (Connection)getFeatureProvider().addIfPossible(addContext);
- }
-
- return newConnection;
- }
-
- protected abstract ConnectionType getConnectionType();
-
- protected abstract EObject getTarget(Anchor targetAnchor);
-
- /**
- * Returns the AClass belonging to the anchor, or null if not available.
- */
- protected abstract EObject getSource(Anchor anchor);
-
- /**
- * Creates a EReference between two AClasses.
- */
- protected abstract void createConnection(EObject source, EObject target);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
+import org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class AcoreBasicCreateConnectionFeature extends AbstractCreateConnectionFeature
+{
+ public AcoreBasicCreateConnectionFeature(IFeatureProvider fp, String name, String description)
+ {
+ super(fp, name, description);
+ }
+
+ public boolean canCreate(ICreateConnectionContext context)
+ {
+ EObject source = getSource(context.getSourceAnchor());
+ EObject target = getTarget(context.getTargetAnchor());
+ if (source != null && target != null && source != target)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public abstract boolean canStartConnection(ICreateConnectionContext context);
+
+ public Connection create(ICreateConnectionContext context)
+ {
+ Connection newConnection = null;
+
+ // get AClasses which should be connected
+ EObject source = getSource(context.getSourceAnchor());
+ EObject target = getTarget(context.getTargetAnchor());
+
+ if (source != null && target != null)
+ {
+ // create new business object
+ createConnection(source, target);
+ // add connection for business object
+ AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(), context.getTargetAnchor());
+
+ addContext.putProperty(AcoreGraphitiContextUtil.CONNECTTION_TYPE, getConnectionType());
+
+ addContext.setNewObject(source);
+ newConnection = (Connection)getFeatureProvider().addIfPossible(addContext);
+ }
+
+ return newConnection;
+ }
+
+ protected abstract ConnectionType getConnectionType();
+
+ protected abstract EObject getTarget(Anchor targetAnchor);
+
+ /**
+ * Returns the AClass belonging to the anchor, or null if not available.
+ */
+ protected abstract EObject getSource(Anchor anchor);
+
+ /**
+ * Creates a EReference between two AClasses.
+ */
+ protected abstract void createConnection(EObject source, EObject target);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java
index 9e3c1dd577..97abf09fe9 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java
@@ -1,60 +1,60 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class AcoreBasicCreateElementFeature extends AbstractCreateFeature
-{
- public AcoreBasicCreateElementFeature(IFeatureProvider fp, String name, String description)
- {
- super(fp, name, description);
- }
-
- public boolean canCreate(ICreateContext context)
- {
- return context.getTargetContainer() instanceof Diagram;
- }
-
- public Object[] create(ICreateContext context)
- {
- EObject newObject = createElement();
-
- DawnGraphitiAcoreResourceUtil.addToModelResource(newObject, getDiagram().eResource().getResourceSet());
-
- // do the add
- addGraphicalRepresentation(context, newObject);
-
- // activate direct editing after object creation
- getFeatureProvider().getDirectEditingInfo().setActive(true);
- // return newly created business object(s)
- return new Object[] { newObject };
- }
-
- protected abstract EObject createElement();
-
- @Override
- public String getCreateImageId()
- {
- return "org.eclipse.graphiti.examples.tutorial.ereference";
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.DawnGraphitiAcoreResourceUtil;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class AcoreBasicCreateElementFeature extends AbstractCreateFeature
+{
+ public AcoreBasicCreateElementFeature(IFeatureProvider fp, String name, String description)
+ {
+ super(fp, name, description);
+ }
+
+ public boolean canCreate(ICreateContext context)
+ {
+ return context.getTargetContainer() instanceof Diagram;
+ }
+
+ public Object[] create(ICreateContext context)
+ {
+ EObject newObject = createElement();
+
+ DawnGraphitiAcoreResourceUtil.addToModelResource(newObject, getDiagram().eResource().getResourceSet());
+
+ // do the add
+ addGraphicalRepresentation(context, newObject);
+
+ // activate direct editing after object creation
+ getFeatureProvider().getDirectEditingInfo().setActive(true);
+ // return newly created business object(s)
+ return new Object[] { newObject };
+ }
+
+ protected abstract EObject createElement();
+
+ @Override
+ public String getCreateImageId()
+ {
+ return "org.eclipse.graphiti.examples.tutorial.ereference";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java
index 776e6229c5..9ee245617b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java
@@ -1,83 +1,83 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.platform.IPlatformImageConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCollapseDummyFeature extends AbstractCustomFeature
-{
-
- public AcoreCollapseDummyFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canExecute(ICustomContext context)
- {
- boolean ret = false;
- PictogramElement[] pes = context.getPictogramElements();
- if (pes != null && pes.length == 1)
- {
- Object bo = getBusinessObjectForPictogramElement(pes[0]);
- if (bo instanceof AClass)
- {
- ret = true;
- }
- }
- return ret;
- }
-
- @Override
- public String getName()
- {
- return "Co&llapse"; //$NON-NLS-1$
- }
-
- @Override
- public String getDescription()
- {
-
- return "Collapse Figure"; //$NON-NLS-1$
- }
-
- @Override
- public String getImageId()
- {
- return IPlatformImageConstants.IMG_EDIT_COLLAPSE;
- }
-
- @Override
- public boolean isAvailable(IContext context)
- {
- return true;
- }
-
- public void execute(ICustomContext context)
- {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Information",//$NON-NLS-1$
- "The 'Collapse Feature' is intentionally not implemented yet."); //$NON-NLS-1$
- }
-
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.platform.IPlatformImageConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCollapseDummyFeature extends AbstractCustomFeature
+{
+
+ public AcoreCollapseDummyFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context)
+ {
+ boolean ret = false;
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1)
+ {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof AClass)
+ {
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Co&llapse"; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getDescription()
+ {
+
+ return "Collapse Figure"; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getImageId()
+ {
+ return IPlatformImageConstants.IMG_EDIT_COLLAPSE;
+ }
+
+ @Override
+ public boolean isAvailable(IContext context)
+ {
+ return true;
+ }
+
+ public void execute(ICustomContext context)
+ {
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Information",//$NON-NLS-1$
+ "The 'Collapse Feature' is intentionally not implemented yet."); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java
index fdd01616a8..9e9255c209 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICopyContext;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.ui.features.AbstractCopyFeature;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCopyAClassFeature extends AbstractCopyFeature
-{
-
- public AcoreCopyAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public boolean canCopy(ICopyContext context)
- {
- final PictogramElement[] pes = context.getPictogramElements();
- if (pes == null || pes.length == 0)
- { // nothing selected
- return false;
- }
-
- // return true, if all selected elements are a AClasses
- for (PictogramElement pe : pes)
- {
- final Object bo = getBusinessObjectForPictogramElement(pe);
- if (!(bo instanceof AClass))
- {
- return false;
- }
- }
- return true;
- }
-
- public void copy(ICopyContext context)
- {
- // get the business-objects for all pictogram-elements
- // we already verified, that all business-objets are AClasses
- PictogramElement[] pes = context.getPictogramElements();
- Object[] bos = new Object[pes.length];
- for (int i = 0; i < pes.length; i++)
- {
- PictogramElement pe = pes[i];
- bos[i] = getBusinessObjectForPictogramElement(pe);
- }
- // put all business objects to the clipboard
- putToClipboard(bos);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICopyContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.features.AbstractCopyFeature;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCopyAClassFeature extends AbstractCopyFeature
+{
+
+ public AcoreCopyAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public boolean canCopy(ICopyContext context)
+ {
+ final PictogramElement[] pes = context.getPictogramElements();
+ if (pes == null || pes.length == 0)
+ { // nothing selected
+ return false;
+ }
+
+ // return true, if all selected elements are a AClasses
+ for (PictogramElement pe : pes)
+ {
+ final Object bo = getBusinessObjectForPictogramElement(pe);
+ if (!(bo instanceof AClass))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void copy(ICopyContext context)
+ {
+ // get the business-objects for all pictogram-elements
+ // we already verified, that all business-objets are AClasses
+ PictogramElement[] pes = context.getPictogramElements();
+ Object[] bos = new Object[pes.length];
+ for (int i = 0; i < pes.length; i++)
+ {
+ PictogramElement pe = pes[i];
+ bos[i] = getBusinessObjectForPictogramElement(pe);
+ }
+ // put all business objects to the clipboard
+ putToClipboard(bos);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java
index 3c00d7dfcc..86a1e2ebf9 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java
@@ -1,53 +1,53 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateAClassFeature extends AcoreBasicCreateElementFeature
-{
- public AcoreCreateAClassFeature(IFeatureProvider fp)
- {
- // set name and description of the creation feature
- super(fp, "AClass", "Create AClass");
- }
-
- @Override
- public boolean canCreate(ICreateContext context)
- {
- return context.getTargetContainer() instanceof Diagram;
- }
-
- @Override
- public String getCreateImageId()
- {
- return "org.eclipse.graphiti.examples.tutorial.ereference";
- }
-
- @Override
- protected EObject createElement()
- {
- AClass aClass = AcoreFactory.eINSTANCE.createAClass();
- aClass.setName("AClass");
- return aClass;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateAClassFeature extends AcoreBasicCreateElementFeature
+{
+ public AcoreCreateAClassFeature(IFeatureProvider fp)
+ {
+ // set name and description of the creation feature
+ super(fp, "AClass", "Create AClass");
+ }
+
+ @Override
+ public boolean canCreate(ICreateContext context)
+ {
+ return context.getTargetContainer() instanceof Diagram;
+ }
+
+ @Override
+ public String getCreateImageId()
+ {
+ return "org.eclipse.graphiti.examples.tutorial.ereference";
+ }
+
+ @Override
+ protected EObject createElement()
+ {
+ AClass aClass = AcoreFactory.eINSTANCE.createAClass();
+ aClass.setName("AClass");
+ return aClass;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java
index a213b5dea8..3ed5721b8e 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java
@@ -1,53 +1,53 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
-import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateAInterfaceFeature extends AcoreBasicCreateElementFeature
-{
- public AcoreCreateAInterfaceFeature(IFeatureProvider fp)
- {
- // set name and description of the creation feature
- super(fp, "AInterface", "Create AInterface");
- }
-
- @Override
- public boolean canCreate(ICreateContext context)
- {
- return context.getTargetContainer() instanceof Diagram;
- }
-
- @Override
- public String getCreateImageId()
- {
- return "org.eclipse.graphiti.examples.tutorial.ereference";
- }
-
- @Override
- protected EObject createElement()
- {
- AInterface aInterface = AcoreFactory.eINSTANCE.createAInterface();
- aInterface.setName("AInterface");
- return aInterface;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateAInterfaceFeature extends AcoreBasicCreateElementFeature
+{
+ public AcoreCreateAInterfaceFeature(IFeatureProvider fp)
+ {
+ // set name and description of the creation feature
+ super(fp, "AInterface", "Create AInterface");
+ }
+
+ @Override
+ public boolean canCreate(ICreateContext context)
+ {
+ return context.getTargetContainer() instanceof Diagram;
+ }
+
+ @Override
+ public String getCreateImageId()
+ {
+ return "org.eclipse.graphiti.examples.tutorial.ereference";
+ }
+
+ @Override
+ protected EObject createElement()
+ {
+ AInterface aInterface = AcoreFactory.eINSTANCE.createAInterface();
+ aInterface.setName("AInterface");
+ return aInterface;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java
index 0d790be98f..8b39c5e988 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java
@@ -1,100 +1,100 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateAggregationFeature extends AcoreBasicCreateConnectionFeature
-{
- public AcoreCreateAggregationFeature(IFeatureProvider fp)
- {
- // provide name and description for the UI, e.g. the palette
- super(fp, "aggregation", "aggregation");
- }
-
- @Override
- public boolean canCreate(ICreateConnectionContext context)
- {
- // return true if both anchors belong to an AClass
- // and those AClasses are not identical
- AClass source = getAClass(context.getSourceAnchor());
- AClass target = getAClass(context.getTargetAnchor());
- if (source != null && target != null && source != target)
- {
- return true;
- }
- return false;
- }
-
- @Override
- public boolean canStartConnection(ICreateConnectionContext context)
- {
- if (getAClass(context.getSourceAnchor()) != null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Creates a EReference between two AClasses.
- */
- @Override
- protected void createConnection(EObject source, EObject target)
- {
- ((AClass)source).getAssociations().add((AClass)target);
- }
-
- @Override
- protected EObject getTarget(Anchor targetAnchor)
- {
- return getAClass(targetAnchor);
- }
-
- @Override
- protected EObject getSource(Anchor anchor)
- {
- return getAClass(anchor);
- }
-
- @Override
- protected ConnectionType getConnectionType()
- {
- return ConnectionType.AGGREGATIONS;
- }
-
- /**
- * Returns the AClass belonging to the anchor, or null if not available.
- */
- private AClass getAClass(Anchor anchor)
- {
- if (anchor != null)
- {
- Object object = getBusinessObjectForPictogramElement(anchor.getParent());
- if (object instanceof AClass)
- {
- return (AClass)object;
- }
- }
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateAggregationFeature extends AcoreBasicCreateConnectionFeature
+{
+ public AcoreCreateAggregationFeature(IFeatureProvider fp)
+ {
+ // provide name and description for the UI, e.g. the palette
+ super(fp, "aggregation", "aggregation");
+ }
+
+ @Override
+ public boolean canCreate(ICreateConnectionContext context)
+ {
+ // return true if both anchors belong to an AClass
+ // and those AClasses are not identical
+ AClass source = getAClass(context.getSourceAnchor());
+ AClass target = getAClass(context.getTargetAnchor());
+ if (source != null && target != null && source != target)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context)
+ {
+ if (getAClass(context.getSourceAnchor()) != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates a EReference between two AClasses.
+ */
+ @Override
+ protected void createConnection(EObject source, EObject target)
+ {
+ ((AClass)source).getAssociations().add((AClass)target);
+ }
+
+ @Override
+ protected EObject getTarget(Anchor targetAnchor)
+ {
+ return getAClass(targetAnchor);
+ }
+
+ @Override
+ protected EObject getSource(Anchor anchor)
+ {
+ return getAClass(anchor);
+ }
+
+ @Override
+ protected ConnectionType getConnectionType()
+ {
+ return ConnectionType.AGGREGATIONS;
+ }
+
+ /**
+ * Returns the AClass belonging to the anchor, or null if not available.
+ */
+ private AClass getAClass(Anchor anchor)
+ {
+ if (anchor != null)
+ {
+ Object object = getBusinessObjectForPictogramElement(anchor.getParent());
+ if (object instanceof AClass)
+ {
+ return (AClass)object;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java
index 9d216b94db..89af2c914f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java
@@ -1,97 +1,97 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateAssociationFeature extends AcoreBasicCreateConnectionFeature
-{
- public AcoreCreateAssociationFeature(IFeatureProvider fp)
- {
- // provide name and description for the UI, e.g. the palette
- super(fp, "assocation", "assocation");
- }
-
- @Override
- public boolean canCreate(ICreateConnectionContext context)
- {
- // return true if both anchors belong to an AClass
- // and those AClasses are not identical
- AClass source = getAClass(context.getSourceAnchor());
- AClass target = getAClass(context.getTargetAnchor());
- if (source != null && target != null && source != target)
- {
- return true;
- }
- return false;
- }
-
- @Override
- public boolean canStartConnection(ICreateConnectionContext context)
- {
- if (getAClass(context.getSourceAnchor()) != null)
- {
- return true;
- }
- return false;
- }
-
- @Override
- protected void createConnection(EObject source, EObject target)
- {
- ((AClass)source).getAggregations().add((AClass)target);
- }
-
- @Override
- protected EObject getTarget(Anchor targetAnchor)
- {
- return getAClass(targetAnchor);
- }
-
- @Override
- protected EObject getSource(Anchor anchor)
- {
- return getAClass(anchor);
- }
-
- @Override
- protected ConnectionType getConnectionType()
- {
- return ConnectionType.ASSOCIATIONS;
- }
-
- /**
- * Returns the AClass belonging to the anchor, or null if not available.
- */
- private AClass getAClass(Anchor anchor)
- {
- if (anchor != null)
- {
- Object object = getBusinessObjectForPictogramElement(anchor.getParent());
- if (object instanceof AClass)
- {
- return (AClass)object;
- }
- }
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateAssociationFeature extends AcoreBasicCreateConnectionFeature
+{
+ public AcoreCreateAssociationFeature(IFeatureProvider fp)
+ {
+ // provide name and description for the UI, e.g. the palette
+ super(fp, "assocation", "assocation");
+ }
+
+ @Override
+ public boolean canCreate(ICreateConnectionContext context)
+ {
+ // return true if both anchors belong to an AClass
+ // and those AClasses are not identical
+ AClass source = getAClass(context.getSourceAnchor());
+ AClass target = getAClass(context.getTargetAnchor());
+ if (source != null && target != null && source != target)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context)
+ {
+ if (getAClass(context.getSourceAnchor()) != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void createConnection(EObject source, EObject target)
+ {
+ ((AClass)source).getAggregations().add((AClass)target);
+ }
+
+ @Override
+ protected EObject getTarget(Anchor targetAnchor)
+ {
+ return getAClass(targetAnchor);
+ }
+
+ @Override
+ protected EObject getSource(Anchor anchor)
+ {
+ return getAClass(anchor);
+ }
+
+ @Override
+ protected ConnectionType getConnectionType()
+ {
+ return ConnectionType.ASSOCIATIONS;
+ }
+
+ /**
+ * Returns the AClass belonging to the anchor, or null if not available.
+ */
+ private AClass getAClass(Anchor anchor)
+ {
+ if (anchor != null)
+ {
+ Object object = getBusinessObjectForPictogramElement(anchor.getParent());
+ if (object instanceof AClass)
+ {
+ return (AClass)object;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java
index 09a82586c4..e87b862174 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java
@@ -1,100 +1,100 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateCompositionsFeature extends AcoreBasicCreateConnectionFeature
-{
- public AcoreCreateCompositionsFeature(IFeatureProvider fp)
- {
- // provide name and description for the UI, e.g. the palette
- super(fp, "composition", "composition");
- }
-
- @Override
- public boolean canCreate(ICreateConnectionContext context)
- {
- // return true if both anchors belong to an AClass
- // and those AClasses are not identical
- AClass source = getAClass(context.getSourceAnchor());
- AClass target = getAClass(context.getTargetAnchor());
- if (source != null && target != null && source != target)
- {
- return true;
- }
- return false;
- }
-
- @Override
- public boolean canStartConnection(ICreateConnectionContext context)
- {
- if (getAClass(context.getSourceAnchor()) != null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Creates a EReference between two AClasses.
- */
- @Override
- protected void createConnection(EObject source, EObject target)
- {
- ((AClass)source).getCompositions().add((AClass)target);
- }
-
- @Override
- protected EObject getTarget(Anchor targetAnchor)
- {
- return getAClass(targetAnchor);
- }
-
- @Override
- protected EObject getSource(Anchor anchor)
- {
- return getAClass(anchor);
- }
-
- @Override
- protected ConnectionType getConnectionType()
- {
- return ConnectionType.COMPOSITIONS;
- }
-
- /**
- * Returns the AClass belonging to the anchor, or null if not available.
- */
- private AClass getAClass(Anchor anchor)
- {
- if (anchor != null)
- {
- Object object = getBusinessObjectForPictogramElement(anchor.getParent());
- if (object instanceof AClass)
- {
- return (AClass)object;
- }
- }
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateCompositionsFeature extends AcoreBasicCreateConnectionFeature
+{
+ public AcoreCreateCompositionsFeature(IFeatureProvider fp)
+ {
+ // provide name and description for the UI, e.g. the palette
+ super(fp, "composition", "composition");
+ }
+
+ @Override
+ public boolean canCreate(ICreateConnectionContext context)
+ {
+ // return true if both anchors belong to an AClass
+ // and those AClasses are not identical
+ AClass source = getAClass(context.getSourceAnchor());
+ AClass target = getAClass(context.getTargetAnchor());
+ if (source != null && target != null && source != target)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context)
+ {
+ if (getAClass(context.getSourceAnchor()) != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates a EReference between two AClasses.
+ */
+ @Override
+ protected void createConnection(EObject source, EObject target)
+ {
+ ((AClass)source).getCompositions().add((AClass)target);
+ }
+
+ @Override
+ protected EObject getTarget(Anchor targetAnchor)
+ {
+ return getAClass(targetAnchor);
+ }
+
+ @Override
+ protected EObject getSource(Anchor anchor)
+ {
+ return getAClass(anchor);
+ }
+
+ @Override
+ protected ConnectionType getConnectionType()
+ {
+ return ConnectionType.COMPOSITIONS;
+ }
+
+ /**
+ * Returns the AClass belonging to the anchor, or null if not available.
+ */
+ private AClass getAClass(Anchor anchor)
+ {
+ if (anchor != null)
+ {
+ Object object = getBusinessObjectForPictogramElement(anchor.getParent());
+ if (object instanceof AClass)
+ {
+ return (AClass)object;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java
index fc0137029f..d4da999fe7 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java
@@ -1,86 +1,86 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateImplementationFeature extends AcoreBasicCreateConnectionFeature
-{
- public AcoreCreateImplementationFeature(IFeatureProvider fp)
- {
- // provide name and description for the UI, e.g. the palette
- super(fp, "implements", "implements");
- }
-
- @Override
- public boolean canStartConnection(ICreateConnectionContext context)
- {
- ABasicClass aClass = getAClass(context.getSourceAnchor());
- if (aClass != null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Creates a EReference between two AClasses.
- */
- @Override
- protected void createConnection(EObject source, EObject target)
- {
- ((AClass)source).getImplementedInterfaces().add((AInterface)target);
- }
-
- @Override
- protected EObject getTarget(Anchor targetAnchor)
- {
- return getAClass(targetAnchor);
- }
-
- @Override
- protected EObject getSource(Anchor anchor)
- {
- return getAClass(anchor);
- }
-
- @Override
- protected ConnectionType getConnectionType()
- {
- return ConnectionType.IMPLEMENTATIONS;
- }
-
- private ABasicClass getAClass(Anchor anchor)
- {
- if (anchor != null)
- {
- Object object = getBusinessObjectForPictogramElement(anchor.getParent());
- if (object instanceof ABasicClass)
- {
- return (ABasicClass)object;
- }
- }
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateImplementationFeature extends AcoreBasicCreateConnectionFeature
+{
+ public AcoreCreateImplementationFeature(IFeatureProvider fp)
+ {
+ // provide name and description for the UI, e.g. the palette
+ super(fp, "implements", "implements");
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context)
+ {
+ ABasicClass aClass = getAClass(context.getSourceAnchor());
+ if (aClass != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates a EReference between two AClasses.
+ */
+ @Override
+ protected void createConnection(EObject source, EObject target)
+ {
+ ((AClass)source).getImplementedInterfaces().add((AInterface)target);
+ }
+
+ @Override
+ protected EObject getTarget(Anchor targetAnchor)
+ {
+ return getAClass(targetAnchor);
+ }
+
+ @Override
+ protected EObject getSource(Anchor anchor)
+ {
+ return getAClass(anchor);
+ }
+
+ @Override
+ protected ConnectionType getConnectionType()
+ {
+ return ConnectionType.IMPLEMENTATIONS;
+ }
+
+ private ABasicClass getAClass(Anchor anchor)
+ {
+ if (anchor != null)
+ {
+ Object object = getBusinessObjectForPictogramElement(anchor.getParent());
+ if (object instanceof ABasicClass)
+ {
+ return (ABasicClass)object;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java
index fd05b32d06..ec76bea251 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java
@@ -1,100 +1,100 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateConnectionContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreCreateSubclassFeature extends AcoreBasicCreateConnectionFeature
-{
- public AcoreCreateSubclassFeature(IFeatureProvider fp)
- {
- // provide name and description for the UI, e.g. the palette
- super(fp, "extends", "extends");
- }
-
- @Override
- public boolean canCreate(ICreateConnectionContext context)
- {
- // return true if both anchors belong to an AClass
- // and those AClasses are not identical
- AClass source = getAClass(context.getSourceAnchor());
- AClass target = getAClass(context.getTargetAnchor());
- if (source != null && target != null && source != target)
- {
- return true;
- }
- return false;
- }
-
- @Override
- public boolean canStartConnection(ICreateConnectionContext context)
- {
- if (getAClass(context.getSourceAnchor()) != null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Creates a EReference between two AClasses.
- */
- @Override
- protected void createConnection(EObject source, EObject target)
- {
- ((AClass)source).getSubClasses().add((AClass)target);
- }
-
- @Override
- protected EObject getTarget(Anchor targetAnchor)
- {
- return getAClass(targetAnchor);
- }
-
- @Override
- protected EObject getSource(Anchor anchor)
- {
- return getAClass(anchor);
- }
-
- @Override
- protected ConnectionType getConnectionType()
- {
- return ConnectionType.SUBCLASSES;
- }
-
- /**
- * Returns the AClass belonging to the anchor, or null if not available.
- */
- private AClass getAClass(Anchor anchor)
- {
- if (anchor != null)
- {
- Object object = getBusinessObjectForPictogramElement(anchor.getParent());
- if (object instanceof AClass)
- {
- return (AClass)object;
- }
- }
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util.AcoreGraphitiContextUtil.ConnectionType;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreCreateSubclassFeature extends AcoreBasicCreateConnectionFeature
+{
+ public AcoreCreateSubclassFeature(IFeatureProvider fp)
+ {
+ // provide name and description for the UI, e.g. the palette
+ super(fp, "extends", "extends");
+ }
+
+ @Override
+ public boolean canCreate(ICreateConnectionContext context)
+ {
+ // return true if both anchors belong to an AClass
+ // and those AClasses are not identical
+ AClass source = getAClass(context.getSourceAnchor());
+ AClass target = getAClass(context.getTargetAnchor());
+ if (source != null && target != null && source != target)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context)
+ {
+ if (getAClass(context.getSourceAnchor()) != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates a EReference between two AClasses.
+ */
+ @Override
+ protected void createConnection(EObject source, EObject target)
+ {
+ ((AClass)source).getSubClasses().add((AClass)target);
+ }
+
+ @Override
+ protected EObject getTarget(Anchor targetAnchor)
+ {
+ return getAClass(targetAnchor);
+ }
+
+ @Override
+ protected EObject getSource(Anchor anchor)
+ {
+ return getAClass(anchor);
+ }
+
+ @Override
+ protected ConnectionType getConnectionType()
+ {
+ return ConnectionType.SUBCLASSES;
+ }
+
+ /**
+ * Returns the AClass belonging to the anchor, or null if not available.
+ */
+ private AClass getAClass(Anchor anchor)
+ {
+ if (anchor != null)
+ {
+ Object object = getBusinessObjectForPictogramElement(anchor.getParent());
+ if (object instanceof AClass)
+ {
+ return (AClass)object;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java
index bbbe83e541..ad9f49f4a1 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java
@@ -1,102 +1,102 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IDirectEditingContext;
-import org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.algorithms.Text;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreDirectEditAClassFeature extends AbstractDirectEditingFeature
-{
-
- public AcoreDirectEditAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public int getEditingType()
- {
- // there are several possible editor-types supported:
- // text-field, checkbox, color-chooser, combobox, ...
- return TYPE_TEXT;
- }
-
- @Override
- public boolean canDirectEdit(IDirectEditingContext context)
- {
- PictogramElement pe = context.getPictogramElement();
- Object bo = getBusinessObjectForPictogramElement(pe);
- GraphicsAlgorithm ga = context.getGraphicsAlgorithm();
- // support direct editing, if it is a AClass, and the user clicked
- // directly on the text and not somewhere else in the rectangle
- if (bo instanceof AClass && ga instanceof Text)
- {
- return true;
- }
- // direct editing not supported in all other cases
- return false;
- }
-
- public String getInitialValue(IDirectEditingContext context)
- {
- // return the current name of the AClass
- PictogramElement pe = context.getPictogramElement();
- AClass AClass = (AClass)getBusinessObjectForPictogramElement(pe);
- return AClass.getName();
- }
-
- @Override
- public String checkValueValid(String value, IDirectEditingContext context)
- {
- if (value.length() < 1)
- {
- return "Please enter any text as class name.";
- }
- if (value.contains(" "))
- {
- return "Spaces are not allowed in class names.";
- }
- if (value.contains("\n"))
- {
- return "Line breakes are not allowed in class names.";
- }
-
- // null means, that the value is valid
- return null;
- }
-
- @Override
- public void setValue(String value, IDirectEditingContext context)
- {
- // set the new name for the AClass
- PictogramElement pe = context.getPictogramElement();
- AClass AClass = (AClass)getBusinessObjectForPictogramElement(pe);
- AClass.setName(value);
-
- // Explicitly update the shape to display the new value in the diagram
- // Note, that this might not be necessary in future versions of Graphiti
- // (currently in discussion)
-
- // we know, that pe is the Shape of the Text, so its container is the
- // main shape of the AClass
- updatePictogramElement(((Shape)pe).getContainer());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreDirectEditAClassFeature extends AbstractDirectEditingFeature
+{
+
+ public AcoreDirectEditAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public int getEditingType()
+ {
+ // there are several possible editor-types supported:
+ // text-field, checkbox, color-chooser, combobox, ...
+ return TYPE_TEXT;
+ }
+
+ @Override
+ public boolean canDirectEdit(IDirectEditingContext context)
+ {
+ PictogramElement pe = context.getPictogramElement();
+ Object bo = getBusinessObjectForPictogramElement(pe);
+ GraphicsAlgorithm ga = context.getGraphicsAlgorithm();
+ // support direct editing, if it is a AClass, and the user clicked
+ // directly on the text and not somewhere else in the rectangle
+ if (bo instanceof AClass && ga instanceof Text)
+ {
+ return true;
+ }
+ // direct editing not supported in all other cases
+ return false;
+ }
+
+ public String getInitialValue(IDirectEditingContext context)
+ {
+ // return the current name of the AClass
+ PictogramElement pe = context.getPictogramElement();
+ AClass AClass = (AClass)getBusinessObjectForPictogramElement(pe);
+ return AClass.getName();
+ }
+
+ @Override
+ public String checkValueValid(String value, IDirectEditingContext context)
+ {
+ if (value.length() < 1)
+ {
+ return "Please enter any text as class name.";
+ }
+ if (value.contains(" "))
+ {
+ return "Spaces are not allowed in class names.";
+ }
+ if (value.contains("\n"))
+ {
+ return "Line breakes are not allowed in class names.";
+ }
+
+ // null means, that the value is valid
+ return null;
+ }
+
+ @Override
+ public void setValue(String value, IDirectEditingContext context)
+ {
+ // set the new name for the AClass
+ PictogramElement pe = context.getPictogramElement();
+ AClass AClass = (AClass)getBusinessObjectForPictogramElement(pe);
+ AClass.setName(value);
+
+ // Explicitly update the shape to display the new value in the diagram
+ // Note, that this might not be necessary in future versions of Graphiti
+ // (currently in discussion)
+
+ // we know, that pe is the Shape of the Text, so its container is the
+ // main shape of the AClass
+ updatePictogramElement(((Shape)pe).getContainer());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java
index 876112e420..6f997b5f08 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java
@@ -1,76 +1,76 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IPasteContext;
-import org.eclipse.graphiti.features.context.impl.AddContext;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.ui.features.AbstractPasteFeature;
-
-/**
- * @author Martin Fluegge
- */
-public class AcorePasteAClassFeature extends AbstractPasteFeature
-{
-
- public AcorePasteAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public boolean canPaste(IPasteContext context)
- {
- // only support pasting directly in the diagram (nothing else selected)
- PictogramElement[] pes = context.getPictogramElements();
- if (pes.length != 1 || !(pes[0] instanceof Diagram))
- {
- return false;
- }
-
- // can paste, if all objects on the clipboard are AClasses
- Object[] fromClipboard = getFromClipboard();
- if (fromClipboard == null || fromClipboard.length == 0)
- {
- return false;
- }
- for (Object object : fromClipboard)
- {
- if (!(object instanceof AClass))
- {
- return false;
- }
- }
- return true;
- }
-
- public void paste(IPasteContext context)
- {
- // we already verified, that we paste directly in the diagram
- PictogramElement[] pes = context.getPictogramElements();
- Diagram diagram = (Diagram)pes[0];
- // get the AClasses from the clipboard without copying them
- // (only copy the pictogram element, not the business object)
- // then create new pictogram elements using the add feature
- Object[] objects = getFromClipboard();
- for (Object object : objects)
- {
- AddContext ac = new AddContext();
- ac.setLocation(0, 0); // for simplicity paste at (0, 0)
- ac.setTargetContainer(diagram);
- addGraphicalRepresentation(ac, object);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IPasteContext;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.features.AbstractPasteFeature;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcorePasteAClassFeature extends AbstractPasteFeature
+{
+
+ public AcorePasteAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public boolean canPaste(IPasteContext context)
+ {
+ // only support pasting directly in the diagram (nothing else selected)
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes.length != 1 || !(pes[0] instanceof Diagram))
+ {
+ return false;
+ }
+
+ // can paste, if all objects on the clipboard are AClasses
+ Object[] fromClipboard = getFromClipboard();
+ if (fromClipboard == null || fromClipboard.length == 0)
+ {
+ return false;
+ }
+ for (Object object : fromClipboard)
+ {
+ if (!(object instanceof AClass))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void paste(IPasteContext context)
+ {
+ // we already verified, that we paste directly in the diagram
+ PictogramElement[] pes = context.getPictogramElements();
+ Diagram diagram = (Diagram)pes[0];
+ // get the AClasses from the clipboard without copying them
+ // (only copy the pictogram element, not the business object)
+ // then create new pictogram elements using the add feature
+ Object[] objects = getFromClipboard();
+ for (Object object : objects)
+ {
+ AddContext ac = new AddContext();
+ ac.setLocation(0, 0); // for simplicity paste at (0, 0)
+ ac.setTargetContainer(diagram);
+ addGraphicalRepresentation(ac, object);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java
index a724f119da..11b3e5f743 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IReconnectionContext;
-import org.eclipse.graphiti.features.impl.DefaultReconnectionFeature;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreReconnectionFeature extends DefaultReconnectionFeature
-{
- public AcoreReconnectionFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public boolean canReconnect(IReconnectionContext context)
- {
- // do not allow to reconnect
- return true;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.graphiti.features.impl.DefaultReconnectionFeature;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreReconnectionFeature extends DefaultReconnectionFeature
+{
+ public AcoreReconnectionFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public boolean canReconnect(IReconnectionContext context)
+ {
+ // do not allow to reconnect
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java
index 609e6abd35..06ea251513 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java
@@ -1,107 +1,107 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreRenameAClassFeature extends AbstractCustomFeature
-{
- private boolean hasDoneChanges = false;
-
- public AcoreRenameAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- @Override
- public String getName()
- {
- return "Rename AClass";
- }
-
- @Override
- public String getDescription()
- {
- return "Change the name of the AClass";
- }
-
- @Override
- public boolean canExecute(ICustomContext context)
- {
- // allow rename if exactly one pictogram element
- // representing a AClass is selected
- boolean ret = false;
- PictogramElement[] pes = context.getPictogramElements();
- if (pes != null && pes.length == 1)
- {
- Object bo = getBusinessObjectForPictogramElement(pes[0]);
- if (bo instanceof AClass)
- {
- ret = true;
- }
- }
- return ret;
- }
-
- public void execute(ICustomContext context)
- {
- PictogramElement[] pes = context.getPictogramElements();
- if (pes != null && pes.length == 1)
- {
- Object bo = getBusinessObjectForPictogramElement(pes[0]);
- if (bo instanceof AClass)
- {
- AClass AClass = (AClass)bo;
- String currentName = AClass.getName();
- // ask user for a new class name
- String newName = askString(getName(), getDescription(), currentName);
- if (newName != null && !newName.equals(currentName))
- {
- hasDoneChanges = true;
- AClass.setName(newName);
- updatePictogramElement(pes[0]);
- }
- }
- }
- }
-
- @Override
- public boolean hasDoneChanges()
- {
- return hasDoneChanges;
- }
-
- public String askString(String dialogTitle, String dialogMessage, String initialValue)
- {
- String ret = null;
- Shell shell = DawnEditorHelper.getActiveShell();
- InputDialog inputDialog = new InputDialog(shell, dialogTitle, dialogMessage, initialValue, null);
- int retDialog = inputDialog.open();
- if (retDialog == Window.OK)
- {
- ret = inputDialog.getValue();
- }
- return ret;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreRenameAClassFeature extends AbstractCustomFeature
+{
+ private boolean hasDoneChanges = false;
+
+ public AcoreRenameAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Rename AClass";
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return "Change the name of the AClass";
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context)
+ {
+ // allow rename if exactly one pictogram element
+ // representing a AClass is selected
+ boolean ret = false;
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1)
+ {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof AClass)
+ {
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ public void execute(ICustomContext context)
+ {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1)
+ {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof AClass)
+ {
+ AClass AClass = (AClass)bo;
+ String currentName = AClass.getName();
+ // ask user for a new class name
+ String newName = askString(getName(), getDescription(), currentName);
+ if (newName != null && !newName.equals(currentName))
+ {
+ hasDoneChanges = true;
+ AClass.setName(newName);
+ updatePictogramElement(pes[0]);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean hasDoneChanges()
+ {
+ return hasDoneChanges;
+ }
+
+ public String askString(String dialogTitle, String dialogMessage, String initialValue)
+ {
+ String ret = null;
+ Shell shell = DawnEditorHelper.getActiveShell();
+ InputDialog inputDialog = new InputDialog(shell, dialogTitle, dialogMessage, initialValue, null);
+ int retDialog = inputDialog.open();
+ if (retDialog == Window.OK)
+ {
+ ret = inputDialog.getValue();
+ }
+ return ret;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java
index 545b204152..814f9ddd57 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java
@@ -1,113 +1,113 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.IReason;
-import org.eclipse.graphiti.features.context.IUpdateContext;
-import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
-import org.eclipse.graphiti.features.impl.Reason;
-import org.eclipse.graphiti.mm.algorithms.Text;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreUpdateAClassFeature extends AbstractUpdateFeature
-{
-
- public AcoreUpdateAClassFeature(IFeatureProvider fp)
- {
- super(fp);
- }
-
- public boolean canUpdate(IUpdateContext context)
- {
- // return true, if linked business object is a AClass
- Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
- return bo instanceof AClass;
- }
-
- public IReason updateNeeded(IUpdateContext context)
- {
- // retrieve name from pictogram model
- String pictogramName = null;
- PictogramElement pictogramElement = context.getPictogramElement();
- if (pictogramElement instanceof ContainerShape)
- {
- ContainerShape cs = (ContainerShape)pictogramElement;
- for (Shape shape : cs.getChildren())
- {
- if (shape.getGraphicsAlgorithm() instanceof Text)
- {
- Text text = (Text)shape.getGraphicsAlgorithm();
- pictogramName = text.getValue();
- }
- }
- }
-
- // retrieve name from business model
- String businessName = null;
- Object bo = getBusinessObjectForPictogramElement(pictogramElement);
- if (bo instanceof AClass)
- {
- AClass AClass = (AClass)bo;
- businessName = AClass.getName();
- }
-
- // update needed, if names are different
- boolean updateNameNeeded = pictogramName == null && businessName != null || pictogramName != null
- && !pictogramName.equals(businessName);
- if (updateNameNeeded)
- {
- return Reason.createTrueReason("Name is out of date");
- }
- else
- {
- return Reason.createFalseReason();
- }
- }
-
- public boolean update(IUpdateContext context)
- {
- // retrieve name from business model
- String businessName = null;
- PictogramElement pictogramElement = context.getPictogramElement();
- Object bo = getBusinessObjectForPictogramElement(pictogramElement);
- if (bo instanceof AClass)
- {
- AClass AClass = (AClass)bo;
- businessName = AClass.getName();
- }
-
- // Set name in pictogram model
- if (pictogramElement instanceof ContainerShape)
- {
- ContainerShape cs = (ContainerShape)pictogramElement;
- for (Shape shape : cs.getChildren())
- {
- if (shape.getGraphicsAlgorithm() instanceof Text)
- {
- Text text = (Text)shape.getGraphicsAlgorithm();
- text.setValue(businessName);
- return true;
- }
- }
- }
-
- return false;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IReason;
+import org.eclipse.graphiti.features.context.IUpdateContext;
+import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
+import org.eclipse.graphiti.features.impl.Reason;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreUpdateAClassFeature extends AbstractUpdateFeature
+{
+
+ public AcoreUpdateAClassFeature(IFeatureProvider fp)
+ {
+ super(fp);
+ }
+
+ public boolean canUpdate(IUpdateContext context)
+ {
+ // return true, if linked business object is a AClass
+ Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
+ return bo instanceof AClass;
+ }
+
+ public IReason updateNeeded(IUpdateContext context)
+ {
+ // retrieve name from pictogram model
+ String pictogramName = null;
+ PictogramElement pictogramElement = context.getPictogramElement();
+ if (pictogramElement instanceof ContainerShape)
+ {
+ ContainerShape cs = (ContainerShape)pictogramElement;
+ for (Shape shape : cs.getChildren())
+ {
+ if (shape.getGraphicsAlgorithm() instanceof Text)
+ {
+ Text text = (Text)shape.getGraphicsAlgorithm();
+ pictogramName = text.getValue();
+ }
+ }
+ }
+
+ // retrieve name from business model
+ String businessName = null;
+ Object bo = getBusinessObjectForPictogramElement(pictogramElement);
+ if (bo instanceof AClass)
+ {
+ AClass AClass = (AClass)bo;
+ businessName = AClass.getName();
+ }
+
+ // update needed, if names are different
+ boolean updateNameNeeded = pictogramName == null && businessName != null || pictogramName != null
+ && !pictogramName.equals(businessName);
+ if (updateNameNeeded)
+ {
+ return Reason.createTrueReason("Name is out of date");
+ }
+ else
+ {
+ return Reason.createFalseReason();
+ }
+ }
+
+ public boolean update(IUpdateContext context)
+ {
+ // retrieve name from business model
+ String businessName = null;
+ PictogramElement pictogramElement = context.getPictogramElement();
+ Object bo = getBusinessObjectForPictogramElement(pictogramElement);
+ if (bo instanceof AClass)
+ {
+ AClass AClass = (AClass)bo;
+ businessName = AClass.getName();
+ }
+
+ // Set name in pictogram model
+ if (pictogramElement instanceof ContainerShape)
+ {
+ ContainerShape cs = (ContainerShape)pictogramElement;
+ for (Shape shape : cs.getChildren())
+ {
+ if (shape.getGraphicsAlgorithm() instanceof Text)
+ {
+ Text text = (Text)shape.getGraphicsAlgorithm();
+ text.setValue(businessName);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java
index 1b0138b389..087b9643b4 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java
@@ -1,24 +1,24 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreGraphitiContextUtil
-{
- public static String CONNECTTION_TYPE = "ConnectionType";
-
- public enum ConnectionType
- {
- SUBCLASSES, IMPLEMENTATIONS, AGGREGATIONS, COMPOSITIONS, ASSOCIATIONS
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreGraphitiContextUtil
+{
+ public static String CONNECTTION_TYPE = "ConnectionType";
+
+ public enum ConnectionType
+ {
+ SUBCLASSES, IMPLEMENTATIONS, AGGREGATIONS, COMPOSITIONS, ASSOCIATIONS
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java
index ecbac7d459..72b569a31c 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java
@@ -1,30 +1,30 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- *
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
-
-import org.eclipse.graphiti.ui.platform.AbstractImageProvider;
-
-/**
- * @author Martin Fluegge
- */
-public class AcoreImageProvider extends AbstractImageProvider
-{
- protected static final String PREFIX = "org.eclipse.graphiti.examples.tutorial."; //$NON-NLS-1$
-
- public static final String IMG_EREFERENCE = PREFIX + "ereference"; //$NON-NLS-1$
-
- @Override
- protected void addAvailableImages()
- {
- addImageFilePath(IMG_EREFERENCE, "icons/ereference.gif"); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
+
+import org.eclipse.graphiti.ui.platform.AbstractImageProvider;
+
+/**
+ * @author Martin Fluegge
+ */
+public class AcoreImageProvider extends AbstractImageProvider
+{
+ protected static final String PREFIX = "org.eclipse.graphiti.examples.tutorial."; //$NON-NLS-1$
+
+ public static final String IMG_EREFERENCE = PREFIX + "ereference"; //$NON-NLS-1$
+
+ @Override
+ protected void addAvailableImages()
+ {
+ addImageFilePath(IMG_EREFERENCE, "icons/ereference.gif"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java
index af1bf31019..09dcbef297 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java
@@ -1,122 +1,122 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
-
-import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
-import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot;
-import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
-import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.mm.pictograms.PictogramLink;
-import org.eclipse.graphiti.mm.pictograms.PictogramsFactory;
-
-import java.io.IOException;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnGraphitiAcoreResourceUtil
-{
- /**
- * In our example the root of the semantic model is an AcoreRoot. This method ensures that AcoreRoot is wiredn to the
- * Diagram element if needed.
- */
- public static void wireDomainModel(final Diagram diagram, final ResourceSet resourceSet, EditingDomain domain)
- {
- domain.getCommandStack().execute(new RecordingCommand((TransactionalEditingDomain)domain)
- {
- @Override
- protected void doExecute()
- {
- PictogramLink link = diagram.getLink();
- if (link == null)
- {
- link = PictogramsFactory.eINSTANCE.createPictogramLink();
- diagram.setLink(link);
- }
-
- EList<EObject> businessObjects = link.getBusinessObjects();
-
- if (businessObjects.size() == 0)
- {
- // create AcoreRoot
- ACoreRoot acoreRoot = AcoreFactory.eINSTANCE.createACoreRoot();
- Resource modelResource = resourceSet.getResources().get(0);
- if (modelResource.equals(diagram.eResource()))
- {
- modelResource = resourceSet.getResources().get(1);
- }
- modelResource.getContents().add(acoreRoot);
-
- link.getBusinessObjects().add(acoreRoot);
-
- try
- {
- diagram.eResource().save(null);
- modelResource.save(null);
- }
- catch (IOException ex)
- {
- throw new RuntimeException(ex);
- }
- }
- }
- });
- }
-
- public static void addToModelResource(EObject element, ResourceSet resourceSet)
- {
- Resource resource = resourceSet.getResources().get(0);
-
- if (resource.getContents().size() > 0 && resource.getContents().get(0) instanceof Diagram)
- {
- // wrong resource
- resource = resourceSet.getResources().get(1);
- }
-
- if (resource.getContents().size() > 0)
- {
- ACoreRoot acoreRoot = (ACoreRoot)resource.getContents().get(0);
-
- addElement(element, acoreRoot);
- }
- // else
- // {
- // ACoreRoot acoreRoot = AcoreFactory.eINSTANCE.createACoreRoot();
- // resource.getContents().add(acoreRoot);
- // addElement(element, acoreRoot);
- // }
- }
-
- private static void addElement(EObject element, ACoreRoot acoreRoot)
- {
- if (acoreRoot instanceof ACoreRoot)
- {
- if (element instanceof AClass)
- {
- acoreRoot.getClasses().add((AClass)element);
- }
- else if (element instanceof AInterface)
- {
- acoreRoot.getInterfaces().add((AInterface)element);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.graphiti.util;
+
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramLink;
+import org.eclipse.graphiti.mm.pictograms.PictogramsFactory;
+
+import java.io.IOException;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnGraphitiAcoreResourceUtil
+{
+ /**
+ * In our example the root of the semantic model is an AcoreRoot. This method ensures that AcoreRoot is wiredn to the
+ * Diagram element if needed.
+ */
+ public static void wireDomainModel(final Diagram diagram, final ResourceSet resourceSet, EditingDomain domain)
+ {
+ domain.getCommandStack().execute(new RecordingCommand((TransactionalEditingDomain)domain)
+ {
+ @Override
+ protected void doExecute()
+ {
+ PictogramLink link = diagram.getLink();
+ if (link == null)
+ {
+ link = PictogramsFactory.eINSTANCE.createPictogramLink();
+ diagram.setLink(link);
+ }
+
+ EList<EObject> businessObjects = link.getBusinessObjects();
+
+ if (businessObjects.size() == 0)
+ {
+ // create AcoreRoot
+ ACoreRoot acoreRoot = AcoreFactory.eINSTANCE.createACoreRoot();
+ Resource modelResource = resourceSet.getResources().get(0);
+ if (modelResource.equals(diagram.eResource()))
+ {
+ modelResource = resourceSet.getResources().get(1);
+ }
+ modelResource.getContents().add(acoreRoot);
+
+ link.getBusinessObjects().add(acoreRoot);
+
+ try
+ {
+ diagram.eResource().save(null);
+ modelResource.save(null);
+ }
+ catch (IOException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ });
+ }
+
+ public static void addToModelResource(EObject element, ResourceSet resourceSet)
+ {
+ Resource resource = resourceSet.getResources().get(0);
+
+ if (resource.getContents().size() > 0 && resource.getContents().get(0) instanceof Diagram)
+ {
+ // wrong resource
+ resource = resourceSet.getResources().get(1);
+ }
+
+ if (resource.getContents().size() > 0)
+ {
+ ACoreRoot acoreRoot = (ACoreRoot)resource.getContents().get(0);
+
+ addElement(element, acoreRoot);
+ }
+ // else
+ // {
+ // ACoreRoot acoreRoot = AcoreFactory.eINSTANCE.createACoreRoot();
+ // resource.getContents().add(acoreRoot);
+ // addElement(element, acoreRoot);
+ // }
+ }
+
+ private static void addElement(EObject element, ACoreRoot acoreRoot)
+ {
+ if (acoreRoot instanceof ACoreRoot)
+ {
+ if (element instanceof AClass)
+ {
+ acoreRoot.getClasses().add((AClass)element);
+ }
+ else if (element instanceof AInterface)
+ {
+ acoreRoot.getInterfaces().add((AInterface)element);
+ }
+ }
+ }
+}

Back to the top