Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java190
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java263
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java167
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java83
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java97
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java107
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java122
32 files changed, 0 insertions, 2708 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
deleted file mode 100644
index 0da48ab64b..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/Activator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index d413958037..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreDiagramTypeProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2011-2013, 2015, 2016 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.IDiagramBehavior;
-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, IDiagramBehavior diagramEditor)
- {
- super.init(diagram, diagramEditor);
- DawnGraphitiAcoreResourceUtil.wireDomainModel(diagram, diagram.eResource().getResourceSet(), getDiagramBehavior().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
deleted file mode 100644
index 828b305f52..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2011-2013, 2015, 2016 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.AcoreCopyAClassFeature;
-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.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
deleted file mode 100644
index 919522bd47..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreToolBehaviorProvider.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index a890a18529..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAClassFeature.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 50924c651d..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAInterfaceFeature.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 3a1e22989c..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAggregationFeature.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 39f9d12d3d..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddAssociationFeature.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 34dbfd2816..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddCompositionFeature.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index f59e790eee..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddImplementationFeature.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 4ca178257d..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreAddSubClassesFeature.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index b9ba59021c..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddConnectionFeature.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 63ea7c57f1..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicAddElementFeature.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015, 2016 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
deleted file mode 100644
index ad09222fc3..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateConnectionFeature.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 31e2699feb..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreBasicCreateElementFeature.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 375f3572a2..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCollapseDummyFeature.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index b500bb5e7c..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCopyAClassFeature.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index f6b5683406..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAClassFeature.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 8bc864b314..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAInterfaceFeature.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 5c99433585..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAggregationFeature.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 9354154cf5..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateAssociationFeature.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 909b4670a7..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateCompositionsFeature.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 4a861ad77e..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateImplementationFeature.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index ba07c70db4..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreCreateSubclassFeature.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 2b5163d9f0..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreDirectEditAClassFeature.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index b8ac3a2002..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcorePasteAClassFeature.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 6c44c1d9a0..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreReconnectionFeature.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 355e18974f..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreRenameAClassFeature.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index 746b17257d..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/features/AcoreUpdateAClassFeature.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015, 2016 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
deleted file mode 100644
index 3ab51f8b78..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreGraphitiContextUtil.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index d60ca26028..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/AcoreImageProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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
deleted file mode 100644
index ae1bfb92cd..0000000000
--- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/util/DawnGraphitiAcoreResourceUtil.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 2015 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