Initial contribution.
Change-Id: Iad2aec816d710f215feb9e904b4220b4fb91ffc9
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/.classpath b/org.eclipse.fmc.blockdiagram.editor.meta/.classpath
new file mode 100644
index 0000000..098194c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/.gitignore b/org.eclipse.fmc.blockdiagram.editor.meta/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/.project b/org.eclipse.fmc.blockdiagram.editor.meta/.project
new file mode 100644
index 0000000..f92b1fd
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.blockdiagram.editor.meta</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.fmc.blockdiagram.editor.meta/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/META-INF/MANIFEST.MF b/org.eclipse.fmc.blockdiagram.editor.meta/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..878ce8f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: FMC Blockdiagram Editor with Ecore Metamodel
+Bundle-SymbolicName: org.eclipse.fmc.blockdiagram.editor.meta;singleton:=true
+Bundle-Version: 0.11.0.qualifier
+Bundle-Activator: org.eclipse.fmc.blockdiagram.editor.meta.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.graphiti,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.ui.ide,
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.fmc.blockdiagram.editor,
+ org.eclipse.fmc.mm,
+ org.eclipse.graphiti.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.draw2d
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.fmc.blockdiagram.editor.meta,
+ org.eclipse.fmc.blockdiagram.editor.meta.features,
+ org.eclipse.fmc.blockdiagram.editor.meta.features.add,
+ org.eclipse.fmc.blockdiagram.editor.meta.features.create,
+ org.eclipse.fmc.blockdiagram.editor.meta.features.update
+Import-Package: org.eclipse.ui.views.properties.tabbed
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/about.html b/org.eclipse.fmc.blockdiagram.editor.meta/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/build.properties b/org.eclipse.fmc.blockdiagram.editor.meta/build.properties
new file mode 100644
index 0000000..f0f6cd3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/plugin.xml b/org.eclipse.fmc.blockdiagram.editor.meta/plugin.xml
new file mode 100644
index 0000000..03960d0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/plugin.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.eclipse.fmc.blockdiagram.editor.meta.profile" name="Profile Extension" schema="schema/org.eclipse.fmc.blockdiagram.editor.meta.profile.exsd"/>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.fmc.blockdiagram.category"
+ class="org.eclipse.fmc.blockdiagram.editor.meta.wizard.FMCMetaDiagramFileWizard"
+ finalPerspective="FMC.perspective"
+ icon="icons/fmcfiletype.png"
+ id="org.eclipse.fmc.blockdiagram.wizard.meta"
+ name="FMC Block Diagram + Model">
+ <description>
+ This wizard creates a FMC block diagram for the graphical layouting information and a separate model file with the data model which will be kept in sync.
+ </description>
+ </wizard>
+ </extension>
+ <!-- Add wizard to common navigator context menu -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.fmc.blockdiagram.wizard.meta">
+ <enablement>
+ </enablement>
+ </commonWizard>
+ </extension>
+ <extension
+ point="org.eclipse.graphiti.ui.diagramTypes">
+ <diagramType
+ id="org.eclipse.fmc.blockdiagramMeta.diagramtype"
+ name="FMC Meta"
+ type="fmcMeta">
+ </diagramType>
+ </extension>
+ <extension
+ point="org.eclipse.graphiti.ui.diagramTypeProviders">
+ <diagramTypeProvider
+ class="org.eclipse.fmc.blockdiagram.editor.meta.diagram.BlockDiagramMetaDiagramTypeProvider"
+ id="org.eclipse.fmc.blockdiagram.providerMeta"
+ name="org.eclipse.fmc.blockdiagram.typeproviderMeta">
+ <diagramType
+ id="org.eclipse.fmc.blockdiagramMeta.diagramtype">
+ </diagramType>
+ <imageProvider
+ id="org.eclipse.fmc.blockdiagram.imageProvider">
+ </imageProvider>
+ </diagramTypeProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="fmcMeta.PropertyContributor">
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.meta.property.ShapePropertyMetaSection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.FMCNodeFilter"
+ id="fmcMeta.shapeSection"
+ tab="fmcMeta.ShapeTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.meta.property.ConnectionPropertyMetaSection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.FMCConnectionFilter"
+ id="fmcMeta.connectionSection"
+ tab="fmcMeta.ConnectionTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.DiagramPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.DiagramFilter"
+ id="fmcMeta.diagramSection"
+ tab="fmcMeta.DiagramTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.meta.property.MetaPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeAndConnectionFilter"
+ id="fmcMeta.propertySection"
+ tab="fmcMeta.PropertyTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.ColorsAndFontsPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeFilter"
+ id="fmcMeta.styleSection"
+ tab="fmcMeta.StyleTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.AlignmentPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeFilter"
+ id="fmcMeta.alignmentSection"
+ tab="fmcMeta.AlignmentTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.meta.property.ProfileSection"
+ filter="org.eclipse.fmc.blockdiagram.editor.meta.property.ProfileFilter"
+ id="fmcMeta.profileSection"
+ tab="fmcMeta.ProfileTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.meta.property.StereotypeSection"
+ filter="org.eclipse.fmc.blockdiagram.editor.meta.property.StereotypeFilter"
+ id="fmcMeta.stereotypeSection"
+ tab="fmcMeta.StereotypeTab">
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="fmcMeta.PropertyContributor">
+ <propertyCategory
+ category="fmcMeta.diagram">
+ </propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="fmcMeta.PropertyContributor">
+ <propertyTab
+ afterTab="fmcMeta.PropertyTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.ShapeTab"
+ label="Shape">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.PropertyTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.ConnectionTab"
+ label="Connection">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.PropertyTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.DiagramTab"
+ label="Diagram">
+ </propertyTab>
+ <propertyTab
+ category="fmcMeta.diagram"
+ id="fmcMeta.PropertyTab"
+ label="Model">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.PropertyTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.StyleTab"
+ label="Style">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.StyleTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.AlignmentTab"
+ indented="true"
+ label="Text Alignment">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.DiagramTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.ProfileTab"
+ label="Profile">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmcMeta.AlignmentTab"
+ category="fmcMeta.diagram"
+ id="fmcMeta.StereotypeTab"
+ label="Stereotype">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.fmc.blockdiagram.editor.typechecking">
+ <typeChecker
+ class="org.eclipse.fmc.blockdiagram.editor.meta.model.MetaFMCTypeHelper">
+ </typeChecker>
+ </extension>
+</plugin>
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/schema/org.eclipse.fmc.blockdiagram.editor.meta.profile.exsd b/org.eclipse.fmc.blockdiagram.editor.meta/schema/org.eclipse.fmc.blockdiagram.editor.meta.profile.exsd
new file mode 100644
index 0000000..3ef0666
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/schema/org.eclipse.fmc.blockdiagram.editor.meta.profile.exsd
@@ -0,0 +1,149 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.fmc.blockdiagram.editor.meta" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.fmc.blockdiagram.editor.meta" id="org.eclipse.fmc.blockdiagram.editor.meta.profile" name="Profile Extension"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="client"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="client">
+ <complexType>
+ <attribute name="diagramSaved" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.meta.profile.IDiagramSaved"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="stereotypeProvider" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="stereotypeSection" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="profileSection" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/Activator.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/Activator.java
new file mode 100644
index 0000000..8610806
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/Activator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.fmc.blockdiagram.editor.meta"; //$NON-NLS-1$
+
+ /** The shared instance */
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * Start this plugin.
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**
+ * Stop this plugin.
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/AddFeatureVisitor.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/AddFeatureVisitor.java
new file mode 100644
index 0000000..9ab1fff
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/AddFeatureVisitor.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta;
+
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.AccessAddMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.AgentAddMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.HumanAgentAddMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.StorageAddMetaFeature;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AreaBorderAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.BraceAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommonFeatureAreaAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommunicationChannelAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsShapeAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.ImageAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.StructureVarianceAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.TextAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Storage;
+import org.eclipse.fmc.mm.StructureVariance;
+
+/**
+ * Visitor for getting the right AddFeature.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class AddFeatureVisitor extends EObjectImpl implements
+ IFMCElementVisitor {
+
+ /** The FeatureProvider which the AddFeature need. */
+ private BlockDiagramMetaFeatureProvider featureProvider;
+
+ /**
+ * Create a new visitor for getting the right AddFeature.
+ *
+ * @param featureProvider
+ * The FeatureProvider which the AddFeature need.
+ */
+ public AddFeatureVisitor(BlockDiagramMetaFeatureProvider featureProvider) {
+ this.featureProvider = featureProvider;
+ }
+
+ /**
+ * Generic visit method which is calling the accept method of the given
+ * FMCElement object which is calling the special method of this visitor.
+ */
+ @Override
+ public Object visit(FMCElement element, Object object) {
+ return element.accept(this, object);
+ }
+
+ /**
+ * Return the right AddFeature for the comment object.
+ */
+ @Override
+ public Object visitComment(Comment comment, Object object) {
+ switch (comment.getType()) {
+ case BRACE:
+ return new BraceAddFeature(featureProvider);
+ case IMAGE:
+ return new ImageAddFeature(featureProvider, ((IAddContext) object)
+ .getProperty("imageid").toString());
+ case AREABORDER:
+ return new AreaBorderAddFeature(featureProvider);
+ case COMMONFEATUREAREA:
+ return new CommonFeatureAreaAddFeature(featureProvider);
+ case TEXT:
+ return new TextAddFeature(featureProvider);
+ case DOTS:
+ return new DotsShapeAddFeature(featureProvider);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Return a new AccessAddMetaFeature object.
+ */
+ @Override
+ public Object visitAccess(Access access, Object object) {
+
+ return new AccessAddMetaFeature(
+ featureProvider,
+ (ConnectionStyle) ((IAddContext) object)
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ }
+
+ /**
+ * Return a new CommunicationChannelAddFeature object.
+ */
+ @Override
+ public Object visitChannel(Channel channel, Object object) {
+ return new CommunicationChannelAddFeature(
+ featureProvider,
+ (ConnectionStyle) ((IAddContext) object)
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ }
+
+ /**
+ * Return the right AddFeature for the agent object.
+ */
+ @Override
+ public Object visitAgent(Agent agent, Object object) {
+ if (agent.isHuman()) {
+ ShapeStyle style = (ShapeStyle) ((IAddContext) object)
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY);
+ return new HumanAgentAddMetaFeature(featureProvider, style);
+ }
+ ShapeStyle style = (ShapeStyle) ((IAddContext) object)
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY);
+ return new AgentAddMetaFeature(featureProvider, style);
+ }
+
+ /**
+ * Return a new StorageAddMetaFeature object.
+ */
+ @Override
+ public Object visitStorage(Storage storage, Object object) {
+ ShapeStyle style = (ShapeStyle) ((IAddContext) object)
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY);
+ return new StorageAddMetaFeature(featureProvider, style);
+ }
+
+ /**
+ * Return a new StructureVarianceAddFeature object.
+ */
+ @Override
+ public Object visitStructureVariance(StructureVariance structureVariance,
+ Object object) {
+ return new StructureVarianceAddFeature(featureProvider);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/BlockDiagramMetaFeatureProvider.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/BlockDiagramMetaFeatureProvider.java
new file mode 100644
index 0000000..b38945d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/BlockDiagramMetaFeatureProvider.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.ReconnectionMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.ShapePasteMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.FMCNodeDeleteFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.TextDirectEditingMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.DotsConnectionAddMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.create.CommunicationChannelCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.create.ConnectionCreateMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.create.DotsCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.create.HumanAgentCreateMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.create.ShapeCreateMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.AccessUpdateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.AgentUpdateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.CommentUpdateMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.CommunicationChannelUpdateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.StorageUpdateMetaFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.update.FMCNodeUpdateFeature;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IDeleteFeature;
+import org.eclipse.graphiti.features.IDirectEditingFeature;
+import org.eclipse.graphiti.features.IPasteFeature;
+import org.eclipse.graphiti.features.IReconnectionFeature;
+import org.eclipse.graphiti.features.IUpdateFeature;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IDeleteContext;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.features.context.IPasteContext;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.graphiti.features.context.IUpdateContext;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+import org.eclipse.graphiti.ui.features.DefaultDeleteFeature;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AnchorAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.InvisibleShapeAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.create.ConnectionCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.create.ShapeCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.RequestDirection;
+
+/**
+ * Feature provider class.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class BlockDiagramMetaFeatureProvider extends BlockDiagramFeatureProvider {
+
+ /**
+ * The stereotype provider (is not null only if the Stereotype Extension is
+ * installed).
+ */
+ private IStereotypeProvider stereoTypeProvider;
+
+ /**
+ * Constructor calls the super constructor and try to load the Stereotype
+ * Extension.
+ *
+ * @param diagramTypeProvider
+ * The diagram provider.
+ */
+ public BlockDiagramMetaFeatureProvider(IDiagramTypeProvider diagramTypeProvider) {
+ super(diagramTypeProvider);
+ setIndependenceSolver(null);
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ try {
+ stereoTypeProvider = (IStereotypeProvider) extensions[0]
+ .createExecutableExtension("stereotypeProvider");
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Returns the right UpdateFeature object for the given context.
+ */
+ @Override
+ public IUpdateFeature getUpdateFeature(IUpdateContext context) {
+ if (context.getPictogramElement() instanceof ContainerShape) {
+ if (typeChecker.isAgent(context.getPictogramElement()))
+ return new AgentUpdateFeature(this, stereoTypeProvider);
+ else if (typeChecker.isStorage(context.getPictogramElement()))
+ return new StorageUpdateMetaFeature(this, stereoTypeProvider);
+ else if (typeChecker.isAreaBorder(context.getPictogramElement()))
+ return new CommentUpdateMetaFeature(this);
+ else
+ return new FMCNodeUpdateFeature(this, stereoTypeProvider);
+ }
+ if (context.getPictogramElement() instanceof Connection) {
+ if (typeChecker.isCommunicationChannel((Connection) context
+ .getPictogramElement())) {
+ return new CommunicationChannelUpdateFeature(this,
+ stereoTypeProvider);
+ } else
+ return new AccessUpdateFeature(this, stereoTypeProvider);
+ } else
+ return super.getUpdateFeature(context);
+
+ }
+
+ /**
+ * Returns the right DeleteFeature object for the given context.
+ */
+ @Override
+ public IDeleteFeature getDeleteFeature(IDeleteContext context) {
+ if (context != null
+ && FMCUtil.getBO(context.getPictogramElement()) instanceof FMCNode)
+ return new FMCNodeDeleteFeature(this);
+ else
+ return new DefaultDeleteFeature(this);
+ }
+
+ /**
+ * Returns the right CreateFeature object for the given context.
+ */
+ @Override
+ public ICreateFeature[] getCreateFeatures() {
+ return new ICreateFeature[] {
+ new ShapeCreateMetaFeature(this, "Agent", "Agent",
+ FmcPackage.Literals.AGENT, BlockDiagramImageProvider.ICON_AGENT),
+ new ShapeCreateMetaFeature(this, "Agent L", "Agent L",
+ FmcPackage.Literals.AGENT, ShapeStyle.L,
+ BlockDiagramImageProvider.ICON_AGENT_L),
+ new ShapeCreateMetaFeature(this, "Agent U", "Agent U",
+ FmcPackage.Literals.AGENT, ShapeStyle.U,
+ BlockDiagramImageProvider.ICON_AGENT_U),
+ new ShapeCreateMetaFeature(this, "Storage", "Storage",
+ FmcPackage.Literals.STORAGE,
+ BlockDiagramImageProvider.ICON_STORAGE),
+ new ShapeCreateMetaFeature(this, "Storage_L", "Storage_L",
+ FmcPackage.Literals.STORAGE, ShapeStyle.L,
+ BlockDiagramImageProvider.ICON_STORAGE_L),
+ new ShapeCreateMetaFeature(this, "Storage_U", "Storage_U",
+ FmcPackage.Literals.STORAGE, ShapeStyle.U,
+ BlockDiagramImageProvider.ICON_STORAGE_U),
+ new HumanAgentCreateMetaFeature(this, "HumanAgent",
+ "HumanAgent", FmcPackage.Literals.AGENT,
+ BlockDiagramImageProvider.ICON_HUMAN_AGENT),
+ new ShapeCreateMetaFeature(this, "StructureVariance",
+ "StructureVariance",
+ FmcPackage.Literals.STRUCTURE_VARIANCE,
+ BlockDiagramImageProvider.ICON_STRUCTURE_VARIANCE),
+ new ShapeCreateMetaFeature(this, "Text",
+ CommentType.TEXT.toString(),
+ FmcPackage.Literals.COMMENT, BlockDiagramImageProvider.ICON_TEXT),
+ new ShapeCreateMetaFeature(this, "Common Feature Area",
+ CommentType.COMMONFEATUREAREA.toString(),
+ FmcPackage.Literals.COMMENT,
+ BlockDiagramImageProvider.ICON_COMMON_FEATURE_AREA),
+ new ShapeCreateMetaFeature(this, "Brace",
+ CommentType.BRACE.toString(),
+ FmcPackage.Literals.COMMENT,
+ BlockDiagramImageProvider.ICON_BRACE),
+ new ShapeCreateMetaFeature(this, "AreaBorder",
+ CommentType.AREABORDER.toString(),
+ FmcPackage.Literals.COMMENT,
+ BlockDiagramImageProvider.ICON_AREABORDER),
+ new ShapeCreateMetaFeature(this, "Dots",
+ CommentType.DOTS.toString(),
+ FmcPackage.Literals.COMMENT, BlockDiagramImageProvider.ICON_DOTS),
+ new ShapeCreateFeature(this, "Anchor", "", FMCType.Anchor,
+ BlockDiagramImageProvider.ICON_ANCHOR) };
+ }
+
+ /**
+ * Returns the right DirectEditingFeature object for the given context.
+ */
+ @Override
+ public IDirectEditingFeature getDirectEditingFeature(
+ IDirectEditingContext context) {
+ if (context.getGraphicsAlgorithm() instanceof Text
+ || context.getGraphicsAlgorithm() instanceof MultiText)
+ return new TextDirectEditingMetaFeature(this, stereoTypeProvider);
+ else {
+ return super.getDirectEditingFeature(context);
+ }
+
+ }
+
+ /**
+ * Returns the right AddFeature object for the given context.
+ */
+ @Override
+ public IAddFeature getAddFeature(IAddContext context) {
+
+ if (context.getNewObject() == FMCType.Invisible) {
+ return new InvisibleShapeAddFeature(this);
+ } else if (context.getNewObject() == FMCType.Dots) {
+ return new DotsConnectionAddMetaFeature(
+ this,
+ (ConnectionStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ } else if (context.getNewObject() == FMCType.Anchor) {
+ return new AnchorAddFeature(this);
+ } else {
+ AddFeatureVisitor visitor = new AddFeatureVisitor(this);
+ return (IAddFeature) visitor.visit(
+ (FMCElement) context.getNewObject(), context);
+ }
+ }
+
+ /**
+ * Returns the right PasteFeature object for the given context.
+ */
+ @Override
+ public IPasteFeature getPasteFeature(IPasteContext context) {
+ DiagramBehavior diagramBehavior = (DiagramBehavior) this
+ .getDiagramTypeProvider().getDiagramBehavior();
+ Point mouseLoc = diagramBehavior.getMouseLocation();
+ context.putProperty("mouseX", mouseLoc.x());
+ context.putProperty("mouseY", mouseLoc.y());
+ return new ShapePasteMetaFeature(this);
+ }
+
+ /**
+ * Returns the right CreateConnectionFeature object for the given context.
+ */
+ @Override
+ public ICreateConnectionFeature[] getCreateConnectionFeatures() {
+ return new ICreateConnectionFeature[] {
+
+ new ConnectionCreateMetaFeature(this, "Modify Access", "",
+ FmcPackage.Literals.ACCESS, ConnectionStyle.COMPOSITE,
+ BlockDiagramImageProvider.ICON_MODIFY_ACCESS, AccessType.RW),
+
+ new ConnectionCreateMetaFeature(this, "Unidirectional Access",
+ "", FmcPackage.Literals.ACCESS,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_ACCESS_MH),
+ new ConnectionCreateMetaFeature(this, "Unidirectional Access",
+ "", FmcPackage.Literals.ACCESS, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_ACCESS),
+
+ new ConnectionCreateMetaFeature(this, "Bidirectional Access",
+ "", FmcPackage.Literals.ACCESS,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_ACCESS_MH,
+ AccessType.UNSPECIFIED),
+ new ConnectionCreateMetaFeature(this, "Bidirectional Access",
+ "", FmcPackage.Literals.ACCESS, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_ACCESS,
+ AccessType.UNSPECIFIED),
+
+ new CommunicationChannelCreateFeature(this,
+ "Unidirectional Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_COMM_CHANNEL_MH,
+ DataflowDirection.DEFAULT, RequestDirection.UNSPECIFIED),
+ new CommunicationChannelCreateFeature(this,
+ "Unidirectional Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_COMM_CHANNEL,
+ DataflowDirection.DEFAULT, RequestDirection.UNSPECIFIED),
+
+ new CommunicationChannelCreateFeature(this,
+ "Bidirectional Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_COMM_CHANNEL_MH,
+ DataflowDirection.UNSPECIFIED,
+ RequestDirection.UNSPECIFIED),
+ new CommunicationChannelCreateFeature(this,
+ "Bidirectional Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_COMM_CHANNEL,
+ DataflowDirection.UNSPECIFIED,
+ RequestDirection.UNSPECIFIED),
+
+ new CommunicationChannelCreateFeature(this,
+ "Request-Response Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_REQ_RESP_COMM_CHANNEL_MH,
+ DataflowDirection.UNSPECIFIED, RequestDirection.REQUEST),
+ new CommunicationChannelCreateFeature(this,
+ "Request-Response Communication Channel", "",
+ FmcPackage.Literals.CHANNEL, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_REQ_RESP_COMM_CHANNEL,
+ DataflowDirection.DEFAULT, RequestDirection.REQUEST),
+ // new ConnectionCreateMetaFeature(this, "Dots Meta",
+ // "", FmcPackage.Literals.COMMENT, ConnectionStyle.NORMAL,
+ // BlockDiagramImageProvider.ICON_DOTS),
+ new DotsCreateFeature(this, "Dots", "", FMCType.Dots,
+ ConnectionStyle.NORMAL, BlockDiagramImageProvider.ICON_DOTS),
+ new ConnectionCreateFeature(this, "Dots", "", FMCType.Dots,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_DOTS_MH) };
+ }
+
+ /**
+ * Returns the right ReconnectionFeature object for the given context.
+ */
+ @Override
+ public IReconnectionFeature getReconnectionFeature(
+ IReconnectionContext context) {
+ return new ReconnectionMetaFeature(this);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/BlockDiagramMetaDiagramTypeProvider.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/BlockDiagramMetaDiagramTypeProvider.java
new file mode 100644
index 0000000..9130164
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/BlockDiagramMetaDiagramTypeProvider.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.diagram;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramTypeProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.BlockDiagramMetaFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IDiagramSaved;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * Diagram provider class.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class BlockDiagramMetaDiagramTypeProvider extends BlockDiagramTypeProvider {
+
+ /**
+ * The save options map.
+ */
+ private static Map<String, Object> saveOptions = new java.util.HashMap<String, Object>();
+
+ static {
+ saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true);
+ }
+
+ /**
+ * Constructor which call the super constructor an set a feature provider.
+ */
+ public BlockDiagramMetaDiagramTypeProvider() {
+ super();
+ setFeatureProvider(new BlockDiagramMetaFeatureProvider(this));
+ this.setProviderId("org.eclipse.fmc.blockdiagram.providerMeta");
+ }
+
+ /**
+ * If the Stereotype Extension is installed forward the diagramSaved info.
+ */
+ @Override
+ public void resourcesSaved(Diagram diagram, Resource[] savedResources) {
+ super.resourcesSaved(diagram, savedResources);
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ IDiagramSaved entry;
+ try {
+ entry = (IDiagramSaved) extensions[0]
+ .createExecutableExtension("diagramSaved");
+ entry.diagramSaved(diagram, getFMCModel(), savedResources);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Get the FMCModel which is represent the diagram.
+ *
+ * @return
+ */
+ private FMCModel getFMCModel() {
+ for (Shape shape : this.getDiagram().getChildren()) {
+ EObject eObject = FMCUtil.getBO(shape);
+ if ((eObject != null) && (eObject.eContainer() != null)
+ && (eObject.eContainer() instanceof FMCModel)) {
+ return (FMCModel) eObject.eContainer();
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/package.html
new file mode 100644
index 0000000..d5ca1cd
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/diagram/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package collects all provider classes. For the blockdiagram meta editor only type provider is needed.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/FMCNodeDeleteFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/FMCNodeDeleteFeature.java
new file mode 100644
index 0000000..e41cb52
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/FMCNodeDeleteFeature.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDeleteContext;
+import org.eclipse.graphiti.ui.features.DefaultDeleteFeature;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FMCNode;
+
+/**
+ * Feature Class for deleting the graphical representation and the business
+ * model.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class FMCNodeDeleteFeature extends DefaultDeleteFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider object.
+ */
+ public FMCNodeDeleteFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Deleting all connections before calling the delete method of the super
+ * class.
+ */
+ @Override
+ public void delete(IDeleteContext context) {
+ EObject bo = FMCUtil.getBO(context.getPictogramElement());
+ if (bo instanceof FMCNode) {
+ FMCNode node = (FMCNode) FMCUtil.getBO(context
+ .getPictogramElement());
+ deleteConnections(node.getAllConnections());
+ }
+ super.delete(context);
+ }
+
+ /**
+ * Delete all given connections.
+ *
+ * @param connections
+ * List of connections.
+ */
+ private void deleteConnections(EList<? extends FMCConnection> connections) {
+ EObject[] toDelete = new EObject[connections.size()];
+ int i = 0;
+ for (FMCConnection con : connections) {
+ toDelete[i++] = con;
+ }
+ deleteBusinessObjects(toDelete);
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/MoveShapeMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/MoveShapeMetaFeature.java
new file mode 100644
index 0000000..ae278be
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/MoveShapeMetaFeature.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.FMCMetaUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+
+/**
+ * Feature Class for moving a business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class MoveShapeMetaFeature extends
+ org.eclipse.fmc.blockdiagram.editor.features.ShapeMoveFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider object.
+ */
+ public MoveShapeMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Reorder and set a new parent of the business model.
+ */
+ @Override
+ protected void moveDomainObjects(Shape shapeToMove,
+ ContainerShape newContainerShape) {
+ EObject boToMove = FMCUtil.getBO(shapeToMove);
+ EObject boNewContainer = FMCUtil.getBO(newContainerShape);
+ if (boToMove != null && boToMove instanceof FMCNode) {
+ FMCNode nodeToMove = (FMCNode) boToMove;
+ if (boNewContainer != null && boNewContainer instanceof FMCNode) {
+ FMCNode nodeNewContainer = (FMCNode) boNewContainer;
+ nodeToMove.setContainer(nodeNewContainer);
+ } else if (newContainerShape instanceof Diagram) {
+ nodeToMove.setContainer(null);
+ FMCMetaUtil.addModelObject(nodeToMove, getDiagram(),
+ getFeatureProvider());
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionMetaFeature.java
new file mode 100644
index 0000000..b0aa96c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionMetaFeature.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.features.ReconnectionFeature;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCElement;
+
+/**
+ * Feature Class for reconnect a business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ReconnectionMetaFeature extends ReconnectionFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider object.
+ */
+ public ReconnectionMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Instantiate and call the ReconnectionVisitor.
+ */
+ @Override
+ public void execute(IContext context) {
+ if (context instanceof IReconnectionContext) {
+ IReconnectionContext reCtx = (IReconnectionContext) context;
+ ReconnectionVisitor visitor = new ReconnectionVisitor();
+ FMCElement bo = (FMCElement) FMCUtil.getBO((PictogramElement) reCtx
+ .getConnection());
+ visitor.visit(bo, reCtx);
+ }
+ super.execute(context);
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionVisitor.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionVisitor.java
new file mode 100644
index 0000000..4590eb2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ReconnectionVisitor.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessTarget;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Storage;
+import org.eclipse.fmc.mm.StructureVariance;
+
+/**
+ * Visitor for setting the given text to the right business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ReconnectionVisitor extends EObjectImpl implements
+ IFMCElementVisitor {
+
+ /**
+ * Generic visit method which is calling the accept method of the given
+ * FMCElement object which is calling the special method of this visitor.
+ */
+ @Override
+ public Object visit(FMCElement element, Object object) {
+ return element.accept(this, object);
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitComment(Comment comment, Object object) {
+ return null;
+ }
+
+ /**
+ * Reconnect a access connection.
+ */
+ @Override
+ public Object visitAccess(Access access, Object object) {
+ IReconnectionContext context = (IReconnectionContext) object;
+ if (access.getAgent().equals(
+ FMCUtil.getBO(context.getOldAnchor().getParent())))
+ access.setAgent((Agent) FMCUtil.getBO(context.getNewAnchor()
+ .getParent()));
+ else if (access.getTarget().equals(
+ FMCUtil.getBO(context.getOldAnchor().getParent())))
+ access.setTarget((AccessTarget) FMCUtil.getBO(context
+ .getNewAnchor().getParent()));
+ return null;
+ }
+
+ /**
+ * Reconnect a channel connection.
+ */
+ @Override
+ public Object visitChannel(Channel channel, Object object) {
+ IReconnectionContext context = (IReconnectionContext) object;
+ if (channel.getSource().equals(
+ FMCUtil.getBO(context.getOldAnchor().getParent())))
+ channel.setSource((Agent) FMCUtil.getBO(context.getNewAnchor()
+ .getParent()));
+ else if (channel.getTarget().equals(
+ FMCUtil.getBO(context.getOldAnchor().getParent())))
+ channel.setTarget((Agent) FMCUtil.getBO(context.getNewAnchor()
+ .getParent()));
+ return null;
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitAgent(Agent agent, Object object) {
+ return null;
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitStorage(Storage storage, Object object) {
+ return null;
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitStructureVariance(StructureVariance structureVariance,
+ Object object) {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ShapePasteMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ShapePasteMetaFeature.java
new file mode 100644
index 0000000..db2bd5e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/ShapePasteMetaFeature.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.FMCMetaUtil;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+
+
+/**
+ * Feature Class for pasting the graphical representation and the business
+ * model.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ShapePasteMetaFeature extends
+ org.eclipse.fmc.blockdiagram.editor.features.ShapePasteFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider object.
+ */
+ public ShapePasteMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Add copied business object to the meta model.
+ *
+ * @param copy
+ * The copied business object.
+ */
+ protected void addCopyToModel(EObject copy) {
+ FMCMetaUtil.addModelObject(copy, getDiagram(), getFeatureProvider());
+ }
+
+ /**
+ * Create an comment object not an image.
+ */
+ @Override
+ protected Object getImageModelObject() {
+ Comment comment = FmcFactory.eINSTANCE.createComment();
+ comment.setType(CommentType.IMAGE);
+ FMCMetaUtil.addModelObject(comment, getDiagram(), getFeatureProvider());
+ return comment;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingMetaFeature.java
new file mode 100644
index 0000000..a19c768
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingMetaFeature.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCElement;
+
+/**
+ * Feature Class for editing the text of a business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class TextDirectEditingMetaFeature extends
+ org.eclipse.fmc.blockdiagram.editor.features.TextDirectEditingFeature {
+
+ /**
+ * The stereotype provider (is not null only if the Stereotype Extension is
+ * installed).
+ */
+ private IStereotypeProvider stereotypeProvider;
+
+ /**
+ * Instantiates a new TextDirectEditingMetaFeature.
+ *
+ * @param fp
+ * the FeatureProvider Class.
+ * @param stereotypeProvider
+ * the StereotypeProvider Class.
+ */
+ public TextDirectEditingMetaFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp);
+ this.stereotypeProvider = stereotypeProvider;
+ }
+
+ /**
+ * Instantiate and call the TextDirectEditingVisitor.
+ */
+ @Override
+ public void setValue(String value, IDirectEditingContext context) {
+ FMCElement element = (FMCElement) FMCUtil
+ .getBO((PictogramElement) context.getPictogramElement());
+
+ TextDirectEditingVisitor visitor = new TextDirectEditingVisitor(context);
+ visitor.visit(element, value);
+
+ if (stereotypeProvider != null)
+ value = stereotypeProvider.getStereotypeText(element) + value;
+ super.setValue(value, context);
+ }
+
+ /**
+ * Get the initial Value when the direct Text editing phase begins.
+ */
+ @Override
+ public String getInitialValue(IDirectEditingContext context) {
+ AbstractText text = getText(context);
+ if (text != null) {
+ String value = text.getValue();
+ if (stereotypeProvider != null)
+ value = FMCUtil.substringStereotype(value);
+ return value;
+ } else
+ return "";
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingVisitor.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingVisitor.java
new file mode 100644
index 0000000..c5f3e6e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/TextDirectEditingVisitor.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features;
+
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Storage;
+import org.eclipse.fmc.mm.StructureVariance;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+
+/**
+ * Visitor for setting the given text to the right business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class TextDirectEditingVisitor extends EObjectImpl implements
+ IFMCElementVisitor {
+
+ /**
+ * Context which is needed for some objects types.
+ */
+ IDirectEditingContext context;
+
+ /**
+ * Create a new visitor for text direct editing.
+ *
+ * @param context
+ * The IDirectEditingContext object.
+ *
+ */
+ public TextDirectEditingVisitor(IDirectEditingContext context) {
+ this.context = context;
+ }
+
+ /**
+ * Generic visit method which is calling the accept method of the given
+ * FMCElement object which is calling the special method of this visitor.
+ */
+ @Override
+ public Object visit(FMCElement element, Object object) {
+ return element.accept(this, object);
+ }
+
+ /**
+ * Set the text of the Comment object.
+ */
+ @Override
+ public Object visitComment(Comment comment, Object object) {
+ if (comment != null && context.getPictogramElement().getLink() != null)
+ comment.setContent((String) object);
+ return null;
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitAccess(Access access, Object object) {
+ assert false : "Wrong Type";
+ return null;
+ }
+
+ /**
+ * Not needed and not implemented.
+ */
+ @Override
+ public Object visitChannel(Channel channel, Object object) {
+ assert false : "Wrong Type";
+ return null;
+ }
+
+ /**
+ * Set the text of the Agent object.
+ */
+ @Override
+ public Object visitAgent(Agent agent, Object object) {
+ setFMCNodeName(agent, (String) object);
+ return null;
+ }
+
+ /**
+ * Set the text of the Storage object.
+ */
+ @Override
+ public Object visitStorage(Storage storage, Object object) {
+ setFMCNodeName(storage, (String) object);
+ return null;
+ }
+
+ /**
+ * Set the text of the StructureVariance object.
+ */
+ @Override
+ public Object visitStructureVariance(StructureVariance structureVariance,
+ Object object) {
+ setFMCNodeName(structureVariance, (String) object);
+ return null;
+ }
+
+ /**
+ * Set the Name for all objects from type FMCNode.
+ *
+ * @param fmcNode
+ * The FMCNode object.
+ * @param text
+ * The String object.
+ */
+ public void setFMCNodeName(FMCNode fmcNode, String text) {
+ if (fmcNode != null && context.getPictogramElement().getLink() != null)
+ fmcNode.setName(text);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AccessAddMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AccessAddMetaFeature.java
new file mode 100644
index 0000000..3ed6d29
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AccessAddMetaFeature.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.CurvedConnection;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessType;
+
+/**
+ * Feature Class for adding the graphical representation of an existing access
+ * business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class AccessAddMetaFeature extends
+ org.eclipse.fmc.blockdiagram.editor.features.add.AccessAddFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The IFeatureProvider.
+ * @param style
+ * The Shape Style.
+ */
+ public AccessAddMetaFeature(IFeatureProvider fp, ConnectionStyle style) {
+ super(fp, style);
+ }
+
+ /**
+ * Decorate the access connection with the right properties (draw a second
+ * connection if the access object represent a read and write access).
+ */
+ protected void addDomainModelContent(IAddContext context, Connection con,
+ Polyline line) {
+ if (context.getNewObject() instanceof Access) {
+ Access access = (Access) context.getNewObject();
+
+ if (access.getType() == AccessType.RW) {
+ IGaService ga = Graphiti.getGaService();
+ IPeService pe = Graphiti.getPeService();
+
+ CompositeConnection compCon = (CompositeConnection) con;
+ CurvedConnection curved1 = pe.createCurvedConnection(
+ new double[] { 0.50d, 50d }, getDiagram());
+ CurvedConnection curved2 = pe.createCurvedConnection(
+ new double[] { 0.50d, -50d }, getDiagram());
+ compCon.getChildren().add(curved1);
+ compCon.getChildren().add(curved2);
+ ga.createPolyline(curved1);
+ ga.createPolyline(curved2);
+ createArrowDecorator(getDiagram(), curved1, true);
+ createArrowDecorator(getDiagram(), curved2, false);
+ line.setLineVisible(false);
+ } else if (access.getType() != AccessType.UNSPECIFIED) {
+ createArrowDecorator(getDiagram(), con, true);
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AgentAddMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AgentAddMetaFeature.java
new file mode 100644
index 0000000..69d63ca
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/AgentAddMetaFeature.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.BlockDiagramMetaFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.AddConnectionHelper;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AgentAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.MultiplicityType;
+
+/**
+ * Feature Class for adding the graphical representation of an existing agent
+ * business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class AgentAddMetaFeature extends AgentAddFeature {
+
+ /**
+ * Object for creating all connections which are existing in the meta model.
+ */
+ AddConnectionHelper connHelper = null;
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ */
+ public AgentAddMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param text
+ * @param width
+ * @param height
+ * @param angle
+ */
+ public AgentAddMetaFeature(IFeatureProvider fp, String text, int width,
+ int height, int angle) {
+ super(fp, text, width, height, angle);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param style
+ */
+ public AgentAddMetaFeature(IFeatureProvider fp, ShapeStyle style) {
+ super(fp, style);
+ }
+
+ /**
+ * Call the AddConnectionHelper for creating all connections which are
+ * existing in the meta model and draw the right multiplicity.
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ PictogramElement picEl = super.add(context);
+
+ // When the Model has connections and channels to Elements in the
+ // current Diagram we must add them.
+ connHelper = new AddConnectionHelper();
+ connHelper.addAgentConnections(picEl,
+ (BlockDiagramMetaFeatureProvider) this.getFeatureProvider(),
+ getDiagram());
+
+ checkMultiplicity(context, picEl);
+
+ return picEl;
+ }
+
+ /**
+ * Create the right graphical multiplicity representation for the given
+ * PictogramElement object.
+ *
+ * @param context
+ * @param picEl
+ */
+ private void checkMultiplicity(IAddContext context, PictogramElement picEl) {
+ ContainerShape container = (ContainerShape) picEl;
+ FMCNode node = (FMCNode) FMCUtil.getBO(container);
+ FMCNodeAlgorithm algorithm = factory.getShape(container);
+ if (algorithm == null)
+ return;
+ boolean isMultiInstance = algorithm.isMultipleInstances(container);
+ if ((node.getMultiplicity() == MultiplicityType.MANY) != isMultiInstance
+ && !isContainerMultiPart(algorithm, container))
+ algorithm.setMultipleInstances((ContainerShape) picEl,
+ getFeatureProvider(),
+ node.getMultiplicity() == MultiplicityType.MANY);
+ }
+
+ /**
+ * Checks if the given container is a container multi part.
+ *
+ * @param algorithm
+ * the FMCNodeAlgorithm.
+ * @param container
+ * the ContainerShape.
+ * @return true, if container is a container multi part.
+ */
+ protected boolean isContainerMultiPart(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ // TODO: Code copy from FMCNodeUpdateFeature;
+ if (container.eContainer() == null
+ || !(container.eContainer() instanceof ContainerShape))
+ return false;
+ ContainerShape containerParent = (ContainerShape) container
+ .eContainer();
+ return container.getGraphicsAlgorithm().equals(
+ algorithm.getMultiInstanceChild(containerParent, true))
+ || container.getGraphicsAlgorithm()
+ .equals(algorithm.getMultiInstanceChild(
+ containerParent, false));
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean isAvailable(IContext context) {
+ if (connHelper == null)
+ return super.isAvailable(context);
+ if (!connHelper.isAvailable(context))
+ return false;
+ return super.isAvailable(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean canExecute(IContext context) {
+ if (connHelper == null)
+ return super.canExecute(context);
+ if (!connHelper.canExecute(context))
+ return false;
+ return super.canExecute(context);
+ }
+
+ /**
+ * Executes the current feature and the builded feature of the connection
+ * helper with the given context.
+ */
+ @Override
+ public void execute(IContext context) {
+ super.execute(context);
+ if (connHelper != null)
+ connHelper.execute(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) can be undone - this is
+ * the undo of the execute operation.
+ */
+ @Override
+ public boolean canUndo(IContext context) {
+ if (connHelper == null)
+ return super.canUndo(context);
+ if (!connHelper.canUndo(context))
+ return false;
+ return super.canUndo(context);
+ }
+
+ /**
+ * Check if this feature or the connection helper feature has done changes.
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ if (connHelper == null)
+ return super.hasDoneChanges();
+ return (connHelper.hasDoneChanges() || super.hasDoneChanges());
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/DotsConnectionAddMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/DotsConnectionAddMetaFeature.java
new file mode 100644
index 0000000..5589b63
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/DotsConnectionAddMetaFeature.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IUpdateFeature;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.impl.UpdateContext;
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsConnectionAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.MultiplicityType;
+
+/**
+ * Feature Class for adding the graphical representation of a multiplicity of an
+ * existing FMCNode business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class DotsConnectionAddMetaFeature extends DotsConnectionAddFeature {
+
+ /**
+ * Call the constructor of the super class and set the linked property as
+ * false because this dots connection represent a multipliciy and has only a
+ * source and no target.
+ *
+ * @param fp
+ * @param style
+ */
+ public DotsConnectionAddMetaFeature(IFeatureProvider fp,
+ ConnectionStyle style) {
+ super(fp, style);
+ this.linked = false;
+ }
+
+ /**
+ * Draw a dots connection without a target to represent a multiplicity.
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ Connection cShape = (Connection) super.add(context);
+
+ // Change the Target BO to Source BO.
+ FMCNode sourceObj = (FMCNode) FMCUtil.getBO(cShape.getStart()
+ .getParent());
+ AnchorContainer aContainer = cShape.getEnd().getParent();
+ // Delete the overridden BO from the Model.
+ aContainer.getLink().getBusinessObjects().remove(0);
+ this.link(aContainer, sourceObj);
+
+ // Update the Graphic Elements.
+ UpdateContext uContext = new UpdateContext(aContainer);
+ IUpdateFeature updateFeature = this.getFeatureProvider()
+ .getUpdateFeature(uContext);
+ if (updateFeature.canUpdate(uContext))
+ updateFeature.execute(uContext);
+
+ uContext = new UpdateContext(cShape.getStart().getParent());
+ updateFeature = this.getFeatureProvider().getUpdateFeature(uContext);
+ if (updateFeature.canUpdate(uContext))
+ updateFeature.execute(uContext);
+
+ // Set Multiplicity to BO
+ sourceObj.setMultiplicity(MultiplicityType.MANY);
+
+ return cShape;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/HumanAgentAddMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/HumanAgentAddMetaFeature.java
new file mode 100644
index 0000000..ce89eb1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/HumanAgentAddMetaFeature.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.BlockDiagramMetaFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.AddConnectionHelper;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+import org.eclipse.fmc.blockdiagram.editor.features.add.HumanAgentAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+
+public class HumanAgentAddMetaFeature extends HumanAgentAddFeature {
+
+ /**
+ * Object for creating all connections which are existing in the meta model.
+ */
+ AddConnectionHelper connHelper = null;
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ */
+ public HumanAgentAddMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param text
+ * @param width
+ * @param height
+ * @param angle
+ */
+ public HumanAgentAddMetaFeature(IFeatureProvider fp, String text,
+ int width, int height, int angle) {
+ super(fp, text, width, height, angle);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param style
+ */
+ public HumanAgentAddMetaFeature(IFeatureProvider fp, ShapeStyle style) {
+ super(fp, style);
+ }
+
+ /**
+ * Call the AddConnectionHelper for creating all connections which are
+ * existing in the meta model and draw the right multiplicity.
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ PictogramElement picEl = super.add(context);
+
+ // When the Model has connections and channels to Elements in the
+ // current Diagram we must add them.
+ connHelper = new AddConnectionHelper();
+ connHelper.addAgentConnections(picEl,
+ (BlockDiagramMetaFeatureProvider) this.getFeatureProvider(),
+ getDiagram());
+
+ return picEl;
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean isAvailable(IContext context) {
+ if (connHelper == null)
+ return super.isAvailable(context);
+ if (!connHelper.isAvailable(context))
+ return false;
+ return super.isAvailable(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean canExecute(IContext context) {
+ if (connHelper == null)
+ return super.canExecute(context);
+ if (!connHelper.canExecute(context))
+ return false;
+ return super.canExecute(context);
+ }
+
+ /**
+ * Executes the current feature and the builded feature of the connection
+ * helper with the given context.
+ */
+ @Override
+ public void execute(IContext context) {
+ super.execute(context);
+ if (connHelper != null)
+ connHelper.execute(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) can be undone - this is
+ * the undo of the execute operation.
+ */
+ @Override
+ public boolean canUndo(IContext context) {
+ if (connHelper == null)
+ return super.canUndo(context);
+ if (!connHelper.canUndo(context))
+ return false;
+ return super.canUndo(context);
+ }
+
+ /**
+ * Check if this feature or the connection helper feature has done changes.
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ if (connHelper == null)
+ return super.hasDoneChanges();
+ return (connHelper.hasDoneChanges() || super.hasDoneChanges());
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/StorageAddMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/StorageAddMetaFeature.java
new file mode 100644
index 0000000..9ffcaae
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/StorageAddMetaFeature.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.BlockDiagramMetaFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.AddConnectionHelper;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.features.add.StorageAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.MultiplicityType;
+
+/**
+ * Feature Class for adding the graphical representation of an existing storage
+ * business object.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class StorageAddMetaFeature extends StorageAddFeature {
+
+ /**
+ * Object for creating all connections which are existing in the meta model.
+ */
+ AddConnectionHelper connHelper = null;
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The IFeatureProvider.
+ * @param style
+ * The Shape Style.
+ */
+ public StorageAddMetaFeature(IFeatureProvider fp, ShapeStyle style) {
+ super(fp, style);
+ }
+
+ /**
+ * Call the AddConnectionHelper for creating all connections which are
+ * existing in the meta model and draw the right multiplicity.
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ PictogramElement picEl = super.add(context);
+
+ // When the Model has connections and channels to Elements in the
+ // current Diagram we must add them.
+ connHelper = new AddConnectionHelper();
+ connHelper.addStorageConnections(picEl,
+ (BlockDiagramMetaFeatureProvider) this.getFeatureProvider(),
+ getDiagram());
+
+ checkMultiplicity(picEl);
+
+ return picEl;
+
+ }
+
+ /**
+ * Create the right graphical multiplicity representation for the given
+ * PictogramElement object.
+ *
+ * @param picEl
+ * The PictogramElement object.
+ */
+ private void checkMultiplicity(PictogramElement picEl) {
+ ContainerShape container = (ContainerShape) picEl;
+ FMCNode node = (FMCNode) FMCUtil.getBO(container);
+ FMCNodeAlgorithm algorithm = factory.getShape(container);
+ if (algorithm == null)
+ return;
+ boolean isMultiInstance = algorithm.isMultipleInstances(container);
+ if ((node.getMultiplicity() == MultiplicityType.MANY) != isMultiInstance
+ && !isContainerMultiPart(algorithm, container))
+ algorithm.setMultipleInstances((ContainerShape) picEl,
+ getFeatureProvider(),
+ node.getMultiplicity() == MultiplicityType.MANY);
+ }
+
+ /**
+ * Checks if the given container is a container multi part.
+ *
+ * @param algorithm
+ * the FMCNodeAlgorithm.
+ * @param container
+ * the ContainerShape.
+ * @return true, if container is a container multi part.
+ */
+ protected boolean isContainerMultiPart(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ if (container.eContainer() == null
+ || !(container.eContainer() instanceof ContainerShape))
+ return false;
+ ContainerShape containerParent = (ContainerShape) container
+ .eContainer();
+ return container.getGraphicsAlgorithm().equals(
+ algorithm.getMultiInstanceChild(containerParent, true))
+ || container.getGraphicsAlgorithm()
+ .equals(algorithm.getMultiInstanceChild(
+ containerParent, false));
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean isAvailable(IContext context) {
+ if (connHelper == null)
+ return super.isAvailable(context);
+ if (!connHelper.isAvailable(context))
+ return false;
+ return super.isAvailable(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) is available with the
+ * given context.
+ */
+ @Override
+ public boolean canExecute(IContext context) {
+ if (connHelper == null)
+ return super.canExecute(context);
+ if (!connHelper.canExecute(context))
+ return false;
+ return super.canExecute(context);
+ }
+
+ /**
+ * Executes the current feature and the builded feature of the connection
+ * helper with the given context.
+ */
+ @Override
+ public void execute(IContext context) {
+ super.execute(context);
+ if (connHelper != null)
+ connHelper.execute(context);
+ }
+
+ /**
+ * Decides if the feature of the connection helper or the current feature
+ * (if the feature of the connection helper is null) can be undone - this is
+ * the undo of the execute operation.
+ */
+ @Override
+ public boolean canUndo(IContext context) {
+ if (connHelper == null)
+ return super.canUndo(context);
+ if (!connHelper.canUndo(context))
+ return false;
+ return super.canUndo(context);
+ }
+
+ /**
+ * Check if this feature or the connection helper feature has done changes.
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ if (connHelper == null)
+ return super.hasDoneChanges();
+ return (connHelper.hasDoneChanges() || super.hasDoneChanges());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/package.html
new file mode 100644
index 0000000..f516c4d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/add/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all modified add features, which has different behaviour as the superclass at the blockdiagram editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/CommunicationChannelCreateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/CommunicationChannelCreateFeature.java
new file mode 100644
index 0000000..6cebeb6
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/CommunicationChannelCreateFeature.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.create;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.RequestDirection;
+
+/**
+ * Feature Class for creating the graphical representation and the business
+ * object of a CommunicationChannel.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class CommunicationChannelCreateFeature extends
+ ConnectionCreateMetaFeature {
+
+ /**
+ * The data flow direction of the CommunicationChannel which should be
+ * create with this feature object.
+ */
+ protected DataflowDirection dataFlow;
+ /**
+ * The data request direction of the CommunicationChannel which should be
+ * create with this feature object.
+ */
+ protected RequestDirection request;
+
+ /**
+ * Constructor save the given data flow direction and the given request
+ * direction as a member and calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param type
+ * @param style
+ * @param icon
+ * @param dataFlow
+ * @param request
+ */
+ public CommunicationChannelCreateFeature(IFeatureProvider fp, String name,
+ String description, Object type, ConnectionStyle style,
+ String icon, DataflowDirection dataFlow, RequestDirection request) {
+ super(fp, name, description, type, style, icon);
+ this.dataFlow = dataFlow;
+ this.request = request;
+ }
+
+ /**
+ * override the createConnectionModel of the superclass (which is setting
+ * the properties for a access connection) and set the communication channel
+ * specific properties.
+ */
+ @Override
+ protected Channel createConnectionModel(Anchor source, Anchor target) {
+ EObject obj = FmcFactory.eINSTANCE.create((EClass) type);
+
+ Channel channel = (Channel) obj;
+ channel.setChannelType(request);
+ channel.setDataflowDirection(dataFlow);
+ EObject sourceObj = FMCUtil.getBO(source.getParent());
+ EObject targetObj = FMCUtil.getBO(target.getParent());
+ channel.setSource((Agent) sourceObj);
+ channel.setTarget((Agent) targetObj);
+ return channel;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ConnectionCreateMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ConnectionCreateMetaFeature.java
new file mode 100644
index 0000000..1a55f5a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ConnectionCreateMetaFeature.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.create;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.FMCMetaUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessTarget;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.Storage;
+
+/**
+ * Feature Class for creating the graphical representation and the business
+ * object of a connection.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ConnectionCreateMetaFeature extends
+ org.eclipse.fmc.blockdiagram.editor.features.create.ConnectionCreateFeature {
+
+ /**
+ * Store the right access type (only relevant when a access object will be
+ * created).
+ */
+ protected AccessType accessType;
+
+ /**
+ * Constructor save the given access type as a member and calls the super
+ * constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param type
+ * @param style
+ * @param icon
+ * @param accessType
+ */
+ public ConnectionCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object type, ConnectionStyle style,
+ String icon, AccessType accessType) {
+ super(fp, name, description, type, style, icon);
+ this.accessType = accessType;
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param type
+ * @param style
+ * @param icon
+ */
+ public ConnectionCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object type, ConnectionStyle style, String icon) {
+ super(fp, name, description, type, style, icon);
+ }
+
+ /**
+ * Create the graphical representation and the business object of the given
+ * context.
+ */
+ @Override
+ protected void createConnectionModel(AddConnectionContext context,
+ Anchor source, Anchor target) {
+ EObject obj = createConnectionModel(source, target);
+ FMCMetaUtil.addModelObject(obj, getDiagram(), getFeatureProvider());
+ context.setNewObject(obj);
+ }
+
+ /**
+ * Set the right properties if the created connection is from type access.
+ *
+ * @param source
+ * The source anchor object
+ * @param target
+ * The target anchor object.
+ * @return The created object.
+ */
+ protected EObject createConnectionModel(Anchor source, Anchor target) {
+ EObject obj = FmcFactory.eINSTANCE.create((EClass) type);
+ if (obj instanceof Access) {
+ Access access = (Access) obj;
+ EObject sourceObj = FMCUtil.getBO(source.getParent());
+ EObject targetObj = FMCUtil.getBO(target.getParent());
+ if (sourceObj instanceof Storage) {
+ access.setType(AccessType.READ);
+ access.setTarget((Storage) sourceObj);
+ access.setAgent((Agent) targetObj);
+ } else if (sourceObj instanceof Agent) {
+ access.setType(AccessType.WRITE);
+ access.setTarget((AccessTarget) targetObj);
+ access.setAgent((Agent) sourceObj);
+ }
+ if (accessType == AccessType.RW
+ || accessType == AccessType.UNSPECIFIED)
+ access.setType(accessType);
+ }
+
+ return obj;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/DotsCreateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/DotsCreateFeature.java
new file mode 100644
index 0000000..3a05174
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/DotsCreateFeature.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.create;
+
+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;
+
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+
+/**
+ * Feature Class for creating the graphical representation of a dots connection.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class DotsCreateFeature extends ConnectionCreateMetaFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param type
+ * @param style
+ * @param icon
+ */
+ public DotsCreateFeature(IFeatureProvider fp, String name,
+ String description, Object type, ConnectionStyle style, String icon) {
+ super(fp, name, description, type, style, icon);
+ }
+
+ /**
+ * Check if the source and the target able to create a dots connection.
+ */
+ @Override
+ public boolean canCreate(ICreateConnectionContext context) {
+ boolean returnValue = super.canCreate(context);
+ if (!returnValue) {
+ return returnValue;
+ }
+ EObject source = getModelObject(context.getSourceAnchor());
+ EObject target = getModelObject(context.getTargetAnchor());
+ if (((source != null) && (target == null))
+ || ((source != null) && (target != null) && (!source.getClass()
+ .equals(target.getClass()))))
+ return false;
+ return true;
+ }
+
+ /**
+ * Returns the EClass belonging to the anchor, or null if not available.
+ */
+ private EObject getModelObject(Anchor anchor) {
+ if (anchor != null) {
+ Object object = getBusinessObjectForPictogramElement(anchor
+ .getParent());
+ if (object instanceof EObject) {
+ return (EObject) object;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/HumanAgentCreateMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/HumanAgentCreateMetaFeature.java
new file mode 100644
index 0000000..7ae30ce
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/HumanAgentCreateMetaFeature.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.create;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.mm.Agent;
+
+/**
+ * Feature Class for creating the graphical representation and the business
+ * model of a human agent.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class HumanAgentCreateMetaFeature extends ShapeCreateMetaFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param modelType
+ * @param icon
+ */
+ public HumanAgentCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object modelType, String icon) {
+ super(fp, name, description, modelType, icon);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param modelType
+ * @param graphicalType
+ * @param icon
+ */
+ public HumanAgentCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object modelType, ShapeStyle graphicalType,
+ String icon) {
+ super(fp, name, description, modelType, graphicalType, icon);
+ }
+
+ /**
+ * Call the create method of the superclass and set the human property of
+ * the created business object.
+ */
+ @Override
+ public Object[] create(ICreateContext context) {
+ Object[] obj = super.create(context);
+ Agent agent = (Agent) obj[0];
+ agent.setHuman(true);
+ return obj;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ShapeCreateMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ShapeCreateMetaFeature.java
new file mode 100644
index 0000000..b714bd4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/ShapeCreateMetaFeature.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.create;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.FMCMetaUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcFactory;
+
+/**
+ * Feature Class for creating the graphical representation and the business
+ * model of a Shape.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ShapeCreateMetaFeature extends
+org.eclipse.fmc.blockdiagram.editor.features.create.ShapeCreateFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param modelType
+ * @param graphicalType
+ * @param icon
+ */
+ public ShapeCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object modelType, ShapeStyle graphicalType,
+ String icon) {
+ super(fp, name, description, modelType, graphicalType, icon);
+ }
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * @param name
+ * @param description
+ * @param modelType
+ * @param icon
+ */
+ public ShapeCreateMetaFeature(IFeatureProvider fp, String name,
+ String description, Object modelType, String icon) {
+ super(fp, name, description, modelType, icon);
+ }
+
+ /**
+ * Create the graphical representation and the business model for the given
+ * context.
+ */
+ @Override
+ public Object[] create(ICreateContext context) {
+ if (modelType instanceof EClass) {
+ EObject obj = FmcFactory.eINSTANCE.create((EClass) modelType);
+ EObject targetBO = null;
+ if (obj instanceof Comment)
+ targetBO = FMCUtil.getBO(getDiagram());
+ else
+ targetBO = FMCUtil.getBO(context.getTargetContainer());
+
+ obj = convertComment(obj);
+ FMCMetaUtil.addModelObject(obj, getDiagram(), getFeatureProvider());
+
+ if (targetBO instanceof FMCNode && obj instanceof FMCNode) {
+ FMCNode containerNode = (FMCNode) targetBO;
+ containerNode.getContains().add((FMCNode) obj);
+ }
+ addGraphicalRepresentation(context, obj);
+ return new Object[] { obj };
+ }
+
+ addGraphicalRepresentation(context, modelType);
+ return new Object[] { modelType };
+ }
+
+ /**
+ * Set the right CommentType to the comment business object if the given
+ * EObject is a Comment object.
+ *
+ * @param obj
+ * The business object.
+ * @return The converted Comment or the unmodified given object.
+ */
+ private EObject convertComment(EObject obj) {
+ if (obj instanceof Comment) {
+ Comment comment = (Comment) obj;
+ for (CommentType commentType : CommentType.VALUES) {
+ if (this.getDescription().equals(commentType.toString())) {
+ comment.setType(commentType);
+ return comment;
+ }
+ }
+ }
+ return obj;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/package.html
new file mode 100644
index 0000000..4bd47e5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/create/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all modified create features, which has different behaviour as the superclass at the blockdiagram editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/package.html
new file mode 100644
index 0000000..e0c2491
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains the feature classes of the editor. There are subpackages for add, create, custom and resize features.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AccessUpdateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AccessUpdateFeature.java
new file mode 100644
index 0000000..bd0c3d9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AccessUpdateFeature.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+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.Reason;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.Storage;
+
+/**
+ * Feature Class for updating the graphical representation and the business
+ * model of an Access.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class AccessUpdateFeature extends FMCConnectionUpdateFeature {
+
+ /**
+ * Constructor only calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider
+ * @param stereotypeProvider
+ * The StereotypeProvider Class.
+ */
+ public AccessUpdateFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp, stereotypeProvider);
+ }
+
+ /**
+ * Update the direction of the graphical representation.
+ */
+ @Override
+ public boolean update(IUpdateContext context) {
+ Connection conShape = (Connection) context.getPictogramElement();
+ FMCConnectionAlgorithm algorithm = factory.getAlgorithm(conShape);
+ Access access = (Access) FMCUtil.getBO(context.getPictogramElement());
+ EObject start = FMCUtil.getBO(conShape.getStart().getParent());
+ if (!equalsAccessType(conShape, access)) {
+ switch (access.getType()) {
+ case UNSPECIFIED:
+ algorithm.setDirection(conShape, DataflowDirection.UNSPECIFIED,
+ getDiagram());
+ break;
+ case READ:
+ algorithm.setDirection(conShape,
+ start instanceof Agent ? DataflowDirection.OTHER
+ : DataflowDirection.DEFAULT, getDiagram());
+ break;
+ case WRITE:
+ algorithm.setDirection(conShape,
+ start instanceof Storage ? DataflowDirection.OTHER
+ : DataflowDirection.DEFAULT, getDiagram());
+ break;
+ case RW:
+ // TODO
+ break;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if update needed because of when the access type property of the
+ * graphical representation is not synch with the domain.
+ */
+ @Override
+ protected IReason updateNeeded(Connection conShape, FMCConnection connection) {
+ Access access = (Access) connection;
+ if (!equalsAccessType(conShape, access))
+ return Reason
+ .createTrueReason("The access type property is not in synch with domain model");
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Equals access type between graphical representation and business object.
+ *
+ * @param conShape
+ * The graphical representation.
+ * @param access
+ * The business object.
+ * @return true if equals otherwiese false
+ */
+ private boolean equalsAccessType(Connection conShape, Access access) {
+ EObject start = FMCUtil.getBO(conShape.getStart().getParent());
+ FMCConnectionAlgorithm algorithm = factory.getAlgorithm(conShape);
+ DataflowDirection direction = algorithm.getDirection(conShape);
+ boolean write = false;
+ if (direction == DataflowDirection.UNSPECIFIED)
+ return access.getType() == AccessType.UNSPECIFIED;
+ if (direction == DataflowDirection.DEFAULT)
+ write = start instanceof Agent;
+ if (direction == DataflowDirection.OTHER)
+ write = start instanceof Storage;
+ return access.getType() == AccessType.WRITE == write;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AgentUpdateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AgentUpdateFeature.java
new file mode 100644
index 0000000..bd31138
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/AgentUpdateFeature.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.DotsConnectionHelper;
+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.Reason;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.FMCNode;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AgentUpdateFeature extends FMCNodeUpdateFeature {
+
+ /**
+ * Constructor only calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider
+ * @param stereotypeProvider
+ * The StereotypeProvider Class.
+ */
+ public AgentUpdateFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp, stereotypeProvider);
+ }
+
+ /**
+ * Call the updateNeeded of the superclass and make additional a check if
+ * the human agent property is synch with the domain model.
+ */
+ @Override
+ protected IReason updateNeeded(ContainerShape container, FMCNode node) {
+ IReason reason = super.updateNeeded(container, node);
+ FMCNodeAlgorithm algorithm = (FMCNodeAlgorithm) factory
+ .getShape(container);
+ if (reason.toBoolean())
+ return reason;
+ else if (!isContainerMultiPart(algorithm, container)
+ && container.isActive()) {
+ Agent agent = (Agent) node;
+
+ if (agent.isHuman() != (factory.getHumanAgent()
+ .hasHumanFigure(container)))
+ return Reason
+ .createTrueReason("The human agent property is not in synch with domain model");
+ }
+ return reason;
+ }
+
+ /**
+ * Calls the DotsConnectionHelper to check if the ContainerShape has a
+ * graphical multiplicity representation.
+ */
+ @Override
+ protected boolean gaphicalMultiplicity(ContainerShape container,
+ FMCNode node) {
+ return new DotsConnectionHelper().graphicalMultiplicity(container, node);
+ }
+
+ /**
+ * Call the update method of the superclass and update the human agent
+ * representation.
+ */
+ @Override
+ public boolean update(IUpdateContext context) {
+ boolean result = super.update(context);
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ Agent agent = (Agent) FMCUtil.getBO(container);
+ FMCNodeAlgorithm algorithm = factory.getShape(container);
+ if ((!isContainerMultiPart(algorithm, container) && agent.isHuman() != (factory
+ .getHumanAgent().hasHumanFigure(container)))) {
+ // TODO adapt vertical orientation of name text
+ if (agent.isHuman()) {
+ factory.getHumanAgent().addHumanFigure(getDiagram(), container,
+ container.getGraphicsAlgorithm().getWidth());
+ } else
+ factory.getHumanAgent().removeHumanFigure(container);
+ }
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommentUpdateMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommentUpdateMetaFeature.java
new file mode 100644
index 0000000..c7a3a21
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommentUpdateMetaFeature.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Comment;
+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.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+
+/**
+ * @author Patrick Jahnke
+ *
+ */
+public class CommentUpdateMetaFeature extends AbstractUpdateFeature {
+
+ /**
+ * Constructor only calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider
+ */
+ public CommentUpdateMetaFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ * The FMCNode can only updated when the PictogramElement of a given context
+ * is a ContainerShape.
+ */
+ @Override
+ public boolean canUpdate(IUpdateContext context) {
+ return context.getPictogramElement() instanceof ContainerShape;
+ }
+
+ /**
+ * Check if the linked business object of the PictogramElement of a given
+ * context is a Comment. If the linked business object is a Comment return
+ * the result of the protected updateNeeded method. Otherwise create a false
+ * reason.
+ */
+ @Override
+ public IReason updateNeeded(IUpdateContext context) {
+ EObject bo = FMCUtil.getBO(context.getPictogramElement());
+ if (bo instanceof Comment) {
+ Comment comment = (Comment) bo;
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ return updateNeeded(container, comment);
+ }
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Check if update needed because of when the text of the graphical
+ * representation is not synch with the domain.
+ *
+ * @param container
+ * The ContainerShape.
+ * @param comment
+ * The Comment.
+ * @return the i reason
+ */
+ protected IReason updateNeeded(ContainerShape container, Comment comment) {
+ AbstractText text = findText(container);
+ if (text == null)
+ return Reason.createFalseReason();
+ // Text not equal
+ if (!equalsText(text, comment))
+ return Reason
+ .createTrueReason("The text is not in synch with domain model");
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Update the Text and the multiplicity if it's needed.
+ */
+ @Override
+ public boolean update(IUpdateContext context) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ Comment comment = (Comment) FMCUtil.getBO(container);
+ updateText(context, comment);
+ return true;
+ }
+
+ /**
+ * Equals text between the graphical representation and the business object.
+ *
+ * @param text
+ * The AbstractText
+ * @param comment
+ * The Comment
+ * @return true, if equals
+ */
+ protected boolean equalsText(AbstractText text, Comment comment) {
+ return text == null && comment.getContent() == null || text != null
+ && text.getValue().equals(comment.getContent());
+ }
+
+ /**
+ * Update text (and if the Stereotype Extension is installed the
+ * Stereotypetext).
+ *
+ * @param context
+ * the UpdateContext.
+ * @param comment
+ * the Comment.
+ */
+ protected void updateText(IUpdateContext context, Comment comment) {
+ AbstractText text = findText((ContainerShape) context
+ .getPictogramElement());
+ if (text != null) {
+ String commentText = comment.getContent();
+ text.setValue(commentText == null ? "" : commentText);
+ } else {
+ // TODO Add new text
+ }
+ }
+
+ /**
+ * Find the AbstractText object in a given ContainerShape object.
+ *
+ * @param container
+ * the ContainerShape
+ * @return the AbstractText object or null.
+ */
+ protected AbstractText findText(ContainerShape container) {
+ GraphicsAlgorithm ga = container.getGraphicsAlgorithm();
+ for (GraphicsAlgorithm gaChild : ga.getGraphicsAlgorithmChildren()) {
+ if (gaChild instanceof AbstractText) {
+ return (AbstractText) gaChild;
+ }
+
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommunicationChannelUpdateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommunicationChannelUpdateFeature.java
new file mode 100644
index 0000000..1a621b8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/CommunicationChannelUpdateFeature.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+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.Reason;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.RequestDirection;
+
+/**
+ * Feature Class for updating the graphical representation and the business
+ * model of a CommunicationChannel.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CommunicationChannelUpdateFeature extends
+ FMCConnectionUpdateFeature {
+
+ /**
+ * Constructor only calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider
+ * @param stereotypeProvider
+ * The StereotypeProvider Class.
+ */
+ public CommunicationChannelUpdateFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp, stereotypeProvider);
+ }
+
+ /**
+ * Search and return the AbstractText object of the given connection.
+ *
+ * @param con
+ * The Connection.
+ * @return The AbstractText object if exists in the given connection.
+ */
+ protected AbstractText getText(Connection con) {
+ for (ConnectionDecorator decorator : con.getConnectionDecorators()) {
+ if (decorator.getGraphicsAlgorithm() instanceof AbstractText
+ && decorator.isActive()
+ && !"R".equals(((AbstractText) decorator
+ .getGraphicsAlgorithm()).getValue()))
+ return (AbstractText) decorator.getGraphicsAlgorithm();
+ }
+ return null;
+ }
+
+ /**
+ * Check if update needed because of when the text or the direction of the
+ * graphical representation is not synch with the domain.
+ *
+ * @param conShape
+ * the graphical representation.
+ * @param connection
+ * the business object.
+ * @return the i reason
+ */
+ protected IReason updateNeeded(Connection conShape, FMCConnection connection) {
+ Channel channel = (Channel) connection;
+ FMCConnectionAlgorithm algorithm = factory.getAlgorithm(conShape);
+ AbstractText text = getText(conShape);
+ if (!(text == null && channel.getName() == null || text != null
+ && FMCUtil.substringStereotype(text.getValue())
+ .equals(channel.getName())))
+ return Reason
+ .createTrueReason("The text is not in synch with domain model");
+ else if (channel.getDataflowDirection() != algorithm
+ .getDirection(conShape)) {
+ return Reason
+ .createTrueReason("The data flow direction is not in synch with domain model");
+ } else if (channel.getChannelType() != algorithm
+ .getRequestDirection(conShape)) {
+ return Reason
+ .createTrueReason("The request direction is not in synch with domain model");
+ }
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Update the Text and the direction if it's needed.
+ */
+ @Override
+ public boolean update(IUpdateContext context) {
+ Connection con = (Connection) context.getPictogramElement();
+ Channel channel = (Channel) FMCUtil.getBO(con);
+ FMCConnectionAlgorithm algorithm = factory.getAlgorithm(con);
+ updateText(context, channel);
+ if (channel.getDataflowDirection() != algorithm.getDirection(con))
+ updateDataflowDirection(context, channel);
+ if ((channel.getChannelType() != algorithm.getRequestDirection(con)))
+ updateRequestDirection(context, channel);
+ return true;
+ }
+
+ /**
+ * Update the graphical representation of the DataflowDirection.
+ *
+ * @param context
+ * The IUpdateContext.
+ * @param channel
+ * The business object.
+ */
+ private void updateDataflowDirection(IUpdateContext context, Channel channel) {
+ Connection conShape = (Connection) context.getPictogramElement();
+ factory.getAlgorithm(conShape).setDirection(conShape,
+ channel.getDataflowDirection(), getDiagram());
+ if (channel.getDataflowDirection() != DataflowDirection.UNSPECIFIED
+ && channel.getChannelType() != RequestDirection.UNSPECIFIED)
+ channel.setChannelType(RequestDirection.UNSPECIFIED);
+ }
+
+ /**
+ * Update the graphical representation of the RequestDirection.
+ *
+ * @param context
+ * The IUpdateContext.
+ * @param channel
+ * The business object.
+ */
+ private void updateRequestDirection(IUpdateContext context, Channel channel) {
+ Connection conShape = (Connection) context.getPictogramElement();
+ factory.getAlgorithm(conShape).setRequestDirection(conShape,
+ channel.getChannelType(), getDiagram());
+ if (channel.getDataflowDirection() != DataflowDirection.UNSPECIFIED
+ && channel.getChannelType() != RequestDirection.UNSPECIFIED)
+ channel.setDataflowDirection(DataflowDirection.UNSPECIFIED);
+ }
+
+ /**
+ * Update text (and if the Stereotype Extension is installed the
+ * Stereotypetext).
+ *
+ * @param context
+ * the UpdateContext.
+ * @param channel
+ * the Channel.
+ */
+ private void updateText(IUpdateContext context, Channel channel) {
+ AbstractText text = getText((Connection) context.getPictogramElement());
+ if (text != null) {
+ String stereotypeText = "";
+ if (stereotypeProvider != null)
+ stereotypeText = stereotypeProvider.getStereotypeText(channel);
+ String nodeText = channel.getName();
+ text.setValue(nodeText == null ? stereotypeText : stereotypeText
+ + nodeText);
+ } else {
+ // TODO Add new text
+ }
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCConnectionUpdateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCConnectionUpdateFeature.java
new file mode 100644
index 0000000..a5899e8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCConnectionUpdateFeature.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+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.pictograms.Connection;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCConnection;
+
+/**
+ * Feature Class for updating the graphical representation and the business
+ * model of a FMCConnection.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public abstract class FMCConnectionUpdateFeature extends AbstractUpdateFeature {
+ protected FMCConnectionAlgorithmFactory factory = FMCConnectionAlgorithmFactory
+ .getInstance();
+
+ /**
+ * The stereotype provider (is not null only if the Stereotype Extension is
+ * installed).
+ */
+ protected IStereotypeProvider stereotypeProvider;
+
+ /**
+ * Instantiates a new FMCConnectionUpdateFeature.
+ *
+ * @param fp
+ * the FeatureProvider Class.
+ * @param stereotypeProvider
+ * the StereotypeProvider Class.
+ */
+ public FMCConnectionUpdateFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp);
+ this.stereotypeProvider = stereotypeProvider;
+ }
+
+ /**
+ * The FMCNode can only updated when the PictogramElement of a given context
+ * is a Connection.
+ */
+ @Override
+ public boolean canUpdate(IUpdateContext context) {
+ return context.getPictogramElement() instanceof Connection;
+ }
+
+ /**
+ * Check if the linked business object of the PictogramElement of a given
+ * context is a FMCConnection. If the linked business object is a
+ * FMCConnection return the result of the abstract updateNeeded method which
+ * is implemented in the subclasses. Otherwise create a false reason.
+ */
+ @Override
+ public IReason updateNeeded(IUpdateContext context) {
+ EObject bo = FMCUtil.getBO(context.getPictogramElement());
+ if (bo instanceof FMCConnection) {
+ FMCConnection connection = (FMCConnection) bo;
+ Connection conShape = (Connection) context.getPictogramElement();
+ return updateNeeded(conShape, connection);
+ }
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * The abstract updateNeeded Method which is implemented in the subclasses.
+ *
+ * @param conShape
+ * The graphical representation.
+ * @param connection
+ * The business object.
+ * @return
+ */
+ protected abstract IReason updateNeeded(Connection conShape,
+ FMCConnection connection);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCNodeUpdateFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCNodeUpdateFeature.java
new file mode 100644
index 0000000..e321162
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/FMCNodeUpdateFeature.java
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+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.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.MultiplicityType;
+
+/**
+ * Feature Class for updating the graphical representation and the business
+ * model of a FMCNode.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCNodeUpdateFeature extends AbstractUpdateFeature {
+
+ /** The algorithm factory of FMCNodes. */
+ protected FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ /**
+ * The stereotype provider (is not null only if the Stereotype Extension is
+ * installed).
+ */
+ private IStereotypeProvider stereotypeProvider;
+
+ /**
+ * Instantiates a new FMC node update feature.
+ *
+ * @param fp
+ * the FeatureProvider Class.
+ * @param stereotypeProvider
+ * the StereotypeProvider Class.
+ */
+ public FMCNodeUpdateFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp);
+ this.stereotypeProvider = stereotypeProvider;
+ }
+
+ /**
+ * The FMCNode can only updated when the PictogramElement of a given context
+ * is a ContainerShape.
+ */
+ @Override
+ public boolean canUpdate(IUpdateContext context) {
+ return context.getPictogramElement() instanceof ContainerShape;
+ }
+
+ /**
+ * Check if the linked business object of the PictogramElement of a given
+ * context is a FMCNode. If the linked business object is a FMCNode return
+ * the result of the protected updateNeeded method. Otherwise create a false
+ * reason.
+ */
+ @Override
+ public IReason updateNeeded(IUpdateContext context) {
+ EObject bo = FMCUtil.getBO(context.getPictogramElement());
+ if (bo instanceof FMCNode) {
+ FMCNode node = (FMCNode) bo;
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ return updateNeeded(container, node);
+ }
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Checks if the given container is a container main multi part.
+ *
+ * @param algorithm
+ * the algorithm.
+ * @param container
+ * the container.
+ * @return true, if container is a container main multi part.
+ */
+ protected boolean isContainerMainMultiPart(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ if (container.eContainer() == null
+ || !(container.eContainer() instanceof ContainerShape))
+ return false;
+ ContainerShape containerParent = (ContainerShape) container
+ .eContainer();
+ return container.getGraphicsAlgorithm().equals(
+ algorithm.getMultiInstanceChild(containerParent, true));
+ }
+
+ /**
+ * Checks if the given container is a container multi part.
+ *
+ * @param algorithm
+ * the FMCNodeAlgorithm.
+ * @param container
+ * the ContainerShape.
+ * @return true, if container is a container multi part.
+ */
+ protected boolean isContainerMultiPart(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ if (container.eContainer() == null
+ || !(container.eContainer() instanceof ContainerShape))
+ return false;
+ ContainerShape containerParent = (ContainerShape) container
+ .eContainer();
+ return container.getGraphicsAlgorithm().equals(
+ algorithm.getMultiInstanceChild(containerParent, true))
+ || container.getGraphicsAlgorithm()
+ .equals(algorithm.getMultiInstanceChild(
+ containerParent, false));
+ }
+
+ /**
+ * Checks if is multi part.
+ *
+ * @param algorithm
+ * the algorithm
+ * @param container
+ * the container
+ * @return true, if is multi part
+ */
+ protected boolean isMultiPart(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ GraphicsAlgorithm invisibleGa = container.getGraphicsAlgorithm();
+ return invisibleGa.getGraphicsAlgorithmChildren().size() == 2;
+ }
+
+ /**
+ * Check if the main shape should update.
+ *
+ * @param algorithm
+ * the algorithm.
+ * @param container
+ * the container.
+ * @return true, if main shape should update.
+ */
+ protected boolean shouldUpdateMainShape(FMCNodeAlgorithm algorithm,
+ ContainerShape container) {
+ boolean isThisContainerAMultiPart = isContainerMultiPart(algorithm,
+ container);
+ boolean isThisContainerMainMultiPart = isContainerMainMultiPart(
+ algorithm, container);
+ boolean isMultiInstance = algorithm.isMultipleInstances(container);
+ return (!isMultiInstance && !isThisContainerAMultiPart || isThisContainerMainMultiPart);
+ }
+
+ /**
+ * Check if update needed because of when the text or the multiplicity of
+ * the graphical representation is not synch with the domain.
+ *
+ * @param container
+ * the ContainerShape
+ * @param node
+ * the FMCNode
+ * @return the i reason
+ */
+ protected IReason updateNeeded(ContainerShape container, FMCNode node) {
+ FMCNodeAlgorithm algorithm = factory.getShape(container);
+ if (algorithm != null) {
+ boolean isThisContainerAMultiPart = isContainerMultiPart(algorithm,
+ container);
+ boolean isMultiInstance = algorithm.isMultipleInstances(container);
+ AbstractText text = findText(container);
+ // Text not equal
+ if (shouldUpdateMainShape(algorithm, container)
+ && !equalsText(text, node))
+ return Reason
+ .createTrueReason("The text is not in synch with domain model");
+ // Multiplicity not equal
+ boolean graphMulti = gaphicalMultiplicity(container, node);
+ if ((!isThisContainerAMultiPart
+ && isMultiInstance != (node.getMultiplicity() == MultiplicityType.MANY) && (!graphMulti))
+ || (graphMulti && (node.getMultiplicity() == MultiplicityType.MANY))) {
+ return Reason
+ .createTrueReason("The multiplicity is not in synch wiht domain model");
+ }
+ }
+ return Reason.createFalseReason();
+ }
+
+ /**
+ * Placeholder Method - will be overridden.
+ *
+ * @param container
+ * the ContainerShape
+ * @param node
+ * the FMCNode
+ * @return false
+ */
+ protected boolean gaphicalMultiplicity(ContainerShape container,
+ FMCNode node) {
+ return false;
+ }
+
+ /**
+ * Find the AbstractText object in a given ContainerShape object.
+ *
+ * @param container
+ * the ContainerShape
+ * @return the AbstractText object or null.
+ */
+ protected AbstractText findText(ContainerShape container) {
+ for (Shape shape : container.getChildren()) {
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
+ return (AbstractText) shape.getGraphicsAlgorithm();
+ }
+ }
+ AbstractText text = null;
+ for (Shape shape : container.getChildren()) {
+ if (text == null && shape instanceof ContainerShape) {
+ text = findText((ContainerShape) shape);
+ }
+ }
+ return text;
+ }
+
+ /**
+ * Update the Text and the mutiplicity if it's needed.
+ */
+ @Override
+ public boolean update(IUpdateContext context) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ FMCNode node = (FMCNode) FMCUtil.getBO(container);
+ FMCNodeAlgorithm algorithm = factory.getShape(container);
+ if (algorithm == null)
+ return false;
+ boolean isMultiInstance = algorithm.isMultipleInstances(container);
+ if (!isMultiInstance || isContainerMainMultiPart(algorithm, container))
+ updateText(context, node);
+ boolean graphMulti = gaphicalMultiplicity(container, node);
+ if (((node.getMultiplicity() == MultiplicityType.MANY) != isMultiInstance
+ && !isContainerMultiPart(algorithm, container) && !graphMulti)
+ || (graphMulti
+ && (node.getMultiplicity() == MultiplicityType.MANY) && isMultiPart(
+ algorithm, container)))
+ updateMultiplicity(context.getPictogramElement(), algorithm, node,
+ graphMulti);
+ return true;
+ }
+
+ /**
+ * Update text (and if the Stereotype Extension is installed the
+ * Stereotypetext).
+ *
+ * @param context
+ * the UpdateContext.
+ * @param node
+ * the FMCNode.
+ */
+ protected void updateText(IUpdateContext context, FMCNode node) {
+ AbstractText text = findText((ContainerShape) context
+ .getPictogramElement());
+ if (text != null) {
+ String stereotypeText = "";
+ if (stereotypeProvider != null)
+ stereotypeText = stereotypeProvider.getStereotypeText(node);
+ String nodeText = node.getName();
+ text.setValue(nodeText == null ? stereotypeText : stereotypeText
+ + nodeText);
+
+ } else {
+ // TODO Add new text
+ }
+ }
+
+ /**
+ * Update the multiplicity representation of the given ContainerShape
+ * object.
+ *
+ * @param picto
+ * the PictogramElement.
+ * @param algorithm
+ * the FMCNodeAlgorithm.
+ * @param node
+ * the FMCNode
+ * @param graphMulti
+ * Is the multiplicity set in the graphical representation.
+ */
+ protected void updateMultiplicity(PictogramElement picto,
+ FMCNodeAlgorithm algorithm, FMCNode node, boolean graphMulti) {
+ algorithm
+ .setMultipleInstances(
+ (ContainerShape) picto,
+ getFeatureProvider(),
+ ((node.getMultiplicity() == MultiplicityType.MANY) && (!graphMulti)));
+ }
+
+ /**
+ * Equals text between the graphical representation and the business object.
+ *
+ * @param text
+ * the AbstractText
+ * @param node
+ * the FMCNode
+ * @return true, if equals
+ */
+ protected boolean equalsText(AbstractText text, FMCNode node) {
+ if ((text == null) || (node.getName() == null))
+ return true;
+ String substringText = text.getValue();
+ if (stereotypeProvider != null)
+ substringText = FMCUtil
+ .substringStereotype(substringText);
+
+ return substringText.equals(node.getName());
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/StorageUpdateMetaFeature.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/StorageUpdateMetaFeature.java
new file mode 100644
index 0000000..447692e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/StorageUpdateMetaFeature.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.features.update;
+
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.util.DotsConnectionHelper;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+
+/**
+ * Feature Class for updating the graphical representation and the business
+ * model of a Storage.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class StorageUpdateMetaFeature extends FMCNodeUpdateFeature {
+
+ /**
+ * Constructor just calls the super constructor.
+ *
+ * @param fp
+ * The FeatureProvider
+ * @param stereotypeProvider
+ * The StereotypeProvider Class.
+ */
+ public StorageUpdateMetaFeature(IFeatureProvider fp,
+ IStereotypeProvider stereotypeProvider) {
+ super(fp, stereotypeProvider);
+ }
+
+ /**
+ * Calls the DotsConnectionHelper to check if the ContainerShape has a
+ * graphical multiplicity representation.
+ */
+ @Override
+ protected boolean gaphicalMultiplicity(ContainerShape container,
+ FMCNode node) {
+ return new DotsConnectionHelper().graphicalMultiplicity(container, node);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/package.html
new file mode 100644
index 0000000..d270525
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/features/update/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all modified update features, which has different behaviour as the superclass at the blockdiagram editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/MetaFMCTypeHelper.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/MetaFMCTypeHelper.java
new file mode 100644
index 0000000..b1128e7
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/MetaFMCTypeHelper.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.model;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.RequestDirection;
+
+/**
+ * Class for checking a pictogram Element which FMC type it represent.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class MetaFMCTypeHelper implements FMCTypeChecker {
+
+ /**
+ * Check if the given pictogram element represent a FMCNode object.
+ */
+ @Override
+ public boolean isFMCNode(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getFMCNode());
+ }
+
+ /**
+ * Check if the given pictogram element represent a FMCConnection object.
+ */
+ @Override
+ public boolean isFMCConnection(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getFMCConnection());
+ }
+
+ /**
+ * Check if the given pictogram element represent a Agent object.
+ */
+ @Override
+ public boolean isAgent(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getAgent());
+ }
+
+ /**
+ * Check if the given pictogram element represent a HumanAgent object.
+ */
+ @Override
+ public boolean isHumanAgent(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo != null && bo instanceof Agent) {
+ return ((Agent) bo).isHuman();
+ } else
+ return false;
+ }
+
+ /**
+ * Check if the given pictogram element represent a Storage object.
+ */
+ @Override
+ public boolean isStorage(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getStorage());
+ }
+
+ /**
+ * Check if the given pictogram element represent a StructureVariance
+ * object.
+ */
+ @Override
+ public boolean isStructureVariance(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getStructureVariance());
+ }
+
+ /**
+ * Check if the given pictogram element represent a CommunicationChannel
+ * object.
+ */
+ @Override
+ public boolean isCommunicationChannel(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getChannel());
+ }
+
+ /**
+ * Check if the given pictogram element represent a Channel object.
+ */
+ @Override
+ public boolean isChannelType(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getChannel());
+ }
+
+ /**
+ * Check if the given pictogram element represent a Access object.
+ */
+ @Override
+ public boolean isAccessType(PictogramElement element) {
+ return isType(element, FmcPackage.eINSTANCE.getAccess());
+ }
+
+ /**
+ * Check if the given object represent a Channel object.
+ */
+ @Override
+ public boolean isChannelType(Object obj) {
+ return (obj.equals(FmcPackage.eINSTANCE.getChannel()) || FmcPackage.eINSTANCE
+ .getChannel().isInstance(obj));
+ }
+
+ /**
+ * Check if the given object represent a CommunicationChannel object.
+ */
+ @Override
+ public boolean isReqRespCommunicationChannel(Object obj) {
+ if (obj instanceof Channel) {
+ return ((Channel) obj).getChannelType() != RequestDirection.UNSPECIFIED;
+ } else
+ return false;
+ }
+
+ /**
+ * Check if the given object represent a UnidirectionalCommunicationChannel
+ * object.
+ */
+ @Override
+ public boolean isUnidirectionalCommunicationChannel(Object obj) {
+ if (obj instanceof Channel) {
+ return ((Channel) obj).getDataflowDirection() == DataflowDirection.DEFAULT;
+ } else
+ return false;
+ }
+
+ /**
+ * Check if the given Connection represent a isReqRespCommunicationChannel
+ * object.
+ */
+ @Override
+ public boolean isReqRespCommunicationChannel(Connection con) {
+ EObject bo = FMCUtil.getBO(con);
+ return isReqRespCommunicationChannel(bo);
+ }
+
+ /**
+ * Check if the given pictogram element has a link to the given EClass.
+ */
+ private boolean isType(PictogramElement element, EClass clazz) {
+ if (element == null)
+ return false;
+ else if (element.getLink() != null && clazz != null) {
+ for (EObject object : element.getLink().getBusinessObjects()) {
+ if (clazz.isInstance(object))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a ModifyAccess object.
+ */
+ @Override
+ public boolean isModifyAccess(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Access) {
+ return ((Access) bo).getType() != AccessType.RW;
+ } else
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a Brace object.
+ */
+ @Override
+ public boolean isBrace(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Comment)
+ return ((Comment) bo).getType() == CommentType.BRACE;
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a AreaBorder object.
+ */
+ @Override
+ public boolean isAreaBorder(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Comment)
+ return ((Comment) bo).getType() == CommentType.AREABORDER;
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a Dots object.
+ */
+ @Override
+ public boolean isDots(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Comment)
+ return ((Comment) bo).getType() == CommentType.DOTS;
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a text comment object.
+ */
+ @Override
+ public boolean isTextComment(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Comment)
+ return ((Comment) bo).getType() == CommentType.TEXT;
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a comment object.
+ */
+ @Override
+ public boolean isComment(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ return bo instanceof Comment;
+ }
+
+ /**
+ * Check if the given pictoram element represents a image object.
+ */
+ public boolean isImage(PictogramElement element) {
+ // TODO To be implemented
+ return false;
+ }
+
+ /**
+ * Check if the given pictoram element represents a CommonFeatureArea
+ * object.
+ */
+ public boolean isCommonFeatureArea(PictogramElement element) {
+ EObject bo = FMCUtil.getBO(element);
+ if (bo instanceof Comment)
+ return ((Comment) bo).getType() == CommentType.COMMONFEATUREAREA;
+ return false;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/package.html
new file mode 100644
index 0000000..311ca29
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/model/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains helper classes, which checks the type of a blockdiagram business model.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/package.html
new file mode 100644
index 0000000..b8dee9e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>The basic package for the blockdiagram meta editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IDiagramSaved.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IDiagramSaved.java
new file mode 100644
index 0000000..820ecd9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IDiagramSaved.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.profile;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * The Interface which must be implemented by the Stereotype Extension.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public interface IDiagramSaved {
+
+ /**
+ * Check the constraints when the diagram is saved.
+ *
+ * @param diagram
+ * The diagram which was saved.
+ * @param model
+ * The model behind the diagram.
+ * @param savedResources
+ * Resource[] Object.
+ */
+ public void diagramSaved(Diagram diagram, FMCModel model,
+ Resource[] savedResources);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/ISectionProvider.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/ISectionProvider.java
new file mode 100644
index 0000000..636cfa5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/ISectionProvider.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.profile;
+
+import java.util.List;
+
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+import org.eclipse.fmc.blockdiagram.editor.property.FMCPropertySection;
+
+/**
+ * The Interface which must be implemented by the Stereotype Extension.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public interface ISectionProvider {
+ /**
+ * Create Controls for a Property Section.
+ *
+ * @param parent
+ * The Composite.
+ * @param aTabbedPropertySheetPage
+ * The TabbedPropertySheetPage.
+ * @param owner
+ * The FMCPropertySection.
+ */
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage,
+ FMCPropertySection owner);
+
+ /**
+ * Check if for the given PictogramElement the section must be shown.
+ *
+ * @param pictogramElement
+ * The PictogramElement to check.
+ * @return true for accepting otherwise false.
+ */
+ public boolean accept(PictogramElement pictogramElement);
+
+ /**
+ * Refresh the section.
+ *
+ * @param input
+ * for multiple selection.
+ * @param singleInput
+ * for single selection.
+ */
+ public void refresh(List<PictogramElement> input,
+ PictogramElement singleInput);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IStereotypeProvider.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IStereotypeProvider.java
new file mode 100644
index 0000000..02f64dd
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/IStereotypeProvider.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.profile;
+
+import org.eclipse.fmc.mm.FMCElement;
+
+/**
+ * The Interface which must be implemented by the Stereotype Extension.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public interface IStereotypeProvider {
+
+ /**
+ * Get the Stereotype text for a given FMCElement.
+ *
+ * @param node
+ * FMCElement which Stereotype text is needed.
+ * @return The Stereotypes text for node.
+ */
+ public String getStereotypeText(FMCElement node);
+
+ /**
+ * Erase the Stereotype text from a given string.
+ *
+ * @param value
+ * String which should substring.
+ * @return String object without the Stereotype text.
+ */
+ public String substringStereotype(String value);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/package.html
new file mode 100644
index 0000000..31fb856
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/profile/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all interfaces, which must be implemented by the stereotype extension.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ConnectionPropertyMetaSection.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ConnectionPropertyMetaSection.java
new file mode 100644
index 0000000..d90f66f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ConnectionPropertyMetaSection.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Extended ConnectionPropertySection for Connections.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ConnectionPropertyMetaSection extends
+ org.eclipse.fmc.blockdiagram.editor.property.ConnectionPropertySection {
+
+ /**
+ * Insert some placeholders.
+ */
+ @Override
+ protected void createDataFlowDirection(TabbedPropertySheetWidgetFactory fac) {
+ // placeholders - data flow direction property -> model property tab
+ fac.createLabel(comp, "");
+ fac.createLabel(comp, "");
+ }
+
+ /**
+ * Insert some placeholders.
+ */
+ @Override
+ protected void createRequestDirection(TabbedPropertySheetWidgetFactory fac) {
+ // placeholders - request direction property -> model property tab
+ fac.createLabel(comp, "");
+ fac.createLabel(comp, "");
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/MetaPropertySection.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/MetaPropertySection.java
new file mode 100644
index 0000000..56222c5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/MetaPropertySection.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.IStereotypeProvider;
+import org.eclipse.fmc.blockdiagram.editor.property.DefaultPropertySection;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+
+/**
+ * Extends the DefaultPropertySection for Stereotype Extension specific
+ * subjects.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class MetaPropertySection extends DefaultPropertySection {
+
+ /**
+ * Load the Stereotype Extension and call the update Method provided by the
+ * Extension.
+ */
+ @Override
+ public void update(final Notification notification) {
+ final EObject eObject = (EObject) notification.getNotifier();
+ if (!isDisposed() && isSelection(eObject) && !isDeleted(eObject)) {
+ getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (!isDisposed() && isSelection(eObject)
+ && !isDeleted(eObject))
+ refresh();
+ DiagramEditor editor = (DiagramEditor) FMCUtil
+ .getActiveEditor();
+ TransactionalEditingDomain domain = editor
+ .getEditingDomain();
+ final PictogramElement pe = editor
+ .getSelectedPictogramElements()[0];
+ Map<EStructuralFeature, GraphicsAlgorithm> map = FMCUtil
+ .getLinkedFeaturesMap(pe, eObject);
+ final GraphicsAlgorithm algo;
+ if (map != null) {
+ algo = map.get(notification.getFeature());
+ domain.getCommandStack().execute(
+ new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ if (algo != null
+ && algo instanceof org.eclipse.graphiti.mm.algorithms.AbstractText) {
+ String stereotypeText = "";
+ if ((eObject != null)
+ && (eObject instanceof FMCNode)) {
+
+ IExtensionRegistry reg = Platform
+ .getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ IStereotypeProvider entry;
+ try {
+ entry = (IStereotypeProvider) extensions[0]
+ .createExecutableExtension("stereotypeProvider");
+ stereotypeText = entry
+ .getStereotypeText((FMCNode) eObject);
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+ String newValue = notification
+ .getNewStringValue() == null ? stereotypeText
+ : stereotypeText
+ + notification
+ .getNewStringValue();
+
+ ((org.eclipse.graphiti.mm.algorithms.AbstractText) algo)
+ .setValue(newValue);
+ }
+ }
+ });
+ editor.getDiagramBehavior().refresh();
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileFilter.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileFilter.java
new file mode 100644
index 0000000..2b08a06
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileFilter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ * Extends the AbstractPropertySectionFilter Class for Stereotype Extension
+ * specific subjects.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ProfileFilter extends AbstractPropertySectionFilter {
+
+ /**
+ * Check if the given PictogramElement has the possibility to add Stereotype
+ * Values. This will be checked in the Stereotype Extension.
+ */
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ ISectionProvider entry;
+ try {
+ entry = (ISectionProvider) extensions[0]
+ .createExecutableExtension("profileSection");
+ return entry.accept(pictogramElement);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileSection.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileSection.java
new file mode 100644
index 0000000..faca058
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ProfileSection.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.fmc.blockdiagram.editor.property.FMCPropertySection;
+
+/**
+ * This property section shows actions and properties when the diagram is
+ * selected in the editor.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ProfileSection extends FMCPropertySection {
+
+ /* the loaded Stereotype Extension */
+ ISectionProvider extension;
+
+ /**
+ * Create Controls for selecting and applying Profiles on a diagram. This
+ * will be done in the Stereotype Extension.
+ */
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ try {
+ extension = (ISectionProvider) extensions[0]
+ .createExecutableExtension("profileSection");
+ extension
+ .createControls(parent, aTabbedPropertySheetPage, this);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Refresh the profile section. This will be done in the Stereotype
+ * Extension.
+ */
+ @Override
+ public void refresh() {
+ super.refresh();
+ if (extension != null)
+ extension.refresh(getInput(), getSingleInput());
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ShapePropertyMetaSection.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ShapePropertyMetaSection.java
new file mode 100644
index 0000000..664bcc9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/ShapePropertyMetaSection.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Extended ShapePropertySection for Shapes.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class ShapePropertyMetaSection extends
+ org.eclipse.fmc.blockdiagram.editor.property.ShapePropertySection {
+
+ /**
+ * Insert some placeholders.
+ */
+ @Override
+ protected void createMultiInstance(TabbedPropertySheetWidgetFactory fac) {
+ // placeholders - multi instance property -> model property tab
+ fac.createLabel(comp, "");
+ fac.createLabel(comp, "");
+ }
+
+ /**
+ * Insert some placeholders.
+ */
+ @Override
+ protected void createHumanAgent(TabbedPropertySheetWidgetFactory fac) {
+ // placeholders - human agent property -> model property tab
+ fac.createLabel(comp, "");
+ fac.createLabel(comp, "");
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeFilter.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeFilter.java
new file mode 100644
index 0000000..f2142e0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeFilter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ * Extends the AbstractPropertySectionFilter Class for the Stereotype Extension
+ * specific subjects.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class StereotypeFilter extends AbstractPropertySectionFilter {
+
+ /**
+ * Check if the given PictogramElement has the possibility to add Stereotype
+ * Values. This will be checked in the Stereotype Extension.
+ */
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ ISectionProvider entry;
+ try {
+ entry = (ISectionProvider) extensions[0]
+ .createExecutableExtension("stereotypeSection");
+ return entry.accept(pictogramElement);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeSection.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeSection.java
new file mode 100644
index 0000000..40fd87b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/StereotypeSection.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.property;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.fmc.blockdiagram.editor.meta.profile.ISectionProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+import org.eclipse.fmc.blockdiagram.editor.property.FMCPropertySection;
+
+/**
+ * This property section shows actions and properties when the diagram is
+ * selected in the editor.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class StereotypeSection extends FMCPropertySection {
+
+ ISectionProvider extension;
+
+ /**
+ * Load the Controls for the StereotypeSection from a loaded Extension.
+ */
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.meta.profile");
+ if (extensions.length == 1) {
+ try {
+ extension = (ISectionProvider) extensions[0]
+ .createExecutableExtension("stereotypeSection");
+ extension
+ .createControls(parent, aTabbedPropertySheetPage, this);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ /**
+ * Send the refresh Command for the StereotypeSection to a loaded Extension.
+ */
+ @Override
+ public void refresh() {
+ super.refresh();
+ if (extension != null)
+ extension.refresh(getInput(), getSingleInput());
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/package.html
new file mode 100644
index 0000000..7f69057
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/property/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all classes, which implement the property view of the diagram.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/AddConnectionHelper.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/AddConnectionHelper.java
new file mode 100644
index 0000000..1e04192
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/AddConnectionHelper.java
@@ -0,0 +1,394 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.meta.BlockDiagramMetaFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.meta.features.add.AccessAddMetaFeature;
+import org.eclipse.graphiti.features.IFeature;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+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.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.features.CompositeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommunicationChannelAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Storage;
+import org.eclipse.fmc.mm.impl.AgentImpl;
+import org.eclipse.fmc.mm.impl.StorageImpl;
+
+/**
+ * The AddConnectionHelper for the Blockdiagram Meta Editor.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class AddConnectionHelper {
+
+ /** The CompositeFeature. */
+ CompositeFeature cf = null;
+
+ /**
+ * Adds all connections from the meta model to the graphical representation.
+ *
+ * @param picEl
+ * the PictogramElement
+ * @param fmcFP
+ * the FMCMetaFeatureProvider
+ * @param diargam
+ * the diargam
+ */
+ public void addAgentConnections(PictogramElement picEl,
+ BlockDiagramMetaFeatureProvider fmcFP, Diagram diargam) {
+ HashMap<EObject, List<PictogramElement>> diagramEObj = new HashMap<EObject, List<PictogramElement>>();
+ GetAllEObjectOfDiagram(diargam, diagramEObj);
+ AgentImpl agent = (AgentImpl) FMCUtil.getBO(picEl);
+
+ if (agent.getAccessConnections().size() == 0
+ && agent.getSourceChannels().size() == 0
+ && agent.getTargetChannels().size() == 0)
+ return;
+
+ // Manage CompositeFeature
+ ArrayList<IFeature> cFList = new ArrayList<IFeature>();
+
+ List<Channel> sourceChanels = getSourceChanels(agent, diagramEObj);
+ for (Channel chl : sourceChanels) {
+ for (PictogramElement pe : diagramEObj.get(chl.getTarget())) {
+ AddConnectionContext context = createContext(picEl, pe, chl,
+ ConnectionStyle.MANHATTAN);
+ CommunicationChannelAddFeature addFeature = (CommunicationChannelAddFeature) fmcFP
+ .getAddFeature(context);
+ addFeature.execute(context);
+ cFList.add(addFeature);
+ }
+ }
+
+ List<Channel> targetChanels = getTargetChanels(agent, diagramEObj);
+ for (Channel chl : targetChanels) {
+ for (PictogramElement pe : diagramEObj.get(chl.getSource())) {
+ AddConnectionContext context = createContext(pe, picEl, chl,
+ ConnectionStyle.MANHATTAN);
+ CommunicationChannelAddFeature addFeature = (CommunicationChannelAddFeature) fmcFP
+ .getAddFeature(context);
+ addFeature.execute(context);
+ cFList.add(addFeature);
+ }
+ }
+
+ List<Access> storageConn = getStorageConnections(agent, diagramEObj);
+ for (Access access : storageConn) {
+ for (PictogramElement pe : diagramEObj.get(access.getTarget())) {
+ AddConnectionContext context = null;
+
+ if (access.getType() == AccessType.READ)
+ context = createContext(pe, picEl, access,
+ ConnectionStyle.MANHATTAN);
+ else if (access.getType() == AccessType.WRITE)
+ context = createContext(picEl, pe, access,
+ ConnectionStyle.MANHATTAN);
+ else
+ context = createContext(picEl, pe, access,
+ ConnectionStyle.COMPOSITE);
+
+ AccessAddMetaFeature addFeature = (AccessAddMetaFeature) fmcFP
+ .getAddFeature(context);
+ addFeature.execute(context);
+ cFList.add(addFeature);
+ }
+ }
+
+ // Manage CompositeFeature
+ IFeature[] featureList = new IFeature[cFList.size()];
+ cf = new CompositeFeature(cFList.toArray(featureList));
+ }
+
+ /**
+ * Adds all connections from the meta model to the graphical representation.
+ *
+ * @param picEl
+ * the PictogramElement
+ * @param fmcFP
+ * the FMCMetaFeatureProvider
+ * @param diargam
+ * the diargam
+ */
+ public void addStorageConnections(PictogramElement picEl,
+ BlockDiagramMetaFeatureProvider fmcFP, Diagram diargam) {
+ HashMap<EObject, List<PictogramElement>> diagramEObj = new HashMap<EObject, List<PictogramElement>>();
+ GetAllEObjectOfDiagram(diargam, diagramEObj);
+ StorageImpl storage = (StorageImpl) FMCUtil.getBO(picEl);
+
+ if (storage.getConnections().size() == 0)
+ return;
+
+ // Manage CompositeFeature
+ ArrayList<IFeature> cFList = new ArrayList<IFeature>();
+
+ List<Access> storageConn = getStorageConnections(storage, diagramEObj);
+ for (Access access : storageConn) {
+ for (PictogramElement pe : diagramEObj.get(access.getAgent())) {
+ AddConnectionContext context = null;
+
+ if (access.getType() == AccessType.READ)
+ context = createContext(picEl, pe, access,
+ ConnectionStyle.MANHATTAN);
+ else if (access.getType() == AccessType.WRITE)
+ context = createContext(pe, picEl, access,
+ ConnectionStyle.MANHATTAN);
+ else
+ context = createContext(pe, picEl, access,
+ ConnectionStyle.COMPOSITE);
+
+ AccessAddMetaFeature addFeature = (AccessAddMetaFeature) fmcFP
+ .getAddFeature(context);
+ addFeature.execute(context);
+ cFList.add(addFeature);
+ }
+ }
+
+ // Manage CompositeFeature
+ IFeature[] featureList = new IFeature[cFList.size()];
+ cf = new CompositeFeature(cFList.toArray(featureList));
+ }
+
+ /**
+ * Get all EObject of a diagram.
+ *
+ * @param cShape
+ * ContainerShape (diagram)
+ * @param map
+ * the map with the EObject as key and a list of
+ * PictogramElements.
+ */
+ private void GetAllEObjectOfDiagram(ContainerShape cShape,
+ Map<EObject, List<PictogramElement>> map) {
+ for (Shape shape : cShape.getChildren()) {
+ if (shape instanceof ContainerShape)
+ GetAllEObjectOfDiagram((ContainerShape) shape, map);
+ if (!shape.isActive())
+ continue;
+ EObject obj = FMCUtil.getBO(shape);
+ if (map.containsKey(obj))
+ map.get(obj).add(shape);
+ else {
+ ArrayList<PictogramElement> lst = new ArrayList<PictogramElement>();
+ lst.add(shape);
+ map.put(obj, lst);
+ }
+ }
+ }
+
+ /**
+ * Gets the storage connections.
+ *
+ * @param storage
+ * the storage
+ * @param diagramEObj
+ * the diagram e obj
+ * @return the storage connections
+ */
+ private List<Access> getStorageConnections(Storage storage,
+ Map<EObject, List<PictogramElement>> diagramEObj) {
+ ArrayList<Access> returnList = new ArrayList<Access>();
+ for (Access access : storage.getConnections()) {
+ if (diagramEObj.containsKey(access.getAgent()))
+ returnList.add(access);
+ }
+
+ return returnList;
+ }
+
+ /**
+ * Gets the storage connections.
+ *
+ * @param agent
+ * the agent
+ * @param diagramEObj
+ * the diagram e obj
+ * @return the storage connections
+ */
+ private List<Access> getStorageConnections(Agent agent,
+ Map<EObject, List<PictogramElement>> diagramEObj) {
+ ArrayList<Access> returnList = new ArrayList<Access>();
+ for (Access access : agent.getAccessConnections()) {
+ if (diagramEObj.containsKey(access.getTarget()))
+ returnList.add(access);
+ }
+
+ return returnList;
+ }
+
+ /**
+ * Gets the source chanels.
+ *
+ * @param agent
+ * the agent
+ * @param diagramEObj
+ * the diagram e obj
+ * @return the source chanels
+ */
+ private List<Channel> getSourceChanels(Agent agent,
+ Map<EObject, List<PictogramElement>> diagramEObj) {
+ ArrayList<Channel> returnList = new ArrayList<Channel>();
+ for (Channel chl : agent.getSourceChannels()) {
+ if (diagramEObj.containsKey(chl.getTarget()))
+ returnList.add(chl);
+ }
+
+ return returnList;
+ }
+
+ /**
+ * Gets the target chanels.
+ *
+ * @param agent
+ * the agent
+ * @param diagramEObj
+ * the diagram e obj
+ * @return the target chanels
+ */
+ private List<Channel> getTargetChanels(Agent agent,
+ Map<EObject, List<PictogramElement>> diagramEObj) {
+ ArrayList<Channel> returnList = new ArrayList<Channel>();
+ for (Channel chl : agent.getTargetChannels()) {
+ if (diagramEObj.containsKey(chl.getSource()))
+ returnList.add(chl);
+ }
+
+ return returnList;
+ }
+
+ /**
+ * Gets the anchor.
+ *
+ * @param pe
+ * the pe
+ * @return the anchor
+ */
+ private Anchor getAnchor(PictogramElement pe) {
+ Anchor ret = null;
+ if (pe instanceof Anchor) {
+ ret = (Anchor) pe;
+ } else if (pe instanceof AnchorContainer) {
+ ret = Graphiti.getPeService()
+ .getChopboxAnchor((AnchorContainer) pe);
+ }
+ return ret;
+ }
+
+ /**
+ * Creates the context.
+ *
+ * @param sourceObject
+ * the source object
+ * @param targetObject
+ * the target object
+ * @param obj
+ * the obj
+ * @param connStyle
+ * the conn style
+ * @return the adds the connection context
+ */
+ private AddConnectionContext createContext(PictogramElement sourceObject,
+ PictogramElement targetObject, Object obj, ConnectionStyle connStyle) {
+
+ AddConnectionContext connectionContext = new AddConnectionContext(
+ getAnchor(sourceObject), getAnchor(targetObject));
+ connectionContext.setNewObject(obj);
+ connectionContext.putProperty(
+ BlockDiagramConstants.GRAPHICAL_TYPE_KEY, connStyle);
+ return connectionContext;
+ }
+
+ /**
+ * Checks if is available.
+ *
+ * @param context
+ * the context
+ * @return true, if is available
+ */
+ public boolean isAvailable(IContext context) {
+ if (cf != null)
+ return cf.isAvailable(context);
+ return true;
+ }
+
+ /**
+ * Can execute.
+ *
+ * @param context
+ * the context
+ * @return true, if successful
+ */
+ public boolean canExecute(IContext context) {
+ if (cf != null)
+ return cf.canExecute(context);
+ return true;
+ }
+
+ /**
+ * Execute.
+ *
+ * @param context
+ * the context
+ */
+ public void execute(IContext context) {
+ if (cf != null)
+ cf.execute(context);
+ }
+
+ /**
+ * Can undo.
+ *
+ * @param context
+ * the context
+ * @return true, if successful
+ */
+ public boolean canUndo(IContext context) {
+ if (cf != null)
+ return cf.canUndo(context);
+ return true;
+ }
+
+ /**
+ * Checks for done changes.
+ *
+ * @return true, if successful
+ */
+ public boolean hasDoneChanges() {
+ if (cf != null)
+ return cf.hasDoneChanges();
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/DotsConnectionHelper.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/DotsConnectionHelper.java
new file mode 100644
index 0000000..cba4c07
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/DotsConnectionHelper.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.util;
+
+import java.util.List;
+
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsConnectionAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.FMCNode;
+
+/**
+ * The Class DotsConnectionHelper.
+ */
+public class DotsConnectionHelper {
+
+ /**
+ * Check if a given container for Gaphical multiplicity.
+ *
+ * @param container
+ * the container
+ * @param node
+ * the node
+ * @return true, if successful
+ */
+ public boolean graphicalMultiplicity(ContainerShape container, FMCNode node) {
+ List<Connection> cons = FMCUtil.getAllConnections(container);
+ for (Connection conn : cons) {
+ if (!DotsConnectionAddFeature.isDots(conn))
+ continue;
+ if (checkDotsConnection(conn.getStart().getParent(), conn.getEnd()
+ .getParent()))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if two given container has a dots connection.
+ *
+ * @param aConn1
+ * the AnchorContainer 1
+ * @param aConn2
+ * the AnchorContainer 2
+ * @return true, if successful
+ */
+ private boolean checkDotsConnection(AnchorContainer aConn1,
+ AnchorContainer aConn2) {
+ if ((aConn1.getLink().getBusinessObjects() != null)
+ && (aConn1.getLink().getBusinessObjects().size() == 1)
+ && (aConn2.getLink().getBusinessObjects() != null)
+ && (aConn2.getLink().getBusinessObjects().size() == 1)) {
+ if (aConn1.getLink().getBusinessObjects().get(0)
+ .equals(aConn2.getLink().getBusinessObjects().get(0)))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/FMCMetaUtil.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/FMCMetaUtil.java
new file mode 100644
index 0000000..87f7e40
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/FMCMetaUtil.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.util;
+
+import java.util.Collections;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.fmc.blockdiagram.editor.meta.Activator;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * Utility Class for the Meta Editor.
+ *
+ * @author Patrick Jahnke
+ *
+ */
+public class FMCMetaUtil {
+
+ private FMCMetaUtil() {
+ }
+
+ /**
+ * Adds the model object.
+ *
+ * @param obj
+ * the object to add
+ * @param d
+ * the diagram
+ * @param fp
+ * the featureprovider
+ */
+ public static void addModelObject(EObject obj, Diagram d,
+ IFeatureProvider fp) {
+ URI uri = d.eResource().getURI();
+ uri = uri.trimFragment();
+ uri = uri.trimFileExtension();
+ uri = uri.appendFileExtension("block");
+ ResourceSet rSet = d.eResource().getResourceSet();
+ /*
+ * final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
+ * .getRoot(); IResource file =
+ * workspaceRoot.findMember(uri.toPlatformString(true)); Resource r =
+ * null;
+ */
+ FMCModel root = null;
+ Resource file = rSet.getResource(uri, false);
+ if (file == null) {
+ file = rSet.createResource(uri);
+ root = FmcFactory.eINSTANCE.createFMCModel();
+ file.getContents().add(root);
+ try {
+ file.save(Collections.EMPTY_MAP);
+ } catch (Exception e) {
+ Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID)).log(
+ new Status(Status.ERROR, Activator.PLUGIN_ID,
+ "Could not save the model file", e));
+ }
+ fp.link(d, new EObject[] { root });
+ }
+
+ else {
+ file = rSet.getResource(uri, true);
+ root = (FMCModel) file.getContents().get(0);
+ }
+
+ if (obj instanceof FMCNode) {
+ FMCNode node = (FMCNode) obj;
+ // Add only to top level model if not already contained somewhere
+ // else
+ // if (node.getContainer() == null)
+ root.getNodes().add(node);
+ } else if (obj instanceof FMCConnection) {
+ root.getConnections().add((FMCConnection) obj);
+ } else if (obj instanceof Comment) {
+ root.getComments().add((Comment) obj);
+ }
+ }
+
+ /**
+ * Get the FmcModel object from a given Diagram.
+ *
+ * @param d
+ * The diagram
+ * @return The FMCModel Object.
+ */
+ public static FMCModel getFMCModel(Diagram d) {
+ URI uri = d.eResource().getURI();
+ uri = uri.trimFragment();
+ uri = uri.trimFileExtension();
+ uri = uri.appendFileExtension("block");
+ ResourceSet rSet = d.eResource().getResourceSet();
+ FMCModel root = null;
+ Resource file = rSet.getResource(uri, false);
+ file = rSet.getResource(uri, true);
+ root = (FMCModel) file.getContents().get(0);
+ return root;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/package.html
new file mode 100644
index 0000000..633d079
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/util/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all utility classes for the Blockdiagram meta editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/FMCMetaDiagramFileWizard.java b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/FMCMetaDiagramFileWizard.java
new file mode 100644
index 0000000..54027e1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/FMCMetaDiagramFileWizard.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.meta.wizard;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.fmc.blockdiagram.editor.util.DiagramFactory;
+import org.eclipse.fmc.blockdiagram.editor.wizards.BlockDiagramFileWizard;
+
+/**
+ * This specialization of the FMCDiagramFileWizard is responsible for creating
+ * FMC files with separated graphical and model files.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCMetaDiagramFileWizard extends BlockDiagramFileWizard {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.wizards.BlockDiagramFileWizard#
+ * createBlockdiagramFile(org.eclipse.core.resources.IFile)
+ */
+ @Override
+ protected void createBlockdiagramFile(IFile file) {
+ DiagramFactory.createDefaultBlockdiagramMetaFile(
+ URI.createFileURI(file.getLocation().toFile().getAbsolutePath()),
+ diagramWidth, diagramHeight, gridUnit);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/package.html b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/package.html
new file mode 100644
index 0000000..a508962
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.meta/src/org/eclipse/fmc/blockdiagram/editor/meta/wizard/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains wizard related code for the blockdiagram meta editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/.classpath b/org.eclipse.fmc.blockdiagram.editor.tests/.classpath
new file mode 100644
index 0000000..098194c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/.gitignore b/org.eclipse.fmc.blockdiagram.editor.tests/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/.project b/org.eclipse.fmc.blockdiagram.editor.tests/.project
new file mode 100644
index 0000000..f3a826b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.blockdiagram.editor.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.fmc.blockdiagram.editor.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/META-INF/MANIFEST.MF b/org.eclipse.fmc.blockdiagram.editor.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..699c492
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.eclipse.fmc.blockdiagram.editor.tests
+Bundle-Version: 0.11.0.qualifier
+Fragment-Host: org.eclipse.fmc.blockdiagram.editor
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.graphiti,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.ui.ide,
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.fmc.mm
+Import-Package: org.junit,
+ org.junit.runner
+Bundle-Vendor: Eclipse Modeling Project
+
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/about.html b/org.eclipse.fmc.blockdiagram.editor.tests/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/build.properties b/org.eclipse.fmc.blockdiagram.editor.tests/build.properties
new file mode 100644
index 0000000..a8cc5fe
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ConnectionTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ConnectionTest.java
new file mode 100644
index 0000000..c9f01ae
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ConnectionTest.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_ACCESS_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_ACCESS_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_COMM_CH_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_COMM_CH_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_DOTS_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_DOTS_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_MODIFY_ACCESS;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_REQRESP_COMM_CH_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_REQRESP_COMM_CH_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_ACCESS_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_ACCESS_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_COMM_CH_FF;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_COMM_CH_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STRUCTURE_VARIANCE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.junit.Test;
+
+public class ConnectionTest extends FMCTestCase {
+
+ @Test
+ public void testUnidirectionalAccessMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_UNI_ACCESS_MH,
+ agent, storage);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testUnidirectionalAccessFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_UNI_ACCESS_FF,
+ agent, storage);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testBidirectionalAccessMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_BI_ACCESS_MH,
+ agent, storage);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testBidirectionalAccessFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_BI_ACCESS_FF,
+ agent, storage);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testModifyAccess() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_MODIFY_ACCESS,
+ agent, storage);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testBidirectionalComChannelMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_BI_COMM_CH_MH,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testBidirectionalComChannelFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_BI_COMM_CH_FF,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testUnidirectionalComChannelMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_UNI_COMM_CH_MH,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testUnidirectionalComChannelFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_UNI_COMM_CH_FF,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testReqResComChannelMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_REQRESP_COMM_CH_MH,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testReqResComChannelFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_REQRESP_COMM_CH_FF,
+ agent, agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testDotsMH() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_DOTS_MH, agent,
+ agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testDotsMHWithoutTarget() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Connection connection = createConnection(CREATE_CON_DOTS_MH, agent,
+ getDiagram());
+ assertEquals("Source Agent and invisible shape expected", 2,
+ getDiagram().getChildren().size());
+ assertNotNull(connection);
+ remove(connection);
+ }
+
+ @Test
+ public void testDotsFF() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10);
+ Connection connection = createConnection(CREATE_CON_DOTS_FF, agent,
+ agent2);
+ assertNotNull(connection);
+ }
+
+ @Test
+ public void testDotsFFWithoutTarget() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Connection connection = createConnection(CREATE_CON_DOTS_FF, agent,
+ getDiagram());
+ assertEquals("Source Agent and invisible shape expected", 2,
+ getDiagram().getChildren().size());
+ assertNotNull(connection);
+ remove(connection);
+ }
+
+ @Test
+ public void testContainerRemove() {
+ ContainerShape container = (ContainerShape) createShape(
+ CREATE_FEATURE_AGENT, 400, 400, 10, 10);
+ Shape anotherShape = createShape(CREATE_FEATURE_AGENT, 400, 400, 10, 10);
+ ContainerShape container2 = (ContainerShape) createShapeInShape(
+ CREATE_FEATURE_AGENT, 200, 200, 110, 110, container);
+ Shape child = createShapeInShape(CREATE_FEATURE_AGENT, 50, 50, 130,
+ 130, container2);
+ Connection connection = createConnection(CREATE_CON_BI_COMM_CH_MH,
+ child, anotherShape);
+ assertNotNull(connection);
+ remove(container);
+ }
+
+ @Test
+ public void testConnectToStructureVariance() {
+ Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10);
+ Shape strv = createShape(CREATE_FEATURE_STRUCTURE_VARIANCE, 100, 100,
+ 200, 10);
+ Connection connection = createConnection(CREATE_CON_UNI_ACCESS_FF,
+ agent, strv);
+ assertNotNull(connection);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCDiagramStateChecker.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCDiagramStateChecker.java
new file mode 100644
index 0000000..973f2e2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCDiagramStateChecker.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc;
+
+import static org.eclipse.fmc.FMCTestCase.assertSameSize;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+public class FMCDiagramStateChecker {
+
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ public void checkDiagramState(Diagram diagram) {
+ checkNoAnchorsInDiagram(diagram);
+ checkDiagramStateRecursively(diagram);
+ checkConnectionOrphans(diagram);
+ }
+
+ private void checkDiagramStateRecursively(ContainerShape container) {
+ for (Shape shape : container.getChildren()) {
+ if (shape instanceof ContainerShape) {
+ ContainerShape childContainer = (ContainerShape) shape;
+ FMCNodeAlgorithm node = factory.getShape(shape);
+ if (node != null) {
+ if (node.isMultipleInstances(childContainer)) {
+ checkMultiInstanceShapeState(childContainer, node);
+ }
+ }
+ if (!childContainer.getGraphicsAlgorithm().isSetFilled()
+ && !childContainer.getGraphicsAlgorithm()
+ .isSetLineVisible()) {
+ for (Anchor anchor : childContainer.getAnchors()) {
+ if (anchor.getIncomingConnections().isEmpty()
+ && anchor.getOutgoingConnections().isEmpty())
+ fail("Invisible shape without connection detected");
+ }
+
+ }
+ checkDiagramStateRecursively(childContainer);
+ } else {
+
+ }
+ }
+ }
+
+ private void checkConnectionOrphans(Diagram diagram) {
+ Set<CompositeConnection> composites = new HashSet<CompositeConnection>();
+ for (Connection con : diagram.getConnections()) {
+ if (con instanceof CompositeConnection) {
+ composites.add((CompositeConnection) con);
+ }
+ }
+
+ for (Connection con : diagram.getConnections()) {
+ if (!isChildOfComposite(composites, con)) {
+ assertNotNull("Orphaned connection with no start anchor",
+ con.getStart());
+ assertNotNull("Orphaned connection with no end anchor",
+ con.getEnd());
+ assertNotNull("Orphaned connection with no start anchor", con
+ .getStart().getParent());
+ assertNotNull("Orphaned connection with no end anchor", con
+ .getEnd().getParent());
+ assertFalse(con.getStart().getParent() == diagram);
+ assertFalse(con.getEnd().getParent() == diagram);
+ }
+ }
+ }
+
+ private boolean isChildOfComposite(Set<CompositeConnection> composites,
+ Connection child) {
+ for (CompositeConnection comp : composites) {
+ for (Connection con : comp.getChildren()) {
+ if (con == child)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void checkMultiInstanceShapeState(ContainerShape childContainer,
+ FMCNodeAlgorithm node) {
+ GraphicsAlgorithm multiInstanceChildMain = node.getMultiInstanceChild(
+ childContainer, true);
+ GraphicsAlgorithm multiInstanceChildSecond = node
+ .getMultiInstanceChild(childContainer, false);
+ assertNotNull(multiInstanceChildMain);
+ assertNotNull(multiInstanceChildSecond);
+ assertEquals(multiInstanceChildMain.getClass(),
+ multiInstanceChildSecond.getClass());
+ assertSameSize(multiInstanceChildMain, multiInstanceChildSecond);
+ assertEquals(multiInstanceChildMain.getX(),
+ multiInstanceChildSecond.getX() + 5);
+ assertEquals(multiInstanceChildMain.getY() + 5,
+ multiInstanceChildSecond.getY());
+ }
+
+ private void checkNoAnchorsInDiagram(Diagram diagram) {
+ assertTrue(
+ "State of diagram not valid: There are anchors in the diagram.",
+ diagram.getAnchors().isEmpty());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCTestCase.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCTestCase.java
new file mode 100644
index 0000000..29a78f6
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/FMCTestCase.java
@@ -0,0 +1,298 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_MODIFY_ACCESS;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramEditor;
+import org.eclipse.fmc.blockdiagram.editor.util.DiagramFactory;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IRemoveFeature;
+import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.CreateContext;
+import org.eclipse.graphiti.features.context.impl.RemoveContext;
+import org.eclipse.graphiti.internal.datatypes.impl.LocationImpl;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+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.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ViewIntroAdapterPart;
+import org.eclipse.ui.internal.intro.IIntroConstants;
+import org.junit.After;
+import org.junit.Before;
+
+@SuppressWarnings("restriction")
+public abstract class FMCTestCase {
+
+ protected static final String BLOCKDIAG_FILENAME = "newDiag.blockdiag";
+ private BlockDiagramEditor editor = null;
+ private FMCDiagramStateChecker stateChecker = new FMCDiagramStateChecker();
+
+ protected BlockDiagramEditor getEditor() {
+ return this.editor;
+ }
+
+ protected void checkDiagramState() {
+ stateChecker.checkDiagramState(getDiagram());
+ }
+
+ protected TransactionalEditingDomain getEditingDomain() {
+ IWorkbenchPart activePart = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActivePart();
+
+ IEditingDomainProvider provider = (IEditingDomainProvider) activePart
+ .getAdapter(IEditingDomainProvider.class);
+ assert provider.getEditingDomain() instanceof TransactionalEditingDomain;
+ TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) provider
+ .getEditingDomain();
+ return editingDomain;
+ }
+
+ protected CreateContext createContext(int width, int height, int x, int y) {
+ CreateContext ctx = new CreateContext();
+ ctx.setLocation(x, y);
+ ctx.setSize(width, height);
+ ctx.setTargetContainer(getDiagram());
+ return ctx;
+ }
+
+ protected IFeatureProvider getFeatureProvider() {
+ return editor.getDiagramTypeProvider().getFeatureProvider();
+ }
+
+ protected Diagram getDiagram() {
+ return editor.getDiagramTypeProvider().getDiagram();
+ }
+
+ public static void assertSameAlgorithm(Shape expected, Shape actual) {
+ GraphicsAlgorithm algorithmA = expected.getGraphicsAlgorithm();
+ GraphicsAlgorithm algorithmB = actual.getGraphicsAlgorithm();
+ assertEquals(algorithmA.getClass(), algorithmB.getClass());
+ }
+
+ public static void assertSameSize(GraphicsAlgorithm expected,
+ GraphicsAlgorithm actual) {
+ assertEquals(expected.getHeight(), actual.getHeight());
+ assertEquals(expected.getWidth(), actual.getWidth());
+ if (expected instanceof RoundedRectangle) {
+ RoundedRectangle rectA = (RoundedRectangle) expected;
+ RoundedRectangle rectB = (RoundedRectangle) expected;
+ assertEquals(rectA.getCornerDimensions().width,
+ rectB.getCornerDimensions().width);
+ assertEquals(rectA.getCornerDimensions().height,
+ rectB.getCornerDimensions().height);
+ } else if (expected instanceof Polygon) {
+ Polygon polyA = (Polygon) expected;
+ Polygon polyB = (Polygon) actual;
+ assertEquals(polyA.getPoints().size(), polyB.getPoints().size());
+ Iterator<Point> iteratorB = polyB.getPoints().iterator();
+ for (Iterator<Point> iteratorA = polyA.getPoints().iterator(); iteratorA
+ .hasNext();) {
+ Point a = iteratorA.next();
+ Point b = iteratorB.next();
+ assertEquals(a.getX(), b.getX());
+ assertEquals(a.getY(), b.getY());
+ }
+ }
+
+ }
+
+ public static void assertSameLocation(Shape expected, Shape actual) {
+ GraphicsAlgorithm algorithmA = expected.getGraphicsAlgorithm();
+ GraphicsAlgorithm algorithmB = actual.getGraphicsAlgorithm();
+ assertEquals(algorithmA.getX(), algorithmB.getX());
+ assertEquals(algorithmA.getY(), algorithmB.getY());
+ }
+
+ public static void assertSize(Shape shape, int width, int height) {
+ GraphicsAlgorithm algorithm = shape.getGraphicsAlgorithm();
+ assertEquals(width, algorithm.getWidth());
+ assertEquals(height, algorithm.getHeight());
+ }
+
+ public void assertPosition(Shape shape, int x, int y) {
+ GraphicsAlgorithm algorithm = shape.getGraphicsAlgorithm();
+ assertEquals(x, algorithm.getX());
+ assertEquals(y, algorithm.getY());
+ }
+
+ protected IProject getProject() {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject("TestProject");
+ return project;
+ }
+
+ private IFile getFmcFile(String filename) throws CoreException {
+ IProgressMonitor progressMonitor = new NullProgressMonitor();
+ IProject project = getProject();
+ if (!project.exists())
+ project.create(progressMonitor);
+ project.open(progressMonitor);
+ final IFile file = project.getFile(new Path(filename));
+ /*
+ * if(file.exists()){ file.delete(true, progressMonitor); }
+ */
+
+ InputStream stream;
+ try {
+ String contents = "This is the initial file contents for *.blockdiag file that should be word-sorted in the Preview page of the multi-page editor";
+ stream = new ByteArrayInputStream(contents.getBytes());
+ if (!file.exists()) {
+ file.create(stream, true, progressMonitor);
+ }
+ stream.close();
+ } catch (IOException e) {
+ }
+ createFMCFile(file);
+
+ return file;
+ }
+
+ protected void createFMCFile(final IFile file) {
+ DiagramFactory.createDefaultBlockdiagramFile(URI.createPlatformResourceURI(file
+ .getFullPath().toString(), true), 1000, 1000, 10);
+ }
+
+ protected void saveDiagram() {
+ editor.doSave(new NullProgressMonitor());
+ }
+
+ @After
+ public void tearDown() {
+ checkDiagramState();
+ saveDiagram();
+ // TODO close diagram
+ // editor.getSite().getPage().close();
+ // editor = null;
+ }
+
+ @Before
+ public void setUp() throws PartInitException, CoreException {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+
+ editor = (BlockDiagramEditor) IDE.openEditor(activePage,
+ getFmcFile(BLOCKDIAG_FILENAME));
+ ViewIntroAdapterPart viewIntro = (ViewIntroAdapterPart) activePage
+ .findView(IIntroConstants.INTRO_VIEW_ID);
+ if (viewIntro != null)
+ viewIntro.getViewSite().getPart().dispose();
+ }
+
+ protected Connection createConnection(int createFeature, Shape source,
+ Shape target) {
+ int consBefore = getDiagram().getConnections().size();
+ ICreateConnectionFeature createConnectionFeature = getFeatureProvider()
+ .getCreateConnectionFeatures()[createFeature];
+ CreateConnectionContext ctx = new CreateConnectionContext();
+ ctx.setSourcePictogramElement(source);
+ ctx.setTargetPictogramElement(target);
+ ctx.setTargetLocation(new LocationImpl(source.getGraphicsAlgorithm()
+ .getX() + 50, source.getGraphicsAlgorithm().getY() + 50));
+ if (createConnectionFeature.canExecute(ctx)) {
+ createConnectionFeature.execute(ctx);
+ assertEquals(
+ createFeature == CREATE_CON_MODIFY_ACCESS ? consBefore + 3
+ : consBefore + 1, getDiagram().getConnections()
+ .size());
+ return getDiagram().getConnections().get(consBefore);
+ } else
+ return null;
+ }
+
+ protected void remove(final PictogramElement element) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ RemoveContext ctx = new RemoveContext(element);
+ IRemoveFeature deleteFeature = getFeatureProvider()
+ .getRemoveFeature(ctx);
+ assertTrue(deleteFeature.canRemove(ctx));
+ assertTrue(deleteFeature.canExecute(ctx));
+ deleteFeature.execute(ctx);
+ }
+ });
+ }
+
+ protected Shape createShapeInShape(int createFeature, final int width,
+ final int height, final int x, final int y, ContainerShape container) {
+ int childsBefore = getDiagram().getChildren().size();
+ int childsBeforeContainer = 0;
+ ICreateFeature feature = getFeatureProvider().getCreateFeatures()[createFeature];
+ CreateContext ctx = createContext(width, height, x, y);
+ if (container != null) {
+ ctx.setTargetContainer(container);
+ childsBeforeContainer = container.getChildren().size();
+ }
+ assertTrue(feature.canExecute(ctx));
+ feature.execute(ctx);
+ if (container != null) {
+ assertEquals(childsBeforeContainer + 1, container.getChildren()
+ .size());
+ return container.getChildren().get(childsBeforeContainer);
+ } else {
+ assertEquals(childsBefore + 1, getDiagram().getChildren().size());
+ return getDiagram().getChildren().get(childsBefore);
+ }
+ }
+
+ protected Shape createShape(int createFeature, final int width,
+ final int height, final int x, final int y) {
+ return createShapeInShape(createFeature, width, height, x, y, null);
+ }
+
+ protected boolean isWriteTransaction(TransactionalEditingDomain domain) {
+ if (domain instanceof TransactionalEditingDomainImpl)
+ return !((TransactionalEditingDomainImpl) domain)
+ .getActiveTransaction().isReadOnly();
+ else
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTest.java
new file mode 100644
index 0000000..5298de9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTest.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AREA_BORDER;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_BRACE;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_COMMON_FEATURE_AREA;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_DOTS;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_HUMAN_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STRUCTURE_VARIANCE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.awt.Point;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.graphiti.features.IMoveShapeFeature;
+import org.eclipse.graphiti.features.IRemoveFeature;
+import org.eclipse.graphiti.features.IResizeShapeFeature;
+import org.eclipse.graphiti.features.context.impl.MoveShapeContext;
+import org.eclipse.graphiti.features.context.impl.RemoveContext;
+import org.eclipse.graphiti.features.context.impl.ResizeShapeContext;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.junit.Test;
+
+public class ShapeTest extends FMCTestCase {
+
+ private static final int WIDTH = 200;
+ private static final int HEIGHT = 120;
+
+ private Shape testCreate(int createFeature) {
+ return testCreate(createFeature, new Point(0, 0));
+ }
+
+ protected Shape testCreate(int createFeature, final Point offset) {
+ final int width = 200;
+ final int height = 120;
+ final int x = 2;
+ final int y = 5;
+ Shape shape = createShape(createFeature, width, height, x, y);
+ assertSize(shape, width + offset.x, height + offset.y);
+ assertPosition(shape, x, y);
+ return shape;
+ }
+
+ private void testResize(final Shape shape) {
+ testResize(shape, new Point(0, 0), Orientation.ALIGNMENT_BOTTOM);
+ }
+
+ private void testResize(final Shape shape, final Point offset,
+ final Orientation hAlignment) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ int width = 122;
+ int height = 111;
+ AbstractText text = findText((ContainerShape) shape);
+ Orientation horizontalBefore = null;
+ Orientation horizontalAfter = null;
+ if (text != null) {
+ text.setHorizontalAlignment(hAlignment);
+ horizontalBefore = text.getHorizontalAlignment();
+ horizontalAfter = text.getVerticalAlignment();
+ }
+ ResizeShapeContext ctx = new ResizeShapeContext(shape);
+ ctx.setSize(width, height);
+ IResizeShapeFeature resizeShapeFeature = getFeatureProvider()
+ .getResizeShapeFeature(ctx);
+ assertTrue(resizeShapeFeature.canResizeShape(ctx));
+ assertTrue(resizeShapeFeature.canExecute(ctx));
+ resizeShapeFeature.execute(ctx);
+ assertEquals(width + offset.x, shape
+ .getGraphicsAlgorithm().getWidth());
+ assertEquals(height + offset.y, shape
+ .getGraphicsAlgorithm().getHeight());
+ if (text != null) {
+ text = findText((ContainerShape) shape);
+ assertEquals(horizontalBefore,
+ text.getHorizontalAlignment());
+ assertEquals(horizontalAfter,
+ text.getVerticalAlignment());
+ }
+ }
+ });
+ }
+
+ private void testMove(final Shape shape) {
+ testMove(shape, new Point(0, 0));
+ }
+
+ private void testMove(final Shape shape, final Point offset) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ final int width = WIDTH;
+ final int height = HEIGHT;
+ MoveShapeContext ctx = new MoveShapeContext(shape);
+ ctx.setLocation(20, 20);
+ ctx.setSourceContainer(shape.getContainer());
+ ctx.setTargetContainer(shape.getContainer());
+ IMoveShapeFeature moveShapeFeature = getFeatureProvider()
+ .getMoveShapeFeature(ctx);
+ assertTrue(moveShapeFeature.canExecute(ctx));
+ assertTrue(moveShapeFeature.canMoveShape(ctx));
+ assertTrue(moveShapeFeature.isAvailable(ctx));
+ moveShapeFeature.execute(ctx);
+ assertSize(shape, width + offset.x, height + offset.y);
+ assertPosition(shape, 20, 20);
+ // TODO Test moving into another shape
+ }
+ });
+ }
+
+ private void testDelete(final Shape shape) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ RemoveContext ctx = new RemoveContext(shape);
+ IRemoveFeature deleteFeature = getFeatureProvider()
+ .getRemoveFeature(ctx);
+ assertTrue("Remove feature cannot be executed",
+ deleteFeature.canRemove(ctx));
+ assertTrue(deleteFeature.canExecute(ctx));
+ deleteFeature.execute(ctx);
+ assertEquals(0, getDiagram().getChildren().size());
+ }
+ });
+ }
+
+ @Test
+ public void testAgent() {
+ Shape shape = testCreate(CREATE_FEATURE_AGENT);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testAgentL() {
+ Shape shape = testCreate(CREATE_FEATURE_AGENT_L);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testAgentU() {
+ Shape shape = testCreate(CREATE_FEATURE_AGENT_U);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testStorage() {
+ Shape shape = testCreate(CREATE_FEATURE_STORAGE);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testStorageL() {
+ Shape shape = testCreate(CREATE_FEATURE_STORAGE_L);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testStorageU() {
+ Shape shape = testCreate(CREATE_FEATURE_STORAGE_U);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testHumanAgent() {
+ Shape shape = testCreate(CREATE_FEATURE_HUMAN_AGENT);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testStructureVariance() {
+ Shape shape = testCreate(CREATE_FEATURE_STRUCTURE_VARIANCE);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ /*
+ * public void testChannel(){ Shape shape =
+ * testCreate(CREATE_FEATURE_CHANNEL); testMove(shape); testResize(shape);
+ * testDelete(shape); }
+ */
+ @Test
+ public void testCommonFeatureArea() {
+ Shape shape = testCreate(CREATE_FEATURE_COMMON_FEATURE_AREA);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testBrace() {
+ Shape shape = testCreate(CREATE_FEATURE_BRACE, new Point(0, -75));
+ testMove(shape, new Point(0, -75));
+ testResize(shape, new Point(0, -84), Orientation.ALIGNMENT_RIGHT);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testAreaBorder() {
+ Shape shape = testCreate(CREATE_FEATURE_AREA_BORDER, new Point(0, -92));
+ testMove(shape, new Point(0, -92));
+ testResize(shape, new Point(0, -83), Orientation.ALIGNMENT_RIGHT);
+ testDelete(shape);
+ }
+
+ @Test
+ public void testDots() {
+ Shape shape = testCreate(CREATE_FEATURE_DOTS);
+ testMove(shape);
+ testResize(shape);
+ testDelete(shape);
+ }
+
+ private AbstractText findText(ContainerShape shape) {
+ for (Shape child : shape.getChildren()) {
+ if (child.getGraphicsAlgorithm() instanceof AbstractText) {
+ return (AbstractText) child.getGraphicsAlgorithm();
+ }
+ }
+ AbstractText found = null;
+ for (Shape child : shape.getChildren()) {
+ if (child instanceof ContainerShape)
+ found = findText((ContainerShape) child);
+ if (found != null)
+ return found;
+ }
+ return found;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTransformationsTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTransformationsTest.java
new file mode 100644
index 0000000..861b4ef
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/ShapeTransformationsTest.java
@@ -0,0 +1,423 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_HUMAN_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.AgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.HumanAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.StorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.property.PropertyActions;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.junit.Test;
+
+public class ShapeTransformationsTest extends FMCTestCase {
+
+ private static final int STYLE_RECT = 0;
+ private static final int STYLE_L = 1;
+ private static final int STYLE_U = 2;
+
+ private static final int WIDTH = 200;
+ private static final int HEIGHT = 120;
+ // private FMCTypeChecker helper = FMCTypeHelperFactory.getInstance();
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+ private PropertyActions actions;
+
+ private PropertyActions getPropertyActions() {
+ if (actions == null)
+ actions = new PropertyActions(getDiagram(), getFeatureProvider(),
+ getEditingDomain());
+ return actions;
+ }
+
+ @Test
+ public void testTransformRectStorageToLandUPlusMultiInstances() {
+ ContainerShape storage = (ContainerShape) createShape(
+ CREATE_FEATURE_STORAGE, WIDTH, HEIGHT, 20, 30);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(storage);
+ assertTrue(nodeAlgo instanceof StorageAlgorithm);
+ StorageAlgorithm storageAlgo = (StorageAlgorithm) nodeAlgo;
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ assertSize(storage, WIDTH, HEIGHT);
+ assertPosition(storage, 20, 30);
+ checkDiagramState();
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ assertFalse(storageAlgo.isMultipleInstances(storage));
+ // Now again but with multiInstance
+ setMultipleInstances(factory.getShape(storage), storage, true);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoL(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoU(storage);
+ assertTrue(storageAlgo.isMultipleInstances(storage));
+ turnStorageIntoRect(storage);
+ }
+
+ @Test
+ public void testTransformRectAgentToLandUPlusMultiInstances() {
+ ContainerShape agent = (ContainerShape) createShape(
+ CREATE_FEATURE_AGENT, WIDTH, HEIGHT, 20, 30);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ AgentAlgorithm agentAlgo = (AgentAlgorithm) nodeAlgo;
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ // Now again but with multiInstance
+ setMultipleInstances(factory.getShape(agent), agent, true);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoL(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoU(agent);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ turnAgentIntoRect(agent);
+ }
+
+ private void turnAgentIntoRect(ContainerShape agent) {
+ getPropertyActions().changeShapeStyle(agent, STYLE_RECT);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ private void turnAgentIntoL(ContainerShape agent) {
+ FMCNodeAlgorithm nodeAlgo;
+ getPropertyActions().changeShapeStyle(agent, STYLE_L);
+ nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ assertTrue(nodeAlgo instanceof LAgentAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ private void turnAgentIntoU(ContainerShape agent) {
+ FMCNodeAlgorithm nodeAlgo;
+ getPropertyActions().changeShapeStyle(agent, STYLE_U);
+ nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ assertTrue(nodeAlgo instanceof UAgentAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ private void turnStorageIntoRect(ContainerShape agent) {
+ getPropertyActions().changeShapeStyle(agent, STYLE_RECT);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof StorageAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ private void turnStorageIntoL(ContainerShape agent) {
+ FMCNodeAlgorithm nodeAlgo;
+ getPropertyActions().changeShapeStyle(agent, STYLE_L);
+ nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof StorageAlgorithm);
+ assertTrue(nodeAlgo instanceof LStorageAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ private void turnStorageIntoU(ContainerShape agent) {
+ FMCNodeAlgorithm nodeAlgo;
+ getPropertyActions().changeShapeStyle(agent, STYLE_U);
+ nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof StorageAlgorithm);
+ assertTrue(nodeAlgo instanceof UStorageAlgorithm);
+ expectHumanAgent(agent, false);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ checkDiagramState();
+ }
+
+ @Test
+ public void testTransformSingleAgentToHumanToMultipleInstances() {
+ ContainerShape agent = (ContainerShape) createShape(
+ CREATE_FEATURE_AGENT, WIDTH, HEIGHT, 20, 30);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ AgentAlgorithm agentAlgo = (AgentAlgorithm) nodeAlgo;
+ expectHumanAgent(agent, false);
+ setMultipleInstances(agentAlgo, agent, true);
+ assertSize(agent, WIDTH, HEIGHT);
+ assertPosition(agent, 20, 30);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ assertNotNull(agentAlgo.getMultiInstanceChild(agent, true));
+ assertNotNull(agentAlgo.getMultiInstanceChild(agent, false));
+ // Now turn into Human Agent
+ turnIntoHumanAgent(agent);
+ expectHumanAgent(agent, true);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into normal Agent
+ turnIntoNormalAgent(agent);
+ expectHumanAgent(agent, false);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into Human Agent
+ turnIntoHumanAgent(agent);
+ expectHumanAgent(agent, true);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into single Human Agent
+ setMultipleInstances(agentAlgo, agent, false);
+ expectHumanAgent(agent, true);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into single normal Agent
+ turnIntoNormalAgent(agent);
+ expectHumanAgent(agent, false);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into single Human Agent
+ turnIntoHumanAgent(agent);
+ expectHumanAgent(agent, true);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into multiple Human Agent
+ setMultipleInstances(agentAlgo, agent, true);
+ expectHumanAgent(agent, true);
+ assertTrue(agentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+ // Turn into single Human Agent
+ setMultipleInstances(agentAlgo, agent, false);
+ expectHumanAgent(agent, true);
+ assertFalse(agentAlgo.isMultipleInstances(agent));
+ }
+
+ private void expectHumanAgent(ContainerShape shape, boolean human) {
+ if (human) {
+ assertTrue(factory.getHumanAgent().hasHumanFigure(shape));
+ assertEquals(1, countHumanFigures(shape));
+ } else {
+ assertFalse(factory.getHumanAgent().hasHumanFigure(shape));
+ assertEquals(0, countHumanFigures(shape));
+ }
+
+ }
+
+ @Test
+ public void testTransformNormalAgentToHumanAgent() {
+ ContainerShape agent = (ContainerShape) createShape(
+ CREATE_FEATURE_HUMAN_AGENT, WIDTH, HEIGHT, 20, 30);
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof HumanAgentAlgorithm);
+ HumanAgentAlgorithm hagentAlgo = (HumanAgentAlgorithm) nodeAlgo;
+
+ turnIntoNormalAgent(agent);
+ expectHumanAgent(agent, false);
+ assertFalse(hagentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+
+ nodeAlgo = factory.getShape(agent);
+ assertTrue(nodeAlgo instanceof AgentAlgorithm);
+ AgentAlgorithm agentAlgo = (HumanAgentAlgorithm) nodeAlgo;
+ checkDiagramState();
+
+ turnIntoHumanAgent(agent);
+ expectHumanAgent(agent, true);
+ assertFalse(hagentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+
+ setMultipleInstances(agentAlgo, agent, true);
+ expectHumanAgent(agent, true);
+ assertTrue(hagentAlgo.isMultipleInstances(agent));
+ checkDiagramState();
+
+ setMultipleInstances(hagentAlgo, agent, false);
+ expectHumanAgent(agent, true);
+ assertFalse(hagentAlgo.isMultipleInstances(agent));
+ }
+
+ public int countHumanFigures(ContainerShape element) {
+ int counter = 0;
+ if (element instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) element;
+ for (Shape shape : new ArrayList<Shape>(container.getChildren())) {
+ if (shape instanceof ContainerShape
+ && shape.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren().size() == 5) {
+ counter++;
+ } else if (shape instanceof ContainerShape) {
+ counter += countHumanFigures((ContainerShape) shape);
+ }
+ }
+ ;
+ }
+ // ContainerShape multiInstanceChild = (ContainerShape)
+ // factory.getHumanAgent().getMultiInstanceChild(element, false);
+ // if(element != null){
+ // for (Shape shape : new ArrayList<Shape>(element.getChildren())) {
+ // if(shape instanceof ContainerShape &&
+ // ((ContainerShape) shape).getChildren().size() == 5){
+ // counter++;
+ // }
+ // };
+ //
+ // }
+ return counter;
+ }
+
+ private void turnIntoHumanAgent(final ContainerShape shape) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(getEditingDomain())) {
+ factory.getHumanAgent().addHumanFigure(
+ getDiagram(), shape,
+ shape.getGraphicsAlgorithm().getWidth());
+ }
+ }
+
+ });
+ }
+
+ private void turnIntoNormalAgent(final ContainerShape shape) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(getEditingDomain())) {
+ factory.getHumanAgent().removeHumanFigure(shape);
+ }
+ }
+
+ });
+ }
+
+ private void setMultipleInstances(final FMCNodeAlgorithm algo,
+ final ContainerShape shape, final boolean multi) {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(getEditingDomain())) {
+ algo.setMultipleInstances(shape,
+ getFeatureProvider(), multi);
+ }
+ }
+
+ });
+ }
+
+ /*
+ * private void refreshOldAnchors(Shape shape, GraphicsAlgorithm algorithm,
+ * Set<BoxRelativeAnchor> stillUsedAnchors){ for (BoxRelativeAnchor anchor :
+ * stillUsedAnchors) { anchor.setParent(shape);
+ * shape.getAnchors().add(anchor);
+ * anchor.setReferencedGraphicsAlgorithm(algorithm); } }
+ */
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/blockdiagram/editor/property/PropertySheetTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/blockdiagram/editor/property/PropertySheetTest.java
new file mode 100644
index 0000000..4d4a42f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/blockdiagram/editor/property/PropertySheetTest.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_HUMAN_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STRUCTURE_VARIANCE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.fmc.blockdiagram.editor.property.DiagramPropertySection;
+import org.eclipse.fmc.blockdiagram.editor.property.ShapePropertySection;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.fmc.FMCTestCase;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.HumanAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.MultipleNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UPolygonAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.junit.Test;
+
+public class PropertySheetTest extends FMCTestCase {
+
+ private static final String TAB_PREDEFINED_STYLE = "fmc.PredefinedStyleTab";
+ private static final String TAB_DIAGRAM = "fmc.DiagramTab";
+ private static final String TAB_SHAPE = "fmc.ShapeTab";
+ private static final String TAB_STYLE = "fmc.StyleTab";
+ private static final String TAB_ALIGNMENT = "fmc.AlignmentTab";
+
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ @Override
+ public void setUp() throws PartInitException, CoreException {
+ super.setUp();
+ }
+
+ TabbedPropertySheetPage getTabbedPropSheet() throws PartInitException {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+
+ PropertySheet propSheet = (PropertySheet) activePage
+ .findView(IPageLayout.ID_PROP_SHEET);
+ if (propSheet == null)
+ propSheet = (PropertySheet) activePage
+ .showView(IPageLayout.ID_PROP_SHEET);
+ activePage.bringToTop(propSheet);
+ return (TabbedPropertySheetPage) propSheet.getCurrentPage();
+ }
+
+ @Test
+ public void testDiagramPropertySection() throws PartInitException {
+ // Diagram selected
+ TabbedPropertySheetPage page = getTabbedPropSheet();
+ checkTabsForDiagram(page);
+ page.setSelectedTab(TAB_DIAGRAM);
+ DiagramPropertySection section = (DiagramPropertySection) page
+ .getCurrentTab().getSections()[0];
+ assertFalse(section.getAnchorsVisible().getSelection());
+ assertAnchorsVisible(false);
+ section.getAnchorsVisible().setSelection(true);
+ assertAnchorsVisible(false);
+ }
+
+ private void checkTabsForDiagram(TabbedPropertySheetPage page) {
+ ITabDescriptor[] activeTabs = page.getActiveTabs();
+ assertEquals(TAB_DIAGRAM, activeTabs[0].getId());
+ assertEquals(TAB_PREDEFINED_STYLE, activeTabs[1].getId());
+ }
+
+ private void select(PictogramElement element) {
+ getEditor().setPictogramElementForSelection(element);
+ getEditor().getDiagramBehavior().selectBufferedPictogramElements();
+ getEditor().getDiagramBehavior().refresh();
+ }
+
+ @Test
+ public void testShapePropertySectionForAgent() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_AGENT);
+ }
+
+ @Test
+ public void testShapePropertySectionForHumanAgent()
+ throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_HUMAN_AGENT);
+ }
+
+ @Test
+ public void testShapePropertySectionForAgentL() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_AGENT_L);
+ }
+
+ @Test
+ public void testShapePropertySectionForAgentU() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_AGENT_U);
+ }
+
+ @Test
+ public void testShapePropertySectionForStorage() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_STORAGE);
+ }
+
+ @Test
+ public void testShapePropertySectionForStorageL() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_STORAGE_L);
+ }
+
+ @Test
+ public void testShapePropertySectionForStorageU() throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_STORAGE_U);
+ }
+
+ @Test
+ public void testShapePropertySectionForStructureVariance()
+ throws PartInitException {
+ testShapePropertySectionForShape(CREATE_FEATURE_STRUCTURE_VARIANCE);
+ }
+
+ private void testShapePropertySectionForShape(int shapeType)
+ throws PartInitException {
+ final int WIDTH = 150;
+ final int HEIGHT = 200;
+ final int X = 75;
+ final int Y = 50;
+ FMCNodeAlgorithm nodeAlgorithm = null;
+ Shape shape = createShape(shapeType, 100, 100, 5, 5);
+ select(shape);
+ TabbedPropertySheetPage page = getTabbedPropSheet();
+ checkTabsForShape(page);
+ page.setSelectedTab(TAB_SHAPE);
+ ShapePropertySection shapeProp = (ShapePropertySection) page
+ .getCurrentTab().getSections()[0];
+ // Width
+ assertTrue(shapeProp.getWidth().isEnabled());
+ shapeProp.getWidth().setSelection(WIDTH);
+ assertEquals(WIDTH, shape.getGraphicsAlgorithm().getWidth());
+ // Height
+ assertTrue(shapeProp.getHeight().isEnabled());
+ shapeProp.getHeight().setSelection(HEIGHT);
+ assertEquals(HEIGHT, shape.getGraphicsAlgorithm().getHeight());
+ // X
+ assertTrue(shapeProp.getxLocation().isEnabled());
+ shapeProp.getxLocation().setSelection(X);
+ assertEquals(X, shape.getGraphicsAlgorithm().getX());
+ // Y
+ assertTrue(shapeProp.getyLocation().isEnabled());
+ shapeProp.getyLocation().setSelection(Y);
+ assertEquals(Y, shape.getGraphicsAlgorithm().getY());
+ // Human Agent
+ boolean humanAgentAvailable = CREATE_FEATURE_AGENT == shapeType
+ || CREATE_FEATURE_HUMAN_AGENT == shapeType;
+ assertEquals(humanAgentAvailable, shapeProp.getIsHumanAgent()
+ .isEnabled());
+ if (humanAgentAvailable) {
+ assertEquals(CREATE_FEATURE_HUMAN_AGENT == shapeType, shapeProp
+ .getIsHumanAgent().getSelection());
+ shapeProp.getIsHumanAgent().setSelection(true);
+ shapeProp.getIsHumanAgent().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof HumanAgentAlgorithm);
+ shapeProp.getIsHumanAgent().setSelection(false);
+ shapeProp.getIsHumanAgent().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(!(nodeAlgorithm instanceof HumanAgentAlgorithm));
+ }
+ // Multi Instances
+ shape = createShape(shapeType, 100, 100, 5, 5);
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab().getSections()[0];
+ boolean multiInstanceAvailable = CREATE_FEATURE_AGENT == shapeType
+ || CREATE_FEATURE_STORAGE == shapeType
+ || CREATE_FEATURE_HUMAN_AGENT == shapeType
+ || CREATE_FEATURE_AGENT_L == shapeType
+ || CREATE_FEATURE_AGENT_U == shapeType
+ || CREATE_FEATURE_STORAGE_L == shapeType
+ || CREATE_FEATURE_STORAGE_U == shapeType;
+ assertEquals(multiInstanceAvailable, shapeProp.getIsMultiInstance()
+ .isEnabled());
+ if (multiInstanceAvailable) {
+ assertEquals(false, shapeProp.getIsMultiInstance().getSelection());
+ shapeProp.getIsMultiInstance().setSelection(true);
+ shapeProp.getIsMultiInstance().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof MultipleNode);
+ MultipleNode multiNodeAlgo = (MultipleNode) nodeAlgorithm;
+ assertTrue(multiNodeAlgo
+ .isMultipleInstances((ContainerShape) shape));
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab()
+ .getSections()[0];
+ shapeProp.getIsMultiInstance().setSelection(false);
+ shapeProp.getIsMultiInstance().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof MultipleNode);
+ multiNodeAlgo = (MultipleNode) nodeAlgorithm;
+ assertFalse(multiNodeAlgo
+ .isMultipleInstances((ContainerShape) shape));
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab()
+ .getSections()[0];
+ }
+ // Shape Style
+ shape = createShape(shapeType, 100, 100, 5, 5);
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab().getSections()[0];
+ boolean shapeStyleAvailable = CREATE_FEATURE_AGENT == shapeType
+ || CREATE_FEATURE_STORAGE == shapeType
+ || CREATE_FEATURE_AGENT_L == shapeType
+ || CREATE_FEATURE_AGENT_U == shapeType
+ || CREATE_FEATURE_STORAGE_L == shapeType
+ || CREATE_FEATURE_STORAGE_U == shapeType;
+ assertEquals(shapeStyleAvailable, shapeProp.getShapeStyle().isEnabled());
+ if (shapeStyleAvailable) {
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab()
+ .getSections()[0];
+ shapeProp.getShapeStyle().select(0);
+ shapeProp.getShapeStyle().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof RectangleAlgorithm);
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab()
+ .getSections()[0];
+ shapeProp.getShapeStyle().select(1);
+ shapeProp.getShapeStyle().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof LPolygonAlgorithm);
+ select(shape);
+ shapeProp = (ShapePropertySection) page.getCurrentTab()
+ .getSections()[0];
+ shapeProp.getShapeStyle().select(2);
+ shapeProp.getShapeStyle().notifyListeners(SWT.Selection,
+ new Event());
+ nodeAlgorithm = factory.getShape(shape);
+ assertTrue(nodeAlgorithm instanceof UPolygonAlgorithm);
+ }
+
+ }
+
+ private void checkTabsForShape(TabbedPropertySheetPage page) {
+ ITabDescriptor[] activeTabs = page.getActiveTabs();
+ assertEquals(TAB_SHAPE, activeTabs[0].getId());
+ assertEquals(TAB_STYLE, activeTabs[1].getId());
+ assertEquals(TAB_ALIGNMENT, activeTabs[2].getId());
+ assertEquals(TAB_PREDEFINED_STYLE, activeTabs[3].getId());
+ }
+
+ private void assertAnchorsVisible(boolean visible) {
+ for (Shape shape : getDiagram().getChildren()) {
+ for (Anchor anchor : shape.getAnchors()) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ assertEquals(visible, anchor.getGraphicsAlgorithm()
+ .getLineVisible());
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/editor/node/FMCNodeAlgorithmFactoryTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/editor/node/FMCNodeAlgorithmFactoryTest.java
new file mode 100644
index 0000000..79cdc0a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/editor/node/FMCNodeAlgorithmFactoryTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.editor.node;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_HUMAN_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_L;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE_U;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STRUCTURE_VARIANCE;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.fmc.FMCTestCase;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.HumanAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.ui.PartInitException;
+import org.junit.Test;
+
+public class FMCNodeAlgorithmFactoryTest extends FMCTestCase {
+
+ private FMCNodeAlgorithmFactory factory;
+
+ @Override
+ public void setUp() throws PartInitException, CoreException {
+ super.setUp();
+ factory = FMCNodeAlgorithmFactory.getInstance();
+ }
+
+ @Test
+ public void testGetAgentByShapeStyle() {
+ assertTrue(factory.getAgentByShapestyle(ShapeStyle.RECT) instanceof RectangleAgentAlgorithm);
+ assertTrue(factory.getAgentByShapestyle(ShapeStyle.L) instanceof LAgentAlgorithm);
+ assertTrue(factory.getAgentByShapestyle(ShapeStyle.U) instanceof UAgentAlgorithm);
+ }
+
+ @Test
+ public void testGetStorageByShapeStyle() {
+ assertTrue(factory.getStorageByShapestyle(ShapeStyle.RECT) instanceof RectangleStorageAlgorithm);
+ assertTrue(factory.getStorageByShapestyle(ShapeStyle.L) instanceof LStorageAlgorithm);
+ assertTrue(factory.getStorageByShapestyle(ShapeStyle.U) instanceof UStorageAlgorithm);
+ }
+
+ @Test
+ public void testGetShape() {
+ Shape shape = createShape(CREATE_FEATURE_AGENT, 100, 100, 5, 5);
+ FMCNodeAlgorithm algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof RectangleAgentAlgorithm);
+ shape = createShape(CREATE_FEATURE_HUMAN_AGENT, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof HumanAgentAlgorithm);
+ shape = createShape(CREATE_FEATURE_AGENT_L, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof LAgentAlgorithm);
+ shape = createShape(CREATE_FEATURE_AGENT_U, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof UAgentAlgorithm);
+ shape = createShape(CREATE_FEATURE_STORAGE, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof RectangleStorageAlgorithm);
+ shape = createShape(CREATE_FEATURE_STORAGE_L, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof LStorageAlgorithm);
+ shape = createShape(CREATE_FEATURE_STORAGE_U, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ assertTrue(algorithm instanceof UStorageAlgorithm);
+ shape = createShape(CREATE_FEATURE_STRUCTURE_VARIANCE, 100, 100, 5, 5);
+ algorithm = factory.getShape(shape);
+ // TODO Why?
+ // assertNull(algorithm);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaConnectionTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaConnectionTest.java
new file mode 100644
index 0000000..f420944
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaConnectionTest.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.meta;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.fmc.ConnectionTest;
+import org.eclipse.fmc.blockdiagram.editor.util.DiagramFactory;
+import org.junit.After;
+import org.junit.Test;
+
+public class MetaConnectionTest extends ConnectionTest {
+
+ @Override
+ protected void createFMCFile(IFile file) {
+ DiagramFactory.createDefaultBlockdiagramMetaFile(URI.createPlatformResourceURI(
+ file.getFullPath().toString(), true), 1000, 1000, 10);
+ }
+
+ @Test
+ @Override
+ public void testUnidirectionalAccessMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testUnidirectionalAccessMH();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testUnidirectionalAccessFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testUnidirectionalAccessFF();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testBidirectionalAccessMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testBidirectionalAccessMH();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testBidirectionalAccessFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testBidirectionalAccessFF();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testModifyAccess() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testModifyAccess();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testBidirectionalComChannelMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super
+ .testBidirectionalComChannelMH();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testBidirectionalComChannelFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super
+ .testBidirectionalComChannelFF();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testUnidirectionalComChannelMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super
+ .testUnidirectionalComChannelMH();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testUnidirectionalComChannelFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super
+ .testUnidirectionalComChannelFF();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testReqResComChannelMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testReqResComChannelMH();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testReqResComChannelFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testReqResComChannelFF();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testDotsMH() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testDotsMH();
+ }
+ });
+ }
+
+ @Override
+ public void testDotsMHWithoutTarget() {
+ // Not supported
+ }
+
+ @Test
+ @Override
+ public void testDotsFF() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testDotsFF();
+ }
+ });
+ }
+
+ @Override
+ public void testDotsFFWithoutTarget() {
+ // Not supported
+ }
+
+ @Test
+ @Override
+ public void testContainerRemove() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super.testContainerRemove();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testConnectToStructureVariance() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaConnectionTest.super
+ .testConnectToStructureVariance();
+ }
+ });
+ }
+
+ @Override
+ @After
+ public void tearDown() {
+ MetaTestUtil.assertMetaFileExists(getProject(), BLOCKDIAG_FILENAME);
+ super.tearDown();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaShapeTest.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaShapeTest.java
new file mode 100644
index 0000000..c4d7caa
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaShapeTest.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.meta;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.fmc.ShapeTest;
+import org.eclipse.fmc.blockdiagram.editor.util.DiagramFactory;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ * Testing all shape types for meta editor
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class MetaShapeTest extends ShapeTest {
+
+ @Override
+ protected void createFMCFile(IFile file) {
+ DiagramFactory.createDefaultBlockdiagramMetaFile(URI.createPlatformResourceURI(
+ file.getFullPath().toString(), true), 1000, 1000, 10);
+ }
+
+ @Test
+ @Override
+ public void testAgent() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testAgent();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testAgentL() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testAgentL();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testAgentU() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testAgentU();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testStorage() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testStorage();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testStorageL() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testStorageL();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testStorageU() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testStorageU();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testHumanAgent() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testHumanAgent();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testStructureVariance() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testStructureVariance();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testCommonFeatureArea() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testCommonFeatureArea();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testBrace() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testBrace();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testAreaBorder() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testAreaBorder();
+ }
+ });
+ }
+
+ @Test
+ @Override
+ public void testDots() {
+ getEditingDomain().getCommandStack().execute(
+ new RecordingCommand(getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ MetaShapeTest.super.testDots();
+ }
+ });
+ }
+
+ @Override
+ @After
+ public void tearDown() {
+ MetaTestUtil.assertMetaFileExists(getProject(), BLOCKDIAG_FILENAME);
+ super.tearDown();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaTestUtil.java b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaTestUtil.java
new file mode 100644
index 0000000..bcae636
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor.tests/src/org/eclipse/fmc/meta/MetaTestUtil.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.meta;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.core.runtime.Path;
+
+public class MetaTestUtil {
+
+ private MetaTestUtil() {
+ }
+
+ public static void assertMetaFileExists(IProject project, String blockfile) {
+ final IFile file = project.getFile(new Path(blockfile.replace(
+ ".blockdiag", "fmc")));
+ if (!file.exists())
+ throw new AssertionFailedException(
+ "Meta file does not exist! Expected location: "
+ + file.getLocationURI());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/.DS_Store b/org.eclipse.fmc.blockdiagram.editor/.DS_Store
new file mode 100644
index 0000000..4f50dec
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/.DS_Store
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/.classpath b/org.eclipse.fmc.blockdiagram.editor/.classpath
new file mode 100644
index 0000000..a14ade4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.blockdiagram.editor/.gitignore b/org.eclipse.fmc.blockdiagram.editor/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.blockdiagram.editor/.project b/org.eclipse.fmc.blockdiagram.editor/.project
new file mode 100644
index 0000000..ecf514e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.blockdiagram.editor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.blockdiagram.editor/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.fmc.blockdiagram.editor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.fmc.blockdiagram.editor/META-INF/MANIFEST.MF b/org.eclipse.fmc.blockdiagram.editor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fa159bf
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: FMC Blockdiagram Editor
+Bundle-SymbolicName: org.eclipse.fmc.blockdiagram.editor;singleton:=true
+Bundle-Version: 0.11.0.qualifier
+Bundle-Activator: org.eclipse.fmc.blockdiagram.editor.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle:
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views.properties.tabbed,
+ org.eclipse.gef,
+ org.eclipse.graphiti,
+ org.eclipse.graphiti.ui,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jface,
+ org.eclipse.fmc.mm
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.fmc.blockdiagram.editor,
+ org.eclipse.fmc.blockdiagram.editor.algorithm.connection,
+ org.eclipse.fmc.blockdiagram.editor.algorithm.node,
+ org.eclipse.fmc.blockdiagram.editor.diagram,
+ org.eclipse.fmc.blockdiagram.editor.features,
+ org.eclipse.fmc.blockdiagram.editor.features.add,
+ org.eclipse.fmc.blockdiagram.editor.features.create,
+ org.eclipse.fmc.blockdiagram.editor.filters,
+ org.eclipse.fmc.blockdiagram.editor.model,
+ org.eclipse.fmc.blockdiagram.editor.property,
+ org.eclipse.fmc.blockdiagram.editor.util,
+ org.eclipse.fmc.blockdiagram.editor.wizards
diff --git a/org.eclipse.fmc.blockdiagram.editor/about.html b/org.eclipse.fmc.blockdiagram.editor/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/build.properties b/org.eclipse.fmc.blockdiagram.editor/build.properties
new file mode 100644
index 0000000..ba01172
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/build.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+source.. = src/,\
+ resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
+src.includes = about.html
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/.DS_Store b/org.eclipse.fmc.blockdiagram.editor/icons/.DS_Store
new file mode 100644
index 0000000..445ee30
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/.DS_Store
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/.DS_Store b/org.eclipse.fmc.blockdiagram.editor/icons/menu/.DS_Store
new file mode 100644
index 0000000..5098492
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/.DS_Store
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/accessories-text-editor.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/accessories-text-editor.png
new file mode 100644
index 0000000..188e1c1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/accessories-text-editor.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/applications-graphics.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/applications-graphics.png
new file mode 100644
index 0000000..4bb955f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/applications-graphics.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-copy.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-copy.png
new file mode 100644
index 0000000..8dd48c4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-copy.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-paste.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-paste.png
new file mode 100644
index 0000000..24588a3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-paste.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-redo.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-redo.png
new file mode 100644
index 0000000..c3b0df0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-redo.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-undo.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-undo.png
new file mode 100644
index 0000000..8b0fef9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/edit-undo.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-down.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-down.png
new file mode 100644
index 0000000..3dd7fcc
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-down.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-jump.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-jump.png
new file mode 100644
index 0000000..1d218c3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-jump.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-up.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-up.png
new file mode 100644
index 0000000..fa9a7d7
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/go-up.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/image-x-generic.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/image-x-generic.png
new file mode 100644
index 0000000..68da502
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/image-x-generic.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/weather-clear.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/weather-clear.png
new file mode 100644
index 0000000..7dc15ea
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/weather-clear.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/menu/x-office-presentation.png b/org.eclipse.fmc.blockdiagram.editor/icons/menu/x-office-presentation.png
new file mode 100644
index 0000000..f7ea302
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/menu/x-office-presentation.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent.png
new file mode 100644
index 0000000..b3e347d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_16.png
new file mode 100644
index 0000000..ed255ad
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_l.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_l.png
new file mode 100644
index 0000000..230c911
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_l.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_u.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_u.png
new file mode 100644
index 0000000..044571d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/agent_u.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/anchor.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/anchor.png
new file mode 100644
index 0000000..c9701da
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/anchor.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/areaborder.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/areaborder.png
new file mode 100644
index 0000000..a0e4326
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/areaborder.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess.png
new file mode 100644
index 0000000..2dc6754
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess_mh.png
new file mode 100644
index 0000000..cb5f013
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biAccess_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel.png
new file mode 100644
index 0000000..92a7fa0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel_mh.png
new file mode 100644
index 0000000..02dca28
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/biCommChannel_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/brace.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/brace.png
new file mode 100644
index 0000000..2062982
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/brace.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/channel.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/channel.png
new file mode 100644
index 0000000..8173ee4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/channel.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/commonFeatureArea.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/commonFeatureArea.png
new file mode 100644
index 0000000..53bd05b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/commonFeatureArea.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots.png
new file mode 100644
index 0000000..3161611
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots_mh.png
new file mode 100644
index 0000000..b80afcf
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/dots_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/humanAgent.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/humanAgent.png
new file mode 100644
index 0000000..b240832
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/humanAgent.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess.png
new file mode 100644
index 0000000..3a32c3d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess_16.png
new file mode 100644
index 0000000..4587208
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/modifyAccess_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel.png
new file mode 100644
index 0000000..b4f3940
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_16.png
new file mode 100644
index 0000000..a7b03f1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_mh.png
new file mode 100644
index 0000000..8999c74
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/reqRespCommChannel_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage.png
new file mode 100644
index 0000000..f6027a1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_16.png
new file mode 100644
index 0000000..4a47bf1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_l.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_l.png
new file mode 100644
index 0000000..950dc07
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_l.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_u.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_u.png
new file mode 100644
index 0000000..08a1725
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/storage_u.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/structureVariance.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/structureVariance.png
new file mode 100644
index 0000000..5360739
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/structureVariance.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/text.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/text.png
new file mode 100644
index 0000000..22f772b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/text.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess.png
new file mode 100644
index 0000000..62a618a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_16.png
new file mode 100644
index 0000000..4b3ff2b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_mh.png
new file mode 100644
index 0000000..635cd3f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirAccess_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel.png
new file mode 100644
index 0000000..cd8d36b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_16.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_16.png
new file mode 100644
index 0000000..d43253a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_16.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_mh.png b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_mh.png
new file mode 100644
index 0000000..665b217
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/icons/palette/unidirCommChannel_mh.png
Binary files differ
diff --git a/org.eclipse.fmc.blockdiagram.editor/plugin.xml b/org.eclipse.fmc.blockdiagram.editor/plugin.xml
new file mode 100644
index 0000000..d5c607e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/plugin.xml
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.eclipse.fmc.blockdiagram.editor.palette" name="Palette Extension Point" schema="schema/org.eclipse.fmc.blockdiagram.editor.palette.exsd"/>
+ <extension-point id="org.eclipse.fmc.blockdiagram.editor.featureprovider" name="Feature Provider Extension" schema="schema/org.eclipse.fmc.blockdiagram.editor.featureprovider.exsd"/>
+ <extension-point id="org.eclipse.fmc.blockdiagram.editor.typechecking" name="Type Checker Extension" schema="schema/org.eclipse.fmc.blockdiagram.editor.typechecking.exsd"/>
+ <extension
+ point="org.eclipse.graphiti.ui.diagramTypes">
+ <diagramType
+ id="org.eclipse.fmc.blockdiagram.diagramtype"
+ name="FMC"
+ type="fmc">
+ </diagramType>
+ <diagramType
+ id="org.eclipse.fmc.blockdiagram.diagramtype.tam"
+ name="TAM"
+ type="tam">
+ </diagramType>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.fmc.blockdiagram.editor.BlockDiagramEditor"
+ default="true"
+ contributorClass="org.eclipse.graphiti.ui.editor.DiagramEditorActionBarContributor"
+ extensions="blockdiag"
+ icon="icons/blockdiagramfiletype.png"
+ id="org.eclipse.fmc.blockdiagram.FMCBlockdiagramEditor"
+ name="FMC Blockdiagram Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.graphiti.ui.diagramTypeProviders">
+ <diagramTypeProvider
+ class="org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramTypeProvider"
+ id="org.eclipse.fmc.blockdiagram.provider"
+ name="org.eclipse.fmc.blockdiagram.typeprovider">
+ <diagramType
+ id="org.eclipse.fmc.blockdiagram.diagramtype">
+ </diagramType>
+ <imageProvider
+ id="org.eclipse.fmc.blockdiagram.imageProvider">
+ </imageProvider>
+ </diagramTypeProvider>
+ <diagramTypeProvider
+ class="org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramTypeProvider"
+ id="org.eclipse.fmc.blockdiagram.provider"
+ name="org.eclipse.fmc.blockdiagram.typeprovider.tam">
+ <diagramType
+ id="org.eclipse.fmc.blockdiagram.diagramtype.tam">
+ </diagramType>
+ <imageProvider
+ id="org.eclipse.fmc.blockdiagram.imageProvider">
+ </imageProvider>
+ </diagramTypeProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.fmc.blockdiagram.category"
+ class="org.eclipse.fmc.blockdiagram.editor.wizards.BlockDiagramFileWizard"
+ icon="icons/blockdiagramfiletype.png"
+ id="org.eclipse.fmc.blockdiagram.wizard.editor"
+ name="FMC Block Diagram">
+ <description>
+ This wizard creates a FMC block diagram.
+ </description>
+ </wizard>
+ <category
+ id="org.eclipse.fmc.blockdiagram.category"
+ name="FMC">
+ </category>
+ </extension>
+ <!-- Add wizard to common navigator context menu -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.fmc.blockdiagram.wizard.editor">
+ <enablement>
+ </enablement>
+ </commonWizard>
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.ui.wizards.new.project">
+ <enablement>
+ </enablement>
+ </commonWizard>
+ </extension>
+ <extension
+ point="org.eclipse.graphiti.ui.imageProviders">
+ <imageProvider
+ class="org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider"
+ id="org.eclipse.fmc.blockdiagram.imageProvider">
+ </imageProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.eclipse.fmc.blockdiagram.editor.application.Perspective"
+ id="FMC.perspective"
+ name="FMC Perspective">
+ </perspective>
+ </extension>
+ <extension point="org.eclipse.ui.elementFactories">
+ <factory class="org.eclipse.fmc.blockdiagram.editor.application.NavigatorRoot" id="org.eclipse.fmc.blockdiagram.application.NavigatorRoot" />
+ </extension>
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewer viewerId="org.eclipse.fmc.blockdiagram.application.NavigatorRoot" />
+ <viewerContentBinding viewerId="org.eclipse.fmc.blockdiagram.application.NavigatorRoot">
+ <includes>
+ <contentExtension pattern="org.eclipse.ui.navigator.resourceContent" />
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.fmc.blockdiagram.application.NavigatorRoot">
+ <includes>
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.*" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.NewActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.PropertiesActionProvider" />
+ </includes>
+ </viewerActionBinding>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="fmc.PropertyContributor">
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.ShapePropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeFilter"
+ id="fmc.shapeSection"
+ tab="fmc.ShapeTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.ConnectionPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.FMCConnectionFilter"
+ id="fmc.connectionSection"
+ tab="fmc.ConnectionTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.DiagramPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.DiagramFilter"
+ id="fmc.diagramSection"
+ tab="fmc.DiagramTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.FMCColorsAndFontsPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeFilter"
+ id="fmc.styleSection"
+ tab="fmc.StyleTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.AlignmentPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.ShapeFilter"
+ id="fmc.alignmentSection"
+ tab="fmc.AlignmentTab">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.fmc.blockdiagram.editor.property.PredefinedStylesPropertySection"
+ filter="org.eclipse.fmc.blockdiagram.editor.filters.PictogramFilter"
+ id="fmc.predefinedStyleSection"
+ tab="fmc.PredefinedStyleTab">
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="fmc.PropertyContributor">
+ <propertyCategory
+ category="fmc.diagram">
+ </propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="fmc.PropertyContributor">
+ <propertyTab
+ category="fmc.diagram"
+ id="fmc.ShapeTab"
+ label="Shape">
+ </propertyTab>
+ <propertyTab
+ category="fmc.diagram"
+ id="fmc.ConnectionTab"
+ label="Connection">
+ </propertyTab>
+ <propertyTab
+ category="fmc.diagram"
+ id="fmc.DiagramTab"
+ label="Diagram">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmc.ShapeTab"
+ category="fmc.diagram"
+ id="fmc.StyleTab"
+ label="Style">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmc.StyleTab"
+ category="fmc.diagram"
+ id="fmc.AlignmentTab"
+ indented="true"
+ label="Text Alignment">
+ </propertyTab>
+ <propertyTab
+ afterTab="fmc.AlignmentTab"
+ category="fmc.diagram"
+ id="fmc.PredefinedStyleTab"
+ indented="false"
+ label="Predefined Styles">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+</plugin>
diff --git a/org.eclipse.fmc.blockdiagram.editor/resources/org/eclipse/fmc/blockdiagram/editor/messages.properties b/org.eclipse.fmc.blockdiagram.editor/resources/org/eclipse/fmc/blockdiagram/editor/messages.properties
new file mode 100644
index 0000000..8aab4ca
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/resources/org/eclipse/fmc/blockdiagram/editor/messages.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+FMCAddFeature_DefaultShapeTitle=title
+FMCAddFeature_FontType=Arial
diff --git a/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.featureprovider.exsd b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.featureprovider.exsd
new file mode 100644
index 0000000..c525e8a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.featureprovider.exsd
@@ -0,0 +1,132 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.fmc.blockdiagram.editor" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.fmc.blockdiagram.editor" id="org.eclipse.fmc.blockdiagram.editor.featureprovider" name="Feature Provider Extension"/>
+ </appinfo>
+ <documentation>
+ This extension point is for providing additional features for the FMC Editors. The Factory interface has to be implemented. This interface is then called by the FMC Blockdiagram Editor in order to instantiate a new feature provider and add the features to the already existing ones.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ <documentation>
+ This extension is for adding new features to the editor. All kinds of features are supported. A featureProviderFactory must be defined which must implement org.eclipse.fmc.blockdiagram.editor.extension.FeatureProviderExtensionFactory. .
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="featureProviderFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="featureProviderFactory">
+ <annotation>
+ <documentation>
+ This factory produces new istances of org.eclipse.fmc.blockdiagram.editor.extension.ExtensionFeatureProvider which is an implementation of AbstractFeatureProvider. All features provided through this extension feature provider will be added to the features of the original editor.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ All features provided through this extension feature provider will be added to the features of the original editor.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.extension.FeatureProviderExtensionFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ <extension
+ point="org.eclipse.fmc.blockdiagram.editor.featureprovider">
+ <featureProviderFactory
+ class="org.eclipse.fmc.blockdiagram.editor.extension.FeaturesProviderExtensionFactory">
+ </featureProviderFactory>
+</extension>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.palette.exsd b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.palette.exsd
new file mode 100644
index 0000000..e5c7d6c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.palette.exsd
@@ -0,0 +1,133 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.fmc.blockdiagram.editor" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.fmc.blockdiagram.editor" id="org.eclipse.fmc.blockdiagram.editor.palette" name="Palette Extension Point"/>
+ </appinfo>
+ <documentation>
+ This extension point allows to add new tool entries to the palette.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="paletteElement"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="paletteElement">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.gef.palette.PaletteEntry:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="shortDescription" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.typechecking.exsd b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.typechecking.exsd
new file mode 100644
index 0000000..179944a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/schema/org.eclipse.fmc.blockdiagram.editor.typechecking.exsd
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.fmc.blockdiagram.editor" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.fmc.blockdiagram.editor" id="org.eclipse.fmc.blockdiagram.typechecking" name="Type Checker Extension"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="typeChecker"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="typeChecker">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.4.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/Activator.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/Activator.java
new file mode 100644
index 0000000..f15e988
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/Activator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID. */
+ public static final String PLUGIN_ID = "org.eclipse.fmc.blockdiagram.editor"; //$NON-NLS-1$
+
+ /** The shared instance. */
+ private static Activator plugin;
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public final void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public final void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramBehavior.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramBehavior.java
new file mode 100644
index 0000000..6132971
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramBehavior.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor;
+
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.KeyStroke;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+import org.eclipse.graphiti.ui.editor.IDiagramContainerUI;
+import org.eclipse.graphiti.ui.internal.action.RemoveAction;
+
+/**
+ * Change delete key behavior from DeleteAction to RemoveAction and enables
+ * direct editing with return key.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class BlockDiagramBehavior extends DiagramBehavior{
+
+ public BlockDiagramBehavior(IDiagramContainerUI diagramContainer) {
+ super(diagramContainer);
+ }
+
+ @Override
+ protected DefaultPaletteBehavior createPaletteBehaviour() {
+ return new BlockDiagramPaletteBehavior(this);
+ }
+
+ @Override
+ public KeyHandler getCommonKeyHandler() {
+ KeyHandler handler = super.getCommonKeyHandler();
+ if (getDiagramTypeProvider().getFeatureProvider()
+ .getDeleteFeature(null) == null) {
+ handler.remove(KeyStroke.getPressed((char) 127, 127, 0));
+ handler.put(KeyStroke.getPressed((char) 127, 127, 0),
+ getDiagramContainer().getActionRegistry().getAction(RemoveAction.ACTION_ID));
+ }
+ handler.put(KeyStroke.getPressed((char) 13, 13, 0), getDiagramContainer().getActionRegistry()
+ .getAction(GEFActionConstants.DIRECT_EDIT));
+ return handler;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramConstants.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramConstants.java
new file mode 100644
index 0000000..7f93fba
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramConstants.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor;
+
+/**
+ * Provides all public constants for the Blockdiagram Editor.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public interface BlockDiagramConstants {
+
+ /**
+ * The key for the context property points.
+ */
+ public static final String POINTS = "points";
+
+ /**
+ * Key for storing the information about the style of a shape in a context property.
+ */
+ public static final String GRAPHICAL_TYPE_KEY = "graphicalType";
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramEditor.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramEditor.java
new file mode 100644
index 0000000..d554f29
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramEditor.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor;
+
+import java.net.MalformedURLException;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.fmc.blockdiagram.editor.clipboard.PasteFromClipboard;
+import org.eclipse.gef.MouseWheelHandler;
+import org.eclipse.gef.MouseWheelZoomHandler;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * The diagram editor represents the editor to Eclipse and is a Graphiti editor.
+ * It defines a custom palette behavior to add new tool entries. Registers all
+ * clipboard images to the image provider. Mouse wheel is enabled for zooming.
+ * Registers additional key handlers for deletion and direct editing.
+ *
+ *
+ * @author Benjamin Schmeling
+ * @author Rainer Thome
+ */
+public class BlockDiagramEditor extends DiagramEditor {
+
+ /**
+ * Default Constructor.
+ */
+ public BlockDiagramEditor() {
+ }
+
+ @Override
+ public void initializeGraphicalViewer() {
+ try {
+ PasteFromClipboard.registerClipImages(this);
+ } catch (MalformedURLException e) {
+ StatusManager
+ .getManager()
+ .handle(new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ "Cannot register clip images to the image provider",
+ e));
+ }
+ super.initializeGraphicalViewer();
+ getGraphicalViewer().setProperty(
+ MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
+ MouseWheelZoomHandler.SINGLETON);
+ }
+
+ @Override
+ protected DiagramBehavior createDiagramBehavior() {
+ return new BlockDiagramBehavior(this);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramMessages.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramMessages.java
new file mode 100644
index 0000000..c5087b5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramMessages.java
@@ -0,0 +1,22 @@
+package org.eclipse.fmc.blockdiagram.editor;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Internationalized messages used in blockdiagram editor.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.fmc.blockdiagram.editor.messages"; //$NON-NLS-1$
+ public static String FMCAddFeature_DefaultShapeTitle;
+ public static String FMCAddFeature_FontType;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, BlockDiagramMessages.class);
+ }
+
+ private BlockDiagramMessages() {
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramPaletteBehavior.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramPaletteBehavior.java
new file mode 100644
index 0000000..6f93d46
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/BlockDiagramPaletteBehavior.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+
+/**
+ * This custom palette behavior allows the addition of new palette tool entries
+ * via the dedicated extension point.
+ *
+ *
+ * @author Benjamin Schmeling
+ */
+public class BlockDiagramPaletteBehavior extends DefaultPaletteBehavior {
+
+ public BlockDiagramPaletteBehavior(DiagramBehavior diagramBehavior) {
+ super(diagramBehavior);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior#createPaletteRoot()
+ */
+ protected PaletteRoot createPaletteRoot() {
+ PaletteRoot root = super.createPaletteRoot();
+ // Creates new palette container for extensions
+ PaletteContainer container = new PaletteDrawer("Extensions");
+ try {
+ addFromExtensionPoint(container);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ if (!container.getChildren().isEmpty())
+ root.add(container);
+
+ return root;
+ }
+
+ /**
+ * Adds new entries if registered via org.eclipse.fmc.blockdiagram.editor.palette
+ * extension.
+ *
+ * @param container
+ * The palette container.
+ * @throws CoreException
+ */
+ private void addFromExtensionPoint(PaletteContainer container)
+ throws CoreException {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.palette");
+ for (IConfigurationElement element : extensions) {
+ PaletteEntry entry = (PaletteEntry) element
+ .createExecutableExtension("class");
+ entry.setLabel(element.getAttribute("label"));
+ entry.setDescription(element.getAttribute("shortDescription"));
+ container.add(entry);
+
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/BraceAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/BraceAlgorithm.java
new file mode 100644
index 0000000..ed0ccc8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/BraceAlgorithm.java
@@ -0,0 +1,379 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.comment;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.ResizableNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+
+/**
+ * This abstract class implements all methods common to braces.
+ *
+ * 1__ 2 \ | 3 \ > 4 5 / | __/ 7 6
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class BraceAlgorithm implements CommentAlgorithm, RotatableNode,
+ ResizableNode {
+
+ protected IGaService ga = Graphiti.getGaService();
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int BRACE_MINIMUM_HEIGHT = 60;
+ public static final int BRACE_DEFAULT_HEIGHT = 80;
+ public static final int BRACE_DEFAULT_LINEWIDTH = 2;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#createGraphics(org.eclipse
+ * .graphiti.mm.pictograms.Diagram,
+ * org.eclipse.graphiti.mm.GraphicsAlgorithmContainer, int, int, int, int)
+ */
+ public GraphicsAlgorithm createGraphics(Diagram diagram,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height) {
+ GraphicsAlgorithm containerGa = (GraphicsAlgorithm) container;
+
+ int lineXy[];
+ int size;
+ if (width > height) {
+ size = width;
+ lineXy = new int[] {
+ /* 1 */0, 0,
+ /* 2 */0, size / 8,
+ /* 3 */size / 2, size / 8,
+ /* 4 */size / 2, 9 * size / 40,
+ /* 5 */size / 2, size / 8,
+ /* 6 */size, size / 8,
+ /* 7 */size, 0 };
+ ga.setLocationAndSize(containerGa, x, y, size, 9 * size / 40);
+ } else { // width <= height
+ size = height;
+ lineXy = new int[] {
+ /* 1 */0, 0,
+ /* 2 */size / 8, 0,
+ /* 3 */size / 8, size / 2,
+ /* 4 */9 * size / 40, size / 2,
+ /* 5 */size / 8, size / 2,
+ /* 6 */size / 8, size,
+ /* 7 */0, size };
+ ga.setLocationAndSize(containerGa, x, y, 9 * size / 40, size);
+ }
+
+ int cornerSize = size / 10;
+ int lineBeforeAfter[] = new int[] {
+ /* 1 */0, 0,
+ /* 2 */cornerSize, cornerSize,
+ /* 3 */cornerSize, cornerSize,
+ /* 4 */0, 0,
+ /* 5 */cornerSize, cornerSize,
+ /* 6 */cornerSize, cornerSize,
+ /* 7 */0, 0 };
+
+ Polyline polyline = ga.createPolyline(container, lineXy,
+ lineBeforeAfter);
+ polyline.setStyle(StyleUtil.getStyle(diagram, StyleUtil.SHAPE));
+ // polyline.setForeground(ga.manageColor(diagram, 0, 0, 0));
+ polyline.setLineWidth(BRACE_DEFAULT_LINEWIDTH);
+ return polyline;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return BRACE_DEFAULT_LINEWIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return BRACE_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return 9 * BRACE_MINIMUM_HEIGHT / 40;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return BRACE_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return 9 * BRACE_DEFAULT_HEIGHT / 40;
+ }
+
+ // ----------------------------------------
+ // ----------- Rotatable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#getAngle(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public int getAngle(GraphicsAlgorithm graphicsAlgorithm) {
+ Polyline polyline = (Polyline) graphicsAlgorithm;
+ EList<Point> points = polyline.getPoints();
+ Point point1 = points.get(1);
+ Point point2 = points.get(2);
+ Point point7 = points.get(7);
+ if (point2.getY() == point1.getY()) {
+ return (point7.getY() > point1.getY()) ? 0 : 180;
+ } else {
+ return (point7.getX() < point1.getX()) ? 90 : 270;
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#isFlipped(org.eclipse.
+ * graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public boolean isFlipped(GraphicsAlgorithm graphicsAlgorithm) {
+ Polyline polyline = (Polyline) graphicsAlgorithm;
+ EList<Point> points = polyline.getPoints();
+ Point point1 = points.get(1);
+ Point point2 = points.get(2);
+ switch (getAngle(polyline)) {
+ case 90:
+ return (point1.getY() < point2.getY()) ? false : true;
+ case 180:
+ return (point1.getX() > point2.getX()) ? false : true;
+ case 270:
+ return (point1.getY() > point2.getY()) ? false : true;
+ default:
+ return (point1.getX() < point2.getX()) ? false : true;
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#rotate90Right(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void rotate90Right(GraphicsAlgorithm graphicsAlgorithm) {
+ Polyline polyline = (Polyline) graphicsAlgorithm
+ .getGraphicsAlgorithmChildren().get(0);
+ graphicsAlgorithm
+ .setX(graphicsAlgorithm.getX()
+ + (graphicsAlgorithm.getWidth() - graphicsAlgorithm
+ .getHeight()) / 2);
+ graphicsAlgorithm
+ .setY(graphicsAlgorithm.getY()
+ - (graphicsAlgorithm.getWidth() - graphicsAlgorithm
+ .getHeight()) / 2);
+ // Rotate graphicsAlgorithm
+ int oldWidth = graphicsAlgorithm.getWidth();
+ int oldHeight = graphicsAlgorithm.getHeight();
+ int oldX, oldY;
+ for (Point point : polyline.getPoints()) {
+ oldX = point.getX();
+ oldY = point.getY();
+ point.setX(oldHeight - oldY);
+ point.setY(oldX);
+ }
+
+ // Adapt the size of graphicsAlgorithm
+ graphicsAlgorithm.setHeight(oldWidth);
+ graphicsAlgorithm.setWidth(oldHeight);
+ polyline.setHeight(oldWidth);
+ polyline.setWidth(oldHeight);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipHorizontally(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipHorizontally(GraphicsAlgorithm graphicsAlgorithm) {
+ Polyline polyline = (Polyline) graphicsAlgorithm
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // Flip graphicsAlgorithm
+ int width = graphicsAlgorithm.getWidth();
+ for (Point point : polyline.getPoints()) {
+ point.setX(width - point.getX());
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipVertically(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipVertically(GraphicsAlgorithm graphicsAlgorithm) {
+ Polyline polyline = (Polyline) graphicsAlgorithm
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // Flip graphicsAlgorithm
+ int height = graphicsAlgorithm.getHeight();
+ for (Point point : polyline.getPoints()) {
+ point.setY(height - point.getY());
+ }
+
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ResizableNode#resize(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm, int, int, int, int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+ // Resize polyline
+ Polyline polyline = (Polyline) algorithm.getGraphicsAlgorithmChildren()
+ .get(0);
+ int newWidth = width;
+ int newHeight = height;
+ int oldWidth = algorithm.getWidth();
+ int oldHeight = algorithm.getHeight();
+
+ int lineXy[];
+ int newSize, oldSize;
+
+ // resize if aspect-ratio change is detected
+ if ((newWidth > newHeight && oldWidth > oldHeight)
+ || (newWidth < newHeight && oldWidth < oldHeight)) {
+ if (newWidth > newHeight) {
+ newSize = newWidth;
+ oldSize = oldWidth;
+ ga.setLocationAndSize(algorithm, x, y, newSize,
+ 9 * newSize / 40);
+ } else {
+ newSize = newHeight;
+ oldSize = oldHeight;
+ ga.setLocationAndSize(algorithm, x, y, 9 * newSize / 40,
+ newSize);
+ }
+
+ double factor = ((double) newSize) / oldSize;
+ for (Point p : polyline.getPoints()) {
+ p.setX((int) (p.getX() * factor));
+ p.setBefore((int) (p.getBefore() * factor));
+ p.setY((int) (p.getY() * factor));
+ p.setAfter((int) (p.getAfter() * factor));
+ }
+ // redraw if aspect-ratio has changed
+ } else {
+ if (newWidth > newHeight) {
+ newSize = newWidth;
+ lineXy = new int[] {
+ /* 1 */0, 0,
+ /* 2 */0, newSize / 8,
+ /* 3 */newSize / 2, newSize / 8,
+ /* 4 */newSize / 2, 9 * newSize / 40,
+ /* 5 */newSize / 2, newSize / 8,
+ /* 6 */newSize, newSize / 8,
+ /* 7 */newSize, 0 };
+ ga.setLocationAndSize(algorithm, x, y, newSize,
+ 9 * newSize / 40);
+ } else { // w <= h
+ newSize = newHeight;
+ lineXy = new int[] {
+ /* 1 */0, 0,
+ /* 2 */newSize / 8, 0,
+ /* 3 */newSize / 8, newSize / 2,
+ /* 4 */9 * newSize / 40, newSize / 2,
+ /* 5 */newSize / 8, newSize / 2,
+ /* 6 */newSize / 8, newSize,
+ /* 7 */0, newSize };
+ ga.setLocationAndSize(algorithm, x, y, 9 * newSize / 40,
+ newSize);
+ }
+
+ int cornerSize = newSize / 10;
+ int lineBeforeAfter[] = new int[] {
+ /* 1 */0, 0,
+ /* 2 */cornerSize, cornerSize,
+ /* 3 */cornerSize, cornerSize,
+ /* 4 */0, 0,
+ /* 5 */cornerSize, cornerSize,
+ /* 6 */cornerSize, cornerSize,
+ /* 7 */0, 0 };
+
+ int i = 0;
+ for (Point p : polyline.getPoints()) {
+ p.setX(lineXy[i]);
+ p.setBefore(lineBeforeAfter[i++]);
+ p.setY(lineXy[i]);
+ p.setAfter(lineBeforeAfter[i++]);
+ }
+
+ }
+
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithm.java
new file mode 100644
index 0000000..b050cc2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithm.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.comment;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.GraphicsNode;
+
+/**
+ * This is the interface for all comment algorithms.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface CommentAlgorithm extends FMCElementAlgorithm, GraphicsNode {
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithmFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithmFactory.java
new file mode 100644
index 0000000..4f6a9f1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/CommentAlgorithmFactory.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.comment;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This factory produces Comment algorithms depending on an already existing
+ * comment instance. The factory is responsible for creating the appropriate
+ * algorithm. This class is singleton.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class CommentAlgorithmFactory {
+
+ private static CommentAlgorithmFactory instance;
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ private BraceAlgorithm brace = null;
+
+ private CommentAlgorithmFactory() {
+ }
+
+ /**
+ * Lazy initialization method of this factory.
+ *
+ * @return The singleton instance of this factory.
+ */
+ public static synchronized CommentAlgorithmFactory getInstance() {
+ if (instance == null) {
+ instance = new CommentAlgorithmFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * Returns the brace algorithm singleton instance.
+ * @return BraceAlgorithm object.
+ */
+ public BraceAlgorithm getBrace() {
+ if (brace == null) {
+ brace = new BraceAlgorithm();
+ }
+ return brace;
+ }
+
+ /**
+ * Returns the appropriate algorithm for the already existing pictogram
+ * element.
+ *
+ * @param picto
+ * The pictogram element to find the algorithm for.
+ * @return The appropriate FMCNodeAlgorithm instance.
+ *
+ */
+ public CommentAlgorithm getShape(PictogramElement picto) {
+ if (helper.isBrace(picto)) {
+ return getBrace();
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/package.html
new file mode 100644
index 0000000..0ea0354
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/comment/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains classes responsible for algorithms to create/modify/process comment elements such as braces.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithm.java
new file mode 100644
index 0000000..0e97347
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithm.java
@@ -0,0 +1,401 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.connection;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommunicationChannelAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.ConnectionAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.RequestDirection;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.Ellipse;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+import org.eclipse.graphiti.mm.pictograms.CurvedConnection;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * This class encapsulates the graphical connection algorithms for editing
+ * different types of connections such as communication channels or access
+ * connections.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCConnectionAlgorithm implements FMCElementAlgorithm {
+ private static final String R_DECO = "R";
+ private static final float decoPosX = 0.4f;
+ private static final int[] POINTS_REQUEST_ARROW = new int[] { 0, 24, -15,
+ 18, 0, 12, -3, 18 };
+ private static final int[] POINTS_RESPONSE_ARROW = new int[] { 10, 24, 25,
+ 18, 10, 12, 13, 18 };
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ /**
+ * The minimum supported size of a channel line decoration (diameter).
+ */
+ public static final int CHANNEL_MIN_SIZE = 16;
+
+ /**
+ * Returns all connection decorators representing connection arrows (access
+ * connection)
+ *
+ * @param con
+ * The connection containing the decorators.
+ * @return Set of connection decorators.
+ */
+ private Set<ConnectionDecorator> getArrowDecorators(Connection con) {
+ Set<ConnectionDecorator> allArrows = new HashSet<ConnectionDecorator>();
+ for (ConnectionDecorator deco : con.getConnectionDecorators()) {
+ if (deco.getGraphicsAlgorithm() instanceof Polygon) {
+ allArrows.add(deco);
+ }
+ }
+ return allArrows;
+ }
+
+ /**
+ * Returns the connection decorator representing the channel from the
+ * connection con.
+ *
+ * @param con
+ * The connection containing the channel decorator.
+ * @return The channel decorator, null if no such decorator exists.
+ *
+ */
+ private ConnectionDecorator getChannelDecorator(Connection con) {
+ for (ConnectionDecorator deco : con.getConnectionDecorators()) {
+ if (deco.getGraphicsAlgorithm() instanceof Ellipse) {
+ return deco;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the connection decorator representing the R for Request.
+ *
+ * @param con
+ * The connection containing the R decorator.
+ * @return The R decorator, null if no such decorator exists.
+ *
+ */
+ private ConnectionDecorator getRequestRDecorator(Connection con) {
+ for (ConnectionDecorator deco : con.getConnectionDecorators()) {
+ if (deco.getGraphicsAlgorithm() instanceof AbstractText
+ && R_DECO.equals(((AbstractText) deco
+ .getGraphicsAlgorithm()).getValue())) {
+ return deco;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Compares the polygon with the given points and returns true if both are
+ * equal.
+ *
+ * @param polyPoints
+ * The polygon points to compare.
+ * @param poly
+ * The polygon object to compare.
+ * @return True if both polygons are equal.
+ */
+ private boolean equalsPolygon(int[] polyPoints, Polygon poly) {
+ int i = 0;
+ for (Point p : poly.getPoints()) {
+ if (p.getX() != polyPoints[i] || p.getY() != polyPoints[i + 1]) {
+ return false;
+ }
+ i += 2;
+ }
+ return true;
+ }
+
+ /**
+ * Sets the location of the channel decorator.
+ *
+ * @param con
+ * The connection containing the channel decorator.
+ * @param location
+ * The relative position of the decorator.
+ * @param diagram
+ * The diagram object.
+ */
+ public void setChannelLocation(Connection con, Diagram diagram,
+ double location) {
+ ConnectionDecorator channelDecorator = getChannelDecorator(con);
+ if (channelDecorator != null) {
+ Set<ConnectionDecorator> arrowDecorators = getArrowDecorators(con);
+ for (ConnectionDecorator arrowDecorator : arrowDecorators) {
+ if (arrowDecorator.getLocation() != 1.0
+ && arrowDecorator.getLocation() != 0.0) {
+ arrowDecorator.setLocation(location);
+ }
+ }
+ con.getConnectionDecorators().remove(channelDecorator);
+ ConnectionDecorator newChannelDecorator = createChannelSymbol(con,
+ diagram);
+ newChannelDecorator.setLocation(location);
+ ConnectionDecorator requestRDecorator = getRequestRDecorator(con);
+ if (requestRDecorator != null)
+ requestRDecorator.setLocation(location);
+ }
+ }
+
+ /**
+ * Returns the relative location of the channel decorator.
+ *
+ * @param con The connection containing the decorator.
+ * @return The relative channel location.
+ */
+ public double getChannelLocation(Connection con) {
+ ConnectionDecorator channelDecorator = getChannelDecorator(con);
+ if (channelDecorator != null) {
+ return channelDecorator.getLocation();
+ } else
+ return 0;
+ }
+
+ /**
+ *
+ * @param con
+ * @param direction
+ * @param diagram
+ */
+ public void setRequestDirection(Connection con, RequestDirection direction,
+ Diagram diagram) {
+ Set<ConnectionDecorator> arrows = getArrowDecorators(con);
+ DataflowDirection dfDirection = getDirection(con);
+ con.getConnectionDecorators().removeAll(arrows);
+ con.getConnectionDecorators().remove(getRequestRDecorator(con));
+ createRequestArrow(con, direction, diagram);
+ createDirectionArrow(con, dfDirection, diagram);
+ }
+
+ /**
+ * Return the request direction of the communication channel, either
+ * Request, Response or Request/Response.
+ *
+ * @param con
+ * The connection representing a communication channel.
+ * @return The request direction of the communication channel.
+ */
+ public RequestDirection getRequestDirection(Connection con) {
+ boolean request = false;
+ boolean response = false;
+ for (ConnectionDecorator deco : con.getConnectionDecorators()) {
+ if (deco.getGraphicsAlgorithm() instanceof Polygon) {
+ if (equalsPolygon(POINTS_REQUEST_ARROW,
+ (Polygon) deco.getGraphicsAlgorithm())) {
+ request = true;
+ }
+ if (equalsPolygon(POINTS_RESPONSE_ARROW,
+ (Polygon) deco.getGraphicsAlgorithm())) {
+ response = true;
+ }
+ if (request && response)
+ return RequestDirection.REQUESTRESPONSE;
+ }
+ }
+ if (request) {
+ return RequestDirection.REQUEST;
+ } else if (response) {
+ return RequestDirection.RESPONSE;
+ }
+ return RequestDirection.UNSPECIFIED;
+ }
+
+ /**
+ * Creates a new request arrow with the specified request direction.
+ *
+ * @param con
+ * Then connection for which the decorator will be created.
+ * @param direction
+ * The request arrow direction
+ * @param diagram
+ * The diagram containing the connection.
+ */
+ private void createRequestArrow(Connection con, RequestDirection direction,
+ Diagram diagram) {
+ IGaService ga = Graphiti.getGaService();
+ IPeService pe = Graphiti.getPeService();
+ ConnectionDecorator arrow = pe.createConnectionDecorator(con, false,
+ decoPosX, true);
+ Polygon arrowPoly = null;
+ switch (direction) {
+ case REQUEST:
+ arrowPoly = ga.createPolygon(arrow, POINTS_REQUEST_ARROW);
+ arrowPoly.setBackground(ga.manageColor(diagram, 0, 0, 0));
+ break;
+ case RESPONSE:
+ arrowPoly = ga.createPolygon(arrow, POINTS_RESPONSE_ARROW);
+ arrowPoly.setBackground(ga.manageColor(diagram, 0, 0, 0));
+ break;
+ case REQUESTRESPONSE:
+ arrowPoly = ga.createPolygon(arrow, POINTS_REQUEST_ARROW);
+ arrowPoly.setBackground(ga.manageColor(diagram, 0, 0, 0));
+ ConnectionDecorator arrow2 = pe.createConnectionDecorator(con,
+ false, decoPosX, true);
+ Polygon arrowPoly2 = ga
+ .createPolygon(arrow2, POINTS_RESPONSE_ARROW);
+ arrowPoly2.setBackground(ga.manageColor(diagram, 0, 0, 0));
+ break;
+ default:
+ break;
+ }
+ if (direction != RequestDirection.UNSPECIFIED) {
+ ConnectionDecorator letter = pe.createConnectionDecorator(con,
+ false, decoPosX, true);
+ letter.setActive(true);
+ Text txt = ga.createText(letter, R_DECO);
+ txt.setForeground(ga.manageColor(diagram, 0, 0, 0));
+ txt.setWidth(10);
+ txt.setHeight(10);
+ ga.setLocation(txt, -8, -22);
+ }
+ }
+
+ /**
+ * Sets the data flow direction of a connection by creating a connection
+ * decorator. If the connection is a composite connection, the direction
+ * is also switched for the children.
+ *
+ * @param con
+ * The connection to set the data flow direction for.
+ * @param direction
+ * The data flow direction to be set.
+ * @param diagram
+ * The diagram containing the connection.
+ */
+ public void setDirection(Connection con, DataflowDirection direction,
+ Diagram diagram) {
+ if (con instanceof CompositeConnection) {
+ CompositeConnection composite = (CompositeConnection) con;
+ int i = 0;
+ for (CurvedConnection child : composite.getChildren()) {
+ changeDirection(child, i == 0 ? direction
+ : DataflowDirection.getOpposite(direction), diagram);
+ i++;
+ }
+ } else
+ changeDirection(con, direction, diagram);
+ }
+
+ /**
+ * Sets the data flow direction of a connection by creating a connection
+ * decorator.
+ *
+ * @param con
+ * The connection to set the data flow direction for.
+ * @param direction
+ * The data flow direction to be set.
+ * @param diagram
+ * The diagram containing the connection.
+ */
+ private void changeDirection(Connection con, DataflowDirection direction,
+ Diagram diagram) {
+ Set<ConnectionDecorator> arrows = getArrowDecorators(con);
+ RequestDirection requestDirection = getRequestDirection(con);
+ con.getConnectionDecorators().removeAll(arrows);
+ con.getConnectionDecorators().remove(getRequestRDecorator(con));
+ createDirectionArrow(con, direction, diagram);
+ createRequestArrow(con, requestDirection, diagram);
+ }
+
+ /**
+ * Returns the data flow direction of the connection.
+ *
+ * @param con
+ * The connection for which the data flow is to be determined.
+ * @return The data flow direction of the connection.
+ */
+ public DataflowDirection getDirection(Connection con) {
+ Set<ConnectionDecorator> arrows = getArrowDecorators(con);
+ if (arrows.isEmpty())
+ return DataflowDirection.UNSPECIFIED;
+ else {
+ for (ConnectionDecorator connectionDecorator : arrows) {
+ if (connectionDecorator.getLocation() == 0) {
+ return DataflowDirection.OTHER;
+ } else if (connectionDecorator.getLocation() == 1) {
+ return DataflowDirection.DEFAULT;
+ }
+ }
+ return DataflowDirection.UNSPECIFIED;
+ }
+ }
+
+ /**
+ * Creates a data flow direction arrow for the connection.
+ *
+ * @param con
+ * The connection to create the connection for.
+ * @param direction
+ * The direction of the connection to be created.
+ * @param diagram
+ * The diagram containing the connection.
+ */
+ private void createDirectionArrow(Connection con,
+ DataflowDirection direction, Diagram diagram) {
+ boolean defaultDirection = direction == DataflowDirection.DEFAULT;
+ if (direction != DataflowDirection.UNSPECIFIED) {
+ ConnectionAddFeature.createArrowDecorator(diagram, con,
+ defaultDirection);
+ }
+ if (direction != DataflowDirection.UNSPECIFIED
+ && helper.isCommunicationChannel(con)) {
+ CommunicationChannelAddFeature.createCenterArrow(diagram, con,
+ defaultDirection);
+ }
+ }
+
+ /**
+ * Creates a channel connection decorator for the connection.
+ *
+ * @param con
+ * The connection to create a channel for.
+ * @param diagram
+ * The diagram containing the connection.
+ * @return The connection decorator for the channel.
+ */
+ public ConnectionDecorator createChannelSymbol(Connection con,
+ Diagram diagram) {
+ ConnectionDecorator cDecorator = Graphiti.getPeService()
+ .createConnectionDecorator(con, false, decoPosX, true);
+ Ellipse e = Graphiti.getGaService().createEllipse(cDecorator);
+ e.setBackground(Graphiti.getGaService().manageColor(diagram, 255, 255,
+ 255));
+ e.setForeground(Graphiti.getGaService().manageColor(diagram, 0, 0, 0));
+ e.setLineWidth(2);
+ Graphiti.getGaService().setLocationAndSize(e, -8, 0, CHANNEL_MIN_SIZE,
+ CHANNEL_MIN_SIZE);
+ return cDecorator;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithmFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithmFactory.java
new file mode 100644
index 0000000..109dbec
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/FMCConnectionAlgorithmFactory.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.connection;
+
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This factory produces connection algorithms.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCConnectionAlgorithmFactory {
+
+ private static FMCConnectionAlgorithmFactory instance = null;
+
+ /**
+ * This class cannot be instantiated it is a singleton.
+ */
+ private FMCConnectionAlgorithmFactory() {
+ }
+
+ /**
+ * Return the singleton instance of this factory class.
+ *
+ * @return The factory instance.
+ */
+ public static synchronized FMCConnectionAlgorithmFactory getInstance() {
+ if (instance == null) {
+ instance = new FMCConnectionAlgorithmFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * Returns the connection algorithm for the pictogram element. If the
+ * pictogram element is not a connection, this method will return null.
+ *
+ * @param picto
+ * The pictogram element for determination of the connection
+ * algorithm.
+ *
+ * @return The connection algorithm matching the pictogram input. Currently,
+ * there is only one type of connection algorithm
+ */
+ public FMCConnectionAlgorithm getAlgorithm(PictogramElement picto) {
+ if (picto instanceof Connection)
+ return new FMCConnectionAlgorithm();
+ return null;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/package.html
new file mode 100644
index 0000000..c7ce532
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/connection/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains classes responsible for algorithms to create/modify/process connections such as communication channels or access connections.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithm.java
new file mode 100644
index 0000000..6f062f9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithm.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.element;
+
+/**
+ * This is the interface for all FMC element algorithms.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface FMCElementAlgorithm {
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithmFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithmFactory.java
new file mode 100644
index 0000000..92ffc70
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/FMCElementAlgorithmFactory.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.element;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.comment.CommentAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This factory produces all kinds of algorithms depending on an already existing
+ * pictogram element instance. The factory is responsible for creating the appropriate
+ * algorithm. This class is singleton.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class FMCElementAlgorithmFactory {
+
+ private static FMCElementAlgorithmFactory instance;
+ private FMCNodeAlgorithmFactory fmcNodeAlgorithmFactory = FMCNodeAlgorithmFactory
+ .getInstance();
+ private FMCConnectionAlgorithmFactory connectionAlgorithmFactory = FMCConnectionAlgorithmFactory
+ .getInstance();
+ private CommentAlgorithmFactory commentAlgorithmFactory = CommentAlgorithmFactory
+ .getInstance();
+
+ /**
+ * Private constructor. Singleton.
+ */
+ private FMCElementAlgorithmFactory() {
+ }
+
+ /**
+ * Lazy initialization method of this factory.
+ *
+ * @return The singleton instance of this factory.
+ */
+ public static synchronized FMCElementAlgorithmFactory getInstance() {
+ if (instance == null) {
+ instance = new FMCElementAlgorithmFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * Returns the appropriate algorithm for the already existing pictogram
+ * element, either a FMCNodeAlgorithm, a ConnectionAlgorithm or a
+ * CommentAlgorithm.
+ *
+ * @param picto
+ * The pictogram element to find the algorithm for.
+ * @return The appropriate FMCElementAlgorithm instance.
+ *
+ */
+ public FMCElementAlgorithm getShape(PictogramElement picto) {
+ // Is it a Node?
+ FMCElementAlgorithm result = fmcNodeAlgorithmFactory.getShape(picto);
+ if (result != null) {
+ return result;
+ }
+ // Is it a Connection?
+ result = connectionAlgorithmFactory.getAlgorithm(picto);
+ if (result != null) {
+ return result;
+ }
+ // Is it a Comment?
+ result = commentAlgorithmFactory.getShape(picto);
+ return result;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/package.html
new file mode 100644
index 0000000..04a0600
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/element/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains classes responsible for algorithms to create/modify/process all kinds of pictogram elements: nodes, connections and comments.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractLPolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractLPolygonAlgorithm.java
new file mode 100644
index 0000000..34ba3d5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractLPolygonAlgorithm.java
@@ -0,0 +1,822 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This abstract class implements all methods common to L-shaped polygons.
+ *
+ * 43 xx 0xx5x 1xxx2
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class AbstractLPolygonAlgorithm extends
+ AbstractPolygonAlgorithm implements LPolygonAlgorithm {
+
+ // ----------------------------------------
+ // ----------- (L)Polygon Impl ------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.PolygonAlgorithm#getInitialPoints(int,
+ * int, int, int)
+ */
+ public List<Point> getInitialPoints(int x, int y, int width, int height) {
+ int outerCornerSize = hasRoundedCorners() ? L_PART_DEFAULT_SIZE / 2 : 0;
+ int innerCornerSize = hasRoundedCorners() ? outerCornerSize * 2 / 3 : 0;
+ List<Point> points = new ArrayList<Point>();
+
+ /* 0 */points.add(ga.createPoint(x, y + height - L_PART_DEFAULT_SIZE,
+ outerCornerSize, outerCornerSize));
+ /* 1 */points.add(ga.createPoint(x, y + height, outerCornerSize,
+ outerCornerSize));
+ /* 2 */points.add(ga.createPoint(x + width, y + height,
+ outerCornerSize, outerCornerSize));
+ /* 3 */points.add(ga.createPoint(x + width, y, outerCornerSize,
+ outerCornerSize));
+ /* 4 */points.add(ga.createPoint(x + width - L_PART_DEFAULT_SIZE, y,
+ outerCornerSize, outerCornerSize));
+ /* 5 */points.add(ga.createPoint(x + width - L_PART_DEFAULT_SIZE, y
+ + height - L_PART_DEFAULT_SIZE, innerCornerSize,
+ innerCornerSize));
+
+ return points;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.LPolygonAlgorithm#
+ * getBottomPartSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getBottomPartSize(Polygon polygon) {
+ EList<Point> points = polygon.getPoints();
+ if (isFlattened(polygon))
+ return Math.abs(points.get(1).getX() - points.get(5).getX());
+ else
+ return Math.abs(points.get(1).getY() - points.get(5).getY());
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.LPolygonAlgorithm#
+ * getRightPartSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getRightPartSize(Polygon polygon) {
+ EList<Point> points = polygon.getPoints();
+ if (isFlattened(polygon))
+ return Math.abs(points.get(3).getY() - points.get(4).getY());
+ else
+ return Math.abs(points.get(3).getX() - points.get(4).getX());
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.LPolygonAlgorithm#
+ * resizeBottomPart(org.eclipse.graphiti.mm.algorithms.Polygon, int)
+ */
+ public void resizeBottomPart(Polygon polygon, int size) {
+ if (size < LPolygonAlgorithm.L_PART_MINIMUM_SIZE) {
+ size = LPolygonAlgorithm.L_PART_MINIMUM_SIZE;
+ }
+ int oldSize = getBottomPartSize(polygon);
+ int sizeDif = isFlipped(polygon) ? oldSize - size : size - oldSize;
+ EList<Point> points = polygon.getPoints();
+ if (sizeDif != 0) {
+ switch (getAngle(polygon)) {
+ case 90:
+ points.get(0).setX(points.get(0).getX() + sizeDif);
+ points.get(5).setX(points.get(5).getX() + sizeDif);
+ break;
+ case 180:
+ points.get(0).setY(points.get(0).getY() + sizeDif);
+ points.get(5).setY(points.get(5).getY() + sizeDif);
+ break;
+ case 270:
+ points.get(0).setX(points.get(0).getX() - sizeDif);
+ points.get(5).setX(points.get(5).getX() - sizeDif);
+ break;
+ default:
+ points.get(0).setY(points.get(0).getY() - sizeDif);
+ points.get(5).setY(points.get(5).getY() - sizeDif);
+ }
+
+ // adapt corner roundings if storage
+ if (hasRoundedCorners()) {
+ int cornerSize = getBottomPartLeftCornerSize(polygon);
+ int innerCornerSize = getBottomPartRightCornerSize(polygon);
+
+ points.get(0).setBefore(cornerSize);
+ points.get(0).setAfter(cornerSize);
+ points.get(1).setBefore(cornerSize);
+ points.get(1).setAfter(cornerSize);
+ points.get(2).setBefore(innerCornerSize);
+ points.get(5).setAfter(innerCornerSize);
+ }
+ }
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = polygon
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Resize bottom part of polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.resizeBottomPart(
+ (Polygon) graphicsAlgorithmChildren.get(i), size);
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(polygon));
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.LPolygonAlgorithm#
+ * resizeRightPart(org.eclipse.graphiti.mm.algorithms.Polygon, int)
+ */
+ public void resizeRightPart(Polygon polygon, int size) {
+ if (size < LPolygonAlgorithm.L_PART_MINIMUM_SIZE) {
+ size = LPolygonAlgorithm.L_PART_MINIMUM_SIZE;
+ }
+ int oldSize = getRightPartSize(polygon);
+ int sizeDif = size - oldSize;
+ EList<Point> points = polygon.getPoints();
+ if (sizeDif != 0) {
+ switch (getAngle(polygon)) {
+ case 90:
+ points.get(4).setY(points.get(4).getY() - sizeDif);
+ points.get(5).setY(points.get(5).getY() - sizeDif);
+ break;
+ case 180:
+ points.get(4).setX(points.get(4).getX() + sizeDif);
+ points.get(5).setX(points.get(5).getX() + sizeDif);
+ break;
+ case 270:
+ points.get(4).setY(points.get(4).getY() + sizeDif);
+ points.get(5).setY(points.get(5).getY() + sizeDif);
+ break;
+ default:
+ points.get(4).setX(points.get(4).getX() - sizeDif);
+ points.get(5).setX(points.get(5).getX() - sizeDif);
+ }
+
+ // adapt corner roundings if polygon has rounded corners
+ if (hasRoundedCorners()) {
+ int cornerSize = getRightPartTopCornerSize(polygon);
+ int innerCornerSize = getRightPartBottomCornerSize(polygon);
+
+ points.get(3).setBefore(cornerSize);
+ points.get(3).setAfter(cornerSize);
+ points.get(4).setBefore(cornerSize);
+ points.get(4).setAfter(cornerSize);
+ points.get(5).setBefore(innerCornerSize);
+ points.get(2).setAfter(innerCornerSize);
+ }
+ }
+
+ relocateText(polygon);
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = polygon
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Resize right part of polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.resizeRightPart(
+ (Polygon) graphicsAlgorithmChildren.get(i), size);
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(polygon));
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.LPolygonAlgorithm#getRightPartTopCornerSize
+ * (org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getRightPartTopCornerSize(Polygon polygon) {
+ return getRightPartSize(polygon) / 2;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.LPolygonAlgorithm#
+ * getBottomPartLeftCornerSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getBottomPartLeftCornerSize(Polygon polygon) {
+ return getBottomPartSize(polygon) / 2;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.LPolygonAlgorithm#
+ * getRightPartBottomCornerSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getRightPartBottomCornerSize(Polygon polygon) {
+ return getRightPartTopCornerSize(polygon);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.LPolygonAlgorithm#
+ * getBottomPartRightCornerSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getBottomPartRightCornerSize(Polygon polygon) {
+ return getBottomPartLeftCornerSize(polygon);
+ }
+
+ // ----------------------------------------
+ // ----------- Rotatable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#getAngle(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public int getAngle(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+ EList<Point> points = polygon.getPoints();
+ Point point1 = points.get(1);
+ Point point2 = points.get(2);
+ if (point2.getY() == point1.getY()) {
+ return (point2.getX() > point1.getX()) ? 0 : 180;
+ } else {
+ return (point2.getY() > point1.getY()) ? 90 : 270;
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#isFlipped(org.eclipse.
+ * graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public boolean isFlipped(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+ EList<Point> points = polygon.getPoints();
+ Point point2 = points.get(2);
+ Point point3 = points.get(3);
+ switch (getAngle(polygon)) {
+ case 90:
+ return (point2.getX() < point3.getX()) ? false : true;
+ case 180:
+ return (point2.getY() < point3.getY()) ? false : true;
+ case 270:
+ return (point2.getX() > point3.getX()) ? false : true;
+ default:
+ return (point2.getY() > point3.getY()) ? false : true;
+ }
+ }
+
+ /**
+ * Is the angle of the L polygon 90 or 270?
+ *
+ * @param polygon
+ * @return True, if angle is 90 or 270
+ */
+ protected boolean isFlattened(Polygon polygon) {
+ double oldAngle = getAngle(polygon);
+ return (oldAngle % 180) == 90;
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.polygon.AbstractPolygonAlgorithm#resize(org
+ * .eclipse.graphiti.mm.algorithms.GraphicsAlgorithm, int, int, int, int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+ Polygon polygon = (Polygon) algorithm;
+ int angle = getAngle(polygon);
+ int[] resizeX;
+ int[] resizeY;
+ if (isFlipped(polygon)) {
+ switch (angle) {
+ case 90:
+ resizeX = new int[4];
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeX[2] = 2;
+ resizeX[3] = 5;
+ resizeY = new int[4];
+ resizeY[0] = 2;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 5;
+ break;
+ case 180:
+ resizeX = new int[2];
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeY = new int[4];
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ resizeY[2] = 2;
+ resizeY[3] = 5;
+ break;
+ case 270:
+ resizeX = new int[2];
+ resizeX[0] = 3;
+ resizeX[1] = 4;
+ resizeY = new int[2];
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ break;
+ default:
+ resizeX = new int[4];
+ resizeX[0] = 2;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 5;
+ resizeY = new int[2];
+ resizeY[0] = 3;
+ resizeY[1] = 4;
+ }
+ } else {
+ switch (angle) {
+ case 90:
+ resizeX = new int[2];
+ resizeX[0] = 3;
+ resizeX[1] = 4;
+ resizeY = new int[4];
+ resizeY[0] = 2;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 5;
+ break;
+ case 180:
+ resizeX = new int[2];
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeY = new int[2];
+ resizeY[0] = 3;
+ resizeY[1] = 4;
+ break;
+ case 270:
+ resizeX = new int[4];
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeX[2] = 2;
+ resizeX[3] = 5;
+ resizeY = new int[2];
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ break;
+ default:
+ resizeX = new int[4];
+ resizeX[0] = 2;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 5;
+ resizeY = new int[4];
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ resizeY[2] = 2;
+ resizeY[3] = 5;
+ }
+ }
+
+ int oldHeight = polygon.getHeight();
+ int oldWidth = polygon.getWidth();
+ int heightDif = height - oldHeight;
+ int widthDif = width - oldWidth;
+
+ EList<Point> points = polygon.getPoints();
+ for (int i = 0; i < resizeX.length; i++) {
+ points.get(resizeX[i]).setX(
+ points.get(resizeX[i]).getX() + widthDif);
+ }
+ for (int i = 0; i < resizeY.length; i++) {
+ points.get(resizeY[i]).setY(
+ points.get(resizeY[i]).getY() + heightDif);
+ }
+
+ // adapt corner roundings if polygon has rounded corners
+ if (hasRoundedCorners()) {
+ int rightCornerSize = getRightPartTopCornerSize(polygon);
+ int rightInnerBottomCornerSize = getRightPartBottomCornerSize(polygon);
+ int bottomCornerSize = getBottomPartLeftCornerSize(polygon);
+ int bottomInnerRightCornerSize = getBottomPartRightCornerSize(polygon);
+
+ points.get(0).setBefore(bottomCornerSize);
+ points.get(0).setAfter(bottomCornerSize);
+ points.get(1).setBefore(bottomCornerSize);
+ points.get(1).setAfter(bottomCornerSize);
+ points.get(2).setBefore(bottomInnerRightCornerSize);
+ points.get(2).setAfter(rightInnerBottomCornerSize);
+ points.get(3).setBefore(rightCornerSize);
+ points.get(3).setAfter(rightCornerSize);
+ points.get(4).setBefore(rightCornerSize);
+ points.get(4).setAfter(rightCornerSize);
+ points.get(5).setBefore(rightInnerBottomCornerSize);
+ points.get(5).setAfter(bottomInnerRightCornerSize);
+ }
+
+ ga.setLocationAndSize(polygon, x, y, width, height);
+
+ relocateText(polygon);
+
+ // adapt first level container (relative anchors + invisible shape)
+ ContainerShape container = this.getContainerShape(polygon);
+ createBoxAnchorSet(container);
+ synchronizeFirstLevelShape(container);
+ }
+
+ // ----------------------------------------
+ // ----------- Named Node -----------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.NamedNode#relocateText(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public void relocateText(GraphicsAlgorithm graphicsAlgorithm) {
+ MultiText text = this.getText(graphicsAlgorithm);
+ if (text != null) {
+ int multipleOffset = 0;
+ if (this.isMultipleInstances(this
+ .getContainerShape(graphicsAlgorithm))) {
+ multipleOffset = MULTI_INSTANCE_GAP;
+ }
+ int angle = getAngle(graphicsAlgorithm);
+ int textContainingPartSize;
+ boolean isOnTop;
+ textContainingPartSize = (angle == 0 || angle == 180) ? getBottomPartSize((Polygon) graphicsAlgorithm)
+ : getRightPartSize((Polygon) graphicsAlgorithm);
+ if (isFlipped(graphicsAlgorithm)) {
+ isOnTop = (angle == 0 || angle == 270) ? true : false;
+ } else {
+ isOnTop = (angle == 180 || angle == 270) ? true : false;
+ }
+
+ int x = super.textMargin;
+ int width = graphicsAlgorithm.getWidth() - 2 * super.textMargin
+ - multipleOffset;
+ int y = (isOnTop ? super.textMargin : graphicsAlgorithm.getHeight()
+ - textContainingPartSize + super.textMargin)
+ + multipleOffset;
+ int height = textContainingPartSize - 2 * super.textMargin
+ - multipleOffset;
+
+ ga.setLocationAndSize(text, x, y, width, height);
+ }
+ }
+
+ // ----------------------------------------
+ // ----------- Anchored Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#addBoxAnchorSet(org.eclipse
+ * .graphiti.mm.pictograms.ContainerShape)
+ */
+ protected void addBoxAnchorSet(Shape shape) {
+
+ GraphicsAlgorithm firstLevelPolygon = shape.getGraphicsAlgorithm();
+ Polygon secondLevelPolygon = (Polygon) firstLevelPolygon
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // Sides of the polygon:
+ // 3
+ // ---
+ // | |
+ // 4 | |
+ // 5 | | 2
+ // ------- |
+ // 0 | |
+ // -----------
+ // 1
+ int numSides = 6;
+ int lineWidth = getDefaultLineWidth();
+ Point[] point = new Point[numSides];
+ for (int i = 0; i < point.length; i++) {
+ point[i] = secondLevelPolygon.getPoints().get(i);
+ }
+
+ // Offset in case of a multi instance shape (adapt anchors when drawing
+ // background part)
+ double offsetMultiInstance = 0.0d;
+ if (firstLevelPolygon.getWidth() != secondLevelPolygon.getWidth()) {
+ // Remove anchors created when drawing the main part
+ FMCUtil.removeObsoleteAnchors(shape);
+ offsetMultiInstance = MULTI_INSTANCE_GAP;
+ }
+
+ // Length of the sides (not taking into account rounded corners)
+ int[] length = new int[numSides];
+ length[0] = getBottomPartSize(secondLevelPolygon) + lineWidth;
+ length[1] = Math.abs(isFlattened(secondLevelPolygon) ? point[1].getY()
+ - point[2].getY() : point[1].getX() - point[2].getX());
+ length[2] = Math.abs(isFlattened(secondLevelPolygon) ? point[2].getX()
+ - point[3].getX() : point[2].getY() - point[3].getY());
+ length[3] = getRightPartSize(secondLevelPolygon) + lineWidth;
+ length[4] = length[2] - length[0];
+ length[5] = length[1] - length[3];
+
+ // Length of the sides that should contain anchors
+ int[] anchoredLength = new int[numSides];
+ for (int i = 0; i < numSides; i++)
+ anchoredLength[i] = Math.max(length[i] - point[i].getAfter()
+ - point[(i + 1) % numSides].getBefore(),
+ DEFAULT_ANCHOR_DIAMETER);
+
+ // Number of anchors of the sides
+ int[] numAnchors = new int[numSides];
+
+ // Gaps between the anchor starting points of the sides (in x and y
+ // direction)
+ double[][] gaps = new double[numSides][2];
+ for (int i = 0; i < gaps.length; i++)
+ for (int j = 0; j < gaps[i].length; j++)
+ gaps[i][j] = 0.0d;
+
+ // Offsets of the starting points of the sides (in x and y direction)
+ double[][] offset = new double[numSides][2];
+ switch (getAngle(secondLevelPolygon)) {
+ case 90:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = length[4] + offsetMultiInstance;
+ offset[1][1] = 0.0d;
+ offset[1][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[5] + offsetMultiInstance;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[5];
+ offset[4][0] = offsetMultiInstance;
+ offset[5][1] = offsetMultiInstance;
+ offset[5][0] = length[4];
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ length[4] = length[4] - (int) offsetMultiInstance;
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = offsetMultiInstance;
+ offset[1][1] = offsetMultiInstance;
+ offset[1][0] = 0.0d;
+ offset[2][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[5];
+ offset[3][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][1] = length[5];
+ offset[4][0] = length[0] + offsetMultiInstance;
+ offset[5][1] = 0.0d;
+ offset[5][0] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ }
+ break;
+ case 180:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[4];
+ offset[0][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][0] = 0.0d;
+ offset[2][1] = offsetMultiInstance;
+ offset[2][0] = 0.0d;
+ offset[3][1] = 0.0d;
+ offset[3][0] = offsetMultiInstance;
+ offset[4][1] = 0.0d;
+ offset[4][0] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][1] = length[4];
+ offset[5][0] = length[3] + offsetMultiInstance;
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][1] = 0.0d;
+ offset[1][0] = offsetMultiInstance;
+ offset[2][1] = offsetMultiInstance;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[0] + offsetMultiInstance;
+ offset[4][0] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][1] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][0] = length[3] + offsetMultiInstance;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[4].getAfter())
+ anchoredLength[4] = anchoredLength[4]
+ - (int) (offsetMultiInstance - point[5].getBefore());
+ }
+ break;
+ case 270:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[0][0] = 0.0d;
+ offset[1][1] = offsetMultiInstance;
+ offset[1][0] = 0.0d;
+ offset[2][1] = 0.0d;
+ offset[2][0] = offsetMultiInstance;
+ offset[3][1] = 0.0d;
+ offset[3][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][1] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][0] = length[0] + offsetMultiInstance;
+ offset[5][1] = length[3] + offsetMultiInstance;
+ offset[5][0] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[4].getAfter())
+ anchoredLength[4] = anchoredLength[4]
+ - (int) (offsetMultiInstance - point[5].getBefore());
+ if (offsetMultiInstance > point[5].getAfter())
+ anchoredLength[5] = anchoredLength[5]
+ - (int) (offsetMultiInstance - point[5].getAfter());
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[0][0] = length[4];
+ offset[1][1] = 0.0d;
+ offset[1][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][1] = 0.0d;
+ offset[2][0] = offsetMultiInstance;
+ offset[3][1] = offsetMultiInstance;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][0] = 0.0d;
+ offset[5][1] = length[3] + offsetMultiInstance;
+ offset[5][0] = length[4];
+ }
+ break;
+ default: // rotation = 0
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = offsetMultiInstance;
+ offset[0][0] = 0.0d;
+ offset[1][1] = 0.0d;
+ offset[1][0] = offsetMultiInstance;
+ offset[2][1] = 0.0d;
+ offset[2][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][0] = length[5];
+ offset[4][1] = length[0] + offsetMultiInstance;
+ offset[4][0] = length[5];
+ offset[5][1] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][0] = 0.0d;
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[4] + offsetMultiInstance;
+ offset[0][0] = 0.0d;
+ offset[1][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][0] = 0.0d;
+ offset[2][1] = 0.0d;
+ offset[2][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][1] = 0.0d;
+ offset[3][0] = length[5] + offsetMultiInstance;
+ offset[4][1] = offsetMultiInstance;
+ offset[4][0] = length[5];
+ offset[5][1] = length[4];
+ offset[5][0] = offsetMultiInstance;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[5].getAfter())
+ anchoredLength[5] = anchoredLength[5]
+ - (int) (offsetMultiInstance - point[5].getAfter());
+ }
+ }
+
+ // adjust offsets according to rounded corners
+ for (int i = 0; i < numSides; i++) {
+ if (point[i].getX() == point[(i + 1) % numSides].getX()) { // vertical
+ // side
+ offset[i][1] = offset[i][1]
+ + (point[i].getY() < point[(i + 1) % numSides].getY() ? (point[i]
+ .getAfter() > 0 ? point[i].getAfter()
+ - ((double) DEFAULT_ANCHOR_DIAMETER) / 2 : 0.0d)
+ : (point[(i + 1) % numSides].getBefore() > 0 ? point[(i + 1)
+ % numSides].getBefore()
+ - ((double) DEFAULT_ANCHOR_DIAMETER)
+ / 2
+ : 0.0d));
+ } else { // horizontal side
+ offset[i][0] = offset[i][0]
+ + (point[i].getX() < point[(i + 1) % numSides].getX() ? (point[i]
+ .getAfter() > 0 ? point[i].getAfter()
+ - ((double) DEFAULT_ANCHOR_DIAMETER) / 2 : 0.0d)
+ : (point[(i + 1) % numSides].getBefore() > 0 ? point[(i + 1)
+ % numSides].getBefore()
+ - ((double) DEFAULT_ANCHOR_DIAMETER)
+ / 2
+ : 0.0d));
+ }
+ }
+
+ // Calculate number of anchors per side
+ for (int i = 0; i < numSides; i++)
+ numAnchors[i] = anchoredLength[i] / DEFAULT_ANCHOR_GAP;
+
+ // Calculate gaps between the starting points of the anchors for each
+ // side
+ int direction = 0;
+ for (int i = 0; i < numSides; i++) {
+ direction = isFlattened(secondLevelPolygon) ? (i % 2)
+ : ((i + 1) % 2);
+ gaps[i][direction] = ((double) anchoredLength[i]) / numAnchors[i];
+ }
+
+ // Create relative box anchors
+ for (int i = 0; i < numSides; i++)
+ for (int j = 0; j < numAnchors[i]; j++)
+ createBoxAnchor(shape, (offset[i][0] + j * gaps[i][0])
+ / firstLevelPolygon.getWidth(), (offset[i][1] + j
+ * gaps[i][1])
+ / firstLevelPolygon.getHeight(),
+ AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractNode.java
new file mode 100644
index 0000000..27055b5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractNode.java
@@ -0,0 +1,541 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.algorithms.Ellipse;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.CurvedConnection;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * This abstract class implements methods for nodes with anchors and
+ * multiplicity property. The node can be named and may contain nested nodes.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class AbstractNode implements AnchoredNode, MultipleNode,
+ NamedNode, ResizableNode, ContainerNode {
+
+ protected IGaService ga = Graphiti.getGaService();
+ protected IPeService pe = Graphiti.getPeService();
+ protected int textMargin = DEFAULT_MARGIN;
+
+ // ----------------------------------------
+ // ----------- Anchored Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#setBoxAnchorsVisible(org
+ * .eclipse.graphiti.mm.pictograms.Shape, boolean)
+ */
+ public void setBoxAnchorsVisible(Shape shape, boolean visible) {
+ for (Anchor anchor : shape.getAnchors()) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ anchor.getGraphicsAlgorithm().setFilled(visible);
+ anchor.getGraphicsAlgorithm().setLineVisible(visible);
+ }
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#isBoxAnchorsVisible(org
+ * .eclipse.graphiti.mm.pictograms.Shape)
+ */
+ public boolean isBoxAnchorsVisible(Shape shape) {
+ for (Anchor anchor : shape.getAnchors()) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ return anchor.getGraphicsAlgorithm().getLineVisible();
+ }
+ }
+ return false;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#resizeBoxAnchorSet(org.
+ * eclipse.graphiti.mm.pictograms.ContainerShape, int, int, int, int)
+ */
+ public void resizeBoxAnchorSet(ContainerShape container, int x, int y,
+ int width, int height) {
+ createBoxAnchorSet(container);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#createBoxAnchorSet(org.
+ * eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public void createBoxAnchorSet(Shape shape) {
+ boolean isAnchorsVisible = isBoxAnchorsVisible(shape);
+ FMCUtil.removeObsoleteAnchors(shape);
+ addBoxAnchorSet(shape);
+ this.setBoxAnchorsVisible(shape, isAnchorsVisible);
+ // removeInnerUnusedAnchors(container);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#removeUnusedBoxAnchors(
+ * org.eclipse.graphiti.mm.pictograms.Shape)
+ */
+ public void removeUnusedBoxAnchors(Shape shape) {
+ FMCUtil.removeObsoleteAnchors(shape);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AnchoredNode#hasUnusedAnchors(org.eclipse
+ * .graphiti.mm.pictograms.Shape)
+ */
+ public boolean hasUnusedAnchors(Shape shape) {
+ for (Anchor anchor : new HashSet<Anchor>(shape.getAnchors())) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ if (anchor.getIncomingConnections().isEmpty()
+ && anchor.getOutgoingConnections().isEmpty()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected abstract void addBoxAnchorSet(Shape container);
+
+ public BoxRelativeAnchor createBoxAnchor(Shape shape, double rw, double rh,
+ int w, int h) {
+ BoxRelativeAnchor boxRelativeAnchor = pe.createBoxRelativeAnchor(shape);
+ // boxRelativeAnchor.setActive(true);
+ boxRelativeAnchor.setRelativeWidth(rw);
+ boxRelativeAnchor.setRelativeHeight(rh);
+ boxRelativeAnchor.setReferencedGraphicsAlgorithm(shape
+ .getGraphicsAlgorithm());
+ final Ellipse ellipse = ga.createEllipse(boxRelativeAnchor);
+ ellipse.setBackground(ga.manageColor(
+ pe.getDiagramForPictogramElement(shape), 195, 195, 240));
+ ellipse.setTransparency(0.3);
+ ellipse.setLineVisible(false);
+ ellipse.setFilled(false);
+ ga.setLocationAndSize(ellipse, 0, 0, w, h);
+ return boxRelativeAnchor;
+ }
+
+ // ----------------------------------------
+ // ----------- Multiple Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.MultipleBox#
+ * setMultipleInstances(org.eclipse.graphiti.mm.pictograms.ContainerShape,
+ * org.eclipse.graphiti.features.IFeatureProvider, boolean)
+ */
+ public void setMultipleInstances(ContainerShape container,
+ IFeatureProvider provider, boolean multipleInstances) {
+ if (multipleInstances) {
+ GraphicsAlgorithm mainShapeGa = container.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // Resize main shape
+ this.resize(mainShapeGa, mainShapeGa.getX() + MULTI_INSTANCE_GAP,
+ mainShapeGa.getY(), mainShapeGa.getWidth()
+ - MULTI_INSTANCE_GAP, mainShapeGa.getHeight()
+ - MULTI_INSTANCE_GAP);
+
+ // Create background shape
+ Diagram diagram = Graphiti.getPeService()
+ .getDiagramForPictogramElement(container);
+ GraphicsAlgorithm bgShapeGa = createGraphics(diagram,
+ container.getGraphicsAlgorithm(), 0, MULTI_INSTANCE_GAP,
+ mainShapeGa.getWidth(), mainShapeGa.getHeight());
+ bgShapeGa.setBackground(mainShapeGa.getBackground());
+ bgShapeGa.setForeground(mainShapeGa.getForeground());
+ bgShapeGa.setTransparency(mainShapeGa.getTransparency());
+ bgShapeGa.setStyle(mainShapeGa.getStyle());
+
+ // Synchronize polygons (e.g. rotation, flip)
+ synchronizeMultiInstanceChildren(container);
+
+ // Adapt first level container (relative anchors + invisible shape)
+ createBoxAnchorSet(container);
+ synchronizeFirstLevelShape(container);
+
+ // Adapt position of text field
+ relocateText(mainShapeGa);
+ } else {
+ GraphicsAlgorithm backgroundGa = getMultiInstanceChild(container,
+ false);
+ GraphicsAlgorithm foregroundGa = getMultiInstanceChild(container,
+ true);
+
+ // Remove background shape
+ container.getGraphicsAlgorithm().getGraphicsAlgorithmChildren()
+ .remove(backgroundGa);
+
+ // Resize main shape
+ this.resize(foregroundGa, foregroundGa.getX() - MULTI_INSTANCE_GAP,
+ foregroundGa.getY(), foregroundGa.getWidth()
+ + MULTI_INSTANCE_GAP, foregroundGa.getHeight()
+ + MULTI_INSTANCE_GAP);
+
+ // Adapt position of text field
+ relocateText(foregroundGa);
+
+ // Adapt first level container (relative anchors + invisible shape)
+ createBoxAnchorSet(container);
+ synchronizeFirstLevelShape(container);
+ }
+ }
+
+ /**
+ * Synchronize invisible shape of the first level container (do nothing by
+ * default).
+ *
+ * @param firstLevelContainer
+ * the ContainerShape of the node.
+ */
+ protected void synchronizeFirstLevelShape(ContainerShape firstLevelContainer) {
+ // synchronize invisible shape of the first level container (do nothing
+ // by default)
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.MultipleNode#
+ * synchronizeMultiInstanceChildren
+ * (org.eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public void synchronizeMultiInstanceChildren(
+ ContainerShape firstLevelContainer) {
+ // synchronize foreground and background ga (do nothing by default)
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.MultipleNode#getMultiInstanceChild(org
+ * .eclipse.graphiti.mm.pictograms.ContainerShape, boolean)
+ */
+ public GraphicsAlgorithm getMultiInstanceChild(ContainerShape container,
+ boolean main) {
+ GraphicsAlgorithm invisibleGa = container.getGraphicsAlgorithm();
+ if (invisibleGa.getGraphicsAlgorithmChildren().size() > 1) {
+ return invisibleGa.getGraphicsAlgorithmChildren().get(main ? 0 : 1);
+ }
+ return null;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.MultipleBox#
+ * isMultipleInstances(org.eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public boolean isMultipleInstances(ContainerShape container) {
+ return getMultiInstanceChild(container, false) != null;
+ }
+
+ // ----------------------------------------
+ // ----------- Container Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#getContainerShape(org.
+ * eclipse.graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public ContainerShape getContainerShape(GraphicsAlgorithm ga) {
+ if (ga.getPictogramElement() != null)
+ return (ContainerShape) ga.getPictogramElement();
+ return this.getContainerShape(ga.getParentGraphicsAlgorithm());
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#isEmpty(org.eclipse.graphiti
+ * .mm.pictograms.ContainerShape)
+ */
+ public boolean isEmpty(ContainerShape cs) {
+ return this.getContainedShapes(cs).isEmpty();
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#isHiding(org.eclipse.graphiti
+ * .mm.pictograms.ContainerShape)
+ */
+ public boolean isHiding(ContainerShape cs) {
+ for (Shape child : this.getContainedShapes(cs)) {
+ if (child.isVisible())
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#getContainedShapes(org
+ * .eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public EList<Shape> getContainedShapes(ContainerShape cs) {
+ EList<Shape> results = new BasicEList<Shape>();
+ for (Shape shape : cs.getChildren()) {
+ if (!(shape.getGraphicsAlgorithm() instanceof MultiText))
+ results.add(shape);
+ }
+ return results;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#hideContainedShapes(org
+ * .eclipse.graphiti.mm.pictograms.ContainerShape, boolean)
+ */
+ public void hideContainedShapes(ContainerShape cs, boolean hideChildren) {
+ for (Shape child : this.getContainedShapes(cs)) {
+ child.setVisible(!hideChildren);
+ this.hideContainedConnections(child, hideChildren);
+ }
+
+ // Resize node
+ // final ContainerShape container = cs;
+ // final GraphicsAlgorithm containerGa =
+ // container.getGraphicsAlgorithm();
+ // final int adaptedWidth = this.getContainedWidth(cs);
+ // final int adaptedHeight = this.getContainedHeight(cs);
+ // final IFeatureProvider fp =
+ // Util.getActiveEditor().getDiagramTypeProvider().getFeatureProvider();
+ // final TransactionalEditingDomain editingDomain =
+ // this.getEditingDomain();
+ //
+ // editingDomain.getCommandStack().execute(
+ // new RecordingCommand(editingDomain) {
+ // @Override
+ // protected void doExecute() {
+ // if(isWriteTransaction(editingDomain)){
+ // ResizeShapeContext ctx = new ResizeShapeContext(container);
+ // ctx.setX(containerGa.getX());
+ // ctx.setY(containerGa.getY());
+ // ctx.setWidth(adaptedWidth);
+ // ctx.setHeight(adaptedHeight);
+ // IResizeShapeFeature resizeShapeFeature =
+ // fp.getResizeShapeFeature(ctx);
+ // if(resizeShapeFeature.canExecute(ctx))
+ // resizeShapeFeature.execute(ctx);
+ // }
+ // }
+ // }
+ // );
+ }
+
+ private void hideContainedConnections(Shape s, boolean hideChildren) {
+ for (Anchor anchor : s.getAnchors()) {
+ List<Connection> connections = new ArrayList<Connection>();
+ connections.addAll(anchor.getIncomingConnections());
+ connections.addAll(anchor.getOutgoingConnections());
+
+ for (Connection con : connections) {
+ // unhide connection only if both start and end shape is visible
+ if (hideChildren
+ || (con.getStart().getParent().isVisible() && con
+ .getEnd().getParent().isVisible())) {
+ con.setVisible(!hideChildren);
+ for (ConnectionDecorator conDecorator : con
+ .getConnectionDecorators()) {
+ conDecorator.setVisible(!hideChildren);
+ }
+ if (con instanceof CompositeConnection) {
+ CompositeConnection cc = (CompositeConnection) con;
+ con.setVisible(!hideChildren);
+ for (CurvedConnection conChild : cc.getChildren()) {
+ // TODO setVisible has no effect for composite
+ // connections - why? (workaround via transparency)
+ conChild.setVisible(!hideChildren);
+ conChild.getGraphicsAlgorithm().setTransparency(
+ hideChildren ? 1.0 : 0.0);
+ for (ConnectionDecorator conChildDecorator : conChild
+ .getConnectionDecorators()) {
+ conChildDecorator.setVisible(!hideChildren);
+ conChildDecorator.getGraphicsAlgorithm()
+ .setTransparency(
+ hideChildren ? 1.0 : 0.0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Hide connections of children, unhide connections only if the child
+ // element is visible
+ if (s instanceof ContainerShape) {
+ for (Shape childShape : ((ContainerShape) s).getChildren()) {
+ if (hideChildren || childShape.isVisible())
+ this.hideContainedConnections(childShape, hideChildren);
+ }
+ }
+
+ }
+
+ // private boolean isWriteTransaction(TransactionalEditingDomain domain){
+ // if(domain instanceof TransactionalEditingDomainImpl)
+ // return !((TransactionalEditingDomainImpl)
+ // domain).getActiveTransaction().isReadOnly();
+ // else
+ // return true;
+ // }
+ //
+ // private TransactionalEditingDomain getEditingDomain(){
+ // IWorkbenchPart activePart = PlatformUI.getWorkbench()
+ // .getActiveWorkbenchWindow().getActivePage().getActivePart();
+ //
+ // IEditingDomainProvider provider = (IEditingDomainProvider) activePart
+ // .getAdapter(IEditingDomainProvider.class);
+ // assert provider.getEditingDomain() instanceof TransactionalEditingDomain;
+ // return (TransactionalEditingDomain) provider.getEditingDomain();
+ // }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#getContainedWidth(org.
+ * eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public int getContainedWidth(ContainerShape cs) {
+ int result = 0;
+ for (Shape child : this.getContainedShapes(cs)) {
+ if (child.isVisible())
+ result = Math.max(result, child.getGraphicsAlgorithm().getX()
+ + child.getGraphicsAlgorithm().getWidth());
+ }
+ if (result == 0)
+ return this.getDefaultWidth();
+ return result + CONTAINER_MARGIN;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ContainerNode#getContainedHeight(org
+ * .eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public int getContainedHeight(ContainerShape cs) {
+ int result = 0;
+ for (Shape child : this.getContainedShapes(cs)) {
+ if (child.isVisible())
+ result = Math.max(result, child.getGraphicsAlgorithm().getY()
+ + child.getGraphicsAlgorithm().getHeight());
+ }
+ if (result == 0)
+ return this.getDefaultHeight();
+ return result + CONTAINER_MARGIN;
+ }
+
+ // ----------------------------------------
+ // ----------- Named Node -----------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.NamedNode#getText(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public MultiText getText(GraphicsAlgorithm graphicsAlgorithm) {
+ ContainerShape container = this.getContainerShape(graphicsAlgorithm);
+ for (Shape child : container.getChildren()) {
+ if (child.getGraphicsAlgorithm() instanceof MultiText) {
+ return (MultiText) child.getGraphicsAlgorithm();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.NamedNode#setTextMargin(int)
+ */
+ public void setTextMargin(int margin) {
+ this.textMargin = margin;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractPolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractPolygonAlgorithm.java
new file mode 100644
index 0000000..7fbd15c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractPolygonAlgorithm.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * This abstract class is the super class for all polygon algorithms and
+ * provides common methods for them. For example, there is a general rotate
+ * method and a standard resize method.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class AbstractPolygonAlgorithm extends AbstractNode implements
+ PolygonAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#createGraphics(org.eclipse
+ * .graphiti.mm.pictograms.Diagram,
+ * org.eclipse.graphiti.mm.GraphicsAlgorithmContainer, int, int, int, int)
+ */
+ public Polygon createGraphics(Diagram diagram,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height) {
+
+ // Create polygon
+ Polygon polygon = ga.createPolygon(container,
+ this.getInitialPoints(0, 0, width, height));
+ ga.setLocationAndSize(polygon, x, y, width, height);
+ polygon.setLineWidth(3);
+ polygon.setTransparency(null);
+ polygon.setStyle(StyleUtil.getStyle(diagram, StyleUtil.SHAPE));
+
+ // Create anchors
+ if (container instanceof GraphicsAlgorithm) {
+ ContainerShape containerShape = this.getContainerShape(polygon);
+ pe.createChopboxAnchor(containerShape);
+ createBoxAnchorSet(containerShape);
+ }
+ return polygon;
+ }
+
+ // ----------------------------------------
+ // ----------- Polygon Impl ---------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.PolygonAlgorithm#hasRoundedCorners()
+ */
+ public boolean hasRoundedCorners() {
+ return false;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#synchronizeFirstLevelShape
+ * (org.eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public void synchronizeFirstLevelShape(ContainerShape firstLevelContainer) {
+ Polygon firstLevelPolygon = (Polygon) firstLevelContainer
+ .getGraphicsAlgorithm();
+ Polygon secondLevelPolygon;
+ if (isMultipleInstances(firstLevelContainer))
+ secondLevelPolygon = (Polygon) getMultiInstanceChild(
+ firstLevelContainer, true);
+ else
+ secondLevelPolygon = (Polygon) firstLevelPolygon
+ .getGraphicsAlgorithmChildren().get(0);
+ int w = firstLevelPolygon.getWidth();
+ int h = firstLevelPolygon.getHeight();
+
+ int i = 0;
+ Point firstLevelPoint;
+ for (Point secondLevelPoint : secondLevelPolygon.getPoints()) {
+ firstLevelPoint = firstLevelPolygon.getPoints().get(i++);
+
+ // ensure that invisible first level shape has maximum width
+ if (secondLevelPoint.getX() != (w - MultipleNode.MULTI_INSTANCE_GAP))
+ firstLevelPoint.setX(secondLevelPoint.getX());
+ else
+ firstLevelPoint.setX(w);
+
+ // ensure that invisible first level shape has maximum height
+ if (secondLevelPoint.getY() != (h - MultipleNode.MULTI_INSTANCE_GAP))
+ firstLevelPoint.setY(secondLevelPoint.getY());
+ else
+ firstLevelPoint.setY(h);
+
+ firstLevelPoint.setAfter(secondLevelPoint.getAfter());
+ firstLevelPoint.setBefore(secondLevelPoint.getBefore());
+ }
+ }
+
+ // ----------------------------------------
+ // ----------- Rotatable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#rotate90Right(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void rotate90Right(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+ polygon.setX(polygon.getX()
+ + (polygon.getWidth() - polygon.getHeight()) / 2);
+ polygon.setY(polygon.getY()
+ - (polygon.getWidth() - polygon.getHeight()) / 2);
+ doRotate(polygon);
+ }
+
+ private void doRotate(Polygon polygon) {
+ // Rotate graphicsAlgorithm
+ int oldWidth = polygon.getWidth();
+ int oldHeight = polygon.getHeight();
+ int oldX, oldY;
+ for (Point point : polygon.getPoints()) {
+ oldX = point.getX();
+ oldY = point.getY();
+ point.setX(oldHeight - oldY);
+ point.setY(oldX);
+ }
+
+ // Adapt the size of graphicsAlgorithm
+ polygon.setHeight(oldWidth);
+ polygon.setWidth(oldHeight);
+
+ // Relocate the text shape of the polygon
+ relocateText(polygon);
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = polygon
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Flip polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.doRotate((Polygon) graphicsAlgorithmChildren.get(i));
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(polygon));
+ }
+
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipHorizontally(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipHorizontally(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+
+ // Flip graphicsAlgorithm
+ int width = polygon.getWidth();
+ for (Point point : polygon.getPoints()) {
+ point.setX(width - point.getX());
+ }
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = graphicsAlgorithm
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Flip polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.flipHorizontally(graphicsAlgorithmChildren.get(i));
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(graphicsAlgorithm));
+ }
+
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipVertically(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipVertically(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+
+ // Flip graphicsAlgorithm
+ int height = polygon.getHeight();
+ for (Point point : polygon.getPoints()) {
+ point.setY(height - point.getY());
+ }
+
+ // Relocate the text shape of the polygon
+ relocateText(polygon);
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = graphicsAlgorithm
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Flip polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.flipVertically(graphicsAlgorithmChildren.get(i));
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(graphicsAlgorithm));
+ }
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.ResizableNode#resize(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm, int, int, int, int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+
+ ga.setLocationAndSize(algorithm, x, y, width, height);
+ ContainerShape container = this.getContainerShape(algorithm);
+ resizeBoxAnchorSet(container, x, y, width, height);
+ }
+
+ // ----------------------------------------
+ // ----------- Multiple Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#
+ * synchronizeMultiInstanceChildren
+ * (org.eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public void synchronizeMultiInstanceChildren(
+ ContainerShape firstLevelContainer) {
+ if (isMultipleInstances(firstLevelContainer)) {
+ GraphicsAlgorithm foregroundGa = getMultiInstanceChild(
+ firstLevelContainer, true);
+ GraphicsAlgorithm backgroundGa = getMultiInstanceChild(
+ firstLevelContainer, false);
+
+ if (foregroundGa != null && backgroundGa != null) {
+ if (foregroundGa instanceof Polygon) {
+ Polygon foregroundPolygon = (Polygon) foregroundGa;
+ Polygon backgroundPolygon = (Polygon) backgroundGa;
+ int i = 0;
+ Point backgroundPoint;
+ for (Point mainPoint : foregroundPolygon.getPoints()) {
+ backgroundPoint = backgroundPolygon.getPoints()
+ .get(i++);
+ backgroundPoint.setX(mainPoint.getX());
+ backgroundPoint.setY(mainPoint.getY());
+ backgroundPoint.setAfter(mainPoint.getAfter());
+ backgroundPoint.setBefore(mainPoint.getBefore());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractRectangleAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractRectangleAlgorithm.java
new file mode 100644
index 0000000..cd0dcac
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractRectangleAlgorithm.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+
+/**
+ * This abstract class is the super class for all rectangle algorithms and
+ * provides common methods for them. For example, there is a general rotate
+ * method.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class AbstractRectangleAlgorithm extends AbstractNode implements
+ RectangleAlgorithm, RotatableNode {
+
+ // ----------------------------------------
+ // ----------- Named Node -----------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.NamedNode#relocateText(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public void relocateText(GraphicsAlgorithm graphicsAlgorithm) {
+ MultiText text = this.getText(graphicsAlgorithm);
+ if (text != null) {
+ int multipleOffset = 0;
+ if (this.isMultipleInstances(this
+ .getContainerShape(graphicsAlgorithm))) {
+ multipleOffset = MULTI_INSTANCE_GAP;
+ }
+ int x = super.textMargin;
+ int width = graphicsAlgorithm.getWidth() - 2 * super.textMargin
+ - multipleOffset;
+ int y = super.textMargin + multipleOffset;
+ int height = graphicsAlgorithm.getHeight() - 2 * super.textMargin
+ - multipleOffset;
+
+ ga.setLocationAndSize(text, x, y, width, height);
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#getAngle(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public int getAngle(GraphicsAlgorithm graphicsAlgorithm) {
+ return 0;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#isFlipped(org.eclipse.
+ * graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public boolean isFlipped(GraphicsAlgorithm graphicsAlgorithm) {
+ return false;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#rotate90Right(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void rotate90Right(GraphicsAlgorithm graphicsAlgorithm) {
+ translateForRotation(graphicsAlgorithm);
+ doRotate(graphicsAlgorithm);
+ relocateText(graphicsAlgorithm);
+ for (GraphicsAlgorithm algorithm : graphicsAlgorithm
+ .getGraphicsAlgorithmChildren()) {
+ doRotate(algorithm);
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipHorizontally(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipHorizontally(GraphicsAlgorithm graphicsAlgorithm) {
+
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RotatableNode#flipVertically(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm)
+ */
+ public void flipVertically(GraphicsAlgorithm graphicsAlgorithm) {
+ }
+
+ /**
+ * Moves algorithm to the point to simulate rotation around center.
+ *
+ * @param graphicsAlgorithm
+ * Algorithm to translate.
+ */
+ protected void translateForRotation(GraphicsAlgorithm graphicsAlgorithm) {
+ graphicsAlgorithm
+ .setX(graphicsAlgorithm.getX()
+ + (graphicsAlgorithm.getWidth() - graphicsAlgorithm
+ .getHeight()) / 2);
+ graphicsAlgorithm
+ .setY(graphicsAlgorithm.getY()
+ - (graphicsAlgorithm.getWidth() - graphicsAlgorithm
+ .getHeight()) / 2);
+ }
+
+ /**
+ * Rotates algorithm by simply switching width and height.
+ *
+ * @param graphicsAlgorithm
+ * Algorithm to rotate.
+ */
+ protected void doRotate(GraphicsAlgorithm graphicsAlgorithm) {
+ int width = graphicsAlgorithm.getWidth();
+ graphicsAlgorithm.setWidth(graphicsAlgorithm.getHeight());
+ graphicsAlgorithm.setHeight(width);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractUPolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractUPolygonAlgorithm.java
new file mode 100644
index 0000000..72ff48a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AbstractUPolygonAlgorithm.java
@@ -0,0 +1,810 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This abstract class collects all methods common to U-shaped polygons.
+ *
+ * 07 43 xx xx x6xx5x 1xxxx2
+ *
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class AbstractUPolygonAlgorithm extends
+ AbstractLPolygonAlgorithm implements UPolygonAlgorithm {
+
+ // ----------------------------------------
+ // ----------- (U)Polygon Impl ------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractLPolygonAlgorithm#getInitialPoints
+ * (int, int, int, int)
+ */
+ public List<Point> getInitialPoints(int x, int y, int width, int height) {
+ int outerCornerSize = hasRoundedCorners() ? L_PART_DEFAULT_SIZE / 2 : 0;
+ int innerCornerSize = hasRoundedCorners() ? outerCornerSize * 2 / 3 : 0;
+ List<Point> points = new ArrayList<Point>();
+
+ /* 0 */points.add(ga
+ .createPoint(x, y, outerCornerSize, outerCornerSize));
+ /* 1 */points.add(ga.createPoint(x, y + height, outerCornerSize,
+ outerCornerSize));
+ /* 2 */points.add(ga.createPoint(x + width, y + height,
+ outerCornerSize, outerCornerSize));
+ /* 3 */points.add(ga.createPoint(x + width, y, outerCornerSize,
+ outerCornerSize));
+ /* 4 */points.add(ga.createPoint(x + width - L_PART_DEFAULT_SIZE, y,
+ outerCornerSize, outerCornerSize));
+ /* 5 */points.add(ga.createPoint(x + width - L_PART_DEFAULT_SIZE, y
+ + height - L_PART_DEFAULT_SIZE, innerCornerSize,
+ innerCornerSize));
+ /* 6 */points.add(ga.createPoint(x + L_PART_DEFAULT_SIZE, y + height
+ - L_PART_DEFAULT_SIZE, innerCornerSize, innerCornerSize));
+ /* 7 */points.add(ga.createPoint(x + L_PART_DEFAULT_SIZE, y,
+ outerCornerSize, outerCornerSize));
+
+ return points;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.polygon.UPolygonAlgorithm#resizeLeftPart(
+ * org.eclipse.graphiti.mm.algorithms.Polygon, int)
+ */
+ public void resizeLeftPart(Polygon polygon, int size) {
+ int oldSize = getLeftPartSize(polygon);
+ int sizeDif = size - oldSize;
+ EList<Point> points = polygon.getPoints();
+ if (sizeDif != 0) {
+ switch (getAngle(polygon)) {
+ case 90:
+ points.get(6).setY(points.get(6).getY() + sizeDif);
+ points.get(7).setY(points.get(7).getY() + sizeDif);
+ break;
+ case 180:
+ points.get(6).setX(points.get(6).getX() - sizeDif);
+ points.get(7).setX(points.get(7).getX() - sizeDif);
+ break;
+ case 270:
+ points.get(6).setY(points.get(6).getY() - sizeDif);
+ points.get(7).setY(points.get(7).getY() - sizeDif);
+ break;
+ default:
+ points.get(6).setX(points.get(6).getX() + sizeDif);
+ points.get(7).setX(points.get(7).getX() + sizeDif);
+ }
+ }
+
+ // adapt corner roundings if polygon has rounded corners
+ if (hasRoundedCorners()) {
+ int leftTopCornerSize = getLeftPartTopCornerSize(polygon);
+ int leftBottomCornerSize = getLeftPartBottomCornerSize(polygon);
+
+ points.get(0).setBefore(leftTopCornerSize);
+ points.get(0).setAfter(leftTopCornerSize);
+ points.get(1).setBefore(leftBottomCornerSize);
+ points.get(6).setAfter(leftBottomCornerSize);
+ points.get(7).setBefore(leftTopCornerSize);
+ points.get(7).setAfter(leftTopCornerSize);
+ }
+
+ relocateText(polygon);
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = polygon
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Resize left part of polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.resizeLeftPart((Polygon) graphicsAlgorithmChildren.get(i),
+ size);
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(polygon));
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.polygon.UPolygonAlgorithm#getLeftPartSize
+ * (org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getLeftPartSize(Polygon polygon) {
+ EList<Point> points = polygon.getPoints();
+ if (isFlattened(polygon))
+ return Math.abs(points.get(7).getY() - points.get(0).getY());
+ else
+ return Math.abs(points.get(7).getX() - points.get(0).getX());
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.LPolygonAlgorithm#
+ * resizeBottomPart(org.eclipse.graphiti.mm.algorithms.Polygon, int)
+ */
+ public void resizeBottomPart(Polygon polygon, int size) {
+ int oldSize = getBottomPartSize(polygon);
+ int sizeDif = isFlipped(polygon) ? oldSize - size : size - oldSize;
+ EList<Point> points = polygon.getPoints();
+ if (sizeDif != 0) {
+ switch (getAngle(polygon)) {
+ case 90:
+ points.get(6).setX(points.get(6).getX() + sizeDif);
+ points.get(5).setX(points.get(5).getX() + sizeDif);
+ break;
+ case 180:
+ points.get(6).setY(points.get(6).getY() + sizeDif);
+ points.get(5).setY(points.get(5).getY() + sizeDif);
+ break;
+ case 270:
+ points.get(6).setX(points.get(6).getX() - sizeDif);
+ points.get(5).setX(points.get(5).getX() - sizeDif);
+ break;
+ default:
+ points.get(6).setY(points.get(6).getY() - sizeDif);
+ points.get(5).setY(points.get(5).getY() - sizeDif);
+ }
+ }
+
+ // adapt corner roundings if polygon has rounded corners
+ if (hasRoundedCorners()) {
+ int bottomLeftCornerSize = getBottomPartLeftCornerSize(polygon);
+ int bottomRightCornerSize = getBottomPartRightCornerSize(polygon);
+
+ points.get(1).setAfter(bottomLeftCornerSize);
+ points.get(2).setBefore(bottomRightCornerSize);
+ points.get(5).setAfter(bottomRightCornerSize);
+ points.get(6).setBefore(bottomLeftCornerSize);
+ }
+
+ relocateText(polygon);
+
+ EList<GraphicsAlgorithm> graphicsAlgorithmChildren = polygon
+ .getGraphicsAlgorithmChildren();
+ for (int i = 0; i < graphicsAlgorithmChildren.size(); i++) {
+ // Resize bottom part of polygon children
+ if (graphicsAlgorithmChildren.get(i) instanceof Polygon)
+ this.resizeBottomPart(
+ (Polygon) graphicsAlgorithmChildren.get(i), size);
+
+ // Update relative anchors when the ga modification is done
+ if (i == graphicsAlgorithmChildren.size() - 1)
+ createBoxAnchorSet(this.getContainerShape(polygon));
+ }
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.UPolygonAlgorithm#getLeftPartTopCornerSize
+ * (org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getLeftPartTopCornerSize(Polygon polygon) {
+ return getLeftPartSize(polygon) / 2;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.UPolygonAlgorithm#
+ * getLeftPartBottomCornerSize(org.eclipse.graphiti.mm.algorithms.Polygon)
+ */
+ public int getLeftPartBottomCornerSize(Polygon polygon) {
+ return getLeftPartTopCornerSize(polygon);
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractLPolygonAlgorithm#resize(org
+ * .eclipse.graphiti.mm.algorithms.GraphicsAlgorithm, int, int, int, int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+ Polygon polygon = (Polygon) algorithm;
+ int angle = getAngle(polygon);
+ int[] resizeX = new int[4];
+ int[] resizeY = new int[4];
+ if (isFlipped(polygon)) {
+ switch (angle) {
+ case 90:
+ resizeX[0] = 1;
+ resizeX[1] = 2;
+ resizeX[2] = 5;
+ resizeX[3] = 6;
+ resizeY[0] = 2;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 5;
+ break;
+ case 180:
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeX[2] = 6;
+ resizeX[3] = 7;
+ resizeY[0] = 1;
+ resizeY[1] = 2;
+ resizeY[2] = 5;
+ resizeY[3] = 6;
+ break;
+ case 270:
+ resizeX[0] = 0;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 7;
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ resizeY[2] = 6;
+ resizeY[3] = 7;
+ break;
+ default:
+ resizeX[0] = 2;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 5;
+ resizeY[0] = 0;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 7;
+ }
+ } else {
+ switch (angle) {
+ case 90:
+ resizeX[0] = 0;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 7;
+ resizeY[0] = 2;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 5;
+ break;
+ case 180:
+ resizeX[0] = 0;
+ resizeX[1] = 1;
+ resizeX[2] = 6;
+ resizeX[3] = 7;
+ resizeY[0] = 0;
+ resizeY[1] = 3;
+ resizeY[2] = 4;
+ resizeY[3] = 7;
+ break;
+ case 270:
+ resizeX[0] = 1;
+ resizeX[1] = 2;
+ resizeX[2] = 5;
+ resizeX[3] = 6;
+ resizeY[0] = 0;
+ resizeY[1] = 1;
+ resizeY[2] = 6;
+ resizeY[3] = 7;
+ break;
+ default:
+ resizeX[0] = 2;
+ resizeX[1] = 3;
+ resizeX[2] = 4;
+ resizeX[3] = 5;
+ resizeY[0] = 1;
+ resizeY[1] = 2;
+ resizeY[2] = 5;
+ resizeY[3] = 6;
+ }
+ }
+
+ int oldHeight = polygon.getHeight();
+ int oldWidth = polygon.getWidth();
+ int heightDif = height - oldHeight;
+ int widthDif = width - oldWidth;
+
+ EList<Point> points = polygon.getPoints();
+ for (int i = 0; i < resizeX.length; i++) {
+ points.get(resizeX[i]).setX(
+ points.get(resizeX[i]).getX() + widthDif);
+ }
+ for (int i = 0; i < resizeY.length; i++) {
+ points.get(resizeY[i]).setY(
+ points.get(resizeY[i]).getY() + heightDif);
+ }
+
+ // adapt corner roundings if polygon has rounded corners
+ if (hasRoundedCorners()) {
+ int leftTopCornerSize = getLeftPartTopCornerSize(polygon);
+ int leftBottomCornerSize = getLeftPartBottomCornerSize(polygon);
+ int rightTopCornerSize = getRightPartTopCornerSize(polygon);
+ int rightBottomCornerSize = getRightPartBottomCornerSize(polygon);
+ int bottomLeftCornerSize = getBottomPartLeftCornerSize(polygon);
+ int bottomRightCornerSize = getBottomPartRightCornerSize(polygon);
+
+ points.get(0).setBefore(leftTopCornerSize);
+ points.get(0).setAfter(leftTopCornerSize);
+ points.get(1).setBefore(leftBottomCornerSize);
+ points.get(1).setAfter(bottomLeftCornerSize);
+ points.get(2).setBefore(bottomRightCornerSize);
+ points.get(2).setAfter(rightBottomCornerSize);
+ points.get(3).setBefore(rightTopCornerSize);
+ points.get(3).setAfter(rightTopCornerSize);
+ points.get(4).setBefore(rightTopCornerSize);
+ points.get(4).setAfter(rightTopCornerSize);
+ points.get(5).setBefore(rightBottomCornerSize);
+ points.get(5).setAfter(bottomRightCornerSize);
+ points.get(6).setBefore(bottomLeftCornerSize);
+ points.get(6).setAfter(leftBottomCornerSize);
+ points.get(7).setBefore(leftTopCornerSize);
+ points.get(7).setAfter(leftTopCornerSize);
+ }
+
+ ga.setLocationAndSize(polygon, x, y, width, height);
+
+ relocateText(polygon);
+
+ // adapt first level container (relative anchors + invisible shape)
+ ContainerShape container = this.getContainerShape(polygon);
+ createBoxAnchorSet(container);
+ synchronizeFirstLevelShape(container);
+ }
+
+ // ----------------------------------------
+ // ----------- Named Node -----------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.NamedNode#relocateText(org.eclipse.graphiti
+ * .mm.algorithms.GraphicsAlgorithm)
+ */
+ public void relocateText(GraphicsAlgorithm graphicsAlgorithm) {
+ Polygon polygon = (Polygon) graphicsAlgorithm;
+ MultiText text = this.getText(graphicsAlgorithm);
+ if (text != null) {
+ int multipleOffset = 0;
+ if (this.isMultipleInstances(this
+ .getContainerShape(graphicsAlgorithm))) {
+ multipleOffset = MULTI_INSTANCE_GAP;
+ }
+ int angle = getAngle(graphicsAlgorithm);
+ int textContainingPartSize;
+ boolean isOnTop = false;
+ switch (angle) {
+ case 90:
+ textContainingPartSize = getRightPartSize(polygon);
+ break;
+ case 270:
+ textContainingPartSize = getLeftPartSize(polygon);
+ break;
+ default:
+ textContainingPartSize = getBottomPartSize(polygon);
+ }
+ if ((isFlipped(graphicsAlgorithm) && angle == 0)
+ || (!isFlipped(graphicsAlgorithm) && angle == 180)) {
+ isOnTop = true;
+ }
+
+ int x = super.textMargin;
+ int width = graphicsAlgorithm.getWidth() - 2 * super.textMargin
+ - multipleOffset;
+ int y = (isOnTop ? super.textMargin : graphicsAlgorithm.getHeight()
+ - textContainingPartSize + super.textMargin)
+ + multipleOffset;
+ int height = textContainingPartSize - 2 * super.textMargin
+ - multipleOffset;
+
+ ga.setLocationAndSize(text, x, y, width, height);
+ }
+ }
+
+ // ----------------------------------------
+ // ----------- Anchored Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractLPolygonAlgorithm#addBoxAnchorSet
+ * (org.eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ protected void addBoxAnchorSet(Shape shape) {
+
+ GraphicsAlgorithm firstLevelPolygon = shape.getGraphicsAlgorithm();
+ Polygon secondLevelPolygon = (Polygon) firstLevelPolygon
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // Sides of the polygon:
+ // 7 3
+ // --- ---
+ // | | | |
+ // | | 6 4 | |
+ // 0 | | 5 | | 2
+ // | ------- |
+ // | |
+ // ---------------
+ // 1
+ int numSides = 8;
+ int lineWidth = getDefaultLineWidth();
+ Point[] point = new Point[numSides];
+ for (int i = 0; i < point.length; i++) {
+ point[i] = secondLevelPolygon.getPoints().get(i);
+ }
+
+ // Offset in case of a multi instance shape (adapt anchors when drawing
+ // background part)
+ double offsetMultiInstance = 0.0d;
+ if (firstLevelPolygon.getWidth() != secondLevelPolygon.getWidth()) {
+ // Remove anchors created when drawing the main part
+ FMCUtil.removeObsoleteAnchors(shape);
+ offsetMultiInstance = MULTI_INSTANCE_GAP;
+ }
+
+ // Length of the sides (not taking into account rounded corners)
+ int[] length = new int[numSides];
+ length[0] = Math.abs(isFlattened(secondLevelPolygon) ? point[2].getX()
+ - point[3].getX() : point[2].getY() - point[3].getY());
+ length[1] = Math.abs(isFlattened(secondLevelPolygon) ? point[1].getY()
+ - point[2].getY() : point[1].getX() - point[2].getX());
+ length[2] = length[0];
+ length[3] = getRightPartSize(secondLevelPolygon) + lineWidth;
+ length[4] = length[2] - getBottomPartSize(secondLevelPolygon);
+ length[6] = length[4];
+ length[7] = getLeftPartSize(secondLevelPolygon) + lineWidth;
+ length[5] = length[1] - length[7] - length[3];
+
+ // Length of the sides that should contain anchors
+ int[] anchoredLength = new int[numSides];
+ for (int i = 0; i < numSides; i++)
+ anchoredLength[i] = Math.max(length[i] - point[i].getAfter()
+ - point[(i + 1) % numSides].getBefore(),
+ DEFAULT_ANCHOR_DIAMETER);
+
+ // Number of anchors of the sides
+ int[] numAnchors = new int[numSides];
+
+ // Gaps between the anchor starting points of the sides (in x and y
+ // direction)
+ double[][] gaps = new double[numSides][2];
+ for (int i = 0; i < gaps.length; i++)
+ for (int j = 0; j < gaps[i].length; j++)
+ gaps[i][j] = 0.0d;
+
+ // Offsets of the starting points of the sides (in x and y direction)
+ double[][] offset = new double[numSides][2];
+ switch (getAngle(secondLevelPolygon)) {
+ case 90:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = offsetMultiInstance;
+ offset[1][1] = 0.0d;
+ offset[1][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[7] + length[5] + offsetMultiInstance;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[7] + length[5];
+ offset[4][0] = offsetMultiInstance;
+ offset[5][1] = length[7] + offsetMultiInstance;
+ offset[5][0] = length[4] - lineWidth;
+ offset[6][1] = length[7] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[6][0] = 0.0d;
+ offset[7][1] = offsetMultiInstance;
+ offset[7][0] = 0.0d;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[4].getAfter())
+ anchoredLength[4] = anchoredLength[4]
+ - (int) Math.abs((offsetMultiInstance - point[4]
+ .getAfter()));
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = offsetMultiInstance;
+ offset[1][1] = offsetMultiInstance;
+ offset[1][0] = 0.0d;
+ offset[2][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[7] + length[5];
+ offset[3][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][1] = length[7] + length[5];
+ offset[4][0] = length[0] - length[4] + offsetMultiInstance;
+ offset[5][1] = length[7];
+ offset[5][0] = length[0] - length[4] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER + lineWidth;
+ offset[6][1] = length[7] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[6][0] = length[0] - length[4] + offsetMultiInstance; // overlapping
+ offset[7][1] = 0.0d;
+ offset[7][0] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[6].getAfter())
+ anchoredLength[6] = anchoredLength[6]
+ - (int) Math.abs((offsetMultiInstance - point[6]
+ .getAfter()));
+ }
+ break;
+ case 180:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][0] = 0.0d;
+ offset[2][1] = offsetMultiInstance;
+ offset[2][0] = 0.0d;
+ offset[3][1] = 0.0d;
+ offset[3][0] = offsetMultiInstance;
+ offset[4][1] = 0.0d;
+ offset[4][0] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][1] = length[4] - lineWidth;
+ offset[5][0] = length[3] + offsetMultiInstance;
+ offset[6][1] = offsetMultiInstance;
+ offset[6][0] = length[3] + length[5];
+ offset[7][1] = 0.0d;
+ offset[7][0] = length[3] + length[5] + offsetMultiInstance;
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = 0.0d;
+ offset[0][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][1] = 0.0d;
+ offset[1][0] = offsetMultiInstance;
+ offset[2][1] = offsetMultiInstance;
+ offset[2][0] = 0.0d;
+ offset[3][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[0] - length[4] + offsetMultiInstance;
+ offset[4][0] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[5][1] = length[0] - length[4] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER + lineWidth;
+ offset[5][0] = length[3] + offsetMultiInstance;
+ offset[6][1] = length[0] - length[4] + offsetMultiInstance;
+ offset[6][0] = length[3] + length[5];
+ offset[7][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[7][0] = length[3] + length[5];
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[4].getAfter())
+ anchoredLength[4] = anchoredLength[4]
+ - (int) Math.abs((offsetMultiInstance - point[4]
+ .getAfter()));
+ }
+ break;
+ case 270:
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[0][0] = 0.0d;
+ offset[1][1] = offsetMultiInstance;
+ offset[1][0] = 0.0d;
+ offset[2][1] = 0.0d;
+ offset[2][0] = offsetMultiInstance;
+ offset[3][1] = 0.0d;
+ offset[3][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][1] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][0] = length[0] - length[4] + offsetMultiInstance;
+ offset[5][1] = length[3] + offsetMultiInstance;
+ offset[5][0] = length[0] - length[4] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER + lineWidth;
+ offset[6][1] = length[3] + length[5];
+ offset[6][0] = length[0] - length[4] + offsetMultiInstance;
+ offset[7][1] = length[3] + length[5];
+ offset[7][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[4].getAfter())
+ anchoredLength[4] = anchoredLength[4]
+ - (int) Math.abs((offsetMultiInstance - point[4]
+ .getAfter()));
+ if (offsetMultiInstance > point[5].getAfter())
+ anchoredLength[5] = anchoredLength[5]
+ - (int) Math.abs((offsetMultiInstance - point[5]
+ .getAfter()));
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[0][0] = 0.0d;
+ offset[1][1] = 0.0d;
+ offset[1][0] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[2][1] = 0.0d;
+ offset[2][0] = offsetMultiInstance;
+ offset[3][1] = offsetMultiInstance;
+ offset[3][0] = 0.0d;
+ offset[4][1] = length[3] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[4][0] = 0.0d;
+ offset[5][1] = length[3] + offsetMultiInstance;
+ offset[5][0] = length[4] - lineWidth;
+ offset[6][1] = length[3] + length[5];
+ offset[6][0] = offsetMultiInstance;
+ offset[7][1] = length[3] + length[5] + offsetMultiInstance;
+ offset[7][0] = 0.0d;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[6].getAfter())
+ anchoredLength[6] = anchoredLength[6]
+ - (int) Math.abs((offsetMultiInstance - point[6]
+ .getAfter()));
+ }
+ break;
+ default: // rotation = 0
+ if (isFlipped(secondLevelPolygon)) {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = offsetMultiInstance;
+ offset[0][0] = 0.0d;
+ offset[1][1] = 0.0d;
+ offset[1][0] = offsetMultiInstance;
+ offset[2][1] = 0.0d;
+ offset[2][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][0] = length[7] + length[5];
+ offset[4][1] = length[0] - length[4] + offsetMultiInstance;
+ offset[4][0] = length[7] + length[5];
+ offset[5][1] = length[0] - length[4] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER + lineWidth;
+ offset[5][0] = length[7];
+ offset[6][1] = length[0] - length[4] + offsetMultiInstance;
+ offset[6][0] = length[7] - DEFAULT_ANCHOR_DIAMETER
+ + offsetMultiInstance; // overlapping
+ offset[7][1] = length[0] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[7][0] = 0.0d;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[6].getAfter())
+ anchoredLength[6] = anchoredLength[6]
+ - (int) (offsetMultiInstance - point[6].getAfter());
+ } else {
+ // specify relative starting points of polygon line segments
+ offset[0][1] = offsetMultiInstance;
+ offset[0][0] = 0.0d;
+ offset[1][1] = length[2] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[1][0] = 0.0d;
+ offset[2][1] = 0.0d;
+ offset[2][0] = length[1] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[3][1] = 0.0d;
+ offset[3][0] = length[7] + length[5] + offsetMultiInstance;
+ offset[4][1] = offsetMultiInstance;
+ offset[4][0] = length[7] + length[5];
+ offset[5][1] = length[4] - lineWidth;
+ offset[5][0] = length[7] + offsetMultiInstance;
+ offset[6][1] = 0.0d;
+ offset[6][0] = length[7] + offsetMultiInstance
+ - DEFAULT_ANCHOR_DIAMETER;
+ offset[7][1] = 0.0d;
+ offset[7][0] = offsetMultiInstance;
+
+ // adjust length of segments due to overlapping of multi
+ // instances
+ if (offsetMultiInstance > point[5].getAfter())
+ anchoredLength[5] = anchoredLength[5]
+ - (int) (offsetMultiInstance - point[5].getAfter());
+ }
+ }
+
+ // adjust offsets according to rounded corners
+ for (int i = 0; i < numSides; i++) {
+ if (point[i].getX() == point[(i + 1) % numSides].getX()) { // vertical
+ // side
+ offset[i][1] = offset[i][1]
+ + (point[i].getY() < point[(i + 1) % numSides].getY() ? (point[i]
+ .getAfter() > 0 ? point[i].getAfter()
+ - ((double) DEFAULT_ANCHOR_DIAMETER) / 2 : 0.0d)
+ : (point[(i + 1) % numSides].getBefore() > 0 ? point[(i + 1)
+ % numSides].getBefore()
+ - ((double) DEFAULT_ANCHOR_DIAMETER)
+ / 2
+ : 0.0d));
+ } else { // horizontal side
+ offset[i][0] = offset[i][0]
+ + (point[i].getX() < point[(i + 1) % numSides].getX() ? (point[i]
+ .getAfter() > 0 ? point[i].getAfter()
+ - ((double) DEFAULT_ANCHOR_DIAMETER) / 2 : 0.0d)
+ : (point[(i + 1) % numSides].getBefore() > 0 ? point[(i + 1)
+ % numSides].getBefore()
+ - ((double) DEFAULT_ANCHOR_DIAMETER)
+ / 2
+ : 0.0d));
+ }
+ }
+
+ // Calculate number of anchors per side
+ for (int i = 0; i < numSides; i++)
+ numAnchors[i] = anchoredLength[i] / DEFAULT_ANCHOR_GAP;
+
+ // Calculate gaps between the starting points of the anchors for each
+ // side
+ int direction = 0;
+ for (int i = 0; i < numSides; i++) {
+ direction = isFlattened(secondLevelPolygon) ? (i % 2)
+ : ((i + 1) % 2);
+ gaps[i][direction] = ((double) anchoredLength[i]) / numAnchors[i];
+ }
+
+ // Create relative box anchors
+ for (int i = 0; i < numSides; i++)
+ for (int j = 0; j < numAnchors[i]; j++)
+ createBoxAnchor(shape, (offset[i][0] + j * gaps[i][0])
+ / firstLevelPolygon.getWidth(), (offset[i][1] + j
+ * gaps[i][1])
+ / firstLevelPolygon.getHeight(),
+ AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AgentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AgentAlgorithm.java
new file mode 100644
index 0000000..f6a1500
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AgentAlgorithm.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This is the interface for all agent algorithms.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public interface AgentAlgorithm extends FMCNodeAlgorithm {
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AnchoredNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AnchoredNode.java
new file mode 100644
index 0000000..1a23306
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/AnchoredNode.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This is the interface for all nodes with anchors.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface AnchoredNode extends GraphicsNode {
+
+ public static final int DEFAULT_ANCHOR_GAP = 8; // 20;
+ public static final int DEFAULT_ANCHOR_DIAMETER = 8;
+
+ /**
+ *
+ * @param container
+ * @param visible
+ */
+ public void setBoxAnchorsVisible(Shape shape, boolean visible);
+
+ /**
+ *
+ * @param shape
+ * @return
+ */
+ public boolean isBoxAnchorsVisible(Shape shape);
+
+ /**
+ *
+ * @param shape
+ * @return
+ */
+ public boolean hasUnusedAnchors(Shape shape);
+
+ /**
+ * Resizes the anchor set of the container according to the given
+ * parameters.
+ *
+ * @param container
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ */
+ public void resizeBoxAnchorSet(ContainerShape container, int x, int y,
+ int width, int height);
+
+ /**
+ * Creates an anchor set for the shape.
+ *
+ * @param shape
+ */
+ public void createBoxAnchorSet(Shape shape);
+
+ /**
+ * Removes the anchor set for the shape. Only removes anchors which have no
+ * connection lines.
+ *
+ * @param shape
+ */
+ public void removeUnusedBoxAnchors(Shape shape);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ContainerNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ContainerNode.java
new file mode 100644
index 0000000..1616d46
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ContainerNode.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This is the interface for all nodes potentially containing other nodes. The
+ * graphical representation of the node is constructed as an invisible graphics
+ * algorithm with potentially multiple visible graphics algorithm children.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface ContainerNode extends GraphicsNode {
+
+ /**
+ * Defines the size of the gap between the container and the contained
+ * element.
+ */
+ public static final int CONTAINER_MARGIN = 5;
+
+ /**
+ * Retrieves the shape the provided graphics algorithm is contained in. The
+ * graphics algorithm can be either the invisible main graphics algorithm of
+ * the ContainerShape or a nested graphics algorithm.
+ *
+ * @param ga
+ * Any graphics algorithm of a ContainerNode.
+ * @return The ContainerShape of the ContainerNode.
+ */
+ public ContainerShape getContainerShape(GraphicsAlgorithm ga);
+
+ /**
+ * Checks whether there are elements contained in the container node.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @return True if the container node does have contained elements.
+ */
+ public boolean isEmpty(ContainerShape cs);
+
+ /**
+ * Checks whether the contained elements are hidden.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @return True if the contained elements are hidden.
+ */
+ public boolean isHiding(ContainerShape cs);
+
+ /**
+ * Retrieves the list of shapes contained in the container node. Shapes that
+ * are part of the container node itself (e.g. name, human agent figure) are
+ * ignored.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @return A list of shapes contained in the container node.
+ */
+ public EList<Shape> getContainedShapes(ContainerShape cs);
+
+ /**
+ * Hides or unhides the shapes contained in the container node according to
+ * the hideChildren parameter.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @param hideChildren
+ * Whether the contained shapes should be hidden or not.
+ */
+ public void hideContainedShapes(ContainerShape cs, boolean hideChildren);
+
+ /**
+ * Calculates the minimum width the container node should have to show all
+ * contained elements.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @return The minimum width of the container node when showing all
+ * contained elements.
+ */
+ public int getContainedWidth(ContainerShape cs);
+
+ /**
+ * Calculates the minimum height the container node should have to show all
+ * contained elements.
+ *
+ * @param cs
+ * The container shape of the container node.
+ * @return The minimum height of the container node when showing all
+ * contained elements.
+ */
+ public int getContainedHeight(ContainerShape cs);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithm.java
new file mode 100644
index 0000000..6c18997
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithm.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+
+/**
+ * This is the interface for all FMC nodes.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface FMCNodeAlgorithm extends FMCElementAlgorithm, MultipleNode,
+ AnchoredNode, NamedNode, ResizableNode, ContainerNode {
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithmFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithmFactory.java
new file mode 100644
index 0000000..8702a32
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/FMCNodeAlgorithmFactory.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This factory produces FMC node algorithms depending on the shape style or an
+ * already existing FMC node instance. The factory is responsible for creating
+ * the appropriate algorithm. This class is singleton.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class FMCNodeAlgorithmFactory {
+
+ private static FMCNodeAlgorithmFactory instance;
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ private RectangleStorageAlgorithm storage = null;
+ private HumanAgentAlgorithm humanAgent = null;
+ private RectangleAgentAlgorithm agent = null;
+ private LAgentAlgorithm lAgent = null;
+ private UAgentAlgorithm uAgent = null;
+ private LStorageAlgorithm lStorage = null;
+ private UStorageAlgorithm uStorage = null;
+
+ private FMCNodeAlgorithmFactory() {
+ }
+
+ /**
+ * Lazy initialization method of this factory.
+ *
+ * @return The singleton instance of this factory.
+ */
+ public static synchronized FMCNodeAlgorithmFactory getInstance() {
+ if (instance == null) {
+ instance = new FMCNodeAlgorithmFactory();
+ }
+ return instance;
+ }
+
+ private RectangleAgentAlgorithm getAgent() {
+ if (agent == null) {
+ agent = new RectangleAgentAlgorithm();
+ }
+ return agent;
+ }
+
+ public HumanAgentAlgorithm getHumanAgent() {
+ if (humanAgent == null) {
+ humanAgent = new HumanAgentAlgorithm();
+ }
+ return humanAgent;
+ }
+
+ private RectangleStorageAlgorithm getStorage() {
+ if (storage == null) {
+ storage = new RectangleStorageAlgorithm();
+ }
+ return storage;
+ }
+
+ private RectangleStorageAlgorithm getStructureVariance() {
+ if (storage == null) {
+ // TODO own algorithm for structure variances?
+ storage = new RectangleStorageAlgorithm();
+ }
+ return storage;
+ }
+
+ private LAgentAlgorithm getLAgent() {
+ if (lAgent == null) {
+ lAgent = new LAgentAlgorithm();
+ }
+ return lAgent;
+ }
+
+ private UAgentAlgorithm getUAgent() {
+ if (uAgent == null) {
+ uAgent = new UAgentAlgorithm();
+ }
+ return uAgent;
+ }
+
+ private LStorageAlgorithm getLStorage() {
+ if (lStorage == null) {
+ lStorage = new LStorageAlgorithm();
+ }
+ return lStorage;
+ }
+
+ private UStorageAlgorithm getUStorage() {
+ if (uStorage == null) {
+ uStorage = new UStorageAlgorithm();
+ }
+ return uStorage;
+ }
+
+ /**
+ * Returns the singleton instance of the appropriate agent algorithm.
+ *
+ * @param style
+ * The shape style
+ *
+ * @return The AgentAlgorithm appropriate for the given shape style.
+ */
+ public AgentAlgorithm getAgentByShapestyle(ShapeStyle style) {
+ switch (style) {
+ case L:
+ return getLAgent();
+ case U:
+ return getUAgent();
+ case RECT:
+ default:
+ return getAgent();
+ }
+ }
+
+ /**
+ * Returns the singleton instance of the appropriate storage algorithm.
+ *
+ * @param style
+ * The shape style
+ *
+ * @return The StorageAlgorithm appropriate for the given shape style.
+ */
+ public StorageAlgorithm getStorageByShapestyle(ShapeStyle style) {
+ switch (style) {
+ case L:
+ return getLStorage();
+ case U:
+ return getUStorage();
+ case RECT:
+ default:
+ return getStorage();
+ }
+ }
+
+ /**
+ * Returns the appropriate algorithm for the already existing pictogram
+ * element.
+ *
+ * @param picto
+ * The pictogram element to find the algorithm for.
+ * @return The appropriate FMCNodeAlgorithm instance.
+ *
+ */
+ public FMCNodeAlgorithm getShape(PictogramElement picto) {
+ if (isAgentWithStyle(picto, ShapeStyle.L)) {
+ return getLAgent();
+ } else if (isAgentWithStyle(picto, ShapeStyle.U)) {
+ return getUAgent();
+ } else if (helper.isHumanAgent(picto))
+ return getHumanAgent();
+ else if (helper.isAgent(picto))
+ return getAgent();
+ else if (isStorageWithStyle(picto, ShapeStyle.L)) {
+ return getLStorage();
+ } else if (isStorageWithStyle(picto, ShapeStyle.U)) {
+ return getUStorage();
+ } else if (helper.isStorage(picto))
+ return getStorage();
+ else if (helper.isStructureVariance(picto))
+ return getStructureVariance();
+ return null;
+ }
+
+ private boolean isAgentWithStyle(PictogramElement picto, ShapeStyle style) {
+ if (!helper.isAgent(picto))
+ return false;
+ if (style != ShapeStyle.RECT
+ && picto.getGraphicsAlgorithm() instanceof Polygon) {
+ Polygon polygon = (Polygon) picto.getGraphicsAlgorithm();
+ EList<Point> points = polygon.getPoints();
+ if (style == ShapeStyle.L && points.size() == 6)
+ return true;
+ else if (style == ShapeStyle.U && points.size() == 8)
+ return true;
+ } else if (style == ShapeStyle.RECT) {
+ return (helper.isAgent(picto));
+ }
+ return false;
+ }
+
+ private boolean isStorageWithStyle(PictogramElement picto, ShapeStyle style) {
+ if (!helper.isStorage(picto))
+ return false;
+ if (style != ShapeStyle.RECT
+ && picto.getGraphicsAlgorithm() instanceof Polygon) {
+ Polygon polygon = (Polygon) picto.getGraphicsAlgorithm();
+ EList<Point> points = polygon.getPoints();
+ if (style == ShapeStyle.L && points.size() == 6)
+ return true;
+ else if (style == ShapeStyle.U && points.size() == 8)
+ return true;
+ } else if (style == ShapeStyle.RECT) {
+ return helper.isStorage(picto);
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/GraphicsNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/GraphicsNode.java
new file mode 100644
index 0000000..3fe65f9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/GraphicsNode.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+
+/**
+ * This is the interface for all graphical nodes.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface GraphicsNode {
+
+ /**
+ * Creates a GraphicsAlgorithm in the given container with the given
+ * location and size. The graphics will be created depending on the type of
+ * node.
+ *
+ * @param diagram
+ * The diagram the graphics algorithm is added to.
+ * @param container
+ * The container of the newly created graphics algorithm
+ * (container shape or parent graphics algorithm).
+ * @param x
+ * The horizontal offset of the newly created graphics algorithm.
+ * @param y
+ * The vertical offset of the newly created graphics algorithm.
+ * @param width
+ * The width of the newly created graphics algorithm.
+ * @param height
+ * The width of the newly created graphics algorithm.
+ * @return The newly created graphics algorithm.
+ */
+ public GraphicsAlgorithm createGraphics(Diagram diagram,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height);
+
+ /**
+ * Retrieves The default line width of the graphical node.
+ *
+ * @return The default line width of the graphical node.
+ */
+ public int getDefaultLineWidth();
+
+ /**
+ * Retrieves the minimum height of the graphical node.
+ *
+ * @return The minimum height of the graphical node.
+ */
+ public int getMinimumHeight();
+
+ /**
+ * Retrieves the minimum width of the graphical node.
+ *
+ * @return The minimum width of the graphical node.
+ */
+ public int getMinimumWidth();
+
+ /**
+ * Retrieves the default height of the graphical node.
+ *
+ * @return The default height of the graphical node.
+ */
+ public int getDefaultHeight();
+
+ /**
+ * Retrieves the default width of the graphical node.
+ *
+ * @return The default width of the graphical node.
+ */
+ public int getDefaultWidth();
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/HumanAgentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/HumanAgentAlgorithm.java
new file mode 100644
index 0000000..6f9dda4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/HumanAgentAlgorithm.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.Ellipse;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+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.IPeCreateService;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class HumanAgentAlgorithm extends RectangleAgentAlgorithm {
+
+ /**
+ * Changes the type of the agent from human agent to (rectangle) agent,
+ * removes the next human figure that is found. If there is more than one
+ * human figure only one is removed.
+ *
+ * @param element
+ * The shape containing the human figure.
+ */
+ public void removeHumanFigure(PictogramElement element) {
+ if (element instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) element;
+ for (Shape shape : new ArrayList<Shape>(container.getChildren())) {
+ if (shape instanceof ContainerShape
+ && shape.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren().size() == 5) {
+ container.getChildren().remove(shape);
+ break;
+ }
+ }
+ ;
+ }
+ }
+
+ /**
+ * Checks if the agent is a human agent / has a human figure.
+ *
+ * @param element
+ * The shape of the agent.
+ * @return True if the agent shape contains a human figure.
+ */
+ public boolean hasHumanFigure(PictogramElement element) {
+ if (element instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) element;
+ for (Shape shape : new ArrayList<Shape>(container.getChildren())) {
+ if (shape instanceof ContainerShape
+ && shape.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren().size() == 5) {
+ return true;
+ }
+ }
+ ;
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the human agent's container shape with the human figure, if
+ * existing.
+ *
+ * @param element
+ * The shape of the agent.
+ * @return The container shape with the human figure, else null.
+ */
+ public ContainerShape getHumanFigure(PictogramElement element) {
+ if (element instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) element;
+ for (Shape shape : new ArrayList<Shape>(container.getChildren())) {
+ if (shape instanceof ContainerShape
+ && shape.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren().size() == 5) {
+ return (ContainerShape) shape;
+ }
+ }
+ ;
+ }
+ return null;
+ }
+
+ /**
+ * Changes the type of the agent to human agent, adds a human figure.
+ *
+ * @param diag
+ * The current Blockdiagram.
+ * @param container
+ * The shape containing the graphics algorithms of the agent.
+ * @param width
+ * The width of the agent.
+ */
+ public void addHumanFigure(Diagram diag, ContainerShape container, int width) {
+ int startPointX = width / 2 - 12;
+ IPeCreateService pe = Graphiti.getPeCreateService();
+ Color black = ga.manageColor(diag, 0, 0, 0);
+ ContainerShape figure = pe.createContainerShape(container, true);
+
+ int headX = 6;
+ int headSize = 10;
+ int bodyX = headSize;
+ int bodyY = headSize - 1;
+ int bodySize = 18;
+ int lArmX = bodyX + 1;
+ int rArmX = bodyX - 1;
+ int armsY = 18;
+ int armEndX = 13;
+ int armEndY = 9;
+ int legY = headSize * 2 + bodySize - 2;
+ int rLegX = headSize * 2 + 1;
+ int centerOfLegsX = headSize;
+ int centerOfLegsY = -headSize - 1;
+
+ // link(figure, FMCType.HumanAgentIcon);
+ Rectangle invRec = ga.createInvisibleRectangle(figure);
+ ga.setLocationAndSize(invRec, startPointX, 10, 25, bodySize + 2
+ * headSize);
+
+ Ellipse head = ga.createEllipse(invRec);
+ head.setFilled(false);
+ head.setForeground(black);
+ head.setParentGraphicsAlgorithm(invRec);
+ ga.setLocationAndSize(head, headX, 0, headSize, headSize);
+ Polyline leftArm = ga.createPolyline(invRec, new int[] { 0, 0,
+ -armEndX, -armEndY });
+ leftArm.setForeground(black);
+ leftArm.setParentGraphicsAlgorithm(invRec);
+ ga.setLocation(leftArm, lArmX, armsY);
+ Polyline rightArm = ga.createPolyline(invRec, new int[] { 0, 0,
+ armEndX, -armEndY });
+ rightArm.setForeground(black);
+ rightArm.setParentGraphicsAlgorithm(invRec);
+ ga.setLocation(rightArm, rArmX, armsY);
+ Polyline body = ga.createPolyline(invRec,
+ new int[] { 0, 0, 0, bodySize });
+ body.setForeground(black);
+ body.setParentGraphicsAlgorithm(invRec);
+ ga.setLocation(body, bodyX, bodyY);
+ Polyline legs = ga.createPolyline(invRec, new int[] { 0, 0,
+ centerOfLegsX, centerOfLegsY, rLegX, 0 });
+ legs.setForeground(black);
+ legs.setParentGraphicsAlgorithm(invRec);
+ ga.setLocation(legs, 0, legY);
+
+ // Shape headShape = pe.createShape(figure, false);
+ // Ellipse head = ga.createEllipse(headShape);
+ // head.setFilled(false);
+ // head.setForeground(black);
+ // ga.setLocationAndSize(head, headX, 0, headSize, headSize);
+ // Shape leftArmShape = pe.createShape(figure, false);
+ // Polyline leftArm = ga.createPolyline(leftArmShape, new int[] { 0, 0,
+ // -armEndX, -armEndY });
+ // leftArm.setForeground(black);
+ // ga.setLocation(leftArm, lArmX, armsY);
+ // Shape rightArmShape = pe.createShape(figure, false);
+ // Polyline rightArm = ga.createPolyline(rightArmShape, new int[] { 0,
+ // 0,
+ // armEndX, -armEndY });
+ // rightArm.setForeground(black);
+ // ga.setLocation(rightArm, rArmX, armsY);
+ // Shape bodyShape = pe.createShape(figure, false);
+ // Polyline body = ga.createPolyline(bodyShape, new int[] { 0, 0, 0,
+ // bodySize});
+ // body.setForeground(black);
+ // ga.setLocation(body, bodyX, bodyY);
+ // Shape legsShape = pe.createShape(figure, false);
+ // Polyline legs = ga.createPolyline(legsShape, new int[] { 0, 0,
+ // centerOfLegsX, centerOfLegsY,
+ // rLegX, 0 });
+ // legs.setForeground(black);
+ // ga.setLocation(legs, 0, legY);
+ }
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RectangleAgentAlgorithm#createGraphics
+ * (org.eclipse.graphiti.mm.pictograms.Diagram,
+ * org.eclipse.graphiti.mm.GraphicsAlgorithmContainer, int, int, int, int)
+ */
+ public GraphicsAlgorithm createGraphics(Diagram diag,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height) {
+ GraphicsAlgorithm rectangle = super.createGraphics(diag, container, x,
+ y, width, height);
+ if (container instanceof ContainerShape)
+ addHumanFigure(diag, (ContainerShape) container, width);
+ return rectangle;
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.RectangleAgentAlgorithm#resize(org.eclipse
+ * .graphiti.mm.algorithms.GraphicsAlgorithm, int, int, int, int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+
+ super.resize(algorithm, x, y, width, height);
+ ContainerShape container = this.getContainerShape(algorithm);
+ removeHumanFigure(container);
+ addHumanFigure(FMCUtil.getActiveEditor().getDiagramTypeProvider()
+ .getDiagram(), container, width);
+ }
+
+ // ----------------------------------------
+ // ----------- Container Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#getContainedShapes(org.
+ * eclipse.graphiti.mm.pictograms.ContainerShape)
+ */
+ public EList<Shape> getContainedShapes(ContainerShape cs) {
+ EList<Shape> results = new BasicEList<Shape>();
+ Shape humanFigureShape = this.getHumanFigure(cs);
+ if (humanFigureShape != null) {
+ for (Shape shape : super.getContainedShapes(cs)) {
+ if (!(shape.equals(humanFigureShape)))
+ results.add(shape);
+ }
+ }
+ return results;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LAgentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LAgentAlgorithm.java
new file mode 100644
index 0000000..8bf70f8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LAgentAlgorithm.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This class encapsulates all operations on a LShape Agent.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class LAgentAlgorithm extends AbstractLPolygonAlgorithm implements
+ AgentAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int LAGENT_MINIMUM_WIDTH = 30;
+ public static final int LAGENT_MINIMUM_HEIGHT = 30;
+ public static final int LAGENT_DEFAULT_WIDTH = 60;
+ public static final int LAGENT_DEFAULT_HEIGHT = 70;
+ public static final int LAGENT_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return LAGENT_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return LAGENT_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return LAGENT_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return LAGENT_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return LAGENT_DEFAULT_LINEWIDTH;
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LPolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LPolygonAlgorithm.java
new file mode 100644
index 0000000..e5b49ed
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LPolygonAlgorithm.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+
+/**
+ * This interface collects all methods common to L-shaped polygons.
+ *
+ * @author Heiko Witteborg
+ * @author Benjamin Schmeling
+ *
+ */
+public interface LPolygonAlgorithm extends PolygonAlgorithm {
+
+ /**
+ * The default size of the figure. The default height of the L shape parts.
+ */
+ public static final int L_PART_DEFAULT_SIZE = 30;
+ public static final int L_PART_MINIMUM_SIZE = 30;
+ public static final int L_MINIMUM_SIZE = 50;
+
+ /**
+ * Calculates the size of the bottom part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The size of the bottom part of the L Polygon.
+ */
+ public int getBottomPartSize(Polygon polygon);
+
+ /**
+ * Calculates the size of the right part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The size of the right part of the L Polygon.
+ */
+ public int getRightPartSize(Polygon polygon);
+
+ /**
+ * Resizes the the bottom part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ */
+ public void resizeBottomPart(Polygon polygon, int size);
+
+ /**
+ * Resizes the the right part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ */
+ public void resizeRightPart(Polygon polygon, int size);
+
+ /**
+ * Calculates the corner size of the right part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The corner width of the right part of the L Polygon.
+ */
+ public int getRightPartTopCornerSize(Polygon polygon);
+
+ /**
+ * Calculates the corner size of the right part of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The corner width of the right part of the L Polygon.
+ */
+ public int getBottomPartLeftCornerSize(Polygon polygon);
+
+ /**
+ * Calculates the corner size of the inner right corner of the bottom part
+ * of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The corner width of the inner right corner of the bottom part of
+ * the L Polygon.
+ */
+ public int getBottomPartRightCornerSize(Polygon polygon);
+
+ /**
+ * Calculates the corner size of the inner bottom corner of the right part
+ * of the L.
+ *
+ * @param polygon
+ * An L-shaped polygon.
+ * @return The corner width of the inner bottom corner of the right part of
+ * the L Polygon.
+ */
+ public int getRightPartBottomCornerSize(Polygon polygon);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LStorageAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LStorageAlgorithm.java
new file mode 100644
index 0000000..535771b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/LStorageAlgorithm.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This class encapsulates all operations on a L-shaped Storage with rounded
+ * corners.
+ *
+ * @author Heiko Witteborg
+ * @author Benjamin Schmeling
+ *
+ */
+public class LStorageAlgorithm extends AbstractLPolygonAlgorithm implements
+ StorageAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int LSTORAGE_MINIMUM_WIDTH = 30;
+ public static final int LSTORAGE_MINIMUM_HEIGHT = 30;
+ public static final int LSTORAGE_DEFAULT_WIDTH = 70;
+ public static final int LSTORAGE_DEFAULT_HEIGHT = 70;
+ public static final int LSTORAGE_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return LSTORAGE_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return LSTORAGE_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return LSTORAGE_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return LSTORAGE_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return LSTORAGE_DEFAULT_LINEWIDTH;
+ }
+
+ // ----------------------------------------
+ // ----------- Polygon Impl ---------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractPolygonAlgorithm#hasRoundedCorners
+ * ()
+ */
+ public boolean hasRoundedCorners() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/MultipleNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/MultipleNode.java
new file mode 100644
index 0000000..21d324f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/MultipleNode.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+
+/**
+ * This is the interface for all nodes with multiplicity option.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface MultipleNode extends GraphicsNode {
+
+ /**
+ * Defines the size of the gap between the multiple instance algorithms.
+ */
+ public static final int MULTI_INSTANCE_GAP = 5;
+
+ /**
+ * @param container
+ * @param multipleInstances
+ */
+ public void setMultipleInstances(ContainerShape container,
+ IFeatureProvider provider, boolean multipleInstances);
+
+ /**
+ * When there are multiple instances, there are two graphics algorithms
+ * showing up. If main == true, then the main part in the front will be
+ * returned, otherwise the part behind the main part. Returns null if this
+ * container is not a a multi instance shape.
+ *
+ * @param container
+ * The container shape of the multiple node.
+ * @param main
+ * True if the graphics algorithm in the foreground should be
+ * returned
+ * @return The selected graphics algorithms of the multiple node. Null if
+ * multiplicity of the node is set to false.
+ */
+ public GraphicsAlgorithm getMultiInstanceChild(ContainerShape container,
+ boolean main);
+
+ /**
+ * Checks if the multiplicity of the multiple node is set to true.
+ *
+ * @param container
+ * The container of the MultipleNode.
+ * @return True if the multiplicity of the MultipleNode is true.
+ */
+ public boolean isMultipleInstances(ContainerShape container);
+
+ /**
+ * Ensures that the multiple instance children are in sync (e.g. size,
+ * position).
+ *
+ * @param container
+ * The container of the MultipleNode.
+ */
+ public void synchronizeMultiInstanceChildren(ContainerShape container);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/NamedNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/NamedNode.java
new file mode 100644
index 0000000..f10dc4e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/NamedNode.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+
+/**
+ * This is the interface for all nodes that have a diplayable name (title, ...).
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface NamedNode extends GraphicsNode {
+
+ /**
+ * Defines the default size of the gap between the container and the name
+ * text.
+ */
+ public static final int DEFAULT_MARGIN = 0;
+
+ /**
+ * Returns the MultiText with the name of the object linked to the shape of
+ * the given graphics algorithm.
+ *
+ * @param graphicsAlgorithm
+ * A graphics algorithm of the shape containing the text as a
+ * direct child.
+ * @return The MultiText graphics algorithm with the name of the node.
+ */
+ public MultiText getText(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Adjusts the location of the MultiText according to size and orientation
+ * of the containing GraphicsAlgorithm.
+ *
+ * @param graphicsAlgorithm
+ * The graphicsAlgorithm containing the MultiText to be adjusted.
+ */
+ public void relocateText(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Sets margin of text to the specified value.
+ *
+ * @param margin
+ * The text's margin.
+ */
+ public void setTextMargin(int margin);
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/PolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/PolygonAlgorithm.java
new file mode 100644
index 0000000..3319e7f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/PolygonAlgorithm.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import java.util.List;
+
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+
+/**
+ * This is the super interface that all polygon algorithms must implement.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public interface PolygonAlgorithm extends AnchoredNode, MultipleNode,
+ ResizableNode, NamedNode, ContainerNode, RotatableNode {
+
+ /**
+ * Indicates whether the polygon algorithm has rounded corners.
+ */
+ public boolean hasRoundedCorners();
+
+ /**
+ * Retrieve a list of initial points according to the given parameters.
+ *
+ * @param x
+ * The relative x offset of the polygon.
+ * @param y
+ * The relative y offset of the polygon.
+ * @param width
+ * The width of the polygon.
+ * @param height
+ * The height of the polygon.
+ * @return The list of initial points of the polygon.
+ */
+ public List<Point> getInitialPoints(int x, int y, int width, int height);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAgentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAgentAlgorithm.java
new file mode 100644
index 0000000..69743ff
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAgentAlgorithm.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This agent algorithm class represents the standard rectangular shape for
+ * agents.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class RectangleAgentAlgorithm extends AbstractRectangleAlgorithm
+ implements AgentAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int AGENT_MINIMUM_WIDTH = 15;
+ public static final int AGENT_MINIMUM_HEIGHT = 15;
+ public static final int AGENT_DEFAULT_WIDTH = 70;
+ public static final int AGENT_DEFAULT_HEIGHT = 50;
+ public static final int AGENT_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#createGraphics(org.eclipse
+ * .graphiti.mm.pictograms.Diagram,
+ * org.eclipse.graphiti.mm.GraphicsAlgorithmContainer, int, int, int, int)
+ */
+ public GraphicsAlgorithm createGraphics(Diagram diag,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height) {
+ Rectangle rectShape = ga.createRectangle(container);
+ ga.setLocationAndSize(rectShape, x, y, width, height);
+ rectShape.setLineWidth(3);
+ rectShape.setTransparency(null);
+ rectShape.setStyle(StyleUtil.getStyle(diag, StyleUtil.SHAPE));
+
+ // Create anchors
+ if (container instanceof GraphicsAlgorithm) {
+ ContainerShape containerShape = this.getContainerShape(rectShape);
+ pe.createChopboxAnchor(containerShape);
+ createBoxAnchorSet(containerShape);
+ }
+ return rectShape;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return AGENT_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return AGENT_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return AGENT_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return AGENT_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return AGENT_DEFAULT_LINEWIDTH;
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.FMCNodeAlgorithm#resize
+ * (org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm, int, int, int,
+ * int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+ ContainerShape container = this.getContainerShape(algorithm);
+
+ ga.setLocationAndSize(algorithm, x, y, width, height);
+
+ relocateText(algorithm);
+
+ // adapt first level container (relative anchors + invisible shape)
+ createBoxAnchorSet(container);
+ }
+
+ // ----------------------------------------
+ // ----------- Anchored Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#addBoxAnchorSet(org.eclipse
+ * .graphiti.mm.pictograms.ContainerShape)
+ */
+ protected void addBoxAnchorSet(Shape shape) {
+
+ // A
+ // ___________
+ // | |
+ // D | | B
+ // |___________|
+ //
+ // C
+
+ GraphicsAlgorithm firstLevelRectangle = shape.getGraphicsAlgorithm();
+ GraphicsAlgorithm secondLevelRectangle = firstLevelRectangle
+ .getGraphicsAlgorithmChildren().get(0);
+
+ // adapt anchors when drawing background part (front part)
+ double offsetMultiInstance = 0.0d;
+ if (firstLevelRectangle.getWidth() != secondLevelRectangle.getWidth()) {
+ // Remove anchors created when drawing the main part
+ FMCUtil.removeObsoleteAnchors(shape);
+ offsetMultiInstance = MULTI_INSTANCE_GAP;
+ }
+
+ int numOfAnchorsW = secondLevelRectangle.getWidth()
+ / AnchoredNode.DEFAULT_ANCHOR_GAP;
+ int numOfAnchorsH = secondLevelRectangle.getHeight()
+ / AnchoredNode.DEFAULT_ANCHOR_GAP;
+ double gapW = (((double) secondLevelRectangle.getWidth()) / numOfAnchorsW)
+ / firstLevelRectangle.getWidth();
+ double gapH = (((double) secondLevelRectangle.getHeight()) / numOfAnchorsH)
+ / firstLevelRectangle.getHeight();
+
+ double relativeOffsetXForA = offsetMultiInstance
+ / firstLevelRectangle.getWidth();
+ double relativeOffsetXForC = 0.0d;
+ double relativeOffsetYForA = 0.0d;
+ double relativeOffsetYForC = 1.0d - (((double) AnchoredNode.DEFAULT_ANCHOR_DIAMETER) / firstLevelRectangle
+ .getHeight());
+ double relativeOffsetXForB = 1.0d - (((double) AnchoredNode.DEFAULT_ANCHOR_DIAMETER) / firstLevelRectangle
+ .getWidth());
+ double relativeOffsetXForD = 0.0d;
+ double relativeOffsetYForB = 0.0d;
+ double relativeOffsetYForD = offsetMultiInstance
+ / firstLevelRectangle.getHeight();
+
+ for (int i = 0; i < numOfAnchorsW; i++) {
+ createBoxAnchor(shape, relativeOffsetXForA + i * gapW,
+ relativeOffsetYForA, AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ createBoxAnchor(shape, relativeOffsetXForC + i * gapW,
+ relativeOffsetYForC, AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ }
+ for (int i = 0; i < numOfAnchorsH; i++) {
+ createBoxAnchor(shape, relativeOffsetXForD, relativeOffsetYForD + i
+ * gapH, AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_GAP);
+ createBoxAnchor(shape, relativeOffsetXForB, relativeOffsetYForB + i
+ * gapH, AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_GAP);
+ }
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAlgorithm.java
new file mode 100644
index 0000000..cb8b877
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleAlgorithm.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This is the interface for all rectangles.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface RectangleAlgorithm extends NamedNode, ContainerNode,
+ MultipleNode, AnchoredNode, ResizableNode {
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleStorageAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleStorageAlgorithm.java
new file mode 100644
index 0000000..ee01182
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RectangleStorageAlgorithm.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.RoundedRectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This storage algorithm class represents the standard rectangular shape with
+ * rounded corners for storages.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class RectangleStorageAlgorithm extends AbstractRectangleAlgorithm
+ implements StorageAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int STORAGE_MINIMUM_WIDTH = 15;
+ public static final int STORAGE_MINIMUM_HEIGHT = 15;
+ public static final int STORAGE_DEFAULT_WIDTH = 60;
+ public static final int STORAGE_DEFAULT_HEIGHT = 40;
+ public static final int STORAGE_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#createGraphics(org.eclipse
+ * .graphiti.mm.pictograms.Diagram,
+ * org.eclipse.graphiti.mm.GraphicsAlgorithmContainer, int, int, int, int)
+ */
+ public GraphicsAlgorithm createGraphics(Diagram diagram,
+ GraphicsAlgorithmContainer container, int x, int y, int width,
+ int height) {
+ int w = width; // width < STORAGE_MINIMUM_CORNER_WIDTH * 2 ?
+ // STORAGE_MINIMUM_CORNER_WIDTH * 2 : width;
+ int h = height; // height < STORAGE_MINIMUM_CORNER_WIDTH * 2 ?
+ // STORAGE_MINIMUM_CORNER_WIDTH * 2 : height;
+ int cornerWidth = (w < h) ? w : h;
+ RoundedRectangle rec = ga.createRoundedRectangle(container,
+ cornerWidth, cornerWidth);
+ ga.setLocationAndSize(rec, x, y, w, h);
+ rec.setLineWidth(3);
+ rec.setTransparency(null);
+ rec.setStyle(StyleUtil.getStyle(diagram, StyleUtil.SHAPE));
+
+ // Create anchors
+ if (container instanceof GraphicsAlgorithm) {
+ ContainerShape containerShape = this.getContainerShape(rec);
+ pe.createChopboxAnchor(containerShape);
+ createBoxAnchorSet(containerShape);
+ }
+ return rec;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return STORAGE_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return STORAGE_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return STORAGE_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return STORAGE_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return STORAGE_DEFAULT_LINEWIDTH;
+ }
+
+ // ----------------------------------------
+ // ----------- Resizable Node -------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.graphicsalgorithms.FMCNodeAlgorithm#resize
+ * (org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm, int, int, int,
+ * int)
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height) {
+ ContainerShape container = this.getContainerShape(algorithm);
+
+ ga.setLocationAndSize(algorithm, x, y, width, height);
+
+ // update rounded corner width and height
+ RoundedRectangle rec = (RoundedRectangle) algorithm;
+ int cornerWidth = (width < height) ? width : height;
+ rec.setCornerHeight(cornerWidth);
+ rec.setCornerWidth(cornerWidth);
+
+ relocateText(algorithm);
+
+ // adapt first level container (relative anchors + invisible shape)
+ createBoxAnchorSet(container);
+ }
+
+ // ----------------------------------------
+ // ----------- Anchored Node --------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractNode#addBoxAnchorSet(org.eclipse
+ * .graphiti.mm.pictograms.ContainerShape)
+ */
+ protected void addBoxAnchorSet(Shape shape) {
+ int radius, numOfAnchorsForStraightSections;
+
+ GraphicsAlgorithm firstLevelRectangle = shape.getGraphicsAlgorithm(); // graphics
+ // =
+ // Rectangle
+ GraphicsAlgorithm secondLevelRectangle = firstLevelRectangle
+ .getGraphicsAlgorithmChildren().get(0); // graphics = Rectangle
+
+ // adapt anchors when drawing background part (front part)
+ double gapForStraightSections, offsetMultiInstance = 0.0d;
+ if (firstLevelRectangle.getWidth() != secondLevelRectangle.getWidth()) {
+ // Remove anchors created when drawing the main part
+ FMCUtil.removeObsoleteAnchors(shape);
+ offsetMultiInstance = MULTI_INSTANCE_GAP;
+ }
+
+ if (secondLevelRectangle.getWidth() > secondLevelRectangle.getHeight()) {
+ // case width > height
+ // A
+ // ___________
+ // / \
+ // D | | B
+ // \ ___________ /
+ //
+ // C
+
+ // add anchors for A+C
+ radius = secondLevelRectangle.getHeight() / 2;
+ numOfAnchorsForStraightSections = (secondLevelRectangle.getWidth() - 2 * radius)
+ / AnchoredNode.DEFAULT_ANCHOR_GAP;
+ double relativeOffsetXForA = (((double) radius + offsetMultiInstance) / firstLevelRectangle
+ .getWidth());
+ double relativeOffsetXForC = ((double) radius)
+ / firstLevelRectangle.getWidth();
+ double relativeOffsetYForA = 0.0d;
+ double relativeOffsetYForC = 1.0d - (((double) AnchoredNode.DEFAULT_ANCHOR_DIAMETER) / firstLevelRectangle
+ .getHeight());
+ gapForStraightSections = (1.0d - relativeOffsetXForA - relativeOffsetXForC)
+ / numOfAnchorsForStraightSections;
+ for (int i = 0; i <= numOfAnchorsForStraightSections; i++) {
+ createBoxAnchor(shape, relativeOffsetXForA + i
+ * gapForStraightSections, relativeOffsetYForA,
+ AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ createBoxAnchor(shape, relativeOffsetXForC + i
+ * gapForStraightSections, relativeOffsetYForC,
+ AnchoredNode.DEFAULT_ANCHOR_GAP,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ }
+
+ // add anchors for B+D
+ double relativeOffsetXForB = (((double) firstLevelRectangle
+ .getWidth()) - AnchoredNode.DEFAULT_ANCHOR_DIAMETER)
+ / firstLevelRectangle.getWidth();
+ double relativeOffsetXForD = 0.0d;
+ double relativeOffsetYForB = (((double) radius) - (AnchoredNode.DEFAULT_ANCHOR_DIAMETER / 2))
+ / firstLevelRectangle.getHeight();
+ double relativeOffsetYForD = (((double) radius)
+ - (AnchoredNode.DEFAULT_ANCHOR_DIAMETER / 2) + offsetMultiInstance)
+ / firstLevelRectangle.getHeight();
+ createBoxAnchor(shape, relativeOffsetXForD, relativeOffsetYForD,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ createBoxAnchor(shape, relativeOffsetXForB, relativeOffsetYForB,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+
+ } else {
+ // case width < height
+ // A
+ // ___
+ // / \
+ // | |
+ // D | | B
+ // | |
+ // \___/
+ //
+ // C
+
+ // add anchors for B+D
+ radius = secondLevelRectangle.getWidth() / 2;
+ numOfAnchorsForStraightSections = (secondLevelRectangle.getHeight() - 2 * radius)
+ / AnchoredNode.DEFAULT_ANCHOR_GAP;
+ double relativeOffsetYForB = ((double) radius)
+ / firstLevelRectangle.getHeight();
+ double relativeOffsetYForD = ((double) radius + offsetMultiInstance)
+ / firstLevelRectangle.getHeight();
+ double relativeOffsetXForB = 1.0d - (((double) AnchoredNode.DEFAULT_ANCHOR_DIAMETER) / firstLevelRectangle
+ .getWidth());
+ double relativeOffsetXForD = 0.0d;
+
+ gapForStraightSections = (1.0d - relativeOffsetYForB - relativeOffsetYForD)
+ / numOfAnchorsForStraightSections;
+ for (int i = 0; i <= numOfAnchorsForStraightSections; i++) {
+ createBoxAnchor(shape, relativeOffsetXForD, relativeOffsetYForD
+ + i * gapForStraightSections,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_GAP);
+ createBoxAnchor(shape, relativeOffsetXForB, relativeOffsetYForB
+ + i * gapForStraightSections,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_GAP);
+ }
+
+ // add anchors for A+C
+ double relativeOffsetXForA = (((double) radius)
+ - (AnchoredNode.DEFAULT_ANCHOR_DIAMETER / 2) + offsetMultiInstance)
+ / firstLevelRectangle.getWidth();
+ double relativeOffsetXForC = (((double) radius) - (AnchoredNode.DEFAULT_ANCHOR_DIAMETER / 2))
+ / firstLevelRectangle.getWidth();
+ double relativeOffsetYForA = 0.0d;
+ double relativeOffsetYForC = (((double) firstLevelRectangle
+ .getHeight()) - AnchoredNode.DEFAULT_ANCHOR_DIAMETER)
+ / firstLevelRectangle.getHeight();
+ createBoxAnchor(shape, relativeOffsetXForA, relativeOffsetYForA,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ createBoxAnchor(shape, relativeOffsetXForC, relativeOffsetYForC,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ResizableNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ResizableNode.java
new file mode 100644
index 0000000..9457d84
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/ResizableNode.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+
+/**
+ * This is the interface for all resizable nodes.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface ResizableNode extends GraphicsNode {
+
+ /**
+ * Resizes the GraphicsAlgorithm. The graphics will be resized depending on
+ * the type of PolygonAlgorithm.
+ *
+ * @param algorithm
+ * The GraphicsAlgorithm to be resized.
+ * @param x
+ * The x position of the GraphicsAlgorithm.
+ * @param y
+ * The y position of the GraphicsAlgorithm.
+ * @param width
+ * The width of the GraphicsAlgorithm.
+ * @param height
+ * The height position of the GraphicsAlgorithm.
+ */
+ public void resize(GraphicsAlgorithm algorithm, int x, int y, int width,
+ int height);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RotatableNode.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RotatableNode.java
new file mode 100644
index 0000000..db7771f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/RotatableNode.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+
+/**
+ * This is the interface for all nodes that can be rotated or flipped.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public interface RotatableNode extends GraphicsNode {
+
+ /**
+ * Calculates the current angle of the graphics algorithm.
+ *
+ * @param graphics
+ * algorithm The observed graphics algorithm.
+ * @return The current angle of the graphics algorithm.
+ */
+ public int getAngle(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Checks whether the graphics algorithm is flipped or not.
+ *
+ * @param graphics
+ * algorithm The observed graphics algorithm.
+ * @return True, if the graphics algorithm is flipped.
+ */
+ public boolean isFlipped(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Rotates the graphics algorithm 90 degrees to the right.
+ *
+ * @param graphics
+ * algorithm The graphics algorithm to be rotated.
+ */
+ public void rotate90Right(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Flips the graphics algorithm and all its rotatable graphics children
+ * horizontally. Does not adapt the position and size of the associated
+ * shape.
+ *
+ * @param graphics
+ * algorithm The graphics algorithm to be flipped.
+ */
+ public void flipHorizontally(GraphicsAlgorithm graphicsAlgorithm);
+
+ /**
+ * Flips the graphics algorithm vertically.
+ *
+ * @param graphics
+ * algorithm The graphics algorithm to be flipped.
+ */
+ public void flipVertically(GraphicsAlgorithm graphicsAlgorithm);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/StorageAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/StorageAlgorithm.java
new file mode 100644
index 0000000..fcc99e0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/StorageAlgorithm.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This is the interface for all storage algorithms.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public interface StorageAlgorithm extends FMCNodeAlgorithm {
+
+ public static final int STORAGE_MINIMUM_CORNER_WIDTH = 30;
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UAgentAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UAgentAlgorithm.java
new file mode 100644
index 0000000..8b7c36b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UAgentAlgorithm.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This class encapsulates all operations on a UShape Agent.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class UAgentAlgorithm extends AbstractUPolygonAlgorithm implements
+ AgentAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ // TODO overwrite constants & remove getters?
+ public static final int UAGENT_MINIMUM_WIDTH = 30;
+ public static final int UAGENT_MINIMUM_HEIGHT = 30;
+ public static final int UAGENT_DEFAULT_WIDTH = 90;
+ public static final int UAGENT_DEFAULT_HEIGHT = 70;
+ public static final int UAGENT_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return UAGENT_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return UAGENT_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return UAGENT_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return UAGENT_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return UAGENT_DEFAULT_LINEWIDTH;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UPolygonAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UPolygonAlgorithm.java
new file mode 100644
index 0000000..19a4701
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UPolygonAlgorithm.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+
+/**
+ * This interface collects all methods common to U-shaped polygons.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public interface UPolygonAlgorithm extends LPolygonAlgorithm {
+
+ /**
+ * Calculates the size of the left part of the U.
+ *
+ * @param polygon
+ * An U-shaped polygon.
+ * @return The size of the left part of the U Polygon.
+ */
+ public int getLeftPartSize(Polygon polygon);
+
+ /**
+ * Resizes the the left part of the U.
+ *
+ * @param polygon
+ * An U-shaped polygon.
+ */
+ public void resizeLeftPart(Polygon polygon, int size);
+
+ /**
+ * Calculates the corner size of the top corner of the left part of the U.
+ *
+ * @param polygon
+ * An U-shaped polygon.
+ * @return The corner size of the top corner of the left part of the U
+ * Polygon.
+ */
+ public int getLeftPartTopCornerSize(Polygon polygon);
+
+ /**
+ * Calculates the corner size of the bottom corner of the left part of the
+ * U.
+ *
+ * @param polygon
+ * An U-shaped polygon.
+ * @return The corner size of the bottom corner of the left part of the U
+ * Polygon.
+ */
+ public int getLeftPartBottomCornerSize(Polygon polygon);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UStorageAlgorithm.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UStorageAlgorithm.java
new file mode 100644
index 0000000..60fb5a4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/UStorageAlgorithm.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.algorithm.node;
+
+/**
+ * This class encapsulates all operations on a UShape Agent.
+ *
+ * @author Heiko Witteborg
+ * @author Benjamin Schmeling
+ *
+ */
+public class UStorageAlgorithm extends AbstractUPolygonAlgorithm implements
+ StorageAlgorithm {
+
+ // ----------------------------------------
+ // ----------- Graphics Node --------------
+
+ public static final int USTORAGE_MINIMUM_WIDTH = 30;
+ public static final int USTORAGE_MINIMUM_HEIGHT = 30;
+ public static final int USTORAGE_DEFAULT_WIDTH = 90;
+ public static final int USTORAGE_DEFAULT_HEIGHT = 70;
+ public static final int USTORAGE_DEFAULT_LINEWIDTH = 3;
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumHeight()
+ */
+ public int getMinimumHeight() {
+ return USTORAGE_MINIMUM_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getMinimumWidth()
+ */
+ public int getMinimumWidth() {
+ return USTORAGE_MINIMUM_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultHeight()
+ */
+ public int getDefaultHeight() {
+ return USTORAGE_DEFAULT_HEIGHT;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultWidth()
+ */
+ public int getDefaultWidth() {
+ return USTORAGE_DEFAULT_WIDTH;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.fmc.blockdiagram.editor.node.GraphicsNode#getDefaultLineWidth()
+ */
+ public int getDefaultLineWidth() {
+ return USTORAGE_DEFAULT_LINEWIDTH;
+ }
+
+ // ----------------------------------------
+ // ----------- Polygon Impl ---------------
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.node.AbstractPolygonAlgorithm#hasRoundedCorners
+ * ()
+ */
+ public boolean hasRoundedCorners() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/package.html
new file mode 100644
index 0000000..1087ee3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/algorithm/node/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains the polygon algorithms for rendering agents and storage shapes.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/NavigatorRoot.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/NavigatorRoot.java
new file mode 100644
index 0000000..589883e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/NavigatorRoot.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.application;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * The Naviagtor Root element for supporting drag and drop of ecore objects into
+ * Graphiti diagrams.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class NavigatorRoot implements IAdaptable, IPersistableElement,
+ IElementFactory {
+
+ public NavigatorRoot() {
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPersistableElement.class)
+ return this;
+ if (adapter == IWorkbenchAdapter.class)
+ return ResourcesPlugin.getWorkspace().getRoot().getAdapter(adapter);
+ return null;
+ }
+
+ public String getFactoryId() {
+ return this.getClass().getCanonicalName();
+ }
+
+ public void saveState(IMemento memento) {
+ }
+
+ public IAdaptable createElement(IMemento memento) {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/Perspective.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/Perspective.java
new file mode 100644
index 0000000..2085645
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/Perspective.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.application;
+
+import org.eclipse.graphiti.ui.internal.editor.ThumbNailView;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.IViewDescriptor;
+
+@SuppressWarnings("restriction")
+/**
+ * This class defines the FMC perspective.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class Perspective implements IPerspectiveFactory {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
+ * .IPageLayout)
+ */
+ @Override
+ public void createInitialLayout(IPageLayout layout) {
+ defineActions(layout);
+ defineLayout(layout);
+ }
+
+ /**
+ * Defines the initial actions for a page.
+ *
+ * @param layout
+ * The layout we are filling
+ */
+ private void defineActions(IPageLayout layout) {
+ // Add "new wizards".
+
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.fmc.blockdiagram.wizard");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.fmc.blockdiagram.wizard.meta");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.fmc.mm.FmcModelWizard");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.papyrus.wizards.createmodel");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
+
+ // Add "show views".
+ layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
+ // layout.addShowViewShortcut(NAVIGATOR_ID);
+ layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
+ }
+
+ /**
+ * Defines the initial layout for a page.
+ *
+ * @param layout
+ * The layout we are filling
+ */
+ private void defineLayout(IPageLayout layout) {
+ // Editors are placed for free.
+ String editorArea = layout.getEditorArea();
+
+ // Top left.
+ IFolderLayout topLeft = layout.createFolder(
+ "topLeft", IPageLayout.LEFT, (float) 0.26, editorArea);//$NON-NLS-1$
+
+ topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
+
+ if (isViewAvailable("org.eclipse.jdt.ui.PackageExplorer")) { //$NON-NLS-1$
+ topLeft.addView("org.eclipse.jdt.ui.PackageExplorer"); //$NON-NLS-1$
+ }
+ topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+
+ // Bottom left.
+ IFolderLayout bottomLeft = layout.createFolder(
+ "bottomLeft", IPageLayout.BOTTOM, (float) 0.50,//$NON-NLS-1$
+ "topLeft");//$NON-NLS-1$
+
+ if (isViewAvailable(ThumbNailView.VIEW_ID)) {
+ bottomLeft.addView(ThumbNailView.VIEW_ID); //$NON-NLS-1$
+ }
+
+ // Bottom right.
+ IFolderLayout bottomRight = layout.createFolder(
+ "bottomRight", IPageLayout.BOTTOM, (float) 0.66,//$NON-NLS-1$
+ editorArea);
+
+ if (isViewAvailable(IPageLayout.ID_PROP_SHEET)) {
+ bottomRight.addView(IPageLayout.ID_PROP_SHEET);
+ }
+ }
+
+ private static boolean isViewAvailable(String viewId) {
+ IViewDescriptor viewDesc = PlatformUI.getWorkbench().getViewRegistry()
+ .find(viewId);
+ return viewDesc != null;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/package.html
new file mode 100644
index 0000000..2f43174
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/application/package.html
@@ -0,0 +1,6 @@
+<html>
+<body>This package contains all classes that are responsible to
+ customize eclipse behavior for the FMC editors.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/CopyToClipboard.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/CopyToClipboard.java
new file mode 100644
index 0000000..588fa52
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/CopyToClipboard.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.clipboard;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.fmc.blockdiagram.editor.Activator;
+import org.eclipse.fmc.blockdiagram.editor.clipboard.img.GraphitiImageConverter;
+import org.eclipse.fmc.blockdiagram.editor.clipboard.img.ImageTransferable;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.graphiti.ui.internal.parts.ConnectionDecoratorEditPart;
+import org.eclipse.graphiti.ui.internal.parts.ShapeEditPart;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * This class is the main entry point for copying to the clipboard.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class CopyToClipboard {
+
+ private static FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ /**
+ * Private constructor.
+ */
+ private CopyToClipboard() {
+ }
+
+ /**
+ * Copies the selected pictogram elements as image in the given format to
+ * the clipboard.
+ *
+ * @param editor
+ * The diagram editor.
+ * @param imageFormat
+ * The image format as integer, e.g.
+ * org.eclipse.swt.SWT.IMAGE_PNG or org.eclipse.swt.SWT.IMAGE_BMP
+ */
+ public static void copyToClipboard(DiagramEditor editor, int imageFormat) {
+ PictogramElement[] els = editor.getSelectedPictogramElements();
+ if (els.length > 0 && els[0] instanceof Diagram) {
+ els = ((Diagram) els[0]).getChildren().toArray(
+ new PictogramElement[] {});
+ }
+ int[] minMaxCoords = FMCUtil.getMinMaxCoords(els);
+ GraphicalViewer viewer = (GraphicalViewer) editor
+ .getAdapter(GraphicalViewer.class);
+ @SuppressWarnings("unchecked")
+ Collection<EditPart> selectedEditParts = new HashSet<EditPart>(
+ viewer.getSelectedEditParts());
+
+ if (selectedEditParts.isEmpty()) {
+ for (Object part : viewer.getEditPartRegistry().values()) {
+ if (part instanceof ShapeEditPart
+ && helper.isFMCNode(((ShapeEditPart) part)
+ .getPictogramElement())) {
+ selectedEditParts.add((ShapeEditPart) part);
+ } else if (part instanceof ConnectionDecoratorEditPart) {
+ selectedEditParts.add((ShapeEditPart) part);
+ }
+ }
+ }
+ Image scaledImage = GraphitiImageConverter.convertEditParts(
+ minMaxCoords, selectedEditParts);
+ try {
+ // Replaced due to Graphiti version update (0.10.0) -- Does not work
+ // on MACOS.
+ byte[] imageBytes = GraphitiUi.getImageService().convertImageToBytes(scaledImage, imageFormat);
+ //byte[] imageBytes = GraphitiUiInternal.getUiService().createImage(
+ // scaledImage, imageFormat);
+ Clipboard clipboard = Toolkit.getDefaultToolkit()
+ .getSystemClipboard();
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ java.awt.Image image = toolkit.createImage(imageBytes);
+ clipboard.setContents(new ImageTransferable(image), null);
+ } catch (Exception e) {
+ StatusManager.getManager().handle(
+ new Status(Status.ERROR, Activator.PLUGIN_ID,
+ "Error while copying to clipboard", e));
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/PasteFromClipboard.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/PasteFromClipboard.java
new file mode 100644
index 0000000..ed23359
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/PasteFromClipboard.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.clipboard;
+
+import java.awt.Graphics2D;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBufferInt;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.fmc.blockdiagram.editor.Activator;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramEditor;
+import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
+import org.eclipse.graphiti.ui.internal.GraphitiUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * This class is the main entry point for pasting from the clipboard.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class PasteFromClipboard {
+
+ private static final String IMG_TYPE = ".png";
+ /**
+ * Folder where the images will be saved to.
+ */
+ private static final String PASTED_IMAGES_FOLDER = ".images/";
+ private static final String CLIP_NAME = "clip";
+ private static final String IMAGE_PREFIX = "org.eclipse.fmc.";
+
+ /**
+ * Retrieves image from the clipboard and writes it to the disk to
+ * PASTED_IMAGES_FOLDER. Creates a imageId and registers it for the
+ * ImageProvider of the diagram.
+ *
+ * @param editor
+ * The diagram editor.
+ *
+ * @return Returns the imageId as String.
+ */
+ public static String pasteImagesFromClipboard(BlockDiagramEditor editor) {
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ String nextImageName = getNextImageName(editor);
+ if (clipboard.getAvailableDataFlavors().length == 0)
+ return null;
+ DataFlavor dataFlavor = clipboard.getAvailableDataFlavors()[0];
+ try {
+ Transferable contents = clipboard.getContents(dataFlavor);
+ Object transferData = contents.getTransferData(contents
+ .getTransferDataFlavors()[0]);
+ if (transferData instanceof BufferedImage) {
+ BufferedImage img = (BufferedImage) transferData;
+ writeImageToDisk(editor,
+ transformToSWTImage(Display.getDefault(), img));
+ return IMAGE_PREFIX + nextImageName;
+ } else if (transferData instanceof List) {
+ List<?> files = (List<?>) transferData;
+ for (Object f : files) {
+ if (f instanceof File) {
+ BufferedImage img = ImageIO.read((File) f);
+ writeImageToDisk(editor,
+ transformToSWTImage(Display.getDefault(), img));
+ return IMAGE_PREFIX + nextImageName;
+ }
+ }
+ }
+ } catch (IOException e) {
+ StatusManager.getManager().handle(
+ new Status(Status.ERROR, Activator.PLUGIN_ID,
+ "Error while writing copied image to disk", e));
+ } catch (UnsupportedFlavorException e) {
+ StatusManager.getManager().handle(
+ new Status(Status.ERROR, Activator.PLUGIN_ID,
+ "Error while pasting from clipboard", e));
+ }
+ return null;
+ }
+
+ /**
+ * Writes the image to the image folder.
+ *
+ * @param editor
+ * The diagram editor.
+ * @param img
+ * The image to be written to the disk.
+ */
+ private static void writeImageToDisk(BlockDiagramEditor editor, Image img) {
+ ImageLoader loader = new ImageLoader();
+ loader.data = new ImageData[] { img.getImageData() };
+ String imageName = getNextImageName(editor);
+ String imageNameWithEnding = imageName + IMG_TYPE;
+ String absoluteImagePath = getImageFolder(editor).toFileString() + "\\"
+ + imageNameWithEnding;
+ loader.save(absoluteImagePath, SWT.IMAGE_PNG);
+ GraphitiUIPlugin.getDefault().getImageRegistry()
+ .put(IMAGE_PREFIX + imageName, img);
+ }
+
+ /**
+ * Transforms an AWT Image into an SWT Image.
+ *
+ * @param display
+ * The SWT Display.
+ * @param awtImage
+ * The AWT Image to be transformed.
+ * @return The SWT Image that has been created.
+ * @throws Exception
+ */
+ private static Image transformToSWTImage(Display display,
+ java.awt.Image awtImage) {
+ int width = awtImage.getWidth(null);
+ int height = awtImage.getHeight(null);
+ BufferedImage bufferedImage = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = bufferedImage.createGraphics();
+ g2d.drawImage(awtImage, 0, 0, null);
+ g2d.dispose();
+ int[] data = ((DataBufferInt) bufferedImage.getData().getDataBuffer())
+ .getData();
+ ImageData imageData = new ImageData(width, height, 24, new PaletteData(
+ 0xFF0000, 0x00FF00, 0x0000FF));
+ imageData.setPixels(0, 0, data.length, data, 0);
+ Image swtImage = new Image(display, imageData);
+ return swtImage;
+ }
+
+ /**
+ * Returns the next available image name starting with CLIP_NAME + 1.
+ *
+ * @param editor
+ * The diagram editor.
+ * @return
+ */
+ private static String getNextImageName(BlockDiagramEditor editor) {
+ File[] files = loadClipFiles(editor);
+ int max = -1;
+ for (File file : files) {
+ String name = file.getName().split("\\.")[0];
+ Integer num = Integer.valueOf(name.replace(CLIP_NAME, ""));
+ if (num > max)
+ max = num;
+ }
+ return CLIP_NAME + (max + 1);
+ }
+
+ /**
+ * Creates the image folder if it does not already exist. Returns the
+ * already pasted files which have already been written to the disk.
+ *
+ * @param editor
+ * The diagram editor.
+ * @return Array of image files stored to the image folder.
+ */
+ private static File[] loadClipFiles(BlockDiagramEditor editor) {
+ URI resolvedImagesURI = getImageFolder(editor);
+ File f = new File(resolvedImagesURI.toFileString());
+ if (!f.exists()) {
+ if (!f.mkdir())
+ throw new IllegalStateException("Cannot create image folder: "
+ + f.getAbsolutePath());
+ }
+ File[] files = f.listFiles();
+ if (files == null)
+ files = new File[] {};
+ return files;
+ }
+
+ /**
+ * Registers all images that have been pasted to the image provider of the
+ * editor.
+ *
+ * @param editor
+ * The diagram editor.
+ * @throws MalformedURLException
+ */
+ public static void registerClipImages(BlockDiagramEditor editor)
+ throws MalformedURLException {
+ for (File file : loadClipFiles(editor)) {
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(new URL(
+ "file:///" + file.getAbsolutePath()));
+ if (GraphitiUIPlugin.getDefault().getImageRegistry()
+ .get(IMAGE_PREFIX + file.getName().replace(IMG_TYPE, "")) == null)
+ GraphitiUIPlugin
+ .getDefault()
+ .getImageRegistry()
+ .put(IMAGE_PREFIX
+ + file.getName().replace(IMG_TYPE, ""),
+ descriptor);
+ }
+ }
+
+ /**
+ * Returns the URI to the folder containing the image files.
+ *
+ * @param editor
+ * The diagram editor.
+ * @return URI to the folder images are pasted and written to.
+ */
+ private static URI getImageFolder(BlockDiagramEditor editor) {
+ DiagramEditorInput input = (DiagramEditorInput) editor.getEditorInput();
+ String projectName = URI.createURI(input.getUriString()).segment(1);
+ URI projectURI = URI.createPlatformResourceURI(projectName, true);
+ URI imagesURI = URI.createURI(projectURI.toString() + "/"
+ + PASTED_IMAGES_FOLDER);
+ URI resolvedImagesURI = CommonPlugin.resolve(imagesURI);
+ return resolvedImagesURI;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/GraphitiImageConverter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/GraphitiImageConverter.java
new file mode 100644
index 0000000..effe06d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/GraphitiImageConverter.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.clipboard.img;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.SWTGraphics;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.graphiti.ui.internal.fixed.FixedScaledGraphics;
+import org.eclipse.graphiti.ui.internal.parts.CompositeConnectionEditPart;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+@SuppressWarnings("restriction")
+/**
+ * This class is responsible for converting the selected Edit Parts to an image.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class GraphitiImageConverter {
+
+ private static final int SCALE_FACTOR = 1;
+
+ /**
+ * Private constructor. Object cannot be initialized.
+ */
+ private GraphitiImageConverter(){}
+
+ /**
+ * Converts the selected edit parts to GEF figures and paints them to a
+ * scaled image. If more than one Shape is selected also the connections
+ * between the figures are drawn. This is also realized for connections
+ * between nested shapes.
+ *
+ *
+ * @param minMaxCoords
+ * The maximum and minimum coordinates. minMaxCoords[0] = min
+ * width, minMaxCoords[1] = max width, minMaxCoords[2] = min
+ * height, minMaxCoords[3] = max height
+ * @param selectedEditParts
+ * The selected edit part to be converted to an image.
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static Image convertEditParts(int[] minMaxCoords,
+ Collection<EditPart> selectedEditParts) {
+ Collection<EditPart> selectedEditPartsWithNested = new HashSet<EditPart>(
+ selectedEditParts);
+ GraphicalEditPart selectionEditpart;
+ int width = minMaxCoords[2] - minMaxCoords[0];
+ int height = minMaxCoords[3] - minMaxCoords[1];
+ Image scaledImage = GraphitiImageConverter.createTransparentImage(width,
+ height);
+ FixedScaledGraphics graphics = GraphitiImageConverter.createGraphics(
+ minMaxCoords, scaledImage);
+ Set<ConnectionEditPart> connectionEditParts = new HashSet<ConnectionEditPart>();
+ for (EditPart part : selectedEditParts) {
+ selectionEditpart = (GraphicalEditPart) part;
+ IFigure selectionFigure = selectionEditpart.getFigure();
+ selectionFigure.paint(graphics);
+ connectionEditParts
+ .addAll(selectionEditpart.getSourceConnections());
+ Collection<EditPart> nested = findAllNested(selectionEditpart,
+ new ArrayList<EditPart>());
+ selectedEditPartsWithNested.addAll(nested);
+ for (EditPart editpart : nested) {
+ if (editpart instanceof GraphicalEditPart)
+ connectionEditParts.addAll(((GraphicalEditPart) editpart)
+ .getSourceConnections());
+ }
+ }
+ for (ConnectionEditPart editPart : connectionEditParts) {
+ if (selectedEditPartsWithNested.contains(editPart.getSource())
+ && selectedEditPartsWithNested.contains(editPart
+ .getTarget())) {
+ IFigure connectionFigure = editPart.getFigure();
+ connectionFigure.paint(graphics);
+ if (editPart instanceof CompositeConnectionEditPart) {
+ CompositeConnectionEditPart compositePart = (CompositeConnectionEditPart) editPart;
+ for (ConnectionEditPart childEdit : compositePart
+ .getEditParts()) {
+ IFigure connectionFigureChild = childEdit.getFigure();
+ connectionFigureChild.paint(graphics);
+ }
+ }
+ }
+ }
+ return scaledImage;
+ }
+
+ /**
+ * Finds all nested edit parts in an edit part container.
+ *
+ * @param container
+ * The container.
+ * @param nested
+ * The nested edit parts already found.
+ * @return The list of all nested edit parts.
+ */
+ private static Collection<EditPart> findAllNested(EditPart container,
+ Collection<EditPart> nested) {
+ for (Object child : container.getChildren()) {
+ if (child instanceof EditPart) {
+ nested.add((EditPart) child);
+ findAllNested((EditPart) child, nested);
+ }
+ }
+ return nested;
+ }
+
+ /**
+ * Creates a new FixedScaledGraphics object.
+ *
+ * @param minMaxCoords
+ * The maximum and minimum coordinates. minMaxCoords[0] = min
+ * width, minMaxCoords[1] = max width, minMaxCoords[2] = min
+ * height, minMaxCoords[3] = max height
+ * @param scaledImage The scaled image to create the FixedScaledGraphics object from.
+ * @return The newly created FixedScaledGraphics object.
+ */
+ private static FixedScaledGraphics createGraphics(int[] minMaxCoords,
+ Image scaledImage) {
+ GC gc = new GC(scaledImage);
+ FixedScaledGraphics graphics = new FixedScaledGraphics(new SWTGraphics(
+ gc));
+ graphics.scale(SCALE_FACTOR);
+ graphics.translate(-minMaxCoords[0], -minMaxCoords[1]);
+ return graphics;
+ }
+
+ /**
+ * Creates a transparent image object initialized with color 254, 254, 254. This
+ * color is set as the transparent color.
+ * @param width The width of the to be created image object.
+ * @param height The height of the to be created image object.
+ * @return The new transparent Image object.
+ */
+ private static Image createTransparentImage(int width, int height) {
+ RGB almostWhite = new RGB(254, 254, 254);
+ Image scaledImage = new Image(Display.getDefault(), width, height);
+ ImageData imageData = scaledImage.getImageData();
+ int whitePixel = imageData.palette.getPixel(almostWhite);
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ imageData.setPixel(x, y, whitePixel);
+ }
+ }
+ imageData.transparentPixel = whitePixel;
+ scaledImage = new Image(Display.getDefault(), imageData);
+ return scaledImage;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/ImageTransferable.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/ImageTransferable.java
new file mode 100644
index 0000000..77fff8b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/ImageTransferable.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.clipboard.img;
+
+import java.awt.Image;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+
+import javax.swing.TransferHandler;
+
+/**
+ * Transfer Handler for copying image data to the clipboard.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("serial")
+public class ImageTransferable extends TransferHandler implements Transferable {
+
+ private static final DataFlavor flavors[] = { DataFlavor.imageFlavor };
+ private Image image;
+
+ /**
+ * Default constructor with image.
+ *
+ * @param img
+ * The image to be copied.
+ */
+ public ImageTransferable(Image img) {
+ this.image = img;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor)
+ */
+ @Override
+ public Object getTransferData(DataFlavor flavor)
+ throws UnsupportedFlavorException, IOException {
+ if (isDataFlavorSupported(flavor)) {
+ return image;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
+ */
+ @Override
+ public DataFlavor[] getTransferDataFlavors() {
+ return flavors.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)
+ */
+ @Override
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ return flavor.equals(DataFlavor.imageFlavor);
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/package.html
new file mode 100644
index 0000000..2f4c53e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/img/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains classes responsible for copy and paste of images to the clipboard.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/package.html
new file mode 100644
index 0000000..029c931
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/clipboard/package.html
@@ -0,0 +1,7 @@
+<html>
+<body>This package contains classes that are responsible for copy
+ and paste shapes and connections to external programs, e.g. as image or
+ MS-EMF for Powerpoint.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramFeatureProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramFeatureProvider.java
new file mode 100644
index 0000000..0214ad5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramFeatureProvider.java
@@ -0,0 +1,633 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.diagram;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.extension.CompositeFeatureProvider;
+import org.eclipse.fmc.blockdiagram.editor.extension.FeatureProviderExtensionFactory;
+import org.eclipse.fmc.blockdiagram.editor.features.ContainerTextDirectEditingFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.DeepRemoveFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.DotsConnectionRemoveFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.ReconnectionFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.ShapeCopyFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.ShapeMoveFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.ShapePasteFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.TextDirectEditingFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AccessAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AgentAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AnchorAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.AreaBorderAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.BraceAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommonFeatureAreaAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.CommunicationChannelAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsConnectionAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsShapeAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.HumanAgentAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.ImageAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.InvisibleShapeAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.StorageAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.StructureVarianceAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.TextAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.create.ConnectionCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.create.ShapeCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.AddTextToConnectionCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.BringToFrontCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.CopyToClipboardCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.FlipHorizontallyCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.FlipVerticallyCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.HideContentCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.LayoutConnectionCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.PaintFormatCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.RotateCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.SendToBackCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.UnhideContentCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.AreaBorderResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.BraceResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.ChannelResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.ContainerResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.DotsShapeResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.ResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.resize.FMCNodeResizeFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+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.IDeleteFeature;
+import org.eclipse.graphiti.features.IDirectEditingFeature;
+import org.eclipse.graphiti.features.IFeature;
+import org.eclipse.graphiti.features.ILayoutFeature;
+import org.eclipse.graphiti.features.IMoveShapeFeature;
+import org.eclipse.graphiti.features.IPasteFeature;
+import org.eclipse.graphiti.features.IReconnectionFeature;
+import org.eclipse.graphiti.features.IRemoveFeature;
+import org.eclipse.graphiti.features.IResizeShapeFeature;
+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.IDeleteContext;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.features.context.ILayoutContext;
+import org.eclipse.graphiti.features.context.IMoveShapeContext;
+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.IRemoveContext;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.custom.ICustomFeature;
+import org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature;
+import org.eclipse.graphiti.features.impl.IIndependenceSolver;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Text;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
+
+/**
+ * This class maps the features of the editor depending on the respective
+ * context.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramFeatureProvider extends DefaultFeatureProvider {
+
+ private static final String MOUSE_Y = "mouseY";
+ private static final String MOUSE_X = "mouseX";
+ private static final String CLASS_EXTENSION = "class";
+ private static final String FEATUREPROVIDER_EXTENSIONPOINT_ID = "org.eclipse.fmc.blockdiagram.editor.featureprovider";
+ public static final int CREATE_FEATURE_AGENT = 0;
+ public static final int CREATE_FEATURE_AGENT_L = 1;
+ public static final int CREATE_FEATURE_AGENT_U = 2;
+ public static final int CREATE_FEATURE_STORAGE = 3;
+ public static final int CREATE_FEATURE_STORAGE_L = 4;
+ public static final int CREATE_FEATURE_STORAGE_U = 5;
+ public static final int CREATE_FEATURE_HUMAN_AGENT = 6;
+ public static final int CREATE_FEATURE_STRUCTURE_VARIANCE = 7;
+ public static final int CREATE_FEATURE_TEXT = 8;
+
+ public static final int CREATE_FEATURE_COMMON_FEATURE_AREA = 9;
+ public static final int CREATE_FEATURE_BRACE = 10;
+ public static final int CREATE_FEATURE_AREA_BORDER = 11;
+ public static final int CREATE_FEATURE_DOTS = 12;
+ public static final int CREATE_FEATURE_ANCHOR = 13;
+
+ public static final int CREATE_CON_UNI_ACCESS_MH = 1;
+ public static final int CREATE_CON_UNI_ACCESS_FF = 2;
+ public static final int CREATE_CON_BI_ACCESS_MH = 3;
+ public static final int CREATE_CON_BI_ACCESS_FF = 4;
+ public static final int CREATE_CON_MODIFY_ACCESS = 0;
+ public static final int CREATE_CON_BI_COMM_CH_MH = 5;
+ public static final int CREATE_CON_BI_COMM_CH_FF = 6;
+ public static final int CREATE_CON_UNI_COMM_CH_MH = 7;
+ public static final int CREATE_CON_UNI_COMM_CH_FF = 8;
+ public static final int CREATE_CON_REQRESP_COMM_CH_MH = 9;
+ public static final int CREATE_CON_REQRESP_COMM_CH_FF = 10;
+ public static final int CREATE_CON_DOTS_MH = 12;
+ public static final int CREATE_CON_DOTS_FF = 11;
+
+ /**
+ * Instance of the FMCTypeChecker to check the types.
+ */
+ protected FMCTypeChecker typeChecker = FMCTypeCheckerFactory.getInstance();
+ /**
+ * Instance of the PaintFormatCustomFeature to store the state which needs
+ * to be stored until the format is pasted.
+ */
+ protected PaintFormatCustomFeature paintFormatFeature;
+ /**
+ * This feature provider can be extended by further feature providers via
+ * extension points. The strategy is to lookup further feature if no other
+ * feature from this class matches the context.
+ */
+ protected CompositeFeatureProvider compositeFP;
+ /**
+ * Main constructor. Initializes the composite feature and sets a custom
+ * IIndependenceSolver to inject the simplified type system.
+ *
+ * @param diagramTypeProvider The diagram type provider.
+ */
+ public BlockDiagramFeatureProvider(IDiagramTypeProvider diagramTypeProvider) {
+ super(diagramTypeProvider);
+ compositeFP = new CompositeFeatureProvider(diagramTypeProvider);
+ try {
+ addFeatureProvidersFromExtensionPoint(diagramTypeProvider);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ setIndependenceSolver(new IIndependenceSolver() {
+
+ @Override
+ public String getKeyForBusinessObject(Object bo) {
+ if (bo instanceof FMCType) {
+ FMCType type = (FMCType) bo;
+ return type.name();
+ } else
+ return null;
+ }
+
+ @Override
+ public Object getBusinessObjectForKey(String key) {
+ return FMCType.valueOf(key);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeatureProvider#
+ * getDragAndDropFeatures
+ * (org.eclipse.graphiti.features.context.IPictogramElementContext)
+ */
+ @Override
+ public IFeature[] getDragAndDropFeatures(IPictogramElementContext context) {
+ return super.getCreateConnectionFeatures();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#getAddFeature
+ * (org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public IAddFeature getAddFeature(IAddContext context) {
+ ShapeStyle style;
+ switch ((FMCType) context.getNewObject()) {
+ case Agent:
+ style = (ShapeStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY);
+ return new AgentAddFeature(this, style);
+ case HumanAgent:
+ return new HumanAgentAddFeature(this);
+ case Storage:
+ style = (ShapeStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY);
+ return new StorageAddFeature(this, style);
+ case StructureVariance:
+ return new StructureVarianceAddFeature(this);
+ case BidirectionalAccess:
+ case UnidirectionalAccess:
+ case ModifyAccess:
+ return new AccessAddFeature(
+ this,
+ (ConnectionStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ case BidirectionalCommChannel:
+ case UnidirectionalCommChannel:
+ case ReqRespCommChannel:
+ return new CommunicationChannelAddFeature(
+ this,
+ (ConnectionStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ case Dots:
+ return new DotsConnectionAddFeature(
+ this,
+ (ConnectionStyle) context
+ .getProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY));
+ case DotsShape:
+ return new DotsShapeAddFeature(this);
+ case Image:
+ return new ImageAddFeature(this, context.getProperty("imageid")
+ .toString());
+ case Text:
+ return new TextAddFeature(this);
+ case CommonFeatureArea:
+ return new CommonFeatureAreaAddFeature(this);
+ case Brace:
+ return new BraceAddFeature(this);
+ case AreaBorder:
+ return new AreaBorderAddFeature(this);
+ case Invisible:
+ return new InvisibleShapeAddFeature(this);
+ case Anchor:
+ return new AnchorAddFeature(this);
+ default:
+ return compositeFP.getAddFeature(context);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#link(org.eclipse
+ * .graphiti.mm.pictograms.PictogramElement, java.lang.Object)
+ */
+ @Override
+ public void link(PictogramElement pictogramElement, Object businessObject) {
+ super.link(pictogramElement, businessObject);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#getCreateFeatures
+ * ()
+ */
+ @Override
+ public ICreateFeature[] getCreateFeatures() {
+ ICreateFeature[] features = new ICreateFeature[14];
+ features[CREATE_FEATURE_AGENT] = new ShapeCreateFeature(this, "Agent",
+ "Agent", FMCType.Agent, BlockDiagramImageProvider.ICON_AGENT);
+
+ features[CREATE_FEATURE_AGENT_L] = new ShapeCreateFeature(this,
+ "Agent L", "Agent L", FMCType.Agent, ShapeStyle.L,
+ BlockDiagramImageProvider.ICON_AGENT_L);
+
+ features[CREATE_FEATURE_AGENT_U] = new ShapeCreateFeature(this,
+ "Agent U", "Agent U", FMCType.Agent, ShapeStyle.U,
+ BlockDiagramImageProvider.ICON_AGENT_U);
+
+ features[CREATE_FEATURE_STORAGE] = new ShapeCreateFeature(this,
+ "Storage", "Storage", FMCType.Storage,
+ BlockDiagramImageProvider.ICON_STORAGE);
+
+ features[CREATE_FEATURE_STORAGE_L] = new ShapeCreateFeature(this,
+ "Storage_L", "Storage_L", FMCType.Storage, ShapeStyle.L,
+ BlockDiagramImageProvider.ICON_STORAGE_L);
+
+ features[CREATE_FEATURE_STORAGE_U] = new ShapeCreateFeature(this,
+ "Storage_U", "Storage_U", FMCType.Storage, ShapeStyle.U,
+ BlockDiagramImageProvider.ICON_STORAGE_U);
+
+ features[CREATE_FEATURE_HUMAN_AGENT] = new ShapeCreateFeature(this,
+ "HumanAgent", "HumanAgent", FMCType.HumanAgent,
+ BlockDiagramImageProvider.ICON_HUMAN_AGENT);
+
+ features[CREATE_FEATURE_STRUCTURE_VARIANCE] = new ShapeCreateFeature(
+ this, "StructureVariance", "StructureVariance",
+ FMCType.StructureVariance,
+ BlockDiagramImageProvider.ICON_STRUCTURE_VARIANCE);
+
+ features[CREATE_FEATURE_TEXT] = new ShapeCreateFeature(this, "Text",
+ "", FMCType.Text, BlockDiagramImageProvider.ICON_TEXT);
+
+ features[CREATE_FEATURE_COMMON_FEATURE_AREA] = new ShapeCreateFeature(
+ this, "Common Feature Area", "", FMCType.CommonFeatureArea,
+ BlockDiagramImageProvider.ICON_COMMON_FEATURE_AREA);
+
+ features[CREATE_FEATURE_BRACE] = new ShapeCreateFeature(this, "Brace",
+ "", FMCType.Brace, BlockDiagramImageProvider.ICON_BRACE);
+
+ features[CREATE_FEATURE_AREA_BORDER] = new ShapeCreateFeature(this,
+ "AreaBorder", "", FMCType.AreaBorder,
+ BlockDiagramImageProvider.ICON_AREABORDER);
+
+ features[CREATE_FEATURE_DOTS] = new ShapeCreateFeature(this, "Dots",
+ "", FMCType.DotsShape, BlockDiagramImageProvider.ICON_DOTS);
+
+ features[CREATE_FEATURE_ANCHOR] = new ShapeCreateFeature(this,
+ "Anchor", "", FMCType.Anchor, BlockDiagramImageProvider.ICON_ANCHOR);
+
+ return features;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeatureProvider#
+ * getCreateConnectionFeatures()
+ */
+ @Override
+ public ICreateConnectionFeature[] getCreateConnectionFeatures() {
+ return new ICreateConnectionFeature[] {
+ new ConnectionCreateFeature(this, "Modify Access", "",
+ FMCType.ModifyAccess, ConnectionStyle.COMPOSITE,
+ BlockDiagramImageProvider.ICON_MODIFY_ACCESS),
+ new ConnectionCreateFeature(this, "Unidirectional Access", "",
+ FMCType.UnidirectionalAccess,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_ACCESS_MH),
+ new ConnectionCreateFeature(this, "Unidirectional Access", "",
+ FMCType.UnidirectionalAccess, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_ACCESS),
+
+ new ConnectionCreateFeature(this, "Bidirectional Access", "",
+ FMCType.BidirectionalAccess, ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_ACCESS_MH),
+ new ConnectionCreateFeature(this, "Bidirectional Access", "",
+ FMCType.BidirectionalAccess, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_ACCESS),
+ new ConnectionCreateFeature(this,
+ "Bidirectional Communication Channel", "",
+ FMCType.BidirectionalCommChannel,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_COMM_CHANNEL_MH),
+ new ConnectionCreateFeature(this,
+ "Bidirectional Communication Channel", "",
+ FMCType.BidirectionalCommChannel,
+ ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_BIDIRECTIONAL_COMM_CHANNEL),
+
+ new ConnectionCreateFeature(this,
+ "Unidirectional Communication Channel", "",
+ FMCType.UnidirectionalCommChannel,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_COMM_CHANNEL_MH),
+ new ConnectionCreateFeature(this,
+ "Unidirectional Communication Channel", "",
+ FMCType.UnidirectionalCommChannel,
+ ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_COMM_CHANNEL),
+
+ new ConnectionCreateFeature(this,
+ "Request-Response Communication Channel", "",
+ FMCType.ReqRespCommChannel, ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_REQ_RESP_COMM_CHANNEL_MH),
+ new ConnectionCreateFeature(this,
+ "Request-Response Communication Channel", "",
+ FMCType.ReqRespCommChannel, ConnectionStyle.NORMAL,
+ BlockDiagramImageProvider.ICON_REQ_RESP_COMM_CHANNEL),
+
+ new ConnectionCreateFeature(this, "Dots", "", FMCType.Dots,
+ ConnectionStyle.NORMAL, BlockDiagramImageProvider.ICON_DOTS),
+ new ConnectionCreateFeature(this, "Dots", "", FMCType.Dots,
+ ConnectionStyle.MANHATTAN,
+ BlockDiagramImageProvider.ICON_DOTS_MH) };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getMoveShapeFeature
+ * (org.eclipse.graphiti.features.context.IMoveShapeContext)
+ */
+ @Override
+ public IMoveShapeFeature getMoveShapeFeature(IMoveShapeContext context) {
+ PictogramElement container = (PictogramElement) context
+ .getPictogramElement().eContainer();
+ if (typeChecker.isHumanAgent(container)
+ && !typeChecker.isFMCNode(context.getPictogramElement())
+ && !typeChecker.isComment(context.getPictogramElement())) {
+ return new DefaultMoveShapeFeature(this);
+ } else
+ return new ShapeMoveFeature(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeatureProvider#
+ * getDirectEditingFeature
+ * (org.eclipse.graphiti.features.context.IDirectEditingContext)
+ */
+ @Override
+ public IDirectEditingFeature getDirectEditingFeature(
+ IDirectEditingContext context) {
+ if (context.getGraphicsAlgorithm() instanceof Text
+ || context.getGraphicsAlgorithm() instanceof MultiText)
+ return new TextDirectEditingFeature(this);
+ else if (!typeChecker.isBrace(context.getPictogramElement())
+ && context.getPictogramElement() instanceof ContainerShape) {
+ return new ContainerTextDirectEditingFeature(this);
+ } else {
+ return super.getDirectEditingFeature(context);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getResizeShapeFeature
+ * (org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ @Override
+ public IResizeShapeFeature getResizeShapeFeature(IResizeShapeContext context) {
+ PictogramElement container = (PictogramElement) context
+ .getPictogramElement().eContainer();
+ // Human Agent Figures cannot be resized
+ if (typeChecker.isHumanAgent(container)
+ && !typeChecker.isFMCNode(context.getPictogramElement())
+ && !typeChecker.isComment(context.getPictogramElement())) {
+ return null;
+ } else if (typeChecker.isBrace(context.getPictogramElement())) {
+ return new BraceResizeFeature(this);
+ } else if (typeChecker.isAreaBorder(context.getPictogramElement())) {
+ return new AreaBorderResizeFeature(this);
+ } else if (typeChecker.isDots(context.getPictogramElement())) {
+ return new DotsShapeResizeFeature(this);
+ } else if (typeChecker.isCommunicationChannel(context.getPictogramElement())) {
+ return new ChannelResizeFeature(this);
+ } else if (typeChecker.isHumanAgent(context.getPictogramElement())) {
+ return new ContainerResizeFeature(this);
+ } else if (typeChecker.isAgent(context.getPictogramElement())
+ || typeChecker.isStorage(context.getPictogramElement())
+ || typeChecker.isStructureVariance(context.getPictogramElement())) {
+ return new FMCNodeResizeFeature(this);
+ }
+ return new ResizeFeature(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getRemoveFeature
+ * (org.eclipse.graphiti.features.context.IRemoveContext)
+ */
+ @Override
+ public IRemoveFeature getRemoveFeature(IRemoveContext context) {
+ if (context.getPictogramElement() instanceof Connection
+ && typeChecker.isDots(context.getPictogramElement())) {
+ return new DotsConnectionRemoveFeature(this);
+ } else
+ return new DeepRemoveFeature(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getDeleteFeature
+ * (org.eclipse.graphiti.features.context.IDeleteContext)
+ */
+ @Override
+ public IDeleteFeature getDeleteFeature(IDeleteContext context) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeatureProvider#
+ * getReconnectionFeature
+ * (org.eclipse.graphiti.features.context.IReconnectionContext)
+ */
+ @Override
+ public IReconnectionFeature getReconnectionFeature(
+ IReconnectionContext context) {
+ return new ReconnectionFeature(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#getLayoutFeature
+ * (org.eclipse.graphiti.features.context.ILayoutContext)
+ */
+ @Override
+ public ILayoutFeature getLayoutFeature(ILayoutContext context) {
+ return super.getLayoutFeature(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getCustomFeatures
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public ICustomFeature[] getCustomFeatures(ICustomContext context) {
+ ICustomFeature[] ret = super.getCustomFeatures(context);
+ List<ICustomFeature> retList = new ArrayList<ICustomFeature>();
+ for (int i = 0; i < ret.length; i++) {
+ retList.add(ret[i]);
+ }
+ retList.add(new CopyToClipboardCustomFeature(this));
+ retList.add(new BringToFrontCustomFeature(this));
+ retList.add(new SendToBackCustomFeature(this));
+ retList.add(new LayoutConnectionCustomFeature(this));
+ retList.add(new AddTextToConnectionCustomFeature(this));
+ if (this.paintFormatFeature == null) {
+ this.paintFormatFeature = new PaintFormatCustomFeature(this);
+ }
+ retList.add(this.paintFormatFeature);
+
+ retList.add(new RotateCustomFeature(this));
+ retList.add(new FlipHorizontallyCustomFeature(this));
+ retList.add(new FlipVerticallyCustomFeature(this));
+
+ retList.add(new HideContentCustomFeature(this));
+ retList.add(new UnhideContentCustomFeature(this));
+ retList.addAll(Arrays.asList(compositeFP.getCustomFeatures(context)));
+ ret = retList.toArray(ret);
+ return ret;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getCopyFeature
+ * (org.eclipse.graphiti.features.context.ICopyContext)
+ */
+ @Override
+ public ICopyFeature getCopyFeature(ICopyContext context) {
+ return new ShapeCopyFeature(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultFeatureProvider#getPasteFeature
+ * (org.eclipse.graphiti.features.context.IPasteContext)
+ */
+ @Override
+ public IPasteFeature getPasteFeature(IPasteContext context) {
+ DiagramBehavior diagramBehavior = (DiagramBehavior) this
+ .getDiagramTypeProvider().getDiagramBehavior();
+ Point mouseLoc = diagramBehavior.getMouseLocation();
+ context.putProperty(MOUSE_X, mouseLoc.x());
+ context.putProperty(MOUSE_Y, mouseLoc.y());
+ return new ShapePasteFeature(this);
+ }
+
+ /**
+ * Adds new feature providers from extension providers.
+ *
+ * @param diagramTypeProvider The diagram type provider.
+ * @throws CoreException
+ */
+ private void addFeatureProvidersFromExtensionPoint(
+ IDiagramTypeProvider diagramTypeProvider) throws CoreException {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor(FEATUREPROVIDER_EXTENSIONPOINT_ID);
+ for (IConfigurationElement element : extensions) {
+ FeatureProviderExtensionFactory entry = (FeatureProviderExtensionFactory) element
+ .createExecutableExtension(CLASS_EXTENSION);
+ compositeFP.addFeatureProvider(entry
+ .createFeatureProviderExtension(diagramTypeProvider));
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramImageProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramImageProvider.java
new file mode 100644
index 0000000..939afb9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramImageProvider.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.diagram;
+
+import org.eclipse.graphiti.ui.platform.AbstractImageProvider;
+
+/**
+ * The Image provider is responsible to register all images used by the editor
+ * and making them accessible through the given ids. For example,
+ * org.eclipse.fmc.blockdiagram.editor.algorithm.node.HumanAgent can be used to
+ * access the icon of a Human Agent.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramImageProvider extends AbstractImageProvider {
+
+ /**
+ * Size postfix for 16 pixel images.
+ */
+ public static final String SIZE_16 = "_16";
+ /**
+ * FMC namespace for images.
+ */
+ private static final String PREFIX = "org.eclipse.fmc.";
+
+ public static final String ICON_HUMAN_AGENT = PREFIX + "IconHumanAgent";
+ public static final String ICON_AGENT = PREFIX + "IconAgent";
+ public static final String ICON_AGENT_L = PREFIX + "IconAgent_L";
+ public static final String ICON_AGENT_U = PREFIX + "IconAgent_U";
+ public static final String ICON_STRUCTURE_VARIANCE = PREFIX
+ + "IconStructureVariance";
+ public static final String ICON_CHANNEL = PREFIX + "IconChannel";
+ public static final String ICON_STORAGE = PREFIX + "IconStorage";
+ public static final String ICON_STORAGE_L = PREFIX + "IconStorage_L";
+ public static final String ICON_STORAGE_U = PREFIX + "IconStorage_U";
+ public static final String ICON_UNIDIRECTIONAL_ACCESS = PREFIX
+ + "IconUnidirectionalAccess";
+ public static final String ICON_UNIDIRECTIONAL_ACCESS_MH = PREFIX
+ + "IconUnidirectionalAccessMh";
+ public static final String ICON_BIDIRECTIONAL_ACCESS = PREFIX
+ + "IconBidirectionalAccess";
+ public static final String ICON_MODIFY_ACCESS = PREFIX + "IconModifyAccess";
+ public static final String ICON_BIDIRECTIONAL_ACCESS_MH = PREFIX
+ + "IconBidirectionalAccessMh";
+ public static final String ICON_UNIDIRECTIONAL_COMM_CHANNEL = PREFIX
+ + "IconUnidirectionalCommunicationChannel";
+ public static final String ICON_UNIDIRECTIONAL_COMM_CHANNEL_MH = PREFIX
+ + "IconUnidirectionalCommunicationChannelMh";
+ public static final String ICON_BIDIRECTIONAL_COMM_CHANNEL = PREFIX
+ + "IconBidirectionalCommunicationChannel";
+ public static final String ICON_BIDIRECTIONAL_COMM_CHANNEL_MH = PREFIX
+ + "IconBidirectionalCommunicationChannelMh";
+ public static final String ICON_REQ_RESP_COMM_CHANNEL = PREFIX
+ + "IconRequestResponseCommunicationChannel";
+ public static final String ICON_REQ_RESP_COMM_CHANNEL_MH = PREFIX
+ + "IconRequestResponseCommunicationChannelMh";
+ public static final String ICON_DOTS = PREFIX + "Dots";
+ public static final String ICON_DOTS_MH = PREFIX + "DotsMh";
+ public static final String ICON_ANCHOR = PREFIX + "Anchor";
+ public static final String ICON_TEXT = PREFIX + "Text";
+ public static final String ICON_COMMON_FEATURE_AREA = PREFIX
+ + "IconCommonFeatureArea";
+ public static final String ICON_BRACE = PREFIX + "IconBrace";
+ public static final String ICON_AREABORDER = PREFIX + "IconAreaBorder";
+
+ public static final String ICON_COPY = PREFIX + "Copy";
+ public static final String ICON_PASTE = PREFIX + "Paste";
+ public static final String ICON_COPY_AS_EMF = PREFIX + "CopyAsEMF";
+ public static final String ICON_COPY_AS_IMG = PREFIX + "CopyAsicons";
+ public static final String ICON_SEND_TO_BACK = PREFIX + "SendBack";
+ public static final String ICON_BRING_TO_FRONT = PREFIX + "BringFront";
+ public static final String ICON_FORMAT_PAINTER = PREFIX + "FormatPainter";
+
+ public static final String ICON_EDIT_SHAPE = PREFIX + "EditShape";
+ public static final String ICON_ROTATE = PREFIX + "Rotate";
+ public static final String ICON_FLIP_HORIZONTALLY = PREFIX
+ + "FlipHorizontally";
+ public static final String ICON_FLIP_VERTICALLY = PREFIX + "FlipVertically";
+ public static final String ICON_HIDE_CONTENT = PREFIX + "HideContent";
+ public static final String ICON_UNHIDE_CONTENT = PREFIX + "ShowContent";
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.platform.AbstractImageProvider#addAvailableImages
+ * ()
+ */
+ protected void addAvailableImages() {
+ addImageFilePath(ICON_HUMAN_AGENT, "icons/palette/humanAgent.png");
+ addImageFilePath(ICON_AGENT, "icons/palette/agent.png");
+ addImageFilePath(ICON_AGENT + SIZE_16, "icons/palette/agent_16.png");
+ addImageFilePath(ICON_AGENT_L, "icons/palette/agent_l.png");
+ addImageFilePath(ICON_AGENT_U, "icons/palette/agent_u.png");
+ addImageFilePath(ICON_STRUCTURE_VARIANCE,
+ "icons/palette/structureVariance.png");
+ addImageFilePath(ICON_CHANNEL, "icons/palette/channel.png");
+ addImageFilePath(ICON_STORAGE, "icons/palette/storage.png");
+ addImageFilePath(ICON_STORAGE + SIZE_16, "icons/palette/storage_16.png");
+ addImageFilePath(ICON_STORAGE_L, "icons/palette/storage_l.png");
+ addImageFilePath(ICON_STORAGE_U, "icons/palette/storage_u.png");
+
+ addImageFilePath(ICON_UNIDIRECTIONAL_ACCESS,
+ "icons/palette/unidirAccess.png");
+ addImageFilePath(ICON_UNIDIRECTIONAL_ACCESS + SIZE_16,
+ "icons/palette/unidirAccess_16.png");
+ addImageFilePath(ICON_UNIDIRECTIONAL_ACCESS_MH,
+ "icons/palette/unidirAccess_mh.png");
+ addImageFilePath(ICON_BIDIRECTIONAL_ACCESS,
+ "icons/palette/biAccess.png");
+ addImageFilePath(ICON_BIDIRECTIONAL_ACCESS_MH,
+ "icons/palette/biAccess_mh.png");
+ addImageFilePath(ICON_MODIFY_ACCESS, "icons/palette/modifyAccess.png");
+ addImageFilePath(ICON_MODIFY_ACCESS + SIZE_16,
+ "icons/palette/modifyAccess_16.png");
+ addImageFilePath(ICON_UNIDIRECTIONAL_COMM_CHANNEL,
+ "icons/palette/unidirCommChannel.png");
+ addImageFilePath(ICON_UNIDIRECTIONAL_COMM_CHANNEL + SIZE_16,
+ "icons/palette/unidirCommChannel_16.png");
+ addImageFilePath(ICON_UNIDIRECTIONAL_COMM_CHANNEL_MH,
+ "icons/palette/unidirCommChannel_mh.png");
+ addImageFilePath(ICON_BIDIRECTIONAL_COMM_CHANNEL,
+ "icons/palette/biCommChannel.png");
+ addImageFilePath(ICON_BIDIRECTIONAL_COMM_CHANNEL_MH,
+ "icons/palette/biCommChannel_mh.png");
+ addImageFilePath(ICON_REQ_RESP_COMM_CHANNEL,
+ "icons/palette/reqRespCommChannel.png");
+ addImageFilePath(ICON_REQ_RESP_COMM_CHANNEL + SIZE_16,
+ "icons/palette/reqRespCommChannel_16.png");
+ addImageFilePath(ICON_REQ_RESP_COMM_CHANNEL_MH,
+ "icons/palette/reqRespCommChannel_mh.png");
+
+ addImageFilePath(ICON_DOTS, "icons/palette/dots.png");
+ addImageFilePath(ICON_DOTS_MH, "icons/palette/dots_mh.png");
+ addImageFilePath(ICON_TEXT, "icons/palette/text.png");
+ addImageFilePath(ICON_COMMON_FEATURE_AREA,
+ "icons/palette/commonFeatureArea.png");
+ addImageFilePath(ICON_BRACE, "icons/palette/brace.png");
+ addImageFilePath(ICON_AREABORDER, "icons/palette/areaborder.png");
+ addImageFilePath(ICON_ANCHOR, "icons/palette/anchor.png");
+
+ addImageFilePath(ICON_PASTE, "icons/menu/edit-paste.png");
+ addImageFilePath(ICON_COPY, "icons/menu/edit-copy.png");
+ addImageFilePath(ICON_COPY_AS_EMF, "icons/menu/x-office-presentation.png");
+ addImageFilePath(ICON_COPY_AS_IMG, "icons/menu/edit-copy.png");
+ addImageFilePath(ICON_BRING_TO_FRONT, "icons/menu/go-up.png");
+ addImageFilePath(ICON_SEND_TO_BACK, "icons/menu/go-down.png");
+ addImageFilePath(ICON_FORMAT_PAINTER, "icons/menu/applications-graphics.png");
+
+ addImageFilePath(ICON_EDIT_SHAPE + SIZE_16,
+ "icons/menu/accessories-text-editor.png");
+ addImageFilePath(ICON_ROTATE + SIZE_16, "icons/menu/edit-redo.png");
+ addImageFilePath(ICON_FLIP_HORIZONTALLY + SIZE_16,
+ "icons/menu/go-jump.png");
+ addImageFilePath(ICON_FLIP_VERTICALLY + SIZE_16,
+ "icons/menu/edit-undo.png");
+ addImageFilePath(ICON_HIDE_CONTENT + SIZE_16,
+ "icons/menu/image-x-generic.png");
+ addImageFilePath(ICON_UNHIDE_CONTENT + SIZE_16,
+ "icons/menu/weather-clear.png.png");
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramToolBehaviorProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramToolBehaviorProvider.java
new file mode 100644
index 0000000..34b2a8e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramToolBehaviorProvider.java
@@ -0,0 +1,572 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.diagram;
+
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_MODIFY_ACCESS;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_REQRESP_COMM_CH_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_ACCESS_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_COMM_CH_MH;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT;
+import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.ContainerNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.features.CreateShapeAndConnectionFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.DirectEditingDoubleclickFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.create.ShapeCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.CategoryCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.FlipHorizontallyCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.FlipVerticallyCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.HideContentCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.RotateCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.FMCCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.custom.UnhideContentCustomFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+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.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.palette.IPaletteCompartmentEntry;
+import org.eclipse.graphiti.palette.IToolEntry;
+import org.eclipse.graphiti.palette.impl.ConnectionCreationToolEntry;
+import org.eclipse.graphiti.palette.impl.ObjectCreationToolEntry;
+import org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry;
+import org.eclipse.graphiti.palette.impl.StackEntry;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.tb.ContextButtonEntry;
+import org.eclipse.graphiti.tb.ContextMenuEntry;
+import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider;
+import org.eclipse.graphiti.tb.IContextButtonPadData;
+import org.eclipse.graphiti.tb.IContextMenuEntry;
+
+/**
+ * The tool behavior provider to extend the palette and configure the context pad.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramToolBehaviorProvider extends DefaultToolBehaviorProvider {
+
+ public BlockDiagramToolBehaviorProvider(IDiagramTypeProvider diagramTypeProvider) {
+ super(diagramTypeProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.tb.DefaultToolBehaviorProvider#getDoubleClickFeature
+ * (org.eclipse.graphiti.features.context.IDoubleClickContext)
+ */
+ @Override
+ public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
+ return new DirectEditingDoubleclickFeature(getFeatureProvider());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.tb.DefaultToolBehaviorProvider#getPalette()
+ */
+ @Override
+ public IPaletteCompartmentEntry[] getPalette() {
+ List<IPaletteCompartmentEntry> ret = new ArrayList<IPaletteCompartmentEntry>();
+ // add new compartment at the end of the existing compartments
+ PaletteCompartmentEntry objects = new PaletteCompartmentEntry(
+ "Objects", null); //$NON-NLS-1$
+ PaletteCompartmentEntry connections = new PaletteCompartmentEntry(
+ "Connections", null);
+ ret.add(objects);
+ ret.add(connections);
+
+ // add all create-features to the new stack-entry
+ addCreateShapeFeatures(objects);
+
+ // add all create-connection-features to the new stack-entry
+ addCreateConnectionFeatures(connections);
+
+ return ret.toArray(new IPaletteCompartmentEntry[ret.size()]);
+ }
+
+ /**
+ * Adds all create connection features to the palette.
+ *
+ * @param connections
+ * The connections to add.
+ */
+ private void addCreateConnectionFeatures(
+ PaletteCompartmentEntry connections) {
+ StackEntry stackEntry;
+ IFeatureProvider featureProvider = getFeatureProvider();
+ ICreateConnectionFeature[] createConnectionFeatures = featureProvider
+ .getCreateConnectionFeatures();
+
+ ICreateConnectionFeature cf0 = createConnectionFeatures[0];
+ ConnectionCreationToolEntry connectionCreationToolEntry0 = new ConnectionCreationToolEntry(
+ cf0.getCreateName(), cf0.getCreateDescription(),
+ cf0.getCreateImageId(), cf0.getCreateLargeImageId());
+ connectionCreationToolEntry0.addCreateConnectionFeature(cf0);
+ connections.addToolEntry(connectionCreationToolEntry0);
+
+ for (int i = 1; i < createConnectionFeatures.length - 1; i = i + 2) {
+ ICreateConnectionFeature cf = createConnectionFeatures[i];
+ ICreateConnectionFeature cf2 = createConnectionFeatures[i + 1];
+ ConnectionCreationToolEntry connectionCreationToolEntry = new ConnectionCreationToolEntry(
+ cf.getCreateName(), cf.getCreateDescription(),
+ cf.getCreateImageId(), cf.getCreateLargeImageId());
+ ConnectionCreationToolEntry connectionCreationToolEntry2 = new ConnectionCreationToolEntry(
+ cf2.getCreateName(), cf2.getCreateDescription(),
+ cf2.getCreateImageId(), cf2.getCreateLargeImageId());
+ stackEntry = new StackEntry(cf.getCreateName(),
+ cf.getCreateDescription(), cf.getCreateImageId());
+ stackEntry.addCreationToolEntry(connectionCreationToolEntry);
+ stackEntry.addCreationToolEntry(connectionCreationToolEntry2);
+ connectionCreationToolEntry.addCreateConnectionFeature(cf);
+ connectionCreationToolEntry2.addCreateConnectionFeature(cf2);
+ connections.addToolEntry(stackEntry);
+ }
+ }
+
+ /**
+ * Adds all create shape features to the palette.
+ *
+ * @param objects
+ * The shapes to add.
+ * @return
+ */
+ private void addCreateShapeFeatures(
+ PaletteCompartmentEntry objects) {
+ IFeatureProvider featureProvider = getFeatureProvider();
+ ICreateFeature[] createFeatures = featureProvider.getCreateFeatures();
+ StackEntry stackEntry = null;
+ int stackCount = 0;
+ for (ICreateFeature cf : createFeatures) {
+ ShapeCreateFeature scf = (ShapeCreateFeature) cf;
+ IToolEntry objectCreationToolEntry = null;
+ if (scf.getModelType() == FmcPackage.Literals.STORAGE
+ || scf.getModelType() == FMCType.Storage) {
+ if (stackCount == 0) {
+ stackEntry = new StackEntry("Storage", "Storage",
+ BlockDiagramImageProvider.ICON_STORAGE);
+
+ objectCreationToolEntry = stackEntry;
+ }
+ stackEntry
+ .addCreationToolEntry(createObjectCreationToolEntry(cf));
+ if (stackCount == 2) {
+ stackCount = 0;
+ } else
+ stackCount++;
+ } else if (scf.getModelType() == FmcPackage.Literals.AGENT
+ || scf.getModelType() == FMCType.Agent) {
+ if (stackCount == 0) {
+ stackEntry = new StackEntry("Agent", "Agent",
+ BlockDiagramImageProvider.ICON_AGENT);
+
+ objectCreationToolEntry = stackEntry;
+ }
+ stackEntry
+ .addCreationToolEntry(createObjectCreationToolEntry(cf));
+ if (stackCount == 2) {
+ stackCount = 0;
+ } else
+ stackCount++;
+ } else {
+ objectCreationToolEntry = createObjectCreationToolEntry(cf);
+
+ }
+ objects.addToolEntry(objectCreationToolEntry);
+ }
+ }
+
+ /**
+ * Creates a new ObjectCreationToolEntry from the create feature.
+ *
+ * @param cf
+ * The create feature.
+ * @return The new ObjectCreationToolEntry.
+ */
+ private ObjectCreationToolEntry createObjectCreationToolEntry(
+ ICreateFeature cf) {
+ return new ObjectCreationToolEntry(cf.getCreateName(),
+ cf.getCreateDescription(), cf.getCreateImageId(),
+ cf.getCreateLargeImageId(), cf);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.tb.DefaultToolBehaviorProvider#getContextButtonPad
+ * (org.eclipse.graphiti.features.context.IPictogramElementContext)
+ */
+ @Override
+ public IContextButtonPadData getContextButtonPad(
+ IPictogramElementContext context) {
+ IContextButtonPadData data = super.getContextButtonPad(context);
+
+ ICreateFeature[] createFeatures = this.getFeatureProvider()
+ .getCreateFeatures();
+ ICreateConnectionFeature[] createConnectionFeatures = this
+ .getFeatureProvider().getCreateConnectionFeatures();
+
+ CreateConnectionContext createConContext = new CreateConnectionContext();
+ createConContext.setSourceAnchor(Graphiti.getPeService()
+ .getChopboxAnchor(
+ (AnchorContainer) context.getPictogramElement()));
+ createConContext.setSourcePictogramElement(context
+ .getPictogramElement());
+ FMCTypeChecker typeHelper = FMCTypeCheckerFactory.getInstance();
+ if (typeHelper.isFMCNode(context.getPictogramElement())) {
+ createFmcNodeContext(data, createConnectionFeatures,
+ createConContext);
+ }
+ // Channels are only allowed between Agents
+ if (typeHelper.isAgent(context.getPictogramElement())) {
+ createAgentContext(data, createFeatures, createConnectionFeatures,
+ createConContext);
+ }
+ if (typeHelper.isStorage(context.getPictogramElement())) {
+ createStorageContext(data, createFeatures,
+ createConnectionFeatures, createConContext);
+ }
+ // Rotate polygons, flip polygons horizontally
+ if (typeHelper.isStorage(context.getPictogramElement())
+ || typeHelper.isAgent(context.getPictogramElement())
+ || typeHelper.isBrace(context.getPictogramElement())
+ || typeHelper
+ .isStructureVariance(context.getPictogramElement())) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+
+ List<ContextButtonEntry> contextButtonEntries = new ArrayList<ContextButtonEntry>();
+
+ PictogramElement[] pictogramElements = { context
+ .getPictogramElement() };
+ ICustomContext customContext = new CustomContext(pictogramElements);
+
+ if (ea instanceof RotatableNode) {
+ createRotateContext(contextButtonEntries, customContext);
+ }
+
+ if (!contextButtonEntries.isEmpty()) {
+ ContextButtonEntry editShapeEntry = new ContextButtonEntry(
+ null, null);
+ editShapeEntry.setText("Edit shape");
+ editShapeEntry.setIconId(BlockDiagramImageProvider.ICON_EDIT_SHAPE
+ + BlockDiagramImageProvider.SIZE_16);
+ data.getDomainSpecificContextButtons().add(editShapeEntry);
+
+ for (ContextButtonEntry contextButtonEntry : contextButtonEntries) {
+ editShapeEntry
+ .addContextButtonMenuEntry(contextButtonEntry);
+ }
+ }
+
+ if (ea instanceof ContainerNode) {
+ createHideContext(data, container, ea, customContext);
+ }
+ }
+ return data;
+ }
+
+ /**
+ *
+ * @param data
+ * @param container
+ * @param ea
+ * @param customContext
+ */
+ private void createHideContext(IContextButtonPadData data,
+ ContainerShape container, FMCElementAlgorithm ea,
+ ICustomContext customContext) {
+ ContainerNode cn = (ContainerNode) ea;
+ if (!cn.isEmpty(container)) {
+ if (!cn.isHiding(container)) {
+ HideContentCustomFeature hideContentFeature = new HideContentCustomFeature(
+ getFeatureProvider());
+ ContextButtonEntry hideContentEntry = new ContextButtonEntry(
+ hideContentFeature, customContext);
+ data.getDomainSpecificContextButtons().add(
+ hideContentEntry);
+ } else {
+ UnhideContentCustomFeature unhideContentFeature = new UnhideContentCustomFeature(
+ getFeatureProvider());
+ ContextButtonEntry unhideContentEntry = new ContextButtonEntry(
+ unhideContentFeature, customContext);
+ data.getDomainSpecificContextButtons().add(
+ unhideContentEntry);
+ }
+ }
+ }
+
+ /**
+ * Creates context buttons for flip and rotate.
+ *
+ * @param contextButtonEntries
+ * @param customContext
+ */
+ private void createRotateContext(
+ List<ContextButtonEntry> contextButtonEntries,
+ ICustomContext customContext) {
+ RotateCustomFeature rotateFeature = new RotateCustomFeature(
+ getFeatureProvider());
+ ContextButtonEntry rotateEntry = new ContextButtonEntry(
+ rotateFeature, customContext);
+ contextButtonEntries.add(rotateEntry);
+
+ FlipHorizontallyCustomFeature flipHorizontallyFeature = new FlipHorizontallyCustomFeature(
+ getFeatureProvider());
+ ContextButtonEntry flipHorizontallyEntry = new ContextButtonEntry(
+ flipHorizontallyFeature, customContext);
+ contextButtonEntries.add(flipHorizontallyEntry);
+
+ FlipVerticallyCustomFeature flipVerticallyFeature = new FlipVerticallyCustomFeature(
+ getFeatureProvider());
+ ContextButtonEntry flipVerticallyEntry = new ContextButtonEntry(
+ flipVerticallyFeature, customContext);
+ contextButtonEntries.add(flipVerticallyEntry);
+ }
+
+ /**
+ * Creates context buttons available for storage.
+ *
+ * @param data
+ * @param createFeatures
+ * @param createConnectionFeatures
+ * @param createConContext
+ */
+ private void createStorageContext(IContextButtonPadData data,
+ ICreateFeature[] createFeatures,
+ ICreateConnectionFeature[] createConnectionFeatures,
+ CreateConnectionContext createConContext) {
+ data.getDomainSpecificContextButtons()
+ .add(createShapeContextButton(
+ createConContext,
+ createFeatures[CREATE_FEATURE_AGENT],
+ createConnectionFeatures[CREATE_CON_MODIFY_ACCESS],
+ "Agent",
+ "Creates an agent connected with unidirectional access",
+ BlockDiagramImageProvider.ICON_AGENT
+ + BlockDiagramImageProvider.SIZE_16));
+ }
+
+ /**
+ * Creates context buttons available for all FMC nodes.
+ *
+ * @param data
+ * @param createConnectionFeatures
+ * @param createConContext
+ */
+ private void createFmcNodeContext(IContextButtonPadData data,
+ ICreateConnectionFeature[] createConnectionFeatures,
+ CreateConnectionContext createConContext) {
+ data.getDomainSpecificContextButtons().add(
+ createConnectionContextButton(createConContext,
+ createConnectionFeatures[CREATE_CON_MODIFY_ACCESS],
+ "Modify Access", "Draw modify access",
+ BlockDiagramImageProvider.ICON_MODIFY_ACCESS
+ + BlockDiagramImageProvider.SIZE_16));
+ data.getDomainSpecificContextButtons().add(
+ createConnectionContextButton(createConContext,
+ createConnectionFeatures[CREATE_CON_UNI_ACCESS_MH],
+ "Unidirectional Access",
+ "Draw unidirectional access",
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_ACCESS
+ + BlockDiagramImageProvider.SIZE_16));
+ }
+
+ /**
+ * Creates context buttons available for agents.
+ *
+ * @param data
+ * @param createFeatures
+ * @param createConnectionFeatures
+ * @param createConContext
+ */
+ private void createAgentContext(IContextButtonPadData data,
+ ICreateFeature[] createFeatures,
+ ICreateConnectionFeature[] createConnectionFeatures,
+ CreateConnectionContext createConContext) {
+ data.getDomainSpecificContextButtons()
+ .add(createConnectionContextButton(
+ createConContext,
+ createConnectionFeatures[CREATE_CON_UNI_COMM_CH_MH],
+ "Unidirectional Communication Channel",
+ "Draw unidirectional communication channel",
+ BlockDiagramImageProvider.ICON_UNIDIRECTIONAL_COMM_CHANNEL
+ + BlockDiagramImageProvider.SIZE_16));
+ data.getDomainSpecificContextButtons()
+ .add(createConnectionContextButton(
+ createConContext,
+ createConnectionFeatures[CREATE_CON_REQRESP_COMM_CH_MH],
+ "Req/Resp Communication Channel",
+ "Draw Req/Resp Communication Channel",
+ BlockDiagramImageProvider.ICON_REQ_RESP_COMM_CHANNEL
+ + BlockDiagramImageProvider.SIZE_16));
+ data.getDomainSpecificContextButtons()
+ .add(createShapeContextButton(
+ createConContext,
+ createFeatures[CREATE_FEATURE_STORAGE],
+ createConnectionFeatures[CREATE_CON_MODIFY_ACCESS],
+ "Storage",
+ "Creates an Storage connected with unidirectional access",
+ BlockDiagramImageProvider.ICON_STORAGE
+ + BlockDiagramImageProvider.SIZE_16));
+ data.getDomainSpecificContextButtons()
+ .add(createShapeContextButton(
+ createConContext,
+ createFeatures[CREATE_FEATURE_AGENT],
+ createConnectionFeatures[CREATE_CON_REQRESP_COMM_CH_MH],
+ "Agent",
+ "Creates an agent connected with communication channel",
+ BlockDiagramImageProvider.ICON_AGENT
+ + BlockDiagramImageProvider.SIZE_16));
+ }
+
+ /**
+ * Creates a context button for shapes which are automatically connected
+ * with the selected source element.
+ *
+ * @param createConContext
+ * The create connection context.
+ * @param createFeature
+ * The create feature
+ * @param createConnectionFeature
+ * The create connection feature.
+ * @param text
+ * The text to be shown.
+ * @param description
+ * The description to be shown.
+ * @param iconId
+ * The image id of the icon to be used.
+ * @return New ContextButtonEntry.
+ */
+ private ContextButtonEntry createShapeContextButton(
+ CreateConnectionContext createConContext,
+ ICreateFeature createFeature,
+ ICreateConnectionFeature createConnectionFeature, String text,
+ String description, String iconId) {
+ CreateShapeAndConnectionFeature feature = new CreateShapeAndConnectionFeature(
+ createFeature, createConnectionFeature, 80, 50);
+ ContextButtonEntry shapeEntry = new ContextButtonEntry(null,
+ createConContext);
+ if (feature.isAvailable(createConContext)
+ && feature.canStartConnection(createConContext))
+ shapeEntry.addDragAndDropFeature(feature);
+ shapeEntry.setText(text);
+ shapeEntry.setDescription(description);
+ shapeEntry.setIconId(iconId);
+ return shapeEntry;
+ }
+
+ /**
+ * Creates a context button for connections.
+ *
+ * @param createConContext
+ * The create connection context.
+ * @param createConnectionFeature
+ * The create connection feature.
+ * @param text
+ * The text to be shown.
+ * @param description
+ * The description to be shown.
+ * @param iconId
+ * The image id of the icon to be used.
+ * @return New ContextButtonEntry.
+ */
+ private ContextButtonEntry createConnectionContextButton(
+ CreateConnectionContext createConContext,
+ ICreateConnectionFeature createConnectionFeature, String text,
+ String description, String iconId) {
+ ContextButtonEntry connectionEntry = new ContextButtonEntry(null,
+ createConContext);
+ if (createConnectionFeature.isAvailable(createConContext)
+ && createConnectionFeature.canStartConnection(createConContext))
+ connectionEntry.addDragAndDropFeature(createConnectionFeature);
+ connectionEntry.setText(text);
+ connectionEntry.setDescription(description);
+ connectionEntry.setIconId(iconId);
+ return connectionEntry;
+ }
+
+ @Override
+ public IContextMenuEntry[] getContextMenu(ICustomContext context) {
+ IContextMenuEntry[] contextMenu = super.getContextMenu(context);
+ Map<String, List<IContextMenuEntry>> categories = new HashMap<String, List<IContextMenuEntry>>();
+ List<IContextMenuEntry> topLevelEntries = new ArrayList<IContextMenuEntry>();
+ for (IContextMenuEntry contextMenuEntry : contextMenu) {
+ if (contextMenuEntry.getFeature() instanceof FMCCustomFeature) {
+ FMCCustomFeature provider = (FMCCustomFeature) contextMenuEntry
+ .getFeature();
+ if (provider.getCategory() != null
+ && provider.getCategory().length() > 0) {
+ if (!categories.containsKey(provider.getCategory())) {
+ categories.put(provider.getCategory(),
+ new ArrayList<IContextMenuEntry>());
+ }
+ categories.get(provider.getCategory())
+ .add(contextMenuEntry);
+ } else
+ topLevelEntries.add(contextMenuEntry);
+ } else
+ topLevelEntries.add(contextMenuEntry);
+ }
+ IContextMenuEntry[] newContextMenu = new IContextMenuEntry[topLevelEntries
+ .size() + categories.size()];
+ int i = 0;
+ for (IContextMenuEntry contextMenuEntry : topLevelEntries) {
+ newContextMenu[i] = contextMenuEntry;
+ i++;
+ }
+ for (Entry<String, List<IContextMenuEntry>> entry : categories
+ .entrySet()) {
+ ContextMenuEntry category = new ContextMenuEntry(
+ new CategoryCustomFeature(getFeatureProvider(),
+ entry.getKey()), context);
+ for (IContextMenuEntry contextMenuEntry : entry.getValue()) {
+ category.add(contextMenuEntry);
+ }
+ newContextMenu[i] = category;
+
+ i++;
+ }
+ return newContextMenu;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramTypeProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramTypeProvider.java
new file mode 100644
index 0000000..b32558b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/BlockDiagramTypeProvider.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.diagram;
+
+import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.tb.IToolBehaviorProvider;
+
+/**
+ * This class is a diagram provider for FMC Blockdiagrams. The diagram type of a
+ * Graphiti diagram is specified inside the model file using the diagramTypeId
+ * attribute. The binding from this type id to the diagram type provider is set
+ * via the org.eclipse.graphiti.ui.diagramTypes extension point.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramTypeProvider extends AbstractDiagramTypeProvider
+ implements IDiagramTypeProvider {
+
+ private static final String FMC_PROVIDER = "org.eclipse.fmc.provider";
+ private IToolBehaviorProvider[] toolBehaviorProviders;
+
+ /**
+ * Constructor setting the feature provider to BlockDiagramFeatureProvider and
+ * setting the providerId.
+ */
+ public BlockDiagramTypeProvider() {
+ super();
+ setFeatureProvider(new BlockDiagramFeatureProvider(this));
+ this.setProviderId(FMC_PROVIDER);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#getAvailableToolBehaviorProviders()
+ */
+ @Override
+ public IToolBehaviorProvider[] getAvailableToolBehaviorProviders() {
+ if (toolBehaviorProviders == null) {
+ toolBehaviorProviders = new IToolBehaviorProvider[] { new BlockDiagramToolBehaviorProvider(
+ this) };
+ }
+ return toolBehaviorProviders.clone();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/package.html
new file mode 100644
index 0000000..43e6ea4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/diagram/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package collects all provider classes such as the type provider, feature provider and tool behavior provider.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/CompositeFeatureProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/CompositeFeatureProvider.java
new file mode 100644
index 0000000..df0e22c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/CompositeFeatureProvider.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.extension;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICopyFeature;
+import org.eclipse.graphiti.features.IPasteFeature;
+import org.eclipse.graphiti.features.IPrintFeature;
+import org.eclipse.graphiti.features.ISaveImageFeature;
+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.IPasteContext;
+import org.eclipse.graphiti.features.custom.ICustomFeature;
+import org.eclipse.graphiti.features.impl.AbstractFeatureProvider;
+
+/**
+ * The CompositeFeatureProvider is a container for other feature providers. It
+ * maintains a list of feature providers which are called in order to get an
+ * feature. If the first feature returns a non-null result, this result is
+ * returned immediately.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CompositeFeatureProvider extends AbstractFeatureProvider {
+
+ private List<AbstractFeatureProvider> featureProviders = new ArrayList<AbstractFeatureProvider>();
+
+ /**
+ *
+ * @param diagramTypeProvider
+ */
+ public CompositeFeatureProvider(IDiagramTypeProvider diagramTypeProvider) {
+ super(diagramTypeProvider);
+ }
+
+ /**
+ * Add a new provider.
+ *
+ * @param provider
+ * The provider to be added.
+ */
+ public void addFeatureProvider(AbstractFeatureProvider provider) {
+ featureProviders.add(provider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#getAddFeature
+ * (org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public IAddFeature getAddFeature(IAddContext context) {
+ for (AbstractFeatureProvider provider : featureProviders) {
+ IAddFeature feature = provider.getAddFeature(context);
+ if (feature != null) {
+ return feature;
+ }
+ }
+ return super.getAddFeature(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeatureProvider#getCustomFeatures
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public ICustomFeature[] getCustomFeatures(ICustomContext context) {
+ Collection<ICustomFeature> features = new ArrayList<ICustomFeature>();
+ for (AbstractFeatureProvider provider : featureProviders) {
+ ICustomFeature[] featureArray = provider.getCustomFeatures(context);
+ features.addAll(Arrays.asList(featureArray));
+ }
+ return features.toArray(new ICustomFeature[] {});
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IFeatureProvider#getCopyFeature(org.eclipse
+ * .graphiti.features.context.ICopyContext)
+ */
+ @Override
+ public ICopyFeature getCopyFeature(ICopyContext context) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IFeatureProvider#getPasteFeature(org.eclipse
+ * .graphiti.features.context.IPasteContext)
+ */
+ @Override
+ public IPasteFeature getPasteFeature(IPasteContext context) {
+ return null;
+ }
+
+ @Override
+ public IPrintFeature getPrintFeature() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ISaveImageFeature getSaveImageFeature() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/ExtensionFeatureProvider.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/ExtensionFeatureProvider.java
new file mode 100644
index 0000000..b491c3f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/ExtensionFeatureProvider.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.extension;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.features.ICopyFeature;
+import org.eclipse.graphiti.features.IPasteFeature;
+import org.eclipse.graphiti.features.IPrintFeature;
+import org.eclipse.graphiti.features.ISaveImageFeature;
+import org.eclipse.graphiti.features.context.ICopyContext;
+import org.eclipse.graphiti.features.context.IPasteContext;
+import org.eclipse.graphiti.features.impl.AbstractFeatureProvider;
+import org.eclipse.graphiti.features.impl.IIndependenceSolver;
+
+/**
+ * All extensions providing new features to the editor must extend this class.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ExtensionFeatureProvider extends AbstractFeatureProvider {
+
+ /**
+ * The main constructor.
+ *
+ * @param diagramTypeProvider The diagram type provider.
+ */
+ public ExtensionFeatureProvider(IDiagramTypeProvider diagramTypeProvider) {
+ super(diagramTypeProvider);
+ setIndependenceSolver(new IIndependenceSolver() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.IIndependenceSolver#
+ * getKeyForBusinessObject(java.lang.Object)
+ */
+ @Override
+ public String getKeyForBusinessObject(Object bo) {
+ if (bo instanceof FMCType) {
+ FMCType type = (FMCType) bo;
+ return type.name();
+ } else
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.IIndependenceSolver#
+ * getBusinessObjectForKey(java.lang.String)
+ */
+ @Override
+ public Object getBusinessObjectForKey(String key) {
+ return FMCType.valueOf(key);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IFeatureProvider#getCopyFeature(org.eclipse
+ * .graphiti.features.context.ICopyContext)
+ */
+ @Override
+ public final ICopyFeature getCopyFeature(ICopyContext context) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IFeatureProvider#getPasteFeature(org.eclipse
+ * .graphiti.features.context.IPasteContext)
+ */
+ @Override
+ public final IPasteFeature getPasteFeature(IPasteContext context) {
+ return null;
+ }
+
+ @Override
+ public IPrintFeature getPrintFeature() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ISaveImageFeature getSaveImageFeature() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/FeatureProviderExtensionFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/FeatureProviderExtensionFactory.java
new file mode 100644
index 0000000..9cd1d1b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/FeatureProviderExtensionFactory.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.extension;
+
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+
+/**
+ * This is the interface to produce feature providers as extensions for the Blockdiagram
+ * feature provider. This interface is used for the
+ * org.eclipse.fmc.blockdiagram.editor.palette extension point.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public interface FeatureProviderExtensionFactory {
+
+ /**
+ * Creates a new feature provider based on the type provider.
+ *
+ * @param typeProvider
+ * The typeProvider passed to the FeatureProvider
+ * @return The new instance of AbstractFeatureProvider
+ */
+ public ExtensionFeatureProvider createFeatureProviderExtension(
+ IDiagramTypeProvider typeProvider);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/package.html
new file mode 100644
index 0000000..73cb057
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/extension/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains classes enabling extensibility of the editor.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CompositeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CompositeFeature.java
new file mode 100644
index 0000000..c8abded
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CompositeFeature.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.graphiti.features.IFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CompositeFeature implements IFeature {
+
+ private final IFeature[] features;
+
+ protected IFeature getFeature(int i) {
+ return features[i];
+ }
+
+ public CompositeFeature(IFeature... features) {
+ this.features = features;
+ }
+
+ @Override
+ public String getName() {
+ return "Composite feature";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Executes mutiple features at the same time";
+ }
+
+ @Override
+ public IFeatureProvider getFeatureProvider() {
+ return features[0].getFeatureProvider();
+ }
+
+ @Override
+ public boolean isAvailable(IContext context) {
+ for (IFeature feature : features) {
+ if (!feature.isAvailable(context))
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canExecute(IContext context) {
+ for (IFeature feature : features) {
+ if (!feature.canExecute(context))
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void execute(IContext context) {
+ for (IFeature feature : features) {
+ feature.execute(context);
+ }
+ }
+
+ @Override
+ public boolean canUndo(IContext context) {
+ for (IFeature feature : features) {
+ if (!feature.canUndo(context))
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean hasDoneChanges() {
+ for (IFeature feature : features) {
+ if (feature.hasDoneChanges())
+ return true;
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ContainerTextDirectEditingFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ContainerTextDirectEditingFeature.java
new file mode 100644
index 0000000..4231cb2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ContainerTextDirectEditingFeature.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This is the direct editing feature class for containers. If a container is
+ * clicked for direct editing the nested text will be found and edited.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ContainerTextDirectEditingFeature extends TextDirectEditingFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public ContainerTextDirectEditingFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /**
+ * Finds the next nested text in a container.
+ *
+ * @param container
+ * The ContainerShape to search in.
+ * @return The found AbstractText, else null.
+ */
+ private AbstractText findTextInContainer(ContainerShape container) {
+ for (Shape shape : container.getChildren()) {
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText)
+ return (AbstractText) shape.getGraphicsAlgorithm();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.TextDirectEditingFeature#getText
+ * (org.eclipse.graphiti.features.context.IDirectEditingContext)
+ */
+ @Override
+ protected AbstractText getText(IDirectEditingContext context) {
+ EObject container = context.getPictogramElement().eContainer();
+ if (container instanceof ContainerShape) {
+ ContainerShape containerShape = (ContainerShape) container;
+ int containerCounter = 0;
+ for (Shape shape : containerShape.getChildren()) {
+ if (shape instanceof ContainerShape) {
+ containerCounter++;
+ if (containerCounter == 2) {
+ return findTextInContainer((ContainerShape) shape);
+ }
+
+ }
+ }
+ return null;
+ } else
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CreateShapeAndConnectionFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CreateShapeAndConnectionFeature.java
new file mode 100644
index 0000000..0e409d2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/CreateShapeAndConnectionFeature.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.datatypes.ILocation;
+import org.eclipse.graphiti.features.ICreateConnectionFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.CreateContext;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This class is capable of executing two features: one for creating a shape and
+ * one for creating a connection. The new Shape will be the target of the
+ * connection.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CreateShapeAndConnectionFeature extends CompositeFeature implements
+ ICreateConnectionFeature {
+
+ private final int width;
+ private final int height;
+
+ /**
+ *
+ * @param createFeature
+ * @param createConnectionFeature
+ * @param width
+ * The width of the new shape.
+ * @param height
+ * The height of the new shape.
+ */
+ public CreateShapeAndConnectionFeature(ICreateFeature createFeature,
+ ICreateConnectionFeature createConnectionFeature, int width,
+ int height) {
+ super(createFeature, createConnectionFeature);
+ this.width = width;
+ this.height = height;
+ }
+
+ private ICreateFeature getCreateFeature() {
+ return (ICreateFeature) getFeature(0);
+ }
+
+ private ICreateConnectionFeature getCreateConnectionFeature() {
+ return (ICreateConnectionFeature) getFeature(1);
+ }
+
+ @Override
+ public boolean canExecute(IContext context) {
+ return true;
+ }
+
+ @Override
+ public void execute(IContext context) {
+ CreateConnectionContext ctx = (CreateConnectionContext) context;
+ getCreateFeature().execute(createContext(ctx));
+ // NOT Look up the location again and determine the new shape that has
+ // been added to the diagram
+ // ILocationInfo locationInfo =
+ // Graphiti.getPeLayoutService().getLocationInfo((Shape)
+ // ctx.getTargetPictogramElement(), ctx.getTargetLocation().getX(),
+ // ctx.getTargetLocation().getY());
+ // Set this new shape create through the create feature to the context.
+ ContainerShape container = ((ContainerShape) ctx
+ .getTargetPictogramElement());
+ // The element that we have added is the last child of the target
+ // pictogram.
+ Shape shape = getShapeBehind(container.getChildren().get(
+ container.getChildren().size() - 1));
+ // Shape shape = );
+ ctx.setTargetPictogramElement(shape);
+ ctx.setTargetAnchor(shape.getAnchors().get(0));
+ getCreateConnectionFeature().execute(ctx);
+ }
+
+ /**
+ * For the case that there is a text on top of this shape.
+ *
+ * @param shape
+ * @return
+ */
+ private Shape getShapeBehind(Shape shape) {
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
+ return shape.getContainer();
+ } else
+ return shape;
+ }
+
+ private ICreateContext createContext(ICreateConnectionContext ctx) {
+ CreateContext cctx = new CreateContext();
+ ILocation relativePosition = FMCUtil.getRelativePosition(
+ ctx.getTargetPictogramElement(), ctx.getTargetLocation());
+ cctx.setX(relativePosition.getX());
+ cctx.setY(relativePosition.getY());
+ cctx.setSize(width, height);
+ cctx.setTargetContainer((ContainerShape) ctx
+ .getTargetPictogramElement());
+ return cctx;
+ }
+
+ @Override
+ public boolean canCreate(ICreateConnectionContext context) {
+ return getCreateConnectionFeature().canCreate(context);
+ }
+
+ @Override
+ public Connection create(ICreateConnectionContext context) {
+ return getCreateConnectionFeature().create(context);
+ }
+
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context) {
+ return getCreateConnectionFeature().canStartConnection(context);
+ }
+
+ @Override
+ public String getCreateName() {
+ return getCreateConnectionFeature().getCreateName();
+ }
+
+ @Override
+ public String getCreateDescription() {
+ return getCreateConnectionFeature().getCreateDescription();
+ }
+
+ @Override
+ public String getCreateImageId() {
+ return getCreateConnectionFeature().getCreateImageId();
+ }
+
+ @Override
+ public String getCreateLargeImageId() {
+ return getCreateConnectionFeature().getCreateLargeImageId();
+ }
+
+ @Override
+ public void startConnecting() {
+ getCreateConnectionFeature().startConnecting();
+ }
+
+ @Override
+ public void endConnecting() {
+ getCreateConnectionFeature().endConnecting();
+ }
+
+ @Override
+ public void attachedToSource(ICreateConnectionContext context) {
+ getCreateConnectionFeature().attachedToSource(context);
+ }
+
+ @Override
+ public void canceledAttaching(ICreateConnectionContext context) {
+ getCreateConnectionFeature().canceledAttaching(context);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DeepRemoveFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DeepRemoveFeature.java
new file mode 100644
index 0000000..7d11678
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DeepRemoveFeature.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IRemoveContext;
+import org.eclipse.graphiti.features.impl.DefaultRemoveFeature;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This Remove feature removes all connections including those that are pointing
+ * to/from child shapes.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DeepRemoveFeature extends DefaultRemoveFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public DeepRemoveFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultRemoveFeature#preRemove(org
+ * .eclipse.graphiti.features.context.IRemoveContext)
+ */
+ @Override
+ public void preRemove(IRemoveContext context) {
+ PictogramElement pe = context.getPictogramElement();
+
+ if (pe instanceof ContainerShape) {
+ removeConnectionsFromAllChildren((ContainerShape) pe);
+ }
+ super.postRemove(context);
+ }
+
+ /**
+ * Removes connections from all the children of the container.
+ *
+ * @param container
+ * The container shape to remove the children from.
+ */
+ private void removeConnectionsFromAllChildren(ContainerShape container) {
+ for (Shape shape : (container.getChildren())) {
+ removeAllConnections(shape);
+ if (shape instanceof ContainerShape) {
+ removeConnectionsFromAllChildren((ContainerShape) shape);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DirectEditingDoubleclickFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DirectEditingDoubleclickFeature.java
new file mode 100644
index 0000000..66f0446
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DirectEditingDoubleclickFeature.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.graphiti.features.IDirectEditingFeature;
+import org.eclipse.graphiti.features.IDirectEditingInfo;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.context.impl.DirectEditingContext;
+import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This class is responsible for enabling direct editing behavior in case of
+ * double click on the shape.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DirectEditingDoubleclickFeature extends AbstractCustomFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public DirectEditingDoubleclickFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ if (context.getPictogramElements().length == 1
+ && context.getPictogramElements()[0] instanceof Shape) {
+ PictogramElement element = context.getPictogramElements()[0];
+ DirectEditingContext ctx = new DirectEditingContext(element,
+ element.getGraphicsAlgorithm());
+ IDirectEditingFeature directEditingFeature = getFeatureProvider()
+ .getDirectEditingFeature(ctx);
+ return directEditingFeature != null;
+ } else
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ if (context.getPictogramElements().length > 0
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+ ContainerShape element = (ContainerShape) context
+ .getPictogramElements()[0];
+ AbstractText text = findTextInContainer(element);
+ editText(element, text);
+ } else if (context.getPictogramElements().length > 0
+ && context.getPictogramElements()[0].getGraphicsAlgorithm() instanceof AbstractText) {
+ PictogramElement element = context.getPictogramElements()[0];
+ editText(element, (AbstractText) element.getGraphicsAlgorithm());
+ }
+ }
+
+ /**
+ * Enables editing of the text.
+ *
+ * @param element The pictogram element which was double-clicked.
+ * @param text The text to be edited by the user
+ */
+ private void editText(PictogramElement element, AbstractText text) {
+ IDirectEditingInfo directEditingInfo = getFeatureProvider()
+ .getDirectEditingInfo();
+ directEditingInfo.setMainPictogramElement(element);
+
+ directEditingInfo.setGraphicsAlgorithm(text);
+ if (text != null)
+ directEditingInfo.setPictogramElement(text.getPictogramElement() != null ? text.getPictogramElement() : element);
+
+ directEditingInfo.setActive(true);
+ getDiagramBehavior().refresh();
+ }
+
+ /**
+ * Finds the text in a container shape and returns it.
+ *
+ * @param container The container shape to find the text in.
+ * @return The found abstract text, else null.
+ */
+ private AbstractText findTextInContainer(ContainerShape container) {
+ for (Shape shape : container.getChildren()) {
+ if (shape instanceof ContainerShape) {
+ for (Shape nested : ((ContainerShape) shape).getChildren()) {
+ if (nested.getGraphicsAlgorithm() instanceof AbstractText)
+ return findTextInGraphicsAlgorithm(nested);
+ }
+ }
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText)
+ return findTextInGraphicsAlgorithm(shape);
+ }
+ return findTextInGraphicsAlgorithm(container);
+ }
+
+ /**
+ * Searches in the graphics algorithm and the graphics algorithm children of
+ * th shape for text algorithms.
+ *
+ * @param shape
+ * The shape to find texts in.
+ * @return The first text that has been found.
+ */
+ private AbstractText findTextInGraphicsAlgorithm(Shape shape){
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText)
+ return (AbstractText) shape.getGraphicsAlgorithm();
+ else if(shape.getGraphicsAlgorithm() != null){
+ for(GraphicsAlgorithm algoChild : shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren()){
+ if (algoChild instanceof AbstractText)
+ return (AbstractText) algoChild;
+ }
+ return null;
+ }
+ else
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DontAskWhenDeleteFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DontAskWhenDeleteFeature.java
new file mode 100644
index 0000000..f6be793
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DontAskWhenDeleteFeature.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IRemoveFeature;
+import org.eclipse.graphiti.features.context.IDeleteContext;
+import org.eclipse.graphiti.features.context.IMultiDeleteInfo;
+import org.eclipse.graphiti.features.context.IRemoveContext;
+import org.eclipse.graphiti.features.context.impl.RemoveContext;
+import org.eclipse.graphiti.features.impl.DefaultRemoveFeature;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.features.DefaultDeleteFeature;
+
+/**
+ * This class extends the DefaultDeleteFeature and skips the delete dialog.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DontAskWhenDeleteFeature extends DefaultDeleteFeature {
+
+ /**
+ * Dirty flag for
+ */
+ private boolean dirty;
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public DontAskWhenDeleteFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultDeleteFeature#canDelete(org.eclipse
+ * .graphiti.features.context.IDeleteContext)
+ */
+ @Override
+ public boolean canDelete(IDeleteContext context) {
+ return !(context.getPictogramElement() instanceof Diagram);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultDeleteFeature#delete(org.eclipse
+ * .graphiti.features.context.IDeleteContext)
+ */
+ @Override
+ public void delete(IDeleteContext context) {
+ IMultiDeleteInfo multiDeleteInfo = context.getMultiDeleteInfo();
+ if (multiDeleteInfo != null && multiDeleteInfo.isDeleteCanceled()) {
+ return;
+ }
+ PictogramElement pe = context.getPictogramElement();
+ Object[] businessObjectsForPictogramElement = getAllBusinessObjectsForPictogramElement(pe);
+ if (businessObjectsForPictogramElement != null
+ && businessObjectsForPictogramElement.length > 0) {
+ if (multiDeleteInfo == null) {
+ if (!getUserDecision(context)) {
+ return;
+ }
+ } else {
+ if (multiDeleteInfo.isShowDialog()) {
+ boolean okPressed = getUserDecision(context);
+ if (okPressed) {
+ // don't show further dialogs
+ multiDeleteInfo.setShowDialog(false);
+ } else {
+ multiDeleteInfo.setDeleteCanceled(true);
+ return;
+ }
+ }
+ }
+ }
+
+ this.dirty = true;
+
+ preDelete(context);
+
+ IRemoveContext rc = new RemoveContext(pe);
+ IFeatureProvider featureProvider = getFeatureProvider();
+ IRemoveFeature removeFeature = new DefaultRemoveFeature(featureProvider);
+ if (removeFeature != null) {
+ removeFeature.remove(rc);
+ }
+
+ deleteBusinessObjects(businessObjectsForPictogramElement);
+
+ postDelete(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultDeleteFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return dirty;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.graphiti.ui.features.DefaultDeleteFeature#setDoneChanges(boolean)
+ */
+ @Override
+ protected void setDoneChanges(boolean doneChanges) {
+ this.dirty = doneChanges;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.ui.features.DefaultDeleteFeature#getUserDecision
+ * (org.eclipse.graphiti.features.context.IDeleteContext)
+ */
+ @Override
+ protected boolean getUserDecision(IDeleteContext context) {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DotsConnectionRemoveFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DotsConnectionRemoveFeature.java
new file mode 100644
index 0000000..9048966
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/DotsConnectionRemoveFeature.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IRemoveContext;
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * Removes the invisible rectangle when DotsConnection is removed.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DotsConnectionRemoveFeature extends DeepRemoveFeature {
+
+ /**
+ * The type checker.
+ */
+ protected FMCTypeChecker checker = FMCTypeCheckerFactory.getInstance();
+
+ public DotsConnectionRemoveFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultRemoveFeature#canRemove(org
+ * .eclipse.graphiti.features.context.IRemoveContext)
+ */
+ @Override
+ public boolean canRemove(IRemoveContext context) {
+ if (context.getPictogramElement() instanceof Connection) {
+ return checker.isDots(context.getPictogramElement())
+ && super.canRemove(context);
+ } else
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.DeepRemoveFeature#preRemove(org.
+ * eclipse.graphiti.features.context.IRemoveContext)
+ */
+ @Override
+ public void preRemove(IRemoveContext context) {
+ super.preRemove(context);
+ if (context.getPictogramElement() instanceof Connection) {
+ Connection connection = (Connection) context.getPictogramElement();
+ AnchorContainer container = connection.getEnd().getParent();
+ if (!container.getGraphicsAlgorithm().isSetLineVisible()
+ && !container.getGraphicsAlgorithm().isSetFilled()) {
+ Graphiti.getPeService().deletePictogramElement(container);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ReconnectionFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ReconnectionFeature.java
new file mode 100644
index 0000000..adb2d72
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ReconnectionFeature.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.fmc.blockdiagram.editor.features.create.ConnectionCreateFeature;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.IReconnectionContext;
+import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.ReconnectionContext;
+import org.eclipse.graphiti.features.impl.DefaultReconnectionFeature;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * This class extends DefaultReconnectionFeature and adds special behavior for
+ * dots connections and support for connecting the shape behind something
+ * non-connectable. Dots connections are special because it is possible to set the
+ * target to an invisible shape.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ReconnectionFeature extends DefaultReconnectionFeature {
+
+ public ReconnectionFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultReconnectionFeature#canReconnect
+ * (org.eclipse.graphiti.features.context.IReconnectionContext)
+ */
+ @Override
+ public boolean canReconnect(IReconnectionContext context) {
+ Connection con = context.getConnection();
+ Object model = FMCUtil.getIndependentObject(con);
+ if (model == null) {
+ model = FMCUtil.getBO(con);
+ }
+
+ ConnectionCreateFeature feature = null;
+
+ feature = new ConnectionCreateFeature(getFeatureProvider(), "", "",
+ model, ConnectionStyle.NORMAL, null);
+
+ CreateConnectionContext ctx = new CreateConnectionContext();
+
+ if (context.getTargetPictogramElement() instanceof Shape) {
+ Shape s = ConnectionCreateFeature
+ .getShapeBehindTextOrPicture((Shape) context
+ .getTargetPictogramElement());
+ if (s != null && !s.getAnchors().isEmpty()) {
+ context.setTargetPictogramElement(s);
+ ((ReconnectionContext) context).setNewAnchor(s.getAnchors()
+ .get(0));
+ }
+ }
+ if (context.getOldAnchor() != null
+ && context.getOldAnchor().eContainer() instanceof Shape) {
+ Shape shape = (Shape) context.getOldAnchor().eContainer();
+ if (!shape.isVisible()) {
+ // It is a Dots Connection
+ return true;
+ }
+ }
+ if (ReconnectionContext.RECONNECT_SOURCE.equals(context
+ .getReconnectType())) {
+ ctx.setSourceAnchor(context.getNewAnchor());
+ ctx.setTargetAnchor(con.getEnd());
+ if (con.getEnd() != null)
+ ctx.setTargetPictogramElement(con.getEnd().getParent());
+ if (context.getNewAnchor() != null)
+ ctx.setSourcePictogramElement(context.getNewAnchor()
+ .getParent());
+ } else if (ReconnectionContext.RECONNECT_TARGET.equals(context
+ .getReconnectType())) {
+ ctx.setSourceAnchor(con.getStart());
+ ctx.setTargetAnchor(context.getNewAnchor());
+ ctx.setSourcePictogramElement(con.getStart().getParent());
+ if (context.getNewAnchor() != null)
+ ctx.setTargetPictogramElement(context.getNewAnchor()
+ .getParent());
+ }
+ return feature.canCreate(ctx);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultReconnectionFeature#execute
+ * (org.eclipse.graphiti.features.context.IContext)
+ */
+ @Override
+ public void execute(IContext context) {
+ // Handle Dots connection with invisible anchor shape
+ if (context instanceof IReconnectionContext) {
+ IReconnectionContext reCtx = (IReconnectionContext) context;
+ if (reCtx.getNewAnchor() == null) {
+ Shape shape = (Shape) reCtx.getOldAnchor().eContainer();
+ Graphiti.getGaService().setLocation(
+ shape.getGraphicsAlgorithm(),
+ reCtx.getTargetLocation().getX(),
+ reCtx.getTargetLocation().getY());
+ } else
+ super.execute(context);
+ } else
+ super.execute(context);
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeCopyFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeCopyFeature.java
new file mode 100644
index 0000000..99f786c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeCopyFeature.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+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;
+
+/**
+ * This class copies pictogram elements to the clipboard.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapeCopyFeature extends AbstractCopyFeature {
+
+ /**
+ * The main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public ShapeCopyFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.ICopyFeature#copy(org.eclipse.graphiti.
+ * features.context.ICopyContext)
+ */
+ @Override
+ public void copy(ICopyContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ putToClipboard(pes);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.ICopyFeature#canCopy(org.eclipse.graphiti
+ * .features.context.ICopyContext)
+ */
+ @Override
+ public boolean canCopy(ICopyContext context) {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeMoveFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeMoveFeature.java
new file mode 100644
index 0000000..5f1fe63
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapeMoveFeature.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import java.util.Collection;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IMoveShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature;
+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;
+
+/**
+ * This class supports moving shapes into their container shapes.
+ *
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapeMoveFeature extends DefaultMoveShapeFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public ShapeMoveFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature#canMoveShape
+ * (org.eclipse.graphiti.features.context.IMoveShapeContext)
+ */
+ @Override
+ public boolean canMoveShape(IMoveShapeContext context) {
+ return FMCUtil.getIndependentObject(context.getTargetContainer()) != FMCType.Brace;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature#internalMove
+ * (org.eclipse.graphiti.features.context.IMoveShapeContext)
+ */
+ @Override
+ protected void internalMove(IMoveShapeContext context) {
+ if (!getUserDecision()) {
+ return;
+ }
+ Shape shapeToMove = context.getShape();
+ ContainerShape oldContainerShape = context.getSourceContainer();
+ ContainerShape newContainerShape = context.getTargetContainer();
+ boolean avoidNegativeCoordinates = !(newContainerShape instanceof Diagram);
+
+ int x = context.getX();
+ int y = context.getY();
+
+ if (avoidNegativeCoordinates
+ && x + shapeToMove.getGraphicsAlgorithm().getWidth() > newContainerShape
+ .getGraphicsAlgorithm().getWidth()) {
+ x -= x + shapeToMove.getGraphicsAlgorithm().getWidth()
+ - newContainerShape.getGraphicsAlgorithm().getWidth();
+ }
+ if (avoidNegativeCoordinates
+ && y + shapeToMove.getGraphicsAlgorithm().getHeight() > newContainerShape
+ .getGraphicsAlgorithm().getHeight()) {
+ y -= y + shapeToMove.getGraphicsAlgorithm().getHeight()
+ - newContainerShape.getGraphicsAlgorithm().getHeight();
+ }
+
+ if (oldContainerShape != newContainerShape) {
+
+ // remember selection, because it is lost when temporarily removing
+ // the shapes.
+ PictogramElement[] currentSelection = getDiagramBehavior().getDiagramContainer()
+ .getSelectedPictogramElements();
+ // the following is a workaround due to an MMR bug
+ if (oldContainerShape != null) {
+ Collection<Shape> children = oldContainerShape.getChildren();
+ if (children != null) {
+ children.remove(shapeToMove);
+ }
+ }
+
+ shapeToMove.setContainer(newContainerShape);
+ moveDomainObjects(shapeToMove, newContainerShape);
+ if (shapeToMove.getGraphicsAlgorithm() != null) {
+ Graphiti.getGaService().setLocation(
+ shapeToMove.getGraphicsAlgorithm(), x, y,
+ avoidNegativeCoordinates);
+ }
+ // restore selection
+ getDiagramBehavior().getDiagramContainer().setPictogramElementsForSelection(
+ currentSelection);
+ } else { // move within the same container
+ if (shapeToMove.getGraphicsAlgorithm() != null) {
+ Graphiti.getGaService().setLocation(
+ shapeToMove.getGraphicsAlgorithm(), x, y,
+ avoidNegativeCoordinates);
+ }
+ }
+ }
+
+ /**
+ * Can be overridden by other move features working on a real meta model.
+ *
+ * @param shapeToMove The shape to be moved.
+ * @param newContainerShape The new container for the shape.
+ */
+ protected void moveDomainObjects(Shape shapeToMove,
+ ContainerShape newContainerShape) {
+ // Nothing to do
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapePasteFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapePasteFeature.java
new file mode 100644
index 0000000..3bfec7c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/ShapePasteFeature.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramEditor;
+import org.eclipse.fmc.blockdiagram.editor.clipboard.PasteFromClipboard;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.datatypes.ILocation;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IAreaContext;
+import org.eclipse.graphiti.features.context.IPasteContext;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+import org.eclipse.graphiti.internal.datatypes.impl.LocationImpl;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.graphiti.ui.features.AbstractPasteFeature;
+
+/**
+ * Paste feature which supports pasting of shapes and images from the clipboard.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class ShapePasteFeature extends AbstractPasteFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public ShapePasteFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IPasteFeature#paste(org.eclipse.graphiti
+ * .features.context.IPasteContext)
+ */
+ @Override
+ public void paste(IPasteContext context) {
+ DiagramEditor activeEditor = (DiagramEditor) FMCUtil
+ .getActiveEditor();
+ Point p = activeEditor.getDiagramBehavior().calculateRealMouseLocation(activeEditor.getDiagramBehavior()
+ .getMouseLocation());
+ Object[] objects = getFromClipboard();
+ if (objects != null && objects.length > 0) {
+ pastePictogramElements(context, p, objects);
+ } else {
+ pasteImage(context);
+ }
+ }
+
+ /**
+ * Pastes the image into the diagram.
+ *
+ * @param context The paste context.
+ */
+ private void pasteImage(IPasteContext context) {
+ String imageId = PasteFromClipboard
+ .pasteImagesFromClipboard((BlockDiagramEditor) getDiagramBehavior().getDiagramContainer());
+ // we already verified, that we paste directly in the diagram
+ if (imageId != null) {
+ AddContext ac = new AddContext();
+ ac.setLocation((Integer) context.getProperty("mouseX"),
+ (Integer) context.getProperty("mouseY"));
+ ac.setTargetContainer(getDiagram());
+ ac.putProperty("imageid", imageId);
+ ac.setNewObject(getImageModelObject());
+ addGraphicalRepresentation(ac, getImageModelObject());
+ }
+ }
+
+ /**
+ * Returns the model object for an image. In this case a FMCType.Image.
+ * Should be overridden by other editors when using another meta model.
+ *
+ * @return The model object to be used.
+ */
+ protected Object getImageModelObject() {
+ return FMCType.Image;
+ }
+
+ /**
+ * Returns the minimum x,y coordinates of the shapes.
+ *
+ * @param shapes
+ * The shapes to analyze the minimum coordinates.
+ * @return The minimum coordinates x,y.
+ */
+ private ILocation getMinimumLocation(Object[] shapes) {
+ int minX = Integer.MAX_VALUE;
+ int minY = Integer.MAX_VALUE;
+
+ for (Object obj : shapes) {
+ if (obj instanceof Shape) {
+ Shape shape = (Shape) obj;
+ if (minX > shape.getGraphicsAlgorithm().getX())
+ minX = shape.getGraphicsAlgorithm().getX();
+ if (minY > shape.getGraphicsAlgorithm().getY())
+ minY = shape.getGraphicsAlgorithm().getY();
+ }
+ }
+ return new LocationImpl(minX, minY);
+ }
+
+ /**
+ * Is the targetContainer object contained in the shapes array?
+ *
+ * @param targetContainer The target container to search for.
+ * @param shapes The shapes array to analyze.
+ * @return
+ */
+ private boolean containsTargetContainer(Object targetContainer,
+ Object[] shapes) {
+ for (Object obj : shapes) {
+ if (targetContainer.equals(obj))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Pastes the pictogram elements into the diagram.
+ *
+ * @param context The paste context.
+ * @param p The point to paste the pictogram elements to.
+ * @param objects The objects to paste.
+ */
+ private void pastePictogramElements(IPasteContext context, Point p,
+ Object[] objects) {
+
+ Map<ILocation, Shape> shapeLocations = new HashMap<ILocation, Shape>();
+ ILocation minimumLocation = getMinimumLocation(objects);
+ ContainerShape targetContainer = ((ContainerShape) context
+ .getPictogramElements()[0]);
+ List<Shape> originalShapes = new ArrayList<Shape>();
+ List<Shape> copiedShapes = new ArrayList<Shape>();
+ if (containsTargetContainer(targetContainer, objects))
+ targetContainer = getDiagram();
+ for (Object object : objects) {
+ if (object instanceof Shape) {
+ Shape copiedShape = (Shape) EcoreUtil.copy((EObject) object);
+ if (copiedShape instanceof ContainerShape) {
+ originalShapes.add((Shape) object);
+ copiedShapes.add(copiedShape);
+ ContainerShape originalContainer = (ContainerShape) object;
+ ContainerShape copiedContainer = (ContainerShape) copiedShape;
+ List<Shape> nestedOriginalShapes = new ArrayList<Shape>();
+ List<Shape> nestedcopiedShapes = new ArrayList<Shape>();
+ getAllNestedShapes(nestedOriginalShapes,
+ (originalContainer.getChildren()));
+ getAllNestedShapes(nestedcopiedShapes,
+ (copiedContainer.getChildren()));
+ copyConnections(nestedOriginalShapes, nestedcopiedShapes);
+ }
+
+ targetContainer.getChildren().add(copiedShape);
+ ILocation relativePosition = FMCUtil.getRelativePosition(
+ targetContainer, p.x, p.y);
+ shapeLocations.put(relativePosition, copiedShape);
+ copiedShape.getGraphicsAlgorithm().setX(
+ relativePosition.getX() - minimumLocation.getX()
+ + copiedShape.getGraphicsAlgorithm().getX());
+ copiedShape.getGraphicsAlgorithm().setY(
+ relativePosition.getY() - minimumLocation.getY()
+ + copiedShape.getGraphicsAlgorithm().getY());
+ if (FMCUtil.getBO(copiedShape) != null) {
+ EObject copy = EcoreUtil.copy(FMCUtil.getBO(copiedShape));
+ addCopyToModel(copy);
+ copiedShape.getLink().getBusinessObjects().clear();
+ copiedShape.getLink().getBusinessObjects().add(copy);
+ }
+
+ copyConnections(originalShapes, copiedShapes);
+ getDiagram().getChildren().add(copiedShape);
+ }
+ }
+ }
+
+ /**
+ * This method should be overridden when using alternative meta models. Does
+ * nothing in this case because no real meta model is used.
+ *
+ * @param copy
+ * The copy to be added to the model.
+ */
+ protected void addCopyToModel(EObject copy) {
+ // Do nothing
+ }
+
+ /**
+ * Returns all nested shapes recursively.
+ *
+ * @param nested
+ * The nested shapes result.
+ * @param shapes
+ * The shapes to be analyzed.
+ */
+ private void getAllNestedShapes(Collection<Shape> nested,
+ Collection<Shape> shapes) {
+ for (Shape shape : shapes) {
+ nested.add(shape);
+ if (shape instanceof ContainerShape) {
+ getAllNestedShapes(nested,
+ ((ContainerShape) shape).getChildren());
+ }
+ }
+ }
+
+ /**
+ * Copies the connections from originalShapes to copiedShapes
+ *
+ * @param originalShapes
+ * The original shapes.
+ * @param copiedShapes
+ * The copied shapes.
+ */
+ private void copyConnections(List<Shape> originalShapes,
+ List<Shape> copiedShapes) {
+ Collection<Connection> conToCopy = new HashSet<Connection>();
+ for (Connection con : getDiagram().getConnections()) {
+ boolean startFound = false;
+ boolean endFound = false;
+ for (Shape shape : originalShapes) {
+ if (con.getStart() != null
+ && shape.equals(con.getStart().getParent())) {
+ startFound = true;
+ }
+ if (con.getEnd() != null
+ && shape.equals(con.getEnd().getParent())) {
+ endFound = true;
+ }
+ if (startFound && endFound)
+ break;
+ }
+ if (startFound && endFound)
+ conToCopy.add(con);
+ }
+ for (Connection connection : conToCopy) {
+ Connection copy = EcoreUtil.copy(connection);
+ Shape start = findCopy(originalShapes, copiedShapes,
+ (Shape) connection.getStart().getParent());
+ Shape end = findCopy(originalShapes, copiedShapes,
+ (Shape) connection.getEnd().getParent());
+ copy.setStart(start.getAnchors().get(0));
+ copy.setEnd(end.getAnchors().get(0));
+ getDiagram().getConnections().add(copy);
+ }
+ }
+
+ /**
+ * Finds the copy of the original in the copied shapes using the same index
+ * as the original.
+ *
+ * @param originalShapes
+ * The shapes to search for the original shape
+ * @param copiedShapes
+ * The copied shapes to find the copy in.
+ * @param original
+ * The original to be found in the originalShapes.
+ * @return The copy of the original using the same index.
+ */
+ private Shape findCopy(List<Shape> originalShapes,
+ List<Shape> copiedShapes, Shape original) {
+ return copiedShapes.get(originalShapes.indexOf(original));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeature#addGraphicalRepresentation
+ * (org.eclipse.graphiti.features.context.IAreaContext, java.lang.Object)
+ */
+ @Override
+ protected PictogramElement addGraphicalRepresentation(IAreaContext context,
+ Object newObject) {
+ if (context instanceof IAddContext)
+ return getFeatureProvider().addIfPossible((IAddContext) context);
+ else
+ return getFeatureProvider().addIfPossible(
+ new AddContext(context, newObject));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.IPasteFeature#canPaste(org.eclipse.graphiti
+ * .features.context.IPasteContext)
+ */
+ @Override
+ public boolean canPaste(IPasteContext context) {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/TextDirectEditingFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/TextDirectEditingFeature.java
new file mode 100644
index 0000000..b20f24e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/TextDirectEditingFeature.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDirectEditingContext;
+import org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature;
+import org.eclipse.graphiti.func.IDirectEditing;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class TextDirectEditingFeature extends AbstractDirectEditingFeature {
+
+ public TextDirectEditingFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.func.IDirectEditing#getEditingType()
+ */
+ @Override
+ public int getEditingType() {
+ return IDirectEditing.TYPE_MULTILINETEXT;
+ }
+
+ /**
+ * If the selected element is a text, this method will return it, otherwise
+ * null.
+ *
+ * @param context
+ * The direct editing context.
+ *
+ * @return The text if one was selected, otherwise null.
+ */
+ protected AbstractText getText(IDirectEditingContext context) {
+ if (context.getGraphicsAlgorithm() instanceof AbstractText)
+ return (AbstractText) context.getGraphicsAlgorithm();
+ else
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IDirectEditing#getInitialValue(org.eclipse.
+ * graphiti.features.context.IDirectEditingContext)
+ */
+ @Override
+ public String getInitialValue(IDirectEditingContext context) {
+ AbstractText text = getText(context);
+ if (text != null) {
+ return text.getValue();
+ } else
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature#setValue
+ * (java.lang.String,
+ * org.eclipse.graphiti.features.context.IDirectEditingContext)
+ */
+ @Override
+ public void setValue(String value, IDirectEditingContext context) {
+ AbstractText text = getText(context);
+ if (text != null) {
+ text.setValue(value);
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AccessAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AccessAddFeature.java
new file mode 100644
index 0000000..cdbbc50
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AccessAddFeature.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+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.algorithms.Polyline;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.CurvedConnection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * Feature responsible for adding the graphical representation of access
+ * connections.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AccessAddFeature extends ConnectionAddFeature {
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param style
+ * The style of the connection: normal or manhattan are
+ * supported.
+ */
+ public AccessAddFeature(IFeatureProvider fp, ConnectionStyle style) {
+ super(fp, style);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public PictogramElement add(IAddContext context) {
+
+ IGaService ga = Graphiti.getGaService();
+ IPeService pe = Graphiti.getPeService();
+ IAddConnectionContext cContext = (IAddConnectionContext) context;
+
+ Connection con = super.createConnection();
+ Polyline line = ga.createPolyline(con);
+ con.setStart(cContext.getSourceAnchor());
+ con.setEnd(cContext.getTargetAnchor());
+ line.setForeground(manageColor(0, 0, 0));
+
+ if (context.getNewObject() == FMCType.UnidirectionalAccess) {
+ createArrowDecorator(getDiagram(), con, true);
+ } else if (context.getNewObject() == FMCType.ModifyAccess) {
+ CompositeConnection compCon = (CompositeConnection) con;
+ CurvedConnection curved1 = pe.createCurvedConnection(new double[] {
+ 0.50d, 50d }, getDiagram());
+ CurvedConnection curved2 = pe.createCurvedConnection(new double[] {
+ 0.50d, -50d }, getDiagram());
+ compCon.getChildren().add(curved1);
+ compCon.getChildren().add(curved2);
+ ga.createPolyline(curved1);
+ ga.createPolyline(curved2);
+ createArrowDecorator(getDiagram(), curved1, true);
+ createArrowDecorator(getDiagram(), curved2, false);
+ line.setLineVisible(false);
+ } else
+ addDomainModelContent(context, con, line);
+
+ link(con, (context.getNewObject()));
+ return con;
+ }
+
+ /**
+ * This method should be overridden if alternative meta models are used.
+ * This method's intention is to change the graphical representation of the
+ * connection according to the new object stored in the context. For the
+ * simple enumeration based meta model nothing is done.
+ *
+ * @param context
+ * The add context.
+ * @param con
+ * The connection to add the domain model element to.
+ * @param line
+ * The polyline representing the connection.
+ */
+ protected void addDomainModelContent(IAddContext context, Connection con,
+ Polyline line) {
+ // Do nothing because the simple meta model provides only a type but
+ // without any further properties
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AgentAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AgentAddFeature.java
new file mode 100644
index 0000000..86067fd
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AgentAddFeature.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.AgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+
+/**
+ * Add Feature class responsible for creating Agent shapes. Supports all shape
+ * styles.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AgentAddFeature extends FMCNodeAddFeature {
+
+ /**
+ * Default constructor with default rectangle width.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public AgentAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ minimumWidth = RectangleAgentAlgorithm.AGENT_DEFAULT_WIDTH;;
+ minimumHeight = RectangleAgentAlgorithm.AGENT_DEFAULT_HEIGHT;
+ }
+
+ /**
+ * Constructor which allows to set the minimum width, height, angle and
+ * title.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param title
+ * The title text of the agent shape
+ * @param width
+ * The minimum shape width.
+ * @param height
+ * The minimum shape height.
+ * @param angle
+ * The angle.
+ */
+ public AgentAddFeature(IFeatureProvider featureProvider, String title, int width,
+ int height, int angle) {
+ super(featureProvider, title, angle);
+ super.minimumHeight = height;
+ super.minimumWidth = width;
+ }
+
+ /**
+ * Constructor which initializes the agent with a particular style.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param style
+ * The style to be used, e.g. RECT, L, U are supported.
+ */
+ public AgentAddFeature(IFeatureProvider featureProvider, ShapeStyle style) {
+ super(featureProvider, style);
+ setDefaultSize(style);
+ }
+
+ /**
+ * Sets the default size based on the style.
+ *
+ * @param style
+ * The style to determine the default size from.
+ */
+ private void setDefaultSize(ShapeStyle style) {
+ if (style != null) {
+ switch (style) {
+ case RECT:
+ minimumWidth = RectangleAgentAlgorithm.AGENT_DEFAULT_WIDTH;
+ minimumHeight = RectangleAgentAlgorithm.AGENT_DEFAULT_HEIGHT;
+ break;
+ case L:
+ minimumWidth = LAgentAlgorithm.LAGENT_DEFAULT_WIDTH;
+ minimumHeight = LAgentAlgorithm.LAGENT_DEFAULT_HEIGHT;
+ break;
+ case U:
+ minimumWidth = UAgentAlgorithm.UAGENT_DEFAULT_WIDTH;
+ minimumHeight = UAgentAlgorithm.UAGENT_DEFAULT_HEIGHT;
+ break;
+ default:
+ assert false : "No style literal matched in switch";
+ break;
+ }
+ } else {
+ minimumWidth = RectangleAgentAlgorithm.AGENT_DEFAULT_WIDTH;
+ minimumHeight = RectangleAgentAlgorithm.AGENT_DEFAULT_HEIGHT;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.FMCNodeAddFeature#createGraphics
+ * (org.eclipse.graphiti.mm.GraphicsAlgorithmContainer,
+ * org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ protected GraphicsAlgorithm createGraphics(
+ GraphicsAlgorithmContainer gaContainer, IAddContext context) {
+ AgentAlgorithm algorithm = FMCNodeAlgorithmFactory.getInstance()
+ .getAgentByShapestyle(this.shapeType);
+ return algorithm.createGraphics(getDiagram(), gaContainer, 0, 0,
+ getWidth(context), getHeight(context));
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AnchorAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AnchorAddFeature.java
new file mode 100644
index 0000000..d9308b8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AnchorAddFeature.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.AnchoredNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.impl.AbstractAddPictogramElementFeature;
+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;
+
+/**
+ * This class is responsible for adding an additional anchor to a shape.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AnchorAddFeature extends AbstractAddPictogramElementFeature {
+
+ /**
+ * Factory for fmc node algorithms.
+ */
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ /**
+ * The main constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public AnchorAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ ContainerShape targetContainer = context.getTargetContainer();
+ return !(targetContainer instanceof Diagram) && targetContainer != null
+ && targetContainer.isActive();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape targetContainer = context.getTargetContainer();
+ double relativeWidth = ((double) context.getX())
+ / ((double) targetContainer.getGraphicsAlgorithm().getWidth());
+ double relativeHeight = ((double) context.getY())
+ / ((double) targetContainer.getGraphicsAlgorithm().getHeight());
+ BoxRelativeAnchor boxAnchor = factory.getHumanAgent().createBoxAnchor(
+ targetContainer, relativeWidth, relativeHeight,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER,
+ AnchoredNode.DEFAULT_ANCHOR_DIAMETER);
+ boxAnchor.getGraphicsAlgorithm().setFilled(true);
+ boxAnchor.getGraphicsAlgorithm().setLineVisible(true);
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AreaBorderAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AreaBorderAddFeature.java
new file mode 100644
index 0000000..4ca38b8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/AreaBorderAddFeature.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.algorithms.styles.LineStyle;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This feature adds the graphical representation of an Area Border to the
+ * diagram.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class AreaBorderAddFeature extends ShapeAddFeature {
+
+ private static final int MIN_HEIGHT = 100;
+ private static final int MIN_WIDTH = 100;
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ */
+ public AreaBorderAddFeature(IFeatureProvider fp) {
+ super(fp);
+ super.minimumWidth = MIN_WIDTH;
+ super.minimumHeight = MIN_HEIGHT;
+ }
+
+ /**
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param linked
+ * True if the pictogram element should be linked to a model
+ * object.
+ */
+ public AreaBorderAddFeature(IFeatureProvider featureProvider, boolean linked) {
+ super(featureProvider);
+ super.minimumWidth = MIN_WIDTH;
+ super.minimumHeight = MIN_HEIGHT;
+ super.linked = linked;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.ShapeAddFeature#canAdd
+ * (org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape container = context.getTargetContainer();
+ ContainerShape areaBorderContainer = pe.createContainerShape(container,
+ true);
+
+ Rectangle invRec = ga.createInvisibleRectangle(areaBorderContainer);
+ invRec.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE));
+ if (linked)
+ link(areaBorderContainer, context.getNewObject());
+
+ int w = context.getWidth();
+ int h = context.getHeight();
+ int min = 100;
+ // check that the longer dim is at least min
+ if (context.getWidth() > context.getHeight()) {
+ w = context.getWidth() < min ? min : w;
+ } else {
+ h = context.getHeight() < min ? min : h;
+ }
+
+ int margin = 2;
+ int lineWidth = 2;
+ int textHeight = 20;
+ int textWidth = 100;
+
+ // dashed line
+ Polyline line = ga.createPolyline(invRec);
+ line.setLineStyle(LineStyle.DASH);
+ line.setLineWidth(lineWidth);
+ line.setParentGraphicsAlgorithm(invRec);
+ line.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE));
+ // description text
+ MultiText txt = ga.createMultiText(invRec, "Area Border");
+ txt.setForeground(manageColor(0, 0, 0));
+ txt.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE));
+ // txt.setFont(ga.manageFont(getDiagram(), "Arial", 10, false, false));
+ txt.setParentGraphicsAlgorithm(invRec);
+
+ if (context.getWidth() > context.getHeight()) {
+ // position of containing rectangle
+ ga.setLocationAndSize(invRec, context.getX(), context.getY(), w, 3
+ * margin + lineWidth + textHeight);
+
+ // position of text field
+ txt.setHorizontalAlignment(Orientation.ALIGNMENT_RIGHT);
+ txt.setVerticalAlignment(Orientation.ALIGNMENT_BOTTOM);
+ ga.setLocationAndSize(txt, margin, margin, w - (2 * margin),
+ textHeight);
+
+ // position of dashed line
+ ga.setLocationAndSize(line, 0, 2 * margin + textHeight, w, 2);
+ line.getPoints().add(ga.createPoint(0, 0));
+ line.getPoints().add(ga.createPoint(w, 0));
+ } else {
+ // position of containing rectangle
+ ga.setLocationAndSize(invRec, context.getX(), context.getY(), 3
+ * margin + lineWidth + textWidth, h);
+
+ // position of dashed line
+ ga.setLocationAndSize(line, margin, 0, 2, h);
+ line.getPoints().add(ga.createPoint(0, 0));
+ line.getPoints().add(ga.createPoint(0, h));
+
+ // position of text field
+ txt.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
+ txt.setVerticalAlignment(Orientation.ALIGNMENT_BOTTOM);
+ ga.setLocationAndSize(txt, 2 * margin + lineWidth, margin,
+ textWidth, h - 2 * margin);
+ }
+
+ return areaBorderContainer;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BlockDiagramAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BlockDiagramAddFeature.java
new file mode 100644
index 0000000..c06f937
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BlockDiagramAddFeature.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.graphiti.datatypes.ILocation;
+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.algorithms.styles.Font;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * TODO Importing causes still references to the imported diagram
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramAddFeature extends AgentAddFeature {
+
+ public static final String DIAGRAM_PROP = "RES";
+
+ public BlockDiagramAddFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape container = context.getTargetContainer();
+ Diagram blockDiagram = (Diagram) context.getProperty(DIAGRAM_PROP);
+
+ blockDiagram = EcoreUtil.copy(blockDiagram);
+ // Move to new Container
+ for (Shape shape : new ArrayList<Shape>(blockDiagram.getChildren())) {
+ shape.setContainer(container);
+ }
+ for (Connection con : new ArrayList<Connection>(
+ blockDiagram.getConnections())) {
+ con.setParent(getDiagram());
+ if (con instanceof FreeFormConnection) {
+ ILocation locationRelativeToDiagram = Graphiti
+ .getPeLayoutService().getLocationRelativeToDiagram(
+ container);
+ for (Point bend : ((FreeFormConnection) con).getBendpoints()) {
+ bend.setX(bend.getX() + locationRelativeToDiagram.getX());
+ bend.setY(bend.getY() + locationRelativeToDiagram.getY());
+ }
+ }
+ }
+ for (Style style : new ArrayList<Style>(blockDiagram.getStyles())) {
+ style.setStyleContainer(getDiagram());
+ getDiagram().getStyles().add(style);
+ }
+ for (Font font : new ArrayList<Font>(blockDiagram.getFonts())) {
+ getDiagram().getFonts().add(font);
+ }
+ for (Color color : new ArrayList<Color>(blockDiagram.getColors())) {
+ getDiagram().getColors().add(color);
+ }
+ return blockDiagram;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BraceAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BraceAddFeature.java
new file mode 100644
index 0000000..d88bd97
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/BraceAddFeature.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.comment.BraceAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.comment.CommentAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This feature adds the graphical representation of a brace shape to the
+ * diagram.
+ *
+ * @author Rainer Thome
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class BraceAddFeature extends ShapeAddFeature {
+
+ /**
+ * Brace algorithm to create the graphical representation.
+ */
+ private BraceAlgorithm braceAlgorithm = CommentAlgorithmFactory.getInstance()
+ .getBrace();
+
+ /**
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public BraceAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ super.minimumWidth = braceAlgorithm.getMinimumWidth();
+ super.minimumHeight = braceAlgorithm.getMinimumHeight();
+ }
+
+ /**
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param linked
+ * True if the pictogram element should be linked to a model
+ * object.
+ */
+ public BraceAddFeature(IFeatureProvider featureProvider, boolean linked) {
+ super(featureProvider);
+ super.minimumWidth = braceAlgorithm.getMinimumWidth();
+ super.minimumHeight = braceAlgorithm.getMinimumHeight();
+ super.linked = linked;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.ShapeAddFeature#canAdd
+ * (org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape container = context.getTargetContainer();
+ ContainerShape newContainer = pe.createContainerShape(container, true);
+
+ Rectangle invRec = ga.createInvisibleRectangle(newContainer);
+ invRec.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE));
+ if (linked)
+ link(newContainer, context.getNewObject());
+
+ BraceAlgorithm algorithm = CommentAlgorithmFactory.getInstance()
+ .getBrace();
+ GraphicsAlgorithm secondLevelGa = algorithm.createGraphics(
+ getDiagram(), invRec, context.getX(), context.getY(),
+ getWidth(context), getHeight(context));
+
+ secondLevelGa.setParentGraphicsAlgorithm(invRec);
+
+ return newContainer;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommonFeatureAreaAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommonFeatureAreaAddFeature.java
new file mode 100644
index 0000000..2f2c0f9
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommonFeatureAreaAddFeature.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Add Feature class responsible for adding the graphical representation of a
+ * common feature area to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CommonFeatureAreaAddFeature extends ShapeAddFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public CommonFeatureAreaAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /**
+ * Constructor allowing to set whether the the area should be linked with a
+ * domain model object.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param linked
+ * True if the pictogram element should be linked to a model
+ * object.
+ */
+ public CommonFeatureAreaAddFeature(IFeatureProvider featureProvider, boolean linked) {
+ super(featureProvider);
+ super.linked = linked;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public PictogramElement add(IAddContext context) {
+ ContainerShape newShape = pe.createContainerShape(
+ context.getTargetContainer(), true);
+ Rectangle rec = ga.createRectangle(newShape);
+ rec.setLineVisible(false);
+ rec.setBackground(manageColor(200, 200, 200));
+ ga.setLocationAndSize(rec, context.getX(), context.getY(),
+ getWidth(context), getHeight(context));
+ addText(newShape, context.getNewObject());
+ pe.createChopboxAnchor(newShape);
+ if (linked)
+ link(newShape, context.getNewObject());
+
+ return newShape;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommunicationChannelAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommunicationChannelAddFeature.java
new file mode 100644
index 0000000..b6183ab
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/CommunicationChannelAddFeature.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.fmc.mm.RequestDirection;
+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.algorithms.Polygon;
+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.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * This class is a specialization of the {@link ConnectionAddFeature} and
+ * responsible for adding access via channels. Both bidirectional and
+ * unidirectional as well as request response are supported.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CommunicationChannelAddFeature extends ConnectionAddFeature {
+
+ private FMCTypeChecker checker = FMCTypeCheckerFactory.getInstance();
+ private FMCConnectionAlgorithmFactory factory = FMCConnectionAlgorithmFactory
+ .getInstance();
+ /**
+ * The position of the decorator. It is not the center because manhattan
+ * connections tend to reroute at this position.
+ */
+ private static final float decoPosX = 0.4f;
+ /**
+ * The default channel text if not specified.
+ */
+ protected static final String defaultChannelText = "Channel";
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param type
+ * The type of the connection.
+ */
+ public CommunicationChannelAddFeature(IFeatureProvider fp,
+ ConnectionStyle type) {
+ super(fp, type);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public PictogramElement add(IAddContext context) {
+ IPeService pe = Graphiti.getPeService();
+ IGaService ga = Graphiti.getGaService();
+
+ IAddConnectionContext cContext = (IAddConnectionContext) context;
+
+ Connection cShape = super.createConnection();
+ Polyline line = ga.createPolyline(cShape);
+ cShape.setStart(cContext.getSourceAnchor());
+ cShape.setEnd(cContext.getTargetAnchor());
+ line.setForeground(manageColor(0, 0, 0));
+
+ FMCConnectionAlgorithm connectionAlgorithm = factory.getAlgorithm(cShape);
+ connectionAlgorithm.createChannelSymbol(cShape, getDiagram());
+
+ if (checker.isUnidirectionalCommunicationChannel(context.getNewObject())) {
+ createCenterArrow(getDiagram(), cShape, true);
+ createArrowDecorator(getDiagram(), cShape, true);
+ }
+ if (checker.isReqRespCommunicationChannel((context.getNewObject()))) {
+ connectionAlgorithm.setRequestDirection(cShape,
+ RequestDirection.REQUEST, (getDiagram()));
+ }
+ linkModel(cShape, cContext);
+ ConnectionDecorator textDecorator = pe.createConnectionDecorator(
+ cShape, true, decoPosX, true);
+ Text text = ga.createText(textDecorator);
+ text.setForeground(manageColor(0, 0, 0));
+ ga.setLocation(text, 0, 15);
+ // set reference name in the text decorator
+
+ text.setValue(getNameFromObject(context.getNewObject()));
+ text.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.CONNECTION));
+ linkTextWithModel(textDecorator, context.getNewObject());
+ return cShape;
+ }
+
+ protected void linkTextWithModel(PictogramElement element, Object obj) {
+ if (obj instanceof FMCType)
+ link(element, FMCType.Text);
+ else {
+ link(element, obj);
+ Graphiti.getLinkService().setLinkProperty(element, "name");
+ }
+ }
+
+ /**
+ * Returns the value of the name attribute of the object.
+ *
+ * @param obj
+ * The object to get the name from.
+ *
+ * @return The value of the name attribute of the eobject, if not an eobject
+ * return default text.
+ */
+ protected String getNameFromObject(Object obj) {
+ if (obj instanceof EObject) {
+ String name = null;
+ EObject eobj = ((EObject) obj);
+ for (EAttribute attr : eobj.eClass().getEAllAttributes()) {
+ if ("name".equals(attr.getName())) {
+ name = (String) eobj.eGet(attr);
+ if (name != null)
+ return name;
+ else {
+ eobj.eSet(attr, defaultChannelText);
+ return defaultChannelText;
+ }
+ }
+ }
+ }
+ return defaultChannelText;
+ }
+
+ /**
+ * Creates the graphical representation of the arrow located near the
+ * channel oval decorator.
+ *
+ * @param diagram
+ * The diagram to create the arrow for.
+ * @param connection
+ * The connection to be decorated with the arrow.
+ * @param defaultDirection
+ * True if the default direction should be used (from source to
+ * target), false otherwise.
+ */
+ public static void createCenterArrow(Diagram diagram, Connection connection,
+ boolean defaultDirection) {
+ ConnectionDecorator arrow1 = Graphiti.getPeService()
+ .createConnectionDecorator(connection, false, decoPosX, true);
+ Polygon p1 = null;
+ if (defaultDirection)
+ p1 = Graphiti.getGaService().createPolygon(arrow1,
+ new int[] { 23, -6, 8, 0, 23, 6, 20, 0 });
+ else
+ p1 = Graphiti.getGaService().createPolygon(arrow1,
+ new int[] { -21, -6, -6, 0, -21, 6, -18, 0 });
+ p1.setBackground(Graphiti.getGaService().manageColor(diagram, 0, 0, 0));
+ }
+
+ /**
+ * Links the domain model object from the context with the connection.
+ *
+ * @param con
+ * The connection to be linked with.
+ * @param context
+ * The add context containing the domain object.
+ */
+ protected void linkModel(Connection con, IAddContext context) {
+ link(con, context.getNewObject());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ConnectionAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ConnectionAddFeature.java
new file mode 100644
index 0000000..b3d483e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ConnectionAddFeature.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.impl.AbstractAddFeature;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * This is the super class of all add features for connections. It provides
+ * functionality to support the different connection styles
+ * {@link ConnectionStyle#NORMAL} and {@link ConnectionStyle#MANHATTAN}.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public abstract class ConnectionAddFeature extends AbstractAddFeature {
+
+ /**
+ * The connection style.
+ */
+ protected ConnectionStyle style;
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider The feature provider.
+ * @param type The style of the connection line.
+ */
+ public ConnectionAddFeature(IFeatureProvider featureProvider, ConnectionStyle type) {
+ super(featureProvider);
+ this.style = type;
+ }
+
+ /**
+ * Creates a new Freeform or Manhattan Connection by using the PeService.
+ *
+ * @return Connection with the style set by the {@linkplain #style}
+ * attribute.
+ */
+ protected Connection createConnection() {
+ IPeService pe = Graphiti.getPeService();
+ switch (this.style) {
+ case NORMAL:
+ return pe.createFreeFormConnection(getDiagram());
+ case MANHATTAN:
+ return pe.createManhattanConnection(getDiagram());
+ case COMPOSITE:
+ return pe.createCompositeConnection(getDiagram());
+ default:
+ return pe.createManhattanConnection(getDiagram());
+ }
+ }
+
+ /**
+ * Creates the arrow decorator for the line.
+ *
+ * @param diagram
+ * The diagram the connection belongs to.
+ * @param con
+ * The connection the decorator should be created for.
+ * @param defaultDirection
+ * True if default direction should be used (from source to
+ * target), false otherwise.
+ */
+ public static void createArrowDecorator(Diagram diagram, Connection con,
+ boolean defaultDirection) {
+ ConnectionDecorator deco = Graphiti.getPeService()
+ .createConnectionDecorator(con, false,
+ defaultDirection ? 1.0 : 0.0, true);
+ Polygon poly = Graphiti.getGaService().createPolygon(deco,
+ new int[] { -15, 6, 0, 0, -15, -6, -12, 0 });
+ poly.setBackground(Graphiti.getGaService()
+ .manageColor(diagram, 0, 0, 0));
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsConnectionAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsConnectionAddFeature.java
new file mode 100644
index 0000000..5f7e73a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsConnectionAddFeature.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+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.algorithms.Ellipse;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+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.IPeService;
+
+/**
+ * This class is responsible for adding dots as a connection to the diagram.
+ * Notice that dots connection can be drawn with no target (only source).
+ * However, in the background, an invisible shape will be added.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DotsConnectionAddFeature extends ConnectionAddFeature {
+
+ /**
+ * The diameter of a dots decorator.
+ */
+ public static final int DOTS_SIZE = 6;
+
+ /**
+ * The number of circles drawn when a dots connection is created.
+ */
+ public static final int NO_OF_DOTS = 3;
+
+ /**
+ * Specifies whether the graphical element is bound to a domain object.
+ */
+ protected boolean linked = true;
+
+ /**
+ * The main cosntructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param style
+ * The connection style.
+ */
+ public DotsConnectionAddFeature(IFeatureProvider featureProvider, ConnectionStyle style) {
+ super(featureProvider, style);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ IPeService pe = Graphiti.getPeService();
+ IGaService ga = Graphiti.getGaService();
+ IAddConnectionContext cContext = (IAddConnectionContext) context;
+
+ Connection cShape = super.createConnection();
+ Polyline line = ga.createPolyline(cShape);
+ line.setLineVisible(false);
+ cShape.setStart(cContext.getSourceAnchor());
+ cShape.setEnd(cContext.getTargetAnchor());
+ line.setForeground(manageColor(0, 0, 0));
+
+ for (int i = 0; i < NO_OF_DOTS; i++) {
+ ConnectionDecorator deco = pe.createConnectionDecorator(cShape,
+ false, (0.8 / NO_OF_DOTS) * (i + 1), true);
+ Ellipse e = ga.createEllipse(deco);
+ e.setBackground(manageColor(0, 0, 0));
+ e.setForeground(manageColor(0, 0, 0));
+ ga.setSize(e, DOTS_SIZE, DOTS_SIZE);
+ }
+
+ if (linked)
+ link(cShape, ((FMCType) context.getNewObject()));
+ return cShape;
+ }
+
+ /**
+ * Checks whether the given connection is a dots connection using the number
+ * of decorators and their type and size.
+ *
+ * @param connection
+ * The connection to be checked.
+ * @return True if it is a dots connection.
+ */
+ public static boolean isDots(Connection connection) {
+ for (ConnectionDecorator decorator : connection
+ .getConnectionDecorators()) {
+ if (decorator.getGraphicsAlgorithm() instanceof Ellipse) {
+ Ellipse ellipse = (Ellipse) decorator.getGraphicsAlgorithm();
+ if (ellipse.getWidth() != DOTS_SIZE
+ || ellipse.getHeight() != DOTS_SIZE) {
+ return false;
+ }
+ }
+ }
+ return connection.getConnectionDecorators().size() == 3;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsShapeAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsShapeAddFeature.java
new file mode 100644
index 0000000..d960c03
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/DotsShapeAddFeature.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.RoundedRectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.util.ColorConstant;
+
+import static org.eclipse.fmc.blockdiagram.editor.features.add.DotsConnectionAddFeature.DOTS_SIZE;
+
+/**
+ * This class is responsible for adding dots as a shape to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DotsShapeAddFeature extends ShapeAddFeature {
+
+ /**
+ * Main constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public DotsShapeAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /**
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param linked
+ * True if graphical object is linked to domain object.
+ */
+ public DotsShapeAddFeature(IFeatureProvider featureProvider, boolean linked) {
+ super(featureProvider);
+ super.linked = linked;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape newShape = pe.createContainerShape(
+ context.getTargetContainer(), true);
+ createGraphics(newShape, context);
+ if (linked)
+ link(newShape, context.getNewObject());
+ return newShape;
+ }
+
+ /**
+ * Creates the graphical representation of the dots shape.
+ *
+ * @param container
+ * The container shape to create the graphics algorithms for.
+ * @param context
+ * The add context.
+ */
+ protected void createGraphics(ContainerShape container, IAddContext context) {
+ RoundedRectangle invRectangle = ga.createRoundedRectangle(container,
+ getWidth(context), getHeight(context));
+ invRectangle.setLineVisible(false);
+ invRectangle.setFilled(false);
+ ga.setLocationAndSize(invRectangle, context.getX(), context.getY(),
+ getWidth(context), getHeight(context));
+ // The layout depends on whether the widht or height is greater
+ // Horizontal layout
+ if (context.getWidth() > context.getHeight()) {
+ int gap = getDotsGap(getWidth(context));
+ for (int i = 0; i < DotsConnectionAddFeature.NO_OF_DOTS; i++) {
+ Shape nestedContainer = pe.createShape(container, false);
+ RoundedRectangle rectangle = ga.createRoundedRectangle(
+ nestedContainer, DOTS_SIZE, DOTS_SIZE);
+ ga.setLocationAndSize(rectangle, 0 + (i) * gap,
+ getHeight(context) / 2, DOTS_SIZE, DOTS_SIZE);
+ rectangle.setForeground(Graphiti.getGaService().manageColor(
+ getDiagram(), new ColorConstant(0, 0, 0)));
+ rectangle.setBackground(Graphiti.getGaService().manageColor(
+ getDiagram(), new ColorConstant(0, 0, 0)));
+ rectangle.setFilled(true);
+ }
+ // Vertical layout
+ } else {
+ int gap = getDotsGap(getHeight(context));
+ for (int i = 0; i < DotsConnectionAddFeature.NO_OF_DOTS; i++) {
+ Shape nestedContainer = pe.createShape(container, false);
+ RoundedRectangle rectangle = ga.createRoundedRectangle(
+ nestedContainer, DOTS_SIZE, DOTS_SIZE);
+ ga.setLocationAndSize(rectangle, getWidth(context) / 2, 0 + (i)
+ * gap, DOTS_SIZE, DOTS_SIZE);
+ rectangle.setForeground(Graphiti.getGaService().manageColor(
+ getDiagram(), new ColorConstant(0, 0, 0)));
+ rectangle.setBackground(Graphiti.getGaService().manageColor(
+ getDiagram(), new ColorConstant(0, 0, 0)));
+ rectangle.setFilled(true);
+ }
+ }
+
+ }
+
+ /**
+ * Calculates the gap between two dots based on the width of the shape.
+ *
+ * @param width
+ * The width of the shape.
+ * @return The gap between two dots symbols/decorators.
+ */
+ public static int getDotsGap(int width) {
+ return (width - DOTS_SIZE) / 2;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/FMCNodeAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/FMCNodeAddFeature.java
new file mode 100644
index 0000000..8ce0889
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/FMCNodeAddFeature.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This abstract class is the super class for all add features that add FMC
+ * nodes.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public abstract class FMCNodeAddFeature extends ShapeAddFeature {
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ */
+ public FMCNodeAddFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param defaultText
+ * The default text.
+ * @param angle
+ * The angle.
+ */
+ public FMCNodeAddFeature(IFeatureProvider fp, String defaultText, int angle) {
+ super(fp, defaultText, angle);
+ }
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param type
+ * The shape style.
+ */
+ public FMCNodeAddFeature(IFeatureProvider fp, ShapeStyle type) {
+ super(fp, type);
+ }
+
+ @Override
+ public PictogramElement add(IAddContext context) {
+
+ // Create invisible container shape & ga
+ ContainerShape newShape = pe.createContainerShape(
+ context.getTargetContainer(), true);
+ GraphicsAlgorithm firstLevelGa = createGraphics(newShape, context);
+ firstLevelGa.setLineVisible(false);
+ firstLevelGa.setFilled(false);
+ ga.setLocationAndSize(firstLevelGa, context.getX(), context.getY(),
+ getWidth(context), getHeight(context));
+
+ // Create visible node ga
+ GraphicsAlgorithm secondLevelGa = createGraphics(firstLevelGa, context);
+ secondLevelGa.setParentGraphicsAlgorithm(firstLevelGa);
+
+ // Create name text shape & ga
+ int x = super.textMargin;
+ int y = this.shapeType == ShapeStyle.RECT ? super.textMargin
+ : firstLevelGa.getHeight()
+ - LPolygonAlgorithm.L_PART_DEFAULT_SIZE
+ + super.textMargin;
+ int width = firstLevelGa.getWidth() - 2 * super.textMargin;
+ int height = this.shapeType == ShapeStyle.RECT ? firstLevelGa
+ .getHeight() - 2 * super.textMargin
+ : LPolygonAlgorithm.L_PART_DEFAULT_SIZE - 2 * super.textMargin;
+ addText(newShape, x, y, width, height, context.getNewObject());
+
+ // Link shape to model object
+ link(newShape, (context.getNewObject()));
+
+ return newShape;
+ }
+
+ /**
+ * Creates a new graphics algorithm and adds it to gaContainer.
+ *
+ * @param gaContainer
+ * The container (pictogram element or graphics algorithm) of the
+ * new graphics algorithm.
+ * @param context
+ * The context for the creation of the new graphics algorithm.
+ * @return The newly created graphics algorithm.
+ */
+ protected abstract GraphicsAlgorithm createGraphics(
+ GraphicsAlgorithmContainer gaContainer, IAddContext context);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/HumanAgentAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/HumanAgentAddFeature.java
new file mode 100644
index 0000000..12d24c6
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/HumanAgentAddFeature.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.HumanAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UAgentAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This class is responsible for adding the graphical representation of human
+ * agents to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class HumanAgentAddFeature extends FMCNodeAddFeature {
+
+ /**
+ * Minimal width of a human agent when it is added to the diagram.
+ */
+ private static int MIN_WIDTH = 70;
+ /**
+ * Minimal height of a human agent when it is added to the diagram.
+ */
+ private static int MIN_HEIGHT = 70;
+
+ /**
+ * Main constructor setting default values.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public HumanAgentAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ super.minimumHeight = MIN_HEIGHT;
+ super.minimumWidth = MIN_WIDTH;
+ }
+
+ /**
+ * Constructor for text, min width, height and angle.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param text
+ * Sets the angle of the text.
+ * @param minWidth
+ * Sets the minimum width.
+ * @param minHeight
+ * Sets the minimum height.
+ * @param angle
+ * Sets the angle of the shape.
+ */
+ public HumanAgentAddFeature(IFeatureProvider featureProvider, String text, int minWidth,
+ int minHeight, int angle) {
+ super(featureProvider, text, angle);
+ super.minimumHeight = minHeight;
+ super.minimumWidth = minWidth;
+ }
+
+ /**
+ * Constructor for shape style.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param style
+ * The style to be used, e.g. RECT, L, U are supported.
+ */
+ public HumanAgentAddFeature(IFeatureProvider featureProvider, ShapeStyle style) {
+ super(featureProvider, style);
+ minimumWidth = MIN_WIDTH;
+ minimumHeight = MIN_HEIGHT;
+ setDefaultSize(style);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.FMCNodeAddFeature#add(org.eclipse
+ * .graphiti.features.context.IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+
+ // Create invisible container shape & ga
+ ContainerShape newShape = pe.createContainerShape(
+ context.getTargetContainer(), true);
+ GraphicsAlgorithm firstLevelGa = createGraphics(newShape, context);
+ firstLevelGa.setLineVisible(false);
+ firstLevelGa.setFilled(false);
+ ga.setLocationAndSize(firstLevelGa, context.getX(), context.getY(),
+ getWidth(context), getHeight(context));
+
+ // Create visible node ga
+ GraphicsAlgorithm secondLevelGa = createGraphics(firstLevelGa, context);
+ secondLevelGa.setParentGraphicsAlgorithm(firstLevelGa);
+
+ // Create name text shape & ga
+ addText(newShape, Orientation.ALIGNMENT_BOTTOM, context.getNewObject());
+ // pe.createChopboxAnchor(childShape);
+
+ // Link shape to model object
+ link(newShape, context.getNewObject());
+
+ return newShape;
+ }
+
+ /**
+ * Sets the default size depending on the shape style.
+ *
+ * @param style The style.
+ */
+ private void setDefaultSize(ShapeStyle style) {
+ if (style != null) {
+ switch (style) {
+ case RECT:
+ minimumWidth = RectangleAgentAlgorithm.AGENT_DEFAULT_WIDTH;
+ minimumHeight = RectangleAgentAlgorithm.AGENT_DEFAULT_HEIGHT;
+ break;
+ case L:
+ minimumWidth = LAgentAlgorithm.LAGENT_DEFAULT_WIDTH;
+ minimumHeight = LAgentAlgorithm.LAGENT_DEFAULT_HEIGHT;
+ break;
+ case U:
+ minimumWidth = UAgentAlgorithm.UAGENT_DEFAULT_WIDTH;
+ minimumHeight = UAgentAlgorithm.UAGENT_DEFAULT_HEIGHT;
+ break;
+ default:
+ assert false : "No style literal matched in switch";
+ break;
+ }
+ } else {
+ minimumWidth = MIN_WIDTH;
+ minimumHeight = MIN_HEIGHT;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.FMCNodeAddFeature#createGraphics
+ * (org.eclipse.graphiti.mm.GraphicsAlgorithmContainer,
+ * org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ protected GraphicsAlgorithm createGraphics(
+ GraphicsAlgorithmContainer gaContainer, IAddContext context) {
+ HumanAgentAlgorithm algorithm = FMCNodeAlgorithmFactory.getInstance()
+ .getHumanAgent();
+ return algorithm.createGraphics(getDiagram(), gaContainer, 0, 0,
+ getWidth(context), getHeight(context));
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ImageAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ImageAddFeature.java
new file mode 100644
index 0000000..267d6dc
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ImageAddFeature.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+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.Image;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * This feature is responsible to add an image to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ImageAddFeature extends AbstractAddShapeFeature {
+
+ /**
+ * The id of the image.
+ */
+ protected String imageId;
+
+ /**
+ * Constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param imageId
+ * The id of the image (registered at the image provider).
+ */
+ public ImageAddFeature(IFeatureProvider featureProvider, String imageId) {
+ super(featureProvider);
+ this.imageId = imageId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ IGaService gaService = Graphiti.getGaService();
+ IPeService peService = Graphiti.getPeService();
+
+ ContainerShape parent = context.getTargetContainer();
+
+ ContainerShape newShape;
+
+ newShape = peService.createContainerShape(parent, true);
+ Rectangle imageBounds = GraphitiUi.getImageService()
+ .getImageForId(getFeatureProvider().getDiagramTypeProvider().getProviderId(), imageId).getBounds();
+ Image image = gaService.createImage(newShape, imageId);
+ image.setId(imageId);
+ image.setStretchH(true);
+ image.setStretchV(true);
+ gaService.setLocationAndSize(image, context.getX(), context.getY(),
+ imageBounds.width, imageBounds.height);
+
+ link(newShape, context.getNewObject());
+
+ layoutPictogramElement(newShape);
+
+ return newShape;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/InvisibleShapeAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/InvisibleShapeAddFeature.java
new file mode 100644
index 0000000..f17b84a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/InvisibleShapeAddFeature.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This add feature adds an invisible rectangle to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class InvisibleShapeAddFeature extends ShapeAddFeature {
+
+ /**
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public InvisibleShapeAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ ContainerShape newShape = pe.createContainerShape(
+ context.getTargetContainer(), true);
+ newShape.setVisible(false);
+ Rectangle rec = ga.createRectangle(newShape);
+ rec.setLineWidth(2);
+ ga.setLocationAndSize(rec, context.getX(), context.getY(), 5, 5);
+ pe.createChopboxAnchor(newShape);
+ return newShape;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ShapeAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ShapeAddFeature.java
new file mode 100644
index 0000000..fffa568
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/ShapeAddFeature.java
@@ -0,0 +1,331 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramMessages;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.NamedNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+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.MultiText;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.services.IPeService;
+
+/**
+ * This abstract class is the super class for all add features that add shapes.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public abstract class ShapeAddFeature extends AbstractAddShapeFeature {
+
+ protected int minimumHeight = 30;
+ protected int minimumWidth = 40;
+ protected int angle = 0;
+ protected int textMargin = NamedNode.DEFAULT_MARGIN;
+
+ protected boolean linked = true;
+
+ protected IPeService pe = Graphiti.getPeService();
+ protected IGaService ga = Graphiti.getGaService();
+ protected final ShapeStyle shapeType;
+ protected final String defaultShapeText;
+ protected final FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ */
+ public ShapeAddFeature(IFeatureProvider fp) {
+ super(fp);
+ this.shapeType = ShapeStyle.RECT;
+ this.defaultShapeText = BlockDiagramMessages.FMCAddFeature_DefaultShapeTitle;
+ }
+
+ /**
+ * @param textMargin
+ * the textMargin to set
+ */
+ void setTextMargin(int textMargin) {
+ this.textMargin = textMargin;
+ }
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param defaultText
+ * The default text.
+ * @param angle
+ * The angle.
+ */
+ public ShapeAddFeature(IFeatureProvider fp, String defaultText, int angle) {
+ super(fp);
+ this.shapeType = ShapeStyle.RECT;
+ this.defaultShapeText = defaultText;
+ this.angle = angle;
+ }
+
+ /**
+ *
+ * @param fp
+ * The feature provider.
+ * @param type
+ * The shape style.
+ */
+ public ShapeAddFeature(IFeatureProvider fp, ShapeStyle type) {
+ super(fp);
+ if (type == null)
+ this.shapeType = ShapeStyle.RECT;
+ else
+ this.shapeType = type;
+ this.defaultShapeText = BlockDiagramMessages.FMCAddFeature_DefaultShapeTitle;
+ }
+
+ /**
+ *
+ * @return The style used for the Blockdiagram Editor.
+ */
+ protected Style getStyle() {
+ Style style = StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE);
+ style.setAngle(angle);
+ return style;
+ }
+
+ /**
+ * Adds a MultiText element to the container shape.
+ *
+ * @param container
+ * The container shape this text is embedded in.
+ * @param x
+ * The offset in x direction.
+ * @param y
+ * The offset in y direction.
+ * @param width
+ * The width of the text area.
+ * @param height
+ * The height of the text area.
+ * @param hor
+ * The horizontal Orientation.
+ * @param ver
+ * The vertical Orientation.
+ * @param text
+ * The text to be set.
+ * @param linkedObj
+ * The object this text will be linked to. The object must
+ * provide a name attribute.
+ * @return The Text Algorithm.
+ */
+ protected MultiText addText(ContainerShape container, int x, int y,
+ int width, int height, Orientation hor, Orientation ver,
+ String text, Object linkedObj) {
+ if (text != null) {
+ Shape txtShape = pe.createShape(container, false);
+ MultiText txt = ga.createMultiText(txtShape, text);
+ txt.setValue(text);
+ // AdapterFactory factory = new I18NAdapterFactory();
+ // factory.adapt(txt, I18NMultiTextAdapter.class);
+ // txtShape.eResource().getResourceSet().getAdapterFactories()
+ // .add(factory);
+ // txt.eAdapters().add(new I18NTextAdapter());
+ txt.setHorizontalAlignment(hor);
+ txt.setVerticalAlignment(ver);
+ ga.setLocationAndSize(txt, x, y, width, height);
+ // txt.setFont(ga.manageFont(getDiagram(),
+ // BlockDiagramMessages.FMCAddFeature_FontType, 10, false, false));
+ txt.setForeground(manageColor(0, 0, 0));
+ txt.setStyle(StyleUtil.getStyle(getDiagram(), StyleUtil.SHAPE));
+ if (linked)
+ linkTextWithModel(txtShape, linkedObj);
+
+ // txt.setParentGraphicsAlgorithm(container.getGraphicsAlgorithm());
+
+ return txt;
+ }
+ return null;
+ }
+
+ /**
+ * Adds a MultiText element to the container shape.
+ *
+ * @param container
+ * The container shape this text is embedded in.
+ * @param hor
+ * The horizontal Orientation.
+ * @param ver
+ * The vertical Orientation.
+ * @param text
+ * The text to be set.
+ * @param linkedObj
+ * The object this text will be linked to. The object must
+ * provide a name attribute.
+ * @return The Text Algorithm.
+ */
+ protected MultiText addText(ContainerShape container, Orientation hor,
+ Orientation ver, String text, Object linkedObj) {
+ return addText(container, textMargin, textMargin, container
+ .getGraphicsAlgorithm().getWidth() - 2 * textMargin, container
+ .getGraphicsAlgorithm().getHeight() - 2 * textMargin, hor, ver,
+ text, linkedObj);
+ }
+
+ /**
+ * Adds a MultiText element to the container shape with the domain object
+ * name property as text. If the domain object does not provide a name the
+ * default text is given.
+ *
+ * @param container
+ * The container shape this text is embedded in.
+ * @param hor
+ * The horizontal Orientation.
+ * @param ver
+ * The vertical Orientation.
+ * @param linkedObj
+ * The object this text will be linked to. The object must
+ * provide a name attribute.
+ * @return The Text Algorithm.
+ */
+ protected MultiText addText(ContainerShape container, Orientation hor,
+ Orientation ver, Object linkedObj) {
+ String txt = getTextFromModel(linkedObj);
+ return addText(container, hor, ver, txt, linkedObj);
+ }
+
+ /**
+ * Adds a MultiText element to the container shape with default text and
+ * default vertical and horizontal orientation set to CENTER.
+ *
+ * @param container
+ * The container shape this text is embedded in.
+ * @param linkedObj
+ * The object this text will be linked to. The object must
+ * provide a name attribute.
+ * @return The Text Algorithm.
+ */
+ protected MultiText addText(ContainerShape container, Object linkedObj) {
+ return addText(container, Orientation.ALIGNMENT_CENTER,
+ Orientation.ALIGNMENT_CENTER, linkedObj);
+ }
+
+ /**
+ * Adds a MultiText element to the container shape with default text and
+ * default horizontal orientation set to CENTER.
+ *
+ * @param container
+ * The container shape this text is embedded in.
+ * @param orientation
+ * The vertical orientation.
+ * @param linkedObj
+ * The object this text will be linked to. The object must
+ * provide a name attribute.
+ */
+ protected void addText(ContainerShape container, Orientation orientation,
+ Object linkedObj) {
+ addText(container, Orientation.ALIGNMENT_CENTER, orientation, linkedObj);
+ }
+
+ protected void addText(ContainerShape container, int x, int y, int width,
+ int height, Object linkedObj) {
+ String txt = getTextFromModel(linkedObj);
+ addText(container, x, y, width, height, Orientation.ALIGNMENT_CENTER,
+ Orientation.ALIGNMENT_CENTER, txt, linkedObj);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context
+ * .IAddContext)
+ */
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ /**
+ * Returns the width which is always greater or equal to the minimum width
+ * of this shape.
+ *
+ * @param context
+ * The add context providing the height.
+ * @return The width >= minimum height.
+ */
+ protected int getHeight(IAddContext context) {
+ if (context.getHeight() < minimumHeight)
+ return minimumHeight;
+ else
+ return context.getHeight();
+ }
+
+ /**
+ * Returns the width which is always greater or equal to the minimum height
+ * of this shape.
+ *
+ * @param context
+ * The add context providing the width.
+ * @return The width >= minimum width.
+ */
+ protected int getWidth(IAddContext context) {
+ if (context.getWidth() < minimumWidth)
+ return minimumWidth;
+ else
+ return context.getWidth();
+ }
+
+ protected void linkTextWithModel(Shape shape, Object obj) {
+ if (obj instanceof FMCType)
+ link(shape, FMCType.Text);
+ else {
+ link(shape, obj);
+ Graphiti.getLinkService().setLinkProperty(shape, "name");
+ }
+ }
+
+ protected String getTextFromModel(Object obj) {
+ if (obj instanceof EObject) {
+ String name = null;
+ EObject eobj = ((EObject) obj);
+ for (EAttribute attr : eobj.eClass().getEAllAttributes()) {
+ if ("name".equals(attr.getName())) {
+ name = (String) eobj.eGet(attr);
+ if (name != null)
+ return name;
+ else {
+ eobj.eSet(attr, defaultShapeText);
+ return defaultShapeText;
+ }
+ }
+
+ }
+ }
+ return defaultShapeText;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StorageAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StorageAddFeature.java
new file mode 100644
index 0000000..1cb8052
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StorageAddFeature.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RectangleStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.StorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UStorageAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.GraphicsAlgorithmContainer;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+
+/**
+ * This feature is responsible for adding storage shapes to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class StorageAddFeature extends FMCNodeAddFeature {
+
+ /**
+ * Minimum width of the shape.
+ */
+ private static int MIN_WIDTH = 70;
+ /**
+ * Minimum height of the shape.
+ */
+ private static int MIN_HEIGHT = 30;
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public StorageAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ minimumWidth = MIN_WIDTH;
+ minimumHeight = MIN_HEIGHT;
+ }
+
+ /**
+ * Constructor for setting the style of the shape.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param style
+ * The style of the shape.
+ */
+ public StorageAddFeature(IFeatureProvider featureProvider, ShapeStyle style) {
+ super(featureProvider, style);
+ setDefaultSize(style);
+ }
+
+ /**
+ * Sets the default size depending on the style.
+ *
+ * @param style
+ * The style of the shape.
+ */
+ private void setDefaultSize(ShapeStyle style) {
+ if (style != null) {
+ switch (style) {
+ case RECT:
+ minimumWidth = RectangleStorageAlgorithm.STORAGE_DEFAULT_WIDTH;
+ minimumHeight = RectangleStorageAlgorithm.STORAGE_DEFAULT_HEIGHT;
+ break;
+ case L:
+ minimumWidth = LStorageAlgorithm.LSTORAGE_DEFAULT_WIDTH;
+ minimumHeight = LStorageAlgorithm.LSTORAGE_DEFAULT_HEIGHT;
+ break;
+ case U:
+ minimumWidth = UStorageAlgorithm.USTORAGE_DEFAULT_WIDTH;
+ minimumHeight = UStorageAlgorithm.USTORAGE_DEFAULT_HEIGHT;
+ break;
+ default:
+ assert false : "No style literal matched in switch";
+ break;
+ }
+ } else {
+ minimumWidth = MIN_WIDTH;
+ minimumHeight = MIN_HEIGHT;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.FMCNodeAddFeature#createGraphics
+ * (org.eclipse.graphiti.mm.GraphicsAlgorithmContainer,
+ * org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ protected GraphicsAlgorithm createGraphics(
+ GraphicsAlgorithmContainer gaContainer, IAddContext context) {
+ StorageAlgorithm algorithm = FMCNodeAlgorithmFactory.getInstance()
+ .getStorageByShapestyle(this.shapeType);
+ return algorithm.createGraphics(getDiagram(), gaContainer, 0, 0,
+ getWidth(context), getHeight(context));
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StructureVarianceAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StructureVarianceAddFeature.java
new file mode 100644
index 0000000..a0fe188
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/StructureVarianceAddFeature.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.mm.algorithms.styles.LineStyle;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * This class is responsible for creating the graphical representation of
+ * structure variances which are special storages.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class StructureVarianceAddFeature extends StorageAddFeature {
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public StructureVarianceAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.add.FMCNodeAddFeature#add(org.eclipse
+ * .graphiti.features.context.IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ PictogramElement pictogramElement = super.add(context);
+ // TODO How to increase the distance between the gaps?
+ pictogramElement.getGraphicsAlgorithm().getGraphicsAlgorithmChildren()
+ .get(0).setLineStyle(LineStyle.DASH);
+ return pictogramElement;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/TextAddFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/TextAddFeature.java
new file mode 100644
index 0000000..ba5f519
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/TextAddFeature.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.add;
+
+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.MultiText;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+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.IPeService;
+
+/**
+ * This feature adds independent texts (free text) to the diagram.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class TextAddFeature extends AbstractAddShapeFeature {
+
+ /**
+ * The text value.
+ */
+ private final String text;
+
+ /**
+ * Determines if the text should be linked to a model object.
+ */
+ private final boolean linked;
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public TextAddFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ this.linked = true;
+ this.text = "A Text";
+ }
+
+ /**
+ * Constructor to define whether the shape should be linked to a model
+ * object.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param linked
+ * True if the pictogram element should be linked to a model
+ * object.
+ */
+ public TextAddFeature(IFeatureProvider featureProvider, boolean linked) {
+ super(featureProvider);
+ this.linked = linked;
+ this.text = "A Text";
+ }
+
+ /**
+ * Constructor to set the initial text.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param text
+ * The default text.
+ */
+ public TextAddFeature(IFeatureProvider featureProvider, String text) {
+ super(featureProvider);
+ this.linked = true;
+ this.text = text;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.graphiti.func.IAdd#canAdd(org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public boolean canAdd(IAddContext context) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context.IAddContext)
+ */
+ @Override
+ public PictogramElement add(IAddContext context) {
+ IPeService pe = Graphiti.getPeService();
+ IGaService ga = Graphiti.getGaService();
+
+ Shape s = pe.createShape(context.getTargetContainer(), true);
+ MultiText txt = ga.createMultiText(s, text);
+ txt.setForeground(manageColor(0, 0, 0));
+ txt.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
+ txt.setFont(ga.manageFont(getDiagram(), "Arial", 10, false, false));
+ ga.setLocationAndSize(txt, context.getX(), context.getY(), 50, 20);
+
+ if (linked)
+ link(s, context.getNewObject());
+
+ return s;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/package.html
new file mode 100644
index 0000000..7cadfae
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/add/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains all add features, which are responsible for creating the shape data in the diagram.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ConnectionCreateFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ConnectionCreateFeature.java
new file mode 100644
index 0000000..677308b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ConnectionCreateFeature.java
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.create;
+
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.datatypes.ILocation;
+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.context.impl.AddContext;
+import org.eclipse.graphiti.features.context.impl.AreaContext;
+import org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.PlatformGraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+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.IPeService;
+
+/**
+ * Create feature for connections. The class can be used for all types of
+ * connections. Furthermore, the class checks whether it is allowed to connect
+ * two shapes according to the rules of block diagrams.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ConnectionCreateFeature extends AbstractCreateConnectionFeature {
+
+ /**
+ * The model object to be created.
+ */
+ protected Object type = null;
+ /**
+ * The id of the icon for the create image.
+ */
+ private String icon = null;
+ /**
+ * The style of the connection.
+ */
+ private ConnectionStyle style = null;
+ /**
+ * Reference to the type checker.
+ */
+ protected FMCTypeChecker checker = FMCTypeCheckerFactory.getInstance();
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param name
+ * The name of the create feature displayed as palette tool entry
+ * label.
+ * @param description
+ * The description palette tool entry
+ * @param type
+ * The object model instance to be created.
+ * @param style
+ * The style of the connection.
+ * @param icon
+ * The icon to be used for the palette tool entry.
+ */
+ public ConnectionCreateFeature(IFeatureProvider featureProvider, String name,
+ String description, Object type, ConnectionStyle style, String icon) {
+ super(featureProvider, name, description);
+ this.type = type;
+ this.icon = icon;
+ this.style = style;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.ICreateConnection#canCreate(org.eclipse.graphiti
+ * .features.context.ICreateConnectionContext)
+ */
+ @Override
+ public boolean canCreate(ICreateConnectionContext context) {
+ PictogramElement targetPictogramElement = context
+ .getTargetPictogramElement();
+ PictogramElement sourcePictogramElement = context
+ .getSourcePictogramElement();
+
+ // Special Case for BoxRelative Anchor
+ if (context.getTargetAnchor() instanceof BoxRelativeAnchor) {
+ targetPictogramElement = context.getTargetAnchor().getParent();
+ }
+ if (context.getSourceAnchor() instanceof BoxRelativeAnchor) {
+ sourcePictogramElement = context.getSourceAnchor().getParent();
+ }
+ if (sourcePictogramElement instanceof Shape
+ && targetPictogramElement instanceof Shape) {
+ Shape shapeBehindTextOrPictureSource = getShapeBehindTextOrPicture((Shape) sourcePictogramElement);
+ Shape shapeBehindTextOrPictureTarget = getShapeBehindTextOrPicture((Shape) targetPictogramElement);
+ if (type != FMCType.Dots
+ && !isSourceAndTargetTypesValid(
+ shapeBehindTextOrPictureSource,
+ shapeBehindTextOrPictureTarget)
+
+ )
+ return false;
+ return type == FMCType.Dots
+ || !(targetPictogramElement instanceof Diagram)
+ && shapeBehindTextOrPictureTarget != null
+ && shapeBehindTextOrPictureSource != null;
+ }
+ return type == FMCType.Dots;
+ // return true;
+ }
+
+ /**
+ * Checks whether the shapes to be connected are compatible according to
+ * block diagram rules.
+ *
+ * @param shapeBehindTextOrPictureSource
+ * The source shape to be connected.
+ * @param shapeBehindTextOrPictureTarget
+ * The target shape to be connected.
+ * @return True if both are compatible and valid.
+ */
+ protected boolean isSourceAndTargetTypesValid(
+ Shape shapeBehindTextOrPictureSource,
+ Shape shapeBehindTextOrPictureTarget) {
+ if (checker.isChannelType(type))
+ return checker.isAgent(shapeBehindTextOrPictureSource)
+ && checker.isAgent(shapeBehindTextOrPictureTarget);
+ else
+ return checker.isAgent(shapeBehindTextOrPictureSource)
+ && (checker.isStorage(shapeBehindTextOrPictureTarget) || checker
+ .isStructureVariance(shapeBehindTextOrPictureTarget))
+ || checker.isAgent(shapeBehindTextOrPictureTarget)
+ && checker.isStorage(shapeBehindTextOrPictureSource);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.ICreateConnection#create(org.eclipse.graphiti
+ * .features.context.ICreateConnectionContext)
+ */
+ @Override
+ public Connection create(ICreateConnectionContext context) {
+ Anchor source = context.getSourceAnchor();
+ Anchor target = context.getTargetAnchor();
+ IPeService pe = Graphiti.getPeService();
+ if (source == null
+ && context.getSourcePictogramElement() instanceof Shape) {
+ Shape container = getShapeBehindTextOrPicture((Shape) context
+ .getSourcePictogramElement());
+ if (container != null) {
+ if (container.getAnchors().isEmpty())
+ source = pe.createChopboxAnchor(container);
+ else
+ source = container.getAnchors().get(0);
+ }
+ }
+ if (target == null
+ && context.getTargetPictogramElement() instanceof Shape) {
+ Shape container = getShapeBehindTextOrPicture((Shape) context
+ .getTargetPictogramElement());
+ if (container != null) {
+ if (container.getAnchors().isEmpty())
+ target = pe.createChopboxAnchor(container);
+ else
+ target = container.getAnchors().get(0);
+ } else {
+ AreaContext areaContext = new AreaContext();
+ ILocation targetLocation = context.getTargetLocation();
+ areaContext.setLocation(targetLocation.getX(),
+ targetLocation.getY());
+ areaContext.setSize(getDiagram().getGraphicsAlgorithm()
+ .getWidth(), getDiagram().getGraphicsAlgorithm()
+ .getHeight());
+ AddContext addContext = new AddContext(areaContext,
+ FMCType.Invisible);
+ addContext.setTargetContainer(getDiagram());
+ // addContext.setLocation(targetLocation.getX(),
+ // targetLocation.getY());
+ Shape invisible = (Shape) getFeatureProvider().addIfPossible(
+ addContext);
+ target = invisible.getAnchors().get(0);
+ }
+ }
+
+ AddConnectionContext addContext = new AddConnectionContext(source,
+ target);
+ if (type instanceof FMCType)
+ addContext.setNewObject(type);
+ else {
+ createConnectionModel(addContext, source, target);
+ }
+ addContext.putProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY, this.style);
+ Connection connection = (Connection) getFeatureProvider()
+ .addIfPossible(addContext);
+ // connection.setEnd(getAdditionalBoxAnchor(target, connection,
+ // context.getTargetLocation()));
+ return connection;
+ }
+
+ /**
+ * Does nothing because the simple enumeration-based object model is used.
+ * However, this method should be overridden in case of a real meta model
+ * being used.
+ *
+ * @param context
+ * The add context.
+ * @param source
+ * Source anchor.
+ * @param target
+ * Target anchor.
+ */
+ protected void createConnectionModel(AddConnectionContext context,
+ Anchor source, Anchor target) {
+
+ }
+
+ /**
+ * If a shape is not allowed as connection source or target return the
+ * container shape.
+ *
+ * @param shape
+ * The selected shape to be analyzed.
+ *
+ * @return Container shape of shape if shape is image or text.
+ */
+ public static Shape getShapeBehindTextOrPicture(Shape shape) {
+ if (shape != null) {
+ if (!shape.isActive()
+ || shape.getGraphicsAlgorithm() instanceof AbstractText
+ || shape.getGraphicsAlgorithm() instanceof PlatformGraphicsAlgorithm) {
+ return shape.getContainer();
+ }
+ // human agent figures
+ if (shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren()
+ .size() > 4)
+ return shape.getContainer();
+ }
+ if (shape instanceof Diagram)
+ return null;
+ return shape;
+ }
+
+ /**
+ * If a shape is not allowed as connection source or target return the
+ * container shape. If no such shape exists, the parent of the anchor is
+ * returned.
+ *
+ * @param shape
+ * The selected shape to be analyzed.
+ * @param anchor
+ * The anchor to be analyzed.
+ * @return Container shape of shape if shape is image or text.
+ */
+ public static Shape getShapeBehindTextOrPicture(Shape shape, Anchor anchor) {
+ Shape shapeBehindTextOrPicture = getShapeBehindTextOrPicture(shape);
+ if (anchor != null && shapeBehindTextOrPicture == null
+ && anchor.getParent() instanceof Shape)
+ return (Shape) anchor.getParent();
+ return shapeBehindTextOrPicture;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.ICreateConnection#canStartConnection(org.eclipse
+ * .graphiti.features.context.ICreateConnectionContext)
+ */
+ @Override
+ public boolean canStartConnection(ICreateConnectionContext context) {
+ PictogramElement sourcePictogramElement = context
+ .getSourcePictogramElement();
+ Shape shapeBehindTextOrPicture = null;
+ if (sourcePictogramElement instanceof Shape)
+ shapeBehindTextOrPicture = getShapeBehindTextOrPicture(
+ (Shape) sourcePictogramElement, context.getSourceAnchor());
+ if (shapeBehindTextOrPicture == null
+ && context.getSourceAnchor() != null)
+ shapeBehindTextOrPicture = (Shape) context.getSourceAnchor()
+ .getReferencedGraphicsAlgorithm().getPictogramElement();
+ return !(sourcePictogramElement instanceof Diagram)
+ && shapeBehindTextOrPicture != null
+ && checker.isAgent(shapeBehindTextOrPicture)
+ || (checker.isStorage(shapeBehindTextOrPicture) && !checker
+ .isChannelType(type));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature#
+ * getCreateImageId()
+ */
+ @Override
+ public String getCreateImageId() {
+ return icon;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ShapeCreateFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ShapeCreateFeature.java
new file mode 100644
index 0000000..7c4ab73
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/ShapeCreateFeature.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.create;
+
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAreaContext;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Create feature for shapes. The class can be used for all types of
+ * shapes.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapeCreateFeature extends AbstractCreateFeature {
+
+ /**
+ * The model object to be used for the shape.
+ */
+ protected final Object modelType;
+ /**
+ * The shape style.
+ */
+ private final ShapeStyle shapeStyle;
+ /**
+ * The id of the icon for the create image.
+ */
+ private String icon = null;
+
+ /**
+ * Getter for modelType property.
+ *
+ * @return The model type to be used for the shape.
+ */
+ public Object getModelType() {
+ return this.modelType;
+ }
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param name
+ * name of the tool palette entry label.
+ * @param description
+ * The description of the tool palette entry label.
+ * @param modelType
+ * The model type to be created.
+ * @param icon
+ */
+ public ShapeCreateFeature(IFeatureProvider featureProvider, String name,
+ String description, Object modelType, String icon) {
+ super(featureProvider, name, description);
+ this.modelType = modelType;
+ this.shapeStyle = null;
+ this.icon = icon;
+ }
+
+ /**
+ * Constructor for setting the shape style.
+ *
+ * @param featureProvider
+ * The feature provider.
+ * @param name
+ * The name of the tool palette entry label.
+ * @param description
+ * The description of the tool palette entry label.
+ * @param modelType
+ * The model type to be created.
+ * @param style
+ * The shape style.
+ * @param icon
+ * The icon id for the tool palette entry.
+ */
+ public ShapeCreateFeature(IFeatureProvider fp, String name,
+ String description, Object modelType, ShapeStyle style,
+ String icon) {
+ super(fp, name, description);
+ this.modelType = modelType;
+ this.shapeStyle = style;
+ this.icon = icon;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.ICreate#canCreate(org.eclipse.graphiti.features
+ * .context.ICreateContext)
+ */
+ @Override
+ public boolean canCreate(ICreateContext context) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractCreateFeature#execute(org.
+ * eclipse.graphiti.features.context.IContext)
+ */
+ @Override
+ public void execute(IContext context) {
+ // TODO Auto-generated method stub
+ super.execute(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.func.ICreate#create(org.eclipse.graphiti.features
+ * .context.ICreateContext)
+ */
+ @Override
+ public Object[] create(ICreateContext context) {
+ addGraphicalRepresentation(context, modelType);
+ return new Object[] { modelType };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeature#addGraphicalRepresentation
+ * (org.eclipse.graphiti.features.context.IAreaContext, java.lang.Object)
+ */
+ @Override
+ protected PictogramElement addGraphicalRepresentation(IAreaContext context,
+ Object newObject) {
+ AddContext addContext = new AddContext(context, newObject);
+ addContext.putProperty(BlockDiagramConstants.GRAPHICAL_TYPE_KEY, this.shapeStyle);
+ return getFeatureProvider().addIfPossible(addContext);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractCreateFeature#getCreateImageId
+ * ()
+ */
+ @Override
+ public String getCreateImageId() {
+ return icon;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/package.html
new file mode 100644
index 0000000..d6ae4f1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/create/package.html
@@ -0,0 +1,3 @@
+<html>
+<body>This package contains all create feature classes for connections and shapes.
+</body>
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/AddTextToConnectionCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/AddTextToConnectionCustomFeature.java
new file mode 100644
index 0000000..0cde3a3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/AddTextToConnectionCustomFeature.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramMessages;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+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.IPeService;
+
+/**
+ * This features adds a text to a connection. This is for example necessary if
+ * the user has removed the text previously.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AddTextToConnectionCustomFeature extends FMCCustomFeature {
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public AddTextToConnectionCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ IGaService ga = Graphiti.getGaService();
+ IPeService pe = Graphiti.getPeService();
+ for (PictogramElement element : context.getPictogramElements()) {
+ Connection con = (Connection) element;
+ ConnectionDecorator letter = pe.createConnectionDecorator(con,
+ true, 0.4f, true);
+ Text txt = ga.createText(letter,
+ BlockDiagramMessages.FMCAddFeature_DefaultShapeTitle);
+ txt.setForeground(ga.manageColor(getDiagram(), 0, 0, 0));
+ ga.setLocation(txt, -8, 22);
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ if (context.getPictogramElements().length == 0)
+ return false;
+ for (PictogramElement element : context.getPictogramElements()) {
+ if (!(element instanceof Connection))
+ return false;
+ }
+ return true;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Add Text";
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/BringToFrontCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/BringToFrontCustomFeature.java
new file mode 100644
index 0000000..ee27fed
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/BringToFrontCustomFeature.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * Makes the selected shape(s) the foremost one.
+ *
+ * @author Rainer Thome
+ * @author Benjamin Schmeling
+ *
+ */
+public class BringToFrontCustomFeature extends FMCCustomFeature {
+
+ private static final String FEATURE_NAME = "Bring to Front";
+ private static final String IMAGE_ID = BlockDiagramImageProvider.ICON_BRING_TO_FRONT;
+
+ /**
+ * The default provider.
+ *
+ * @param featureProvider
+ * The feature provider for this feature.
+ */
+ public BringToFrontCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return FEATURE_NAME;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return IMAGE_ID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ if (context.getPictogramElements() != null
+ && context.getPictogramElements().length > 0) {
+ for (PictogramElement pe : context.getPictogramElements()) {
+ if (!(pe instanceof Shape))
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ for (PictogramElement pe : context.getPictogramElements()) {
+ if (pe instanceof Shape)
+ Graphiti.getPeService().sendToFront((Shape) pe);
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CategoryCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CategoryCustomFeature.java
new file mode 100644
index 0000000..7d39bdf
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CategoryCustomFeature.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+
+/**
+ * Container feature for categories. Cannot be executed.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CategoryCustomFeature extends FMCCustomFeature {
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider
+ * The type provider.
+ * @param category
+ * The name of the category.
+ */
+ public CategoryCustomFeature(IFeatureProvider featureProvider, String category) {
+ super(featureProvider, category);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return super.getCategory();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CopyToClipboardCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CopyToClipboardCustomFeature.java
new file mode 100644
index 0000000..9d1b46e
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/CopyToClipboardCustomFeature.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramEditor;
+import org.eclipse.fmc.blockdiagram.editor.clipboard.CopyToClipboard;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.swt.SWT;
+
+/**
+ * Copies the currently selected shapes as Image to the clipboard. Supported
+ * Image formats are bmp, gif, png, tiff.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class CopyToClipboardCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Image format.
+ */
+ private final int imageFormat;
+
+ /**
+ * Default Constructor setting the image format to PNG.
+ *
+ * @param featureProvider
+ * The feature provider for this feature.
+ */
+ public CopyToClipboardCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ this.imageFormat = SWT.IMAGE_PNG;
+ }
+
+ /**
+ * Constructor for setting image format. Supported is bmp, gif, png, tiff.
+ *
+ * @param featureProvider
+ * The feature provider for this feature.
+ * @param imageFormat
+ * The image format as integer, e.g.
+ * org.eclipse.swt.SWT.IMAGE_PNG or org.eclipse.swt.SWT.IMAGE_BMP
+ */
+ public CopyToClipboardCustomFeature(IFeatureProvider featureProvider, int imageFormat) {
+ super(featureProvider);
+ this.imageFormat = imageFormat;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_COPY_AS_IMG;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Copy to Clipboard (PNG)";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ if (context.getPictogramElements() != null
+ && context.getPictogramElements().length > 0) {
+ for (PictogramElement pe : context.getPictogramElements()) {
+ if (pe instanceof Shape)
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ CopyToClipboard.copyToClipboard((BlockDiagramEditor) getDiagramBehavior().getDiagramContainer(),
+ imageFormat);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeature#canUndo(org.eclipse
+ * .graphiti.features.context.IContext)
+ */
+ @Override
+ public boolean canUndo(IContext context) {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FMCCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FMCCustomFeature.java
new file mode 100644
index 0000000..20b8ac1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FMCCustomFeature.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+
+/**
+ * This is the super class for all custom features. All features can be grouped
+ * by category.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public abstract class FMCCustomFeature extends AbstractCustomFeature {
+
+ /**
+ * The category name.
+ */
+ private final String category;
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public FMCCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ this.category = null;
+ }
+
+ /**
+ * Constructor for setting the category.
+ *
+ * @param featureProvider The feature provider.
+ * @param category The category name.
+ */
+ public FMCCustomFeature(IFeatureProvider featureProvider, String category) {
+ super(featureProvider);
+ this.category = category;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#isAvailable
+ * (org.eclipse.graphiti.features.context.IContext)
+ */
+ @Override
+ public boolean isAvailable(IContext context) {
+ return canExecute(context);
+ }
+
+ /**
+ * Getter for category.
+ *
+ * @return Category name.
+ */
+ public String getCategory() {
+ return category;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipHorizontallyCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipHorizontallyCustomFeature.java
new file mode 100644
index 0000000..b078091
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipHorizontallyCustomFeature.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Flips the selected element horizontally.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class FlipHorizontallyCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public FlipHorizontallyCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider, "Transform");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Flip horizontally";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_FLIP_HORIZONTALLY
+ + BlockDiagramImageProvider.SIZE_16;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getDescription
+ * ()
+ */
+ @Override
+ public String getDescription() {
+ return "Flip element horizontally";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+ if (ea instanceof RotatableNode) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+ GraphicsAlgorithm invisibleGa = container.getGraphicsAlgorithm();
+ if (ea instanceof RotatableNode) {
+ ((RotatableNode) ea).flipHorizontally(invisibleGa);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipVerticallyCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipVerticallyCustomFeature.java
new file mode 100644
index 0000000..39d938f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/FlipVerticallyCustomFeature.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Flips the selected element vertically.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class FlipVerticallyCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public FlipVerticallyCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider, "Transform");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Flip vertically";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_FLIP_VERTICALLY + BlockDiagramImageProvider.SIZE_16;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getDescription
+ * ()
+ */
+ @Override
+ public String getDescription() {
+ return "Flip the element vertically";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+ if (ea instanceof RotatableNode) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+ GraphicsAlgorithm invisibleGa = container.getGraphicsAlgorithm();
+ if (ea instanceof RotatableNode) {
+ ((RotatableNode) ea).flipVertically(invisibleGa);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/HideContentCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/HideContentCustomFeature.java
new file mode 100644
index 0000000..52f272b
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/HideContentCustomFeature.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Rotates the selected polygon by 90 degrees to the right.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class HideContentCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Boolean to track whether something has changed in diagram.
+ */
+ private boolean hasDoneChanges = false;
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public HideContentCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider, "Transform");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Hide Content";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_HIDE_CONTENT + BlockDiagramImageProvider.SIZE_16;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getDescription
+ * ()
+ */
+ @Override
+ public String getDescription() {
+ return "Hide the contained elements";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ // allow rotate if exactly one pictogram element representing a Polygon
+ // is selected
+ boolean ret = false;
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCNodeAlgorithm na = FMCNodeAlgorithmFactory.getInstance()
+ .getShape(container);
+ ret = na != null && !na.isEmpty(container)
+ && !na.isHiding(container);
+ }
+ return ret;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ ContainerShape firstLevelContainer = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCNodeAlgorithm na = FMCNodeAlgorithmFactory.getInstance()
+ .getShape(firstLevelContainer);
+ na.hideContainedShapes(firstLevelContainer, true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return this.hasDoneChanges;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/ImportBlockDiagramCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/ImportBlockDiagramCustomFeature.java
new file mode 100644
index 0000000..fef2edb
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/ImportBlockDiagramCustomFeature.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.core.internal.resources.File;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.fmc.blockdiagram.editor.features.add.BlockDiagramAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.wizards.BlockDiagramFilePage;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+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.ui.internal.services.GraphitiUiInternal;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * This feature imports all shapes from another block diagram to the diagram.
+ * All elements are copied.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class ImportBlockDiagramCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider
+ */
+ public ImportBlockDiagramCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ String path = showImportDialog();
+ if (path != null) {
+ PictogramElement pictogramElement = context.getPictogramElements()[0];
+ Resource resource = context.getPictogramElements()[0].eResource();
+ Resource diagResource = resource.getResourceSet().createResource(
+ URI.createPlatformResourceURI(path, true));
+ try {
+ diagResource.load(Collections.EMPTY_MAP);
+ Diagram diagram = (Diagram) diagResource.getContents().get(0);
+ AddContext ctx = new AddContext();
+ ctx.putProperty(BlockDiagramAddFeature.DIAGRAM_PROP, diagram);
+ ctx.setTargetContainer((ContainerShape) pictogramElement);
+ new BlockDiagramAddFeature(getFeatureProvider()).execute(ctx);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ /**
+ * Displays the import dialog.
+ *
+ * @return The full path to the selected diagram file.
+ */
+ private String showImportDialog() {
+ ElementTreeSelectionDialog fDialog = new ElementTreeSelectionDialog(
+ GraphitiUiInternal.getWorkbenchService().getShell(),
+ new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ fDialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ fDialog.setAllowMultiple(false);
+ fDialog.setValidator(new ISelectionStatusValidator() {
+
+ @Override
+ public IStatus validate(Object[] selection) {
+ if (selection.length == 1
+ && selection[0] instanceof File
+ && ((File) selection[0]).getFullPath().toOSString()
+ .endsWith(BlockDiagramFilePage.DIAGRAM_EXTENSION))
+ return new Status(IStatus.OK, "Blockdiagram Editor", "");
+ return new Status(IStatus.ERROR, "Blockdiagram", "");
+ }
+ });
+ if (fDialog.open() == Dialog.OK) {
+ return ((File) fDialog.getResult()[0]).getFullPath().toOSString();
+ } else
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Import FMC Blockdiagram";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ return context.getPictogramElements().length > 0
+ && context.getPictogramElements()[0] instanceof ContainerShape;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/LayoutConnectionCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/LayoutConnectionCustomFeature.java
new file mode 100644
index 0000000..9582213
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/LayoutConnectionCustomFeature.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IPeLayoutService;
+
+/**
+ * Layout feature which moves the source or target anchor in such a way that the
+ * connection line is straight.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class LayoutConnectionCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Graphiti layout service.
+ */
+ private IPeLayoutService pe = Graphiti.getPeLayoutService();
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ */
+ public LayoutConnectionCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ for (PictogramElement element : context.getPictogramElements()) {
+ if (!(element instanceof Connection)) {
+ return false;
+ } else {
+ Connection con = (Connection) element;
+ if (!(con.getStart() instanceof BoxRelativeAnchor && con
+ .getEnd() instanceof BoxRelativeAnchor))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ for (PictogramElement element : context.getPictogramElements()) {
+ Connection con = (Connection) element;
+ Anchor start = con.getStart();
+ Anchor end = con.getEnd();
+ if (start instanceof BoxRelativeAnchor
+ || end instanceof BoxRelativeAnchor) {
+ int difW = pe.getLocationRelativeToDiagram(end).getX()
+ - pe.getLocationRelativeToDiagram(start).getX();
+ int difH = pe.getLocationRelativeToDiagram(end).getY()
+ - pe.getLocationRelativeToDiagram(start).getY();
+
+ if (isVerticalAnchor(start) || isVerticalAnchor(end)) {
+ if (!(end instanceof BoxRelativeAnchor))
+ ((BoxRelativeAnchor) start)
+ .setRelativeWidth(((BoxRelativeAnchor) start)
+ .getRelativeWidth()
+ + getRelativeWidth(start, difW));
+ else
+ ((BoxRelativeAnchor) end)
+ .setRelativeWidth(((BoxRelativeAnchor) end)
+ .getRelativeWidth()
+ - getRelativeWidth(end, difW));
+ } else if (isHorizontalAnchor(start) || isHorizontalAnchor(end)) {
+ if (!(end instanceof BoxRelativeAnchor))
+ ((BoxRelativeAnchor) start)
+ .setRelativeHeight(((BoxRelativeAnchor) start)
+ .getRelativeHeight()
+ + getRelativeHeight(start, difH));
+ else
+ ((BoxRelativeAnchor) end)
+ .setRelativeHeight(((BoxRelativeAnchor) end)
+ .getRelativeHeight()
+ - getRelativeHeight(end, difH));
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks whether the anchor is positioned along a vertical line.
+ *
+ * @param anchor
+ * The anchor to be checked.
+ * @return True if it is an anchor along a vertical line.
+ */
+ private boolean isVerticalAnchor(Anchor anchor) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ BoxRelativeAnchor boxAnchor = (BoxRelativeAnchor) anchor;
+ return boxAnchor.getRelativeHeight() == 0
+ || boxAnchor.getRelativeHeight() == 1;
+ } else
+ return false;
+ }
+
+ /**
+ * Checks whether the anchor is positioned along a horizontal line.
+ *
+ * @param anchor
+ * The anchor to be checked.
+ * @return True if it is an anchor along a horizontal line.
+ */
+ private boolean isHorizontalAnchor(Anchor anchor) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ BoxRelativeAnchor boxAnchor = (BoxRelativeAnchor) anchor;
+ return boxAnchor.getRelativeWidth() == 0
+ || boxAnchor.getRelativeWidth() == 1;
+ } else
+ return false;
+ }
+
+ /**
+ * Calculates the relative width of the given anchor.
+ *
+ * @param anchor
+ * The anchor the relative width is determined for.
+ * @param dist
+ * The horizontal anchor distance
+ * @return Relative width.
+ */
+ private double getRelativeWidth(Anchor anchor, int dist) {
+ double width = anchor.getParent().getGraphicsAlgorithm().getWidth();
+ return dist / width;
+ }
+
+ /**
+ * Calculates the relative height of the given anchor.
+ *
+ * @param anchor
+ * The anchor the relative height is determined for.
+ * @param dist
+ * The vertical anchor distance.
+ * @return Relative height.
+ */
+ private double getRelativeHeight(Anchor anchor, int num) {
+ double height = anchor.getParent().getGraphicsAlgorithm().getHeight();
+ return num / height;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Layout Connection";
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/PaintFormatCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/PaintFormatCustomFeature.java
new file mode 100644
index 0000000..36f121c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/PaintFormatCustomFeature.java
@@ -0,0 +1,254 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.algorithms.styles.Font;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This class implements copy and paste of background color, foreground color,
+ * font color, font type, text angle, style and transparency. This feature is
+ * stateful. The state is kept until the format is pasted.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class PaintFormatCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Is the format copied?
+ */
+ private boolean formatCopied = false;
+ /**
+ * Stores background color.
+ */
+ private Color background;
+ /**
+ * Stores foreground color.
+ */
+ private Color foreground;
+ /**
+ * Stores font color.
+ */
+ private Color fontColor;
+ /**
+ * Stores font.
+ */
+ private Font font;
+ /**
+ * Stores text angle.
+ */
+ private Integer textAngle;
+ /**
+ * Stores stlye.
+ */
+ private Style style;
+ /**
+ * Stores transparency.
+ */
+ private Double transparency;
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public PaintFormatCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ for (PictogramElement pictogramElement : context.getPictogramElements()) {
+ if (!isFormatCopied()) {
+ copyFormat(pictogramElement);
+ } else {
+ pasteFormat(pictogramElement);
+ }
+ }
+ this.formatCopied = !this.formatCopied;
+ if (!isFormatCopied()) {
+ this.background = null;
+ this.foreground = null;
+ this.style = null;
+ this.font = null;
+ this.fontColor = null;
+ this.transparency = null;
+ this.textAngle = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "FormatPainter";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_FORMAT_PAINTER;
+ }
+
+ /**
+ * Copies the format.
+ *
+ * @param element
+ * The pictogram element with the format to be copied.
+ */
+ private void copyFormat(PictogramElement element) {
+ GraphicsAlgorithm graphicsAlgorithm = element.getGraphicsAlgorithm();
+ this.background = graphicsAlgorithm.getBackground();
+ this.foreground = graphicsAlgorithm.getForeground();
+ this.transparency = graphicsAlgorithm.getTransparency();
+ this.style = graphicsAlgorithm.getStyle();
+ if (element instanceof ContainerShape) {
+ AbstractText text = getText((ContainerShape) element);
+ if (text != null) {
+ this.font = text.getFont();
+ this.fontColor = text.getForeground();
+ this.textAngle = text.getAngle();
+ }
+ }
+ }
+
+ /**
+ * Pastes the format.
+ *
+ * @param element
+ * The pictogram element to which the format should be pasted.
+ */
+ private void pasteFormat(PictogramElement element) {
+ pasteFormat(element, element.getGraphicsAlgorithm());
+ for (GraphicsAlgorithm graphicsAlgorithm : element
+ .getGraphicsAlgorithm().getGraphicsAlgorithmChildren()) {
+ pasteFormat(element, graphicsAlgorithm);
+ }
+ }
+
+ /**
+ * Pastes the format.
+ *
+ * @param element
+ * The pictogram element to which the format should be pasted.
+ * @param graphicsAlgorithm
+ * The target graphics algorithm to paste to.
+ */
+ private void pasteFormat(PictogramElement element,
+ GraphicsAlgorithm graphicsAlgorithm) {
+ graphicsAlgorithm.setBackground(this.background);
+ graphicsAlgorithm.setForeground(this.foreground);
+ graphicsAlgorithm.setTransparency(this.transparency);
+ graphicsAlgorithm.setStyle(this.style);
+ if (element instanceof ContainerShape) {
+ AbstractText text = getText((ContainerShape) element);
+ if (text != null) {
+ text.setFont(this.font);
+ text.setForeground(this.fontColor);
+ text.setAngle(this.textAngle);
+ }
+ if (this.style != null && text.getFont() == null)
+ text.setFont(this.style.getFont());
+ }
+ }
+
+ /**
+ * Returns the text of a container shape.
+ *
+ * @param shape
+ * The shape to find the text in.
+ * @return The found text.
+ */
+ private AbstractText getText(ContainerShape shape) {
+ for (Shape child : shape.getChildren()) {
+ if (child.getGraphicsAlgorithm() instanceof AbstractText)
+ return (AbstractText) child.getGraphicsAlgorithm();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ return (formatCopied && context.getPictogramElements().length > 0)
+ || context.getPictogramElements().length == 1;
+ }
+
+ /**
+ * Getter for formatCopied.
+ *
+ * @return True if the format was copied.
+ */
+ public boolean isFormatCopied() {
+ return this.formatCopied;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return !isFormatCopied();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.AbstractFeature#canUndo(org.eclipse
+ * .graphiti.features.context.IContext)
+ */
+ @Override
+ public boolean canUndo(IContext context) {
+ return !isFormatCopied();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/RotateCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/RotateCustomFeature.java
new file mode 100644
index 0000000..55ac56f
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/RotateCustomFeature.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.element.FMCElementAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Rotates the selected element by 90 degrees to the right.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class RotateCustomFeature extends FMCCustomFeature {
+
+ private boolean hasDoneChanges = false;
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider The feature provider.
+ */
+ public RotateCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider, "Transform");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Rotate clockwise";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_ROTATE + BlockDiagramImageProvider.SIZE_16;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getDescription
+ * ()
+ */
+ @Override
+ public String getDescription() {
+ return "Rotate the element by 90 degrees clockwise";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(container);
+ if (ea instanceof RotatableNode) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ ContainerShape firstLevelContainer = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCElementAlgorithm ea = FMCElementAlgorithmFactory.getInstance()
+ .getShape(firstLevelContainer);
+ GraphicsAlgorithm invisibleGa = firstLevelContainer
+ .getGraphicsAlgorithm();
+ if (ea instanceof RotatableNode) {
+ ((RotatableNode) ea).rotate90Right(invisibleGa);
+ hasDoneChanges = true;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return this.hasDoneChanges;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/SendToBackCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/SendToBackCustomFeature.java
new file mode 100644
index 0000000..141f1c8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/SendToBackCustomFeature.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * Makes the selected shape(s) the backmost one.
+ *
+ * @author Benjamin Schmeling
+ * @author Rainer Thome
+ *
+ */
+public class SendToBackCustomFeature extends FMCCustomFeature {
+
+ private static final String FEATURE_NAME = "Send to Back";
+ private static final String IMAGE_ID = BlockDiagramImageProvider.ICON_SEND_TO_BACK;
+
+ /**
+ * Default constructor.
+ *
+ * @param featureProvider
+ * The feature provider for this feature.
+ */
+ public SendToBackCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return FEATURE_NAME;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return IMAGE_ID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ if (context.getPictogramElements() != null
+ && context.getPictogramElements().length > 0) {
+ for (PictogramElement pe : context.getPictogramElements()) {
+ if (!(pe instanceof Shape))
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ for (PictogramElement pe : context.getPictogramElements()) {
+ if (pe instanceof Shape)
+ Graphiti.getPeService().sendToBack((Shape) pe);
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/UnhideContentCustomFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/UnhideContentCustomFeature.java
new file mode 100644
index 0000000..d6a81e1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/UnhideContentCustomFeature.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.custom;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramImageProvider;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Rotates the selected polygon by 90 degrees to the right.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class UnhideContentCustomFeature extends FMCCustomFeature {
+
+ /**
+ * Boolean to track whether changes were done.
+ */
+ private boolean hasDoneChanges = false;
+
+ /**
+ * The default constructor.
+ *
+ * @param featureProvider
+ * The feature provider.
+ */
+ public UnhideContentCustomFeature(IFeatureProvider featureProvider) {
+ super(featureProvider, "Transform");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#getName()
+ */
+ @Override
+ public String getName() {
+ return "Show Content";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getImageId()
+ */
+ @Override
+ public String getImageId() {
+ return BlockDiagramImageProvider.ICON_UNHIDE_CONTENT + BlockDiagramImageProvider.SIZE_16;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#getDescription
+ * ()
+ */
+ @Override
+ public String getDescription() {
+ return "Unhide the contained elements";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.AbstractCustomFeature#canExecute
+ * (org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ // allow rotate if exactly one pictogram element representing a Polygon
+ // is selected
+ boolean ret = false;
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1
+ && context.getPictogramElements()[0] instanceof ContainerShape) {
+
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCNodeAlgorithm na = FMCNodeAlgorithmFactory.getInstance()
+ .getShape(container);
+
+ ret = na != null && !na.isEmpty(container)
+ && na.isHiding(container);
+ }
+ return ret;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse
+ * .graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ ContainerShape firstLevelContainer = (ContainerShape) context
+ .getPictogramElements()[0];
+ FMCNodeAlgorithm na = FMCNodeAlgorithmFactory.getInstance()
+ .getShape(firstLevelContainer);
+ na.hideContainedShapes(firstLevelContainer, false);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.graphiti.features.impl.AbstractFeature#hasDoneChanges()
+ */
+ @Override
+ public boolean hasDoneChanges() {
+ return this.hasDoneChanges;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/package.html
new file mode 100644
index 0000000..f039ca0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/custom/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains all custom feature classes.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/package.html
new file mode 100644
index 0000000..e0c2491
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains the feature classes of the editor. There are subpackages for add, create, custom and resize features.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/AreaBorderResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/AreaBorderResizeFeature.java
new file mode 100644
index 0000000..72c1c6a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/AreaBorderResizeFeature.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+
+/**
+ * Resizes the AreaBorder Shape.
+ *
+ * @author Heiko Witteborg
+ *
+ */
+public class AreaBorderResizeFeature extends DefaultResizeShapeFeature {
+
+ public AreaBorderResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public void resizeShape(IResizeShapeContext context) {
+ super.resizeShape(context);
+ IGaService ga = Graphiti.getGaService();
+
+ int w = context.getWidth();
+ int h = context.getHeight();
+ int min = 100;
+ // check that the longer dim is at least min
+ if (context.getWidth() > context.getHeight()) {
+ w = context.getWidth() < min ? min : w;
+ } else {
+ h = context.getHeight() < min ? min : h;
+ }
+
+ int margin = 2;
+ int lineWidth = 2;
+ int textHeight = 20;
+ int textWidth = 100;
+
+ Rectangle invRec = (Rectangle) context.getShape()
+ .getGraphicsAlgorithm();
+ Polyline line = null;
+ MultiText txt = null;
+ for (GraphicsAlgorithm gaChild : invRec.getGraphicsAlgorithmChildren()) {
+ if (gaChild instanceof Polyline) {
+ line = (Polyline) gaChild;
+ } else if (gaChild instanceof MultiText) {
+ txt = (MultiText) gaChild;
+ }
+ }
+
+ if (context.getWidth() > context.getHeight()) {
+ // position of containing rectangle
+ ga.setLocationAndSize(invRec, context.getX(), context.getY(), w, 3
+ * margin + lineWidth + textHeight);
+
+ // position of text field
+ txt.setHorizontalAlignment(Orientation.ALIGNMENT_RIGHT);
+ ga.setLocationAndSize(txt, margin, margin, w - (2 * margin),
+ textHeight);
+
+ // position of dashed line
+ ga.setLocationAndSize(line, 0, 2 * margin + textHeight, w, 2);
+ Point endPoint = line.getPoints().get(1);
+ endPoint.setX(w);
+ endPoint.setY(0);
+ // line.getPoints().add(ga.createPoint(w, 0));
+ } else {
+ // position of containing rectangle
+ ga.setLocationAndSize(invRec, context.getX(), context.getY(), 3
+ * margin + lineWidth + textWidth, h);
+
+ // position of text field
+ txt.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
+ txt.setVerticalAlignment(Orientation.ALIGNMENT_BOTTOM);
+ ga.setLocationAndSize(txt, 2 * margin + lineWidth, margin,
+ textWidth, h - 2 * margin);
+
+ // position of dashed line
+ ga.setLocationAndSize(line, margin, 0, 2, h);
+ Point endPoint = line.getPoints().get(1);
+ endPoint.setX(0);
+ endPoint.setY(h);
+ }
+
+ // layoutPictogramElement(lineShape);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/BraceResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/BraceResizeFeature.java
new file mode 100644
index 0000000..136f895
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/BraceResizeFeature.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.comment.BraceAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.comment.CommentAlgorithmFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+
+/**
+ * Resizes the Brace Shape.
+ *
+ * @author Rainer Thome
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class BraceResizeFeature extends DefaultResizeShapeFeature {
+
+ public BraceResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public void resizeShape(IResizeShapeContext context) {
+ // super.resizeShape(context);
+
+ GraphicsAlgorithm resizeGa = context.getPictogramElement()
+ .getGraphicsAlgorithm();
+ BraceAlgorithm braceAlgorithm = CommentAlgorithmFactory.getInstance()
+ .getBrace();
+
+ int oldContainerWidth = resizeGa.getWidth();
+ int oldContainerHeight = resizeGa.getHeight();
+ int oldContainerX = resizeGa.getX();
+ int oldContainerY = resizeGa.getY();
+
+ int newContainerWidth = context.getWidth();
+ int newContainerHeight = context.getHeight();
+ int newContainerX = context.getX();
+ int newContainerY = context.getY();
+
+ // ensure minimum size of braces
+ if (context.getWidth() < braceAlgorithm.getMinimumWidth()) {
+ if (oldContainerX != context.getX())
+ newContainerX = oldContainerX + oldContainerWidth
+ - braceAlgorithm.getMinimumWidth();
+ newContainerWidth = braceAlgorithm.getMinimumWidth();
+ }
+ if (context.getHeight() < braceAlgorithm.getMinimumHeight()) {
+ if (oldContainerY != context.getY())
+ newContainerY = oldContainerY + oldContainerHeight
+ - braceAlgorithm.getMinimumHeight();
+ newContainerHeight = braceAlgorithm.getMinimumHeight();
+ }
+
+ // Resize visible polyline
+ braceAlgorithm.resize(resizeGa, newContainerX, newContainerY,
+ newContainerWidth, newContainerHeight);
+
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ChannelResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ChannelResizeFeature.java
new file mode 100644
index 0000000..429f925
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ChannelResizeFeature.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.context.impl.ResizeShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ChannelResizeFeature extends DefaultResizeShapeFeature {
+
+ public ChannelResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature#resizeShape
+ * (org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ public void resizeShape(IResizeShapeContext context) {
+ int minimum = FMCUtil.getMinimum(context.getWidth(),
+ context.getHeight());
+ if (minimum < FMCConnectionAlgorithm.CHANNEL_MIN_SIZE)
+ minimum = FMCConnectionAlgorithm.CHANNEL_MIN_SIZE;
+ ResizeShapeContext ctx = new ResizeShapeContext(context.getShape());
+ ctx.setHeight(minimum);
+ ctx.setWidth(minimum);
+ ctx.setLocation(context.getX(), context.getY());
+ super.resizeShape(ctx);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ContainerResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ContainerResizeFeature.java
new file mode 100644
index 0000000..24f470d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ContainerResizeFeature.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.MultiText;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+
+/**
+ * This class is responsible for the resizing of shapes that are container for
+ * other shapes that should also be resized.
+ *
+ * @author Benjamin Schmeling
+ * @author Heiko Witteborg
+ *
+ */
+public class ContainerResizeFeature extends ResizeFeature {
+
+ // private static final int GAP = 10;
+ private FMCNodeAlgorithm fmcNode;
+
+ public ContainerResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.resize.ResizeFeature#resizeShape
+ * (org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ public final void resizeShape(IResizeShapeContext context) {
+
+ GraphicsAlgorithm resizeGa = context.getPictogramElement()
+ .getGraphicsAlgorithm();
+ fmcNode = FMCNodeAlgorithmFactory.getInstance().getShape(
+ context.getPictogramElement());
+
+ if (fmcNode != null) {
+ int oldContainerWidth = resizeGa.getWidth();
+ int oldContainerHeight = resizeGa.getHeight();
+ int oldContainerX = resizeGa.getX();
+ int oldContainerY = resizeGa.getY();
+
+ int newContainerWidth = context.getWidth();
+ int newContainerHeight = context.getHeight();
+ int newContainerX = context.getX();
+ int newContainerY = context.getY();
+
+ // ensure minimum size of fmc nodes
+ if (context.getWidth() < fmcNode.getMinimumWidth()) {
+ if (oldContainerX != context.getX())
+ newContainerX = oldContainerX + oldContainerWidth
+ - fmcNode.getMinimumWidth();
+ newContainerWidth = fmcNode.getMinimumWidth();
+ }
+ if (context.getHeight() < fmcNode.getMinimumHeight()) {
+ if (oldContainerY != context.getY())
+ newContainerY = oldContainerY + oldContainerHeight
+ - fmcNode.getMinimumHeight();
+ newContainerHeight = fmcNode.getMinimumHeight();
+
+ }
+
+ // Resize (invisible) first level ga of the fmc node
+ fmcNode.resize(resizeGa, newContainerX, newContainerY,
+ newContainerWidth, newContainerHeight);
+
+ // Resize (visible) ga children
+ if (context.getPictogramElement() instanceof ContainerShape) {
+ for (GraphicsAlgorithm childGa : resizeGa
+ .getGraphicsAlgorithmChildren()) {
+ resizeGaChild(childGa, newContainerWidth
+ - oldContainerWidth, newContainerHeight
+ - oldContainerHeight);
+ }
+ }
+ } else {
+ super.resizeShape(context);
+ }
+
+ }
+
+ /**
+ *
+ * @param ga
+ * @param widthDelta
+ * @param heightDelta
+ */
+ private void resizeGaChild(GraphicsAlgorithm ga, int widthDelta,
+ int heightDelta) {
+ int oldWidth, oldHeight;
+ oldWidth = ga.getWidth();
+ oldHeight = ga.getHeight();
+ fmcNode.resize(ga, ga.getX(), ga.getY(), oldWidth + widthDelta,
+ oldHeight + heightDelta);
+ // Graphiti.getGaService().setLocationAndSize(ga, ga.getX(), ga.getY(),
+ // oldWidth + widthDelta, oldHeight + heightDelta);
+ for (GraphicsAlgorithm childGa : ga.getGraphicsAlgorithmChildren())
+ resizeGaChild(childGa, widthDelta, heightDelta);
+ }
+
+ private boolean isDirectGraphicsContainer(Shape shape) {
+ return !shape.isActive()
+ && !(shape.getGraphicsAlgorithm() instanceof MultiText);
+ }
+
+ /**
+ * Resizes the child shape.
+ *
+ * @param container
+ * The container of the child that shall be resized.
+ * @param context
+ * The context referencing the child shape.
+ */
+ protected void resizeChild(ContainerShape container,
+ IResizeShapeContext context) {
+ super.resizeShape(context);
+ }
+
+ protected int getMaximumChildWidth(ContainerShape shape) {
+ int max = 0;
+ for (Shape child : shape.getChildren()) {
+ if (!isDirectGraphicsContainer(child)) {
+ if (max < child.getGraphicsAlgorithm().getWidth())
+ max = child.getGraphicsAlgorithm().getWidth();
+ }
+ }
+ return max;
+ }
+
+ protected int getMaximumChildHeight(ContainerShape shape) {
+ int max = 0;
+ for (Shape child : shape.getChildren()) {
+ if (!isDirectGraphicsContainer(child)) {
+ if (max < child.getGraphicsAlgorithm().getHeight())
+ max = child.getGraphicsAlgorithm().getHeight();
+ }
+ }
+ return max;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/DotsShapeResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/DotsShapeResizeFeature.java
new file mode 100644
index 0000000..1bcbcd4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/DotsShapeResizeFeature.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsConnectionAddFeature;
+import org.eclipse.fmc.blockdiagram.editor.features.add.DotsShapeAddFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DotsShapeResizeFeature extends DefaultResizeShapeFeature {
+
+ public DotsShapeResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature#resizeShape
+ * (org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ public void resizeShape(IResizeShapeContext context) {
+
+ ContainerShape container = (ContainerShape) context
+ .getPictogramElement();
+ Graphiti.getGaService().setLocationAndSize(
+ container.getGraphicsAlgorithm(), context.getX(),
+ context.getY(), context.getWidth(), context.getHeight());
+ int i = 0;
+ if (context.getWidth() > context.getHeight()) {
+ int gap = DotsShapeAddFeature.getDotsGap(context.getWidth());
+ for (Shape shape : container.getChildren()) {
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ Graphiti.getGaService().setLocationAndSize(graphicsAlgorithm,
+ 0 + (i) * gap, context.getHeight() / 2,
+ DotsConnectionAddFeature.DOTS_SIZE,
+ DotsConnectionAddFeature.DOTS_SIZE);
+ i++;
+ }
+ } else {
+ int gap = DotsShapeAddFeature.getDotsGap(context.getHeight());
+ for (Shape shape : container.getChildren()) {
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ Graphiti.getGaService().setLocationAndSize(graphicsAlgorithm,
+ context.getWidth() / 2, 0 + (i) * gap,
+ DotsConnectionAddFeature.DOTS_SIZE,
+ DotsConnectionAddFeature.DOTS_SIZE);
+ i++;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/FMCNodeResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/FMCNodeResizeFeature.java
new file mode 100644
index 0000000..1b85cfa
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/FMCNodeResizeFeature.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCNodeResizeFeature extends ContainerResizeFeature {
+
+ public FMCNodeResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.features.resize.ContainerResizeFeature
+ * #resizeChild(org.eclipse.graphiti.mm.pictograms.ContainerShape,
+ * org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ public void resizeChild(ContainerShape container,
+ IResizeShapeContext context) {
+ super.resizeShape(context);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ResizeFeature.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ResizeFeature.java
new file mode 100644
index 0000000..98104a0
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/ResizeFeature.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.features.resize;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IResizeShapeContext;
+import org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * Resize feature which automatically realigns the texts of the shapes.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ResizeFeature extends DefaultResizeShapeFeature {
+
+ public ResizeFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.graphiti.features.impl.DefaultResizeShapeFeature#resizeShape
+ * (org.eclipse.graphiti.features.context.IResizeShapeContext)
+ */
+ public void resizeShape(IResizeShapeContext context) {
+ int w, h;
+ int maxW = 0;
+ int maxH = 0;
+ if (context.getShape() instanceof ContainerShape) {
+ GraphicsAlgorithm sGa;
+ for (Shape s : ((ContainerShape) context.getShape()).getChildren()) {
+ sGa = s.getGraphicsAlgorithm();
+ if (!(sGa instanceof AbstractText)) {
+ if (sGa.getWidth() + sGa.getX() > maxW) {
+ maxW = sGa.getWidth() + sGa.getX();
+ }
+ if (sGa.getHeight() + sGa.getY() > maxH) {
+ maxH = sGa.getHeight() + sGa.getY();
+ }
+ }
+ }
+ }
+
+ w = context.getWidth() >= maxW ? context.getWidth() : maxW;
+ h = context.getHeight() >= maxH ? context.getHeight() : maxH;
+ // ((ResizeShapeContext) context).setHeight(h);
+ // ((ResizeShapeContext) context).setWidth(w);
+ if (context.getShape() instanceof ContainerShape) {
+ for (Shape s : ((ContainerShape) context.getShape()).getChildren()) {
+ if (s.getGraphicsAlgorithm() instanceof AbstractText
+ && !s.isActive()) {
+
+ Graphiti.getGaService().setLocationAndSize(
+ s.getGraphicsAlgorithm(), 5, 5, w - 5, h - 10);
+ }
+ /*
+ * else if (FMCUtil.getIndependentObject(context.getShape()) ==
+ * FMCType.HumanAgent || FMCUtil.getBO(context.getShape())
+ * instanceof HumanAgent) {
+ *
+ * int oldWidth = s.getGraphicsAlgorithm().getWidth(); int
+ * oldHeight = s.getGraphicsAlgorithm().getHeight();
+ * Graphiti.getGaService().setLocation(
+ * s.getGraphicsAlgorithm(), w / 2 - 12, 10); }
+ */
+ }
+ }
+ super.resizeShape(context);
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/package.html
new file mode 100644
index 0000000..296b7ee
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/features/resize/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains all resize feature classes.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/DiagramFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/DiagramFilter.java
new file mode 100644
index 0000000..759d5ee
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/DiagramFilter.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DiagramFilter extends AbstractPropertySectionFilter {
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return pictogramElement instanceof Diagram;
+ };
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCConnectionFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCConnectionFilter.java
new file mode 100644
index 0000000..6b02c97
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCConnectionFilter.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCConnectionFilter extends AbstractPropertySectionFilter {
+
+ FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return helper.isFMCConnection(pictogramElement);
+ };
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCNodeFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCNodeFilter.java
new file mode 100644
index 0000000..29ed3f8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCNodeFilter.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCNodeFilter extends AbstractPropertySectionFilter {
+
+ FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return helper.isFMCNode(pictogramElement);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCPropertyFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCPropertyFilter.java
new file mode 100644
index 0000000..a30cbd4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/FMCPropertyFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCPropertyFilter extends AbstractPropertySectionFilter {
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return pictogramElement != null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/PictogramFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/PictogramFilter.java
new file mode 100644
index 0000000..1d441c6
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/PictogramFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class PictogramFilter extends AbstractPropertySectionFilter {
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return pictogramElement != null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeAndConnectionFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeAndConnectionFilter.java
new file mode 100644
index 0000000..e5b159a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeAndConnectionFilter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+import org.eclipse.graphiti.mm.pictograms.Connection;
+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.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapeAndConnectionFilter extends AbstractPropertySectionFilter {
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return pictogramElement != null
+ && (pictogramElement instanceof Shape || pictogramElement instanceof Connection)
+ && !(pictogramElement instanceof Diagram);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeFilter.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeFilter.java
new file mode 100644
index 0000000..8b2cba3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/ShapeFilter.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.filters;
+
+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.ui.platform.AbstractPropertySectionFilter;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapeFilter extends AbstractPropertySectionFilter {
+
+ @Override
+ protected boolean accept(PictogramElement pictogramElement) {
+ return pictogramElement != null && pictogramElement instanceof Shape
+ && !(pictogramElement instanceof Diagram);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/package.html
new file mode 100644
index 0000000..9be7041
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/filters/package.html
@@ -0,0 +1,4 @@
+<html>
+<body>This package contains all property section filter classes.
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ConnectionStyle.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ConnectionStyle.java
new file mode 100644
index 0000000..7c71e8d
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ConnectionStyle.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public enum ConnectionStyle {
+ NORMAL, MANHATTAN, COMPOSITE
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ExtensibleFMCTypeChecker.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ExtensibleFMCTypeChecker.java
new file mode 100644
index 0000000..a8b47fc
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ExtensibleFMCTypeChecker.java
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ExtensibleFMCTypeChecker implements FMCTypeChecker {
+
+ private List<FMCTypeChecker> helpers = new ArrayList<FMCTypeChecker>();
+
+ public ExtensibleFMCTypeChecker() {
+ helpers.add(new SimpleFMCTypeChecker());
+ addTypeCheckersFromExtensionPoint();
+ }
+
+ @Override
+ public boolean isFMCNode(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isFMCNode(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isFMCConnection(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isFMCConnection(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isAgent(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isAgent(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isHumanAgent(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isHumanAgent(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isStorage(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isStorage(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isStructureVariance(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isStructureVariance(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isCommunicationChannel(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isCommunicationChannel(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isChannelType(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isChannelType(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isAccessType(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isAccessType(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isChannelType(Object obj) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isChannelType(obj);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isReqRespCommunicationChannel(Object obj) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isReqRespCommunicationChannel(obj);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isUnidirectionalCommunicationChannel(Object obj) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isUnidirectionalCommunicationChannel(obj);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isReqRespCommunicationChannel(Connection con) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isReqRespCommunicationChannel(con);
+ }
+ return check;
+ }
+
+ private void addTypeCheckersFromExtensionPoint() {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("org.eclipse.fmc.blockdiagram.editor.typechecking");
+ for (IConfigurationElement element : extensions) {
+ FMCTypeChecker helper;
+ try {
+ helper = (FMCTypeChecker) element
+ .createExecutableExtension("class");
+ if (!containsType(helpers, helper.getClass())) {
+ helpers.add(helper);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private boolean containsType(Collection<?> col, Class<?> type) {
+ for (Object object : col) {
+ if (type.isInstance(object))
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isModifyAccess(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isModifyAccess(element);
+ }
+ return check;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isBrace(org.eclipse.
+ * graphiti.mm.pictograms.PictogramElement)
+ */
+ public boolean isBrace(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isBrace(element);
+ }
+ return check;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isAreaBorder(org.eclipse
+ * .graphiti.mm.pictograms.PictogramElement)
+ */
+ public boolean isAreaBorder(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isAreaBorder(element);
+ }
+ return check;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isDots(org.eclipse.graphiti
+ * .mm.pictograms.PictogramElement)
+ */
+ public boolean isDots(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isDots(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isTextComment(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isTextComment(element);
+ }
+ return check;
+ }
+
+ @Override
+ public boolean isComment(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isComment(element);
+ }
+ return check;
+ }
+
+ public boolean isImage(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isImage(element);
+ }
+ return check;
+ }
+
+ public boolean isCommonFeatureArea(PictogramElement element) {
+ boolean check = false;
+ for (Iterator<FMCTypeChecker> iterator = helpers.iterator(); !check
+ && iterator.hasNext();) {
+ FMCTypeChecker helper = iterator.next();
+ check = helper.isCommonFeatureArea(element);
+ }
+ return check;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCType.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCType.java
new file mode 100644
index 0000000..a962cab
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCType.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+/**
+ * The graphical FMC type.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public enum FMCType {
+ /**
+ * Used for invisible place holder ends, e.g. for dots connection
+ */
+ Invisible, Agent, HumanAgent, Storage, StructureVariance, Channel, UnidirectionalAccess, BidirectionalAccess, ModifyAccess, UnidirectionalCommChannel, BidirectionalCommChannel, ReqRespCommChannel, Dots, DotsShape, Image, Text, CommonFeatureArea, Brace, HumanAgentIcon, Unknown, AreaBorder, Anchor;
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeChecker.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeChecker.java
new file mode 100644
index 0000000..ed988e1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeChecker.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public interface FMCTypeChecker {
+
+ /**
+ * Checks whether this pictogram element is linked with a FMCNode, e.g.
+ * Agent, Storage..
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a FMCNode in the
+ * domain model.
+ */
+ public boolean isFMCNode(PictogramElement element);
+
+ public boolean isFMCConnection(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with an Agent.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to an Agent in the domain
+ * model.
+ */
+ public boolean isAgent(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with an Agent and if this
+ * Agent is a HumanAgent.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to an Agent in the domain
+ * model which is a Human Agent.
+ */
+ public boolean isHumanAgent(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with a Storage.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Storage.
+ */
+ public boolean isStorage(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with a Structure
+ * Variance.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Structure Variance.
+ */
+ public boolean isStructureVariance(PictogramElement element);
+
+ public boolean isCommunicationChannel(PictogramElement element);
+
+ public boolean isChannelType(PictogramElement element);
+
+ public boolean isModifyAccess(PictogramElement element);
+
+ public boolean isAccessType(PictogramElement element);
+
+ public boolean isChannelType(Object obj);
+
+ public boolean isReqRespCommunicationChannel(Object obj);
+
+ public boolean isUnidirectionalCommunicationChannel(Object obj);
+
+ public boolean isReqRespCommunicationChannel(Connection con);
+
+ /**
+ * Checks whether this pictogram element is linked with a Brace.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Brace.
+ */
+ public boolean isBrace(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with an AreaBorder.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to an AreaBorder.
+ */
+ public boolean isAreaBorder(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is linked with Dots.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to Dots.
+ */
+ public boolean isDots(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is a text comment.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is a text comment.
+ */
+ public boolean isTextComment(PictogramElement element);
+
+ /**
+ * Checks whether this pictogram element is a comment.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is comment.
+ */
+ public boolean isComment(PictogramElement element);
+
+ public abstract boolean isImage(PictogramElement element);
+
+ public abstract boolean isCommonFeatureArea(PictogramElement element);
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeCheckerFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeCheckerFactory.java
new file mode 100644
index 0000000..bd1e1f1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/FMCTypeCheckerFactory.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCTypeCheckerFactory {
+
+ private static FMCTypeChecker helper;
+
+ public static FMCTypeChecker getInstance() {
+ if (helper == null) {
+ helper = new ExtensibleFMCTypeChecker();
+ }
+ return helper;
+ }
+
+ public static void setTypeHelper(FMCTypeChecker typeHelper) {
+ helper = typeHelper;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ShapeStyle.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ShapeStyle.java
new file mode 100644
index 0000000..a3c9408
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/ShapeStyle.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public enum ShapeStyle {
+
+ RECT, L, U, T;
+
+ public String getName() {
+ switch (ordinal()) {
+ default:
+ case 0:
+ return "Default";
+ case 1:
+ return "L-Shape";
+ case 2:
+ return "U-Shape";
+ case 3:
+ return "T-Shape";
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/SimpleFMCTypeChecker.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/SimpleFMCTypeChecker.java
new file mode 100644
index 0000000..7d915dc
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/SimpleFMCTypeChecker.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.model;
+
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Convenience Class for supporting both metamodels, the simple
+ * Enumeration-based one and the Ecore based one.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public final class SimpleFMCTypeChecker implements FMCTypeChecker {
+
+ private static FMCTypeChecker helper;
+
+ public SimpleFMCTypeChecker() {
+ }
+
+ public static FMCTypeChecker getInstance() {
+ if (helper == null) {
+ helper = new SimpleFMCTypeChecker();
+ }
+ return helper;
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with a FMCNode, e.g.
+ * Agent, Storage..
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a FMCNode in the
+ * domain model.
+ */
+ public boolean isFMCNode(PictogramElement element) {
+ return isType(element, FMCType.Agent, FMCType.HumanAgent,
+ FMCType.Storage, FMCType.StructureVariance);
+ }
+
+ public boolean isFMCConnection(PictogramElement element) {
+ return isChannelType(element) || isAccessType(element);
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with an Agent.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to an Agent in the domain
+ * model.
+ */
+ public boolean isAgent(PictogramElement element) {
+ return isType(element, FMCType.Agent, FMCType.HumanAgent);
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with an Agent and if this
+ * Agent is a HumanAgent.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to an Agent in the domain
+ * model which is a Human Agent.
+ */
+ public boolean isHumanAgent(PictogramElement element) {
+ return isType(element, FMCType.HumanAgent);
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with a Storage.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Storage.
+ */
+ public boolean isStorage(PictogramElement element) {
+ return isType(element, FMCType.Storage);
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with a Structure
+ * Variance.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Storage.
+ */
+ public boolean isStructureVariance(PictogramElement element) {
+ return isType(element, FMCType.StructureVariance);
+ }
+
+ /**
+ * Checks whether this pictogram element is linked with a Structure
+ * Variance.
+ *
+ * @param element
+ * The pictogram element to be checked.
+ *
+ * @return true if the pictogram element is linked to a Storage.
+ */
+ public boolean isCommunicationChannel(PictogramElement element) {
+ return isType(element, FMCType.BidirectionalCommChannel,
+ FMCType.UnidirectionalCommChannel, FMCType.ReqRespCommChannel);
+ }
+
+ public boolean isChannelType(PictogramElement element) {
+ return isType(element, getChannelTypes());
+ }
+
+ public boolean isAccessType(PictogramElement element) {
+ return isType(element, FMCType.UnidirectionalAccess,
+ FMCType.BidirectionalAccess, FMCType.ModifyAccess);
+ }
+
+ public boolean isModifyAccess(PictogramElement element) {
+ return isType(element, FMCType.ModifyAccess);
+ }
+
+ public boolean isChannelType(Object obj) {
+ for (Object chan : getChannelTypes()) {
+ if (chan.equals(obj))
+ return true;
+ }
+ return false;
+ }
+
+ private FMCType[] getChannelTypes() {
+ return new FMCType[] { FMCType.BidirectionalCommChannel,
+ FMCType.UnidirectionalCommChannel, FMCType.ReqRespCommChannel };
+ }
+
+ public boolean isReqRespCommunicationChannel(Object obj) {
+ return obj == FMCType.ReqRespCommChannel;
+ }
+
+ public boolean isUnidirectionalCommunicationChannel(Object obj) {
+ return obj == FMCType.UnidirectionalCommChannel;
+ }
+
+ public boolean isReqRespCommunicationChannel(Connection con) {
+ return isType(con, FMCType.ReqRespCommChannel);
+ }
+
+ private boolean isType(PictogramElement element, FMCType... types) {
+ if (element == null)
+ return false;
+ FMCType objectType = FMCUtil.getIndependentObject(element);
+ if (objectType != null) {
+ for (FMCType type : types) {
+ if (objectType == type)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isBrace(org.eclipse.
+ * graphiti.mm.pictograms.PictogramElement)
+ */
+ public boolean isBrace(PictogramElement element) {
+ return isType(element, FMCType.Brace);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isAreaBorder(org.eclipse
+ * .graphiti.mm.pictograms.PictogramElement)
+ */
+ public boolean isAreaBorder(PictogramElement element) {
+ return isType(element, FMCType.AreaBorder);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker#isDots(org.eclipse.graphiti
+ * .mm.pictograms.PictogramElement)
+ */
+ public boolean isDots(PictogramElement element) {
+ return isType(element, FMCType.DotsShape, FMCType.Dots);
+ }
+
+ @Override
+ public boolean isTextComment(PictogramElement element) {
+ return isType(element, FMCType.Text);
+ }
+
+ @Override
+ public boolean isComment(PictogramElement element) {
+ return isTextComment(element) || isDots(element)
+ || isAreaBorder(element) || isBrace(element)
+ || isCommonFeatureArea(element) || isImage(element);
+ }
+
+ @Override
+ public boolean isCommonFeatureArea(PictogramElement element) {
+ return isType(element, FMCType.CommonFeatureArea);
+ }
+
+ @Override
+ public boolean isImage(PictogramElement element) {
+ return isType(element, FMCType.Image);
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/package.html
new file mode 100644
index 0000000..bff7ba1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/model/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains the simple data model for the FMC Blockdiagram Editor and also other enumeration classes.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/package.html
new file mode 100644
index 0000000..436dbb5
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>The basic package for the FMC Blockdiagram editor.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/AlignmentPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/AlignmentPropertySection.java
new file mode 100644
index 0000000..a37c60c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/AlignmentPropertySection.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.styles.Orientation;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.mm.pictograms.util.PictogramsAdapterFactory;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class AlignmentPropertySection extends GraphitiPropertySection {
+
+ protected CCombo horCombo, verCombo;
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ Composite comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ fac.createLabel(comp, "Horizontal Orientation:");
+ horCombo = fac.createCCombo(comp);
+ horCombo.setItems(new String[] { Orientation.ALIGNMENT_LEFT.getName(),
+ Orientation.ALIGNMENT_CENTER.getName(),
+ Orientation.ALIGNMENT_RIGHT.getName() });
+ horCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ changeHorizontalAlignment();
+ }
+ });
+ fac.createLabel(comp, "Vertical Orientation:");
+ verCombo = fac.createCCombo(comp);
+ verCombo.setItems(new String[] { Orientation.ALIGNMENT_TOP.getName(),
+ Orientation.ALIGNMENT_CENTER.getName(),
+ Orientation.ALIGNMENT_BOTTOM.getName() });
+ verCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ changeVerticalAlignment();
+ }
+ });
+ refresh();
+ }
+
+ private void changeHorizontalAlignment() {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ List<PictogramElement> inputs = getInput();
+ for (PictogramElement singleInput : inputs) {
+ if (singleInput instanceof ContainerShape) {
+ for (Shape s : ((ContainerShape) singleInput)
+ .getChildren()) {
+ setHorizontalAlignment(s);
+ }
+ } else if (singleInput.getGraphicsAlgorithm() instanceof AbstractText) {
+ setHorizontalAlignment(singleInput);
+ }
+ }
+ }
+ });
+ }
+
+ private void changeVerticalAlignment() {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ List<PictogramElement> inputs = getInput();
+ for (PictogramElement singleInput : inputs) {
+ if (singleInput instanceof ContainerShape) {
+ for (Shape s : ((ContainerShape) singleInput)
+ .getChildren()) {
+ setVerticalAlignment(s);
+ }
+ } else if (singleInput.getGraphicsAlgorithm() instanceof AbstractText) {
+ setVerticalAlignment(singleInput);
+ }
+ }
+ }
+ });
+ }
+
+ public IPropertySource getPropertySource(Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ AdapterFactory adapterFactory = getAdapterFactory(object);
+ if (adapterFactory != null) {
+ IItemPropertySource itemPropertySource = (IItemPropertySource) adapterFactory
+ .adapt(object, IItemPropertySource.class);
+ if (itemPropertySource != null) {
+ return new PropertySource(object, itemPropertySource);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object)
+ .getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ protected AdapterFactory getAdapterFactory(Object object) {
+ return new PictogramsAdapterFactory();
+ }
+
+ public NotificationFilter getFilter() {
+ return NotificationFilter
+ .createEventTypeFilter(Notification.SET)
+ .or(NotificationFilter
+ .createEventTypeFilter(Notification.UNSET))
+ .and(NotificationFilter.createNotifierTypeFilter(EObject.class));
+ }
+
+ public void update(final Notification notification) {
+ final EObject eObject = (EObject) notification.getNotifier();
+ if (!isDisposed() && isSelection(eObject) && !isDeleted(eObject)) {
+ getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (!isDisposed() && isSelection(eObject)
+ && !isDeleted(eObject))
+ refresh();
+ }
+
+ });
+ }
+ }
+
+ protected boolean isSelection(EObject eObject) {
+ ISelection selection = getSelection();
+ if (selection == null) {
+ return false;
+ }
+ IStructuredSelection s = (IStructuredSelection) selection;
+ if (s.size() > 1) {
+ return false;
+ }
+ for (Iterator<?> it = s.iterator(); it.hasNext();) {
+ if (eObject == it.next()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean isDeleted(EObject eObject) {
+ return eObject.eResource() == null;
+ }
+
+ protected Display getDisplay() {
+ return getPart().getSite().getShell().getDisplay();
+ }
+
+ @Override
+ public void refresh() {
+ if (!this.isDisposed()) {
+ PictogramElement el = this.getSingleInput();
+ if (el != null && el instanceof ContainerShape) {
+ for (Shape s : ((ContainerShape) el).getChildren()) {
+ if (s.getGraphicsAlgorithm() instanceof AbstractText) {
+ // && !s.isActive()) {
+ refreshText(s);
+ }
+ }
+ } else if (el != null
+ && el.getGraphicsAlgorithm() instanceof AbstractText) {
+ refreshText((Shape) el);
+ } else {
+ verCombo.setEnabled(false);
+ horCombo.setEnabled(false);
+ }
+ }
+ }
+
+ private void refreshText(Shape s) {
+ verCombo.setEnabled(true);
+ horCombo.setEnabled(true);
+ horCombo.setText(((AbstractText) s.getGraphicsAlgorithm())
+ .getHorizontalAlignment().getName());
+ verCombo.setText(((AbstractText) s.getGraphicsAlgorithm())
+ .getVerticalAlignment().getName());
+ }
+
+ private void setHorizontalAlignment(PictogramElement s) {
+ if (s.getGraphicsAlgorithm() instanceof AbstractText) {
+ ((AbstractText) s.getGraphicsAlgorithm())
+ .setHorizontalAlignment(Orientation.getByName(horCombo
+ .getText()));
+ }
+ }
+
+ private void setVerticalAlignment(PictogramElement s) {
+ if (s.getGraphicsAlgorithm() instanceof AbstractText) {
+ ((AbstractText) s.getGraphicsAlgorithm())
+ .setVerticalAlignment(Orientation.getByName(verCombo
+ .getText()));
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ColorsAndFontsPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ColorsAndFontsPropertySection.java
new file mode 100644
index 0000000..3bb4318
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ColorsAndFontsPropertySection.java
@@ -0,0 +1,967 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.blockdiagram.editor.util.FontUtils;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.styles.Font;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
+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.mm.pictograms.util.PictogramsAdapterFactory;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Standard property section that allows the user to change fonts and colors of
+ * objects in a Graphiti-based diagram editor.
+ *
+ * @author Rainer Thome
+ *
+ */
+public class ColorsAndFontsPropertySection extends AbstractPropertySection
+ implements IPropertySourceProvider {
+
+ private static final String TOOLTIP_BG_COLOR = "Sets the background color of the selcted shape";
+
+ private static final String TOOLTIP_FG_COLOR = "Sets the color of the frame for the selected shape";
+
+ private static final String TOOLTIP_FONT_COLOR = "Sets the color for the font of the selected shape";
+
+ private static final String TOOLTIP_TRANSPARENCY = "Sets the transparency of the selected shape.";
+
+ private static final String TOOLTIP_TEXT_ANGLE = "Rotates the text of the selected shape by the chosen angle.";
+
+ private static final String TOOLTIP_STYLE = "A predefined style for the shape can be selected. By changing the predefined style of a shape it will loose its own style information and inherits the style of predefined one. Predefined styles can be maintained in the Predefined Styles Property Tab.";
+
+ private static final String TOOLTIP_ITALIC = "Sets the font type to italic for the text of the selected shape(s).";
+
+ private static final String TOOLTIP_BOLD = "Sets the font type to bold for the text of the selected shape(s).";
+
+ private static final String TOOLTIP_FONT_SIZE = "Changes the font size for the text of the selected shape(s).";
+
+ private static final String TOOLTIP_RECURSIVE_FONT = "Propagates all changes to fonts also to fonts of children shapes.";
+
+ private static final String TOOLTIP_FONT_TYPE = "Sets the font type for the text of the selected shape(s).";
+
+ private static final String NONE = "NONE";
+
+ protected boolean disposed;
+ protected CCombo fontsCombo;
+ protected CCombo sizesCombo;
+ protected CCombo stylesCombo;
+ protected Label foreLabel;
+ protected Label backLabel;
+ protected Label fontLabel;
+ protected Spinner transparency;
+ protected Spinner textAngle;
+ protected TransactionalEditingDomain editingDomain;
+ protected Button isRecursiveFont;
+ protected Button isBold;
+ protected Button isItalic;
+ protected Diagram diagram;
+ protected Composite comp;
+
+ protected GridData gridData;
+
+ public IPropertySource getPropertySource(Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ AdapterFactory adapterFactory = getAdapterFactory(object);
+ if (adapterFactory != null) {
+ IItemPropertySource itemPropertySource = (IItemPropertySource) adapterFactory
+ .adapt(object, IItemPropertySource.class);
+ if (itemPropertySource != null) {
+ return new PropertySource(object, itemPropertySource);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object)
+ .getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ protected AdapterFactory getAdapterFactory(Object object) {
+ return new PictogramsAdapterFactory();
+ }
+
+ private boolean fontSupported(String fontName) {
+ for (String supportedFontName : FontUtils.getFontNames()) {
+ if (fontName.equals(supportedFontName))
+ return true;
+ }
+ return false;
+ }
+
+ protected PictogramElement getColorElement() {
+ if (getInput().isEmpty())
+ return null;
+ else
+ return getInput().get(0);
+ }
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ // page.setPropertySourceProvider(getPropertySourceProvider());
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ comp = fac.createComposite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.horizontalSpacing = 10;
+ comp.setLayout(layout);
+ comp.setLayoutData(gridData);
+
+ createFontColorControl(fac, comp);
+ createFontTypeControl(fac, comp);
+ createFontSizeControl(fac, comp);
+ createTextAngleControl(fac, comp);
+
+ createBackgroundColorControl(fac, comp);
+ createTransparencyControl(fac, comp);
+ createBoldControl(fac, comp);
+ createItalicControl(fac, comp);
+ createForegroundColorControl(fac, comp);
+
+ createStyleControl(fac, comp);
+ createRecursiveFontControl(fac, comp);
+
+ refresh();
+ }
+
+ protected void createFontTypeControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Font Type:");
+ label.setToolTipText(TOOLTIP_FONT_TYPE);
+ fontsCombo = fac.createCCombo(comp);
+ fontsCombo.setToolTipText(TOOLTIP_FONT_TYPE);
+ fontsCombo.setItems(FontUtils.getFontNames());
+ fontsCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateFonts();
+ }
+ });
+ }
+
+ protected void createFontSizeControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Font Size:");
+ label.setToolTipText(TOOLTIP_FONT_SIZE);
+ sizesCombo = fac.createCCombo(comp);
+ sizesCombo.setToolTipText(TOOLTIP_FONT_SIZE);
+ sizesCombo.setItems(FontUtils.FONT_SIZES);
+ sizesCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateFonts();
+ }
+ });
+ }
+
+ protected void createBoldControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Bold:");
+ label.setToolTipText(TOOLTIP_BOLD);
+ isBold = new Button(comp, SWT.CHECK);
+ isBold.setToolTipText(TOOLTIP_FONT_SIZE);
+ isBold.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateFonts();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createItalicControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Italic:");
+ label.setToolTipText(TOOLTIP_ITALIC);
+ isItalic = new Button(comp, SWT.CHECK);
+ isItalic.setToolTipText(TOOLTIP_ITALIC);
+ isItalic.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateFonts();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createFontColorControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ fontLabel = fac.createLabel(comp, "Font Color:");
+ fontLabel.setToolTipText(TOOLTIP_FONT_COLOR);
+ Button bt3 = fac.createButton(comp, "Change Font Color...", SWT.PUSH);
+ bt3.setToolTipText(TOOLTIP_FONT_COLOR);
+ bt3.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ FMCUtil.getActiveEditor()
+ .getEditingDomain()
+ .getCommandStack()
+ .execute(
+ new RecordingCommand(FMCUtil.getActiveEditor()
+ .getEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ updateFontColors(FMCUtil.editColor(null,
+ diagram));
+ }
+ });
+
+ }
+ });
+ }
+
+ protected void createRecursiveFontControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ Label label = fac.createLabel(comp, "Change Fonts for Children:");
+ label.setToolTipText(TOOLTIP_RECURSIVE_FONT);
+ isRecursiveFont = new Button(comp, SWT.CHECK);
+ isRecursiveFont.setToolTipText(TOOLTIP_RECURSIVE_FONT);
+ }
+
+ protected void createForegroundColorControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ foreLabel = fac.createLabel(comp, "Foreground:");
+ foreLabel.setToolTipText(TOOLTIP_FG_COLOR);
+ Button bt = fac.createButton(comp, "Change Foreground Color...",
+ SWT.PUSH);
+ bt.setToolTipText(TOOLTIP_FG_COLOR);
+ bt.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ FMCUtil.getActiveEditor()
+ .getEditingDomain()
+ .getCommandStack()
+ .execute(
+ new RecordingCommand(FMCUtil.getActiveEditor()
+ .getEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ if (!getInput().isEmpty())
+ updateColors(
+ getInput().get(0),
+ FMCUtil.editColor(
+ getColorElement()
+ .getGraphicsAlgorithm()
+ .getForeground(),
+ diagram), true);
+ }
+ });
+
+ }
+ });
+ }
+
+ protected void createBackgroundColorControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ backLabel = fac.createLabel(comp, "Background:");
+ backLabel.setToolTipText(TOOLTIP_BG_COLOR);
+ Button bt2 = fac.createButton(comp, "Change Background Color...",
+ SWT.PUSH);
+ bt2.setToolTipText(TOOLTIP_BG_COLOR);
+ bt2.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ FMCUtil.getActiveEditor()
+ .getEditingDomain()
+ .getCommandStack()
+ .execute(
+ new RecordingCommand(FMCUtil.getActiveEditor()
+ .getEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ if (!getInput().isEmpty())
+ updateColors(
+ getInput().get(0),
+ FMCUtil.editColor(
+ getColorElement()
+ .getGraphicsAlgorithm()
+ .getBackground(),
+ diagram), false);
+ }
+ });
+
+ }
+ });
+ }
+
+ protected void createTransparencyControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ Label label = fac.createLabel(comp, "Transparency:");
+ label.setToolTipText(TOOLTIP_TRANSPARENCY);
+ transparency = new Spinner(comp, SWT.BORDER);
+ transparency.setToolTipText(TOOLTIP_TRANSPARENCY);
+ transparency.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ final double transparencyValue = ((Spinner) e.getSource())
+ .getSelection();
+ for (PictogramElement el : getInput()) {
+ updateTransparency(el, transparencyValue);
+ }
+ }
+
+ });
+ }
+
+ protected void createTextAngleControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Text Angle:");
+ label.setToolTipText(TOOLTIP_TEXT_ANGLE);
+ textAngle = new Spinner(comp, SWT.BORDER);
+ textAngle.setToolTipText(TOOLTIP_TEXT_ANGLE);
+ textAngle.setMaximum(360);
+ textAngle.setIncrement(90);
+ textAngle.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ final int angle = ((Spinner) e.getSource()).getSelection();
+
+ for (PictogramElement el : getInput()) {
+ rotateText(el, angle);
+ }
+ }
+
+ });
+ }
+
+ protected void createStyleControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ Label label = fac.createLabel(comp, "Style:");
+ label.setToolTipText(TOOLTIP_STYLE);
+ stylesCombo = fac.createCCombo(comp);
+ stylesCombo.setToolTipText(TOOLTIP_STYLE);
+ stylesCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ for (PictogramElement el : getInput()) {
+ updateStyle(el, stylesCombo.getItem(stylesCombo
+ .getSelectionIndex()));
+ }
+ }
+ });
+ }
+
+ protected void updateStyle(final PictogramElement el, final String styleId) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+
+ Style style = getStyle(styleId);
+ GraphicsAlgorithm ga = el.getGraphicsAlgorithm();
+ if (NONE.equals(styleId))
+ updateStyle(ga, null);
+ else {
+ updateStyle(ga, style);
+
+ if (el instanceof ContainerShape) {
+ AbstractText text = getTextFromShape((ContainerShape) el);
+ if (text != null) {
+ text.setForeground(null);
+ text.setFont(null);
+ text.setStyle(style);
+ }
+ }
+ }
+ }
+ });
+
+ }
+
+ private void updateStyle(GraphicsAlgorithm ga, Style style) {
+ ga.setStyle(style);
+ ga.setTransparency(null);
+ ga.setBackground(null);
+ ga.setForeground(null);
+
+ for (GraphicsAlgorithm gaChild : ga.getGraphicsAlgorithmChildren()) {
+ updateStyle(gaChild, style);
+ }
+ }
+
+ private Style getStyle(String styleId) {
+ for (Style style : diagram.getStyles()) {
+ if (styleId.equals(style.getId()))
+ return style;
+ }
+ return null;
+ }
+
+ private String[] getStyleIds() {
+ String[] styles = new String[diagram.getStyles().size()];
+ // styles[0] = NONE;
+ int i = 0;
+ for (Style style : diagram.getStyles()) {
+ styles[i] = style.getId();
+ i++;
+ }
+ return styles;
+ }
+
+ protected void updateTransparency(final PictogramElement el,
+ final double transparencyValue) {
+ FMCUtil.getActiveEditor()
+ .getEditingDomain()
+ .getCommandStack()
+ .execute(
+ new RecordingCommand(FMCUtil.getActiveEditor()
+ .getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ GraphicsAlgorithm graphicsAlgorithm = el
+ .getGraphicsAlgorithm();
+ double trans = graphicsAlgorithm
+ .getTransparency() == null ? 0
+ : graphicsAlgorithm.getTransparency();
+ BigDecimal decimal = new BigDecimal(trans,
+ new MathContext(2));
+ if (Double.compare(transparencyValue / 100.0,
+ decimal.doubleValue()) != 0) {
+ graphicsAlgorithm
+ .setTransparency(transparencyValue / 100.0);
+ for (GraphicsAlgorithm childGa : graphicsAlgorithm
+ .getGraphicsAlgorithmChildren()) {
+ childGa.setTransparency(transparencyValue / 100.0);
+ }
+ }
+ }
+
+ });
+ }
+
+ protected void rotateText(final PictogramElement el, final int angle) {
+ FMCUtil.getActiveEditor()
+ .getEditingDomain()
+ .getCommandStack()
+ .execute(
+ new RecordingCommand(FMCUtil.getActiveEditor()
+ .getEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ if (el instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) el;
+ final AbstractText textFromShape = getTextFromShape(container);
+ if (textFromShape != null
+ && textFromShape.getAngle() != angle) {
+ textFromShape.setAngle(angle);
+ refresh();
+ }
+ if (isRecursiveFont.getSelection()) {
+ for (Shape shape : container
+ .getChildren()) {
+ rotateText(shape, angle);
+ }
+ }
+
+ } else if (el.getGraphicsAlgorithm() instanceof AbstractText
+ && ((AbstractText) el
+ .getGraphicsAlgorithm())
+ .getAngle() != angle) {
+ ((AbstractText) el.getGraphicsAlgorithm())
+ .setAngle(angle);
+ refresh();
+ }
+ }
+
+ });
+ }
+
+ protected void updateFonts() {
+ for (PictogramElement el : this.getInput()) {
+ updateFont(el);
+ }
+ }
+
+ protected void updateFont(final PictogramElement el) {
+ if (el.getGraphicsAlgorithm() instanceof AbstractText) {
+ final AbstractText text = ((AbstractText) el.getGraphicsAlgorithm());
+ updateFont(text);
+ } else if (el instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) el;
+ AbstractText text = getTextFromShape(container);
+ if (text != null)
+ updateFont(text);
+ if (isRecursiveFont.getSelection())
+ for (Shape shape : container.getChildren()) {
+ updateFont(shape);
+ }
+ } else if (el instanceof Connection) {
+ Connection con = (Connection) el;
+ for (ConnectionDecorator decorator : con.getConnectionDecorators()) {
+ if (decorator.getGraphicsAlgorithm() instanceof AbstractText)
+ updateFont(((AbstractText) decorator.getGraphicsAlgorithm()));
+ }
+
+ }
+ }
+
+ protected void updateFont(final AbstractText text) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ text.setFont(Graphiti.getGaService().manageFont(
+ diagram,
+ fontsCombo.getItem(fontsCombo
+ .getSelectionIndex()),
+ Integer.parseInt(sizesCombo.getItem(sizesCombo
+ .getSelectionIndex())),
+ isItalic.getSelection(), isBold.getSelection()));
+ }
+ });
+ }
+
+ protected void updateColors(final PictogramElement el,
+ final org.eclipse.graphiti.mm.algorithms.styles.Color c,
+ final boolean isForeground) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ updateColors(el.getGraphicsAlgorithm(), c, isForeground);
+ }
+ });
+ refresh();
+ }
+
+ private void updateColors(GraphicsAlgorithm ga,
+ org.eclipse.graphiti.mm.algorithms.styles.Color c,
+ boolean isForeground) {
+ if (isForeground) {
+ ga.setForeground(c);
+ } else {
+ if (ga.getStyle() != null)
+ ga.getStyle().setRenderingStyle(null);
+ ga.setBackground(c);
+ }
+
+ for (GraphicsAlgorithm gaChild : ga.getGraphicsAlgorithmChildren()) {
+ updateColors(gaChild, c, isForeground);
+ }
+ }
+
+ protected void updateFontColors(
+ final org.eclipse.graphiti.mm.algorithms.styles.Color c) {
+ for (PictogramElement el : this.getInput()) {
+ updateFontColor(c, el);
+ }
+ }
+
+ protected void updateFontColor(
+ final org.eclipse.graphiti.mm.algorithms.styles.Color c,
+ PictogramElement el) {
+ if (el instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) el;
+ final AbstractText textFromShape = getTextFromShape(container);
+ if (textFromShape != null)
+ updateFontColor(c, textFromShape);
+ if (isRecursiveFont.getSelection()) {
+ for (Shape shape : container.getChildren()) {
+ updateFontColor(c, shape);
+ }
+ }
+ refresh();
+ } else if (el.getGraphicsAlgorithm() instanceof AbstractText) {
+ updateFontColor(c, (AbstractText) el.getGraphicsAlgorithm());
+ }
+ }
+
+ protected void updateFontColor(
+ final org.eclipse.graphiti.mm.algorithms.styles.Color c,
+ final AbstractText ga) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ ga.setForeground(c);
+ }
+ });
+ refresh();
+ }
+
+ protected void updateLines() {
+
+ }
+
+ public void dispose() {
+ super.dispose();
+ disposed = true;
+ }
+
+ @Override
+ public void refresh() {
+ if (!this.isDisposed()) {
+ PictogramElement el = getColorElement();
+ if (el != null && el instanceof Shape) {
+ GraphicsAlgorithm ga = el.getGraphicsAlgorithm();
+ if (ga == null)
+ return;
+ stylesCombo.setItems(getStyleIds());
+ if (ga.getStyle() != null)
+ stylesCombo.setText(ga.getStyle().getId());
+ else
+ stylesCombo.setText(NONE);
+ if (ga instanceof AbstractText) {
+ fontsCombo.setEnabled(true);
+ if ((((AbstractText) ga).getFont() == null)) {
+ defaultCombos();
+ } else {
+ Font font = ((AbstractText) ga).getFont();
+ fontsCombo.setText(font.getName());
+ sizesCombo.setEnabled(true);
+ sizesCombo.setText(String.valueOf(font.getSize()));
+ isBold.setSelection(font.isBold());
+ isItalic.setSelection(font.isItalic());
+ textAngle.setSelection(((AbstractText) ga).getAngle());
+ }
+ } else {
+ if (el instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape) el;
+ if (ga.getTransparency() != null)
+ transparency.setSelection((int) (ga
+ .getTransparency().doubleValue() * 100));
+ else
+ transparency.setSelection(0);
+ AbstractText text = getTextFromShape(container);
+
+ if (text != null) {
+ textAngle.setSelection(text.getAngle());
+ extractFontFromText(text);
+ setColorOfFCLabel(text.getForeground());
+ }
+
+ } else {
+ disableCombos();
+ }
+ org.eclipse.graphiti.mm.algorithms.styles.Color back = ga
+ .getBackground();
+ setColorOfBGLabel(back);
+ org.eclipse.graphiti.mm.algorithms.styles.Color fore = ga
+ .getForeground();
+ setColorOfFGLabel(fore);
+ }
+ } else if (el instanceof Connection) {
+ Connection con = (Connection) el;
+ for (ConnectionDecorator decorator : con
+ .getConnectionDecorators()) {
+ if (decorator.getGraphicsAlgorithm() instanceof AbstractText)
+ extractFontFromText((AbstractText) decorator
+ .getGraphicsAlgorithm());
+ }
+
+ }
+
+ refreshGridLayout();
+ }
+ }
+
+ protected void refreshGridLayout() {
+ ScrolledComposite tabbedPropertyComposite = findTabbedPropertyComposite(comp);
+ if (tabbedPropertyComposite != null) {
+ int cols = tabbedPropertyComposite.getSize().x / 200 * 2;
+ cols = cols < 2 ? 2 : cols;
+ comp.setLayout(new GridLayout(cols > 8 ? 8 : cols, false));
+ comp.layout();
+ }
+ }
+
+ protected void setColorOfFCLabel(
+ org.eclipse.graphiti.mm.algorithms.styles.Color fore) {
+ if (fore != null) {
+ fontLabel.setBackground(new Color(Display.getDefault(), fore
+ .getRed(), fore.getGreen(), fore.getBlue()));
+ fontLabel.setForeground(new Color(Display.getDefault(), 255 - fore
+ .getRed(), 255 - fore.getGreen(), 255 - fore.getBlue()));
+ } else {
+ fontLabel.setBackground(new Color(Display.getDefault(), 255, 255,
+ 255));
+ fontLabel.setForeground(new Color(Display.getDefault(), 0, 0, 0));
+ }
+ }
+
+ protected void setColorOfFGLabel(
+ org.eclipse.graphiti.mm.algorithms.styles.Color fore) {
+ if (fore != null) {
+ foreLabel.setBackground(new Color(Display.getDefault(), fore
+ .getRed(), fore.getGreen(), fore.getBlue()));
+ foreLabel.setForeground(new Color(Display.getDefault(), 255 - fore
+ .getRed(), 255 - fore.getGreen(), 255 - fore.getBlue()));
+ } else {
+ foreLabel.setBackground(new Color(Display.getDefault(), 255, 255,
+ 255));
+ foreLabel.setForeground(new Color(Display.getDefault(), 0, 0, 0));
+ }
+ }
+
+ protected void setColorOfBGLabel(
+ org.eclipse.graphiti.mm.algorithms.styles.Color back) {
+ if (back != null) {
+ backLabel.setBackground(new Color(Display.getDefault(), back
+ .getRed(), back.getGreen(), back.getBlue()));
+ backLabel.setForeground(new Color(Display.getDefault(), 255 - back
+ .getRed(), 255 - back.getGreen(), 255 - back.getBlue()));
+ } else {
+ backLabel.setBackground(new Color(Display.getDefault(), 255, 255,
+ 255));
+ backLabel.setForeground(new Color(Display.getDefault(), 0, 0, 0));
+ }
+ }
+
+ protected void extractFontFromText(AbstractText text) {
+ if (text != null && text.getFont() != null) {
+ fontsCombo.setEnabled(true);
+ fontsCombo.setText(text.getFont().getName());
+ sizesCombo.setEnabled(true);
+ sizesCombo.setText(String.valueOf(text.getFont().getSize()));
+ isBold.setSelection(text.getFont().isBold());
+ isItalic.setSelection(text.getFont().isItalic());
+ } else if (text != null && text.getStyle() != null
+ && text.getStyle().getFont() != null) {
+ fontsCombo.setEnabled(true);
+ fontsCombo.setText(text.getStyle().getFont().getName());
+ sizesCombo.setEnabled(true);
+ sizesCombo.setText(String.valueOf(text.getStyle().getFont()
+ .getSize()));
+ isBold.setSelection(text.getStyle().getFont().isBold());
+ isItalic.setSelection(text.getStyle().getFont().isItalic());
+ } else {
+ // disableCombos();
+ defaultCombos();
+ }
+ }
+
+ protected AbstractText getTextFromShape(ContainerShape container) {
+ AbstractText text = null;
+ for (Shape shape : container.getChildren()) {
+ if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
+ text = (AbstractText) shape.getGraphicsAlgorithm();
+ return text;
+ }
+ }
+ for (Shape shape : container.getChildren()) {
+ if (shape instanceof ContainerShape) {
+ AbstractText textFromShape = getTextFromShape((ContainerShape) shape);
+ if (textFromShape != null)
+ return textFromShape;
+ }
+ }
+ for (GraphicsAlgorithm ga : container.getGraphicsAlgorithm()
+ .getGraphicsAlgorithmChildren()) {
+ if (ga instanceof AbstractText) {
+ return (AbstractText) ga;
+ }
+ }
+ return text;
+ }
+
+ protected void disableCombos() {
+ fontsCombo.clearSelection();
+ fontsCombo.setText("");
+ fontsCombo.setEnabled(false);
+ sizesCombo.clearSelection();
+ sizesCombo.setText("");
+ sizesCombo.setEnabled(false);
+ }
+
+ protected void defaultCombos() {
+ if (fontSupported("Arial"))
+ fontsCombo.setText("Arial");
+ else if (FontUtils.getFontNames().length > 0)
+ fontsCombo.setText(FontUtils.getFontNames()[0]);
+ fontsCombo.setEnabled(true);
+ sizesCombo.setText("8");
+ sizesCombo.setEnabled(true);
+ isBold.setSelection(false);
+ isItalic.setSelection(false);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected List<PictogramElement> getInput() {
+ ISelection sel = getSelection();
+ if (sel instanceof IStructuredSelection) {
+ Object[] fe = ((IStructuredSelection) sel).toArray();
+ for (Object object : fe) {
+ if (!(object instanceof PictogramElement))
+ return Collections.EMPTY_LIST;
+ }
+ return new ArrayList(Arrays.asList(fe));
+ // if (fe != null && fe instanceof PictogramElement)
+ // return (PictogramElement) fe;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ public boolean isDisposed() {
+ return disposed;
+ }
+
+ public NotificationFilter getFilter() {
+ return NotificationFilter
+ .createEventTypeFilter(Notification.SET)
+ .or(NotificationFilter
+ .createEventTypeFilter(Notification.UNSET))
+ .and(NotificationFilter.createNotifierTypeFilter(EObject.class));
+ }
+
+ public void update(final Notification notification) {
+ final EObject eObject = (EObject) notification.getNotifier();
+ if (!isDisposed() && isSelection(eObject) && !isDeleted(eObject)) {
+ getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (!isDisposed() && isSelection(eObject)
+ && !isDeleted(eObject))
+ refresh();
+ }
+
+ });
+ }
+ }
+
+ protected boolean isSelection(EObject eObject) {
+ ISelection selection = getSelection();
+ if (selection == null) {
+ return false;
+ }
+ IStructuredSelection s = (IStructuredSelection) selection;
+ if (s.size() > 1) {
+ return false;
+ }
+ for (Iterator<?> it = s.iterator(); it.hasNext();) {
+ if (eObject == it.next()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean isDeleted(EObject eObject) {
+ return eObject.eResource() == null;
+ }
+
+ protected Display getDisplay() {
+ return getPart().getSite().getShell().getDisplay();
+ }
+
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ // set the current editing domain
+ IEditingDomainProvider provider = (IEditingDomainProvider) part
+ .getAdapter(IEditingDomainProvider.class);
+ assert provider.getEditingDomain() instanceof TransactionalEditingDomain;
+ editingDomain = (TransactionalEditingDomain) provider
+ .getEditingDomain();
+ diagram = FMCUtil.getActiveEditor().getDiagramTypeProvider().getDiagram();
+ // transform the selection
+ List<Object> objects = new ArrayList<Object>();
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> it = ((IStructuredSelection) selection).iterator();
+ while (it.hasNext()) {
+ GraphicalEditPart editPart = (GraphicalEditPart) it.next();
+ objects.add((PictogramElement) editPart.getModel());
+
+ }
+ }
+ StructuredSelection newSelection = new StructuredSelection(objects);
+ super.setInput(part, newSelection);
+ refresh();
+ }
+
+ protected ScrolledComposite findTabbedPropertyComposite(Composite comp) {
+ if (comp.getParent() == null) {
+ return null;
+ } else if (comp.getParent() instanceof ScrolledComposite) {
+ return (ScrolledComposite) comp.getParent();
+ } else
+ return findTabbedPropertyComposite(comp.getParent());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ConnectionPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ConnectionPropertySection.java
new file mode 100644
index 0000000..a2097d7
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ConnectionPropertySection.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithmFactory;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.RequestDirection;
+import org.eclipse.graphiti.mm.pictograms.CompositeConnection;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ManhattanConnection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ConnectionPropertySection extends FMCPropertySection {
+
+ private static final String TOOLTIP_DATA_FLOW = "Sets the direction of the data flow of the selected connection";
+
+ private static final String TOOLTIP_REQUEST_DIRECTION = "Sets the request direction of the channel";
+
+ private static final String TOOLTIP_CONNECTION_TYPE = "Sets the typeof the direction";
+
+ private static final String TOOLTIP_CHANNEL_LOCATION = "Moves the channel symbol along the given relative position";
+
+ private FMCConnectionAlgorithmFactory conFactory = FMCConnectionAlgorithmFactory
+ .getInstance();
+
+ private Spinner channelLocation;
+ private CCombo dataFlowDirection;
+ private CCombo requestDirection;
+ private CCombo connectionType;
+
+ private static final BigDecimal HUNDRET = new BigDecimal(100);
+
+ private void createConnectionProperties(TabbedPropertySheetWidgetFactory fac) {
+ createDataFlowDirection(fac);
+ createRequestDirection(fac);
+ createChannelLocation(fac);
+ createConnectionType(fac);
+ }
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ createConnectionProperties(fac);
+ refresh();
+ }
+
+ protected void createConnectionType(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Connection Type:");
+ label.setToolTipText(TOOLTIP_CONNECTION_TYPE);
+ connectionType = fac.createCCombo(comp, SWT.DROP_DOWN);
+ connectionType.setToolTipText(TOOLTIP_REQUEST_DIRECTION);
+ connectionType.setEditable(false);
+ connectionType
+ .setItems(new String[] { "Auto Routing", "Manual Routing" });
+ connectionType.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ getActions().changeConnectionType((Connection) el,
+ connectionType.getSelectionIndex());
+
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createDataFlowDirection(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "DataFlow:");
+ label.setToolTipText(TOOLTIP_DATA_FLOW);
+ dataFlowDirection = fac.createCCombo(comp, SWT.DROP_DOWN);
+ dataFlowDirection.setToolTipText(TOOLTIP_DATA_FLOW);
+ dataFlowDirection.setEditable(false);
+ dataFlowDirection.setItems(new String[] { "Unspecified", "Default",
+ "Other" });
+ dataFlowDirection.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ getActions().changeDataFlowDirection((Connection) el,
+ dataFlowDirection.getSelectionIndex());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createRequestDirection(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Channel Type:");
+ label.setToolTipText(TOOLTIP_REQUEST_DIRECTION);
+ requestDirection = fac.createCCombo(comp, SWT.DROP_DOWN);
+ requestDirection.setToolTipText(TOOLTIP_REQUEST_DIRECTION);
+ requestDirection.setEditable(false);
+ requestDirection.setItems(new String[] { "Unspecified", "Request",
+ "Response", "Request/Response" });
+ requestDirection.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ getActions().changeRequestDirection((Connection) el,
+ requestDirection.getSelectionIndex());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createChannelLocation(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "ChannelLocation:");
+ label.setToolTipText(TOOLTIP_CHANNEL_LOCATION);
+ channelLocation = new Spinner(comp, SWT.BORDER);
+ channelLocation.setToolTipText(TOOLTIP_CHANNEL_LOCATION);
+ channelLocation.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int location = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Connection) {
+ Connection con = (Connection) el;
+ FMCConnectionAlgorithm algorithm = conFactory
+ .getAlgorithm(con);
+ BigDecimal decimal = new BigDecimal(algorithm
+ .getChannelLocation(con), new MathContext(2));
+ BigDecimal locationDecimal = new BigDecimal(location,
+ new MathContext(2));
+ if (!locationDecimal.divide(HUNDRET).equals(decimal))
+ getActions().changeChannelLocation(con,
+ location / 100.0);
+ }
+ }
+ });
+ }
+
+ private void refreshConnection(Connection con) {
+ connectionType.setEnabled(!(con instanceof CompositeConnection));
+ connectionType.select(con instanceof ManhattanConnection ? 0 : 1);
+ if (dataFlowDirection != null)
+ dataFlowDirection.setEnabled(!helper.isModifyAccess(con));
+ if (helper.isCommunicationChannel(con)) {
+ FMCConnectionAlgorithm connectionAlgorithm = conFactory
+ .getAlgorithm(con);
+ if (requestDirection != null)
+ requestDirection.setEnabled(true);
+ channelLocation.setEnabled(true);
+ channelLocation.setSelection((int) (connectionAlgorithm
+ .getChannelLocation(con) * 100));
+ } else {
+ channelLocation.setEnabled(false);
+ if (requestDirection != null)
+ requestDirection.setEnabled(false);
+ }
+ FMCConnectionAlgorithm algorithm = conFactory.getAlgorithm(con);
+ if (dataFlowDirection != null) {
+ DataflowDirection direction = algorithm.getDirection(con);
+ switch (direction) {
+ case UNSPECIFIED:
+ dataFlowDirection.select(0);
+ break;
+ case DEFAULT:
+ dataFlowDirection.select(1);
+ break;
+ case OTHER:
+ dataFlowDirection.select(2);
+ break;
+ }
+ }
+ if (requestDirection != null) {
+ RequestDirection reqDirection = algorithm.getRequestDirection(con);
+ switch (reqDirection) {
+ case UNSPECIFIED:
+ requestDirection.select(0);
+ break;
+ case REQUEST:
+ requestDirection.select(1);
+ break;
+ case RESPONSE:
+ requestDirection.select(2);
+ break;
+ case REQUESTRESPONSE:
+ requestDirection.select(3);
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if (!this.isDisposed()) {
+ PictogramElement el = this.getSingleInput();
+ if (el != null && el instanceof Connection) {
+ refreshConnection((Connection) el);
+ }
+ ScrolledComposite tabbedPropertyComposite = findTabbedPropertyComposite(comp);
+ if (tabbedPropertyComposite != null) {
+ int cols = tabbedPropertyComposite.getSize().x / 150 * 2;
+ cols = cols < 2 ? 2 : cols;
+ comp.setLayout(new GridLayout(cols > 8 ? 8 : cols, false));
+ comp.layout();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DefaultPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DefaultPropertySection.java
new file mode 100644
index 0000000..2616bf1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DefaultPropertySection.java
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.DemultiplexingListener;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+import org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * Default implementation of a table based property sheet that lets you change
+ * every property of the selected EObject.
+ *
+ * @author Rainer Thome
+ *
+ */
+public class DefaultPropertySection extends AdvancedPropertySection implements
+ IPropertySourceProvider {
+
+ protected TransactionalEditingDomain editingDomain;
+
+ private DemultiplexingListener eventListener = new DemultiplexingListener(
+ getFilter()) {
+
+ protected void handleNotification(TransactionalEditingDomain domain,
+ Notification notification) {
+ update(notification);
+ }
+ };
+
+ protected boolean disposed;
+
+ public IPropertySource getPropertySource(Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ AdapterFactory adapterFactory = getAdapterFactory(object);
+ if (adapterFactory != null) {
+ IItemPropertySource itemPropertySource = (IItemPropertySource) adapterFactory
+ .adapt(object, IItemPropertySource.class);
+ if (itemPropertySource != null) {
+ return new PropertySource(object, itemPropertySource);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object)
+ .getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ private IPropertySourceProvider getPropertySourceProvider() {
+ return this;
+ }
+
+ private AdapterFactory getAdapterFactory(Object object) {
+ if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
+ return ((AdapterFactoryEditingDomain) getEditingDomain())
+ .getAdapterFactory();
+ }
+ return null;
+ }
+
+ private void setActionBars(IActionBars actionBars) {
+ if (actionBars != null) {
+ actionBars.getMenuManager().removeAll();
+ actionBars.getToolBarManager().removeAll();
+ actionBars.getStatusLineManager().removeAll();
+ page.makeContributions(actionBars.getMenuManager(),
+ actionBars.getToolBarManager(),
+ actionBars.getStatusLineManager());
+ actionBars.getToolBarManager().update(true);
+ }
+
+ }
+
+ @Override
+ public void createControls(final Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ page.setPropertySourceProvider(getPropertySourceProvider());
+ setActionBars(aTabbedPropertySheetPage.getSite().getActionBars());
+ }
+
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ // set the current editing domain
+ IEditingDomainProvider provider = (IEditingDomainProvider) part
+ .getAdapter(IEditingDomainProvider.class);
+ assert provider.getEditingDomain() instanceof TransactionalEditingDomain;
+ editingDomain = (TransactionalEditingDomain) provider
+ .getEditingDomain();
+ // transform the selection
+ List<Object> objects = new ArrayList<Object>();
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> it = ((IStructuredSelection) selection).iterator();
+ while (it.hasNext()) {
+ Object next = it.next();
+ if (next instanceof GraphicalEditPart) {
+ GraphicalEditPart editPart = (GraphicalEditPart) next;
+ PictogramElement pe = (PictogramElement) editPart
+ .getModel();
+ Object modelObj = Graphiti.getLinkService()
+ .getBusinessObjectForLinkedPictogramElement(pe);
+
+ objects.add(modelObj);
+ } else if (next instanceof EObject) {
+ objects.add(next);
+ }
+ }
+ }
+ StructuredSelection newSelection = new StructuredSelection(objects);
+ super.setInput(part, newSelection);
+ }
+
+ public NotificationFilter getFilter() {
+ return NotificationFilter
+ .createEventTypeFilter(Notification.SET)
+ .or(NotificationFilter
+ .createEventTypeFilter(Notification.UNSET))
+ .and(NotificationFilter.createNotifierTypeFilter(EObject.class));
+ }
+
+ @Override
+ public void aboutToBeHidden() {
+ if (getEditingDomain() != null) {
+ getEditingDomain().removeResourceSetListener(getEventListener());
+ }
+ super.aboutToBeHidden();
+ }
+
+ @Override
+ public void aboutToBeShown() {
+ super.aboutToBeShown();
+ if (getEditingDomain() != null) {
+ getEditingDomain().addResourceSetListener(getEventListener());
+ }
+ }
+
+ private DemultiplexingListener getEventListener() {
+ return eventListener;
+ }
+
+ private TransactionalEditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ public void update(final Notification notification) {
+ final EObject eObject = (EObject) notification.getNotifier();
+ if (!isDisposed() && isSelection(eObject) && !isDeleted(eObject)) {
+ getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (!isDisposed() && isSelection(eObject)
+ && !isDeleted(eObject))
+ refresh();
+ DiagramEditor editor = (DiagramEditor) FMCUtil
+ .getActiveEditor();
+ TransactionalEditingDomain domain = editor
+ .getEditingDomain();
+ final PictogramElement pe = editor
+ .getSelectedPictogramElements()[0];
+ Map<EStructuralFeature, GraphicsAlgorithm> map = FMCUtil
+ .getLinkedFeaturesMap(pe, eObject);
+ final GraphicsAlgorithm algo;
+ if (map != null) {
+ algo = map.get(notification.getFeature());
+ domain.getCommandStack().execute(
+ new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ if (algo != null
+ && algo instanceof org.eclipse.graphiti.mm.algorithms.AbstractText)
+ ((org.eclipse.graphiti.mm.algorithms.AbstractText) algo).setValue(notification
+ .getNewStringValue());
+ }
+ });
+ editor.getDiagramBehavior().refresh();
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.disposed = true;
+ }
+
+ protected boolean isDisposed() {
+ return this.disposed;
+ }
+
+ protected boolean isSelection(EObject eObject) {
+ ISelection selection = getSelection();
+ if (selection == null) {
+ return false;
+ }
+ IStructuredSelection s = (IStructuredSelection) selection;
+ if (s.size() > 1) {
+ return false;
+ }
+ for (Iterator<?> it = s.iterator(); it.hasNext();) {
+ if (eObject == it.next()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean isDeleted(EObject eObject) {
+ return eObject.eResource() == null;
+ }
+
+ protected Display getDisplay() {
+ return getPart().getSite().getShell().getDisplay();
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DiagramPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DiagramPropertySection.java
new file mode 100644
index 0000000..5cc1464
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/DiagramPropertySection.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.util.Iterator;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * This property section shows actions and properties when the diagram is
+ * selected in the editor.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DiagramPropertySection extends FMCPropertySection {
+
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+ private Spinner gridUnit;
+ private Button anchorsVisible;
+ private Button anchorsEnabled;
+
+ /**
+ * Getter for anchorsVisible
+ *
+ * @return anchorsVisible button
+ */
+ Button getAnchorsVisible() {
+ return anchorsVisible;
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls
+ * (org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ createDiagramControls(fac);
+ refresh();
+ }
+
+ /**
+ *
+ * @param fac
+ */
+ protected void createGridUnit(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "GridUnit:");
+ gridUnit = new Spinner(comp, SWT.BORDER);
+ gridUnit.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int unit = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Diagram) {
+ Diagram diagram = (Diagram) el;
+ if (unit != diagram.getGridUnit())
+ getActions().changeGridUnit(diagram, unit);
+
+ }
+ }
+ });
+ }
+
+ /**
+ *
+ * @param fac
+ */
+ protected void createAnchorsVisible(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Anchors visible:");
+ anchorsVisible = new Button(comp, SWT.CHECK);
+ anchorsVisible.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ getActions().visualizeAnchors(getDiagram(),
+ anchorsVisible.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ /**
+ *
+ * @param fac
+ */
+ protected void createAnchorsEnabled(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Anchors enabled:");
+ anchorsEnabled = new Button(comp, SWT.CHECK);
+ anchorsEnabled.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ getActions().enableAnchors(getDiagram(),
+ anchorsEnabled.getSelection());
+ if (anchorsEnabled.getSelection()
+ && anchorsVisible.getSelection())
+ getActions().visualizeAnchors(getDiagram(),
+ anchorsVisible.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ /**
+ * Creates all controls for this property section.
+ *
+ * @param fac
+ */
+ protected void createDiagramControls(TabbedPropertySheetWidgetFactory fac) {
+ // Canot be changed until diagram is reopened
+ // createGridUnit(fac);
+ createAnchorsVisible(fac);
+ createAnchorsEnabled(fac);
+ }
+
+ @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ public void refresh() {
+ super.refresh();
+ boolean visible = false;
+ boolean enabled = false;
+ if (getSingleInput() instanceof Diagram) {
+ Diagram diag = (Diagram) getSingleInput();
+ for (Iterator<Shape> iterator = diag.getChildren().iterator(); !visible
+ && iterator.hasNext();) {
+ Shape shape = iterator.next();
+ FMCNodeAlgorithm nodeAlgorithm = factory.getShape(shape);
+ if (nodeAlgorithm != null) {
+ if (nodeAlgorithm.isBoxAnchorsVisible(shape))
+ visible = true;
+ if (nodeAlgorithm.hasUnusedAnchors(shape))
+ enabled = true;
+ }
+ }
+ anchorsVisible.setSelection(visible);
+ anchorsEnabled.setSelection(enabled);
+ }
+ // gridUnit.setSelection(getDiagram().getGridUnit());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCColorsAndFontsPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCColorsAndFontsPropertySection.java
new file mode 100644
index 0000000..b1e5fdd
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCColorsAndFontsPropertySection.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+/**
+ * Assumes that agent storage and structure variance are container shape with
+ * children to be updated.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCColorsAndFontsPropertySection extends
+ ColorsAndFontsPropertySection {
+
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ @Override
+ protected void updateTransparency(PictogramElement el,
+ double transparencyValue) {
+ for (PictogramElement input : super.getInput()) {
+ if (helper.isAgent(input) || helper.isStorage(input)
+ || helper.isStructureVariance(input)) {
+ super.updateTransparency(input, transparencyValue);
+ } else
+ super.updateTransparency(el, transparencyValue);
+ }
+ }
+
+ @Override
+ protected void updateStyle(PictogramElement el, String styleId) {
+ for (PictogramElement input : super.getInput()) {
+ if (helper.isAgent(input) || helper.isStorage(input)
+ || helper.isStructureVariance(input)) {
+ super.updateStyle(input, styleId);
+ } else
+ super.updateStyle(el, styleId);
+ }
+ }
+
+ @Override
+ protected void updateColors(PictogramElement el, Color c,
+ boolean isForeground) {
+ for (PictogramElement input : super.getInput()) {
+ if (helper.isAgent(input) || helper.isStorage(input)
+ || helper.isStructureVariance(input)) {
+ super.updateColors(input, c, isForeground);
+ } else
+ super.updateColors(el, c, isForeground);
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCPropertySection.java
new file mode 100644
index 0000000..b844b9a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/FMCPropertySection.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCPropertySection extends GraphitiPropertySection {
+
+ protected Composite comp;
+ protected PropertyActions actions;
+ protected IFeatureProvider fp = null;
+ protected FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ protected PropertyActions getActions() {
+ if (this.actions == null) {
+ this.actions = new PropertyActions(getDiagram(),
+ getFeatureProvider(), editingDomain);
+ }
+ return this.actions;
+ }
+
+ public IFeatureProvider getFeatureProvider() {
+ if (this.fp == null) {
+ this.fp = FMCUtil.getActiveEditor().getDiagramTypeProvider()
+ .getFeatureProvider();
+ }
+ return this.fp;
+ }
+
+ protected ScrolledComposite findTabbedPropertyComposite(Composite comp) {
+ if (comp.getParent() == null) {
+ return null;
+ } else if (comp.getParent() instanceof ScrolledComposite) {
+ return (ScrolledComposite) comp.getParent();
+ } else
+ return findTabbedPropertyComposite(comp.getParent());
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/GraphitiPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/GraphitiPropertySection.java
new file mode 100644
index 0000000..9e65e2c
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/GraphitiPropertySection.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public abstract class GraphitiPropertySection extends AbstractPropertySection {
+
+ protected TransactionalEditingDomain editingDomain;
+ protected boolean disposed;
+ private Diagram diagram;
+
+ public boolean isDisposed() {
+ return disposed;
+ }
+
+ public Diagram getDiagram() {
+ if (this.diagram == null) {
+ this.diagram = getDiagramSavely();
+ }
+ return this.diagram;
+ }
+
+ /**
+ * Check first if is possible to return the active diagram.
+ *
+ * @return null or the active Diagram object.
+ */
+ protected Diagram getDiagramSavely() {
+ if ((this.diagram == null)
+ && (FMCUtil.getActiveEditorSavely() != null)
+ && (FMCUtil.getActiveEditorSavely().getDiagramTypeProvider() != null)
+ && (FMCUtil.getActiveEditorSavely().getDiagramTypeProvider()
+ .getDiagram() != null)) {
+ this.diagram = FMCUtil.getActiveEditorSavely()
+ .getDiagramTypeProvider().getDiagram();
+ }
+ return this.diagram;
+ }
+
+ protected PictogramElement getSingleInput() {
+ ISelection sel = getSelection();
+ if (sel instanceof IStructuredSelection) {
+ Object fe = ((IStructuredSelection) sel).getFirstElement();
+ if (fe != null && fe instanceof PictogramElement)
+ return (PictogramElement) fe;
+ }
+ return null;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected List<PictogramElement> getInput() {
+ ISelection sel = getSelection();
+ if (sel instanceof IStructuredSelection) {
+ Object[] fe = ((IStructuredSelection) sel).toArray();
+ for (Object object : fe) {
+ if (!(object instanceof PictogramElement))
+ return Collections.EMPTY_LIST;
+ }
+ return new ArrayList(Arrays.asList(fe));
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ // set the current editing domain
+ IEditingDomainProvider provider = (IEditingDomainProvider) part
+ .getAdapter(IEditingDomainProvider.class);
+ assert provider.getEditingDomain() instanceof TransactionalEditingDomain;
+ editingDomain = (TransactionalEditingDomain) provider
+ .getEditingDomain();
+
+ // transform the selection
+ List<Object> objects = new ArrayList<Object>();
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> it = ((IStructuredSelection) selection).iterator();
+ while (it.hasNext()) {
+ GraphicalEditPart editPart = (GraphicalEditPart) it.next();
+ objects.add((PictogramElement) editPart.getModel());
+
+ }
+ }
+ StructuredSelection newSelection = new StructuredSelection(objects);
+ super.setInput(part, newSelection);
+ refresh();
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PredefinedStylesPropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PredefinedStylesPropertySection.java
new file mode 100644
index 0000000..10745d4
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PredefinedStylesPropertySection.java
@@ -0,0 +1,573 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.blockdiagram.editor.util.StyleUtil;
+import org.eclipse.graphiti.mm.algorithms.styles.AdaptedGradientColoredAreas;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredArea;
+import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredAreas;
+import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredLocation;
+import org.eclipse.graphiti.mm.algorithms.styles.LocationType;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.algorithms.styles.StylesFactory;
+import org.eclipse.graphiti.mm.algorithms.styles.StylesPackage;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IGradientType;
+import org.eclipse.graphiti.util.IPredefinedRenderingStyle;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class PredefinedStylesPropertySection extends FMCPropertySection {
+ private static final String TOOLTIP_CREATE_STYLE = "Creates a new style with the name given in the text field. The newly created style will automatically be selected.";
+ private static final String TOOLTIP_STYLE_NAME = "Sets the name of the new style to be created.";
+ private static final String TOOLTIP_GRADIENT_STYLE = "Set the type of the gradient which can be either vertical, horizontal or none for no gradient color.";
+ private static final String TOOLTIP_STYLE_CONTROL = "The currently selected predefined style. All style properties shown in this property tab correspond to the selected style.";
+ private static final String TOOLTIP_GRADIENT_COLOR = "Sets the gradient target color if the selected gradient style is either vertical or horizontal. The source color is the selected background color.";
+ private Label gradientColorLabel;
+ private CCombo stylesCombo;
+ private CCombo gradientType;
+ protected Button gradientColor;
+ protected Button createStyle;
+ protected Text styleName;
+
+ private static final BigDecimal HUNDRET = new BigDecimal(100);
+
+ private StyleColorsAndFontsPropertySection propSection = new StyleColorsAndFontsPropertySection();
+
+ private class StyleColorsAndFontsPropertySection extends
+ FMCColorsAndFontsPropertySection {
+
+ private Style style;
+
+ public StyleColorsAndFontsPropertySection() {
+ gridData = new GridData(GridData.VERTICAL_ALIGN_END);
+ gridData.horizontalSpan = 4;
+ }
+
+ public void setStyle(Style style) {
+ this.style = style;
+ }
+
+ @Override
+ protected void createRecursiveFontControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ };
+
+ @Override
+ protected void createStyleControl(TabbedPropertySheetWidgetFactory fac,
+ Composite comp) {
+ };
+
+ @Override
+ protected void createFontColorControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ }
+
+ @Override
+ protected void createTextAngleControl(
+ TabbedPropertySheetWidgetFactory fac, Composite comp) {
+ }
+
+ @Override
+ protected void updateTransparency(PictogramElement el,
+ final double transparencyValue) {
+ if (style != null) {
+ Double trans = style.getTransparency() == null ? 0.0 : style
+ .getTransparency();
+ BigDecimal decimal = new BigDecimal(trans, new MathContext(2));
+ BigDecimal transparencyValueDecimal = new BigDecimal(
+ transparencyValue, new MathContext(2));
+ if (!transparencyValueDecimal.divide(HUNDRET).equals(decimal))
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ style.setTransparency(transparencyValue / 100);
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void rotateText(PictogramElement el, final int angle) {
+ if (style != null) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ style.setAngle(angle);
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void updateColors(PictogramElement el, final Color c,
+ final boolean isForeground) {
+
+ if (style != null) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (!isForeground) {
+ style.setBackground(c);
+ setColorOfBGLabel(c);
+ updateGradientColor(false);
+ } else {
+ style.setForeground(c);
+ setColorOfFGLabel(c);
+ }
+ }
+ });
+ }
+ }
+
+ protected void updateFonts() {
+ if (style != null) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ style.setFont(Graphiti
+ .getGaService()
+ .manageFont(
+ PredefinedStylesPropertySection.this
+ .getDiagram(),
+ fontsCombo.getItem(fontsCombo
+ .getSelectionIndex()),
+ Integer.parseInt(sizesCombo.getItem(sizesCombo
+ .getSelectionIndex())),
+ isItalic.getSelection(),
+ isBold.getSelection()));
+ }
+ });
+ }
+ };
+
+ public void refresh() {
+ if (!this.isDisposed() && style != null) {
+ fontsCombo.setText(style.getFont().getName());
+ sizesCombo.setText(String.valueOf(style.getFont().getSize()));
+ isBold.setSelection(style.getFont().isBold());
+ isItalic.setSelection(style.getFont().isItalic());
+ if (style.getTransparency() == null)
+ transparency.setSelection(0);
+ else
+ transparency
+ .setSelection((int) (style.getTransparency() * 100));
+ setColorOfBGLabel(style.getBackground());
+ setColorOfFGLabel(style.getForeground());
+ refreshGridLayout();
+ }
+ }
+ };
+
+ protected void createGradientTypeControl(
+ TabbedPropertySheetWidgetFactory fac, Composite parent) {
+ Composite comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ Label label = fac.createLabel(comp, "Gradient Type:");
+ label.setToolTipText(TOOLTIP_GRADIENT_STYLE);
+ gradientType = fac.createCCombo(comp);
+ gradientType.setToolTipText(TOOLTIP_GRADIENT_STYLE);
+ gradientType
+ .setItems(new String[] { "NONE", "VERTICAL", "HORIZONTAL" });
+ gradientType.setData("VERTICAL", IGradientType.VERTICAL);
+ gradientType.setData("HORIZONTAL", IGradientType.HORIZONTAL);
+ gradientType.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (stylesCombo.getSelectionIndex() >= 0) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ Style style = StyleUtil.findStyle(
+ getDiagram(), getSelectedStyleId());
+ if (gradientType.getSelectionIndex() == 0) {
+ style.setRenderingStyle(null);
+ } else {
+ if (style.getRenderingStyle() == null)
+ createRenderingStyle(style);
+ AdaptedGradientColoredAreas adaptedGradientColoredAreas = style
+ .getRenderingStyle()
+ .getAdaptedGradientColoredAreas();
+ adaptedGradientColoredAreas
+ .setGradientType((Integer) gradientType
+ .getData(getSelectedGradientType()));
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+
+ protected void createStyleControl(TabbedPropertySheetWidgetFactory fac,
+ Composite parent) {
+ Composite comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ Label label = fac.createLabel(comp, "Selected Style:");
+ label.setToolTipText(TOOLTIP_STYLE_CONTROL);
+ stylesCombo = fac.createCCombo(comp);
+ stylesCombo.setToolTipText(TOOLTIP_STYLE_CONTROL);
+ stylesCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (stylesCombo.getSelectionIndex() >= 0) {
+ String item = getSelectedStyleId();
+ createOrSelectStyle(item);
+ }
+ }
+ });
+ }
+
+ protected void createGradientColorControl(
+ TabbedPropertySheetWidgetFactory fac, Composite parent) {
+ Composite comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ gradientColorLabel = fac.createLabel(comp, "Gradient Color");
+ gradientColorLabel.setToolTipText(TOOLTIP_GRADIENT_COLOR);
+ gradientColor = fac.createButton(comp, "Change Gradient Color...",
+ SWT.PUSH);
+ gradientColor.setToolTipText(TOOLTIP_GRADIENT_COLOR);
+ gradientColor.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ if (gradientType.getSelectionIndex() > 0) {
+ updateGradientColor(true);
+ }
+ }
+ });
+
+ }
+ });
+ }
+
+ private Color getGradientColor(Style style) {
+
+ if (style.getRenderingStyle() != null) {
+ AdaptedGradientColoredAreas adaptedGradientColoredAreas = style
+ .getRenderingStyle().getAdaptedGradientColoredAreas();
+ if (!adaptedGradientColoredAreas.getAdaptedGradientColoredAreas()
+ .isEmpty()) {
+ GradientColoredAreas oldGradientColoredAreas = adaptedGradientColoredAreas
+ .getAdaptedGradientColoredAreas().get(0);
+ GradientColoredLocation oldGradientColor = oldGradientColoredAreas
+ .getGradientColor().get(0).getEnd();
+ return oldGradientColor.getColor();
+ } else
+ return createNewColor(style.getForeground());
+ } else
+ return createNewColor(style.getForeground());
+ }
+
+ private void createNewStyleControl(TabbedPropertySheetWidgetFactory fac,
+ Composite parent) {
+ Composite comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ styleName = fac.createText(comp, "");
+ styleName.setToolTipText(TOOLTIP_STYLE_NAME);
+ createStyle = fac.createButton(comp, "Create New Style", SWT.PUSH);
+ createStyle.setToolTipText(TOOLTIP_CREATE_STYLE);
+ createStyle.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ createOrSelectStyle(styleName.getText());
+ }
+ });
+ }
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(1, false));
+ createStyleControl(fac, comp);
+ createNewStyleControl(fac, comp);
+ createGradientTypeControl(fac, comp);
+ createGradientColorControl(fac, comp);
+ propSection.createControls(comp, aTabbedPropertySheetPage);
+
+ propSection.refresh();
+ }
+
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ propSection.setInput(part, selection);
+ // createDefaultLayerStyle(0);
+ }
+
+ private void createOrSelectStyle(final String styleId) {
+ final IGaService gaService = Graphiti.getGaService();
+
+ if (styleId != null) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ Style style = StyleUtil.findStyle(getDiagram(),
+ styleId);
+ if (style == null) {
+ style = gaService.createStyle(getDiagram(),
+ styleId);
+ Style shapeStyle = StyleUtil.getStyle(
+ getDiagram(), StyleUtil.SHAPE);
+ style.setLineWidth(shapeStyle.getLineWidth());
+ style.setForeground(shapeStyle.getForeground());
+ style.setBackground(shapeStyle.getBackground());
+ style.setFont(shapeStyle.getFont());
+ style.setFilled(true);
+ style.setLineVisible(true);
+ gradientType.select(0);
+ }
+ propSection.setStyle(style);
+ setColorOfGradientColorLabel(getGradientColor(style));
+ }
+ });
+ refresh();
+ int i = getSelectionIndex(styleId);
+ stylesCombo.select(i);
+ }
+
+ }
+
+ private static GradientColoredAreas getAreas(Color start, Color end) {
+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE
+ .createGradientColoredAreas();
+ gradientColoredAreas
+ .setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT);
+ final EList<GradientColoredArea> gcas = gradientColoredAreas
+ .getGradientColor();
+
+ addGradientColoredArea(gcas, start, 0,
+ LocationType.LOCATION_TYPE_ABSOLUTE_START, end, 0,
+ LocationType.LOCATION_TYPE_ABSOLUTE_END);
+ return gradientColoredAreas;
+ }
+
+ protected static void addGradientColoredArea(
+ EList<GradientColoredArea> gcas, Color colorStart,
+ int locationValueStart, LocationType locationTypeStart,
+ Color colorEnd, int locationValueEnd, LocationType locationTypeEnd) {
+ final GradientColoredArea gca = StylesFactory.eINSTANCE
+ .createGradientColoredArea();
+ gcas.add(gca);
+ gca.setStart(StylesFactory.eINSTANCE.createGradientColoredLocation());
+ gca.getStart().setColor(colorStart);
+ gca.getStart().setLocationType(locationTypeStart);
+ gca.getStart().setLocationValue(locationValueStart);
+ gca.setEnd(StylesFactory.eINSTANCE.createGradientColoredLocation());
+ gca.getEnd().setColor(colorEnd);
+ gca.getEnd().setLocationType(locationTypeEnd);
+ gca.getEnd().setLocationValue(locationValueEnd);
+ }
+
+ private Color createNewColor(Color color) {
+ Color newColor = StylesFactory.eINSTANCE.createColor();
+ newColor.eSet(StylesPackage.eINSTANCE.getColor_Red(), color.getRed());
+ newColor.eSet(StylesPackage.eINSTANCE.getColor_Green(),
+ color.getGreen());
+ newColor.eSet(StylesPackage.eINSTANCE.getColor_Blue(), color.getBlue());
+ return newColor;
+ }
+
+ /*
+ * private Color manageColor(int red, int green, int blue){ return
+ * Graphiti.getGaService().manageColor(getDiagram(), red, green, blue); }
+ */
+
+ @Override
+ public void refresh() {
+ if (!this.isDisposed()) {
+ super.refresh();
+ propSection.refresh();
+ String selectedItem = stylesCombo.getSelectionIndex() >= 0 ? stylesCombo
+ .getItem(stylesCombo.getSelectionIndex()) : "";
+ stylesCombo.setItems(getStyleIds());
+ int i = getSelectionIndex(selectedItem);
+ if (stylesCombo.getItems().length > 0
+ && i > stylesCombo.getItems().length - 1) {
+ stylesCombo.select(0);
+ createOrSelectStyle(stylesCombo.getItems()[0]);
+ } else
+ stylesCombo.select(i);
+
+ Style style = StyleUtil.findStyle(getDiagram(), selectedItem);
+ if (style != null && style.getRenderingStyle() != null) {
+ Integer currentGradientType = style.getRenderingStyle()
+ .getAdaptedGradientColoredAreas().getGradientType();
+ gradientType.select(IGradientType.VERTICAL
+ .equals(currentGradientType) ? 1 : 2);
+ } else
+ gradientType.select(0);
+
+ ScrolledComposite tabbedPropertyComposite = findTabbedPropertyComposite(comp);
+ if (tabbedPropertyComposite != null) {
+ int cols = tabbedPropertyComposite.getSize().x / 200 * 2;
+ cols = cols < 2 ? 2 : cols;
+ comp.setLayout(new GridLayout(cols > 4 ? 4 : cols, false));
+ comp.layout();
+ }
+
+ }
+ }
+
+ /**
+ * test
+ *
+ * @param selectedItem
+ * @return
+ */
+ private int getSelectionIndex(String selectedItem) {
+ int i = 0;
+ for (String item : stylesCombo.getItems()) {
+ if (item.equals(selectedItem))
+ break;
+ i++;
+ }
+ return i;
+ }
+
+ private String[] getStyleIds() {
+ String[] styles = new String[getDiagram().getStyles().size()];
+ int i = 0;
+ for (Style style : getDiagram().getStyles()) {
+ styles[i] = style.getId();
+ i++;
+ }
+ return styles;
+ }
+
+ private String getSelectedStyleId() {
+ String item = stylesCombo.getItem(stylesCombo.getSelectionIndex());
+ return item;
+ }
+
+ private String getSelectedGradientType() {
+ String item = gradientType.getItem(gradientType.getSelectionIndex());
+ return item;
+ }
+
+ private void createRenderingStyle(Style style) {
+ final IGaService gaService = Graphiti.getGaService();
+ final AdaptedGradientColoredAreas agca = StylesFactory.eINSTANCE
+ .createAdaptedGradientColoredAreas();
+ agca.setDefinedStyleId(style.getId() + "_Gradient");
+ agca.setGradientType(IGradientType.VERTICAL);
+ Color gradientColor = getGradientColor(style);
+ agca.getAdaptedGradientColoredAreas().add(
+ IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,
+ getAreas(createNewColor(style.getBackground()), gradientColor));
+ gaService.setRenderingStyle(style, agca);
+ setColorOfGradientColorLabel(gradientColor);
+ }
+
+ protected void setColorOfGradientColorLabel(Color back) {
+ if (back != null) {
+ gradientColorLabel
+ .setBackground(new org.eclipse.swt.graphics.Color(Display
+ .getDefault(), back.getRed(), back.getGreen(), back
+ .getBlue()));
+ gradientColorLabel
+ .setForeground(new org.eclipse.swt.graphics.Color(Display
+ .getDefault(), 255 - back.getRed(), 255 - back
+ .getGreen(), 255 - back.getBlue()));
+ } else {
+ gradientColorLabel
+ .setBackground(new org.eclipse.swt.graphics.Color(Display
+ .getDefault(), 255, 255, 255));
+ gradientColorLabel
+ .setForeground(new org.eclipse.swt.graphics.Color(Display
+ .getDefault(), 0, 0, 0));
+ }
+ }
+
+ private void updateGradientColor(boolean gradientColor) {
+ Style style = StyleUtil.findStyle(getDiagram(), getSelectedStyleId());
+ if (style.getRenderingStyle() != null) {
+ AdaptedGradientColoredAreas adaptedGradientColoredAreas = style
+ .getRenderingStyle().getAdaptedGradientColoredAreas();
+ if (!adaptedGradientColoredAreas.getAdaptedGradientColoredAreas()
+ .isEmpty()) {
+ GradientColoredAreas oldGradientColoredAreas = adaptedGradientColoredAreas
+ .getAdaptedGradientColoredAreas().get(0);
+ // adaptedGradientColoredAreas.getAdaptedGradientColoredAreas().clear();
+ GradientColoredLocation oldGradientColorEnd = oldGradientColoredAreas
+ .getGradientColor().get(0).getEnd();
+ GradientColoredLocation oldGradientColorStart = oldGradientColoredAreas
+ .getGradientColor().get(0).getStart();
+ oldGradientColorStart.setColor(createNewColor(style
+ .getBackground()));
+ Color newColor = null;
+ if (gradientColor)
+ newColor = createNewColor(FMCUtil.editColor(
+ oldGradientColorEnd.getColor(), getDiagram()));
+ // Style color is not automatically added to diagram, so we do
+ // this manually
+ // getDiagram().getColors().add(newColor);
+
+ // adaptedGradientColoredAreas.getAdaptedGradientColoredAreas().add(
+ // IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,
+ // getAreas(style.getBackground(), gradientColor ? newColor :
+ // oldGradientColor.getColor()));
+ oldGradientColorEnd.setColor(gradientColor ? newColor
+ : oldGradientColorEnd.getColor());
+ setColorOfGradientColorLabel(newColor);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PropertyActions.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PropertyActions.java
new file mode 100644
index 0000000..efabe40
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/PropertyActions.java
@@ -0,0 +1,664 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramConstants;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.connection.FMCConnectionAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.RotatableNode;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ConnectionStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.RequestDirection;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IRemoveFeature;
+import org.eclipse.graphiti.features.IResizeShapeFeature;
+import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
+import org.eclipse.graphiti.features.context.impl.RemoveContext;
+import org.eclipse.graphiti.features.context.impl.ResizeShapeContext;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+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;
+
+/**
+ * This class collects all actions triggered by property sheet elements.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class PropertyActions {
+
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+ private FMCConnectionAlgorithmFactory conFactory = FMCConnectionAlgorithmFactory
+ .getInstance();
+ private final TransactionalEditingDomain editingDomain;
+ private final Diagram diagram;
+ private final IFeatureProvider provider;
+
+ /**
+ *
+ * @param diagram
+ * @param provider
+ * @param editingDomain
+ */
+ public PropertyActions(Diagram diagram, IFeatureProvider provider,
+ TransactionalEditingDomain editingDomain) {
+ this.diagram = diagram;
+ this.provider = provider;
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ *
+ * @param con
+ * @param selectionIndex
+ */
+ void changeDataFlowDirection(final Connection con, final int selectionIndex) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCConnectionAlgorithm algorithm = conFactory
+ .getAlgorithm(con);
+ switch (selectionIndex) {
+ case 0:
+ algorithm.setDirection(con,
+ DataflowDirection.UNSPECIFIED, diagram);
+ break;
+ case 1:
+ algorithm.setDirection(con,
+ DataflowDirection.DEFAULT, diagram);
+ break;
+ case 2:
+ algorithm.setDirection(con,
+ DataflowDirection.OTHER, diagram);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Changes the request direction of a connection.
+ *
+ * @param con
+ * @param selectionIndex
+ */
+ void changeRequestDirection(final Connection con, final int selectionIndex) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCConnectionAlgorithm algorithm = conFactory
+ .getAlgorithm(con);
+ switch (selectionIndex) {
+ case 0:
+ algorithm.setRequestDirection(con,
+ RequestDirection.UNSPECIFIED, diagram);
+ break;
+ case 1:
+ algorithm.setRequestDirection(con,
+ RequestDirection.REQUEST, diagram);
+ break;
+ case 2:
+ algorithm.setRequestDirection(con,
+ RequestDirection.RESPONSE, diagram);
+ break;
+ case 3:
+ algorithm.setRequestDirection(con,
+ RequestDirection.REQUESTRESPONSE,
+ diagram);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Rotates the pictogram element.
+ *
+ * @param angleDegrees
+ * @param picto
+ */
+ void rotate(final int angleDegrees, final PictogramElement picto) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ GraphicsAlgorithm invisibleGa = picto
+ .getGraphicsAlgorithm();
+ FMCNodeAlgorithm na = FMCNodeAlgorithmFactory
+ .getInstance().getShape(picto);
+ if (na instanceof RotatableNode) {
+ RotatableNode rn = (RotatableNode) na;
+ // Rotate depending on the current and the
+ // selected angle
+ int oldAngle = rn.getAngle(invisibleGa);
+ for (int i = 0; i < ((angleDegrees + 360 - oldAngle) / 90) % 4; i++) {
+ rn.rotate90Right(invisibleGa);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Resizes the bottom part if the pictogram is a polygon such as an L or U
+ * shape.
+ *
+ * @param size
+ * @param picto
+ */
+ void resizeBottomPart(final int size, final PictogramElement picto) {
+ final LPolygonAlgorithm lPoly = (LPolygonAlgorithm) factory
+ .getShape(picto);
+ if (lPoly.getBottomPartSize((Polygon) picto.getGraphicsAlgorithm()) != size) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ lPoly.resizeBottomPart(
+ (Polygon) picto.getGraphicsAlgorithm(),
+ size);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Resizes the right part if the pictogram is a polygon such as a U shape.
+ *
+ * @param size
+ * @param picto
+ */
+ void resizeRightPart(final int size, final PictogramElement picto) {
+ final LPolygonAlgorithm lPoly = (LPolygonAlgorithm) factory
+ .getShape(picto);
+ if (lPoly.getRightPartSize((Polygon) picto.getGraphicsAlgorithm()) != size) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ lPoly.resizeRightPart(
+ (Polygon) picto.getGraphicsAlgorithm(),
+ size);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Resizes the left part if the pictogram is a polygon such as an L or U
+ * shape.
+ *
+ * @param size
+ * @param picto
+ */
+ void resizeLeftPart(final int size, final PictogramElement picto) {
+ final UPolygonAlgorithm uPoly = (UPolygonAlgorithm) factory
+ .getShape(picto);
+ if (uPoly.getLeftPartSize((Polygon) picto.getGraphicsAlgorithm()) != size) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ uPoly.resizeLeftPart(
+ (Polygon) picto.getGraphicsAlgorithm(),
+ size);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Resizes the shape.
+ *
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ * @param shape
+ */
+ void resize(final int x, final int y, final int width, final int height,
+ final Shape shape) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ ResizeShapeContext ctx = new ResizeShapeContext(
+ shape);
+ ctx.setX(x);
+ ctx.setY(y);
+ ctx.setWidth(width);
+ ctx.setHeight(height);
+ if (shape instanceof Diagram) {
+ shape.getGraphicsAlgorithm().setWidth(width);
+ shape.getGraphicsAlgorithm().setHeight(height);
+ } else {
+ IResizeShapeFeature resizeShapeFeature = provider
+ .getResizeShapeFeature(ctx);
+ if (resizeShapeFeature.canExecute(ctx))
+ resizeShapeFeature.execute(ctx);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Returns true if transaction is not read-only.
+ *
+ * @param domain
+ * @return
+ */
+ private boolean isWriteTransaction(TransactionalEditingDomain domain) {
+ if (domain instanceof TransactionalEditingDomainImpl)
+ return !((TransactionalEditingDomainImpl) domain)
+ .getActiveTransaction().isReadOnly();
+ else
+ return true;
+ }
+
+ /**
+ * Changes a shape to a multiinstance shape
+ *
+ * @param shape
+ * @param multipleInstances
+ */
+ void changeMultiInstance(final ContainerShape shape,
+ final boolean multipleInstances) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCNodeAlgorithm shapeAlgorithm = factory
+ .getShape(shape);
+ if (shapeAlgorithm != null) {
+ shapeAlgorithm.setMultipleInstances(shape,
+ provider, multipleInstances);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Changes the agent type to human or non-human.
+ *
+ * @param shape
+ * @param human
+ * @param selectionIndex
+ */
+ void changeAgentType(final ContainerShape shape, final boolean human) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ GraphicsAlgorithm alg = shape
+ .getGraphicsAlgorithm();
+ if (human) {
+ factory.getHumanAgent().addHumanFigure(diagram,
+ shape, alg.getWidth());
+ provider.link(shape, FMCType.HumanAgent);
+ } else {
+ factory.getHumanAgent()
+ .removeHumanFigure(shape);
+ provider.link(shape, FMCType.Agent);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Changes style of the shape.
+ *
+ * @param element
+ * @param selectionIndex
+ */
+ public void changeShapeStyle(final PictogramElement element,
+ final int selectionIndex) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCNodeAlgorithm algorithm = null;
+ ShapeStyle style = ShapeStyle.values()[selectionIndex];
+ if (helper.isAgent(element)) {
+ algorithm = factory.getAgentByShapestyle(style);
+ } else if (helper.isStorage(element)) {
+ algorithm = factory
+ .getStorageByShapestyle(style);
+ }
+ if (algorithm != null) {
+ ContainerShape firstLevelContainer = (ContainerShape) element;
+ GraphicsAlgorithm firstLevelGa = firstLevelContainer
+ .getGraphicsAlgorithm();
+
+ // Save old style settings
+ GraphicsAlgorithm oldSecondLevelGa = firstLevelGa
+ .getGraphicsAlgorithmChildren().get(0);
+ Color oldBackground = oldSecondLevelGa
+ .getBackground();
+ Color oldForeground = oldSecondLevelGa
+ .getForeground();
+ Double oldTransparency = oldSecondLevelGa
+ .getTransparency();
+ Style oldStyle = oldSecondLevelGa.getStyle();
+ boolean isMultiple = algorithm
+ .isMultipleInstances(firstLevelContainer);
+
+ // Create new invisible first level shape
+ firstLevelGa = algorithm.createGraphics(
+ diagram, firstLevelContainer,
+ firstLevelGa.getX(),
+ firstLevelGa.getY(),
+ firstLevelGa.getWidth(),
+ firstLevelGa.getHeight());
+ firstLevelGa.setBackground(oldBackground);
+ firstLevelGa.setForeground(oldForeground);
+ firstLevelGa.setTransparency(oldTransparency);
+ firstLevelGa.setStyle(oldStyle);
+ firstLevelGa.setLineVisible(false);
+ firstLevelGa.setFilled(false);
+ Graphiti.getGaService().setLocationAndSize(
+ firstLevelGa, firstLevelGa.getX(),
+ firstLevelGa.getY(),
+ firstLevelGa.getWidth(),
+ firstLevelGa.getHeight());
+ // link(newShape, context.getNewObject());?
+
+ // Create second level shape
+ GraphicsAlgorithm secondLevelGa = algorithm
+ .createGraphics(diagram, firstLevelGa,
+ 0, 0, firstLevelGa.getWidth(),
+ firstLevelGa.getHeight());
+ secondLevelGa.setLineVisible(true);
+ secondLevelGa.setFilled(true);
+ secondLevelGa.setBackground(oldBackground);
+ secondLevelGa.setForeground(oldForeground);
+ secondLevelGa.setTransparency(oldTransparency);
+ secondLevelGa.setStyle(oldStyle);
+ secondLevelGa
+ .setParentGraphicsAlgorithm(firstLevelGa);
+
+ if (isMultiple) {
+ algorithm
+ .setMultipleInstances(
+ firstLevelContainer,
+ provider, true);
+ }
+
+ algorithm.relocateText(secondLevelGa);
+
+ // Adapt first level shape (anchors)
+ algorithm
+ .createBoxAnchorSet(firstLevelContainer);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Changes the grid unit of the diagram.
+ *
+ * @param diagram
+ * @param gridUnit
+ */
+ void changeGridUnit(final Diagram diagram, final int gridUnit) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ diagram.setGridUnit(gridUnit);
+ }
+ }
+ });
+ }
+
+ /**
+ * Sets the channelLocation if the connection has a channel.
+ *
+ * @param con
+ * @param location
+ */
+ void changeChannelLocation(final Connection con, final double location) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ conFactory.getAlgorithm(con).setChannelLocation(
+ con, diagram, location);
+ }
+ }
+ });
+ }
+
+ /**
+ * Visualizes the anchors or hides the anchors depending on the visible
+ * parameter. Processes anchors recursively for all container children.
+ *
+ * @param container
+ * @param visible
+ */
+ void visualizeAnchors(final ContainerShape container, final boolean visible) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ for (Shape child : container.getChildren()) {
+ visualizeAnchors(child, visible);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Visualizes the anchors or hides the anchors depending on the visible
+ * parameter.
+ *
+ * @param shape
+ * @param visible
+ */
+ void visualizeAnchors(final Shape shape, final boolean visible) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(shape);
+ if (nodeAlgo != null)
+ nodeAlgo.setBoxAnchorsVisible(shape, visible);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * Adds or removes anchors depending on enabled parameter. Processes anchors
+ * recursively for all container children.
+ *
+ * @param container
+ * @param enabled
+ */
+ void enableAnchors(final ContainerShape container, final boolean enabled) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ for (Shape child : container.getChildren()) {
+ enableAnchors(child, enabled);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Adds or removes anchors depending on enabled parameter.
+ *
+ * @param shape
+ * @param enabled
+ * @return True if new anchors had to be created.
+ */
+ boolean enableAnchors(final Shape shape, final boolean enabled) {
+ final FMCNodeAlgorithm nodeAlgo = factory.getShape(shape);
+ boolean created = nodeAlgo != null && enabled
+ && !nodeAlgo.hasUnusedAnchors(shape);
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCNodeAlgorithm nodeAlgo = factory.getShape(shape);
+ if (nodeAlgo != null) {
+ if (enabled
+ && !nodeAlgo.hasUnusedAnchors(shape)) {
+ nodeAlgo.createBoxAnchorSet(shape);
+ } else
+ nodeAlgo.removeUnusedBoxAnchors(shape);
+ }
+ }
+ }
+ });
+ return created;
+ }
+
+ /**
+ * Changes the type of the connection based on the selection.
+ *
+ * @param connection
+ * @param selectionIndex
+ */
+ public void changeConnectionType(final Connection connection,
+ final int selectionIndex) {
+ editingDomain.getCommandStack().execute(
+ new RecordingCommand(editingDomain) {
+ @Override
+ protected void doExecute() {
+ if (isWriteTransaction(editingDomain)) {
+ FMCConnectionAlgorithm algorithm = conFactory
+ .getAlgorithm(connection);
+ double channelLocation = algorithm
+ .getChannelLocation(connection);
+ DataflowDirection direction = algorithm
+ .getDirection(connection);
+ RequestDirection requestDirection = algorithm
+ .getRequestDirection(connection);
+ Object modelObject = FMCUtil
+ .getModelObject(connection);
+ Anchor start = connection.getStart();
+ Anchor end = connection.getEnd();
+ RemoveContext remCtx = new RemoveContext(connection);
+ IRemoveFeature removeFeature = provider
+ .getRemoveFeature(remCtx);
+ if (removeFeature.canExecute(remCtx)) {
+ removeFeature.execute(remCtx);
+ }
+ AddConnectionContext addCtx = new AddConnectionContext(
+ start, end);
+ addCtx.setNewObject(modelObject);
+
+ switch (selectionIndex) {
+ case 0:
+ addCtx.putProperty(
+ BlockDiagramConstants.GRAPHICAL_TYPE_KEY,
+ ConnectionStyle.MANHATTAN);
+ break;
+ case 1:
+ addCtx.putProperty(
+ BlockDiagramConstants.GRAPHICAL_TYPE_KEY,
+ ConnectionStyle.NORMAL);
+ break;
+ default:
+ break;
+ }
+ IAddFeature addFeature = provider
+ .getAddFeature(addCtx);
+
+ if (addFeature.canExecute(addCtx)) {
+ addFeature.execute(addCtx);
+ EList<Connection> connections = provider
+ .getDiagramTypeProvider().getDiagram()
+ .getConnections();
+ Connection newConnection = connections
+ .get(connections.size() - 1);
+ // TODO Reselect new connection. Problem with
+ // this line is that still the old connection is
+ // selected.
+ // provider.getDiagramTypeProvider().getDiagramEditor().setPictogramElementForSelection(newConnection);
+ algorithm.setChannelLocation(newConnection,
+ diagram, channelLocation);
+ algorithm.setDirection(newConnection,
+ direction, diagram);
+ algorithm.setRequestDirection(newConnection,
+ requestDirection, diagram);
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ShapePropertySection.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ShapePropertySection.java
new file mode 100644
index 0000000..ea0af0a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/ShapePropertySection.java
@@ -0,0 +1,691 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.property;
+
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.LPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.PolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.FMCNodeAlgorithmFactory;
+import org.eclipse.fmc.blockdiagram.editor.algorithm.node.UPolygonAlgorithm;
+import org.eclipse.fmc.blockdiagram.editor.model.ShapeStyle;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeChecker;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCTypeCheckerFactory;
+import org.eclipse.fmc.blockdiagram.editor.util.FMCUtil;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+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.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class ShapePropertySection extends FMCPropertySection {
+
+ private static final String TOOLTIP_MULTI_INSTANCE = "Switch between multi instances or single instances";
+ private static final String TOOLTIP_HUMAN_AGENT = "If an agent shape is selected it allows to switch between human and non-human agents.";
+ private static final String TOOLTIP_SHAPE_STYLE = "Selects the style of the shape which can be one of Rectable, L or U.";
+ private static final String TOOLTIP_ANGLE = "Rotates the selected element in case of L or U shapes";
+ private static final String TOOLTIP_BOTTOM_SIZE = "Sets the size of the bottom part of an L or U shape";
+ private static final String TOOLTIP_LEFT_SIZE = "Sets the size of the left part of an L or U shape";
+ private static final String TOOLTIP_RIGHT_SIZE = "Sets the size of the right part of an L or U shape";
+ private static final String TOOLTIP_ANCHORS_VISIBLE = "Makes all anchors of the selected shape visible/invisible";
+ private static final int MAX = 1000000;
+ private static final String TOOLTIP_ANCHORS_ENABLED = "Creates/deletes anchors of the selected shape ";
+ private FMCNodeAlgorithmFactory factory = FMCNodeAlgorithmFactory
+ .getInstance();
+
+ private Spinner width;
+ private Spinner height;
+ private Spinner xLocation;
+ private Spinner yLocation;
+ private Spinner bottomSize;
+ private Spinner leftSize;
+ private Spinner rightSize;
+ private Spinner angleSize;
+ private CCombo shapeStyle;
+
+ private Button isHumanAgent;
+ private Button isMultiInstance;
+ private Button isAnchorsVisible;
+ private Button isAnchorsEnabled;
+
+ private PictogramElement previouslySelectedPicto = null;
+
+ private FMCTypeChecker helper = FMCTypeCheckerFactory.getInstance();
+
+ /**
+ * @return the width
+ */
+ Spinner getWidth() {
+ return width;
+ }
+
+ /**
+ * @return the height
+ */
+ Spinner getHeight() {
+ return height;
+ }
+
+ /**
+ * @return the xLocation
+ */
+ Spinner getxLocation() {
+ return xLocation;
+ }
+
+ /**
+ * @return the yLocation
+ */
+ Spinner getyLocation() {
+ return yLocation;
+ }
+
+ /**
+ * @return the bottomSize
+ */
+ Spinner getBottomSize() {
+ return bottomSize;
+ }
+
+ /**
+ * @return the leftSize
+ */
+ Spinner getLeftSize() {
+ return leftSize;
+ }
+
+ /**
+ * @return the rightSize
+ */
+ Spinner getRightSize() {
+ return rightSize;
+ }
+
+ /**
+ * @return the angleSize
+ */
+ Spinner getAngleSize() {
+ return angleSize;
+ }
+
+ /**
+ * @return the shapeStyle
+ */
+ CCombo getShapeStyle() {
+ return shapeStyle;
+ }
+
+ /**
+ * @return the isHumanAgent
+ */
+ Button getIsHumanAgent() {
+ return isHumanAgent;
+ }
+
+ /**
+ * @return the isMultiInstance
+ */
+ Button getIsMultiInstance() {
+ return isMultiInstance;
+ }
+
+ /**
+ * @return the isAnchorsVisible
+ */
+ Button getIsAnchorsVisible() {
+ return isAnchorsVisible;
+ }
+
+ /**
+ * @return the isAnchorsVisible
+ */
+ Button getIsAnchorsEnabled() {
+ return isAnchorsEnabled;
+ }
+
+ private void createShapeProperties(TabbedPropertySheetWidgetFactory fac) {
+ createWidth(fac);
+ createHeight(fac);
+ createXLocation(fac);
+ createYLocation(fac);
+ createAngleSize(fac);
+ createShapeStyle(fac);
+ createHumanAgent(fac);
+ createMultiInstance(fac);
+ createBottomSize(fac);
+ createRightSize(fac);
+ createLeftSize(fac);
+ createAnchorsVisible(fac);
+ createAnchorsEnabled(fac);
+ }
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory fac = getWidgetFactory();
+ comp = fac.createComposite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ createShapeProperties(fac);
+ refresh();
+ }
+
+ protected void createWidth(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Width:");
+ width = new Spinner(comp, SWT.BORDER);
+ width.setMaximum(MAX);
+ width.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int width = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Shape) {
+ Shape shape = (Shape) el;
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ if (width != graphicsAlgorithm.getWidth())
+ getActions().resize(graphicsAlgorithm.getX(),
+ graphicsAlgorithm.getY(), width,
+ graphicsAlgorithm.getHeight(), shape);
+ }
+ }
+ });
+ }
+
+ protected void createHeight(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Height:");
+ height = new Spinner(comp, SWT.BORDER);
+ // height.setMaximum(diag.getGraphicsAlgorithm().getHeight());
+ height.setMaximum(MAX);
+ height.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int height = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Shape) {
+ Shape shape = (Shape) el;
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ if (height != graphicsAlgorithm.getHeight())
+ getActions().resize(graphicsAlgorithm.getX(),
+ graphicsAlgorithm.getY(),
+ graphicsAlgorithm.getWidth(), height, shape);
+ }
+ }
+ });
+ }
+
+ protected void createXLocation(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Location X:");
+ xLocation = new Spinner(comp, SWT.BORDER);
+ // xLocation.setMaximum(diag.getGraphicsAlgorithm().getWidth());
+ xLocation.setMaximum(MAX);
+ xLocation.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int x = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Shape) {
+ Shape shape = (Shape) el;
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ if (x != graphicsAlgorithm.getX())
+ getActions().resize(x, graphicsAlgorithm.getY(),
+ graphicsAlgorithm.getWidth(),
+ graphicsAlgorithm.getHeight(), shape);
+ }
+ }
+ });
+ }
+
+ protected void createYLocation(TabbedPropertySheetWidgetFactory fac) {
+ fac.createLabel(comp, "Location Y:");
+ yLocation = new Spinner(comp, SWT.BORDER);
+ // yLocation.setMaximum(diag.getGraphicsAlgorithm().getHeight());
+ yLocation.setMaximum(MAX);
+ yLocation.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int y = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ if (el != null && el instanceof Shape) {
+ Shape shape = (Shape) el;
+ GraphicsAlgorithm graphicsAlgorithm = shape
+ .getGraphicsAlgorithm();
+ if (y != graphicsAlgorithm.getY())
+ getActions().resize(graphicsAlgorithm.getX(), y,
+ graphicsAlgorithm.getWidth(),
+ graphicsAlgorithm.getHeight(), shape);
+ }
+ }
+ });
+ }
+
+ protected void createAngleSize(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Angle:");
+ label.setToolTipText(TOOLTIP_ANGLE);
+ angleSize = new Spinner(comp, SWT.BORDER);
+ angleSize.setToolTipText(TOOLTIP_ANGLE);
+ angleSize.setMaximum(270);
+ angleSize.setIncrement(90);
+ angleSize.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int angle = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+ // if(el != null && el.getGraphicsAlgorithm() instanceof
+ // Polygon){
+ if (el != null) {
+ getActions().rotate(angle, el);
+ }
+ }
+ });
+ }
+
+ protected void createShapeStyle(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Shapestyle:");
+ label.setToolTipText(TOOLTIP_SHAPE_STYLE);
+ shapeStyle = fac.createCCombo(comp, SWT.DROP_DOWN);
+ shapeStyle.setToolTipText(TOOLTIP_SHAPE_STYLE);
+ shapeStyle.setEditable(false);
+ shapeStyle.setItems(new String[] { ShapeStyle.RECT.getName(),
+ ShapeStyle.L.getName(), ShapeStyle.U.getName() });
+ shapeStyle.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int index = shapeStyle.getSelectionIndex();
+ PictogramElement el = getSingleInput();
+ getActions().changeShapeStyle(el, index);
+ if (index > 0 && !getIsHumanAgent().isDisposed())
+ getIsHumanAgent().setEnabled(false);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createHumanAgent(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Human Agent:");
+ label.setToolTipText(TOOLTIP_HUMAN_AGENT);
+ isHumanAgent = new Button(comp, SWT.CHECK);
+ isHumanAgent.setToolTipText(TOOLTIP_HUMAN_AGENT);
+ isHumanAgent.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ if (el instanceof ContainerShape)
+ getActions().changeAgentType((ContainerShape) el,
+ isHumanAgent.getSelection());
+ if (isHumanAgent.getSelection())
+ getShapeStyle().setEnabled(false);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createMultiInstance(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Multiple Instances:");
+ label.setToolTipText(TOOLTIP_MULTI_INSTANCE);
+ isMultiInstance = new Button(comp, SWT.CHECK);
+ isMultiInstance.setToolTipText(TOOLTIP_MULTI_INSTANCE);
+ isMultiInstance.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ if (el instanceof ContainerShape)
+ getActions().changeMultiInstance((ContainerShape) el,
+ isMultiInstance.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createBottomSize(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Size (Bottom):");
+ label.setToolTipText(TOOLTIP_BOTTOM_SIZE);
+ bottomSize = new Spinner(comp, SWT.BORDER);
+ bottomSize.setToolTipText(TOOLTIP_BOTTOM_SIZE);
+ // bottomSize.setMaximum(diag.getGraphicsAlgorithm().getHeight());
+ bottomSize.setMaximum(MAX);
+ bottomSize.setSelection(LPolygonAlgorithm.L_PART_DEFAULT_SIZE);
+ bottomSize.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int size = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+
+ getActions().resizeBottomPart(size, el);
+ }
+ });
+ }
+
+ protected void createLeftSize(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Size (Left):");
+ label.setToolTipText(TOOLTIP_LEFT_SIZE);
+ leftSize = new Spinner(comp, SWT.BORDER);
+ leftSize.setToolTipText(TOOLTIP_LEFT_SIZE);
+ leftSize.setMaximum(MAX);
+ // leftSize.setMaximum(diag.getGraphicsAlgorithm().getWidth());
+ leftSize.setSelection(LPolygonAlgorithm.L_PART_DEFAULT_SIZE);
+ leftSize.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int size = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+
+ getActions().resizeLeftPart(size, el);
+ }
+ });
+ }
+
+ protected void createRightSize(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Size (Right):");
+ label.setToolTipText(TOOLTIP_RIGHT_SIZE);
+ rightSize = new Spinner(comp, SWT.BORDER);
+ rightSize.setToolTipText(TOOLTIP_RIGHT_SIZE);
+ rightSize.setSelection(LPolygonAlgorithm.L_PART_DEFAULT_SIZE);
+ rightSize.setMaximum(MAX);
+ // rightSize.setMaximum(diag.getGraphicsAlgorithm().getWidth());
+ rightSize.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(final ModifyEvent e) {
+ int size = ((Spinner) e.getSource()).getSelection();
+ PictogramElement el = getSingleInput();
+
+ getActions().resizeRightPart(size, el);
+ }
+ });
+ }
+
+ protected void createAnchorsVisible(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Anchors visible:");
+ label.setToolTipText(TOOLTIP_ANCHORS_VISIBLE);
+ isAnchorsVisible = new Button(comp, SWT.CHECK);
+ isAnchorsVisible.setToolTipText(TOOLTIP_ANCHORS_VISIBLE);
+ isAnchorsVisible.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ getActions().visualizeAnchors((Shape) el,
+ isAnchorsVisible.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ protected void createAnchorsEnabled(TabbedPropertySheetWidgetFactory fac) {
+ Label label = fac.createLabel(comp, "Anchors enabled:");
+ label.setToolTipText(TOOLTIP_ANCHORS_ENABLED);
+ isAnchorsEnabled = new Button(comp, SWT.CHECK);
+ isAnchorsEnabled.setToolTipText(TOOLTIP_ANCHORS_ENABLED);
+ isAnchorsEnabled.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PictogramElement el = getSingleInput();
+ boolean created = getActions().enableAnchors((Shape) el,
+ isAnchorsEnabled.getSelection());
+ if (created && isAnchorsVisible.getSelection())
+ getActions().visualizeAnchors((Shape) el,
+ isAnchorsVisible.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
+ private void refreshFMCNode(ContainerShape shape) {
+
+ shapeStyle
+ .setEnabled(((helper.isAgent(super.getSingleInput())) || helper
+ .isStorage(super.getSingleInput()))
+ && !helper.isHumanAgent(super.getSingleInput()));
+ FMCNodeAlgorithm fmcNodeAlgorithmParent = factory.getShape(shape);
+
+ if (fmcNodeAlgorithmParent != null) {
+ isAnchorsVisible.setSelection(fmcNodeAlgorithmParent
+ .isBoxAnchorsVisible(shape));
+ isAnchorsEnabled.setSelection(fmcNodeAlgorithmParent
+ .hasUnusedAnchors(shape));
+ }
+
+ // Case MultiShape
+ if (FMCUtil.isMultiShape(shape)) {
+ FMCNodeAlgorithm fmcNodeAlgorithm = factory.getShape(shape);
+ if (fmcNodeAlgorithm instanceof LPolygonAlgorithm) {
+ Polygon polygon = (Polygon) shape.getGraphicsAlgorithm();
+ shapeStyle.select(1);
+ if (isHumanAgent != null)
+ isHumanAgent.setEnabled(false);
+ angleSize.setEnabled(true);
+ angleSize.setSelection(((PolygonAlgorithm) fmcNodeAlgorithm)
+ .getAngle(polygon));
+
+ bottomSize.setEnabled(true);
+ rightSize.setEnabled(true);
+ rightSize.setMinimum(LPolygonAlgorithm.L_PART_MINIMUM_SIZE);
+ rightSize.setSelection(((LPolygonAlgorithm) fmcNodeAlgorithm)
+ .getRightPartSize(polygon));
+ bottomSize.setSelection(((LPolygonAlgorithm) fmcNodeAlgorithm)
+ .getBottomPartSize(polygon));
+ bottomSize.setMinimum(LPolygonAlgorithm.L_PART_MINIMUM_SIZE);
+ if (fmcNodeAlgorithm instanceof UPolygonAlgorithm) {
+ shapeStyle.select(2);
+ // isHumanAgentLabel.setEnabled(false);
+ // isHumanAgent.setEnabled(false);
+
+ leftSize.setEnabled(true);
+ leftSize.setMinimum(LPolygonAlgorithm.L_PART_MINIMUM_SIZE);
+ leftSize.setSelection(((UPolygonAlgorithm) fmcNodeAlgorithm)
+ .getLeftPartSize(polygon));
+ }
+ } else if (helper.isStorage(shape)) {
+ shapeStyle.select(0);
+ } else if (helper.isAgent(shape)) {
+ shapeStyle.select(0);
+ if (isHumanAgent != null) {
+ isHumanAgent.setEnabled(true);
+ isHumanAgent.setSelection(helper.isHumanAgent(shape));
+ }
+ } else {
+ if (isHumanAgent != null)
+ isHumanAgent.setEnabled(false);
+ }
+ if (fmcNodeAlgorithmParent != null && isMultiInstance != null)
+ isMultiInstance.setSelection(fmcNodeAlgorithmParent
+ .isMultipleInstances(shape));
+ }
+ // Simple Shape
+ else if (fmcNodeAlgorithmParent != null
+ && shape.getGraphicsAlgorithm() instanceof Polygon) {
+ Polygon polygon = (Polygon) shape.getGraphicsAlgorithm();
+ // angleSize.setSelection((int)
+ // Math.round(polygonAlgorithmParent.getAngle(polygon)));
+
+ if (fmcNodeAlgorithmParent instanceof LPolygonAlgorithm) {
+ bottomSize.setEnabled(true);
+ rightSize.setEnabled(true);
+ rightSize.setMinimum(LPolygonAlgorithm.L_PART_MINIMUM_SIZE);
+ rightSize
+ .setSelection(((LPolygonAlgorithm) fmcNodeAlgorithmParent)
+ .getRightPartSize(polygon));
+ bottomSize
+ .setSelection(((LPolygonAlgorithm) fmcNodeAlgorithmParent)
+ .getBottomPartSize(polygon));
+ angleSize.setEnabled(true);
+ angleSize.setEnabled(true);
+ angleSize
+ .setSelection(((PolygonAlgorithm) fmcNodeAlgorithmParent)
+ .getAngle(polygon));
+ }
+ if (fmcNodeAlgorithmParent instanceof UPolygonAlgorithm) {
+ leftSize.setEnabled(true);
+ leftSize.setMinimum(LPolygonAlgorithm.L_PART_MINIMUM_SIZE);
+ leftSize.setSelection(((UPolygonAlgorithm) fmcNodeAlgorithmParent)
+ .getLeftPartSize(polygon));
+ }
+ }
+ }
+
+ private void refreshShape(Shape shape) {
+ setControlsDisabled();
+ if (!(shape instanceof Diagram)) {
+ if (width != null) {
+ width.setEnabled(true);
+ }
+ if (height != null) {
+ height.setEnabled(true);
+ }
+ if (xLocation != null) {
+ xLocation.setEnabled(true);
+ }
+ if (yLocation != null) {
+ yLocation.setEnabled(true);
+ }
+ }
+ if (helper.isFMCNode(shape)) {
+ refreshFMCNode((ContainerShape) shape);
+ }
+ GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
+ if (graphicsAlgorithm != null) {
+ width.setSelection(graphicsAlgorithm.getWidth());
+ height.setSelection(graphicsAlgorithm.getHeight());
+ xLocation.setSelection(graphicsAlgorithm.getX());
+ yLocation.setSelection(graphicsAlgorithm.getY());
+ }
+ if (isMultiInstance != null) {
+ boolean isMultiInstanceVisible = (helper.isAgent(super
+ .getSingleInput()))
+ || helper.isStorage(super.getSingleInput());// ||
+ // helper.isStructureVariance(super.getSingleInput());
+ isMultiInstance.setEnabled(isMultiInstanceVisible);
+ }
+
+ }
+
+ @Override
+ public void refresh() {
+ if (!this.isDisposed()
+ && (previouslySelectedPicto == null || previouslySelectedPicto != this
+ .getSingleInput())) {
+ PictogramElement el = this.getSingleInput();
+ if (el != null && el instanceof Shape) {
+ refreshShape((Shape) el);
+ } else {
+ setControlsDisabled();
+ }
+ previouslySelectedPicto = el;
+ ScrolledComposite tabbedPropertyComposite = findTabbedPropertyComposite(comp);
+ if (tabbedPropertyComposite != null) {
+ int cols = tabbedPropertyComposite.getSize().x / 150 * 2;
+ cols = cols < 2 ? 2 : cols;
+ comp.setLayout(new GridLayout(cols > 8 ? 8 : cols, false));
+ comp.layout();
+ }
+ }
+ }
+
+ private void setControlsDisabled() {
+ disableStandardSizeControls();
+ disableSpecialSizeControls();
+ if (shapeStyle != null) {
+ shapeStyle.setEnabled(false);
+
+ }
+ if (isHumanAgent != null) {
+ isHumanAgent.setEnabled(false);
+
+ }
+ if (isMultiInstance != null) {
+ isMultiInstance.setEnabled(false);
+
+ }
+ }
+
+ private void disableSpecialSizeControls() {
+ if (bottomSize != null) {
+ bottomSize.setEnabled(false);
+ }
+ if (leftSize != null) {
+ leftSize.setEnabled(false);
+ }
+ if (rightSize != null) {
+ rightSize.setEnabled(false);
+ }
+ }
+
+ private void disableStandardSizeControls() {
+ if (angleSize != null) {
+ angleSize.setEnabled(false);
+ }
+ if (width != null) {
+ width.setEnabled(false);
+ }
+ if (height != null) {
+ height.setEnabled(false);
+ }
+ if (xLocation != null) {
+ xLocation.setEnabled(false);
+ }
+ if (yLocation != null) {
+ yLocation.setEnabled(false);
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/package.html
new file mode 100644
index 0000000..bff7ba1
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/property/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This package contains the simple data model for the FMC Blockdiagram Editor and also other enumeration classes.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/DiagramFactory.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/DiagramFactory.java
new file mode 100644
index 0000000..673d4d2
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/DiagramFactory.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.util;
+
+import java.util.Collections;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * This class is responsible for creating new Diagram instances.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class DiagramFactory {
+
+ public static final int DIAGRAM_HEIGHT_DEFAULT = 1000;
+ public static final int DIAGRAM_WIDTH_DEFAULT = 1000;
+
+ /**
+ * Creates a default diagram of type blockdiagram with the given size.
+ *
+ * @param uri
+ * The uri where the new blockdiagram file is written to.
+ * @param width
+ * The width.
+ * @param height
+ * The height.
+ */
+ public static void createDefaultBlockdiagramFile(URI uri, int width, int height,
+ int gridUnit) {
+ Diagram defaultDiagram = getDefaultDiagram();
+ defaultDiagram.setGridUnit(gridUnit);
+ createBlockdiagramFile(uri, defaultDiagram, width, height);
+ }
+
+ /**
+ * Creates a default diagram of type fmcMeta with the given size.
+ *
+ * @param uri
+ * The uri where the new fmc file is written to.
+ * @param width
+ * The width.
+ * @param height
+ * The height.
+ */
+ public static void createDefaultBlockdiagramMetaFile(URI uri, int width, int height,
+ int gridUnit) {
+ Diagram defaultDiagram = getDefaultMetaDiagram();
+ defaultDiagram.setGridUnit(gridUnit);
+ createBlockdiagramFile(uri, defaultDiagram, width, height);
+ }
+
+ /**
+ *
+ * @return Default diagram of type blockdiagram.
+ */
+ public static Diagram getDefaultDiagram() {
+ Diagram d = Graphiti.getPeService().createDiagram("fmc", "", 10, false);
+ d.setSnapToGrid(true);
+ return d;
+ }
+
+ /**
+ *
+ * @return Default diagram of type fmcMeta.
+ */
+ public static Diagram getDefaultMetaDiagram() {
+ Diagram diagram = getDefaultDiagram();
+ diagram.setDiagramTypeId("fmcMeta");
+ return diagram;
+ }
+
+ /**
+ * Creates a new blockdiagram file with a given Diagram and width and height.
+ *
+ * @param uri
+ * The uri where the new fmc files is written to.
+ * @param d
+ * The diagram.
+ * @param width
+ * The width.
+ * @param height
+ * The height.
+ */
+ public static void createBlockdiagramFile(URI uri, Diagram d, int width, int height) {
+ XMIResourceFactoryImpl resFac = new XMIResourceFactoryImpl();
+ try {
+ // IGaService gaService = Graphiti.getGaService();
+ Resource r = resFac.createResource(uri);
+ /*
+ * Rectangle rec = gaService.createRectangle(d);
+ * rec.setHeight(height); rec.setWidth(width);
+ * rec.setBackground(gaService.manageColor(d, 255, 255, 255));
+ * rec.setForeground(gaService.manageColor(d, 220, 220, 220));
+ */
+ r.getContents().add(d);
+ r.save(Collections.EMPTY_MAP);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ public static void createDefaultFMCProfileFile(URI uri, int width,
+ int height, int gridUnit) {
+ Diagram defaultDiagram = getDefaultProfileDiagram();
+ defaultDiagram.setGridUnit(gridUnit);
+ createBlockdiagramFile(uri, defaultDiagram, width, height);
+ }
+
+ /**
+ *
+ * @return Default diagram of type fmc profile.
+ */
+ public static Diagram getDefaultProfileDiagram() {
+ // PictogramsFactory pictoFactory = PictogramsFactory.eINSTANCE;
+ Diagram d = Graphiti.getPeService().createDiagram("fmcProfile", "", 10,
+ false);
+ d.setSnapToGrid(true);
+ return d;
+ }
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FMCUtil.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FMCUtil.java
new file mode 100644
index 0000000..a500fbe
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FMCUtil.java
@@ -0,0 +1,654 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.fmc.blockdiagram.editor.model.FMCType;
+import org.eclipse.graphiti.datatypes.ILocation;
+import org.eclipse.graphiti.internal.datatypes.impl.LocationImpl;
+import org.eclipse.graphiti.mm.Property;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.AnchorContainer;
+import org.eclipse.graphiti.mm.pictograms.BoxRelativeAnchor;
+import org.eclipse.graphiti.mm.pictograms.ChopboxAnchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+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.PictogramLink;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaCreateService;
+import org.eclipse.graphiti.services.ILinkService;
+import org.eclipse.graphiti.services.IPeService;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.ColorDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+@SuppressWarnings("restriction")
+public class FMCUtil {
+
+ /**
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public static int getMinimum(int x, int y) {
+ return x < y ? x : y;
+ }
+
+ public static boolean isMultiShape(PictogramElement shape) {
+ if (shape instanceof ContainerShape)
+ return !((ContainerShape) shape).getChildren().isEmpty();
+ else
+ return false;
+ }
+
+ public static Set<BoxRelativeAnchor> removeObsoleteAnchors(Shape shape) {
+ Set<BoxRelativeAnchor> stillUsedAnchors = new HashSet<BoxRelativeAnchor>();
+ for (Anchor anchor : new HashSet<Anchor>(shape.getAnchors())) {
+ if (anchor instanceof BoxRelativeAnchor) {
+ if (anchor.getIncomingConnections().isEmpty()
+ && anchor.getOutgoingConnections().isEmpty())
+ shape.getAnchors().remove(anchor);
+ else
+ stillUsedAnchors.add((BoxRelativeAnchor) anchor);
+
+ }
+ }
+ return stillUsedAnchors;
+ }
+
+ public static List<Connection> getAllConnections(Shape shape) {
+ ArrayList<Connection> returnValue = new ArrayList<Connection>();
+ for (Anchor anchor : new HashSet<Anchor>(shape.getAnchors())) {
+ if (!anchor.getIncomingConnections().isEmpty())
+ returnValue.addAll(anchor.getIncomingConnections());
+ if (!anchor.getOutgoingConnections().isEmpty())
+ returnValue.addAll(anchor.getOutgoingConnections());
+ }
+ return returnValue;
+ }
+
+ public static Color editColor(Color color) {
+ if (color != null && color.eContainer() instanceof Diagram) {
+ Shell shell = getShell();
+ ColorDialog colorDia = new ColorDialog(shell);
+ colorDia.setText("Choose Color");
+ colorDia.setRGB(new RGB(color.getRed(), color.getGreen(), color
+ .getBlue()));
+
+ RGB retRgb = colorDia.open();
+ if (retRgb == null) {
+ return null;
+ }
+
+ Diagram diagram = (Diagram) color.eContainer();
+ Color newCol = Graphiti.getGaService().manageColor(diagram,
+ retRgb.red, retRgb.green, retRgb.blue);
+ return newCol;
+
+ }
+
+ return null;
+ }
+
+ public static Diagram getDiagram(PictogramElement picto) {
+ EObject container = picto.eContainer();
+ if (container instanceof Diagram)
+ return (Diagram) container;
+ else if (container instanceof PictogramElement)
+ return getDiagram((PictogramElement) container);
+ else
+ return null;
+ }
+
+ private static Shell getShell() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+
+ public static FMCType getIndependentObject(PictogramElement el) {
+ if (el != null) {
+ for (Property prop : el.getProperties()) {
+ if (prop.getKey().equals("independentObject")) {
+ return FMCType.valueOf(prop.getValue());
+ }
+ }
+ }
+ return null;
+ }
+
+ public static EObject getBO(PictogramElement pe) {
+ if (pe == null)
+ return null;
+ PictogramLink link = pe.getLink();
+ if (link == null)
+ return null;
+ if (!pe.getLink().getBusinessObjects().isEmpty())
+ return pe.getLink().getBusinessObjects().get(0);
+ else
+ return null;
+
+ }
+
+ public static Object getModelObject(PictogramElement pe) {
+ FMCType independentObject = getIndependentObject(pe);
+ if (independentObject == null)
+ return getBO(pe);
+ else
+ return getIndependentObject(pe);
+ }
+
+ public static final int ANCHOR_LEFT = 1;
+ public static final int ANCHOR_RIGHT = 2;
+ public static final int ANCHOR_TOP = 3;
+ public static final int ANCHOR_BOTTOM = 4;
+
+ public static ILocation getRelativePosition(final PictogramElement element,
+ final int x, final int y) {
+ return getRelativePosition(element, new LocationImpl(x, y));
+ }
+
+ /**
+ * Returns the pictogram elements out of a specific diagram which reference
+ * the specified business object.
+ *
+ * @param diagram
+ * the diagram, which contains the pictogram element
+ * @param bo
+ * the business object, which the pictogram elements reference
+ * @return the corresponding pictogram elements, never null
+ * @see #getPictogramElement(Diagram, EObject) How to obtain only the first
+ * associated pictogram element?
+ */
+ public static Collection<PictogramElement> getPictogramElements(
+ final Diagram diagram, final EObject bo) {
+ final Collection<PictogramElement> elements = new ArrayList<PictogramElement>();
+ final Collection<PictogramLink> pictogramLinks = diagram
+ .getPictogramLinks();
+ linkLoop: for (final PictogramLink pictogramLink : pictogramLinks) {
+ final List<EObject> businessObjects = pictogramLink
+ .getBusinessObjects();
+ for (final EObject obj : businessObjects) {
+ if (EcoreUtil.equals(bo, obj)) {
+ final PictogramElement pe = pictogramLink
+ .getPictogramElement();
+ if (pe != null) {
+ elements.add(pe);
+ continue linkLoop;
+ }
+ }
+ }
+ }
+ return elements;
+ }
+
+ public static ILocation getRelativePosition(final PictogramElement element,
+ final ILocation location) {
+ location.setX(location.getX() - element.getGraphicsAlgorithm().getX());
+ location.setY(location.getY() - element.getGraphicsAlgorithm().getY());
+ if (element.eContainer() instanceof ContainerShape
+ && !(element.eContainer() instanceof Diagram)) {
+ return getRelativePosition((ContainerShape) element.eContainer(),
+ location);
+
+ } else
+ return location;
+ }
+
+ public static ILocation getAbsolutePosition(final PictogramElement element,
+ final ILocation location) {
+ location.setX(location.getX() + element.getGraphicsAlgorithm().getX());
+ location.setY(location.getY() + element.getGraphicsAlgorithm().getY());
+ if (element.eContainer() instanceof ContainerShape
+ && !(element.eContainer() instanceof Diagram)) {
+ return getAbsolutePosition((ContainerShape) element.eContainer(),
+ location);
+
+ } else
+ return location;
+ }
+
+ public static Map<String, String> extensionToTypeMap = new HashMap<String, String>() {
+ private static final long serialVersionUID = 3995819479426775731L;
+
+ {
+ put("actionsdiag", "actions");
+ put("activitydiag", "activity");
+ put("concernsdiag", "concerns");
+ put("mappingdiag", "mapping");
+ put("bpmndiag", "bpmn2");
+ }
+ };
+ public static Map<String, String> extensionToModelExtensionMap = new HashMap<String, String>() {
+ private static final long serialVersionUID = 7135824024665889657L;
+
+ {
+ put("actionsdiag", "actions");
+ put("activitydiag", "actions");
+ put("concernsdiag", "concerns");
+ put("mappingdiag", "service");
+ put("bpmndiag", "bpmn2");
+ }
+ };
+
+ /**
+ *
+ * Find minimum and maximum coordinates used within set of selected
+ * pictogram elements. The meanings of the return array are: 0: min X 1: min
+ * Y 2: max X 3: max Y
+ *
+ * @author Rainer Thome
+ */
+ public static int[] getMinMaxCoords(PictogramElement[] els) {
+ int[] ret = new int[4];
+ ret[0] = Integer.MAX_VALUE;
+ ret[1] = Integer.MAX_VALUE;
+ ret[2] = Integer.MIN_VALUE;
+ ret[3] = Integer.MIN_VALUE;
+ GraphicsAlgorithm ga = null;
+ for (PictogramElement el : els) {
+ ga = el.getGraphicsAlgorithm();
+ if (ga.getX() < ret[0])
+ ret[0] = ga.getX();
+ if (ga.getY() < ret[1])
+ ret[1] = ga.getY();
+ if (ga.getX() + ga.getWidth() > ret[2])
+ ret[2] = ga.getX() + ga.getWidth();
+ if (ga.getY() + ga.getHeight() > ret[3])
+ ret[3] = ga.getY() + ga.getHeight();
+ }
+ return ret;
+ }
+
+ public static ResourceSet getResourceSet() {
+ final DiagramEditor editor = getActiveEditor();
+ if (editor != null)
+ return editor.getDiagramBehavior().getResourceSet();
+ return null;
+ }
+
+ public static Color editColor(final Color color, final Diagram diagram) {
+
+ final Shell shell = getShell();
+ final ColorDialog colorDia = new ColorDialog(shell);
+ colorDia.setText("Choose Color");
+ if (color != null)
+ colorDia.setRGB(new RGB(color.getRed(), color.getGreen(), color
+ .getBlue()));
+
+ final RGB retRgb = colorDia.open();
+ if (retRgb == null) {
+ return color;
+ }
+ final Color newCol = Graphiti.getGaService().manageColor(diagram,
+ retRgb.red, retRgb.green, retRgb.blue);
+ return newCol;
+ }
+
+ public static int extractId(final String str) {
+ final int hashId = str.lastIndexOf("(");
+ final int bracketId = str.lastIndexOf(")");
+ return Integer.parseInt(str.substring(hashId + 1, bracketId));
+ }
+
+ /**
+ * Returns the CustomDiagramEditor instance, which is currently active.
+ *
+ * @return the active editor instance, if existent, null otherwise
+ */
+ public static DiagramEditor getActiveEditor() {
+ return getActiveEditorSavely();
+ }
+
+ /**
+ * Check first if is possible to return the currently active DiagramEditor.
+ *
+ * @return the active editor instance, if existent, null otherwise
+ */
+ public static DiagramEditor getActiveEditorSavely() {
+ if ((PlatformUI.getWorkbench() == null)
+ || (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null)
+ || (PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage() == null)
+ || (PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().getActiveEditor() == null))
+ return null;
+ final IEditorPart editor = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ return editor instanceof DiagramEditor ? (DiagramEditor) editor : null;
+ }
+
+ /**
+ * @return the resource associated with the currently open diagram
+ */
+ public static IResource getActiveResource() {
+ return ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .findMember(
+ getActiveEditor().getDiagramTypeProvider().getDiagram()
+ .eResource().getURI().toPlatformString(true));
+ }
+
+ public static String convertHungarian(final String in) {
+ final StringBuffer buffer = new StringBuffer(in);
+ final ArrayList<Integer> indexes = new ArrayList<Integer>();
+ for (int i = 0; i < buffer.length(); i++) {
+ if (i == 0) {
+ buffer.replace(0, 1, Character.toString(Character
+ .toUpperCase(buffer.charAt(0))));
+ } else if (Character.isUpperCase(buffer.charAt(i))) {
+ indexes.add(i);
+ }
+ }
+ for (int i = 0; i < indexes.size(); i++) {
+ buffer.insert(indexes.get(i) + i, ' ');
+ }
+ return buffer.toString().trim();
+ }
+
+ public static Map<EStructuralFeature, GraphicsAlgorithm> getLinkedFeaturesMap(
+ final PictogramElement el, final EObject obj) {
+ final ILinkService ls = Graphiti.getLinkService();
+ final Map<EStructuralFeature, GraphicsAlgorithm> out = new HashMap<EStructuralFeature, GraphicsAlgorithm>();
+ if (el instanceof ContainerShape) {
+ final EList<Shape> children = ((ContainerShape) el).getChildren();
+ for (final Shape shape : children) {
+ final Property prop = ls.getLinkProperty(shape);
+ if (prop != null)
+ out.put(obj.eClass().getEStructuralFeature(prop.getValue()),
+ shape.getGraphicsAlgorithm());
+ }
+ return out;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the pictogram element out of a specific diagram, which references
+ * the specified business object.
+ *
+ * @param diagram
+ * the diagram, which contains the pictogram element
+ * @param bo
+ * the business object, which the pictogram element references
+ * @return the corresponding business object, null otherwise
+ */
+ public static PictogramElement getPictogramElement(final Diagram diagram,
+ final EObject bo) {
+ final Collection<PictogramLink> pictogramLinks = diagram
+ .getPictogramLinks();
+ for (final PictogramLink pictogramLink : pictogramLinks) {
+ final List<EObject> businessObjects = pictogramLink
+ .getBusinessObjects();
+ for (final EObject obj : businessObjects) {
+ if (EcoreUtil.equals(bo, obj)) {
+ final PictogramElement pe = pictogramLink
+ .getPictogramElement();
+ if (pe != null) {
+ return pe;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates a list, which contains the points with the necessary coordinates
+ * to represent a non-functional action shape, depending on the width w and
+ * height h.
+ *
+ * @param w
+ * the width of the shape
+ * @param h
+ * the height of the shape
+ * @return
+ */
+ public static ArrayList<Point> getActionPolygonPoints(final int w,
+ final int h) {
+ final IGaCreateService gaCreate = Graphiti.getGaCreateService();
+ final ArrayList<Point> points = new ArrayList<Point>();
+ points.add(gaCreate.createPoint(0, 0));
+ points.add(gaCreate.createPoint((int) Math.round(0.75 * w), 0));
+ points.add(gaCreate.createPoint(w, (int) Math.round(0.5 * h)));
+ points.add(gaCreate.createPoint((int) Math.round(0.75 * w), h));
+ points.add(gaCreate.createPoint(0, h));
+ points.add(gaCreate.createPoint((int) Math.round(0.25 * w),
+ (int) Math.round(0.5 * h)));
+ return points;
+ }
+
+ /**
+ * Finds the name of the business objects EClass.
+ *
+ * @param pe
+ * the pictogram element containing the business object
+ * @return
+ */
+ public static String getElementType(final PictogramElement pe) {
+ final EObject bo = getBO(pe);
+ return bo.eClass().getName();
+ }
+
+ public static boolean isDrillUpShape(final PictogramElement pe) {
+ final EList<Property> properties = pe.getProperties();
+ for (final Property p : properties) {
+ if (p.getKey().equals("type")
+ && p.getValue().equals("DrillUpShape"))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method used in the context of determining the appropriate anchor for a
+ * gateway figure out of the four fixed anchors, which are generally
+ * available for those figures. Returns an integer value representing the
+ * anchor, which is nearest to the coordinates given in the parameters. One
+ * pair of x/y coordinates represents the anchor location and the other pair
+ * represents the bendpoint location.
+ *
+ * @param x1
+ * first x coordinate
+ * @param y1
+ * first y coordinate
+ * @param x2
+ * second x coordinate
+ * @param y2
+ * second y coordinate
+ * @return the index of the anchor, which needs to be used
+ */
+ public static int getAppropriateAnchor(final int x1, final int y1,
+ final int x2, final int y2) {
+ final int xdiff = x2 - x1;
+ final int ydiff = y2 - y1;
+ if (Math.abs(ydiff) > Math.abs(xdiff)) {
+ if (ydiff < 0) {
+ return ANCHOR_BOTTOM;
+ } else {
+ return ANCHOR_TOP;
+ }
+ } else {
+ if (xdiff < 0) {
+ return ANCHOR_RIGHT;
+ } else {
+ return ANCHOR_LEFT;
+ }
+ }
+ }
+
+ /**
+ * Returns one anchor out of a list, which is closest to a specified (mouse)
+ * location.
+ *
+ * @param anchors
+ * list of available anchors
+ * @param mouseLocation
+ * the reference location
+ * @return the anchor closest to the location
+ */
+ public static Anchor getClosestAnchor(final List<Anchor> anchors,
+ final ILocation mouseLocation) {
+ final IPeService pe = Graphiti.getPeService();
+ int minDiff = Integer.MAX_VALUE;
+ Anchor minAnchor = null;
+ if (anchors != null && (!anchors.isEmpty())) {
+ int currDiff = 0;
+ for (final Anchor anchor : anchors) {
+ final ILocation anchorLocation = pe
+ .getLocationRelativeToDiagram(anchor);
+ currDiff = Math.abs(anchorLocation.getX()
+ - mouseLocation.getX())
+ + Math.abs(anchorLocation.getY() - mouseLocation.getY());
+ if (currDiff < minDiff) {
+ minDiff = currDiff;
+ minAnchor = anchor;
+ }
+ }
+ }
+ return minAnchor;
+ }
+
+ /**
+ * @param element
+ * @return an anchor for the given element<br>
+ * If the element itself is an anchor, it is returned. If the
+ * element is an instance of {@link AnchorContainer}, the first
+ * contained {@link ChopboxAnchor} is returned. If neither of these
+ * cases is present, null is returned.
+ */
+ public static Anchor getAnchorForPictogramElement(
+ final PictogramElement element) {
+ if (element instanceof Anchor) {
+ return (Anchor) element;
+ } else if (element instanceof AnchorContainer) {
+ final Collection<Anchor> existingAnchors = ((AnchorContainer) element)
+ .getAnchors();
+ for (final Iterator<Anchor> iter = existingAnchors.iterator(); iter
+ .hasNext();) {
+ final Anchor anchor = iter.next();
+ if (anchor instanceof ChopboxAnchor) {
+ return anchor;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Checks, whether a specific EClass equals another EClass or is a subtype
+ * of it.
+ *
+ * @param clazz
+ * the EClass to be checked
+ * @param clazz2
+ * the reference EClass
+ * @return true, if clazz is a subtype of clazz2 or a subtype of it, false
+ * otherwise
+ */
+ public static boolean isOfType(final EClass clazz, final EClass clazz2) {
+ return clazz.equals(clazz2)
+ || clazz.getEAllSuperTypes().contains(clazz2);
+ }
+
+ /**
+ * Recursively traverses all shapes contained in another shape and returns
+ * them as a list. The containing shape itself will not be returned.
+ *
+ * @param container
+ * the containing shape
+ * @return a list of all contained shapes
+ */
+ public static List<Shape> getAllChildren(final ContainerShape container) {
+ final List<Shape> ret = new ArrayList<Shape>();
+ for (final Shape sh : container.getChildren()) {
+ if (!ret.contains(sh)) {
+ ret.add(sh);
+ if (sh instanceof ContainerShape)
+ ret.addAll(getAllChildren((ContainerShape) sh));
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * @param fileName
+ * @return a URI for the given file which is relative to the current
+ * platform location
+ */
+ public static URI createRelativeURI(final String fileName) {
+ return URI.createFileURI(fileName.replaceAll("\\\\", "/").replace(
+ Platform.getLocation().toString(), ""));
+ }
+
+ /**
+ * @param map
+ * @return a map where keys and values of map are exchanged
+ * @throws IllegalArgumentException
+ * if the key-value-mapping of the given map is not bijective
+ */
+ public static <A, B> Map<B, A> conjugateMap(final Map<A, B> map)
+ throws IllegalArgumentException {
+ final Map<B, A> newMap = new HashMap<B, A>();
+ for (final Entry<A, B> entry : map.entrySet())
+ if (newMap.put(entry.getValue(), entry.getKey()) != null)
+ throw new IllegalArgumentException(String.format(
+ "The value \"%s\" is assigned to multiple keys.",
+ entry.getValue()));
+ return newMap;
+ }
+
+ public static String substringStereotype(String value) {
+ int index = value.indexOf(">>\n");
+ if (index > 0)
+ return value.substring(index + 3);
+ return value;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FontUtils.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FontUtils.java
new file mode 100644
index 0000000..0b0b29a
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/FontUtils.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.util;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for fonts. Not intended to be instantiated.
+ *
+ * @author Rainer Thome
+ *
+ */
+public class FontUtils {
+
+ private FontUtils(){}
+
+ /**
+ * Returns a list of all available fonts.
+ *
+ * @return string array of available font names
+ */
+ public static String[] getFontNames() {
+ Set<String> stringItems = new HashSet<String>();
+ FontData[] fontDatas = Display.getDefault().getFontList(null, true);
+ for (int i = 0; i < fontDatas.length; i++) {
+ if (fontDatas[i].getName() != null) {
+ stringItems.add(fontDatas[i].getName());
+ }
+ }
+
+ // add strings into the array
+ String strings[] = new String[stringItems.size()];
+ int i = 0;
+ for (String item : stringItems) {
+ strings[i++] = item;
+ }
+
+ // sort the array
+ Arrays.sort(strings);
+
+ return strings;
+ }
+
+ /**
+ * List of predefined font sizes.
+ */
+ public static String[] FONT_SIZES = new String[] { "8", "9", "10", "11",
+ "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48",
+ "72" };
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/StyleUtil.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/StyleUtil.java
new file mode 100644
index 0000000..3d935ea
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/StyleUtil.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.util;
+
+import java.util.Collection;
+
+import org.eclipse.fmc.blockdiagram.editor.BlockDiagramMessages;
+import org.eclipse.graphiti.mm.algorithms.styles.Style;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.ColorConstant;
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ *
+ * @author Rainer Thome
+ *
+ */
+public class StyleUtil {
+
+ private static final IColorConstant SHAPE_FOREGOUND = new ColorConstant(0,
+ 0, 0);
+ private static final IColorConstant SHAPE_BACKGROUND = new ColorConstant(
+ 255, 255, 255);
+ private static String DEFAULT_FONT = BlockDiagramMessages.FMCAddFeature_FontType;
+
+ public static final String SHAPE = "Shape";
+ public static final String CONNECTION = "Connection";
+
+ public static Style getStyle(Diagram d) {
+ return getStyle(d, SHAPE);
+ }
+
+ public static Style getStyle(Diagram d, String styleId) {
+ Style style = findStyle(d, styleId);
+
+ IGaService gaService = Graphiti.getGaService();
+ if (style == null) {
+ style = gaService.createStyle(d, styleId);
+ if (SHAPE.equals(styleId)) {
+ style.setLineWidth(3);
+ style.setForeground(gaService.manageColor(d, SHAPE_FOREGOUND));
+ style.setBackground(gaService.manageColor(d, SHAPE_BACKGROUND));
+ style.setFont(gaService.manageFont(d, DEFAULT_FONT, 10, false,
+ false));
+ } else if (CONNECTION.equals(styleId)) {
+ style.setFont(gaService.manageFont(d, DEFAULT_FONT, 8, false,
+ false));
+ }
+ }
+ return style;
+ }
+
+ public static Style findStyle(Diagram d, String styleId) {
+ Collection<Style> styles = d.getStyles();
+ if (styles != null) {
+ for (Style style : styles) {
+ if (styleId.equals(style.getId())) {
+ return style;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/package.html
new file mode 100644
index 0000000..93635d3
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/util/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>This is the util package containing various utility classes.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFilePage.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFilePage.java
new file mode 100644
index 0000000..8cf9cbf
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFilePage.java
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.wizards;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+/**
+ * This is the page showing up when the new Blockdiagram Wizard has been started.
+ * It allows for the selection of diagram width and height, the filename (only
+ * blockdiagram is allowed as file extension) and the container project/folder can
+ * be selected.
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class BlockDiagramFilePage extends WizardPage {
+
+ public static final String DIAGRAM_EXTENSION = "blockdiag";
+
+ /**
+ * The control for specifying the container project/folder.
+ */
+ private Text containerText;
+
+ /**
+ * The control for specifying the name of the Blockdiagram file.
+ */
+ private Text fileText;
+
+ /**
+ * The selected container, which is required in order to fill the
+ * containerText.
+ */
+ private ISelection selection;
+
+ private Spinner gridUnit;
+
+ /**
+ * The supported file extension
+ */
+ private String extension;
+
+ /**
+ * Getter for extension
+ *
+ * @return file extension
+ */
+ public String getExtension() {
+ return this.extension;
+ }
+
+ /**
+ * Constructor for BlockDiagramFilePage.
+ *
+ * @param selection
+ * The currently selected project container.
+ */
+ public BlockDiagramFilePage(ISelection selection) {
+ super("BlockdiagramWizardPage");
+ setTitle("New Blockdiagram File");
+ this.extension = DIAGRAM_EXTENSION;
+ this.subInit();
+ this.selection = selection;
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+ createContainerControl(container);
+ createFilenameControl(container);
+ createGridUnitControl(container);
+ // createDiagramSizeControl(container);
+ initialize();
+ dialogChanged();
+ setControl(container);
+ }
+
+ protected void createGridUnitControl(Composite container) {
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&GridUnit:");
+ gridUnit = new Spinner(container, SWT.BORDER);
+ gridUnit.setSelection(10);
+ }
+
+ /**
+ * Creates the filename input controls.
+ *
+ * @param container
+ * The parent composite container.
+ */
+ private void createFilenameControl(Composite container) {
+ Label label;
+ GridData gd;
+ label = new Label(container, SWT.NULL);
+ label.setText("&File name:");
+
+ fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ fileText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+ new Label(container, SWT.NULL);
+ }
+
+ /**
+ * Creates the container selection controls.
+ *
+ * @param container
+ * The parent composite container.
+ */
+ private void createContainerControl(Composite container) {
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Project:");
+
+ containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ containerText.setLayoutData(gd);
+ containerText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ Button button = new Button(container, SWT.PUSH);
+ button.setText("Browse...");
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse();
+ }
+ });
+ }
+
+ /**
+ * Tests if the current workbench selection is a suitable container to use.
+ */
+ private void initialize() {
+ if (selection != null && selection.isEmpty() == false
+ && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() > 1)
+ return;
+ Object obj = ssel.getFirstElement();
+ if (obj instanceof IResource) {
+ IContainer container;
+ if (obj instanceof IContainer)
+ container = (IContainer) obj;
+ else
+ container = ((IResource) obj).getParent();
+ containerText.setText(container.getFullPath().toString());
+ }
+ } else {
+ try {
+ IContainer container = FMCWizardUtils
+ .createProjectIfNecessary();
+ if (container != null)
+ containerText.setText(container.getFullPath().toString());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ }
+ fileText.setText("new_file." + extension);
+ }
+
+ /**
+ * Uses the standard container selection dialog to choose the new value for
+ * the container field.
+ */
+ private void handleBrowse() {
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(
+ getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+ "Select new file container");
+ if (dialog.open() == ContainerSelectionDialog.OK) {
+ Object[] result = dialog.getResult();
+ if (result.length == 1) {
+ containerText.setText(((Path) result[0]).toString());
+ }
+ }
+ }
+
+ /**
+ * Ensures that both text fields are set.
+ */
+ private void dialogChanged() {
+ IResource container = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(new Path(getContainerName()));
+ String fileName = getFileName();
+ if (getContainerName().length() == 0) {
+ updateStatus("File container must be specified");
+ return;
+ }
+ if (container == null
+ || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
+ updateStatus("File container must exist");
+ return;
+ }
+ if (!container.isAccessible()) {
+ updateStatus("Project must be writable");
+ return;
+ }
+ if (fileName.length() == 0) {
+ updateStatus("File name must be specified");
+ return;
+ }
+ if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
+ updateStatus("File name must be valid");
+ return;
+ }
+ int dotLoc = fileName.lastIndexOf('.');
+ if (dotLoc != -1) {
+ String ext = fileName.substring(dotLoc + 1);
+ if (ext.equalsIgnoreCase(extension) == false) {
+ updateStatus("File extension must be \"" + extension + "\"");
+ return;
+ }
+ }
+ IContainer cont = (IContainer) container;
+ IFile f = cont.getFile(new Path(fileName));
+ if (f.exists()) {
+ updateStatus("File already exists. Please choose another file name.");
+ return;
+ }
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ /**
+ *
+ * @return The name of the selected container project/folder for this new
+ * Blockdiagram file.
+ */
+ public String getContainerName() {
+ return containerText.getText();
+ }
+
+ /**
+ *
+ * @return The selected filename for this new Blockdiagram file including the file
+ * extension.
+ */
+ public String getFileName() {
+ String file = fileText.getText();
+ if (!file.endsWith(extension))
+ file += "." + extension;
+ return file;
+ }
+
+ public int getGridUnit() {
+ if (gridUnit == null)
+ return 5;
+ else
+ return gridUnit.getSelection();
+ }
+
+ private void subInit() {
+ setDescription("This wizard creates a new Blockdiagram Diagram file with *."
+ + extension
+ + " extension that can be opened by the Blockdiagram editor.");
+ if (fileText != null) {
+ String txt = fileText.getText();
+ if (txt != null) {
+ int dotPos = txt.lastIndexOf('.');
+ if (dotPos != -1) {
+ txt = txt.substring(0, dotPos + 1).concat(extension);
+ fileText.setText(txt);
+ } else {
+ fileText.setText(txt + "." + extension);
+ }
+ } else
+ fileText.setText("new_file." + extension);
+ }
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFileWizard.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFileWizard.java
new file mode 100644
index 0000000..acdc597
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/BlockDiagramFileWizard.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.fmc.blockdiagram.editor.util.DiagramFactory;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * This class is responsible for creating Blockdiagram files with a single graphical
+ * file.
+ *
+ * @author Benjamin Schmeling
+ * @author Rainer Thome
+ *
+ */
+public class BlockDiagramFileWizard extends Wizard implements INewWizard {
+
+ protected BlockDiagramFilePage page;
+ protected int diagramWidth;
+ protected int diagramHeight;
+ protected int gridUnit;
+ protected ISelection selection;
+
+ /**
+ * Constructor for BlockDiagramFileWizard.
+ */
+ public BlockDiagramFileWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Adding the page to the wizard.
+ */
+ public void addPages() {
+ page = new BlockDiagramFilePage(selection);
+ addPage(page);
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in the wizard. We
+ * will create an operation and run it using wizard as execution context.
+ */
+ public boolean performFinish() {
+ final String containerName = page.getContainerName();
+ final String fileName = page.getFileName();
+ this.gridUnit = page.getGridUnit();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+ try {
+ doFinish(containerName, fileName, monitor,
+ page.getExtension());
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(true, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error",
+ realException.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The worker method. It will find the container, create the file if missing
+ * or just replace its contents, and open the editor on the newly created
+ * file.
+ */
+ private void doFinish(String containerName, String fileName,
+ IProgressMonitor monitor, String extension) throws CoreException {
+ // create a sample file
+ monitor.beginTask("Creating " + fileName, 2);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = root.findMember(new Path(containerName));
+ if (!resource.exists() || !(resource instanceof IContainer)) {
+ throwCoreException("Project \"" + containerName
+ + "\" does not exist.");
+ }
+ IContainer container = (IContainer) resource;
+ final IFile file = container.getFile(new Path(fileName));
+ try {
+ InputStream stream = openContentStream();
+ if (!file.exists()) {
+
+ file.create(stream, true, monitor);
+ }
+ stream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ createBlockdiagramFile(file);
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file, true);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ protected void createBlockdiagramFile(final IFile file) {
+ DiagramFactory.createDefaultBlockdiagramFile(URI.createPlatformResourceURI(file
+ .getFullPath().toString(), true), diagramWidth, diagramHeight,
+ gridUnit);
+ }
+
+ /**
+ * We will initialize file contents with a sample text.
+ */
+ private InputStream openContentStream() {
+ return new ByteArrayInputStream(new byte[0]);
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, "BlockdiagramEditor", IStatus.OK,
+ message, null);
+ throw new CoreException(status);
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if we can initialize
+ * from it.
+ *
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/FMCWizardUtils.java b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/FMCWizardUtils.java
new file mode 100644
index 0000000..37088ce
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/FMCWizardUtils.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.blockdiagram.editor.wizards;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ *
+ * @author Benjamin Schmeling
+ *
+ */
+public class FMCWizardUtils {
+
+ public static IContainer createProjectIfNecessary() throws CoreException {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (root.getProjects().length == 0) {
+ IProgressMonitor progressMonitor = new NullProgressMonitor();
+ root.getProjects();
+ final String PROJECT_NAME = "FMCProject";
+ IProject project = root.getProject(PROJECT_NAME);
+ project.create(progressMonitor);
+ project.open(progressMonitor);
+ return project;
+ } else if (root.getProjects().length == 1) {
+ return root.getProjects()[0];
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/package.html b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/package.html
new file mode 100644
index 0000000..223c8c8
--- /dev/null
+++ b/org.eclipse.fmc.blockdiagram.editor/src/org/eclipse/fmc/blockdiagram/editor/wizards/package.html
@@ -0,0 +1,9 @@
+<html>
+<body>This package contains wizard related code. There are two
+ different types of wizards. One for the creation of pure graphical FMC
+ Block Diagrams and one for graphical ones with a separate model file.
+ Both Wizards are using the BlockDiagramFilePage class for rendering the
+ input data.
+</body>
+</html>
+
diff --git a/org.eclipse.fmc.feature/.project b/org.eclipse.fmc.feature/.project
new file mode 100644
index 0000000..c46dee7
--- /dev/null
+++ b/org.eclipse.fmc.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.feature/build.properties b/org.eclipse.fmc.feature/build.properties
new file mode 100644
index 0000000..67a260d
--- /dev/null
+++ b/org.eclipse.fmc.feature/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+bin.includes = feature.xml
diff --git a/org.eclipse.fmc.feature/feature.xml b/org.eclipse.fmc.feature/feature.xml
new file mode 100644
index 0000000..a8c14a5
--- /dev/null
+++ b/org.eclipse.fmc.feature/feature.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<feature
+ id="org.eclipse.fmc.feature"
+ label="FMC Feature"
+ version="0.11.0.qualifier"
+ license-feature="org.eclipse.license"
+ provider-name="Eclipse Modeling Project">
+
+ <description >
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2005, 2011 SAP AG.
+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
+ </copyright>
+
+ <plugin
+ id="org.eclipse.fmc.blockdiagram.editor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.fmc.blockdiagram.editor.meta"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.fmc.mm"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.fmc.mm.edit"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.fmc.mm.editor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.fmc.mm.edit/.classpath b/org.eclipse.fmc.mm.edit/.classpath
new file mode 100644
index 0000000..3bc2475
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.mm.edit/.gitignore b/org.eclipse.fmc.mm.edit/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.mm.edit/.project b/org.eclipse.fmc.mm.edit/.project
new file mode 100644
index 0000000..9e21f1b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.mm.edit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.mm.edit/META-INF/MANIFEST.MF b/org.eclipse.fmc.mm.edit/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2871c7c
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.fmc.mm.edit;singleton:=true
+Bundle-Version: 0.11.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.fmc.mm.provider.FMCEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.fmc.mm.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.fmc.mm;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.fmc.mm.edit/about.html b/org.eclipse.fmc.mm.edit/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.mm.edit/build.properties b/org.eclipse.fmc.mm.edit/build.properties
new file mode 100644
index 0000000..c892b4b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_nodeMetadata_Metadata.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_nodeMetadata_Metadata.gif
new file mode 100644
index 0000000..b2b92ad
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_nodeMetadata_Metadata.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_stereotypes_Stereotype.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_stereotypes_Stereotype.gif
new file mode 100644
index 0000000..4d15317
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCElement_stereotypes_Stereotype.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_comments_Comment.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_comments_Comment.gif
new file mode 100644
index 0000000..56549ea
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_comments_Comment.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Access.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Access.gif
new file mode 100644
index 0000000..4b3ff2b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Access.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Channel.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Channel.gif
new file mode 100644
index 0000000..d43253a
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_connections_Channel.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Agent.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Agent.gif
new file mode 100644
index 0000000..ed255ad
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Agent.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Storage.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Storage.gif
new file mode 100644
index 0000000..4a47bf1
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_Storage.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_StructureVariance.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_StructureVariance.gif
new file mode 100644
index 0000000..236f18e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCModel_nodes_StructureVariance.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Agent.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Agent.gif
new file mode 100644
index 0000000..ed255ad
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Agent.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Storage.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Storage.gif
new file mode 100644
index 0000000..4a47bf1
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_Storage.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_StructureVariance.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_StructureVariance.gif
new file mode 100644
index 0000000..236f18e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateFMCNode_contains_StructureVariance.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateTAMModel_connections_Channel.gif b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateTAMModel_connections_Channel.gif
new file mode 100644
index 0000000..d43253a
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/ctool16/CreateTAMModel_connections_Channel.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Access.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Access.gif
new file mode 100644
index 0000000..4b3ff2b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Access.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Agent.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Agent.gif
new file mode 100644
index 0000000..ed255ad
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Agent.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Channel.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Channel.gif
new file mode 100644
index 0000000..d43253a
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Channel.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Comment.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Comment.gif
new file mode 100644
index 0000000..498364f
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Comment.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/FMCModel.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/FMCModel.gif
new file mode 100644
index 0000000..2124f3e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/FMCModel.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Metadata.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Metadata.gif
new file mode 100644
index 0000000..53500da
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Metadata.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Stereotype.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Stereotype.gif
new file mode 100644
index 0000000..94c953e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Stereotype.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/StereotypeValue.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/StereotypeValue.gif
new file mode 100644
index 0000000..c673a52
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/StereotypeValue.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/Storage.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/Storage.gif
new file mode 100644
index 0000000..4a47bf1
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/Storage.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/icons/full/obj16/StructureVariance.gif b/org.eclipse.fmc.mm.edit/icons/full/obj16/StructureVariance.gif
new file mode 100644
index 0000000..236f18e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/icons/full/obj16/StructureVariance.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.edit/plugin.properties b/org.eclipse.fmc.mm.edit/plugin.properties
new file mode 100644
index 0000000..f70213b
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/plugin.properties
@@ -0,0 +1,109 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+pluginName = FMC Edit Support
+providerName = Eclipse Modeling Project
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_Agent_type = Agent
+_UI_Channel_type = Channel
+_UI_Storage_type = Storage
+_UI_FMCNode_type = FMC Node
+_UI_FMCConnection_type = FMC Connection
+_UI_Access_type = Access
+_UI_FMCModel_type = FMC Model
+_UI_StructureVariance_type = Structure Variance
+_UI_Metadata_type = Metadata
+_UI_AccessTarget_type = Access Target
+_UI_Comment_type = Comment
+_UI_FMCElement_type = FMC Element
+_UI_Stereotype_type = Stereotype
+_UI_StereotypeValue_type = Stereotype Value
+_UI_IFMCElementVisitor_type = IFMC Element Visitor
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_Agent_accessConnections_feature = Access Connections
+_UI_Agent_human_feature = Human
+_UI_Agent_sourceChannels_feature = Source Channels
+_UI_Agent_targetChannels_feature = Target Channels
+_UI_Channel_channelType_feature = Channel Type
+_UI_Channel_source_feature = Source
+_UI_Channel_target_feature = Target
+_UI_Channel_dataflowDirection_feature = Dataflow Direction
+_UI_Channel_name_feature = Name
+_UI_FMCNode_name_feature = Name
+_UI_FMCNode_contains_feature = Contains
+_UI_FMCNode_container_feature = Container
+_UI_FMCNode_multiplicity_feature = Multiplicity
+_UI_FMCNode_nextElement_feature = Next Element
+_UI_Access_agent_feature = Agent
+_UI_Access_type_feature = Type
+_UI_Access_target_feature = Target
+_UI_FMCModel_name_feature = Name
+_UI_FMCModel_nodes_feature = Nodes
+_UI_FMCModel_connections_feature = Connections
+_UI_FMCModel_comments_feature = Comments
+_UI_FMCModel_profileId_feature = Profile Id
+_UI_Metadata_creator_feature = Creator
+_UI_Metadata_changer_feature = Changer
+_UI_Metadata_creationdate_feature = Creationdate
+_UI_Metadata_lastchange_feature = Lastchange
+_UI_Metadata_version_feature = Version
+_UI_Metadata_language_feature = Language
+_UI_AccessTarget_connections_feature = Connections
+_UI_Comment_content_feature = Content
+_UI_Comment_commentAssignment_feature = Comment Assignment
+_UI_Comment_type_feature = Type
+_UI_FMCElement_nodeMetadata_feature = Node Metadata
+_UI_FMCElement_stereotypes_feature = Stereotypes
+_UI_Stereotype_id_feature = Id
+_UI_Stereotype_values_feature = Values
+_UI_StereotypeValue_id_feature = Id
+_UI_StereotypeValue_valueString_feature = Value String
+_UI_StereotypeValue_valueBoolean_feature = Value Boolean
+_UI_StereotypeValue_valueInteger_feature = Value Integer
+_UI_Unknown_feature = Unspecified
+
+_UI_AccessType_UNSPECIFIED_literal = UNSPECIFIED
+_UI_AccessType_READ_literal = READ
+_UI_AccessType_WRITE_literal = WRITE
+_UI_AccessType_RW_literal = RW
+_UI_RequestDirection_UNSPECIFIED_literal = UNSPECIFIED
+_UI_RequestDirection_REQUEST_literal = REQUEST
+_UI_RequestDirection_RESPONSE_literal = RESPONSE
+_UI_RequestDirection_REQUESTRESPONSE_literal = REQUESTRESPONSE
+_UI_MultiplicityType_ONE_literal = ONE
+_UI_MultiplicityType_MANY_literal = MANY
+_UI_DataflowDirection_UNSPECIFIED_literal = UNSPECIFIED
+_UI_DataflowDirection_DEFAULT_literal = DEFAULT
+_UI_DataflowDirection_OTHER_literal = OTHER
+_UI_CommentType_TEXT_literal = TEXT
+_UI_CommentType_IMAGE_literal = IMAGE
+_UI_CommentType_OTHER_literal = OTHER
+_UI_CommentType_BRACE_literal = BRACE
+_UI_CommentType_AREABORDER_literal = AREABORDER
+_UI_CommentType_COMMONFEATUREAREA_literal = COMMONFEATUREAREA
+_UI_CommentType_DOTS_literal = DOTS
diff --git a/org.eclipse.fmc.mm.edit/plugin.xml b/org.eclipse.fmc.mm.edit/plugin.xml
new file mode 100644
index 0000000..47ac9fe
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/plugin.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <!-- @generated Blockdiagram -->
+ <factory
+ uri="http://fmc.eclipse.org/0.10.0"
+ class="org.eclipse.fmc.mm.provider.FmcItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AccessItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AccessItemProvider.java
new file mode 100644
index 0000000..e1171db
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AccessItemProvider.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Access} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AccessItemProvider
+ extends FMCConnectionItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addAgentPropertyDescriptor(object);
+ addTypePropertyDescriptor(object);
+ addTargetPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Agent feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addAgentPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Access_agent_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Access_agent_feature", "_UI_Access_type"),
+ FmcPackage.Literals.ACCESS__AGENT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Type feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Access_type_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Access_type_feature", "_UI_Access_type"),
+ FmcPackage.Literals.ACCESS__TYPE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTargetPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Access_target_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Access_target_feature", "_UI_Access_type"),
+ FmcPackage.Literals.ACCESS__TARGET,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Access.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Access"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ AccessType labelValue = ((Access)object).getType();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Access_type") :
+ getString("_UI_Access_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Access.class)) {
+ case FmcPackage.ACCESS__TYPE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AgentItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AgentItemProvider.java
new file mode 100644
index 0000000..823a73d
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/AgentItemProvider.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Agent} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AgentItemProvider
+ extends FMCNodeItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AgentItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addAccessConnectionsPropertyDescriptor(object);
+ addHumanPropertyDescriptor(object);
+ addSourceChannelsPropertyDescriptor(object);
+ addTargetChannelsPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Access Connections feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addAccessConnectionsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Agent_accessConnections_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Agent_accessConnections_feature", "_UI_Agent_type"),
+ FmcPackage.Literals.AGENT__ACCESS_CONNECTIONS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Human feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addHumanPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Agent_human_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Agent_human_feature", "_UI_Agent_type"),
+ FmcPackage.Literals.AGENT__HUMAN,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Source Channels feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSourceChannelsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Agent_sourceChannels_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Agent_sourceChannels_feature", "_UI_Agent_type"),
+ FmcPackage.Literals.AGENT__SOURCE_CHANNELS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target Channels feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTargetChannelsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Agent_targetChannels_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Agent_targetChannels_feature", "_UI_Agent_type"),
+ FmcPackage.Literals.AGENT__TARGET_CHANNELS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Agent.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Agent"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Agent)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Agent_type") :
+ getString("_UI_Agent_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Agent.class)) {
+ case FmcPackage.AGENT__HUMAN:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/ChannelItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/ChannelItemProvider.java
new file mode 100644
index 0000000..e8e6090
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/ChannelItemProvider.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Channel} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ChannelItemProvider
+ extends FMCConnectionItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ChannelItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addChannelTypePropertyDescriptor(object);
+ addSourcePropertyDescriptor(object);
+ addTargetPropertyDescriptor(object);
+ addDataflowDirectionPropertyDescriptor(object);
+ addNamePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Channel Type feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addChannelTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Channel_channelType_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Channel_channelType_feature", "_UI_Channel_type"),
+ FmcPackage.Literals.CHANNEL__CHANNEL_TYPE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Source feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSourcePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Channel_source_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Channel_source_feature", "_UI_Channel_type"),
+ FmcPackage.Literals.CHANNEL__SOURCE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTargetPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Channel_target_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Channel_target_feature", "_UI_Channel_type"),
+ FmcPackage.Literals.CHANNEL__TARGET,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Dataflow Direction feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDataflowDirectionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Channel_dataflowDirection_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Channel_dataflowDirection_feature", "_UI_Channel_type"),
+ FmcPackage.Literals.CHANNEL__DATAFLOW_DIRECTION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Channel_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Channel_name_feature", "_UI_Channel_type"),
+ FmcPackage.Literals.CHANNEL__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Channel.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Channel"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Channel)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Channel_type") :
+ getString("_UI_Channel_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Channel.class)) {
+ case FmcPackage.CHANNEL__CHANNEL_TYPE:
+ case FmcPackage.CHANNEL__DATAFLOW_DIRECTION:
+ case FmcPackage.CHANNEL__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/CommentItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/CommentItemProvider.java
new file mode 100644
index 0000000..d782751
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/CommentItemProvider.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Comment} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CommentItemProvider
+ extends FMCElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CommentItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addContentPropertyDescriptor(object);
+ addCommentAssignmentPropertyDescriptor(object);
+ addTypePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Content feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addContentPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Comment_content_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Comment_content_feature", "_UI_Comment_type"),
+ FmcPackage.Literals.COMMENT__CONTENT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Comment Assignment feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCommentAssignmentPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Comment_commentAssignment_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Comment_commentAssignment_feature", "_UI_Comment_type"),
+ FmcPackage.Literals.COMMENT__COMMENT_ASSIGNMENT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Type feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Comment_type_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Comment_type_feature", "_UI_Comment_type"),
+ FmcPackage.Literals.COMMENT__TYPE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Comment.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Comment"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Comment)object).getContent();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Comment_type") :
+ getString("_UI_Comment_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Comment.class)) {
+ case FmcPackage.COMMENT__CONTENT:
+ case FmcPackage.COMMENT__TYPE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCConnectionItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCConnectionItemProvider.java
new file mode 100644
index 0000000..8879860
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCConnectionItemProvider.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.FMCConnection} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FMCConnectionItemProvider
+ extends FMCElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCConnectionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_FMCConnection_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCEditPlugin.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCEditPlugin.java
new file mode 100644
index 0000000..537da47
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCEditPlugin.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+/**
+ * This is the central singleton for the FMC edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class FMCEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final FMCEditPlugin INSTANCE = new FMCEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCElementItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCElementItemProvider.java
new file mode 100644
index 0000000..c390db9
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCElementItemProvider.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.FMCElement} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FMCElementItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCElementItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(FmcPackage.Literals.FMC_ELEMENT__NODE_METADATA);
+ childrenFeatures.add(FmcPackage.Literals.FMC_ELEMENT__STEREOTYPES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_FMCElement_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(FMCElement.class)) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_ELEMENT__NODE_METADATA,
+ FmcFactory.eINSTANCE.createMetadata()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_ELEMENT__STEREOTYPES,
+ FmcFactory.eINSTANCE.createStereotype()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FMCEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCModelItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCModelItemProvider.java
new file mode 100644
index 0000000..7488d84
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCModelItemProvider.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.FMCModel} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FMCModelItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCModelItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addNamePropertyDescriptor(object);
+ addProfileIdPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FMCModel_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FMCModel_name_feature", "_UI_FMCModel_type"),
+ FmcPackage.Literals.FMC_MODEL__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Profile Id feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addProfileIdPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FMCModel_profileId_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FMCModel_profileId_feature", "_UI_FMCModel_type"),
+ FmcPackage.Literals.FMC_MODEL__PROFILE_ID,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(FmcPackage.Literals.FMC_MODEL__NODES);
+ childrenFeatures.add(FmcPackage.Literals.FMC_MODEL__CONNECTIONS);
+ childrenFeatures.add(FmcPackage.Literals.FMC_MODEL__COMMENTS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns FMCModel.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FMCModel"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FMCModel)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FMCModel_type") :
+ getString("_UI_FMCModel_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(FMCModel.class)) {
+ case FmcPackage.FMC_MODEL__NAME:
+ case FmcPackage.FMC_MODEL__PROFILE_ID:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case FmcPackage.FMC_MODEL__NODES:
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__NODES,
+ FmcFactory.eINSTANCE.createAgent()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__NODES,
+ FmcFactory.eINSTANCE.createStorage()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__NODES,
+ FmcFactory.eINSTANCE.createStructureVariance()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__CONNECTIONS,
+ FmcFactory.eINSTANCE.createChannel()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__CONNECTIONS,
+ FmcFactory.eINSTANCE.createAccess()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_MODEL__COMMENTS,
+ FmcFactory.eINSTANCE.createComment()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FMCEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCNodeItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCNodeItemProvider.java
new file mode 100644
index 0000000..c2a6022
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FMCNodeItemProvider.java
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.FMCNode} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FMCNodeItemProvider
+ extends FMCElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCNodeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addNamePropertyDescriptor(object);
+ addMultiplicityPropertyDescriptor(object);
+ addNextElementPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FMCNode_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FMCNode_name_feature", "_UI_FMCNode_type"),
+ FmcPackage.Literals.FMC_NODE__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Multiplicity feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addMultiplicityPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FMCNode_multiplicity_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FMCNode_multiplicity_feature", "_UI_FMCNode_type"),
+ FmcPackage.Literals.FMC_NODE__MULTIPLICITY,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Next Element feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNextElementPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FMCNode_nextElement_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FMCNode_nextElement_feature", "_UI_FMCNode_type"),
+ FmcPackage.Literals.FMC_NODE__NEXT_ELEMENT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(FmcPackage.Literals.FMC_NODE__CONTAINS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FMCNode)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FMCNode_type") :
+ getString("_UI_FMCNode_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(FMCNode.class)) {
+ case FmcPackage.FMC_NODE__NAME:
+ case FmcPackage.FMC_NODE__MULTIPLICITY:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case FmcPackage.FMC_NODE__CONTAINS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_NODE__CONTAINS,
+ FmcFactory.eINSTANCE.createAgent()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_NODE__CONTAINS,
+ FmcFactory.eINSTANCE.createStorage()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.FMC_NODE__CONTAINS,
+ FmcFactory.eINSTANCE.createStructureVariance()));
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FmcItemProviderAdapterFactory.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FmcItemProviderAdapterFactory.java
new file mode 100644
index 0000000..1ff7864
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/FmcItemProviderAdapterFactory.java
@@ -0,0 +1,428 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.fmc.mm.util.FmcAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcItemProviderAdapterFactory extends FmcAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Agent} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AgentItemProvider agentItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Agent}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createAgentAdapter() {
+ if (agentItemProvider == null) {
+ agentItemProvider = new AgentItemProvider(this);
+ }
+
+ return agentItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Channel} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ChannelItemProvider channelItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Channel}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createChannelAdapter() {
+ if (channelItemProvider == null) {
+ channelItemProvider = new ChannelItemProvider(this);
+ }
+
+ return channelItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Storage} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StorageItemProvider storageItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Storage}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStorageAdapter() {
+ if (storageItemProvider == null) {
+ storageItemProvider = new StorageItemProvider(this);
+ }
+
+ return storageItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Access} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AccessItemProvider accessItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Access}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createAccessAdapter() {
+ if (accessItemProvider == null) {
+ accessItemProvider = new AccessItemProvider(this);
+ }
+
+ return accessItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.FMCModel} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FMCModelItemProvider fmcModelItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.FMCModel}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFMCModelAdapter() {
+ if (fmcModelItemProvider == null) {
+ fmcModelItemProvider = new FMCModelItemProvider(this);
+ }
+
+ return fmcModelItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.StructureVariance} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StructureVarianceItemProvider structureVarianceItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.StructureVariance}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStructureVarianceAdapter() {
+ if (structureVarianceItemProvider == null) {
+ structureVarianceItemProvider = new StructureVarianceItemProvider(this);
+ }
+
+ return structureVarianceItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Metadata} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MetadataItemProvider metadataItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Metadata}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createMetadataAdapter() {
+ if (metadataItemProvider == null) {
+ metadataItemProvider = new MetadataItemProvider(this);
+ }
+
+ return metadataItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Comment} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CommentItemProvider commentItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Comment}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createCommentAdapter() {
+ if (commentItemProvider == null) {
+ commentItemProvider = new CommentItemProvider(this);
+ }
+
+ return commentItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.Stereotype} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StereotypeItemProvider stereotypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.Stereotype}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStereotypeAdapter() {
+ if (stereotypeItemProvider == null) {
+ stereotypeItemProvider = new StereotypeItemProvider(this);
+ }
+
+ return stereotypeItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.fmc.mm.StereotypeValue} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StereotypeValueItemProvider stereotypeValueItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.fmc.mm.StereotypeValue}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStereotypeValueAdapter() {
+ if (stereotypeValueItemProvider == null) {
+ stereotypeValueItemProvider = new StereotypeValueItemProvider(this);
+ }
+
+ return stereotypeValueItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (agentItemProvider != null) agentItemProvider.dispose();
+ if (channelItemProvider != null) channelItemProvider.dispose();
+ if (storageItemProvider != null) storageItemProvider.dispose();
+ if (accessItemProvider != null) accessItemProvider.dispose();
+ if (fmcModelItemProvider != null) fmcModelItemProvider.dispose();
+ if (structureVarianceItemProvider != null) structureVarianceItemProvider.dispose();
+ if (metadataItemProvider != null) metadataItemProvider.dispose();
+ if (commentItemProvider != null) commentItemProvider.dispose();
+ if (stereotypeItemProvider != null) stereotypeItemProvider.dispose();
+ if (stereotypeValueItemProvider != null) stereotypeValueItemProvider.dispose();
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/MetadataItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/MetadataItemProvider.java
new file mode 100644
index 0000000..65e77ae
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/MetadataItemProvider.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.Metadata;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Metadata} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class MetadataItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MetadataItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addCreatorPropertyDescriptor(object);
+ addChangerPropertyDescriptor(object);
+ addCreationdatePropertyDescriptor(object);
+ addLastchangePropertyDescriptor(object);
+ addVersionPropertyDescriptor(object);
+ addLanguagePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Creator feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCreatorPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_creator_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_creator_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__CREATOR,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Changer feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addChangerPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_changer_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_changer_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__CHANGER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Creationdate feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCreationdatePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_creationdate_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_creationdate_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__CREATIONDATE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Lastchange feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLastchangePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_lastchange_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_lastchange_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__LASTCHANGE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Version feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addVersionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_version_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_version_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__VERSION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Language feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLanguagePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Metadata_language_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Metadata_language_feature", "_UI_Metadata_type"),
+ FmcPackage.Literals.METADATA__LANGUAGE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Metadata.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Metadata"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Metadata)object).getCreator();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Metadata_type") :
+ getString("_UI_Metadata_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Metadata.class)) {
+ case FmcPackage.METADATA__CREATOR:
+ case FmcPackage.METADATA__CHANGER:
+ case FmcPackage.METADATA__CREATIONDATE:
+ case FmcPackage.METADATA__LASTCHANGE:
+ case FmcPackage.METADATA__VERSION:
+ case FmcPackage.METADATA__LANGUAGE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FMCEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeItemProvider.java
new file mode 100644
index 0000000..1a63302
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeItemProvider.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.Stereotype;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Stereotype} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StereotypeItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StereotypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addIdPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Id feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addIdPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Stereotype_id_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Stereotype_id_feature", "_UI_Stereotype_type"),
+ FmcPackage.Literals.STEREOTYPE__ID,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(FmcPackage.Literals.STEREOTYPE__VALUES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns Stereotype.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Stereotype"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Stereotype)object).getId();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Stereotype_type") :
+ getString("_UI_Stereotype_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Stereotype.class)) {
+ case FmcPackage.STEREOTYPE__ID:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case FmcPackage.STEREOTYPE__VALUES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (FmcPackage.Literals.STEREOTYPE__VALUES,
+ FmcFactory.eINSTANCE.createStereotypeValue()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FMCEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeValueItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeValueItemProvider.java
new file mode 100644
index 0000000..813c108
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StereotypeValueItemProvider.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.StereotypeValue;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.StereotypeValue} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StereotypeValueItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StereotypeValueItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addIdPropertyDescriptor(object);
+ addValueStringPropertyDescriptor(object);
+ addValueBooleanPropertyDescriptor(object);
+ addValueIntegerPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Id feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addIdPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_StereotypeValue_id_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_StereotypeValue_id_feature", "_UI_StereotypeValue_type"),
+ FmcPackage.Literals.STEREOTYPE_VALUE__ID,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value String feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueStringPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_StereotypeValue_valueString_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_StereotypeValue_valueString_feature", "_UI_StereotypeValue_type"),
+ FmcPackage.Literals.STEREOTYPE_VALUE__VALUE_STRING,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value Boolean feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueBooleanPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_StereotypeValue_valueBoolean_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_StereotypeValue_valueBoolean_feature", "_UI_StereotypeValue_type"),
+ FmcPackage.Literals.STEREOTYPE_VALUE__VALUE_BOOLEAN,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value Integer feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueIntegerPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_StereotypeValue_valueInteger_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_StereotypeValue_valueInteger_feature", "_UI_StereotypeValue_type"),
+ FmcPackage.Literals.STEREOTYPE_VALUE__VALUE_INTEGER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns StereotypeValue.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/StereotypeValue"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((StereotypeValue)object).getId();
+ return label == null || label.length() == 0 ?
+ getString("_UI_StereotypeValue_type") :
+ getString("_UI_StereotypeValue_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(StereotypeValue.class)) {
+ case FmcPackage.STEREOTYPE_VALUE__ID:
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_STRING:
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN:
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FMCEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StorageItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StorageItemProvider.java
new file mode 100644
index 0000000..04cb277
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StorageItemProvider.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.Storage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.Storage} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StorageItemProvider
+ extends FMCNodeItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StorageItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns Agent.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Storage"));
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addConnectionsPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Connections feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addConnectionsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AccessTarget_connections_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AccessTarget_connections_feature", "_UI_AccessTarget_type"),
+ FmcPackage.Literals.ACCESS_TARGET__CONNECTIONS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Storage)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Storage_type") :
+ getString("_UI_Storage_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StructureVarianceItemProvider.java b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StructureVarianceItemProvider.java
new file mode 100644
index 0000000..bebf31e
--- /dev/null
+++ b/org.eclipse.fmc.mm.edit/src/org/eclipse/fmc/mm/provider/StructureVarianceItemProvider.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.StructureVariance;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.fmc.mm.StructureVariance} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StructureVarianceItemProvider
+ extends FMCNodeItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StructureVarianceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addConnectionsPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Connections feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addConnectionsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AccessTarget_connections_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AccessTarget_connections_feature", "_UI_AccessTarget_type"),
+ FmcPackage.Literals.ACCESS_TARGET__CONNECTIONS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns StructureVariance.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/StructureVariance"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((StructureVariance)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_StructureVariance_type") :
+ getString("_UI_StructureVariance_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.editor/.classpath b/org.eclipse.fmc.mm.editor/.classpath
new file mode 100644
index 0000000..3bc2475
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.mm.editor/.gitignore b/org.eclipse.fmc.mm.editor/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.mm.editor/.project b/org.eclipse.fmc.mm.editor/.project
new file mode 100644
index 0000000..b7685fc
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.mm.editor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.mm.editor/META-INF/MANIFEST.MF b/org.eclipse.fmc.mm.editor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5735026
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.fmc.mm.editor;singleton:=true
+Bundle-Version: 0.11.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.fmc.mm.presentation.FMCEditorPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.fmc.mm.presentation
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.fmc.mm.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.emf.edit.ui;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources
diff --git a/org.eclipse.fmc.mm.editor/about.html b/org.eclipse.fmc.mm.editor/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.mm.editor/build.properties b/org.eclipse.fmc.mm.editor/build.properties
new file mode 100644
index 0000000..b76ce85
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin
+src.includes = about.html
diff --git a/org.eclipse.fmc.mm.editor/icons/full/obj16/FmcModelFile.gif b/org.eclipse.fmc.mm.editor/icons/full/obj16/FmcModelFile.gif
new file mode 100644
index 0000000..388b937
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/icons/full/obj16/FmcModelFile.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.editor/icons/full/wizban/NewFmc.gif b/org.eclipse.fmc.mm.editor/icons/full/wizban/NewFmc.gif
new file mode 100644
index 0000000..3dd4aa0
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/icons/full/wizban/NewFmc.gif
Binary files differ
diff --git a/org.eclipse.fmc.mm.editor/plugin.properties b/org.eclipse.fmc.mm.editor/plugin.properties
new file mode 100644
index 0000000..1e842d0
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/plugin.properties
@@ -0,0 +1,93 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+pluginName = FMC Editor
+providerName = Eclipse Modeling Project
+
+_UI_FmcEditor_menu = &Fmc Editor
+
+_UI_CreateChild_menu_item = &New Child
+_UI_CreateSibling_menu_item = N&ew Sibling
+
+_UI_ShowPropertiesView_menu_item = Show &Properties View
+_UI_RefreshViewer_menu_item = &Refresh
+
+_UI_SelectionPage_label = Selection
+_UI_ParentPage_label = Parent
+_UI_ListPage_label = List
+_UI_TreePage_label = Tree
+_UI_TablePage_label = Table
+_UI_TreeWithColumnsPage_label = Tree with Columns
+_UI_ObjectColumn_label = Object
+_UI_SelfColumn_label = Self
+
+_UI_NoObjectSelected = Selected Nothing
+_UI_SingleObjectSelected = Selected Object: {0}
+_UI_MultiObjectSelected = Selected {0} Objects
+
+_UI_OpenEditorError_label = Open Editor
+
+_UI_Wizard_category = Example EMF Model Creation Wizards
+
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
+_UI_FmcModelWizard_label = Fmc Model
+_UI_FmcModelWizard_description = Create a new Fmc model
+
+_UI_FmcEditor_label = Fmc Model Editor
+
+_UI_FmcEditorFilenameDefaultBase = My
+_UI_FmcEditorFilenameExtensions = block
+
+_UI_Wizard_label = New
+
+_WARN_FilenameExtension = The file name must end in ''.{0}''
+_WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
+
+_UI_ModelObject = &Model Object
+_UI_XMLEncoding = &XML Encoding
+_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description = Specify a file name and select a model object to create
+
+_UI_FileConflict_label = File Conflict
+_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?
+
+_UI_FMCEditorAdvisor_ActionSet_label = FMC Action Set
+_UI_Perspective_label = FMC
+
+_UI_Browse_label = &Browse...
+_UI_File_label = &File
+_UI_Question_title = Question
+_WARN_FileConflict = The file "{0}" already exists. Do you want to replace the existing file?
+_UI_Error_title = Error
+_WARN_No_Editor = There is no editor registered for the file "{0}".
+
+_UI_Application_title = FMC Application
+_UI_Menu_File_label = &File
+_UI_Menu_New_label = &New
+_UI_Menu_Open_label = &Open...
+_UI_Menu_Open_description = Opens a model object file
+_UI_Menu_OpenURI_label = &Open URI...
+_UI_Menu_OpenURI_description = Opens a model object loading it from a URI
+_UI_Menu_Edit_label = &Edit
+_UI_Menu_Window_label = &Window
+_UI_Menu_Help_label = &Help
+_UI_Menu_About_label = FMC &About...
+_UI_About_title = FMC Application
+_UI_About_text = FMC Application about box goes here.
+
+_UI_FmcModelWizard_ActionSet_label = Fmc Model Action Set
+
diff --git a/org.eclipse.fmc.mm.editor/plugin.xml b/org.eclipse.fmc.mm.editor/plugin.xml
new file mode 100644
index 0000000..b104234
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/plugin.xml
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.core.runtime.applications"
+ id="FMCEditorAdvisorApplication">
+ <!-- @generated Blockdiagram -->
+ <application>
+ <run class="org.eclipse.fmc.mm.presentation.FMCEditorAdvisor$Application"/>
+ </application>
+ </extension>
+
+ <extension point="org.eclipse.ui.perspectives">
+ <!-- @generated Blockdiagram -->
+ <perspective
+ name="%_UI_Perspective_label"
+ class="org.eclipse.fmc.mm.presentation.FMCEditorAdvisor$Perspective"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorPerspective">
+ </perspective>
+ </extension>
+
+ <extension point="org.eclipse.ui.commands">
+ <!-- @generated Blockdiagram -->
+ <command
+ name="%_UI_Menu_OpenURI_label"
+ description="%_UI_Menu_OpenURI_description"
+ categoryId="org.eclipse.ui.category.file"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenURICommand"/>
+ <command
+ name="%_UI_Menu_Open_label"
+ description="%_UI_Menu_Open_description"
+ categoryId="org.eclipse.ui.category.file"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenCommand"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <!-- @generated Blockdiagram -->
+ <key
+ commandId="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenURICommand"
+ sequence="M1+U"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ commandId="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenCommand"
+ sequence="M1+O"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.actionSets">
+ <!-- @generated Blockdiagram -->
+ <actionSet
+ label="%_UI_FMCEditorAdvisor_ActionSet_label"
+ visible="true"
+ id="FMCEditorAdvisorActionSet">
+ <action
+ label="%_UI_Menu_About_label"
+ class="org.eclipse.fmc.mm.presentation.FMCEditorAdvisor$AboutAction"
+ menubarPath="help/additions"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorAboutAction"/>
+ <action
+ label="%_UI_Menu_OpenURI_label"
+ definitionId="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenURICommand"
+ class="org.eclipse.fmc.mm.presentation.FMCEditorAdvisor$OpenURIAction"
+ menubarPath="file/additions"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenURIAction"/>
+ <action
+ label="%_UI_Menu_Open_label"
+ definitionId="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenCommand"
+ class="org.eclipse.fmc.mm.presentation.FMCEditorAdvisor$OpenAction"
+ menubarPath="file/additions"
+ id="org.eclipse.fmc.mm.presentation.FMCEditorAdvisorOpenAction"/>
+ </actionSet>
+ </extension>
+
+ <extension point="org.eclipse.ui.actionSets">
+ <!-- @generated Blockdiagram -->
+ <actionSet
+ label="%_UI_FmcModelWizard_ActionSet_label"
+ visible="true"
+ id="org.eclipse.fmc.mm.presentation.FmcActionBarContributorActionSet">
+ <action
+ label="%_UI_FmcModelWizard_label"
+ class="org.eclipse.fmc.mm.presentation.FmcActionBarContributor$NewAction"
+ menubarPath="file/new/additions"
+ id="org.eclipse.fmc.mm.presentation.FmcActionBarContributorNewAction"/>
+ </actionSet>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <!-- @generated Blockdiagram -->
+ <editor
+ id="org.eclipse.fmc.mm.presentation.FmcEditorID"
+ name="%_UI_FmcEditor_label"
+ icon="icons/full/obj16/FmcModelFile.gif"
+ extensions="block"
+ class="org.eclipse.fmc.mm.presentation.FmcEditor"
+ contributorClass="org.eclipse.fmc.mm.presentation.FmcActionBarContributor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.fmc.blockdiagram.category"
+ class="org.eclipse.fmc.mm.presentation.FmcModelWizard"
+ icon="icons/full/obj16/FmcModelFile.gif"
+ id="org.eclipse.fmc.mm.FmcModelWizard"
+ name="FMC Block Model">
+ <description>
+ This wizard creates a FMC Block Model.
+ </description>
+ </wizard>
+ <category
+ id="org.eclipse.fmc.blockdiagram.category"
+ name="FMC">
+ </category>
+ </extension>
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension
+ isRoot="false"
+ pattern="org.eclipse.fmc.mm.modelContent"/>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.fmc.mm.navigator.ProjectAdapterFactoryContentProvider"
+ id="org.eclipse.fmc.mm.modelContent"
+ labelProvider="org.eclipse.fmc.mm.navigator.ProjectAdapterFactoryLabelProvider"
+ name="Model content"
+ priority="normal">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IResource"/>
+ <test forcePluginActivation="true"
+ property="org.eclipse.core.resources.extension" value="block"/>
+ </and>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.emf.ecore.resource.Resource"/>
+ <instanceof value="org.eclipse.fmc.mm.FMCNode"/>
+ </or>
+ </possibleChildren>
+ </navigatorContent>
+ </extension>
+ <!-- Add wizard to common navigator context menu -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.fmc.mm.FmcModelWizard">
+ <enablement>
+ </enablement>
+ </commonWizard>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryContentProvider.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryContentProvider.java
new file mode 100644
index 0000000..36e7ab0
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryContentProvider.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.navigator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+
+public class ProjectAdapterFactoryContentProvider extends
+ AdapterFactoryContentProvider implements IResourceChangeListener,
+ IResourceDeltaVisitor {
+
+ private static ResourceSet resourceSet = new ResourceSetImpl();;
+
+ public ProjectAdapterFactoryContentProvider() {
+ super(ProjectAdapterFactoryProvider.getAdapterFactory());
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ public boolean hasChildren(Object object) {
+ if (object instanceof IFile)
+ return true;
+ return super.hasChildren(object);
+ }
+
+ public Object[] getChildren(Object object) {
+ if (object instanceof IFile) {
+ String path = ((IFile) object).getFullPath().toString();
+ URI uri = URI.createPlatformResourceURI(path, true);
+ object = resourceSet.getResource(uri, false);
+ }
+ return super.getChildren(object);
+ }
+
+ public Object[] getElements(Object object) {
+ if (object instanceof IFile) {
+ String path = ((IFile) object).getFullPath().toString();
+ URI uri = URI.createPlatformResourceURI(path, false);
+ object = resourceSet.getResource(uri, true);
+ }
+ return super.getElements(object);
+ }
+
+ public Object getParent(Object object) {
+ if (object instanceof IFile)
+ return ((IResource) object).getParent();
+ return super.getParent(object);
+ }
+
+
+
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ delta.accept(this);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ try {
+ IResource changedResource = delta.getResource();
+ if ((changedResource.getType() == IResource.FILE)
+ && ("block".equals(changedResource.getFileExtension()))) {
+ String path = ((IFile) changedResource).getFullPath()
+ .toString();
+ URI uri = URI.createPlatformResourceURI(path, true);
+ Resource res = resourceSet.getResource(uri, true);
+ res.unload();
+ res.load(resourceSet.getLoadOptions());
+ notifyChanged(new ViewerNotification(new NotificationImpl(
+ Notification.SET, "", "Refresh")));
+ }
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ @Override
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ super.dispose();
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryLabelProvider.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryLabelProvider.java
new file mode 100644
index 0000000..a81128a
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryLabelProvider.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.navigator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+public class ProjectAdapterFactoryLabelProvider extends
+ AdapterFactoryLabelProvider {
+ public ProjectAdapterFactoryLabelProvider() {
+ super(ProjectAdapterFactoryProvider.getAdapterFactory());
+ }
+
+ public Image getImage(Object object) {
+ if (object instanceof IFile)
+ return PlatformUI.getWorkbench().getSharedImages()
+ .getImage(ISharedImages.IMG_OBJ_FILE);
+ return super.getImage(object);
+ }
+
+ public String getText(Object object) {
+ if (object instanceof IFile)
+ return ((IFile) object).getName();
+ return super.getText(object);
+ }
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryProvider.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryProvider.java
new file mode 100644
index 0000000..f7f5679
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/navigator/ProjectAdapterFactoryProvider.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.navigator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.fmc.mm.provider.FmcItemProviderAdapterFactory;
+
+public class ProjectAdapterFactoryProvider {
+ private static ComposedAdapterFactory adapterFactory;
+
+ public final static List<AdapterFactory> createFactoryList() {
+ List<AdapterFactory> factories = new ArrayList<AdapterFactory>();
+ factories.add(new FmcItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ return factories;
+ }
+
+ public final static ComposedAdapterFactory getAdapterFactory() {
+ if (adapterFactory == null)
+ adapterFactory = new ComposedAdapterFactory(createFactoryList());
+ return adapterFactory;
+ }
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorAdvisor.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorAdvisor.java
new file mode 100644
index 0000000..33c3f42
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorAdvisor.java
@@ -0,0 +1,577 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.presentation;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ContributionItemFactory;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+import org.eclipse.ui.application.IWorkbenchConfigurer;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchAdvisor;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+
+import org.eclipse.fmc.mm.presentation.FMCEditorPlugin;
+
+
+/**
+ * Customized {@link WorkbenchAdvisor} for the RCP application.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class FMCEditorAdvisor extends WorkbenchAdvisor {
+ /**
+ * The default file extension filters for use in dialogs.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final String[] FILE_EXTENSION_FILTERS = FmcEditor.FILE_EXTENSION_FILTERS.toArray(new String[0]);
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key) {
+ return FMCEditorPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return org.eclipse.fmc.mm.presentation.FMCEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ }
+
+ /**
+ * RCP's application
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Application implements IApplication {
+ /**
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ WorkbenchAdvisor workbenchAdvisor = new FMCEditorAdvisor();
+ Display display = PlatformUI.createDisplay();
+ try {
+ int returnCode = PlatformUI.createAndRunWorkbench(display, workbenchAdvisor);
+ if (returnCode == PlatformUI.RETURN_RESTART) {
+ return IApplication.EXIT_RESTART;
+ }
+ else {
+ return IApplication.EXIT_OK;
+ }
+ }
+ finally {
+ display.dispose();
+ }
+ }
+
+ /**
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void stop() {
+ // Do nothing.
+ }
+ }
+
+ /**
+ * RCP's perspective
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Perspective implements IPerspectiveFactory {
+ /**
+ * Perspective ID
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String ID_PERSPECTIVE = "org.eclipse.fmc.mm.presentation.FMCEditorAdvisorPerspective";
+
+ /**
+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createInitialLayout(IPageLayout layout) {
+ layout.setEditorAreaVisible(true);
+ layout.addPerspectiveShortcut(ID_PERSPECTIVE);
+
+ IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, (float)0.66, layout.getEditorArea());
+ right.addView(IPageLayout.ID_OUTLINE);
+
+ IFolderLayout bottonRight = layout.createFolder("bottonRight", IPageLayout.BOTTOM, (float)0.60, "right");
+ bottonRight.addView(IPageLayout.ID_PROP_SHEET);
+ }
+ }
+
+ /**
+ * RCP's window advisor
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class WindowAdvisor extends WorkbenchWindowAdvisor {
+ /**
+ * @see WorkbenchWindowAdvisor#WorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public WindowAdvisor(IWorkbenchWindowConfigurer configurer) {
+ super(configurer);
+ }
+
+ /**
+ * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen()
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void preWindowOpen() {
+ IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new Point(600, 450));
+ configurer.setShowCoolBar(false);
+ configurer.setShowStatusLine(true);
+ configurer.setTitle(getString("_UI_Application_title"));
+ }
+
+ /**
+ * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
+ return new WindowActionBarAdvisor(configurer);
+ }
+ }
+
+ /**
+ * RCP's action bar advisor
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class WindowActionBarAdvisor extends ActionBarAdvisor {
+ /**
+ * @see ActionBarAdvisor#ActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public WindowActionBarAdvisor(IActionBarConfigurer configurer) {
+ super(configurer);
+ }
+
+ /**
+ * @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void fillMenuBar(IMenuManager menuBar) {
+ IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
+ menuBar.add(createFileMenu(window));
+ menuBar.add(createEditMenu(window));
+ menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ menuBar.add(createWindowMenu(window));
+ menuBar.add(createHelpMenu(window));
+ }
+
+ /**
+ * Creates the 'File' menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createFileMenu(IWorkbenchWindow window) {
+ IMenuManager menu = new MenuManager(getString("_UI_Menu_File_label"),
+ IWorkbenchActionConstants.M_FILE);
+ menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
+
+ IMenuManager newMenu = new MenuManager(getString("_UI_Menu_New_label"), "new");
+ newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+
+ menu.add(newMenu);
+ menu.add(new Separator());
+ menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ menu.add(new Separator());
+ addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window));
+ addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window));
+ menu.add(new Separator());
+ addToMenuAndRegister(menu, ActionFactory.SAVE.create(window));
+ addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window));
+ addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window));
+ menu.add(new Separator());
+ addToMenuAndRegister(menu, ActionFactory.QUIT.create(window));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
+ return menu;
+ }
+
+ /**
+ * Creates the 'Edit' menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createEditMenu(IWorkbenchWindow window) {
+ IMenuManager menu = new MenuManager(getString("_UI_Menu_Edit_label"),
+ IWorkbenchActionConstants.M_EDIT);
+ menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
+
+ addToMenuAndRegister(menu, ActionFactory.UNDO.create(window));
+ addToMenuAndRegister(menu, ActionFactory.REDO.create(window));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
+ menu.add(new Separator());
+
+ addToMenuAndRegister(menu, ActionFactory.CUT.create(window));
+ addToMenuAndRegister(menu, ActionFactory.COPY.create(window));
+ addToMenuAndRegister(menu, ActionFactory.PASTE.create(window));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
+ menu.add(new Separator());
+
+ addToMenuAndRegister(menu, ActionFactory.DELETE.create(window));
+ addToMenuAndRegister(menu, ActionFactory.SELECT_ALL.create(window));
+ menu.add(new Separator());
+
+ menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
+
+ menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ return menu;
+ }
+
+ /**
+ * Creates the 'Window' menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createWindowMenu(IWorkbenchWindow window) {
+ IMenuManager menu = new MenuManager(getString("_UI_Menu_Window_label"),
+ IWorkbenchActionConstants.M_WINDOW);
+
+ addToMenuAndRegister(menu, ActionFactory.OPEN_NEW_WINDOW.create(window));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window));
+
+ return menu;
+ }
+
+ /**
+ * Creates the 'Help' menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createHelpMenu(IWorkbenchWindow window) {
+ IMenuManager menu = new MenuManager(getString("_UI_Menu_Help_label"), IWorkbenchActionConstants.M_HELP);
+ // Welcome or intro page would go here
+ // Help contents would go here
+ // Tips and tricks page would go here
+ menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
+ menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ return menu;
+ }
+
+ /**
+ * Adds the specified action to the given menu and also registers the action with the
+ * action bar configurer, in order to activate its key binding.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addToMenuAndRegister(IMenuManager menuManager, IAction action) {
+ menuManager.add(action);
+ getActionBarConfigurer().registerGlobalAction(action);
+ }
+ }
+
+ /**
+ * About action for the RCP application.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class AboutAction extends WorkbenchWindowActionDelegate {
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(getWindow().getShell(), getString("_UI_About_title"),
+ getString("_UI_About_text"));
+ }
+ }
+
+ /**
+ * Open action for the objects from the FMC model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class OpenAction extends WorkbenchWindowActionDelegate {
+ /**
+ * Opens the editors for the files selected using the file dialog.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void run(IAction action) {
+ String[] filePaths = openFilePathDialog(getWindow().getShell(), SWT.OPEN, null);
+ if (filePaths.length > 0) {
+ openEditor(getWindow().getWorkbench(), URI.createFileURI(filePaths[0]));
+ }
+ }
+ }
+
+ /**
+ * Open URI action for the objects from the FMC model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class OpenURIAction extends WorkbenchWindowActionDelegate {
+ /**
+ * Opens the editors for the files selected using the LoadResourceDialog.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void run(IAction action) {
+ LoadResourceAction.LoadResourceDialog loadResourceDialog = new LoadResourceAction.LoadResourceDialog(getWindow().getShell());
+ if (Window.OK == loadResourceDialog.open()) {
+ for (URI uri : loadResourceDialog.getURIs()) {
+ openEditor(getWindow().getWorkbench(), uri);
+ }
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static String[] openFilePathDialog(Shell shell, int style, String[] fileExtensionFilters) {
+ return openFilePathDialog(shell, style, fileExtensionFilters, (style & SWT.OPEN) != 0, (style & SWT.OPEN) != 0, (style & SWT.SAVE) != 0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static String[] openFilePathDialog(Shell shell, int style, String[] fileExtensionFilters, boolean includeGroupFilter, boolean includeAllFilter, boolean addExtension) {
+ FileDialog fileDialog = new FileDialog(shell, style);
+ if (fileExtensionFilters == null) {
+ fileExtensionFilters = FILE_EXTENSION_FILTERS;
+ }
+
+ // If requested, augment the file extension filters by adding a group of all the other filters (*.ext1;*.ext2;...)
+ // at the beginning and/or an all files wildcard (*.*) at the end.
+ //
+ includeGroupFilter &= fileExtensionFilters.length > 1;
+ int offset = includeGroupFilter ? 1 : 0;
+
+ if (includeGroupFilter || includeAllFilter) {
+ int size = fileExtensionFilters.length + offset + (includeAllFilter ? 1 : 0);
+ String[] allFilters = new String[size];
+ StringBuilder group = includeGroupFilter ? new StringBuilder() : null;
+
+ for (int i = 0; i < fileExtensionFilters.length; i++) {
+ if (includeGroupFilter) {
+ if (i != 0) {
+ group.append(';');
+ }
+ group.append(fileExtensionFilters[i]);
+ }
+ allFilters[i + offset] = fileExtensionFilters[i];
+ }
+
+ if (includeGroupFilter) {
+ allFilters[0] = group.toString();
+ }
+ if (includeAllFilter) {
+ allFilters[allFilters.length - 1] = "*.*";
+ }
+
+ fileDialog.setFilterExtensions(allFilters);
+ }
+ else {
+ fileDialog.setFilterExtensions(fileExtensionFilters);
+ }
+ fileDialog.open();
+
+ String[] filenames = fileDialog.getFileNames();
+ String[] result = new String[filenames.length];
+ String path = fileDialog.getFilterPath() + File.separator;
+ String extension = null;
+
+ // If extension adding requested, get the dotted extension corresponding to the selected filter.
+ //
+ if (addExtension) {
+ int i = fileDialog.getFilterIndex();
+ if (i != -1 && (!includeAllFilter || i != fileExtensionFilters.length)) {
+ i = includeGroupFilter && i == 0 ? 0 : i - offset;
+ String filter = fileExtensionFilters[i];
+ int dot = filter.lastIndexOf('.');
+ if (dot == 1 && filter.charAt(0) == '*') {
+ extension = filter.substring(dot);
+ }
+ }
+ }
+
+ // Build the result by adding the selected path and, if needed, auto-appending the extension.
+ //
+ for (int i = 0; i < filenames.length; i++) {
+ String filename = path + filenames[i];
+ if (extension != null) {
+ int dot = filename.lastIndexOf('.');
+ if (dot == -1 || !Arrays.asList(fileExtensionFilters).contains("*" + filename.substring(dot))) {
+ filename += extension;
+ }
+ }
+ result[i] = filename;
+ }
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static boolean openEditor(IWorkbench workbench, URI uri) {
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+
+ IEditorDescriptor editorDescriptor = EditUIUtil.getDefaultEditor(uri, null);
+ if (editorDescriptor == null) {
+ MessageDialog.openError(
+ workbenchWindow.getShell(),
+ getString("_UI_Error_title"),
+ getString("_WARN_No_Editor", uri.lastSegment()));
+ return false;
+ }
+ else {
+ try {
+ page.openEditor(new URIEditorInput(uri), editorDescriptor.getId());
+ }
+ catch (PartInitException exception) {
+ MessageDialog.openError(
+ workbenchWindow.getShell(),
+ getString("_UI_OpenEditorError_label"),
+ exception.getMessage());
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId()
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getInitialWindowPerspectiveId() {
+ return Perspective.ID_PERSPECTIVE;
+ }
+
+ /**
+ * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void initialize(IWorkbenchConfigurer configurer) {
+ super.initialize(configurer);
+ configurer.setSaveAndRestore(true);
+ }
+
+ /**
+ * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
+ return new WindowAdvisor(configurer);
+ }
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorPlugin.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorPlugin.java
new file mode 100644
index 0000000..a0985a8
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FMCEditorPlugin.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.presentation;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+/**
+ * This is the central singleton for the FMC editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class FMCEditorPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final FMCEditorPlugin INSTANCE = new FMCEditorPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCEditorPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcActionBarContributor.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcActionBarContributor.java
new file mode 100644
index 0000000..ae5a544
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcActionBarContributor.java
@@ -0,0 +1,462 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.presentation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.jface.wizard.WizardDialog;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * This is the action bar contributor for the Fmc model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcActionBarContributor
+ extends EditingDomainActionBarContributor
+ implements ISelectionChangedListener {
+ /**
+ * Action to create objects from the Fmc model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class NewAction extends WorkbenchWindowActionDelegate {
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void run(IAction action) {
+ FmcModelWizard wizard = new FmcModelWizard();
+ wizard.init(getWindow().getWorkbench(), StructuredSelection.EMPTY);
+ WizardDialog wizardDialog = new WizardDialog(getWindow().getShell(), wizard);
+ wizardDialog.open();
+ }
+ }
+
+ /**
+ * This keeps track of the active editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction showPropertiesViewAction =
+ new Action(FMCEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ FMCEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor
+ * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction refreshViewerAction =
+ new Action(FMCEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run() {
+ if (activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null) {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateChild actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ /**
+ * This creates an instance of the contributor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcActionBarContributor() {
+ super(ADDITIONS_LAST_STYLE);
+ loadResourceAction = new LoadResourceAction();
+ validateAction = new ValidateAction();
+ controlAction = new ControlAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(new Separator("fmc-settings"));
+ toolBarManager.add(new Separator("fmc-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor additions,
+ * as well as the sub-menus for object creation items.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(FMCEditorPlugin.INSTANCE.getString("_UI_FmcEditor_menu"), "org.eclipse.fmc.mmMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(FMCEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(FMCEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener
+ (new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if (selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if (part == null) {
+ selectionProvider = null;
+ }
+ else {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if (selectionProvider.getSelection() != null) {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
+ * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
+ * that can be added to the selected object and updating the menus accordingly.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null) {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if (createSiblingMenuManager != null) {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null) {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if (createSiblingMenuManager != null) {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
+ * by inserting them before the specified contribution item <code>contributionID</code>.
+ * If <code>contributionID</code> is <code>null</code>, they are simply added.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
+ if (actions != null) {
+ for (IAction action : actions) {
+ if (contributionID != null) {
+ manager.insertBefore(contributionID, action);
+ }
+ else {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
+ if (actions != null) {
+ IContributionItem[] items = manager.getItems();
+ for (int i = 0; i < items.length; i++) {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while (contributionItem instanceof SubContributionItem) {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if (contributionItem instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if (actions.contains(action)) {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager) {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(FMCEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(FMCEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void addGlobalActions(IMenuManager menuManager) {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcEditor.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcEditor.java
new file mode 100644
index 0000000..1991f2a
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcEditor.java
@@ -0,0 +1,1716 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.presentation;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.custom.CTabFolder;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+
+import org.eclipse.swt.graphics.Point;
+
+import org.eclipse.swt.layout.FillLayout;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.ui.ViewerPane;
+
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+
+import org.eclipse.fmc.mm.provider.FmcItemProviderAdapterFactory;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+
+/**
+ * This is an example of a Fmc model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcEditor
+ extends MultiPageEditorPart
+ implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider {
+ /**
+ * The filters for file extensions supported by the editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSION_FILTERS = prefixExtensions(FmcModelWizard.FILE_EXTENSIONS, "*.");
+
+ /**
+ * Returns a new unmodifiable list containing prefixed versions of the extensions in the given list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static List<String> prefixExtensions(List<String> extensions, String prefix) {
+ List<String> result = new ArrayList<String>();
+ for (String extension : extensions) {
+ result.add(prefix + extension);
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge...
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>();
+
+ /**
+ * This is the viewer that shadows the selection in the content outline.
+ * The parent relation must be correctly defined for this to work.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This inverts the roll of parent and child in the content provider and show parents as a tree.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer parentViewer;
+
+ /**
+ * This shows how a tree view works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewer;
+
+ /**
+ * This shows how a list view works.
+ * A list viewer doesn't support icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ListViewer listViewer;
+
+ /**
+ * This shows how a table view works.
+ * A table can be used as a list with icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TableViewer tableViewer;
+
+ /**
+ * This shows how a tree view with columns works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewerWithColumns;
+
+ /**
+ * This keeps track of the active viewer pane, in the book.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ViewerPane currentViewerPane;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * This listens for when the outline becomes active
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IPartListener partListener =
+ new IPartListener() {
+ public void partActivated(IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(FmcEditor.this);
+
+ setCurrentViewer(contentOutlineViewer);
+ }
+ }
+ else if (p instanceof PropertySheet) {
+ if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
+ getActionBarContributor().setActiveEditor(FmcEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == FmcEditor.this) {
+ handleActivate();
+ }
+ }
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter =
+ new EContentAdapter() {
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ break;
+ }
+ }
+ }
+ else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ resourceToDiagnosticMap.remove(target);
+ if (updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ }
+ };
+
+ /**
+ * Handles activation of the editor or it's associated views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleActivate() {
+ // Recompute the read only state.
+ //
+ if (editingDomain.getResourceToReadOnlyMap() != null) {
+ editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!removedResources.isEmpty()) {
+ if (handleDirtyConflict()) {
+ getSite().getPage().closeEditor(FmcEditor.this, false);
+ }
+ else {
+ removedResources.clear();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+ else if (!changedResources.isEmpty()) {
+ changedResources.removeAll(savedResources);
+ handleChangedResources();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles what to do with changed resources on activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleChangedResources() {
+ if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+ if (isDirty()) {
+ changedResources.addAll(editingDomain.getResourceSet().getResources());
+ }
+ editingDomain.getCommandStack().flush();
+
+ updateProblemIndication = false;
+ for (Resource resource : changedResources) {
+ if (resource.isLoaded()) {
+ resource.unload();
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ }
+ catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (updateProblemIndication) {
+ BasicDiagnostic diagnostic =
+ new BasicDiagnostic
+ (Diagnostic.OK,
+ "org.eclipse.fmc.mm.editor",
+ 0,
+ null,
+ new Object [] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ try {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ }
+ catch (PartInitException exception) {
+ FMCEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean handleDirtyConflict() {
+ return
+ MessageDialog.openQuestion
+ (getSite().getShell(),
+ getString("_UI_FileConflict_label"),
+ getString("_WARN_FileConflict"));
+ }
+
+ /**
+ * This creates a model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcEditor() {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void initializeEditingDomain() {
+ // Create an adapter factory that yields item providers.
+ //
+ adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new FmcItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are executed.
+ //
+ BasicCommandStack commandStack = new BasicCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
+ //
+ commandStack.addCommandStackListener
+ (new CommandStackListener() {
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
+ PropertySheetPage propertySheetPage = i.next();
+ if (propertySheetPage.getControl().isDisposed()) {
+ i.remove();
+ }
+ else {
+ propertySheetPage.refresh();
+ }
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This is here for the listener to be able to call it.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(int action) {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelectionToViewer(Collection<?> collection) {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty()) {
+ Runnable runnable =
+ new Runnable() {
+ public void run() {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (currentViewer != null) {
+ currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * This returns the editing domain as required by the {@link IEditingDomainProvider} interface.
+ * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}
+ * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getElements(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getChildren(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getParent(Object object) {
+ return null;
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewerPane(ViewerPane viewerPane) {
+ if (currentViewerPane != viewerPane) {
+ if (currentViewerPane != null) {
+ currentViewerPane.showFocus(false);
+ }
+ currentViewerPane = viewerPane;
+ }
+ setCurrentViewer(currentViewerPane.getViewer());
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
+ * is the current one.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewer(Viewer viewer) {
+ // If it is changing...
+ //
+ if (currentViewer != viewer) {
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (currentViewer != null) {
+ currentViewer.removeSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null) {
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's selection.
+ //
+ setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider} interface.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Viewer getViewer() {
+ return currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createContextMenuFor(StructuredViewer viewer) {
+ MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu= contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+ Resource resource = null;
+ try {
+ // Load the resource through the editing domain.
+ //
+ resource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ }
+ catch (Exception e) {
+ exception = e;
+ resource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic =
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.fmc.mm.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object [] { exception == null ? (Object)resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null) {
+ return
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.fmc.mm.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
+ }
+ else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void createPages() {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ selectionViewer = (TreeViewer)viewerPane.getViewer();
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ selectionViewer.setInput(editingDomain.getResourceSet());
+ selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ viewerPane.setTitle(editingDomain.getResourceSet());
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+ }
+
+ // Create a page for the parent tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ parentViewer = (TreeViewer)viewerPane.getViewer();
+ parentViewer.setAutoExpandLevel(30);
+ parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
+ parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(parentViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ParentPage_label"));
+ }
+
+ // This is the page for the list viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new ListViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ listViewer = (ListViewer)viewerPane.getViewer();
+ listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(listViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ListPage_label"));
+ }
+
+ // This is the page for the tree viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ treeViewer = (TreeViewer)viewerPane.getViewer();
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(treeViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreePage_label"));
+ }
+
+ // This is the page for the table viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TableViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ tableViewer = (TableViewer)viewerPane.getViewer();
+
+ Table table = tableViewer.getTable();
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn objectColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(3, 100, true));
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+
+ TableColumn selfColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(2, 100, true));
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+
+ tableViewer.setColumnProperties(new String [] {"a", "b"});
+ tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(tableViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TablePage_label"));
+ }
+
+ // This is the page for the table tree viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), FmcEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
+
+ Tree tree = treeViewerWithColumns.getTree();
+ tree.setLayoutData(new FillLayout());
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+ objectColumn.setWidth(250);
+
+ TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+ selfColumn.setWidth(200);
+
+ treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
+ treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(treeViewerWithColumns);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
+ }
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ setActivePage(0);
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener
+ (new ControlAdapter() {
+ boolean guard = false;
+ @Override
+ public void controlResized(ControlEvent event) {
+ if (!guard) {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part,
+ * this hides the single tab at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void hideTabs() {
+ if (getPageCount() <= 1) {
+ setPageText(0, "");
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(1);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y + 6);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part,
+ * this shows the tabs at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void showTabs() {
+ if (getPageCount() > 1) {
+ setPageText(0, getString("_UI_SelectionPage_label"));
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y - 6);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void pageChange(int pageIndex) {
+ super.pageChange(pageIndex);
+
+ if (contentOutlinePage != null) {
+ handleContentOutlineSelection(contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class key) {
+ if (key.equals(IContentOutlinePage.class)) {
+ return showOutlineView() ? getContentOutlinePage() : null;
+ }
+ else if (key.equals(IPropertySheetPage.class)) {
+ return getPropertySheetPage();
+ }
+ else {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IContentOutlinePage getContentOutlinePage() {
+ if (contentOutlinePage == null) {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage {
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ contentOutlineViewer = getTreeViewer();
+ contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ contentOutlineViewer.setInput(editingDomain.getResourceSet());
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(contentOutlineViewer);
+
+ if (!editingDomain.getResourceSet().getResources().isEmpty()) {
+ // Select the root object in the view.
+ //
+ contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ contentOutlinePage.addSelectionChangedListener
+ (new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage() {
+ PropertySheetPage propertySheetPage =
+ new ExtendedPropertySheetPage(editingDomain) {
+ @Override
+ public void setSelectionToViewer(List<?> selection) {
+ FmcEditor.this.setSelectionToViewer(selection);
+ FmcEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ propertySheetPages.add(propertySheetPage);
+
+ return propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void handleContentOutlineSelection(ISelection selection) {
+ if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ if (selectedElements.hasNext()) {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ // If it's the selection viewer, then we want it to select the same selection as this selection.
+ //
+ if (currentViewerPane.getViewer() == selectionViewer) {
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext()) {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ selectionViewer.setSelection(new StructuredSelection(selectionList));
+ }
+ else {
+ // Set the input to the widget.
+ //
+ if (currentViewerPane.getViewer().getInput() != selectedElement) {
+ currentViewerPane.getViewer().setInput(selectedElement);
+ currentViewerPane.setTitle(selectedElement);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command stack.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
+
+ // Do the work within an operation because this is a long running activity that modifies the workbench.
+ //
+ IRunnableWithProgress operation =
+ new IRunnableWithProgress() {
+ // This is the method that gets invoked when the operation runs.
+ //
+ public void run(IProgressMonitor monitor) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Resource resource : editingDomain.getResourceSet().getResources()) {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+ try {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ FMCEditorPlugin.INSTANCE.log(exception);
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the specified resource.
+ * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean isPersisted(Resource resource) {
+ boolean result = false;
+ try {
+ InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
+ if (stream != null) {
+ result = true;
+ stream.close();
+ }
+ }
+ catch (IOException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ /**
+ * This always returns true because it is not currently supported.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * This also changes the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ String[] filters = FILE_EXTENSION_FILTERS.toArray(new String[FILE_EXTENSION_FILTERS.size()]);
+ String[] files = FMCEditorAdvisor.openFilePathDialog(getSite().getShell(), SWT.SAVE, filters);
+ if (files.length > 0) {
+ URI uri = URI.createFileURI(files[0]);
+ doSaveAs(uri, new URIEditorInput(uri));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ IProgressMonitor progressMonitor =
+ getActionBars().getStatusLineManager() != null ?
+ getActionBars().getStatusLineManager().getProgressMonitor() :
+ new NullProgressMonitor();
+ doSave(progressMonitor);
+ }
+
+ /**
+ * This is called during startup.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setFocus() {
+ if (currentViewerPane != null) {
+ currentViewerPane.setFocus();
+ }
+ else {
+ getControl(getActivePage()).setFocus();
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ISelection getSelection() {
+ return editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
+ * Calling this result will notify the listeners.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelection(ISelection selection) {
+ editorSelection = selection;
+
+ for (ISelectionChangedListener listener : selectionChangedListeners) {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStatusLineManager(ISelection selection) {
+ IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
+ contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Collection<?> collection = ((IStructuredSelection)selection).toList();
+ switch (collection.size()) {
+ case 0: {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ break;
+ }
+ case 1: {
+ String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ break;
+ }
+ default: {
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ break;
+ }
+ }
+ }
+ else {
+ statusLineManager.setMessage("");
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key) {
+ return FMCEditorPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return FMCEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void menuAboutToShow(IMenuManager menuManager) {
+ ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor() {
+ return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IActionBars getActionBars() {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ updateProblemIndication = false;
+
+ getSite().getPage().removePartListener(partListener);
+
+ adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this) {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ for (PropertySheetPage propertySheetPage : propertySheetPages) {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null) {
+ contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean showOutlineView() {
+ return true;
+ }
+}
diff --git a/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcModelWizard.java b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcModelWizard.java
new file mode 100644
index 0000000..f574ba0
--- /dev/null
+++ b/org.eclipse.fmc.mm.editor/src/org/eclipse/fmc/mm/presentation/FmcModelWizard.java
@@ -0,0 +1,597 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.presentation;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.provider.FMCEditPlugin;
+
+import java.io.File;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * This is a simple wizard for creating a new model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcModelWizard extends Wizard implements INewWizard {
+ /**
+ * The supported extensions for created files.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS =
+ Collections.unmodifiableList(Arrays.asList(FMCEditorPlugin.INSTANCE.getString("_UI_FmcEditorFilenameExtensions").split("\\s*,\\s*")));
+
+ /**
+ * A formatted list of supported file extensions, suitable for display.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS =
+ FMCEditorPlugin.INSTANCE.getString("_UI_FmcEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
+ * This caches an instance of the model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FmcPackage fmcPackage = FmcPackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FmcFactory fmcFactory = fmcPackage.getFmcFactory();
+
+ /**
+ * This is the initial object creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FmcModelWizardInitialObjectCreationPage initialObjectCreationPage;
+
+ /**
+ * Remember the selection during initialization for populating the default container.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Remember the workbench during initialization.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWorkbench workbench;
+
+ /**
+ * Caches the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected List<String> initialObjectNames;
+
+ /**
+ * This just records the information.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(FMCEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(FMCEditorPlugin.INSTANCE.getImage("full/wizban/NewFmc")));
+ }
+
+ /**
+ * Returns the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getInitialObjectNames() {
+ if (initialObjectNames == null) {
+ initialObjectNames = new ArrayList<String>();
+ /*for (EClassifier eClassifier : fmcPackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass)eClassifier;
+ if (!eClass.isAbstract()) {
+ initialObjectNames.add(eClass.getName());
+ }
+ }
+ }
+ Collections.sort(initialObjectNames, java.text.Collator.getInstance());*/
+ initialObjectNames.add(fmcPackage.getFMCModel().getName());
+ }
+ return initialObjectNames;
+ }
+
+ /**
+ * Create a new model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EObject createInitialModel() {
+ EClass eClass = (EClass)fmcPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
+ EObject rootObject = fmcFactory.create(eClass);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ // Get the URI of the model file.
+ //
+ final URI fileURI = getModelURI();
+ if (new File(fileURI.toFileString()).exists()) {
+ if (!MessageDialog.openQuestion
+ (getShell(),
+ FMCEditorPlugin.INSTANCE.getString("_UI_Question_title"),
+ FMCEditorPlugin.INSTANCE.getString("_WARN_FileConflict", new String []{ fileURI.toFileString() }))) {
+ initialObjectCreationPage.selectFileField();
+ return false;
+ }
+ }
+
+ // Do the work within an operation.
+ //
+ IRunnableWithProgress operation = new IRunnableWithProgress() {
+ public void run(IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
+ resource.save(options);
+ }
+ catch (Exception exception) {
+ FMCEditorPlugin.INSTANCE.log(exception);
+ }
+ finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ getContainer().run(false, false, operation);
+
+ return FMCEditorAdvisor.openEditor(workbench, fileURI);
+ }
+ catch (Exception exception) {
+ FMCEditorPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the page where the type of object to create is selected.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class FmcModelWizardInitialObjectCreationPage extends WizardPage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Text fileField;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo initialObjectField;
+
+ /**
+ * @generated
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected List<String> encodings;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo encodingField;
+
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcModelWizardInitialObjectCreationPage(String pageId) {
+ super(pageId);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 12;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+ }
+
+ Label resourceURILabel = new Label(composite, SWT.LEFT);
+ {
+ resourceURILabel.setText(FMCEditorPlugin.INSTANCE.getString("_UI_File_label"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ resourceURILabel.setLayoutData(data);
+ }
+
+ Composite fileComposite = new Composite(composite, SWT.NONE);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.END;
+ fileComposite.setLayoutData(data);
+
+ GridLayout layout = new GridLayout();
+ data.horizontalAlignment = GridData.FILL;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ fileComposite.setLayout(layout);
+ }
+
+ fileField = new Text(fileComposite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = 1;
+ fileField.setLayoutData(data);
+ // Select the container and propose filename
+ if (selection != null && selection.isEmpty() == false
+ && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() > 1)
+ return;
+ Object obj = ssel.getFirstElement();
+ if (obj instanceof IResource) {
+ IContainer container;
+ if (obj instanceof IContainer)
+ container = (IContainer) obj;
+ else
+ container = ((IResource) obj).getParent();
+ fileField.setText(container.getLocation().toFile().getAbsolutePath()
+ + "/newFile.block");
+ }
+ }
+ }
+
+ fileField.addModifyListener(validator);
+
+ Button resourceURIBrowseFileSystemButton = new Button(fileComposite, SWT.PUSH);
+ resourceURIBrowseFileSystemButton.setText(FMCEditorPlugin.INSTANCE.getString("_UI_Browse_label"));
+
+ resourceURIBrowseFileSystemButton.addSelectionListener
+ (new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ String[] filters = FmcEditor.FILE_EXTENSION_FILTERS.toArray(new String[FmcEditor.FILE_EXTENSION_FILTERS.size()]);
+ String[] files = FMCEditorAdvisor.openFilePathDialog(getShell(), SWT.SAVE, filters);
+ if (files.length > 0) {
+ fileField.setText(files[0]);
+ }
+ }
+ });
+ Label containerLabel = new Label(composite, SWT.LEFT);
+ {
+ containerLabel.setText(FMCEditorPlugin.INSTANCE.getString("_UI_ModelObject"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ containerLabel.setLayoutData(data);
+ }
+
+ initialObjectField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ initialObjectField.setLayoutData(data);
+ }
+
+ for (String objectName : getInitialObjectNames()) {
+ initialObjectField.add(getLabel(objectName));
+ }
+
+ if (initialObjectField.getItemCount() == 1) {
+ initialObjectField.select(0);
+ }
+ initialObjectField.addModifyListener(validator);
+
+ Label encodingLabel = new Label(composite, SWT.LEFT);
+ {
+ encodingLabel.setText(FMCEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ encodingLabel.setLayoutData(data);
+ }
+ encodingField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ encodingField.setLayoutData(data);
+ }
+
+ for (String encoding : getEncodings()) {
+ encodingField.add(encoding);
+ }
+
+ encodingField.select(0);
+ encodingField.addModifyListener(validator);
+
+ setPageComplete(validatePage());
+ setControl(composite);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ModifyListener validator =
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean validatePage() {
+ URI fileURI = getFileURI();
+ if (fileURI == null || fileURI.isEmpty()) {
+ setErrorMessage(null);
+ return false;
+ }
+
+ String extension = fileURI.fileExtension();
+ if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
+ setErrorMessage(FMCEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
+ return false;
+ }
+
+ setErrorMessage(null);
+ return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ initialObjectField.clearSelection();
+ encodingField.clearSelection();
+ fileField.setFocus();
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInitialObjectName() {
+ String label = initialObjectField.getText();
+
+ for (String name : getInitialObjectNames()) {
+ if (getLabel(name).equals(label)) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getEncoding() {
+ return encodingField.getText();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public URI getFileURI() {
+ try {
+ return URI.createFileURI(fileField.getText());
+ }
+ catch (Exception exception) {
+ // Ignore
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void selectFileField() {
+ initialObjectField.clearSelection();
+ encodingField.clearSelection();
+ fileField.selectAll();
+ fileField.setFocus();
+ }
+
+ /**
+ * Returns the label for the specified type name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected String getLabel(String typeName) {
+ try {
+ return FMCEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
+ }
+ catch(MissingResourceException mre) {
+ FMCEditorPlugin.INSTANCE.log(mre);
+ }
+ return typeName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getEncodings() {
+ if (encodings == null) {
+ encodings = new ArrayList<String>();
+ for (StringTokenizer stringTokenizer = new StringTokenizer(FMCEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
+ encodings.add(stringTokenizer.nextToken());
+ }
+ }
+ return encodings;
+ }
+ }
+
+ /**
+ * The framework calls this to create the contents of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ initialObjectCreationPage = new FmcModelWizardInitialObjectCreationPage("Whatever2");
+ initialObjectCreationPage.setTitle(FMCEditorPlugin.INSTANCE.getString("_UI_FmcModelWizard_label"));
+ initialObjectCreationPage.setDescription(FMCEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
+ addPage(initialObjectCreationPage);
+ }
+
+ /**
+ * Get the URI from the page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public URI getModelURI() {
+ return initialObjectCreationPage.getFileURI();
+ }
+
+}
diff --git a/org.eclipse.fmc.mm/.classpath b/org.eclipse.fmc.mm/.classpath
new file mode 100644
index 0000000..098194c
--- /dev/null
+++ b/org.eclipse.fmc.mm/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.fmc.mm/.gitignore b/org.eclipse.fmc.mm/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.fmc.mm/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.fmc.mm/.project b/org.eclipse.fmc.mm/.project
new file mode 100644
index 0000000..8f209c4
--- /dev/null
+++ b/org.eclipse.fmc.mm/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fmc.mm</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.fmc.mm/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.fmc.mm/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/org.eclipse.fmc.mm/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.fmc.mm/META-INF/MANIFEST.MF b/org.eclipse.fmc.mm/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d6381e0
--- /dev/null
+++ b/org.eclipse.fmc.mm/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.fmc.mm;singleton:=true
+Bundle-Version: 0.11.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.fmc.mm.Activator
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.fmc.mm,
+ org.eclipse.fmc.mm.impl,
+ org.eclipse.fmc.mm.util
+Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.fmc.mm/about.html b/org.eclipse.fmc.mm/about.html
new file mode 100644
index 0000000..333235b
--- /dev/null
+++ b/org.eclipse.fmc.mm/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 26, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.fmc.mm/build.properties b/org.eclipse.fmc.mm/build.properties
new file mode 100644
index 0000000..eee59f6
--- /dev/null
+++ b/org.eclipse.fmc.mm/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/org.eclipse.fmc.mm/model/Blockdiagram.ecore b/org.eclipse.fmc.mm/model/Blockdiagram.ecore
new file mode 100644
index 0000000..3e1d6d9
--- /dev/null
+++ b/org.eclipse.fmc.mm/model/Blockdiagram.ecore
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mm" nsURI="http://fmc.eclipse.org/0.10.0" nsPrefix="fmc">
+ <eClassifiers xsi:type="ecore:EClass" name="Agent" eSuperTypes="#//FMCNode">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Agents are active components"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="accessConnections" upperBound="-1"
+ eType="#//Access" eOpposite="#//Access/agent"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="human" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sourceChannels" upperBound="-1"
+ eType="#//Channel" eOpposite="#//Channel/source"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="targetChannels" upperBound="-1"
+ eType="#//Channel" eOpposite="#//Channel/target"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Channel" eSuperTypes="#//FMCConnection">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Channel contains transient data"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="channelType" lowerBound="1"
+ eType="#//RequestDirection"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
+ eType="#//Agent" eOpposite="#//Agent/sourceChannels"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
+ eType="#//Agent" eOpposite="#//Agent/targetChannels"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="dataflowDirection" eType="#//DataflowDirection"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//AccessTarget">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Storage contains persistent data"/>
+ </eAnnotations>
+ <eOperations name="isShared" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FMCNode" abstract="true" eSuperTypes="#//FMCElement">
+ <eOperations name="getAllConnections" ordered="false" upperBound="-1" eType="#//FMCConnection"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="contains" upperBound="-1"
+ eType="#//FMCNode" containment="true" eOpposite="#//FMCNode/container"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="container" eType="#//FMCNode"
+ eOpposite="#//FMCNode/contains"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="multiplicity" eType="#//MultiplicityType"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nextElement" eType="#//FMCNode"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FMCConnection" abstract="true" eSuperTypes="#//FMCElement"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Access" eSuperTypes="#//FMCConnection">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="agent" lowerBound="1" eType="#//Agent"
+ eOpposite="#//Agent/accessConnections"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="#//AccessType"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
+ eType="#//AccessTarget" eOpposite="#//AccessTarget/connections"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="AccessType">
+ <eLiterals name="UNSPECIFIED"/>
+ <eLiterals name="READ" value="1"/>
+ <eLiterals name="WRITE" value="2"/>
+ <eLiterals name="RW" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FMCModel">
+ <eOperations name="getAllFMCNodes" upperBound="-1" eType="#//FMCNode"/>
+ <eOperations name="getAllFMCConnections" upperBound="-1" eType="#//FMCConnection"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
+ eType="#//FMCNode" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
+ eType="#//FMCConnection" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="comments" upperBound="-1"
+ eType="#//Comment" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="profileId" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="RequestDirection">
+ <eLiterals name="UNSPECIFIED"/>
+ <eLiterals name="REQUEST" value="1"/>
+ <eLiterals name="RESPONSE" value="2"/>
+ <eLiterals name="REQUESTRESPONSE" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="StructureVariance" eSuperTypes="#//AccessTarget"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Metadata">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="creator" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="changer" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="creationdate" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDate"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastchange" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDate"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ELong"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="language" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="MultiplicityType">
+ <eLiterals name="ONE"/>
+ <eLiterals name="MANY" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="DataflowDirection">
+ <eLiterals name="UNSPECIFIED"/>
+ <eLiterals name="DEFAULT" value="1"/>
+ <eLiterals name="OTHER" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AccessTarget" abstract="true" interface="true"
+ eSuperTypes="#//FMCNode">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
+ eType="#//Access" eOpposite="#//Access/target"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Comment" eSuperTypes="#//FMCElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="content" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="commentAssignment" eType="#//FMCElement"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//CommentType"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FMCElement" abstract="true">
+ <eOperations name="accept" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="visitor" eType="#//IFMCElementVisitor"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nodeMetadata" eType="#//Metadata"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="stereotypes" upperBound="-1"
+ eType="#//Stereotype" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="CommentType">
+ <eLiterals name="TEXT"/>
+ <eLiterals name="IMAGE" value="1"/>
+ <eLiterals name="OTHER" value="2"/>
+ <eLiterals name="BRACE" value="3"/>
+ <eLiterals name="AREABORDER" value="4"/>
+ <eLiterals name="COMMONFEATUREAREA" value="5"/>
+ <eLiterals name="DOTS" value="6" literal="DOTS"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Stereotype">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="values" upperBound="-1"
+ eType="#//StereotypeValue" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="StereotypeValue">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueString" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueBoolean" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueInteger" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IFMCElementVisitor" abstract="true"
+ interface="true">
+ <eOperations name="visit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="element" eType="#//FMCElement"/>
+ <eParameters name="object" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitComment" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="comment" eType="#//Comment"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitAccess" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="access" eType="#//Access"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitChannel" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="channel" eType="#//Channel"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitAgent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="agent" eType="#//Agent"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitStorage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="storage" eType="#//Storage"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ <eOperations name="visitStructureVariance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
+ <eParameters name="structureVariance" eType="#//StructureVariance"/>
+ <eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ </eOperations>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/org.eclipse.fmc.mm/model/Blockdiagram.ecorediag b/org.eclipse.fmc.mm/model/Blockdiagram.ecorediag
new file mode 100644
index 0000000..c1139bf
--- /dev/null
+++ b/org.eclipse.fmc.mm/model/Blockdiagram.ecorediag
@@ -0,0 +1,848 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_fZMNgbnFEeCIh4IPPl39pw" type="EcoreTools" name="FMC" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_kC48gLnFEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_kDGX4LnFEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_kDNFkLnFEeCIh4IPPl39pw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_WswLYdI7EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Agent/human"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WswycNI7EeCUvLkdTet4aw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_kDNFkbnFEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_kDNFkrnFEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_kDNFk7nFEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_kDOTsLnFEeCIh4IPPl39pw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_kDOTsbnFEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_kDOTsrnFEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_kDOTs7nFEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_kC48gbnFEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="10011046" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Agent"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kC48grnFEeCIh4IPPl39pw" x="200" y="605" height="123"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_j3fIULnGEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_j3g9gLnGEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_j3hkkLnGEeCIh4IPPl39pw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_DcwuILxSEeCvELOnU-vfpQ" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Channel/channelType"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DcwuIbxSEeCvELOnU-vfpQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_h-mfsNPTEeC_deL0gCnxBQ" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Channel/dataflowDirection"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_h-mfsdPTEeC_deL0gCnxBQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_ei9Kwd1AEeCZZ556znA2mw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Channel/name"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ei9Kwt1AEeCZZ556znA2mw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_j3hkkbnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_j3iLoLnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_j3iLobnGEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_j3iysLnGEeCIh4IPPl39pw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_j3iysbnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_j3iysrnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_j3iys7nGEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_j3fIUbnGEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="8047085" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Channel"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_j3fIUrnGEeCIh4IPPl39pw" x="420" y="600"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_k9d48LnGEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_k9gVMLnGEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_k9g8QLnGEeCIh4IPPl39pw" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_k9g8QbnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_k9g8QrnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_k9g8Q7nGEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_k9iKYLnGEeCIh4IPPl39pw" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_3S4KALnGEeCIh4IPPl39pw" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//Storage/isShared"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_3S4KAbnGEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_k9iKYbnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_k9iKYrnGEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_k9iKY7nGEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_k9d48bnGEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="10011046" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Storage"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k9d48rnGEeCIh4IPPl39pw" x="140" y="790"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_CjoFgLnHEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_CjpToLnHEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_CjpTobnHEeCIh4IPPl39pw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_GGlO4LnHEeCIh4IPPl39pw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//FMCNode/name"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GGlO4bnHEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_zMBy8NI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//FMCNode/multiplicity"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_zMBy8dI8EeCUvLkdTet4aw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_CjpTornHEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Cjp6sLnHEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Cjp6sbnHEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Cjp6srnHEeCIh4IPPl39pw" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_GekUcCo-EeGJtrri0GnTxQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//FMCNode/getAllConnections"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GekUcSo-EeGJtrri0GnTxQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Cjp6s7nHEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Cjp6tLnHEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Cjp6tbnHEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_CjoFgbnHEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="10011046" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//FMCNode"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CjoFgrnHEeCIh4IPPl39pw" x="105" y="445"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_zHau0LnJEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_zHb88LnJEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_zHb88bnJEeCIh4IPPl39pw" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_zHb88rnJEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_zHb887nJEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_zHckALnJEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_zHdLELnJEeCIh4IPPl39pw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_zHdLEbnJEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_zHdLErnJEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_zHdLE7nJEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_zHau0bnJEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="8047085" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//FMCConnection"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_zHbV4LnJEeCIh4IPPl39pw" x="585" y="445" width="168" height="63"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_0CFf8LnMEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_0CH8MLnMEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_0CIjQLnMEeCIh4IPPl39pw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_JGKdELnVEeCIh4IPPl39pw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Access/type"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_JGKdEbnVEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_0CIjQbnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_0CIjQrnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_0CIjQ7nMEeCIh4IPPl39pw"/>
+ <layoutConstraint xmi:type="notation:Ratio" xmi:id="_1KJ7QLnMEeCIh4IPPl39pw" value="0.2926829268292683"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_0CJxYLnMEeCIh4IPPl39pw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_0CJxYbnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_0CJxYrnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_0CJxY7nMEeCIh4IPPl39pw"/>
+ <layoutConstraint xmi:type="notation:Ratio" xmi:id="_1KLJYLnMEeCIh4IPPl39pw" value="0.2926829268292683"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_0CFf8bnMEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="8047085" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Access"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_0CFf8rnMEeCIh4IPPl39pw" x="690" y="600"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_2ezaALnMEeCIh4IPPl39pw" type="1005">
+ <children xmi:type="notation:Node" xmi:id="_2e0oILnMEeCIh4IPPl39pw" type="4010"/>
+ <children xmi:type="notation:Node" xmi:id="_2e12QLnMEeCIh4IPPl39pw" type="5008">
+ <children xmi:type="notation:Node" xmi:id="_0oXKcKv7EeGvVsVYMo0deA" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//AccessType/UNSPECIFIED"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_0oXKcav7EeGvVsVYMo0deA"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_D2t2ULnNEeCIh4IPPl39pw" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//AccessType/READ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_D2t2UbnNEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_E-kPMLnNEeCIh4IPPl39pw" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//AccessType/WRITE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_E-kPMbnNEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GXH9kLnNEeCIh4IPPl39pw" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//AccessType/RW"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GXH9kbnNEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_2e12QbnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_2e12QrnMEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_2e12Q7nMEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_2ezaAbnMEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EEnum" href="Blockdiagram.ecore#//AccessType"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2ezaArnMEeCIh4IPPl39pw" x="594" y="850"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_DuwSgLngEeCIh4IPPl39pw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_DuzV0LngEeCIh4IPPl39pw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_Duz84LngEeCIh4IPPl39pw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_FNoEQLngEeCIh4IPPl39pw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//FMCModel/name"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_FNorULngEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_JGXlsPKHEeGPRpHtH7HKBw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//FMCModel/profileId"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_JGXlsfKHEeGPRpHtH7HKBw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Duz84bngEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Duz84rngEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Duz847ngEeCIh4IPPl39pw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Du1LALngEeCIh4IPPl39pw" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_Xk0OACs3EeKNtIlN5g2dCw" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//FMCModel/getAllFMCNodes"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Xk0OASs3EeKNtIlN5g2dCw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dEEsACs3EeKNtIlN5g2dCw" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//FMCModel/getAllFMCConnections"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_dEEsASs3EeKNtIlN5g2dCw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Du1LAbngEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Du1LArngEeCIh4IPPl39pw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Du1LA7ngEeCIh4IPPl39pw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_Duw5kLngEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//FMCModel"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Duw5kbngEeCIh4IPPl39pw" x="275" y="30"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Iiza4LxSEeCvELOnU-vfpQ" type="1005">
+ <children xmi:type="notation:Node" xmi:id="_IjDSgLxSEeCvELOnU-vfpQ" type="4010"/>
+ <children xmi:type="notation:Node" xmi:id="_IjFHsLxSEeCvELOnU-vfpQ" type="5008">
+ <children xmi:type="notation:Node" xmi:id="_Jsr0ELxSEeCvELOnU-vfpQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//RequestDirection/UNSPECIFIED"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Jsr0EbxSEeCvELOnU-vfpQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_LirFULxSEeCvELOnU-vfpQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//RequestDirection/REQUEST"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_LirFUbxSEeCvELOnU-vfpQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_MZCFkLxSEeCvELOnU-vfpQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//RequestDirection/RESPONSE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_MZCsoLxSEeCvELOnU-vfpQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_qobRsNPSEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//RequestDirection/REQUESTRESPONSE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qobRsdPSEeC_deL0gCnxBQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_IjFHsbxSEeCvELOnU-vfpQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_IjFHsrxSEeCvELOnU-vfpQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_IjFuwLxSEeCvELOnU-vfpQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_Iiza4bxSEeCvELOnU-vfpQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EEnum" href="Blockdiagram.ecore#//RequestDirection"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Iiza4rxSEeCvELOnU-vfpQ" x="544" y="995"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_mx-iQLzhEeC4tcu5DJSSpQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_myLWkLzhEeC4tcu5DJSSpQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_myL9oLzhEeC4tcu5DJSSpQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_myL9obzhEeC4tcu5DJSSpQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_myL9orzhEeC4tcu5DJSSpQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_myL9o7zhEeC4tcu5DJSSpQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_myNLwLzhEeC4tcu5DJSSpQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_myNLwbzhEeC4tcu5DJSSpQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_myNLwrzhEeC4tcu5DJSSpQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_myNLw7zhEeC4tcu5DJSSpQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_myA-gLzhEeC4tcu5DJSSpQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="10011046" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//StructureVariance"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_myA-gbzhEeC4tcu5DJSSpQ" x="-10" y="790" width="133"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_SYGC0NI8EeCUvLkdTet4aw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_SYJtMNI8EeCUvLkdTet4aw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_SYLiYNI8EeCUvLkdTet4aw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_TyouMNI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/creator"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TyouMdI8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_VclukNI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/changer"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_VclukdI8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_WNb8sNI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/creationdate"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WNb8sdI8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_XbPzoNI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/lastchange"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_XbPzodI8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_YyHf8NI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/version"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_YyHf8dI8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_jX0TUNI8EeCUvLkdTet4aw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Metadata/language"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_jX0TUdI8EeCUvLkdTet4aw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_SYLiYdI8EeCUvLkdTet4aw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SYLiYtI8EeCUvLkdTet4aw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SYLiY9I8EeCUvLkdTet4aw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_SYN-oNI8EeCUvLkdTet4aw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_SYN-odI8EeCUvLkdTet4aw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SYN-otI8EeCUvLkdTet4aw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SYN-o9I8EeCUvLkdTet4aw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_SYGC0dI8EeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Metadata"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SYGC0tI8EeCUvLkdTet4aw" x="655" y="60"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_1CqAcdPIEeC_deL0gCnxBQ" type="1005">
+ <children xmi:type="notation:Node" xmi:id="_1CxVMNPIEeC_deL0gCnxBQ" type="4010"/>
+ <children xmi:type="notation:Node" xmi:id="_1C7tQNPIEeC_deL0gCnxBQ" type="5008">
+ <children xmi:type="notation:Node" xmi:id="_2xzp4NPIEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//MultiplicityType/ONE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2xzp4dPIEeC_deL0gCnxBQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_4DpFMNPIEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//MultiplicityType/MANY"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_4DpFMdPIEeC_deL0gCnxBQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_1C7tQdPIEeC_deL0gCnxBQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_1C7tQtPIEeC_deL0gCnxBQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_1C7tQ9PIEeC_deL0gCnxBQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_1CqActPIEeC_deL0gCnxBQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EEnum" href="Blockdiagram.ecore#//MultiplicityType"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1CqAc9PIEeC_deL0gCnxBQ" x="709" y="850"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_V6B6kNPTEeC_deL0gCnxBQ" type="1005">
+ <children xmi:type="notation:Node" xmi:id="_V6ChoNPTEeC_deL0gCnxBQ" type="4010"/>
+ <children xmi:type="notation:Node" xmi:id="_V6ChodPTEeC_deL0gCnxBQ" type="5008">
+ <children xmi:type="notation:Node" xmi:id="_YjB9INPTEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//DataflowDirection/UNSPECIFIED"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_YjCkMNPTEeC_deL0gCnxBQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_c1eCsNPTEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//DataflowDirection/DEFAULT"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_c1eCsdPTEeC_deL0gCnxBQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_eJ--kNPTEeC_deL0gCnxBQ" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//DataflowDirection/OTHER"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_eJ--kdPTEeC_deL0gCnxBQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_V6ChotPTEeC_deL0gCnxBQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_V6Cho9PTEeC_deL0gCnxBQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_V6ChpNPTEeC_deL0gCnxBQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_V6B6kdPTEeC_deL0gCnxBQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EEnum" href="Blockdiagram.ecore#//DataflowDirection"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V6B6ktPTEeC_deL0gCnxBQ" x="414" y="995"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_4wbbYCysEeGi0PzSniT2TQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_4wd3oCysEeGi0PzSniT2TQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_4weesCysEeGi0PzSniT2TQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_4weesSysEeGi0PzSniT2TQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_4weesiysEeGi0PzSniT2TQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_4weesyysEeGi0PzSniT2TQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_4wfs0CysEeGi0PzSniT2TQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_4wfs0SysEeGi0PzSniT2TQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_4wfs0iysEeGi0PzSniT2TQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_4wfs0yysEeGi0PzSniT2TQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_4wbbYSysEeGi0PzSniT2TQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//AccessTarget"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4wbbYiysEeGi0PzSniT2TQ" x="85" y="605"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_CtUjQEDuEeG4SpW_daU41A" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_CtgwgEDuEeG4SpW_daU41A" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_Ctm3IEDuEeG4SpW_daU41A" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_EI_QAEDuEeG4SpW_daU41A" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Comment/content"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_EI_QAUDuEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_D3_KIEDvEeG4SpW_daU41A" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Comment/type"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_D3_KIUDvEeG4SpW_daU41A"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Ctm3IUDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Ctm3IkDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Ctm3I0DuEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Ctm3JEDuEeG4SpW_daU41A" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Ctm3JUDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Ctm3JkDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Ctm3J0DuEeG4SpW_daU41A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_CtUjQUDuEeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Comment"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CtUjQkDuEeG4SpW_daU41A" x="395" y="445"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_RplHMEDuEeG4SpW_daU41A" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_RplHM0DuEeG4SpW_daU41A" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_RplHNEDuEeG4SpW_daU41A" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_RplHNUDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_RplHNkDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_RplHN0DuEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_RplHOEDuEeG4SpW_daU41A" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_aY8j4PXAEeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//FMCElement/accept"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_aY8j4fXAEeGalId-FlgDAQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_RplHOUDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_RplHOkDuEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_RplHO0DuEeG4SpW_daU41A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_RplHMUDuEeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//FMCElement"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RplHMkDuEeG4SpW_daU41A" x="275" y="185"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Goos0EDvEeG4SpW_daU41A" type="1005">
+ <children xmi:type="notation:Node" xmi:id="_Goos00DvEeG4SpW_daU41A" type="4010"/>
+ <children xmi:type="notation:Node" xmi:id="_Goos1EDvEeG4SpW_daU41A" type="5008">
+ <children xmi:type="notation:Node" xmi:id="_LeExwEDvEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/TEXT"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_LeExwUDvEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_OVCX0EDvEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/IMAGE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_OVCX0UDvEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_UPEQ0EDwEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/AREABORDER"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_UPEQ0UDwEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_RW-CUEDwEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/BRACE"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_RW-CUUDwEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_H0iicEDzEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/COMMONFEATUREAREA"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_H0iicUDzEeG4SpW_daU41A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_TZbewEDvEeG4SpW_daU41A" type="2006">
+ <element xmi:type="ecore:EEnumLiteral" href="Blockdiagram.ecore#//CommentType/OTHER"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TZbewUDvEeG4SpW_daU41A"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_Goos1UDvEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Goos1kDvEeG4SpW_daU41A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Goos10DvEeG4SpW_daU41A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_Goos0UDvEeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EEnum" href="Blockdiagram.ecore#//CommentType"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Goos0kDvEeG4SpW_daU41A" x="415" y="850"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_umh7wPKEEeGPRpHtH7HKBw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_umh7w_KEEeGPRpHtH7HKBw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_umh7xPKEEeGPRpHtH7HKBw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_0tM_EPKEEeGPRpHtH7HKBw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//Stereotype/id"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_0tM_EfKEEeGPRpHtH7HKBw"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_umh7xfKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_umh7xvKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_umh7x_KEEeGPRpHtH7HKBw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_umh7yPKEEeGPRpHtH7HKBw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_umh7yfKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_umh7yvKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_umh7y_KEEeGPRpHtH7HKBw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_umh7wfKEEeGPRpHtH7HKBw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//Stereotype"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_umh7wvKEEeGPRpHtH7HKBw" x="15" y="180"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_x9geoPKEEeGPRpHtH7HKBw" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_x9geo_KEEeGPRpHtH7HKBw" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_x9gepPKEEeGPRpHtH7HKBw" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_lAvbUPKGEeGPRpHtH7HKBw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//StereotypeValue/id"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_lAvbUfKGEeGPRpHtH7HKBw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_20H9YPKGEeGPRpHtH7HKBw" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//StereotypeValue/valueString"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_20H9YfKGEeGPRpHtH7HKBw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_bew6EPf9EeGgwcibBqOMOA" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//StereotypeValue/valueBoolean"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bew6Eff9EeGgwcibBqOMOA"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_eUuakPf9EeGgwcibBqOMOA" type="2001">
+ <element xmi:type="ecore:EAttribute" href="Blockdiagram.ecore#//StereotypeValue/valueInteger"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_eUuakff9EeGgwcibBqOMOA"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_x9gepfKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_x9gepvKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_x9gep_KEEeGPRpHtH7HKBw"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_x9geqPKEEeGPRpHtH7HKBw" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_x9geqfKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_x9geqvKEEeGPRpHtH7HKBw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_x9geq_KEEeGPRpHtH7HKBw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_x9geofKEEeGPRpHtH7HKBw" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//StereotypeValue"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x9geovKEEeGPRpHtH7HKBw" x="-20" y="295"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_vrm7IPW-EeGalId-FlgDAQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_vrwFEPW-EeGalId-FlgDAQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_vrwFEfW-EeGalId-FlgDAQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_vrwFEvW-EeGalId-FlgDAQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_vrwFE_W-EeGalId-FlgDAQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_vrwFFPW-EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_vrwFFfW-EeGalId-FlgDAQ" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_0C_yIPW-EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visit"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_0C_yIfW-EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_ElMZIPW_EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitComment"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ElMZIfW_EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_R7TeoPW_EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitAccess"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_R7TeofW_EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_eNH1kPW_EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitChannel"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_eNH1kfW_EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_qCT64PW_EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitAgent"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qCT64fW_EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_8wregPW_EeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitStorage"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_8wregfW_EeGalId-FlgDAQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_M6NG0PXAEeGalId-FlgDAQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="Blockdiagram.ecore#//IFMCElementVisitor/visitStructureVariance"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_M6NG0fXAEeGalId-FlgDAQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_vrwFFvW-EeGalId-FlgDAQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_vrwFF_W-EeGalId-FlgDAQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_vrwFGPW-EeGalId-FlgDAQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_vrm7IfW-EeGalId-FlgDAQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="Blockdiagram.ecore#//IFMCElementVisitor"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vrm7IvW-EeGalId-FlgDAQ" x="-20" y="905"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_fZNboLnFEeCIh4IPPl39pw"/>
+ <element xmi:type="ecore:EPackage" href="Blockdiagram.ecore#/"/>
+ <edges xmi:type="notation:Edge" xmi:id="_uOnUMLnGEeCIh4IPPl39pw" type="3003" source="_4wbbYCysEeGi0PzSniT2TQ" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_uOnUMbnGEeCIh4IPPl39pw" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_uOnUMrnGEeCIh4IPPl39pw" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_uOnUM7nGEeCIh4IPPl39pw" points="[-19, -33, -167, 126]$[-19, -144, -167, 15]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9w_LMCysEeGi0PzSniT2TQ" id="(0.7450980392156863,0.813953488372093)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uOq-kLnGEeCIh4IPPl39pw" id="(0.8260869565217391,0.8088235294117647)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_NuLLALnKEeCIh4IPPl39pw" type="3002" source="_0CFf8LnMEeCIh4IPPl39pw" target="_4wbbYCysEeGi0PzSniT2TQ">
+ <children xmi:type="notation:Node" xmi:id="_NuNnQLnKEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_NuNnQbnKEeCIh4IPPl39pw" x="-23" y="-8"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_NuPccLnKEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_NuPccbnKEeCIh4IPPl39pw" x="1" y="-8"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_NuLLAbnKEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_NuLLArnKEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Access/target"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_NuLLA7nKEeCIh4IPPl39pw" points="[0, 4, 622, 5]$[0, 127, 622, 128]$[-615, 127, 7, 128]$[-615, 1, 7, 2]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_xbTkAAywEeKJB5X1CTJrdg" id="(0.7985074626865671,0.9215686274509803)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_xbTkAQywEeKJB5X1CTJrdg" id="(0.7941176470588235,0.9069767441860465)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_cgAAkLnKEeCIh4IPPl39pw" type="3002" source="_0CFf8LnMEeCIh4IPPl39pw" target="_kC48gLnFEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_cgB1wLnKEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cgB1wbnKEeCIh4IPPl39pw" x="37" y="-8"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cgCc0LnKEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cgCc0bnKEeCIh4IPPl39pw" x="60" y="-8"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_cgAAkbnKEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_cgAAkrnKEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Access/agent"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cgAAk7nKEeCIh4IPPl39pw" points="[0, 7, 526, -63]$[0, 108, 526, 38]$[-526, 108, 0, 38]$[-526, 84, 0, 14]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_36_CEkDtEeG4SpW_daU41A" id="(0.5074626865671642,0.8627450980392157)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_36_CE0DtEeG4SpW_daU41A" id="(0.22794117647058823,0.8861788617886179)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_ezoQELnKEeCIh4IPPl39pw" type="3002" source="_kC48gLnFEeCIh4IPPl39pw" target="_0CFf8LnMEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_ezpeMLnKEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ezpeMbnKEeCIh4IPPl39pw" x="-11" y="-37"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_ezqFQLnKEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ezqFQbnKEeCIh4IPPl39pw" x="-11" y="-102"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_ezoQEbnKEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_ezoQErnKEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Agent/accessConnections"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ezoQE7nKEeCIh4IPPl39pw" points="[0, 14, -526, 84]$[0, 38, -526, 108]$[526, 38, 0, 108]$[526, -63, 0, 7]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vlLI0gywEeKJB5X1CTJrdg" id="(0.22794117647058823,0.8861788617886179)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vlLI0wywEeKJB5X1CTJrdg" id="(0.5074626865671642,0.8627450980392157)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_r4miQLnKEeCIh4IPPl39pw" type="3002" source="_4wbbYCysEeGi0PzSniT2TQ" target="_0CFf8LnMEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_r4nwYLnKEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_r4nwYbnKEeCIh4IPPl39pw" y="12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_r4oXcLnKEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_r4oXcbnKEeCIh4IPPl39pw" x="-45" y="12"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_r4miQbnKEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_r4miQrnKEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//AccessTarget/connections"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_r4miQ7nKEeCIh4IPPl39pw" points="[7, 2, -615, 1]$[7, 128, -615, 127]$[622, 128, 0, 127]$[622, 5, 0, 4]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hL4DYtJAEeCUvLkdTet4aw" id="(0.7941176470588235,0.9069767441860465)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hL4DY9JAEeCUvLkdTet4aw" id="(0.7985074626865671,0.9215686274509803)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_OQKy4LnMEeCIh4IPPl39pw" type="3003" source="_kC48gLnFEeCIh4IPPl39pw" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_OQLZ8LnMEeCIh4IPPl39pw" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_OQLZ8bnMEeCIh4IPPl39pw" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_OQLZ8rnMEeCIh4IPPl39pw" points="[-50, -21, 64, 122]$[-50, -132, 64, 11]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_OQQScLnMEeCIh4IPPl39pw" id="(0.7843137254901961,0.17592592592592593)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mqitUNR2EeCiNtlifNq5pA" id="(0.35233160621761656,0.8529411764705882)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_1wKyYLnMEeCIh4IPPl39pw" type="3003" source="_0CFf8LnMEeCIh4IPPl39pw" target="_zHau0LnJEeCIh4IPPl39pw">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_1wKyYbnMEeCIh4IPPl39pw" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_1wKyYrnMEeCIh4IPPl39pw" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_1wKyY7nMEeCIh4IPPl39pw" points="[-16, -24, 65, 103]$[-16, -71, 65, 56]$[-66, -71, 15, 56]$[-66, -118, 15, 9]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_BS9BkEDvEeG4SpW_daU41A" id="(0.5476190476190477,0.8571428571428571)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_HLTR4LngEeCIh4IPPl39pw" type="3002" source="_DuwSgLngEeCIh4IPPl39pw" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_HLT48LngEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_HLT48bngEeCIh4IPPl39pw" x="13" y="-21"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_HLT48rngEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_HLT487ngEeCIh4IPPl39pw" x="10" y="10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_HLTR4bngEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_HLTR4rngEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCModel/nodes"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_HLTR47ngEeCIh4IPPl39pw" points="[-6, 0, 48, -407]$[-54, 0, 0, -407]$[-54, 370, 0, -37]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_HLW8QLngEeCIh4IPPl39pw" id="(0.024691358024691357,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_LJzu0LngEeCIh4IPPl39pw" type="3002" source="_DuwSgLngEeCIh4IPPl39pw" target="_zHau0LnJEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_LJ1kALngEeCIh4IPPl39pw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_LJ1kAbngEeCIh4IPPl39pw" x="46" y="-59"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_LJ2LELngEeCIh4IPPl39pw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_LJ2LEbngEeCIh4IPPl39pw" x="46" y="-14"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_LJzu0bngEeCIh4IPPl39pw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_LJzu0rngEeCIh4IPPl39pw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCModel/connections"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_LJzu07ngEeCIh4IPPl39pw" points="[9, 0, -110, -391]$[119, 0, 0, -391]$[119, 388, 0, -3]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_LJ9f0LngEeCIh4IPPl39pw" id="(0.9444444444444444,0.4117647058823529)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_LJ9f0bngEeCIh4IPPl39pw" id="(0.3333333333333333,0.06349206349206349)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_Nbdl8bzhEeC4tcu5DJSSpQ" type="3002" source="_CjoFgLnHEeCIh4IPPl39pw" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_NbgpQLzhEeC4tcu5DJSSpQ" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_NbgpQbzhEeC4tcu5DJSSpQ" x="6" y="-12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Nbh3YLzhEeC4tcu5DJSSpQ" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Nbh3YbzhEeC4tcu5DJSSpQ" x="-29" y="-12"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_Nbdl8rzhEeC4tcu5DJSSpQ" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_Nbdl87zhEeC4tcu5DJSSpQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCNode/contains"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Nbdl9LzhEeC4tcu5DJSSpQ" points="[-4, 0, -25, 24]$[-69, 0, -90, 24]$[-69, -68, -90, -44]$[13, -68, -8, -44]$[13, -53, -8, -29]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_0bDIEgyvEeKJB5X1CTJrdg" id="(0.017391304347826087,0.7254901960784313)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_0bDIEwyvEeKJB5X1CTJrdg" id="(0.10434782608695652,0.39215686274509803)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_UYAhULzhEeC4tcu5DJSSpQ" type="3002" source="_CjoFgLnHEeCIh4IPPl39pw" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_UYBvcLzhEeC4tcu5DJSSpQ" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_UYBvcbzhEeC4tcu5DJSSpQ" x="6" y="10"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_UYCWgLzhEeC4tcu5DJSSpQ" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_UYCWgbzhEeC4tcu5DJSSpQ" x="-36" y="10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_UYAhUbzhEeC4tcu5DJSSpQ" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_UYAhUrzhEeC4tcu5DJSSpQ" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCNode/container"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_UYAhU7zhEeC4tcu5DJSSpQ" points="[-8, -29, 13, -53]$[-8, -44, 13, -68]$[-90, -44, -69, -68]$[-90, 24, -69, 0]$[-25, 24, -4, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_UYRnELzhEeC4tcu5DJSSpQ" id="(0.10434782608695652,0.39215686274509803)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_UYRnEbzhEeC4tcu5DJSSpQ" id="(0.017391304347826087,0.7254901960784313)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_qcmZ4LzhEeC4tcu5DJSSpQ" type="3003" source="_mx-iQLzhEeC4tcu5DJSSpQ" target="_4wbbYCysEeGi0PzSniT2TQ">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_qcmZ4bzhEeC4tcu5DJSSpQ" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_qcmZ4rzhEeC4tcu5DJSSpQ" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_qcmZ47zhEeC4tcu5DJSSpQ" points="[55, -20, -18, 146]$[55, -164, -18, 2]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_DsgHYCytEeGi0PzSniT2TQ" id="(0.43137254901960786,0.9534883720930233)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_oqtMcNJAEeCUvLkdTet4aw" type="3003" source="_j3fIULnGEeCIh4IPPl39pw" target="_zHau0LnJEeCIh4IPPl39pw">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_oqtMcdJAEeCUvLkdTet4aw" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_oqtMctJAEeCUvLkdTet4aw" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_oqtMc9JAEeCUvLkdTet4aw" points="[103, -21, -113, 125]$[103, -68, -113, 78]$[198, -68, -18, 78]$[198, -115, -18, 31]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_oqwPwNJAEeCUvLkdTet4aw" id="(0.13297872340425532,0.2549019607843137)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_5pELANJAEeCUvLkdTet4aw" type="3002" source="_RplHMEDuEeG4SpW_daU41A" target="_SYGC0NI8EeCUvLkdTet4aw">
+ <children xmi:type="notation:Node" xmi:id="_5pFZINJAEeCUvLkdTet4aw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_5pFZIdJAEeCUvLkdTet4aw" x="-26" y="-1"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_5pGAMNJAEeCUvLkdTet4aw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_5pGAMdJAEeCUvLkdTet4aw" x="-26" y="-59"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_5pELAdJAEeCUvLkdTet4aw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_5pELAtJAEeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCElement/nodeMetadata"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5pELA9JAEeCUvLkdTet4aw" points="[286, 0, -116, 47]$[402, 0, 0, 47]$[402, -36, 0, 11]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5pJDgNJAEeCUvLkdTet4aw" id="(0.16666666666666666,0.9302325581395349)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5pJDgdJAEeCUvLkdTet4aw" id="(0.5436241610738255,0.9191176470588235)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_D_fzUNJBEeCUvLkdTet4aw" type="3002" source="_j3fIULnGEeCIh4IPPl39pw" target="_kC48gLnFEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_D_hBcNJBEeCUvLkdTet4aw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_D_hBcdJBEeCUvLkdTet4aw" x="-15" y="12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_D_hBctJBEeCUvLkdTet4aw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_D_hBc9JBEeCUvLkdTet4aw" x="10" y="12"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_D_fzUdJBEeCUvLkdTet4aw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_D_fzUtJBEeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Channel/source"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_D_fzU9JBEeCUvLkdTet4aw" points="[7, 9, 116, -14]$[7, 31, 116, 8]$[-104, 31, 5, 8]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_tPWm4NJBEeCUvLkdTet4aw" id="(0.07446808510638298,0.9019607843137255)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_tPWm4dJBEeCUvLkdTet4aw" id="(0.9635627530364372,0.7642276422764228)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_GydqMNJBEeCUvLkdTet4aw" type="3002" source="_j3fIULnGEeCIh4IPPl39pw" target="_kC48gLnFEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_GyeRQNJBEeCUvLkdTet4aw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GyeRQdJBEeCUvLkdTet4aw" x="5" y="-12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_Gye4UNJBEeCUvLkdTet4aw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Gye4UdJBEeCUvLkdTet4aw" x="29" y="-12"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_GydqMdJBEeCUvLkdTet4aw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_GydqMtJBEeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Channel/target"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_GydqM9JBEeCUvLkdTet4aw" points="[0, 2, 342, -33]$[0, 35, 342, 0]$[0, 35, 342, 0]$[-291, 35, 51, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uO-34NJBEeCUvLkdTet4aw" id="(0.8351063829787234,0.9803921568627451)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uO-34dJBEeCUvLkdTet4aw" id="(0.625,0.9186991869918699)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_TEh4wNJBEeCUvLkdTet4aw" type="3002" source="_kC48gLnFEeCIh4IPPl39pw" target="_j3fIULnGEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_TEjG4NJBEeCUvLkdTet4aw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TEjG4dJBEeCUvLkdTet4aw" x="10" y="50"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_TEjG4tJBEeCUvLkdTet4aw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TEjG49JBEeCUvLkdTet4aw" x="10" y="-11"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_TEh4wdJBEeCUvLkdTet4aw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_TEh4wtJBEeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Agent/sourceChannels"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_TEh4w9JBEeCUvLkdTet4aw" points="[5, 8, -104, 31]$[116, 8, 7, 31]$[116, -14, 7, 9]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_m2rusgywEeKJB5X1CTJrdg" id="(0.9635627530364372,0.7642276422764228)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_m2ruswywEeKJB5X1CTJrdg" id="(0.07446808510638298,0.9019607843137255)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_akId4NJBEeCUvLkdTet4aw" type="3002" source="_kC48gLnFEeCIh4IPPl39pw" target="_j3fIULnGEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_akJE8NJBEeCUvLkdTet4aw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_akJE8dJBEeCUvLkdTet4aw" x="49" y="7"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_akJsANJBEeCUvLkdTet4aw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_akJsAdJBEeCUvLkdTet4aw" x="-10" y="7"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_akId4dJBEeCUvLkdTet4aw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_akId4tJBEeCUvLkdTet4aw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Agent/targetChannels"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_akId49JBEeCUvLkdTet4aw" points="[51, 0, -291, 35]$[342, 0, 0, 35]$[342, 0, 0, 35]$[342, -33, 0, 2]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yZV5kgywEeKJB5X1CTJrdg" id="(0.625,0.9186991869918699)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yZV5kwywEeKJB5X1CTJrdg" id="(0.8351063829787234,0.9803921568627451)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_ENLLgCytEeGi0PzSniT2TQ" type="3003" source="_k9d48LnGEeCIh4IPPl39pw" target="_4wbbYCysEeGi0PzSniT2TQ">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_ENLLgSytEeGi0PzSniT2TQ" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_ENLLgiytEeGi0PzSniT2TQ" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ENLLgyytEeGi0PzSniT2TQ" points="[-7, -11, 10, 165]$[-7, -155, 10, 21]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ENOO0CytEeGi0PzSniT2TQ" id="(0.08387096774193549,0.23529411764705882)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_eUC5kUDsEeG4SpW_daU41A" type="3002" source="_CjoFgLnHEeCIh4IPPl39pw" target="_CjoFgLnHEeCIh4IPPl39pw">
+ <children xmi:type="notation:Node" xmi:id="_eUJAMEDsEeG4SpW_daU41A" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_eUJAMUDsEeG4SpW_daU41A" x="-24" y="61"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_eUJAMkDsEeG4SpW_daU41A" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_eUJAM0DsEeG4SpW_daU41A" x="-24" y="11"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_eUC5kkDsEeG4SpW_daU41A" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_eUC5k0DsEeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCNode/nextElement"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_eUC5lEDsEeG4SpW_daU41A" points="[7, 0, 61, -1]$[37, 0, 91, -1]$[37, 43, 91, 42]$[-54, 43, 0, 42]$[-54, 7, 0, 6]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_eUhasEDsEeG4SpW_daU41A" id="(0.97165991902834,0.9078947368421053)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_eUhasUDsEeG4SpW_daU41A" id="(0.7530364372469636,0.9210526315789473)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_haxIAEDuEeG4SpW_daU41A" type="3003" source="_CjoFgLnHEeCIh4IPPl39pw" target="_RplHMEDuEeG4SpW_daU41A">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_haxIAUDuEeG4SpW_daU41A" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_haxIAkDuEeG4SpW_daU41A" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_haxIA0DuEeG4SpW_daU41A" points="[16, -9, -60, 149]$[16, -115, -60, 43]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ha3OoEDuEeG4SpW_daU41A" id="(0.7530364372469636,0.13157894736842105)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ha3OoUDuEeG4SpW_daU41A" id="(0.2647058823529412,0.13953488372093023)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_kXW08EDuEeG4SpW_daU41A" type="3003" source="_zHau0LnJEeCIh4IPPl39pw" target="_RplHMEDuEeG4SpW_daU41A">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_kXW08UDuEeG4SpW_daU41A" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_kXW08kDuEeG4SpW_daU41A" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kXW080DuEeG4SpW_daU41A" points="[7, -23, 10, 104]$[7, -124, 10, 3]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kXc7kEDuEeG4SpW_daU41A" id="(0.14285714285714285,0.38095238095238093)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kXc7kUDuEeG4SpW_daU41A" id="(0.9478260869565217,0.9411764705882353)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_rkrXQEDuEeG4SpW_daU41A" type="3002" source="_CtUjQEDuEeG4SpW_daU41A" target="_RplHMEDuEeG4SpW_daU41A">
+ <children xmi:type="notation:Node" xmi:id="_rkxd4EDuEeG4SpW_daU41A" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_rkxd4UDuEeG4SpW_daU41A" x="-9" y="91"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_rkxd4kDuEeG4SpW_daU41A" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_rkxd40DuEeG4SpW_daU41A" x="-9" y="15"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_rkrXQUDuEeG4SpW_daU41A" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_rkrXQkDuEeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Comment/commentAssignment"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_rkrXQ0DuEeG4SpW_daU41A" points="[5, -23, -22, 187]$[5, -209, -22, 1]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_rk3kgEDuEeG4SpW_daU41A" id="(0.23809523809523808,0.35294117647058826)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_rk3kgUDuEeG4SpW_daU41A" id="(0.5333333333333333,0.9803921568627451)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_KwpRwED0EeG4SpW_daU41A" type="3002" source="_DuwSgLngEeCIh4IPPl39pw" target="_CtUjQEDuEeG4SpW_daU41A">
+ <children xmi:type="notation:Node" xmi:id="_Kwqf4ED0EeG4SpW_daU41A" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Kwqf4UD0EeG4SpW_daU41A" x="-9" y="12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_KwrG8ED0EeG4SpW_daU41A" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_KwrG8UD0EeG4SpW_daU41A" x="31" y="14"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_KwpRwUD0EeG4SpW_daU41A" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_KwpRwkD0EeG4SpW_daU41A" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCModel/comments"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_KwpRw0D0EeG4SpW_daU41A" points="[9, 1, 38, -359]$[104, 1, 133, -359]$[103, 276, 132, -84]$[103, 272, 132, -88]$[-26, 272, 3, -88]$[-26, 337, 3, -23]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Kwv_cED0EeG4SpW_daU41A" id="(0.9691358024691358,0.8676470588235294)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Kwv_cUD0EeG4SpW_daU41A" id="(0.7682119205298014,0.35294117647058826)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_RKTsUKvNEeGvVsVYMo0deA" type="3003" source="_CtUjQEDuEeG4SpW_daU41A" target="_RplHMEDuEeG4SpW_daU41A">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_RKTsUavNEeGvVsVYMo0deA" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_RKTsUqvNEeGvVsVYMo0deA" fontName="Segoe UI"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_RKTsU6vNEeGvVsVYMo0deA" points="[8, -9, 23, 192]$[8, -195, 23, 6]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_RKZy8KvNEeGvVsVYMo0deA" id="(0.08609271523178808,0.14705882352941177)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_doJ0gAyuEeKJB5X1CTJrdg" id="(0.34202898550724636,0.8823529411764706)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_AJ6S8PKFEeGPRpHtH7HKBw" type="3002" source="_umh7wPKEEeGPRpHtH7HKBw" target="_x9geoPKEEeGPRpHtH7HKBw">
+ <children xmi:type="notation:Node" xmi:id="_AJ6S9PKFEeGPRpHtH7HKBw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_AJ6S9fKFEeGPRpHtH7HKBw" x="-12" y="-47"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_AJ6S9vKFEeGPRpHtH7HKBw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_AJ6S9_KFEeGPRpHtH7HKBw" x="-12" y="-18"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_AJ6S8fKFEeGPRpHtH7HKBw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_AJ6S8vKFEeGPRpHtH7HKBw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//Stereotype/values"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_AJ6S8_KFEeGPRpHtH7HKBw" points="[-13, 4, 128, 5]$[-84, 4, 57, 5]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_AJ6S-PKFEeGPRpHtH7HKBw" id="(0.47058823529411764,0.9607843137254902)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_8MrWcPKGEeGPRpHtH7HKBw" type="3002" source="_RplHMEDuEeG4SpW_daU41A" target="_umh7wPKEEeGPRpHtH7HKBw">
+ <children xmi:type="notation:Node" xmi:id="_8MrWdPKGEeGPRpHtH7HKBw" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_8MrWdfKGEeGPRpHtH7HKBw" x="-40" y="11"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_8MrWdvKGEeGPRpHtH7HKBw" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_8MrWd_KGEeGPRpHtH7HKBw" x="5" y="11"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_8MrWcfKGEeGPRpHtH7HKBw" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_8MrWcvKGEeGPRpHtH7HKBw" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="Blockdiagram.ecore#//FMCElement/stereotypes"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_8MrWc_KGEeGPRpHtH7HKBw" points="[-11, -1, 254, 17]$[-204, -18, 61, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_8MrWePKGEeGPRpHtH7HKBw" id="(0.11764705882352941,0.4186046511627907)"/>
+ </edges>
+</notation:Diagram>
diff --git a/org.eclipse.fmc.mm/model/Blockdiagram.genmodel b/org.eclipse.fmc.mm/model/Blockdiagram.genmodel
new file mode 100644
index 0000000..7d47f8f
--- /dev/null
+++ b/org.eclipse.fmc.mm/model/Blockdiagram.genmodel
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+ -->
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="*****************************************************************************
 * <copyright>
 *
 * Copyright (c) 2013, 2013 SAP AG.
 * 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:
 * SAP AG - initial API, implementation and documentation
 *
 * </copyright>
 *
 ******************************************************************************"
+ modelDirectory="/org.eclipse.fmc.mm/src" editDirectory="/org.eclipse.fmc.mm.edit/src"
+ editorDirectory="/org.eclipse.fmc.mm.editor/src" modelPluginID="org.eclipse.fmc.mm"
+ modelName="FMC" importerID="org.eclipse.emf.importer.ecore" complianceLevel="7.0"
+ copyrightFields="false" editPluginID="org.eclipse.fmc.mm.edit" editorPluginID="org.eclipse.fmc.mm.editor"
+ language="" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"
+ runtimePlatform="RCP">
+ <foreignModel>Blockdiagram.ecore</foreignModel>
+ <genPackages prefix="Fmc" basePackage="org.eclipse.fmc" disposableProviderFactory="true"
+ ecorePackage="Blockdiagram.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="Blockdiagram.ecore#//AccessType">
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//AccessType/UNSPECIFIED"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//AccessType/READ"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//AccessType/WRITE"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//AccessType/RW"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="Blockdiagram.ecore#//RequestDirection">
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//RequestDirection/UNSPECIFIED"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//RequestDirection/REQUEST"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//RequestDirection/RESPONSE"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//RequestDirection/REQUESTRESPONSE"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="Blockdiagram.ecore#//MultiplicityType">
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//MultiplicityType/ONE"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//MultiplicityType/MANY"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="Blockdiagram.ecore#//DataflowDirection">
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//DataflowDirection/UNSPECIFIED"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//DataflowDirection/DEFAULT"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//DataflowDirection/OTHER"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="Blockdiagram.ecore#//CommentType">
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/TEXT"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/IMAGE"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/OTHER"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/BRACE"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/AREABORDER"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/COMMONFEATUREAREA"/>
+ <genEnumLiterals ecoreEnumLiteral="Blockdiagram.ecore#//CommentType/DOTS"/>
+ </genEnums>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Agent">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Agent/accessConnections"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Agent/human"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Agent/sourceChannels"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Agent/targetChannels"/>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Channel">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Channel/channelType"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Channel/source"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Channel/target"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Channel/dataflowDirection"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Channel/name"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//Storage">
+ <genOperations ecoreOperation="Blockdiagram.ecore#//Storage/isShared"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//FMCNode">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//FMCNode/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCNode/contains"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCNode/container"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//FMCNode/multiplicity"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCNode/nextElement"/>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//FMCNode/getAllConnections"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//FMCConnection"/>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Access">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Access/agent"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Access/type"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Access/target"/>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//FMCModel">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//FMCModel/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCModel/nodes"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCModel/connections"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCModel/comments"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//FMCModel/profileId"/>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//FMCModel/getAllFMCNodes"/>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//FMCModel/getAllFMCConnections"/>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//StructureVariance"/>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Metadata">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/creator"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/changer"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/creationdate"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/lastchange"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/version"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Metadata/language"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//AccessTarget">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//AccessTarget/connections"/>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Comment">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Comment/content"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Comment/commentAssignment"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Comment/type"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//FMCElement">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCElement/nodeMetadata"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//FMCElement/stereotypes"/>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//FMCElement/accept">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//FMCElement/accept/visitor"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//FMCElement/accept/object"/>
+ </genOperations>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//Stereotype">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//Stereotype/id"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Blockdiagram.ecore#//Stereotype/values"/>
+ </genClasses>
+ <genClasses ecoreClass="Blockdiagram.ecore#//StereotypeValue">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//StereotypeValue/id"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//StereotypeValue/valueString"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//StereotypeValue/valueBoolean"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Blockdiagram.ecore#//StereotypeValue/valueInteger"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="Blockdiagram.ecore#//IFMCElementVisitor">
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visit">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visit/element"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visit/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitComment">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitComment/comment"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitComment/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitAccess">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitAccess/access"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitAccess/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitChannel">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitChannel/channel"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitChannel/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitAgent">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitAgent/agent"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitAgent/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitStorage">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitStorage/storage"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitStorage/object"/>
+ </genOperations>
+ <genOperations ecoreOperation="Blockdiagram.ecore#//IFMCElementVisitor/visitStructureVariance">
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitStructureVariance/structureVariance"/>
+ <genParameters ecoreParameter="Blockdiagram.ecore#//IFMCElementVisitor/visitStructureVariance/object"/>
+ </genOperations>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/org.eclipse.fmc.mm/plugin.properties b/org.eclipse.fmc.mm/plugin.properties
new file mode 100644
index 0000000..feaf780
--- /dev/null
+++ b/org.eclipse.fmc.mm/plugin.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# <copyright>
+#
+# Copyright (c) 2013, 2013 SAP AG.
+# 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:
+# SAP AG - initial API, implementation and documentation
+#
+# </copyright>
+#
+###############################################################################
+
+pluginName = FMC Model
+providerName = Eclipse Modeling Project
diff --git a/org.eclipse.fmc.mm/plugin.xml b/org.eclipse.fmc.mm/plugin.xml
new file mode 100644
index 0000000..e6d0fe9
--- /dev/null
+++ b/org.eclipse.fmc.mm/plugin.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <!-- @generated Blockdiagram -->
+ <package
+ uri="http://fmc.eclipse.org/0.10.0"
+ class="org.eclipse.fmc.mm.FmcPackage"
+ genModel="model/Blockdiagram.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Access.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Access.java
new file mode 100644
index 0000000..ed9a892
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Access.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Access</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Access#getAgent <em>Agent</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Access#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Access#getTarget <em>Target</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccess()
+ * @model
+ * @generated
+ */
+public interface Access extends FMCConnection {
+ /**
+ * Returns the value of the '<em><b>Agent</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Agent#getAccessConnections <em>Access Connections</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Agent</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Agent</em>' reference.
+ * @see #setAgent(Agent)
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccess_Agent()
+ * @see org.eclipse.fmc.mm.Agent#getAccessConnections
+ * @model opposite="accessConnections" required="true"
+ * @generated
+ */
+ Agent getAgent();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Access#getAgent <em>Agent</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Agent</em>' reference.
+ * @see #getAgent()
+ * @generated
+ */
+ void setAgent(Agent value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.fmc.mm.AccessType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.AccessType
+ * @see #setType(AccessType)
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccess_Type()
+ * @model required="true"
+ * @generated
+ */
+ AccessType getType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Access#getType <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.AccessType
+ * @see #getType()
+ * @generated
+ */
+ void setType(AccessType value);
+
+ /**
+ * Returns the value of the '<em><b>Target</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.AccessTarget#getConnections <em>Connections</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target</em>' reference.
+ * @see #setTarget(AccessTarget)
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccess_Target()
+ * @see org.eclipse.fmc.mm.AccessTarget#getConnections
+ * @model opposite="connections" required="true"
+ * @generated
+ */
+ AccessTarget getTarget();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Access#getTarget <em>Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target</em>' reference.
+ * @see #getTarget()
+ * @generated
+ */
+ void setTarget(AccessTarget value);
+
+} // Access
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessTarget.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessTarget.java
new file mode 100644
index 0000000..6e25433
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessTarget.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Access Target</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.AccessTarget#getConnections <em>Connections</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccessTarget()
+ * @model interface="true" abstract="true"
+ * @generated
+ */
+public interface AccessTarget extends FMCNode {
+ /**
+ * Returns the value of the '<em><b>Connections</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Access}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Access#getTarget <em>Target</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Connections</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Connections</em>' reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccessTarget_Connections()
+ * @see org.eclipse.fmc.mm.Access#getTarget
+ * @model opposite="target"
+ * @generated
+ */
+ EList<Access> getConnections();
+
+} // AccessTarget
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessType.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessType.java
new file mode 100644
index 0000000..3f08254
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/AccessType.java
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Access Type</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage#getAccessType()
+ * @model
+ * @generated
+ */
+public enum AccessType implements Enumerator {
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED_VALUE
+ * @generated
+ * @ordered
+ */
+ UNSPECIFIED(0, "UNSPECIFIED", "UNSPECIFIED"),
+
+ /**
+ * The '<em><b>READ</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #READ_VALUE
+ * @generated
+ * @ordered
+ */
+ READ(1, "READ", "READ"),
+
+ /**
+ * The '<em><b>WRITE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #WRITE_VALUE
+ * @generated
+ * @ordered
+ */
+ WRITE(2, "WRITE", "WRITE"),
+
+ /**
+ * The '<em><b>RW</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #RW_VALUE
+ * @generated
+ * @ordered
+ */
+ RW(3, "RW", "RW");
+
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>UNSPECIFIED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int UNSPECIFIED_VALUE = 0;
+
+ /**
+ * The '<em><b>READ</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>READ</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #READ
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int READ_VALUE = 1;
+
+ /**
+ * The '<em><b>WRITE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>WRITE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #WRITE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int WRITE_VALUE = 2;
+
+ /**
+ * The '<em><b>RW</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>RW</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #RW
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int RW_VALUE = 3;
+
+ /**
+ * An array of all the '<em><b>Access Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final AccessType[] VALUES_ARRAY =
+ new AccessType[] {
+ UNSPECIFIED,
+ READ,
+ WRITE,
+ RW,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Access Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<AccessType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static AccessType get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ AccessType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static AccessType getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ AccessType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static AccessType get(int value) {
+ switch (value) {
+ case UNSPECIFIED_VALUE: return UNSPECIFIED;
+ case READ_VALUE: return READ;
+ case WRITE_VALUE: return WRITE;
+ case RW_VALUE: return RW;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private AccessType(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //AccessType
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Activator.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Activator.java
new file mode 100644
index 0000000..d49a7d0
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Activator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.fmc.blockdiagram.mm"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Agent.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Agent.java
new file mode 100644
index 0000000..d357c71
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Agent.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Agent</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * Agents are active components
+ * <!-- end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Agent#getAccessConnections <em>Access Connections</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Agent#isHuman <em>Human</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Agent#getSourceChannels <em>Source Channels</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Agent#getTargetChannels <em>Target Channels</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getAgent()
+ * @model
+ * @generated
+ */
+public interface Agent extends FMCNode {
+ /**
+ * Returns the value of the '<em><b>Access Connections</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Access}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Access#getAgent <em>Agent</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Access Connections</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Access Connections</em>' reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getAgent_AccessConnections()
+ * @see org.eclipse.fmc.mm.Access#getAgent
+ * @model opposite="agent"
+ * @generated
+ */
+ EList<Access> getAccessConnections();
+
+ /**
+ * Returns the value of the '<em><b>Human</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Human</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Human</em>' attribute.
+ * @see #setHuman(boolean)
+ * @see org.eclipse.fmc.mm.FmcPackage#getAgent_Human()
+ * @model
+ * @generated
+ */
+ boolean isHuman();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Agent#isHuman <em>Human</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Human</em>' attribute.
+ * @see #isHuman()
+ * @generated
+ */
+ void setHuman(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Source Channels</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Channel}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Channel#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Source Channels</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Source Channels</em>' reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getAgent_SourceChannels()
+ * @see org.eclipse.fmc.mm.Channel#getSource
+ * @model opposite="source"
+ * @generated
+ */
+ EList<Channel> getSourceChannels();
+
+ /**
+ * Returns the value of the '<em><b>Target Channels</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Channel}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Channel#getTarget <em>Target</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Channels</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Channels</em>' reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getAgent_TargetChannels()
+ * @see org.eclipse.fmc.mm.Channel#getTarget
+ * @model opposite="target"
+ * @generated
+ */
+ EList<Channel> getTargetChannels();
+
+} // Agent
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Channel.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Channel.java
new file mode 100644
index 0000000..2038c87
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Channel.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Channel</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * Channel contains transient data
+ * <!-- end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Channel#getChannelType <em>Channel Type</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Channel#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Channel#getTarget <em>Target</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Channel#getDataflowDirection <em>Dataflow Direction</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Channel#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel()
+ * @model
+ * @generated
+ */
+public interface Channel extends FMCConnection {
+ /**
+ * Returns the value of the '<em><b>Channel Type</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.fmc.mm.RequestDirection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Channel Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Channel Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.RequestDirection
+ * @see #setChannelType(RequestDirection)
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel_ChannelType()
+ * @model required="true"
+ * @generated
+ */
+ RequestDirection getChannelType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Channel#getChannelType <em>Channel Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Channel Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.RequestDirection
+ * @see #getChannelType()
+ * @generated
+ */
+ void setChannelType(RequestDirection value);
+
+ /**
+ * Returns the value of the '<em><b>Source</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Agent#getSourceChannels <em>Source Channels</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Source</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Source</em>' reference.
+ * @see #setSource(Agent)
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel_Source()
+ * @see org.eclipse.fmc.mm.Agent#getSourceChannels
+ * @model opposite="sourceChannels" required="true"
+ * @generated
+ */
+ Agent getSource();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Channel#getSource <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Source</em>' reference.
+ * @see #getSource()
+ * @generated
+ */
+ void setSource(Agent value);
+
+ /**
+ * Returns the value of the '<em><b>Target</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.Agent#getTargetChannels <em>Target Channels</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target</em>' reference.
+ * @see #setTarget(Agent)
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel_Target()
+ * @see org.eclipse.fmc.mm.Agent#getTargetChannels
+ * @model opposite="targetChannels" required="true"
+ * @generated
+ */
+ Agent getTarget();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Channel#getTarget <em>Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target</em>' reference.
+ * @see #getTarget()
+ * @generated
+ */
+ void setTarget(Agent value);
+
+ /**
+ * Returns the value of the '<em><b>Dataflow Direction</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.fmc.mm.DataflowDirection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Dataflow Direction</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Dataflow Direction</em>' attribute.
+ * @see org.eclipse.fmc.mm.DataflowDirection
+ * @see #setDataflowDirection(DataflowDirection)
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel_DataflowDirection()
+ * @model
+ * @generated
+ */
+ DataflowDirection getDataflowDirection();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Channel#getDataflowDirection <em>Dataflow Direction</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Dataflow Direction</em>' attribute.
+ * @see org.eclipse.fmc.mm.DataflowDirection
+ * @see #getDataflowDirection()
+ * @generated
+ */
+ void setDataflowDirection(DataflowDirection value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getChannel_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Channel#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // Channel
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Comment.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Comment.java
new file mode 100644
index 0000000..38bbe9a
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Comment.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Comment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Comment#getContent <em>Content</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Comment#getCommentAssignment <em>Comment Assignment</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Comment#getType <em>Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getComment()
+ * @model
+ * @generated
+ */
+public interface Comment extends FMCElement {
+ /**
+ * Returns the value of the '<em><b>Content</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Content</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Content</em>' attribute.
+ * @see #setContent(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getComment_Content()
+ * @model
+ * @generated
+ */
+ String getContent();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Comment#getContent <em>Content</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Content</em>' attribute.
+ * @see #getContent()
+ * @generated
+ */
+ void setContent(String value);
+
+ /**
+ * Returns the value of the '<em><b>Comment Assignment</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Comment Assignment</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Comment Assignment</em>' reference.
+ * @see #setCommentAssignment(FMCElement)
+ * @see org.eclipse.fmc.mm.FmcPackage#getComment_CommentAssignment()
+ * @model
+ * @generated
+ */
+ FMCElement getCommentAssignment();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Comment#getCommentAssignment <em>Comment Assignment</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Comment Assignment</em>' reference.
+ * @see #getCommentAssignment()
+ * @generated
+ */
+ void setCommentAssignment(FMCElement value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.fmc.mm.CommentType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.CommentType
+ * @see #setType(CommentType)
+ * @see org.eclipse.fmc.mm.FmcPackage#getComment_Type()
+ * @model
+ * @generated
+ */
+ CommentType getType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Comment#getType <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see org.eclipse.fmc.mm.CommentType
+ * @see #getType()
+ * @generated
+ */
+ void setType(CommentType value);
+
+} // Comment
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/CommentType.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/CommentType.java
new file mode 100644
index 0000000..4809af9
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/CommentType.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Comment Type</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage#getCommentType()
+ * @model
+ * @generated
+ */
+public enum CommentType implements Enumerator {
+ /**
+ * The '<em><b>TEXT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TEXT_VALUE
+ * @generated
+ * @ordered
+ */
+ TEXT(0, "TEXT", "TEXT"),
+
+ /**
+ * The '<em><b>IMAGE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #IMAGE_VALUE
+ * @generated
+ * @ordered
+ */
+ IMAGE(1, "IMAGE", "IMAGE"),
+
+ /**
+ * The '<em><b>OTHER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #OTHER_VALUE
+ * @generated
+ * @ordered
+ */
+ OTHER(2, "OTHER", "OTHER"),
+
+ /**
+ * The '<em><b>BRACE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #BRACE_VALUE
+ * @generated
+ * @ordered
+ */
+ BRACE(3, "BRACE", "BRACE"),
+
+ /**
+ * The '<em><b>AREABORDER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #AREABORDER_VALUE
+ * @generated
+ * @ordered
+ */
+ AREABORDER(4, "AREABORDER", "AREABORDER"),
+
+ /**
+ * The '<em><b>COMMONFEATUREAREA</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #COMMONFEATUREAREA_VALUE
+ * @generated
+ * @ordered
+ */
+ COMMONFEATUREAREA(5, "COMMONFEATUREAREA", "COMMONFEATUREAREA"),
+
+ /**
+ * The '<em><b>DOTS</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #DOTS_VALUE
+ * @generated
+ * @ordered
+ */
+ DOTS(6, "DOTS", "DOTS");
+
+ /**
+ * The '<em><b>TEXT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>TEXT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TEXT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TEXT_VALUE = 0;
+
+ /**
+ * The '<em><b>IMAGE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>IMAGE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #IMAGE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int IMAGE_VALUE = 1;
+
+ /**
+ * The '<em><b>OTHER</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>OTHER</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #OTHER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int OTHER_VALUE = 2;
+
+ /**
+ * The '<em><b>BRACE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>BRACE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #BRACE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int BRACE_VALUE = 3;
+
+ /**
+ * The '<em><b>AREABORDER</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>AREABORDER</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #AREABORDER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int AREABORDER_VALUE = 4;
+
+ /**
+ * The '<em><b>COMMONFEATUREAREA</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>COMMONFEATUREAREA</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #COMMONFEATUREAREA
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int COMMONFEATUREAREA_VALUE = 5;
+
+ /**
+ * The '<em><b>DOTS</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>DOTS</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #DOTS
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int DOTS_VALUE = 6;
+
+ /**
+ * An array of all the '<em><b>Comment Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final CommentType[] VALUES_ARRAY =
+ new CommentType[] {
+ TEXT,
+ IMAGE,
+ OTHER,
+ BRACE,
+ AREABORDER,
+ COMMONFEATUREAREA,
+ DOTS,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Comment Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<CommentType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Comment Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static CommentType get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ CommentType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Comment Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static CommentType getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ CommentType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Comment Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static CommentType get(int value) {
+ switch (value) {
+ case TEXT_VALUE: return TEXT;
+ case IMAGE_VALUE: return IMAGE;
+ case OTHER_VALUE: return OTHER;
+ case BRACE_VALUE: return BRACE;
+ case AREABORDER_VALUE: return AREABORDER;
+ case COMMONFEATUREAREA_VALUE: return COMMONFEATUREAREA;
+ case DOTS_VALUE: return DOTS;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private CommentType(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //CommentType
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/DataflowDirection.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/DataflowDirection.java
new file mode 100644
index 0000000..13b2c4d
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/DataflowDirection.java
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Dataflow Direction</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage#getDataflowDirection()
+ * @model
+ * @generated
+ */
+public enum DataflowDirection implements Enumerator {
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED_VALUE
+ * @generated
+ * @ordered
+ */
+ UNSPECIFIED(0, "UNSPECIFIED", "UNSPECIFIED"),
+
+ /**
+ * The '<em><b>DEFAULT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #DEFAULT_VALUE
+ * @generated
+ * @ordered
+ */
+ DEFAULT(1, "DEFAULT", "DEFAULT"),
+
+ /**
+ * The '<em><b>OTHER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #OTHER_VALUE
+ * @generated
+ * @ordered
+ */
+ OTHER(2, "OTHER", "OTHER");
+
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>UNSPECIFIED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int UNSPECIFIED_VALUE = 0;
+
+ /**
+ * The '<em><b>DEFAULT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>DEFAULT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #DEFAULT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int DEFAULT_VALUE = 1;
+
+ /**
+ * The '<em><b>OTHER</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>OTHER</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #OTHER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int OTHER_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Dataflow Direction</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final DataflowDirection[] VALUES_ARRAY =
+ new DataflowDirection[] {
+ UNSPECIFIED,
+ DEFAULT,
+ OTHER,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Dataflow Direction</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<DataflowDirection> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Dataflow Direction</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static DataflowDirection get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ DataflowDirection result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Dataflow Direction</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static DataflowDirection getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ DataflowDirection result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Dataflow Direction</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static DataflowDirection get(int value) {
+ switch (value) {
+ case UNSPECIFIED_VALUE: return UNSPECIFIED;
+ case DEFAULT_VALUE: return DEFAULT;
+ case OTHER_VALUE: return OTHER;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the opposite direction.
+ *
+ * @param direction
+ * The direction to determine the opposite data flow direction
+ * from.
+ * @return The opposite direction of the specified.
+ * @generated NOT
+ */
+ public static DataflowDirection getOpposite(DataflowDirection direction) {
+ switch (direction) {
+ case OTHER:
+ return DataflowDirection.DEFAULT;
+ case DEFAULT:
+ return DataflowDirection.OTHER;
+ case UNSPECIFIED:
+ return DataflowDirection.UNSPECIFIED;
+ }
+ return DataflowDirection.UNSPECIFIED;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private DataflowDirection(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //DataflowDirection
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCConnection.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCConnection.java
new file mode 100644
index 0000000..09c7966
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCConnection.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>FMC Connection</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCConnection()
+ * @model abstract="true"
+ * @generated
+ */
+public interface FMCConnection extends FMCElement {
+} // FMCConnection
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCElement.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCElement.java
new file mode 100644
index 0000000..b9835f0
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCElement.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>FMC Element</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.FMCElement#getNodeMetadata <em>Node Metadata</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCElement#getStereotypes <em>Stereotypes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCElement()
+ * @model abstract="true"
+ * @generated
+ */
+public interface FMCElement extends EObject {
+ /**
+ * Returns the value of the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Node Metadata</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Node Metadata</em>' containment reference.
+ * @see #setNodeMetadata(Metadata)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCElement_NodeMetadata()
+ * @model containment="true"
+ * @generated
+ */
+ Metadata getNodeMetadata();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCElement#getNodeMetadata <em>Node Metadata</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Node Metadata</em>' containment reference.
+ * @see #getNodeMetadata()
+ * @generated
+ */
+ void setNodeMetadata(Metadata value);
+
+ /**
+ * Returns the value of the '<em><b>Stereotypes</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Stereotype}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Stereotypes</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Stereotypes</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCElement_Stereotypes()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Stereotype> getStereotypes();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object accept(IFMCElementVisitor visitor, Object object);
+
+} // FMCElement
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCModel.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCModel.java
new file mode 100644
index 0000000..a4c9568
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCModel.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>FMC Model</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.FMCModel#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCModel#getNodes <em>Nodes</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCModel#getConnections <em>Connections</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCModel#getComments <em>Comments</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCModel#getProfileId <em>Profile Id</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel()
+ * @model
+ * @generated
+ */
+public interface FMCModel extends EObject {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCModel#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Nodes</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.FMCNode}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Nodes</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Nodes</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel_Nodes()
+ * @model containment="true"
+ * @generated
+ */
+ EList<FMCNode> getNodes();
+
+ /**
+ * Returns the value of the '<em><b>Connections</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.FMCConnection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Connections</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Connections</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel_Connections()
+ * @model containment="true"
+ * @generated
+ */
+ EList<FMCConnection> getConnections();
+
+ /**
+ * Returns the value of the '<em><b>Comments</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.Comment}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Comments</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Comments</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel_Comments()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Comment> getComments();
+
+ /**
+ * Returns the value of the '<em><b>Profile Id</b></em>' attribute list.
+ * The list contents are of type {@link java.lang.Object}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Profile Id</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Profile Id</em>' attribute list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCModel_ProfileId()
+ * @model
+ * @generated
+ */
+ EList<Object> getProfileId();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ EList<FMCNode> getAllFMCNodes();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ EList<FMCConnection> getAllFMCConnections();
+
+} // FMCModel
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCNode.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCNode.java
new file mode 100644
index 0000000..fd9080d
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FMCNode.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>FMC Node</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.FMCNode#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCNode#getContains <em>Contains</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCNode#getContainer <em>Container</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCNode#getMultiplicity <em>Multiplicity</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.FMCNode#getNextElement <em>Next Element</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode()
+ * @model abstract="true"
+ * @generated
+ */
+public interface FMCNode extends FMCElement {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCNode#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Contains</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.FMCNode}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.FMCNode#getContainer <em>Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Contains</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Contains</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode_Contains()
+ * @see org.eclipse.fmc.mm.FMCNode#getContainer
+ * @model opposite="container" containment="true"
+ * @generated
+ */
+ EList<FMCNode> getContains();
+
+ /**
+ * Returns the value of the '<em><b>Container</b></em>' container reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.fmc.mm.FMCNode#getContains <em>Contains</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Container</em>' container reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Container</em>' container reference.
+ * @see #setContainer(FMCNode)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode_Container()
+ * @see org.eclipse.fmc.mm.FMCNode#getContains
+ * @model opposite="contains" transient="false"
+ * @generated
+ */
+ FMCNode getContainer();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCNode#getContainer <em>Container</em>}' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Container</em>' container reference.
+ * @see #getContainer()
+ * @generated
+ */
+ void setContainer(FMCNode value);
+
+ /**
+ * Returns the value of the '<em><b>Multiplicity</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.fmc.mm.MultiplicityType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Multiplicity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Multiplicity</em>' attribute.
+ * @see org.eclipse.fmc.mm.MultiplicityType
+ * @see #setMultiplicity(MultiplicityType)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode_Multiplicity()
+ * @model
+ * @generated
+ */
+ MultiplicityType getMultiplicity();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCNode#getMultiplicity <em>Multiplicity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Multiplicity</em>' attribute.
+ * @see org.eclipse.fmc.mm.MultiplicityType
+ * @see #getMultiplicity()
+ * @generated
+ */
+ void setMultiplicity(MultiplicityType value);
+
+ /**
+ * Returns the value of the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Next Element</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Next Element</em>' reference.
+ * @see #setNextElement(FMCNode)
+ * @see org.eclipse.fmc.mm.FmcPackage#getFMCNode_NextElement()
+ * @model
+ * @generated
+ */
+ FMCNode getNextElement();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.FMCNode#getNextElement <em>Next Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Next Element</em>' reference.
+ * @see #getNextElement()
+ * @generated
+ */
+ void setNextElement(FMCNode value);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation" ordered="false"
+ * @generated NOT
+ */
+ EList<? extends FMCConnection> getAllConnections();
+
+} // FMCNode
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcFactory.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcFactory.java
new file mode 100644
index 0000000..7560f20
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcFactory.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage
+ * @generated
+ */
+public interface FmcFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ FmcFactory eINSTANCE = org.eclipse.fmc.mm.impl.FmcFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Agent</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Agent</em>'.
+ * @generated
+ */
+ Agent createAgent();
+
+ /**
+ * Returns a new object of class '<em>Channel</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Channel</em>'.
+ * @generated
+ */
+ Channel createChannel();
+
+ /**
+ * Returns a new object of class '<em>Storage</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Storage</em>'.
+ * @generated
+ */
+ Storage createStorage();
+
+ /**
+ * Returns a new object of class '<em>Access</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Access</em>'.
+ * @generated
+ */
+ Access createAccess();
+
+ /**
+ * Returns a new object of class '<em>FMC Model</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>FMC Model</em>'.
+ * @generated
+ */
+ FMCModel createFMCModel();
+
+ /**
+ * Returns a new object of class '<em>Structure Variance</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Structure Variance</em>'.
+ * @generated
+ */
+ StructureVariance createStructureVariance();
+
+ /**
+ * Returns a new object of class '<em>Metadata</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Metadata</em>'.
+ * @generated
+ */
+ Metadata createMetadata();
+
+ /**
+ * Returns a new object of class '<em>Comment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Comment</em>'.
+ * @generated
+ */
+ Comment createComment();
+
+ /**
+ * Returns a new object of class '<em>Stereotype</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Stereotype</em>'.
+ * @generated
+ */
+ Stereotype createStereotype();
+
+ /**
+ * Returns a new object of class '<em>Stereotype Value</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Stereotype Value</em>'.
+ * @generated
+ */
+ StereotypeValue createStereotypeValue();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ FmcPackage getFmcPackage();
+
+} //FmcFactory
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcPackage.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcPackage.java
new file mode 100644
index 0000000..83ae2d5
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/FmcPackage.java
@@ -0,0 +1,2312 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface FmcPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "mm";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://fmc.eclipse.org/0.10.0";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "fmc";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ FmcPackage eINSTANCE = org.eclipse.fmc.mm.impl.FmcPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.FMCElementImpl <em>FMC Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCElementImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCElement()
+ * @generated
+ */
+ int FMC_ELEMENT = 11;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_ELEMENT__NODE_METADATA = 0;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_ELEMENT__STEREOTYPES = 1;
+
+ /**
+ * The number of structural features of the '<em>FMC Element</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_ELEMENT_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.FMCNodeImpl <em>FMC Node</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCNodeImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCNode()
+ * @generated
+ */
+ int FMC_NODE = 3;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__NODE_METADATA = FMC_ELEMENT__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__STEREOTYPES = FMC_ELEMENT__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__NAME = FMC_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Contains</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__CONTAINS = FMC_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__CONTAINER = FMC_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Multiplicity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__MULTIPLICITY = FMC_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE__NEXT_ELEMENT = FMC_ELEMENT_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>FMC Node</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_NODE_FEATURE_COUNT = FMC_ELEMENT_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.AgentImpl <em>Agent</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.AgentImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAgent()
+ * @generated
+ */
+ int AGENT = 0;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__NODE_METADATA = FMC_NODE__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__STEREOTYPES = FMC_NODE__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__NAME = FMC_NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Contains</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__CONTAINS = FMC_NODE__CONTAINS;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__CONTAINER = FMC_NODE__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Multiplicity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__MULTIPLICITY = FMC_NODE__MULTIPLICITY;
+
+ /**
+ * The feature id for the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__NEXT_ELEMENT = FMC_NODE__NEXT_ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Access Connections</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__ACCESS_CONNECTIONS = FMC_NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Human</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__HUMAN = FMC_NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Source Channels</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__SOURCE_CHANNELS = FMC_NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Target Channels</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT__TARGET_CHANNELS = FMC_NODE_FEATURE_COUNT + 3;
+
+ /**
+ * The number of structural features of the '<em>Agent</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AGENT_FEATURE_COUNT = FMC_NODE_FEATURE_COUNT + 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.FMCConnectionImpl <em>FMC Connection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCConnectionImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCConnection()
+ * @generated
+ */
+ int FMC_CONNECTION = 4;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_CONNECTION__NODE_METADATA = FMC_ELEMENT__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_CONNECTION__STEREOTYPES = FMC_ELEMENT__STEREOTYPES;
+
+ /**
+ * The number of structural features of the '<em>FMC Connection</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_CONNECTION_FEATURE_COUNT = FMC_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.ChannelImpl <em>Channel</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.ChannelImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getChannel()
+ * @generated
+ */
+ int CHANNEL = 1;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__NODE_METADATA = FMC_CONNECTION__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__STEREOTYPES = FMC_CONNECTION__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Channel Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__CHANNEL_TYPE = FMC_CONNECTION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Source</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__SOURCE = FMC_CONNECTION_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__TARGET = FMC_CONNECTION_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Dataflow Direction</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__DATAFLOW_DIRECTION = FMC_CONNECTION_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL__NAME = FMC_CONNECTION_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Channel</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CHANNEL_FEATURE_COUNT = FMC_CONNECTION_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.AccessTarget <em>Access Target</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.AccessTarget
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccessTarget()
+ * @generated
+ */
+ int ACCESS_TARGET = 9;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__NODE_METADATA = FMC_NODE__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__STEREOTYPES = FMC_NODE__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__NAME = FMC_NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Contains</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__CONTAINS = FMC_NODE__CONTAINS;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__CONTAINER = FMC_NODE__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Multiplicity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__MULTIPLICITY = FMC_NODE__MULTIPLICITY;
+
+ /**
+ * The feature id for the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__NEXT_ELEMENT = FMC_NODE__NEXT_ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Connections</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET__CONNECTIONS = FMC_NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Access Target</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_TARGET_FEATURE_COUNT = FMC_NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.StorageImpl <em>Storage</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StorageImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStorage()
+ * @generated
+ */
+ int STORAGE = 2;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__NODE_METADATA = ACCESS_TARGET__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__STEREOTYPES = ACCESS_TARGET__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__NAME = ACCESS_TARGET__NAME;
+
+ /**
+ * The feature id for the '<em><b>Contains</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__CONTAINS = ACCESS_TARGET__CONTAINS;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__CONTAINER = ACCESS_TARGET__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Multiplicity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__MULTIPLICITY = ACCESS_TARGET__MULTIPLICITY;
+
+ /**
+ * The feature id for the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__NEXT_ELEMENT = ACCESS_TARGET__NEXT_ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Connections</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE__CONNECTIONS = ACCESS_TARGET__CONNECTIONS;
+
+ /**
+ * The number of structural features of the '<em>Storage</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STORAGE_FEATURE_COUNT = ACCESS_TARGET_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.AccessImpl <em>Access</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.AccessImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccess()
+ * @generated
+ */
+ int ACCESS = 5;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS__NODE_METADATA = FMC_CONNECTION__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS__STEREOTYPES = FMC_CONNECTION__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Agent</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS__AGENT = FMC_CONNECTION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS__TYPE = FMC_CONNECTION_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS__TARGET = FMC_CONNECTION_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Access</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ACCESS_FEATURE_COUNT = FMC_CONNECTION_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.FMCModelImpl <em>FMC Model</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCModelImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCModel()
+ * @generated
+ */
+ int FMC_MODEL = 6;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Nodes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL__NODES = 1;
+
+ /**
+ * The feature id for the '<em><b>Connections</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL__CONNECTIONS = 2;
+
+ /**
+ * The feature id for the '<em><b>Comments</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL__COMMENTS = 3;
+
+ /**
+ * The feature id for the '<em><b>Profile Id</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL__PROFILE_ID = 4;
+
+ /**
+ * The number of structural features of the '<em>FMC Model</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FMC_MODEL_FEATURE_COUNT = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.StructureVarianceImpl <em>Structure Variance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StructureVarianceImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStructureVariance()
+ * @generated
+ */
+ int STRUCTURE_VARIANCE = 7;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__NODE_METADATA = ACCESS_TARGET__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__STEREOTYPES = ACCESS_TARGET__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__NAME = ACCESS_TARGET__NAME;
+
+ /**
+ * The feature id for the '<em><b>Contains</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__CONTAINS = ACCESS_TARGET__CONTAINS;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__CONTAINER = ACCESS_TARGET__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Multiplicity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__MULTIPLICITY = ACCESS_TARGET__MULTIPLICITY;
+
+ /**
+ * The feature id for the '<em><b>Next Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__NEXT_ELEMENT = ACCESS_TARGET__NEXT_ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Connections</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE__CONNECTIONS = ACCESS_TARGET__CONNECTIONS;
+
+ /**
+ * The number of structural features of the '<em>Structure Variance</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STRUCTURE_VARIANCE_FEATURE_COUNT = ACCESS_TARGET_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.MetadataImpl <em>Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.MetadataImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getMetadata()
+ * @generated
+ */
+ int METADATA = 8;
+
+ /**
+ * The feature id for the '<em><b>Creator</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__CREATOR = 0;
+
+ /**
+ * The feature id for the '<em><b>Changer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__CHANGER = 1;
+
+ /**
+ * The feature id for the '<em><b>Creationdate</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__CREATIONDATE = 2;
+
+ /**
+ * The feature id for the '<em><b>Lastchange</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__LASTCHANGE = 3;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__VERSION = 4;
+
+ /**
+ * The feature id for the '<em><b>Language</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA__LANGUAGE = 5;
+
+ /**
+ * The number of structural features of the '<em>Metadata</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int METADATA_FEATURE_COUNT = 6;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.CommentImpl <em>Comment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.CommentImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getComment()
+ * @generated
+ */
+ int COMMENT = 10;
+
+ /**
+ * The feature id for the '<em><b>Node Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT__NODE_METADATA = FMC_ELEMENT__NODE_METADATA;
+
+ /**
+ * The feature id for the '<em><b>Stereotypes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT__STEREOTYPES = FMC_ELEMENT__STEREOTYPES;
+
+ /**
+ * The feature id for the '<em><b>Content</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT__CONTENT = FMC_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Comment Assignment</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT__COMMENT_ASSIGNMENT = FMC_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT__TYPE = FMC_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Comment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMMENT_FEATURE_COUNT = FMC_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.StereotypeImpl <em>Stereotype</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StereotypeImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStereotype()
+ * @generated
+ */
+ int STEREOTYPE = 12;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE__ID = 0;
+
+ /**
+ * The feature id for the '<em><b>Values</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE__VALUES = 1;
+
+ /**
+ * The number of structural features of the '<em>Stereotype</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl <em>Stereotype Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StereotypeValueImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStereotypeValue()
+ * @generated
+ */
+ int STEREOTYPE_VALUE = 13;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_VALUE__ID = 0;
+
+ /**
+ * The feature id for the '<em><b>Value String</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_VALUE__VALUE_STRING = 1;
+
+ /**
+ * The feature id for the '<em><b>Value Boolean</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_VALUE__VALUE_BOOLEAN = 2;
+
+ /**
+ * The feature id for the '<em><b>Value Integer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_VALUE__VALUE_INTEGER = 3;
+
+ /**
+ * The number of structural features of the '<em>Stereotype Value</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STEREOTYPE_VALUE_FEATURE_COUNT = 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.IFMCElementVisitor <em>IFMC Element Visitor</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.IFMCElementVisitor
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getIFMCElementVisitor()
+ * @generated
+ */
+ int IFMC_ELEMENT_VISITOR = 14;
+
+ /**
+ * The number of structural features of the '<em>IFMC Element Visitor</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IFMC_ELEMENT_VISITOR_FEATURE_COUNT = 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.AccessType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccessType()
+ * @generated
+ */
+ int ACCESS_TYPE = 15;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.RequestDirection <em>Request Direction</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.RequestDirection
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getRequestDirection()
+ * @generated
+ */
+ int REQUEST_DIRECTION = 16;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.MultiplicityType <em>Multiplicity Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.MultiplicityType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getMultiplicityType()
+ * @generated
+ */
+ int MULTIPLICITY_TYPE = 17;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.DataflowDirection <em>Dataflow Direction</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.DataflowDirection
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getDataflowDirection()
+ * @generated
+ */
+ int DATAFLOW_DIRECTION = 18;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.fmc.mm.CommentType <em>Comment Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.CommentType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getCommentType()
+ * @generated
+ */
+ int COMMENT_TYPE = 19;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Agent <em>Agent</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Agent</em>'.
+ * @see org.eclipse.fmc.mm.Agent
+ * @generated
+ */
+ EClass getAgent();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.fmc.mm.Agent#getAccessConnections <em>Access Connections</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Access Connections</em>'.
+ * @see org.eclipse.fmc.mm.Agent#getAccessConnections()
+ * @see #getAgent()
+ * @generated
+ */
+ EReference getAgent_AccessConnections();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Agent#isHuman <em>Human</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Human</em>'.
+ * @see org.eclipse.fmc.mm.Agent#isHuman()
+ * @see #getAgent()
+ * @generated
+ */
+ EAttribute getAgent_Human();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.fmc.mm.Agent#getSourceChannels <em>Source Channels</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Source Channels</em>'.
+ * @see org.eclipse.fmc.mm.Agent#getSourceChannels()
+ * @see #getAgent()
+ * @generated
+ */
+ EReference getAgent_SourceChannels();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.fmc.mm.Agent#getTargetChannels <em>Target Channels</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Target Channels</em>'.
+ * @see org.eclipse.fmc.mm.Agent#getTargetChannels()
+ * @see #getAgent()
+ * @generated
+ */
+ EReference getAgent_TargetChannels();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Channel <em>Channel</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Channel</em>'.
+ * @see org.eclipse.fmc.mm.Channel
+ * @generated
+ */
+ EClass getChannel();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Channel#getChannelType <em>Channel Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Channel Type</em>'.
+ * @see org.eclipse.fmc.mm.Channel#getChannelType()
+ * @see #getChannel()
+ * @generated
+ */
+ EAttribute getChannel_ChannelType();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.Channel#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Source</em>'.
+ * @see org.eclipse.fmc.mm.Channel#getSource()
+ * @see #getChannel()
+ * @generated
+ */
+ EReference getChannel_Source();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.Channel#getTarget <em>Target</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Target</em>'.
+ * @see org.eclipse.fmc.mm.Channel#getTarget()
+ * @see #getChannel()
+ * @generated
+ */
+ EReference getChannel_Target();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Channel#getDataflowDirection <em>Dataflow Direction</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Dataflow Direction</em>'.
+ * @see org.eclipse.fmc.mm.Channel#getDataflowDirection()
+ * @see #getChannel()
+ * @generated
+ */
+ EAttribute getChannel_DataflowDirection();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Channel#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.fmc.mm.Channel#getName()
+ * @see #getChannel()
+ * @generated
+ */
+ EAttribute getChannel_Name();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Storage <em>Storage</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Storage</em>'.
+ * @see org.eclipse.fmc.mm.Storage
+ * @generated
+ */
+ EClass getStorage();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.FMCNode <em>FMC Node</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>FMC Node</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode
+ * @generated
+ */
+ EClass getFMCNode();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.FMCNode#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode#getName()
+ * @see #getFMCNode()
+ * @generated
+ */
+ EAttribute getFMCNode_Name();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.FMCNode#getContains <em>Contains</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Contains</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode#getContains()
+ * @see #getFMCNode()
+ * @generated
+ */
+ EReference getFMCNode_Contains();
+
+ /**
+ * Returns the meta object for the container reference '{@link org.eclipse.fmc.mm.FMCNode#getContainer <em>Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the container reference '<em>Container</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode#getContainer()
+ * @see #getFMCNode()
+ * @generated
+ */
+ EReference getFMCNode_Container();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.FMCNode#getMultiplicity <em>Multiplicity</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Multiplicity</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode#getMultiplicity()
+ * @see #getFMCNode()
+ * @generated
+ */
+ EAttribute getFMCNode_Multiplicity();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.FMCNode#getNextElement <em>Next Element</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Next Element</em>'.
+ * @see org.eclipse.fmc.mm.FMCNode#getNextElement()
+ * @see #getFMCNode()
+ * @generated
+ */
+ EReference getFMCNode_NextElement();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.FMCConnection <em>FMC Connection</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>FMC Connection</em>'.
+ * @see org.eclipse.fmc.mm.FMCConnection
+ * @generated
+ */
+ EClass getFMCConnection();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Access <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Access</em>'.
+ * @see org.eclipse.fmc.mm.Access
+ * @generated
+ */
+ EClass getAccess();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.Access#getAgent <em>Agent</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Agent</em>'.
+ * @see org.eclipse.fmc.mm.Access#getAgent()
+ * @see #getAccess()
+ * @generated
+ */
+ EReference getAccess_Agent();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Access#getType <em>Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Type</em>'.
+ * @see org.eclipse.fmc.mm.Access#getType()
+ * @see #getAccess()
+ * @generated
+ */
+ EAttribute getAccess_Type();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.Access#getTarget <em>Target</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Target</em>'.
+ * @see org.eclipse.fmc.mm.Access#getTarget()
+ * @see #getAccess()
+ * @generated
+ */
+ EReference getAccess_Target();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.FMCModel <em>FMC Model</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>FMC Model</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel
+ * @generated
+ */
+ EClass getFMCModel();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.FMCModel#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel#getName()
+ * @see #getFMCModel()
+ * @generated
+ */
+ EAttribute getFMCModel_Name();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.FMCModel#getNodes <em>Nodes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Nodes</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel#getNodes()
+ * @see #getFMCModel()
+ * @generated
+ */
+ EReference getFMCModel_Nodes();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.FMCModel#getConnections <em>Connections</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Connections</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel#getConnections()
+ * @see #getFMCModel()
+ * @generated
+ */
+ EReference getFMCModel_Connections();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.FMCModel#getComments <em>Comments</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Comments</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel#getComments()
+ * @see #getFMCModel()
+ * @generated
+ */
+ EReference getFMCModel_Comments();
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.fmc.mm.FMCModel#getProfileId <em>Profile Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Profile Id</em>'.
+ * @see org.eclipse.fmc.mm.FMCModel#getProfileId()
+ * @see #getFMCModel()
+ * @generated
+ */
+ EAttribute getFMCModel_ProfileId();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.StructureVariance <em>Structure Variance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Structure Variance</em>'.
+ * @see org.eclipse.fmc.mm.StructureVariance
+ * @generated
+ */
+ EClass getStructureVariance();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Metadata <em>Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Metadata</em>'.
+ * @see org.eclipse.fmc.mm.Metadata
+ * @generated
+ */
+ EClass getMetadata();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getCreator <em>Creator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Creator</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getCreator()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Creator();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getChanger <em>Changer</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Changer</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getChanger()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Changer();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getCreationdate <em>Creationdate</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Creationdate</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getCreationdate()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Creationdate();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getLastchange <em>Lastchange</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lastchange</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getLastchange()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Lastchange();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getVersion <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Version</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getVersion()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Version();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Metadata#getLanguage <em>Language</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Language</em>'.
+ * @see org.eclipse.fmc.mm.Metadata#getLanguage()
+ * @see #getMetadata()
+ * @generated
+ */
+ EAttribute getMetadata_Language();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.AccessTarget <em>Access Target</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Access Target</em>'.
+ * @see org.eclipse.fmc.mm.AccessTarget
+ * @generated
+ */
+ EClass getAccessTarget();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.fmc.mm.AccessTarget#getConnections <em>Connections</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Connections</em>'.
+ * @see org.eclipse.fmc.mm.AccessTarget#getConnections()
+ * @see #getAccessTarget()
+ * @generated
+ */
+ EReference getAccessTarget_Connections();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Comment <em>Comment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Comment</em>'.
+ * @see org.eclipse.fmc.mm.Comment
+ * @generated
+ */
+ EClass getComment();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Comment#getContent <em>Content</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Content</em>'.
+ * @see org.eclipse.fmc.mm.Comment#getContent()
+ * @see #getComment()
+ * @generated
+ */
+ EAttribute getComment_Content();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.fmc.mm.Comment#getCommentAssignment <em>Comment Assignment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Comment Assignment</em>'.
+ * @see org.eclipse.fmc.mm.Comment#getCommentAssignment()
+ * @see #getComment()
+ * @generated
+ */
+ EReference getComment_CommentAssignment();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Comment#getType <em>Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Type</em>'.
+ * @see org.eclipse.fmc.mm.Comment#getType()
+ * @see #getComment()
+ * @generated
+ */
+ EAttribute getComment_Type();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.FMCElement <em>FMC Element</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>FMC Element</em>'.
+ * @see org.eclipse.fmc.mm.FMCElement
+ * @generated
+ */
+ EClass getFMCElement();
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.fmc.mm.FMCElement#getNodeMetadata <em>Node Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Node Metadata</em>'.
+ * @see org.eclipse.fmc.mm.FMCElement#getNodeMetadata()
+ * @see #getFMCElement()
+ * @generated
+ */
+ EReference getFMCElement_NodeMetadata();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.FMCElement#getStereotypes <em>Stereotypes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Stereotypes</em>'.
+ * @see org.eclipse.fmc.mm.FMCElement#getStereotypes()
+ * @see #getFMCElement()
+ * @generated
+ */
+ EReference getFMCElement_Stereotypes();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.Stereotype <em>Stereotype</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Stereotype</em>'.
+ * @see org.eclipse.fmc.mm.Stereotype
+ * @generated
+ */
+ EClass getStereotype();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.Stereotype#getId <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Id</em>'.
+ * @see org.eclipse.fmc.mm.Stereotype#getId()
+ * @see #getStereotype()
+ * @generated
+ */
+ EAttribute getStereotype_Id();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.fmc.mm.Stereotype#getValues <em>Values</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Values</em>'.
+ * @see org.eclipse.fmc.mm.Stereotype#getValues()
+ * @see #getStereotype()
+ * @generated
+ */
+ EReference getStereotype_Values();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.StereotypeValue <em>Stereotype Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Stereotype Value</em>'.
+ * @see org.eclipse.fmc.mm.StereotypeValue
+ * @generated
+ */
+ EClass getStereotypeValue();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.StereotypeValue#getId <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Id</em>'.
+ * @see org.eclipse.fmc.mm.StereotypeValue#getId()
+ * @see #getStereotypeValue()
+ * @generated
+ */
+ EAttribute getStereotypeValue_Id();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.StereotypeValue#getValueString <em>Value String</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value String</em>'.
+ * @see org.eclipse.fmc.mm.StereotypeValue#getValueString()
+ * @see #getStereotypeValue()
+ * @generated
+ */
+ EAttribute getStereotypeValue_ValueString();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.StereotypeValue#isValueBoolean <em>Value Boolean</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value Boolean</em>'.
+ * @see org.eclipse.fmc.mm.StereotypeValue#isValueBoolean()
+ * @see #getStereotypeValue()
+ * @generated
+ */
+ EAttribute getStereotypeValue_ValueBoolean();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.fmc.mm.StereotypeValue#getValueInteger <em>Value Integer</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value Integer</em>'.
+ * @see org.eclipse.fmc.mm.StereotypeValue#getValueInteger()
+ * @see #getStereotypeValue()
+ * @generated
+ */
+ EAttribute getStereotypeValue_ValueInteger();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.fmc.mm.IFMCElementVisitor <em>IFMC Element Visitor</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IFMC Element Visitor</em>'.
+ * @see org.eclipse.fmc.mm.IFMCElementVisitor
+ * @generated
+ */
+ EClass getIFMCElementVisitor();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.fmc.mm.AccessType <em>Access Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Access Type</em>'.
+ * @see org.eclipse.fmc.mm.AccessType
+ * @generated
+ */
+ EEnum getAccessType();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.fmc.mm.RequestDirection <em>Request Direction</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Request Direction</em>'.
+ * @see org.eclipse.fmc.mm.RequestDirection
+ * @generated
+ */
+ EEnum getRequestDirection();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.fmc.mm.MultiplicityType <em>Multiplicity Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Multiplicity Type</em>'.
+ * @see org.eclipse.fmc.mm.MultiplicityType
+ * @generated
+ */
+ EEnum getMultiplicityType();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.fmc.mm.DataflowDirection <em>Dataflow Direction</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Dataflow Direction</em>'.
+ * @see org.eclipse.fmc.mm.DataflowDirection
+ * @generated
+ */
+ EEnum getDataflowDirection();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.fmc.mm.CommentType <em>Comment Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Comment Type</em>'.
+ * @see org.eclipse.fmc.mm.CommentType
+ * @generated
+ */
+ EEnum getCommentType();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ FmcFactory getFmcFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.AgentImpl <em>Agent</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.AgentImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAgent()
+ * @generated
+ */
+ EClass AGENT = eINSTANCE.getAgent();
+
+ /**
+ * The meta object literal for the '<em><b>Access Connections</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AGENT__ACCESS_CONNECTIONS = eINSTANCE.getAgent_AccessConnections();
+
+ /**
+ * The meta object literal for the '<em><b>Human</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AGENT__HUMAN = eINSTANCE.getAgent_Human();
+
+ /**
+ * The meta object literal for the '<em><b>Source Channels</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AGENT__SOURCE_CHANNELS = eINSTANCE.getAgent_SourceChannels();
+
+ /**
+ * The meta object literal for the '<em><b>Target Channels</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AGENT__TARGET_CHANNELS = eINSTANCE.getAgent_TargetChannels();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.ChannelImpl <em>Channel</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.ChannelImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getChannel()
+ * @generated
+ */
+ EClass CHANNEL = eINSTANCE.getChannel();
+
+ /**
+ * The meta object literal for the '<em><b>Channel Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CHANNEL__CHANNEL_TYPE = eINSTANCE.getChannel_ChannelType();
+
+ /**
+ * The meta object literal for the '<em><b>Source</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference CHANNEL__SOURCE = eINSTANCE.getChannel_Source();
+
+ /**
+ * The meta object literal for the '<em><b>Target</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference CHANNEL__TARGET = eINSTANCE.getChannel_Target();
+
+ /**
+ * The meta object literal for the '<em><b>Dataflow Direction</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CHANNEL__DATAFLOW_DIRECTION = eINSTANCE.getChannel_DataflowDirection();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CHANNEL__NAME = eINSTANCE.getChannel_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.StorageImpl <em>Storage</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StorageImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStorage()
+ * @generated
+ */
+ EClass STORAGE = eINSTANCE.getStorage();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.FMCNodeImpl <em>FMC Node</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCNodeImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCNode()
+ * @generated
+ */
+ EClass FMC_NODE = eINSTANCE.getFMCNode();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute FMC_NODE__NAME = eINSTANCE.getFMCNode_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Contains</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_NODE__CONTAINS = eINSTANCE.getFMCNode_Contains();
+
+ /**
+ * The meta object literal for the '<em><b>Container</b></em>' container reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_NODE__CONTAINER = eINSTANCE.getFMCNode_Container();
+
+ /**
+ * The meta object literal for the '<em><b>Multiplicity</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute FMC_NODE__MULTIPLICITY = eINSTANCE.getFMCNode_Multiplicity();
+
+ /**
+ * The meta object literal for the '<em><b>Next Element</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_NODE__NEXT_ELEMENT = eINSTANCE.getFMCNode_NextElement();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.FMCConnectionImpl <em>FMC Connection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCConnectionImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCConnection()
+ * @generated
+ */
+ EClass FMC_CONNECTION = eINSTANCE.getFMCConnection();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.AccessImpl <em>Access</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.AccessImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccess()
+ * @generated
+ */
+ EClass ACCESS = eINSTANCE.getAccess();
+
+ /**
+ * The meta object literal for the '<em><b>Agent</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ACCESS__AGENT = eINSTANCE.getAccess_Agent();
+
+ /**
+ * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ACCESS__TYPE = eINSTANCE.getAccess_Type();
+
+ /**
+ * The meta object literal for the '<em><b>Target</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ACCESS__TARGET = eINSTANCE.getAccess_Target();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.FMCModelImpl <em>FMC Model</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCModelImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCModel()
+ * @generated
+ */
+ EClass FMC_MODEL = eINSTANCE.getFMCModel();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute FMC_MODEL__NAME = eINSTANCE.getFMCModel_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Nodes</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_MODEL__NODES = eINSTANCE.getFMCModel_Nodes();
+
+ /**
+ * The meta object literal for the '<em><b>Connections</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_MODEL__CONNECTIONS = eINSTANCE.getFMCModel_Connections();
+
+ /**
+ * The meta object literal for the '<em><b>Comments</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_MODEL__COMMENTS = eINSTANCE.getFMCModel_Comments();
+
+ /**
+ * The meta object literal for the '<em><b>Profile Id</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute FMC_MODEL__PROFILE_ID = eINSTANCE.getFMCModel_ProfileId();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.StructureVarianceImpl <em>Structure Variance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StructureVarianceImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStructureVariance()
+ * @generated
+ */
+ EClass STRUCTURE_VARIANCE = eINSTANCE.getStructureVariance();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.MetadataImpl <em>Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.MetadataImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getMetadata()
+ * @generated
+ */
+ EClass METADATA = eINSTANCE.getMetadata();
+
+ /**
+ * The meta object literal for the '<em><b>Creator</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__CREATOR = eINSTANCE.getMetadata_Creator();
+
+ /**
+ * The meta object literal for the '<em><b>Changer</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__CHANGER = eINSTANCE.getMetadata_Changer();
+
+ /**
+ * The meta object literal for the '<em><b>Creationdate</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__CREATIONDATE = eINSTANCE.getMetadata_Creationdate();
+
+ /**
+ * The meta object literal for the '<em><b>Lastchange</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__LASTCHANGE = eINSTANCE.getMetadata_Lastchange();
+
+ /**
+ * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__VERSION = eINSTANCE.getMetadata_Version();
+
+ /**
+ * The meta object literal for the '<em><b>Language</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute METADATA__LANGUAGE = eINSTANCE.getMetadata_Language();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.AccessTarget <em>Access Target</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.AccessTarget
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccessTarget()
+ * @generated
+ */
+ EClass ACCESS_TARGET = eINSTANCE.getAccessTarget();
+
+ /**
+ * The meta object literal for the '<em><b>Connections</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ACCESS_TARGET__CONNECTIONS = eINSTANCE.getAccessTarget_Connections();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.CommentImpl <em>Comment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.CommentImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getComment()
+ * @generated
+ */
+ EClass COMMENT = eINSTANCE.getComment();
+
+ /**
+ * The meta object literal for the '<em><b>Content</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute COMMENT__CONTENT = eINSTANCE.getComment_Content();
+
+ /**
+ * The meta object literal for the '<em><b>Comment Assignment</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference COMMENT__COMMENT_ASSIGNMENT = eINSTANCE.getComment_CommentAssignment();
+
+ /**
+ * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute COMMENT__TYPE = eINSTANCE.getComment_Type();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.FMCElementImpl <em>FMC Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.FMCElementImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getFMCElement()
+ * @generated
+ */
+ EClass FMC_ELEMENT = eINSTANCE.getFMCElement();
+
+ /**
+ * The meta object literal for the '<em><b>Node Metadata</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_ELEMENT__NODE_METADATA = eINSTANCE.getFMCElement_NodeMetadata();
+
+ /**
+ * The meta object literal for the '<em><b>Stereotypes</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FMC_ELEMENT__STEREOTYPES = eINSTANCE.getFMCElement_Stereotypes();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.StereotypeImpl <em>Stereotype</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StereotypeImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStereotype()
+ * @generated
+ */
+ EClass STEREOTYPE = eINSTANCE.getStereotype();
+
+ /**
+ * The meta object literal for the '<em><b>Id</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STEREOTYPE__ID = eINSTANCE.getStereotype_Id();
+
+ /**
+ * The meta object literal for the '<em><b>Values</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STEREOTYPE__VALUES = eINSTANCE.getStereotype_Values();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl <em>Stereotype Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.impl.StereotypeValueImpl
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getStereotypeValue()
+ * @generated
+ */
+ EClass STEREOTYPE_VALUE = eINSTANCE.getStereotypeValue();
+
+ /**
+ * The meta object literal for the '<em><b>Id</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STEREOTYPE_VALUE__ID = eINSTANCE.getStereotypeValue_Id();
+
+ /**
+ * The meta object literal for the '<em><b>Value String</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STEREOTYPE_VALUE__VALUE_STRING = eINSTANCE.getStereotypeValue_ValueString();
+
+ /**
+ * The meta object literal for the '<em><b>Value Boolean</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STEREOTYPE_VALUE__VALUE_BOOLEAN = eINSTANCE.getStereotypeValue_ValueBoolean();
+
+ /**
+ * The meta object literal for the '<em><b>Value Integer</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STEREOTYPE_VALUE__VALUE_INTEGER = eINSTANCE.getStereotypeValue_ValueInteger();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.IFMCElementVisitor <em>IFMC Element Visitor</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.IFMCElementVisitor
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getIFMCElementVisitor()
+ * @generated
+ */
+ EClass IFMC_ELEMENT_VISITOR = eINSTANCE.getIFMCElementVisitor();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.AccessType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getAccessType()
+ * @generated
+ */
+ EEnum ACCESS_TYPE = eINSTANCE.getAccessType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.RequestDirection <em>Request Direction</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.RequestDirection
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getRequestDirection()
+ * @generated
+ */
+ EEnum REQUEST_DIRECTION = eINSTANCE.getRequestDirection();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.MultiplicityType <em>Multiplicity Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.MultiplicityType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getMultiplicityType()
+ * @generated
+ */
+ EEnum MULTIPLICITY_TYPE = eINSTANCE.getMultiplicityType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.DataflowDirection <em>Dataflow Direction</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.DataflowDirection
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getDataflowDirection()
+ * @generated
+ */
+ EEnum DATAFLOW_DIRECTION = eINSTANCE.getDataflowDirection();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.fmc.mm.CommentType <em>Comment Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.CommentType
+ * @see org.eclipse.fmc.mm.impl.FmcPackageImpl#getCommentType()
+ * @generated
+ */
+ EEnum COMMENT_TYPE = eINSTANCE.getCommentType();
+
+ }
+
+} //FmcPackage
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/IFMCElementVisitor.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/IFMCElementVisitor.java
new file mode 100644
index 0000000..844be1e
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/IFMCElementVisitor.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>IFMC Element Visitor</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getIFMCElementVisitor()
+ * @model interface="true" abstract="true"
+ * @generated
+ */
+public interface IFMCElementVisitor extends EObject {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visit(FMCElement element, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitComment(Comment comment, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitAccess(Access access, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitChannel(Channel channel, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitAgent(Agent agent, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitStorage(Storage storage, Object object);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Object visitStructureVariance(StructureVariance structureVariance, Object object);
+
+} // IFMCElementVisitor
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Metadata.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Metadata.java
new file mode 100644
index 0000000..397b713
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Metadata.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Date;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Metadata</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getCreator <em>Creator</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getChanger <em>Changer</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getCreationdate <em>Creationdate</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getLastchange <em>Lastchange</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getVersion <em>Version</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Metadata#getLanguage <em>Language</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata()
+ * @model
+ * @generated
+ */
+public interface Metadata extends EObject {
+ /**
+ * Returns the value of the '<em><b>Creator</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Creator</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Creator</em>' attribute.
+ * @see #setCreator(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Creator()
+ * @model
+ * @generated
+ */
+ String getCreator();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getCreator <em>Creator</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Creator</em>' attribute.
+ * @see #getCreator()
+ * @generated
+ */
+ void setCreator(String value);
+
+ /**
+ * Returns the value of the '<em><b>Changer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Changer</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Changer</em>' attribute.
+ * @see #setChanger(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Changer()
+ * @model
+ * @generated
+ */
+ String getChanger();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getChanger <em>Changer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Changer</em>' attribute.
+ * @see #getChanger()
+ * @generated
+ */
+ void setChanger(String value);
+
+ /**
+ * Returns the value of the '<em><b>Creationdate</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Creationdate</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Creationdate</em>' attribute.
+ * @see #setCreationdate(Date)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Creationdate()
+ * @model
+ * @generated
+ */
+ Date getCreationdate();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getCreationdate <em>Creationdate</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Creationdate</em>' attribute.
+ * @see #getCreationdate()
+ * @generated
+ */
+ void setCreationdate(Date value);
+
+ /**
+ * Returns the value of the '<em><b>Lastchange</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lastchange</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lastchange</em>' attribute.
+ * @see #setLastchange(Date)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Lastchange()
+ * @model
+ * @generated
+ */
+ Date getLastchange();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getLastchange <em>Lastchange</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lastchange</em>' attribute.
+ * @see #getLastchange()
+ * @generated
+ */
+ void setLastchange(Date value);
+
+ /**
+ * Returns the value of the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Version</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Version</em>' attribute.
+ * @see #setVersion(long)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Version()
+ * @model
+ * @generated
+ */
+ long getVersion();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getVersion <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Version</em>' attribute.
+ * @see #getVersion()
+ * @generated
+ */
+ void setVersion(long value);
+
+ /**
+ * Returns the value of the '<em><b>Language</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Language</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Language</em>' attribute.
+ * @see #setLanguage(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getMetadata_Language()
+ * @model
+ * @generated
+ */
+ String getLanguage();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Metadata#getLanguage <em>Language</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Language</em>' attribute.
+ * @see #getLanguage()
+ * @generated
+ */
+ void setLanguage(String value);
+
+} // Metadata
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/MultiplicityType.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/MultiplicityType.java
new file mode 100644
index 0000000..5be0782
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/MultiplicityType.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Multiplicity Type</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage#getMultiplicityType()
+ * @model
+ * @generated
+ */
+public enum MultiplicityType implements Enumerator {
+ /**
+ * The '<em><b>ONE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #ONE_VALUE
+ * @generated
+ * @ordered
+ */
+ ONE(0, "ONE", "ONE"),
+
+ /**
+ * The '<em><b>MANY</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #MANY_VALUE
+ * @generated
+ * @ordered
+ */
+ MANY(1, "MANY", "MANY");
+
+ /**
+ * The '<em><b>ONE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>ONE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #ONE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_VALUE = 0;
+
+ /**
+ * The '<em><b>MANY</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>MANY</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #MANY
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Multiplicity Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final MultiplicityType[] VALUES_ARRAY =
+ new MultiplicityType[] {
+ ONE,
+ MANY,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Multiplicity Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<MultiplicityType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Multiplicity Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static MultiplicityType get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ MultiplicityType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Multiplicity Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static MultiplicityType getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ MultiplicityType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Multiplicity Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static MultiplicityType get(int value) {
+ switch (value) {
+ case ONE_VALUE: return ONE;
+ case MANY_VALUE: return MANY;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private MultiplicityType(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //MultiplicityType
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/RequestDirection.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/RequestDirection.java
new file mode 100644
index 0000000..66295f8
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/RequestDirection.java
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Request Direction</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage#getRequestDirection()
+ * @model
+ * @generated
+ */
+public enum RequestDirection implements Enumerator {
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED_VALUE
+ * @generated
+ * @ordered
+ */
+ UNSPECIFIED(0, "UNSPECIFIED", "UNSPECIFIED"),
+
+ /**
+ * The '<em><b>REQUEST</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #REQUEST_VALUE
+ * @generated
+ * @ordered
+ */
+ REQUEST(1, "REQUEST", "REQUEST"),
+
+ /**
+ * The '<em><b>RESPONSE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #RESPONSE_VALUE
+ * @generated
+ * @ordered
+ */
+ RESPONSE(2, "RESPONSE", "RESPONSE"),
+
+ /**
+ * The '<em><b>REQUESTRESPONSE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #REQUESTRESPONSE_VALUE
+ * @generated
+ * @ordered
+ */
+ REQUESTRESPONSE(3, "REQUESTRESPONSE", "REQUESTRESPONSE");
+
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>UNSPECIFIED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int UNSPECIFIED_VALUE = 0;
+
+ /**
+ * The '<em><b>REQUEST</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>REQUEST</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #REQUEST
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int REQUEST_VALUE = 1;
+
+ /**
+ * The '<em><b>RESPONSE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>RESPONSE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #RESPONSE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int RESPONSE_VALUE = 2;
+
+ /**
+ * The '<em><b>REQUESTRESPONSE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>REQUESTRESPONSE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #REQUESTRESPONSE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int REQUESTRESPONSE_VALUE = 3;
+
+ /**
+ * An array of all the '<em><b>Request Direction</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final RequestDirection[] VALUES_ARRAY =
+ new RequestDirection[] {
+ UNSPECIFIED,
+ REQUEST,
+ RESPONSE,
+ REQUESTRESPONSE,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Request Direction</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<RequestDirection> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Request Direction</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static RequestDirection get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ RequestDirection result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Request Direction</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static RequestDirection getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ RequestDirection result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Request Direction</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static RequestDirection get(int value) {
+ switch (value) {
+ case UNSPECIFIED_VALUE: return UNSPECIFIED;
+ case REQUEST_VALUE: return REQUEST;
+ case RESPONSE_VALUE: return RESPONSE;
+ case REQUESTRESPONSE_VALUE: return REQUESTRESPONSE;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private RequestDirection(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //RequestDirection
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Stereotype.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Stereotype.java
new file mode 100644
index 0000000..2d95d1f
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Stereotype.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Stereotype</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.Stereotype#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.Stereotype#getValues <em>Values</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotype()
+ * @model
+ * @generated
+ */
+public interface Stereotype extends EObject {
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotype_Id()
+ * @model
+ * @generated
+ */
+ String getId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.Stereotype#getId <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(String value);
+
+ /**
+ * Returns the value of the '<em><b>Values</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.fmc.mm.StereotypeValue}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Values</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Values</em>' containment reference list.
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotype_Values()
+ * @model containment="true"
+ * @generated
+ */
+ EList<StereotypeValue> getValues();
+
+} // Stereotype
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StereotypeValue.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StereotypeValue.java
new file mode 100644
index 0000000..f93195f
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StereotypeValue.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Stereotype Value</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.StereotypeValue#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.StereotypeValue#getValueString <em>Value String</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.StereotypeValue#isValueBoolean <em>Value Boolean</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.StereotypeValue#getValueInteger <em>Value Integer</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotypeValue()
+ * @model
+ * @generated
+ */
+public interface StereotypeValue extends EObject {
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotypeValue_Id()
+ * @model
+ * @generated
+ */
+ String getId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.StereotypeValue#getId <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(String value);
+
+ /**
+ * Returns the value of the '<em><b>Value String</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value String</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value String</em>' attribute.
+ * @see #setValueString(String)
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotypeValue_ValueString()
+ * @model
+ * @generated
+ */
+ String getValueString();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.StereotypeValue#getValueString <em>Value String</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value String</em>' attribute.
+ * @see #getValueString()
+ * @generated
+ */
+ void setValueString(String value);
+
+ /**
+ * Returns the value of the '<em><b>Value Boolean</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value Boolean</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value Boolean</em>' attribute.
+ * @see #setValueBoolean(boolean)
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotypeValue_ValueBoolean()
+ * @model
+ * @generated
+ */
+ boolean isValueBoolean();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.StereotypeValue#isValueBoolean <em>Value Boolean</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value Boolean</em>' attribute.
+ * @see #isValueBoolean()
+ * @generated
+ */
+ void setValueBoolean(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Value Integer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value Integer</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value Integer</em>' attribute.
+ * @see #setValueInteger(int)
+ * @see org.eclipse.fmc.mm.FmcPackage#getStereotypeValue_ValueInteger()
+ * @model
+ * @generated
+ */
+ int getValueInteger();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.fmc.mm.StereotypeValue#getValueInteger <em>Value Integer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value Integer</em>' attribute.
+ * @see #getValueInteger()
+ * @generated
+ */
+ void setValueInteger(int value);
+
+} // StereotypeValue
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Storage.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Storage.java
new file mode 100644
index 0000000..7eb178b
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/Storage.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Storage</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * Storage contains persistent data
+ * <!-- end-model-doc -->
+ *
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getStorage()
+ * @model
+ * @generated
+ */
+public interface Storage extends AccessTarget {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ boolean isShared();
+
+} // Storage
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StructureVariance.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StructureVariance.java
new file mode 100644
index 0000000..15cdb66
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/StructureVariance.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Structure Variance</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.fmc.mm.FmcPackage#getStructureVariance()
+ * @model
+ * @generated
+ */
+public interface StructureVariance extends AccessTarget {
+} // StructureVariance
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AccessImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AccessImpl.java
new file mode 100644
index 0000000..d6cac89
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AccessImpl.java
@@ -0,0 +1,388 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessTarget;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Access</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.AccessImpl#getAgent <em>Agent</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.AccessImpl#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.AccessImpl#getTarget <em>Target</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AccessImpl extends FMCConnectionImpl implements Access {
+ /**
+ * The cached value of the '{@link #getAgent() <em>Agent</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAgent()
+ * @generated
+ * @ordered
+ */
+ protected Agent agent;
+
+ /**
+ * The default value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final AccessType TYPE_EDEFAULT = AccessType.UNSPECIFIED;
+
+ /**
+ * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected AccessType type = TYPE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTarget()
+ * @generated
+ * @ordered
+ */
+ protected AccessTarget target;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AccessImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.ACCESS;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent getAgent() {
+ if (agent != null && agent.eIsProxy()) {
+ InternalEObject oldAgent = (InternalEObject)agent;
+ agent = (Agent)eResolveProxy(oldAgent);
+ if (agent != oldAgent) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.ACCESS__AGENT, oldAgent, agent));
+ }
+ }
+ return agent;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent basicGetAgent() {
+ return agent;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetAgent(Agent newAgent, NotificationChain msgs) {
+ Agent oldAgent = agent;
+ agent = newAgent;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.ACCESS__AGENT, oldAgent, newAgent);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setAgent(Agent newAgent) {
+ if (newAgent != agent) {
+ NotificationChain msgs = null;
+ if (agent != null)
+ msgs = ((InternalEObject)agent).eInverseRemove(this, FmcPackage.AGENT__ACCESS_CONNECTIONS, Agent.class, msgs);
+ if (newAgent != null)
+ msgs = ((InternalEObject)newAgent).eInverseAdd(this, FmcPackage.AGENT__ACCESS_CONNECTIONS, Agent.class, msgs);
+ msgs = basicSetAgent(newAgent, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.ACCESS__AGENT, newAgent, newAgent));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessType getType() {
+ return type;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setType(AccessType newType) {
+ AccessType oldType = type;
+ type = newType == null ? TYPE_EDEFAULT : newType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.ACCESS__TYPE, oldType, type));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessTarget getTarget() {
+ if (target != null && target.eIsProxy()) {
+ InternalEObject oldTarget = (InternalEObject)target;
+ target = (AccessTarget)eResolveProxy(oldTarget);
+ if (target != oldTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.ACCESS__TARGET, oldTarget, target));
+ }
+ }
+ return target;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessTarget basicGetTarget() {
+ return target;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTarget(AccessTarget newTarget, NotificationChain msgs) {
+ AccessTarget oldTarget = target;
+ target = newTarget;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.ACCESS__TARGET, oldTarget, newTarget);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTarget(AccessTarget newTarget) {
+ if (newTarget != target) {
+ NotificationChain msgs = null;
+ if (target != null)
+ msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.ACCESS_TARGET__CONNECTIONS, AccessTarget.class, msgs);
+ if (newTarget != null)
+ msgs = ((InternalEObject)newTarget).eInverseAdd(this, FmcPackage.ACCESS_TARGET__CONNECTIONS, AccessTarget.class, msgs);
+ msgs = basicSetTarget(newTarget, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.ACCESS__TARGET, newTarget, newTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ if (agent != null)
+ msgs = ((InternalEObject)agent).eInverseRemove(this, FmcPackage.AGENT__ACCESS_CONNECTIONS, Agent.class, msgs);
+ return basicSetAgent((Agent)otherEnd, msgs);
+ case FmcPackage.ACCESS__TARGET:
+ if (target != null)
+ msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.ACCESS_TARGET__CONNECTIONS, AccessTarget.class, msgs);
+ return basicSetTarget((AccessTarget)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ return basicSetAgent(null, msgs);
+ case FmcPackage.ACCESS__TARGET:
+ return basicSetTarget(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ if (resolve) return getAgent();
+ return basicGetAgent();
+ case FmcPackage.ACCESS__TYPE:
+ return getType();
+ case FmcPackage.ACCESS__TARGET:
+ if (resolve) return getTarget();
+ return basicGetTarget();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ setAgent((Agent)newValue);
+ return;
+ case FmcPackage.ACCESS__TYPE:
+ setType((AccessType)newValue);
+ return;
+ case FmcPackage.ACCESS__TARGET:
+ setTarget((AccessTarget)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ setAgent((Agent)null);
+ return;
+ case FmcPackage.ACCESS__TYPE:
+ setType(TYPE_EDEFAULT);
+ return;
+ case FmcPackage.ACCESS__TARGET:
+ setTarget((AccessTarget)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.ACCESS__AGENT:
+ return agent != null;
+ case FmcPackage.ACCESS__TYPE:
+ return type != TYPE_EDEFAULT;
+ case FmcPackage.ACCESS__TARGET:
+ return target != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (type: ");
+ result.append(type);
+ result.append(')');
+ return result.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitAccess(this, object);
+ }
+
+} //AccessImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AgentImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AgentImpl.java
new file mode 100644
index 0000000..a3bda01
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/AgentImpl.java
@@ -0,0 +1,347 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Agent</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.AgentImpl#getAccessConnections <em>Access Connections</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.AgentImpl#isHuman <em>Human</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.AgentImpl#getSourceChannels <em>Source Channels</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.AgentImpl#getTargetChannels <em>Target Channels</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AgentImpl extends FMCNodeImpl implements Agent {
+ /**
+ * The cached value of the '{@link #getAccessConnections() <em>Access Connections</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccessConnections()
+ * @generated
+ * @ordered
+ */
+ protected EList<Access> accessConnections;
+
+ /**
+ * The default value of the '{@link #isHuman() <em>Human</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isHuman()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean HUMAN_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isHuman() <em>Human</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isHuman()
+ * @generated
+ * @ordered
+ */
+ protected boolean human = HUMAN_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getSourceChannels() <em>Source Channels</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSourceChannels()
+ * @generated
+ * @ordered
+ */
+ protected EList<Channel> sourceChannels;
+
+ /**
+ * The cached value of the '{@link #getTargetChannels() <em>Target Channels</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetChannels()
+ * @generated
+ * @ordered
+ */
+ protected EList<Channel> targetChannels;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AgentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.AGENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Access> getAccessConnections() {
+ if (accessConnections == null) {
+ accessConnections = new EObjectWithInverseResolvingEList<Access>(Access.class, this, FmcPackage.AGENT__ACCESS_CONNECTIONS, FmcPackage.ACCESS__AGENT);
+ }
+ return accessConnections;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isHuman() {
+ return human;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setHuman(boolean newHuman) {
+ boolean oldHuman = human;
+ human = newHuman;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.AGENT__HUMAN, oldHuman, human));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Channel> getSourceChannels() {
+ if (sourceChannels == null) {
+ sourceChannels = new EObjectWithInverseResolvingEList<Channel>(Channel.class, this, FmcPackage.AGENT__SOURCE_CHANNELS, FmcPackage.CHANNEL__SOURCE);
+ }
+ return sourceChannels;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Channel> getTargetChannels() {
+ if (targetChannels == null) {
+ targetChannels = new EObjectWithInverseResolvingEList<Channel>(Channel.class, this, FmcPackage.AGENT__TARGET_CHANNELS, FmcPackage.CHANNEL__TARGET);
+ }
+ return targetChannels;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getAccessConnections()).basicAdd(otherEnd, msgs);
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getSourceChannels()).basicAdd(otherEnd, msgs);
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getTargetChannels()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ return ((InternalEList<?>)getAccessConnections()).basicRemove(otherEnd, msgs);
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ return ((InternalEList<?>)getSourceChannels()).basicRemove(otherEnd, msgs);
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ return ((InternalEList<?>)getTargetChannels()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ return getAccessConnections();
+ case FmcPackage.AGENT__HUMAN:
+ return isHuman();
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ return getSourceChannels();
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ return getTargetChannels();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ getAccessConnections().clear();
+ getAccessConnections().addAll((Collection<? extends Access>)newValue);
+ return;
+ case FmcPackage.AGENT__HUMAN:
+ setHuman((Boolean)newValue);
+ return;
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ getSourceChannels().clear();
+ getSourceChannels().addAll((Collection<? extends Channel>)newValue);
+ return;
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ getTargetChannels().clear();
+ getTargetChannels().addAll((Collection<? extends Channel>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ getAccessConnections().clear();
+ return;
+ case FmcPackage.AGENT__HUMAN:
+ setHuman(HUMAN_EDEFAULT);
+ return;
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ getSourceChannels().clear();
+ return;
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ getTargetChannels().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.AGENT__ACCESS_CONNECTIONS:
+ return accessConnections != null && !accessConnections.isEmpty();
+ case FmcPackage.AGENT__HUMAN:
+ return human != HUMAN_EDEFAULT;
+ case FmcPackage.AGENT__SOURCE_CHANNELS:
+ return sourceChannels != null && !sourceChannels.isEmpty();
+ case FmcPackage.AGENT__TARGET_CHANNELS:
+ return targetChannels != null && !targetChannels.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (human: ");
+ result.append(human);
+ result.append(')');
+ return result.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitAgent(this, object);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public EList<FMCConnection> getAllConnections() {
+ EList<FMCConnection> allConnections = new BasicEList<FMCConnection>();
+ allConnections.addAll(getSourceChannels());
+ allConnections.addAll(getTargetChannels());
+ allConnections.addAll(getAccessConnections());
+ return allConnections;
+ }
+
+} //AgentImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/ChannelImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/ChannelImpl.java
new file mode 100644
index 0000000..8472a70
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/ChannelImpl.java
@@ -0,0 +1,496 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.RequestDirection;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Channel</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getChannelType <em>Channel Type</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getTarget <em>Target</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getDataflowDirection <em>Dataflow Direction</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ChannelImpl extends FMCConnectionImpl implements Channel {
+ /**
+ * The default value of the '{@link #getChannelType() <em>Channel Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getChannelType()
+ * @generated
+ * @ordered
+ */
+ protected static final RequestDirection CHANNEL_TYPE_EDEFAULT = RequestDirection.UNSPECIFIED;
+
+ /**
+ * The cached value of the '{@link #getChannelType() <em>Channel Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getChannelType()
+ * @generated
+ * @ordered
+ */
+ protected RequestDirection channelType = CHANNEL_TYPE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSource()
+ * @generated
+ * @ordered
+ */
+ protected Agent source;
+
+ /**
+ * The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTarget()
+ * @generated
+ * @ordered
+ */
+ protected Agent target;
+
+ /**
+ * The default value of the '{@link #getDataflowDirection() <em>Dataflow Direction</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDataflowDirection()
+ * @generated
+ * @ordered
+ */
+ protected static final DataflowDirection DATAFLOW_DIRECTION_EDEFAULT = DataflowDirection.UNSPECIFIED;
+
+ /**
+ * The cached value of the '{@link #getDataflowDirection() <em>Dataflow Direction</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDataflowDirection()
+ * @generated
+ * @ordered
+ */
+ protected DataflowDirection dataflowDirection = DATAFLOW_DIRECTION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ChannelImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.CHANNEL;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public RequestDirection getChannelType() {
+ return channelType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setChannelType(RequestDirection newChannelType) {
+ RequestDirection oldChannelType = channelType;
+ channelType = newChannelType == null ? CHANNEL_TYPE_EDEFAULT : newChannelType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__CHANNEL_TYPE, oldChannelType, channelType));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent getSource() {
+ if (source != null && source.eIsProxy()) {
+ InternalEObject oldSource = (InternalEObject)source;
+ source = (Agent)eResolveProxy(oldSource);
+ if (source != oldSource) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.CHANNEL__SOURCE, oldSource, source));
+ }
+ }
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent basicGetSource() {
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSource(Agent newSource, NotificationChain msgs) {
+ Agent oldSource = source;
+ source = newSource;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__SOURCE, oldSource, newSource);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSource(Agent newSource) {
+ if (newSource != source) {
+ NotificationChain msgs = null;
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs);
+ if (newSource != null)
+ msgs = ((InternalEObject)newSource).eInverseAdd(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs);
+ msgs = basicSetSource(newSource, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__SOURCE, newSource, newSource));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent getTarget() {
+ if (target != null && target.eIsProxy()) {
+ InternalEObject oldTarget = (InternalEObject)target;
+ target = (Agent)eResolveProxy(oldTarget);
+ if (target != oldTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.CHANNEL__TARGET, oldTarget, target));
+ }
+ }
+ return target;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent basicGetTarget() {
+ return target;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTarget(Agent newTarget, NotificationChain msgs) {
+ Agent oldTarget = target;
+ target = newTarget;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__TARGET, oldTarget, newTarget);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTarget(Agent newTarget) {
+ if (newTarget != target) {
+ NotificationChain msgs = null;
+ if (target != null)
+ msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs);
+ if (newTarget != null)
+ msgs = ((InternalEObject)newTarget).eInverseAdd(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs);
+ msgs = basicSetTarget(newTarget, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__TARGET, newTarget, newTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataflowDirection getDataflowDirection() {
+ return dataflowDirection;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setDataflowDirection(DataflowDirection newDataflowDirection) {
+ DataflowDirection oldDataflowDirection = dataflowDirection;
+ dataflowDirection = newDataflowDirection == null ? DATAFLOW_DIRECTION_EDEFAULT : newDataflowDirection;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__DATAFLOW_DIRECTION, oldDataflowDirection, dataflowDirection));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__SOURCE:
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs);
+ return basicSetSource((Agent)otherEnd, msgs);
+ case FmcPackage.CHANNEL__TARGET:
+ if (target != null)
+ msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs);
+ return basicSetTarget((Agent)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__SOURCE:
+ return basicSetSource(null, msgs);
+ case FmcPackage.CHANNEL__TARGET:
+ return basicSetTarget(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__CHANNEL_TYPE:
+ return getChannelType();
+ case FmcPackage.CHANNEL__SOURCE:
+ if (resolve) return getSource();
+ return basicGetSource();
+ case FmcPackage.CHANNEL__TARGET:
+ if (resolve) return getTarget();
+ return basicGetTarget();
+ case FmcPackage.CHANNEL__DATAFLOW_DIRECTION:
+ return getDataflowDirection();
+ case FmcPackage.CHANNEL__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__CHANNEL_TYPE:
+ setChannelType((RequestDirection)newValue);
+ return;
+ case FmcPackage.CHANNEL__SOURCE:
+ setSource((Agent)newValue);
+ return;
+ case FmcPackage.CHANNEL__TARGET:
+ setTarget((Agent)newValue);
+ return;
+ case FmcPackage.CHANNEL__DATAFLOW_DIRECTION:
+ setDataflowDirection((DataflowDirection)newValue);
+ return;
+ case FmcPackage.CHANNEL__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__CHANNEL_TYPE:
+ setChannelType(CHANNEL_TYPE_EDEFAULT);
+ return;
+ case FmcPackage.CHANNEL__SOURCE:
+ setSource((Agent)null);
+ return;
+ case FmcPackage.CHANNEL__TARGET:
+ setTarget((Agent)null);
+ return;
+ case FmcPackage.CHANNEL__DATAFLOW_DIRECTION:
+ setDataflowDirection(DATAFLOW_DIRECTION_EDEFAULT);
+ return;
+ case FmcPackage.CHANNEL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.CHANNEL__CHANNEL_TYPE:
+ return channelType != CHANNEL_TYPE_EDEFAULT;
+ case FmcPackage.CHANNEL__SOURCE:
+ return source != null;
+ case FmcPackage.CHANNEL__TARGET:
+ return target != null;
+ case FmcPackage.CHANNEL__DATAFLOW_DIRECTION:
+ return dataflowDirection != DATAFLOW_DIRECTION_EDEFAULT;
+ case FmcPackage.CHANNEL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (channelType: ");
+ result.append(channelType);
+ result.append(", dataflowDirection: ");
+ result.append(dataflowDirection);
+ result.append(", name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitChannel(this, object);
+ }
+
+} //ChannelImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/CommentImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/CommentImpl.java
new file mode 100644
index 0000000..7d49de6
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/CommentImpl.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Comment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getContent <em>Content</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getCommentAssignment <em>Comment Assignment</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getType <em>Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class CommentImpl extends FMCElementImpl implements Comment {
+ /**
+ * The default value of the '{@link #getContent() <em>Content</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContent()
+ * @generated
+ * @ordered
+ */
+ protected static final String CONTENT_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getContent() <em>Content</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContent()
+ * @generated
+ * @ordered
+ */
+ protected String content = CONTENT_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getCommentAssignment() <em>Comment Assignment</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCommentAssignment()
+ * @generated
+ * @ordered
+ */
+ protected FMCElement commentAssignment;
+
+ /**
+ * The default value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final CommentType TYPE_EDEFAULT = CommentType.TEXT;
+
+ /**
+ * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected CommentType type = TYPE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CommentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.COMMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setContent(String newContent) {
+ String oldContent = content;
+ content = newContent;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__CONTENT, oldContent, content));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCElement getCommentAssignment() {
+ if (commentAssignment != null && commentAssignment.eIsProxy()) {
+ InternalEObject oldCommentAssignment = (InternalEObject)commentAssignment;
+ commentAssignment = (FMCElement)eResolveProxy(oldCommentAssignment);
+ if (commentAssignment != oldCommentAssignment) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.COMMENT__COMMENT_ASSIGNMENT, oldCommentAssignment, commentAssignment));
+ }
+ }
+ return commentAssignment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCElement basicGetCommentAssignment() {
+ return commentAssignment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCommentAssignment(FMCElement newCommentAssignment) {
+ FMCElement oldCommentAssignment = commentAssignment;
+ commentAssignment = newCommentAssignment;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__COMMENT_ASSIGNMENT, oldCommentAssignment, commentAssignment));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CommentType getType() {
+ return type;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setType(CommentType newType) {
+ CommentType oldType = type;
+ type = newType == null ? TYPE_EDEFAULT : newType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__TYPE, oldType, type));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.COMMENT__CONTENT:
+ return getContent();
+ case FmcPackage.COMMENT__COMMENT_ASSIGNMENT:
+ if (resolve) return getCommentAssignment();
+ return basicGetCommentAssignment();
+ case FmcPackage.COMMENT__TYPE:
+ return getType();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.COMMENT__CONTENT:
+ setContent((String)newValue);
+ return;
+ case FmcPackage.COMMENT__COMMENT_ASSIGNMENT:
+ setCommentAssignment((FMCElement)newValue);
+ return;
+ case FmcPackage.COMMENT__TYPE:
+ setType((CommentType)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.COMMENT__CONTENT:
+ setContent(CONTENT_EDEFAULT);
+ return;
+ case FmcPackage.COMMENT__COMMENT_ASSIGNMENT:
+ setCommentAssignment((FMCElement)null);
+ return;
+ case FmcPackage.COMMENT__TYPE:
+ setType(TYPE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.COMMENT__CONTENT:
+ return CONTENT_EDEFAULT == null ? content != null : !CONTENT_EDEFAULT.equals(content);
+ case FmcPackage.COMMENT__COMMENT_ASSIGNMENT:
+ return commentAssignment != null;
+ case FmcPackage.COMMENT__TYPE:
+ return type != TYPE_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (content: ");
+ result.append(content);
+ result.append(", type: ");
+ result.append(type);
+ result.append(')');
+ return result.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitComment(this, object);
+ }
+
+} //CommentImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCConnectionImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCConnectionImpl.java
new file mode 100644
index 0000000..d635b26
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCConnectionImpl.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>FMC Connection</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public abstract class FMCConnectionImpl extends FMCElementImpl implements FMCConnection {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FMCConnectionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.FMC_CONNECTION;
+ }
+
+} //FMCConnectionImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCElementImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCElementImpl.java
new file mode 100644
index 0000000..908f767
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCElementImpl.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Metadata;
+import org.eclipse.fmc.mm.Stereotype;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>FMC Element</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCElementImpl#getNodeMetadata <em>Node Metadata</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCElementImpl#getStereotypes <em>Stereotypes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public abstract class FMCElementImpl extends EObjectImpl implements FMCElement {
+ /**
+ * The cached value of the '{@link #getNodeMetadata() <em>Node Metadata</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNodeMetadata()
+ * @generated
+ * @ordered
+ */
+ protected Metadata nodeMetadata;
+
+ /**
+ * The cached value of the '{@link #getStereotypes() <em>Stereotypes</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStereotypes()
+ * @generated
+ * @ordered
+ */
+ protected EList<Stereotype> stereotypes;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FMCElementImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.FMC_ELEMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Metadata getNodeMetadata() {
+ return nodeMetadata;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetNodeMetadata(Metadata newNodeMetadata, NotificationChain msgs) {
+ Metadata oldNodeMetadata = nodeMetadata;
+ nodeMetadata = newNodeMetadata;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_ELEMENT__NODE_METADATA, oldNodeMetadata, newNodeMetadata);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setNodeMetadata(Metadata newNodeMetadata) {
+ if (newNodeMetadata != nodeMetadata) {
+ NotificationChain msgs = null;
+ if (nodeMetadata != null)
+ msgs = ((InternalEObject)nodeMetadata).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FmcPackage.FMC_ELEMENT__NODE_METADATA, null, msgs);
+ if (newNodeMetadata != null)
+ msgs = ((InternalEObject)newNodeMetadata).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FmcPackage.FMC_ELEMENT__NODE_METADATA, null, msgs);
+ msgs = basicSetNodeMetadata(newNodeMetadata, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_ELEMENT__NODE_METADATA, newNodeMetadata, newNodeMetadata));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Stereotype> getStereotypes() {
+ if (stereotypes == null) {
+ stereotypes = new EObjectContainmentEList<Stereotype>(Stereotype.class, this, FmcPackage.FMC_ELEMENT__STEREOTYPES);
+ }
+ return stereotypes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ return basicSetNodeMetadata(null, msgs);
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ return ((InternalEList<?>)getStereotypes()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ return getNodeMetadata();
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ return getStereotypes();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ setNodeMetadata((Metadata)newValue);
+ return;
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ getStereotypes().clear();
+ getStereotypes().addAll((Collection<? extends Stereotype>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ setNodeMetadata((Metadata)null);
+ return;
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ getStereotypes().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_ELEMENT__NODE_METADATA:
+ return nodeMetadata != null;
+ case FmcPackage.FMC_ELEMENT__STEREOTYPES:
+ return stereotypes != null && !stereotypes.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //FMCElementImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCModelImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCModelImpl.java
new file mode 100644
index 0000000..f6610d4
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCModelImpl.java
@@ -0,0 +1,378 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>FMC Model</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCModelImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCModelImpl#getNodes <em>Nodes</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCModelImpl#getConnections <em>Connections</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCModelImpl#getComments <em>Comments</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCModelImpl#getProfileId <em>Profile Id</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class FMCModelImpl extends EObjectImpl implements FMCModel {
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getNodes() <em>Nodes</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNodes()
+ * @generated
+ * @ordered
+ */
+ protected EList<FMCNode> nodes;
+
+ /**
+ * The cached value of the '{@link #getConnections() <em>Connections</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getConnections()
+ * @generated
+ * @ordered
+ */
+ protected EList<FMCConnection> connections;
+
+ /**
+ * The cached value of the '{@link #getComments() <em>Comments</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getComments()
+ * @generated
+ * @ordered
+ */
+ protected EList<Comment> comments;
+
+ /**
+ * The cached value of the '{@link #getProfileId() <em>Profile Id</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProfileId()
+ * @generated
+ * @ordered
+ */
+ protected EList<Object> profileId;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FMCModelImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.FMC_MODEL;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_MODEL__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<FMCNode> getNodes() {
+ if (nodes == null) {
+ nodes = new EObjectContainmentEList<FMCNode>(FMCNode.class, this, FmcPackage.FMC_MODEL__NODES);
+ }
+ return nodes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<FMCConnection> getConnections() {
+ if (connections == null) {
+ connections = new EObjectContainmentEList<FMCConnection>(FMCConnection.class, this, FmcPackage.FMC_MODEL__CONNECTIONS);
+ }
+ return connections;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Comment> getComments() {
+ if (comments == null) {
+ comments = new EObjectContainmentEList<Comment>(Comment.class, this, FmcPackage.FMC_MODEL__COMMENTS);
+ }
+ return comments;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Object> getProfileId() {
+ if (profileId == null) {
+ profileId = new EDataTypeUniqueEList<Object>(Object.class, this, FmcPackage.FMC_MODEL__PROFILE_ID);
+ }
+ return profileId;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public EList<FMCNode> getAllFMCNodes() {
+ BasicEList<FMCNode> list = new BasicEList<FMCNode>();
+ for (FMCNode node : this.getNodes()) {
+ recursiveGetAllFMCNodes(node, list);
+ }
+ return list;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ private void recursiveGetAllFMCNodes(FMCNode node, EList<FMCNode> list) {
+ list.add(node);
+ for (FMCNode subnode : node.getContains()) {
+ recursiveGetAllFMCNodes(subnode, list);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<FMCConnection> getAllFMCConnections() {
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.FMC_MODEL__NODES:
+ return ((InternalEList<?>)getNodes()).basicRemove(otherEnd, msgs);
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ return ((InternalEList<?>)getConnections()).basicRemove(otherEnd, msgs);
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ return ((InternalEList<?>)getComments()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.FMC_MODEL__NAME:
+ return getName();
+ case FmcPackage.FMC_MODEL__NODES:
+ return getNodes();
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ return getConnections();
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ return getComments();
+ case FmcPackage.FMC_MODEL__PROFILE_ID:
+ return getProfileId();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.FMC_MODEL__NAME:
+ setName((String)newValue);
+ return;
+ case FmcPackage.FMC_MODEL__NODES:
+ getNodes().clear();
+ getNodes().addAll((Collection<? extends FMCNode>)newValue);
+ return;
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ getConnections().clear();
+ getConnections().addAll((Collection<? extends FMCConnection>)newValue);
+ return;
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ getComments().clear();
+ getComments().addAll((Collection<? extends Comment>)newValue);
+ return;
+ case FmcPackage.FMC_MODEL__PROFILE_ID:
+ getProfileId().clear();
+ getProfileId().addAll((Collection<? extends Object>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_MODEL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case FmcPackage.FMC_MODEL__NODES:
+ getNodes().clear();
+ return;
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ getConnections().clear();
+ return;
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ getComments().clear();
+ return;
+ case FmcPackage.FMC_MODEL__PROFILE_ID:
+ getProfileId().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_MODEL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case FmcPackage.FMC_MODEL__NODES:
+ return nodes != null && !nodes.isEmpty();
+ case FmcPackage.FMC_MODEL__CONNECTIONS:
+ return connections != null && !connections.isEmpty();
+ case FmcPackage.FMC_MODEL__COMMENTS:
+ return comments != null && !comments.isEmpty();
+ case FmcPackage.FMC_MODEL__PROFILE_ID:
+ return profileId != null && !profileId.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", profileId: ");
+ result.append(profileId);
+ result.append(')');
+ return result.toString();
+ }
+
+} //FMCModelImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCNodeImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCNodeImpl.java
new file mode 100644
index 0000000..c5c1820
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FMCNodeImpl.java
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.MultiplicityType;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>FMC Node</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCNodeImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCNodeImpl#getContains <em>Contains</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCNodeImpl#getContainer <em>Container</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCNodeImpl#getMultiplicity <em>Multiplicity</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.FMCNodeImpl#getNextElement <em>Next Element</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public abstract class FMCNodeImpl extends FMCElementImpl implements FMCNode {
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getContains() <em>Contains</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContains()
+ * @generated
+ * @ordered
+ */
+ protected EList<FMCNode> contains;
+
+ /**
+ * The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMultiplicity()
+ * @generated
+ * @ordered
+ */
+ protected static final MultiplicityType MULTIPLICITY_EDEFAULT = MultiplicityType.ONE;
+
+ /**
+ * The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMultiplicity()
+ * @generated
+ * @ordered
+ */
+ protected MultiplicityType multiplicity = MULTIPLICITY_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getNextElement() <em>Next Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNextElement()
+ * @generated
+ * @ordered
+ */
+ protected FMCNode nextElement;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FMCNodeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.FMC_NODE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_NODE__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<FMCNode> getContains() {
+ if (contains == null) {
+ contains = new EObjectContainmentWithInverseEList<FMCNode>(FMCNode.class, this, FmcPackage.FMC_NODE__CONTAINS, FmcPackage.FMC_NODE__CONTAINER);
+ }
+ return contains;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCNode getContainer() {
+ if (eContainerFeatureID() != FmcPackage.FMC_NODE__CONTAINER) return null;
+ return (FMCNode)eInternalContainer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetContainer(FMCNode newContainer, NotificationChain msgs) {
+ msgs = eBasicSetContainer((InternalEObject)newContainer, FmcPackage.FMC_NODE__CONTAINER, msgs);
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setContainer(FMCNode newContainer) {
+ if (newContainer != eInternalContainer() || (eContainerFeatureID() != FmcPackage.FMC_NODE__CONTAINER && newContainer != null)) {
+ if (EcoreUtil.isAncestor(this, newContainer))
+ throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
+ NotificationChain msgs = null;
+ if (eInternalContainer() != null)
+ msgs = eBasicRemoveFromContainer(msgs);
+ if (newContainer != null)
+ msgs = ((InternalEObject)newContainer).eInverseAdd(this, FmcPackage.FMC_NODE__CONTAINS, FMCNode.class, msgs);
+ msgs = basicSetContainer(newContainer, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_NODE__CONTAINER, newContainer, newContainer));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MultiplicityType getMultiplicity() {
+ return multiplicity;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setMultiplicity(MultiplicityType newMultiplicity) {
+ MultiplicityType oldMultiplicity = multiplicity;
+ multiplicity = newMultiplicity == null ? MULTIPLICITY_EDEFAULT : newMultiplicity;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_NODE__MULTIPLICITY, oldMultiplicity, multiplicity));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCNode getNextElement() {
+ if (nextElement != null && nextElement.eIsProxy()) {
+ InternalEObject oldNextElement = (InternalEObject)nextElement;
+ nextElement = (FMCNode)eResolveProxy(oldNextElement);
+ if (nextElement != oldNextElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.FMC_NODE__NEXT_ELEMENT, oldNextElement, nextElement));
+ }
+ }
+ return nextElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCNode basicGetNextElement() {
+ return nextElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setNextElement(FMCNode newNextElement) {
+ FMCNode oldNextElement = nextElement;
+ nextElement = newNextElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.FMC_NODE__NEXT_ELEMENT, oldNextElement, nextElement));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public EList<? extends FMCConnection> getAllConnections() {
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__CONTAINS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getContains()).basicAdd(otherEnd, msgs);
+ case FmcPackage.FMC_NODE__CONTAINER:
+ if (eInternalContainer() != null)
+ msgs = eBasicRemoveFromContainer(msgs);
+ return basicSetContainer((FMCNode)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__CONTAINS:
+ return ((InternalEList<?>)getContains()).basicRemove(otherEnd, msgs);
+ case FmcPackage.FMC_NODE__CONTAINER:
+ return basicSetContainer(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
+ switch (eContainerFeatureID()) {
+ case FmcPackage.FMC_NODE__CONTAINER:
+ return eInternalContainer().eInverseRemove(this, FmcPackage.FMC_NODE__CONTAINS, FMCNode.class, msgs);
+ }
+ return super.eBasicRemoveFromContainerFeature(msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__NAME:
+ return getName();
+ case FmcPackage.FMC_NODE__CONTAINS:
+ return getContains();
+ case FmcPackage.FMC_NODE__CONTAINER:
+ return getContainer();
+ case FmcPackage.FMC_NODE__MULTIPLICITY:
+ return getMultiplicity();
+ case FmcPackage.FMC_NODE__NEXT_ELEMENT:
+ if (resolve) return getNextElement();
+ return basicGetNextElement();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__NAME:
+ setName((String)newValue);
+ return;
+ case FmcPackage.FMC_NODE__CONTAINS:
+ getContains().clear();
+ getContains().addAll((Collection<? extends FMCNode>)newValue);
+ return;
+ case FmcPackage.FMC_NODE__CONTAINER:
+ setContainer((FMCNode)newValue);
+ return;
+ case FmcPackage.FMC_NODE__MULTIPLICITY:
+ setMultiplicity((MultiplicityType)newValue);
+ return;
+ case FmcPackage.FMC_NODE__NEXT_ELEMENT:
+ setNextElement((FMCNode)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case FmcPackage.FMC_NODE__CONTAINS:
+ getContains().clear();
+ return;
+ case FmcPackage.FMC_NODE__CONTAINER:
+ setContainer((FMCNode)null);
+ return;
+ case FmcPackage.FMC_NODE__MULTIPLICITY:
+ setMultiplicity(MULTIPLICITY_EDEFAULT);
+ return;
+ case FmcPackage.FMC_NODE__NEXT_ELEMENT:
+ setNextElement((FMCNode)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.FMC_NODE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case FmcPackage.FMC_NODE__CONTAINS:
+ return contains != null && !contains.isEmpty();
+ case FmcPackage.FMC_NODE__CONTAINER:
+ return getContainer() != null;
+ case FmcPackage.FMC_NODE__MULTIPLICITY:
+ return multiplicity != MULTIPLICITY_EDEFAULT;
+ case FmcPackage.FMC_NODE__NEXT_ELEMENT:
+ return nextElement != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", multiplicity: ");
+ result.append(multiplicity);
+ result.append(')');
+ return result.toString();
+ }
+
+} //FMCNodeImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcFactoryImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcFactoryImpl.java
new file mode 100644
index 0000000..4ecb19c
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcFactoryImpl.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.fmc.mm.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcFactoryImpl extends EFactoryImpl implements FmcFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static FmcFactory init() {
+ try {
+ FmcFactory theFmcFactory = (FmcFactory)EPackage.Registry.INSTANCE.getEFactory(FmcPackage.eNS_URI);
+ if (theFmcFactory != null) {
+ return theFmcFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new FmcFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case FmcPackage.AGENT: return createAgent();
+ case FmcPackage.CHANNEL: return createChannel();
+ case FmcPackage.STORAGE: return createStorage();
+ case FmcPackage.ACCESS: return createAccess();
+ case FmcPackage.FMC_MODEL: return createFMCModel();
+ case FmcPackage.STRUCTURE_VARIANCE: return createStructureVariance();
+ case FmcPackage.METADATA: return createMetadata();
+ case FmcPackage.COMMENT: return createComment();
+ case FmcPackage.STEREOTYPE: return createStereotype();
+ case FmcPackage.STEREOTYPE_VALUE: return createStereotypeValue();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case FmcPackage.ACCESS_TYPE:
+ return createAccessTypeFromString(eDataType, initialValue);
+ case FmcPackage.REQUEST_DIRECTION:
+ return createRequestDirectionFromString(eDataType, initialValue);
+ case FmcPackage.MULTIPLICITY_TYPE:
+ return createMultiplicityTypeFromString(eDataType, initialValue);
+ case FmcPackage.DATAFLOW_DIRECTION:
+ return createDataflowDirectionFromString(eDataType, initialValue);
+ case FmcPackage.COMMENT_TYPE:
+ return createCommentTypeFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case FmcPackage.ACCESS_TYPE:
+ return convertAccessTypeToString(eDataType, instanceValue);
+ case FmcPackage.REQUEST_DIRECTION:
+ return convertRequestDirectionToString(eDataType, instanceValue);
+ case FmcPackage.MULTIPLICITY_TYPE:
+ return convertMultiplicityTypeToString(eDataType, instanceValue);
+ case FmcPackage.DATAFLOW_DIRECTION:
+ return convertDataflowDirectionToString(eDataType, instanceValue);
+ case FmcPackage.COMMENT_TYPE:
+ return convertCommentTypeToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Agent createAgent() {
+ AgentImpl agent = new AgentImpl();
+ return agent;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Channel createChannel() {
+ ChannelImpl channel = new ChannelImpl();
+ return channel;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Storage createStorage() {
+ StorageImpl storage = new StorageImpl();
+ return storage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Access createAccess() {
+ AccessImpl access = new AccessImpl();
+ return access;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FMCModel createFMCModel() {
+ FMCModelImpl fmcModel = new FMCModelImpl();
+ return fmcModel;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StructureVariance createStructureVariance() {
+ StructureVarianceImpl structureVariance = new StructureVarianceImpl();
+ return structureVariance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Metadata createMetadata() {
+ MetadataImpl metadata = new MetadataImpl();
+ return metadata;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Comment createComment() {
+ CommentImpl comment = new CommentImpl();
+ return comment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Stereotype createStereotype() {
+ StereotypeImpl stereotype = new StereotypeImpl();
+ return stereotype;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StereotypeValue createStereotypeValue() {
+ StereotypeValueImpl stereotypeValue = new StereotypeValueImpl();
+ return stereotypeValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessType createAccessTypeFromString(EDataType eDataType, String initialValue) {
+ AccessType result = AccessType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertAccessTypeToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public RequestDirection createRequestDirectionFromString(EDataType eDataType, String initialValue) {
+ RequestDirection result = RequestDirection.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertRequestDirectionToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MultiplicityType createMultiplicityTypeFromString(EDataType eDataType, String initialValue) {
+ MultiplicityType result = MultiplicityType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertMultiplicityTypeToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataflowDirection createDataflowDirectionFromString(EDataType eDataType, String initialValue) {
+ DataflowDirection result = DataflowDirection.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertDataflowDirectionToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CommentType createCommentTypeFromString(EDataType eDataType, String initialValue) {
+ CommentType result = CommentType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertCommentTypeToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcPackage getFmcPackage() {
+ return (FmcPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static FmcPackage getPackage() {
+ return FmcPackage.eINSTANCE;
+ }
+
+} //FmcFactoryImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcPackageImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcPackageImpl.java
new file mode 100644
index 0000000..f9474c6
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/FmcPackageImpl.java
@@ -0,0 +1,1095 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.AccessTarget;
+import org.eclipse.fmc.mm.AccessType;
+import org.eclipse.fmc.mm.Agent;
+import org.eclipse.fmc.mm.Channel;
+import org.eclipse.fmc.mm.Comment;
+import org.eclipse.fmc.mm.CommentType;
+import org.eclipse.fmc.mm.DataflowDirection;
+import org.eclipse.fmc.mm.FMCConnection;
+import org.eclipse.fmc.mm.FMCElement;
+import org.eclipse.fmc.mm.FMCModel;
+import org.eclipse.fmc.mm.FMCNode;
+import org.eclipse.fmc.mm.FmcFactory;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Metadata;
+import org.eclipse.fmc.mm.MultiplicityType;
+import org.eclipse.fmc.mm.RequestDirection;
+import org.eclipse.fmc.mm.Stereotype;
+import org.eclipse.fmc.mm.StereotypeValue;
+import org.eclipse.fmc.mm.Storage;
+import org.eclipse.fmc.mm.StructureVariance;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FmcPackageImpl extends EPackageImpl implements FmcPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass agentEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass channelEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass storageEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fmcNodeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fmcConnectionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass accessEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fmcModelEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass structureVarianceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass metadataEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass accessTargetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass commentEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fmcElementEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass stereotypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass stereotypeValueEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass ifmcElementVisitorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum accessTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum requestDirectionEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum multiplicityTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum dataflowDirectionEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum commentTypeEEnum = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.fmc.mm.FmcPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private FmcPackageImpl() {
+ super(eNS_URI, FmcFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link FmcPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static FmcPackage init() {
+ if (isInited) return (FmcPackage)EPackage.Registry.INSTANCE.getEPackage(FmcPackage.eNS_URI);
+
+ // Obtain or create and register package
+ FmcPackageImpl theFmcPackage = (FmcPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FmcPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FmcPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theFmcPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theFmcPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theFmcPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(FmcPackage.eNS_URI, theFmcPackage);
+ return theFmcPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getAgent() {
+ return agentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAgent_AccessConnections() {
+ return (EReference)agentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAgent_Human() {
+ return (EAttribute)agentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAgent_SourceChannels() {
+ return (EReference)agentEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAgent_TargetChannels() {
+ return (EReference)agentEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getChannel() {
+ return channelEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getChannel_ChannelType() {
+ return (EAttribute)channelEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getChannel_Source() {
+ return (EReference)channelEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getChannel_Target() {
+ return (EReference)channelEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getChannel_DataflowDirection() {
+ return (EAttribute)channelEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getChannel_Name() {
+ return (EAttribute)channelEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStorage() {
+ return storageEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFMCNode() {
+ return fmcNodeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getFMCNode_Name() {
+ return (EAttribute)fmcNodeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCNode_Contains() {
+ return (EReference)fmcNodeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCNode_Container() {
+ return (EReference)fmcNodeEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getFMCNode_Multiplicity() {
+ return (EAttribute)fmcNodeEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCNode_NextElement() {
+ return (EReference)fmcNodeEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFMCConnection() {
+ return fmcConnectionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getAccess() {
+ return accessEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAccess_Agent() {
+ return (EReference)accessEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAccess_Type() {
+ return (EAttribute)accessEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAccess_Target() {
+ return (EReference)accessEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFMCModel() {
+ return fmcModelEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getFMCModel_Name() {
+ return (EAttribute)fmcModelEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCModel_Nodes() {
+ return (EReference)fmcModelEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCModel_Connections() {
+ return (EReference)fmcModelEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCModel_Comments() {
+ return (EReference)fmcModelEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getFMCModel_ProfileId() {
+ return (EAttribute)fmcModelEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStructureVariance() {
+ return structureVarianceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getMetadata() {
+ return metadataEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Creator() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Changer() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Creationdate() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Lastchange() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Version() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMetadata_Language() {
+ return (EAttribute)metadataEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getAccessTarget() {
+ return accessTargetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAccessTarget_Connections() {
+ return (EReference)accessTargetEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getComment() {
+ return commentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getComment_Content() {
+ return (EAttribute)commentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getComment_CommentAssignment() {
+ return (EReference)commentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getComment_Type() {
+ return (EAttribute)commentEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFMCElement() {
+ return fmcElementEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCElement_NodeMetadata() {
+ return (EReference)fmcElementEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFMCElement_Stereotypes() {
+ return (EReference)fmcElementEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStereotype() {
+ return stereotypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStereotype_Id() {
+ return (EAttribute)stereotypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getStereotype_Values() {
+ return (EReference)stereotypeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStereotypeValue() {
+ return stereotypeValueEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStereotypeValue_Id() {
+ return (EAttribute)stereotypeValueEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStereotypeValue_ValueString() {
+ return (EAttribute)stereotypeValueEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStereotypeValue_ValueBoolean() {
+ return (EAttribute)stereotypeValueEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStereotypeValue_ValueInteger() {
+ return (EAttribute)stereotypeValueEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIFMCElementVisitor() {
+ return ifmcElementVisitorEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getAccessType() {
+ return accessTypeEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getRequestDirection() {
+ return requestDirectionEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getMultiplicityType() {
+ return multiplicityTypeEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getDataflowDirection() {
+ return dataflowDirectionEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getCommentType() {
+ return commentTypeEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcFactory getFmcFactory() {
+ return (FmcFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ agentEClass = createEClass(AGENT);
+ createEReference(agentEClass, AGENT__ACCESS_CONNECTIONS);
+ createEAttribute(agentEClass, AGENT__HUMAN);
+ createEReference(agentEClass, AGENT__SOURCE_CHANNELS);
+ createEReference(agentEClass, AGENT__TARGET_CHANNELS);
+
+ channelEClass = createEClass(CHANNEL);
+ createEAttribute(channelEClass, CHANNEL__CHANNEL_TYPE);
+ createEReference(channelEClass, CHANNEL__SOURCE);
+ createEReference(channelEClass, CHANNEL__TARGET);
+ createEAttribute(channelEClass, CHANNEL__DATAFLOW_DIRECTION);
+ createEAttribute(channelEClass, CHANNEL__NAME);
+
+ storageEClass = createEClass(STORAGE);
+
+ fmcNodeEClass = createEClass(FMC_NODE);
+ createEAttribute(fmcNodeEClass, FMC_NODE__NAME);
+ createEReference(fmcNodeEClass, FMC_NODE__CONTAINS);
+ createEReference(fmcNodeEClass, FMC_NODE__CONTAINER);
+ createEAttribute(fmcNodeEClass, FMC_NODE__MULTIPLICITY);
+ createEReference(fmcNodeEClass, FMC_NODE__NEXT_ELEMENT);
+
+ fmcConnectionEClass = createEClass(FMC_CONNECTION);
+
+ accessEClass = createEClass(ACCESS);
+ createEReference(accessEClass, ACCESS__AGENT);
+ createEAttribute(accessEClass, ACCESS__TYPE);
+ createEReference(accessEClass, ACCESS__TARGET);
+
+ fmcModelEClass = createEClass(FMC_MODEL);
+ createEAttribute(fmcModelEClass, FMC_MODEL__NAME);
+ createEReference(fmcModelEClass, FMC_MODEL__NODES);
+ createEReference(fmcModelEClass, FMC_MODEL__CONNECTIONS);
+ createEReference(fmcModelEClass, FMC_MODEL__COMMENTS);
+ createEAttribute(fmcModelEClass, FMC_MODEL__PROFILE_ID);
+
+ structureVarianceEClass = createEClass(STRUCTURE_VARIANCE);
+
+ metadataEClass = createEClass(METADATA);
+ createEAttribute(metadataEClass, METADATA__CREATOR);
+ createEAttribute(metadataEClass, METADATA__CHANGER);
+ createEAttribute(metadataEClass, METADATA__CREATIONDATE);
+ createEAttribute(metadataEClass, METADATA__LASTCHANGE);
+ createEAttribute(metadataEClass, METADATA__VERSION);
+ createEAttribute(metadataEClass, METADATA__LANGUAGE);
+
+ accessTargetEClass = createEClass(ACCESS_TARGET);
+ createEReference(accessTargetEClass, ACCESS_TARGET__CONNECTIONS);
+
+ commentEClass = createEClass(COMMENT);
+ createEAttribute(commentEClass, COMMENT__CONTENT);
+ createEReference(commentEClass, COMMENT__COMMENT_ASSIGNMENT);
+ createEAttribute(commentEClass, COMMENT__TYPE);
+
+ fmcElementEClass = createEClass(FMC_ELEMENT);
+ createEReference(fmcElementEClass, FMC_ELEMENT__NODE_METADATA);
+ createEReference(fmcElementEClass, FMC_ELEMENT__STEREOTYPES);
+
+ stereotypeEClass = createEClass(STEREOTYPE);
+ createEAttribute(stereotypeEClass, STEREOTYPE__ID);
+ createEReference(stereotypeEClass, STEREOTYPE__VALUES);
+
+ stereotypeValueEClass = createEClass(STEREOTYPE_VALUE);
+ createEAttribute(stereotypeValueEClass, STEREOTYPE_VALUE__ID);
+ createEAttribute(stereotypeValueEClass, STEREOTYPE_VALUE__VALUE_STRING);
+ createEAttribute(stereotypeValueEClass, STEREOTYPE_VALUE__VALUE_BOOLEAN);
+ createEAttribute(stereotypeValueEClass, STEREOTYPE_VALUE__VALUE_INTEGER);
+
+ ifmcElementVisitorEClass = createEClass(IFMC_ELEMENT_VISITOR);
+
+ // Create enums
+ accessTypeEEnum = createEEnum(ACCESS_TYPE);
+ requestDirectionEEnum = createEEnum(REQUEST_DIRECTION);
+ multiplicityTypeEEnum = createEEnum(MULTIPLICITY_TYPE);
+ dataflowDirectionEEnum = createEEnum(DATAFLOW_DIRECTION);
+ commentTypeEEnum = createEEnum(COMMENT_TYPE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ agentEClass.getESuperTypes().add(this.getFMCNode());
+ channelEClass.getESuperTypes().add(this.getFMCConnection());
+ storageEClass.getESuperTypes().add(this.getAccessTarget());
+ fmcNodeEClass.getESuperTypes().add(this.getFMCElement());
+ fmcConnectionEClass.getESuperTypes().add(this.getFMCElement());
+ accessEClass.getESuperTypes().add(this.getFMCConnection());
+ structureVarianceEClass.getESuperTypes().add(this.getAccessTarget());
+ accessTargetEClass.getESuperTypes().add(this.getFMCNode());
+ commentEClass.getESuperTypes().add(this.getFMCElement());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(agentEClass, Agent.class, "Agent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAgent_AccessConnections(), this.getAccess(), this.getAccess_Agent(), "accessConnections", null, 0, -1, Agent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAgent_Human(), theEcorePackage.getEBoolean(), "human", null, 0, 1, Agent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAgent_SourceChannels(), this.getChannel(), this.getChannel_Source(), "sourceChannels", null, 0, -1, Agent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAgent_TargetChannels(), this.getChannel(), this.getChannel_Target(), "targetChannels", null, 0, -1, Agent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(channelEClass, Channel.class, "Channel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getChannel_ChannelType(), this.getRequestDirection(), "channelType", null, 1, 1, Channel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getChannel_Source(), this.getAgent(), this.getAgent_SourceChannels(), "source", null, 1, 1, Channel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getChannel_Target(), this.getAgent(), this.getAgent_TargetChannels(), "target", null, 1, 1, Channel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getChannel_DataflowDirection(), this.getDataflowDirection(), "dataflowDirection", null, 0, 1, Channel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getChannel_Name(), theEcorePackage.getEString(), "name", null, 0, 1, Channel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(storageEClass, Storage.class, "Storage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ addEOperation(storageEClass, ecorePackage.getEBoolean(), "isShared", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ initEClass(fmcNodeEClass, FMCNode.class, "FMCNode", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getFMCNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, FMCNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCNode_Contains(), this.getFMCNode(), this.getFMCNode_Container(), "contains", null, 0, -1, FMCNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCNode_Container(), this.getFMCNode(), this.getFMCNode_Contains(), "container", null, 0, 1, FMCNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getFMCNode_Multiplicity(), this.getMultiplicityType(), "multiplicity", null, 0, 1, FMCNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCNode_NextElement(), this.getFMCNode(), null, "nextElement", null, 0, 1, FMCNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ addEOperation(fmcNodeEClass, this.getFMCConnection(), "getAllConnections", 0, -1, IS_UNIQUE, !IS_ORDERED);
+
+ initEClass(fmcConnectionEClass, FMCConnection.class, "FMCConnection", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(accessEClass, Access.class, "Access", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAccess_Agent(), this.getAgent(), this.getAgent_AccessConnections(), "agent", null, 1, 1, Access.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAccess_Type(), this.getAccessType(), "type", null, 1, 1, Access.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAccess_Target(), this.getAccessTarget(), this.getAccessTarget_Connections(), "target", null, 1, 1, Access.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(fmcModelEClass, FMCModel.class, "FMCModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getFMCModel_Name(), ecorePackage.getEString(), "name", null, 0, 1, FMCModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCModel_Nodes(), this.getFMCNode(), null, "nodes", null, 0, -1, FMCModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCModel_Connections(), this.getFMCConnection(), null, "connections", null, 0, -1, FMCModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCModel_Comments(), this.getComment(), null, "comments", null, 0, -1, FMCModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getFMCModel_ProfileId(), ecorePackage.getEJavaObject(), "profileId", null, 0, -1, FMCModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ addEOperation(fmcModelEClass, this.getFMCNode(), "getAllFMCNodes", 0, -1, IS_UNIQUE, IS_ORDERED);
+
+ addEOperation(fmcModelEClass, this.getFMCConnection(), "getAllFMCConnections", 0, -1, IS_UNIQUE, IS_ORDERED);
+
+ initEClass(structureVarianceEClass, StructureVariance.class, "StructureVariance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(metadataEClass, Metadata.class, "Metadata", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getMetadata_Creator(), theEcorePackage.getEString(), "creator", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMetadata_Changer(), theEcorePackage.getEString(), "changer", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMetadata_Creationdate(), theEcorePackage.getEDate(), "creationdate", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMetadata_Lastchange(), theEcorePackage.getEDate(), "lastchange", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMetadata_Version(), theEcorePackage.getELong(), "version", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMetadata_Language(), theEcorePackage.getEString(), "language", null, 0, 1, Metadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(accessTargetEClass, AccessTarget.class, "AccessTarget", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAccessTarget_Connections(), this.getAccess(), this.getAccess_Target(), "connections", null, 0, -1, AccessTarget.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(commentEClass, Comment.class, "Comment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getComment_Content(), theEcorePackage.getEString(), "content", null, 0, 1, Comment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getComment_CommentAssignment(), this.getFMCElement(), null, "commentAssignment", null, 0, 1, Comment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getComment_Type(), this.getCommentType(), "type", null, 0, 1, Comment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(fmcElementEClass, FMCElement.class, "FMCElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getFMCElement_NodeMetadata(), this.getMetadata(), null, "nodeMetadata", null, 0, 1, FMCElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFMCElement_Stereotypes(), this.getStereotype(), null, "stereotypes", null, 0, -1, FMCElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ EOperation op = addEOperation(fmcElementEClass, ecorePackage.getEJavaObject(), "accept", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getIFMCElementVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ initEClass(stereotypeEClass, Stereotype.class, "Stereotype", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getStereotype_Id(), theEcorePackage.getEString(), "id", null, 0, 1, Stereotype.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getStereotype_Values(), this.getStereotypeValue(), null, "values", null, 0, -1, Stereotype.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(stereotypeValueEClass, StereotypeValue.class, "StereotypeValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getStereotypeValue_Id(), theEcorePackage.getEString(), "id", null, 0, 1, StereotypeValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getStereotypeValue_ValueString(), theEcorePackage.getEString(), "valueString", null, 0, 1, StereotypeValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getStereotypeValue_ValueBoolean(), theEcorePackage.getEBoolean(), "valueBoolean", null, 0, 1, StereotypeValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getStereotypeValue_ValueInteger(), theEcorePackage.getEInt(), "valueInteger", null, 0, 1, StereotypeValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(ifmcElementVisitorEClass, IFMCElementVisitor.class, "IFMCElementVisitor", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visit", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getFMCElement(), "element", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, theEcorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitComment", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getComment(), "comment", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitAccess", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getAccess(), "access", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitChannel", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getChannel(), "channel", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitAgent", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getAgent(), "agent", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitStorage", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getStorage(), "storage", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ op = addEOperation(ifmcElementVisitorEClass, ecorePackage.getEJavaObject(), "visitStructureVariance", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getStructureVariance(), "structureVariance", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(accessTypeEEnum, AccessType.class, "AccessType");
+ addEEnumLiteral(accessTypeEEnum, AccessType.UNSPECIFIED);
+ addEEnumLiteral(accessTypeEEnum, AccessType.READ);
+ addEEnumLiteral(accessTypeEEnum, AccessType.WRITE);
+ addEEnumLiteral(accessTypeEEnum, AccessType.RW);
+
+ initEEnum(requestDirectionEEnum, RequestDirection.class, "RequestDirection");
+ addEEnumLiteral(requestDirectionEEnum, RequestDirection.UNSPECIFIED);
+ addEEnumLiteral(requestDirectionEEnum, RequestDirection.REQUEST);
+ addEEnumLiteral(requestDirectionEEnum, RequestDirection.RESPONSE);
+ addEEnumLiteral(requestDirectionEEnum, RequestDirection.REQUESTRESPONSE);
+
+ initEEnum(multiplicityTypeEEnum, MultiplicityType.class, "MultiplicityType");
+ addEEnumLiteral(multiplicityTypeEEnum, MultiplicityType.ONE);
+ addEEnumLiteral(multiplicityTypeEEnum, MultiplicityType.MANY);
+
+ initEEnum(dataflowDirectionEEnum, DataflowDirection.class, "DataflowDirection");
+ addEEnumLiteral(dataflowDirectionEEnum, DataflowDirection.UNSPECIFIED);
+ addEEnumLiteral(dataflowDirectionEEnum, DataflowDirection.DEFAULT);
+ addEEnumLiteral(dataflowDirectionEEnum, DataflowDirection.OTHER);
+
+ initEEnum(commentTypeEEnum, CommentType.class, "CommentType");
+ addEEnumLiteral(commentTypeEEnum, CommentType.TEXT);
+ addEEnumLiteral(commentTypeEEnum, CommentType.IMAGE);
+ addEEnumLiteral(commentTypeEEnum, CommentType.OTHER);
+ addEEnumLiteral(commentTypeEEnum, CommentType.BRACE);
+ addEEnumLiteral(commentTypeEEnum, CommentType.AREABORDER);
+ addEEnumLiteral(commentTypeEEnum, CommentType.COMMONFEATUREAREA);
+ addEEnumLiteral(commentTypeEEnum, CommentType.DOTS);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //FmcPackageImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/MetadataImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/MetadataImpl.java
new file mode 100644
index 0000000..0d7e4c4
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/MetadataImpl.java
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Date;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.Metadata;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Metadata</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getCreator <em>Creator</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getChanger <em>Changer</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getCreationdate <em>Creationdate</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getLastchange <em>Lastchange</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getVersion <em>Version</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.MetadataImpl#getLanguage <em>Language</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class MetadataImpl extends EObjectImpl implements Metadata {
+ /**
+ * The default value of the '{@link #getCreator() <em>Creator</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreator()
+ * @generated
+ * @ordered
+ */
+ protected static final String CREATOR_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCreator() <em>Creator</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreator()
+ * @generated
+ * @ordered
+ */
+ protected String creator = CREATOR_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getChanger() <em>Changer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getChanger()
+ * @generated
+ * @ordered
+ */
+ protected static final String CHANGER_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getChanger() <em>Changer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getChanger()
+ * @generated
+ * @ordered
+ */
+ protected String changer = CHANGER_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getCreationdate() <em>Creationdate</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreationdate()
+ * @generated
+ * @ordered
+ */
+ protected static final Date CREATIONDATE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCreationdate() <em>Creationdate</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreationdate()
+ * @generated
+ * @ordered
+ */
+ protected Date creationdate = CREATIONDATE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLastchange() <em>Lastchange</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastchange()
+ * @generated
+ * @ordered
+ */
+ protected static final Date LASTCHANGE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLastchange() <em>Lastchange</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastchange()
+ * @generated
+ * @ordered
+ */
+ protected Date lastchange = LASTCHANGE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected static final long VERSION_EDEFAULT = 0L;
+
+ /**
+ * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected long version = VERSION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLanguage() <em>Language</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLanguage()
+ * @generated
+ * @ordered
+ */
+ protected static final String LANGUAGE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLanguage() <em>Language</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLanguage()
+ * @generated
+ * @ordered
+ */
+ protected String language = LANGUAGE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MetadataImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.METADATA;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getCreator() {
+ return creator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCreator(String newCreator) {
+ String oldCreator = creator;
+ creator = newCreator;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__CREATOR, oldCreator, creator));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getChanger() {
+ return changer;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setChanger(String newChanger) {
+ String oldChanger = changer;
+ changer = newChanger;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__CHANGER, oldChanger, changer));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Date getCreationdate() {
+ return creationdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCreationdate(Date newCreationdate) {
+ Date oldCreationdate = creationdate;
+ creationdate = newCreationdate;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__CREATIONDATE, oldCreationdate, creationdate));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Date getLastchange() {
+ return lastchange;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLastchange(Date newLastchange) {
+ Date oldLastchange = lastchange;
+ lastchange = newLastchange;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__LASTCHANGE, oldLastchange, lastchange));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public long getVersion() {
+ return version;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setVersion(long newVersion) {
+ long oldVersion = version;
+ version = newVersion;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__VERSION, oldVersion, version));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLanguage() {
+ return language;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLanguage(String newLanguage) {
+ String oldLanguage = language;
+ language = newLanguage;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.METADATA__LANGUAGE, oldLanguage, language));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.METADATA__CREATOR:
+ return getCreator();
+ case FmcPackage.METADATA__CHANGER:
+ return getChanger();
+ case FmcPackage.METADATA__CREATIONDATE:
+ return getCreationdate();
+ case FmcPackage.METADATA__LASTCHANGE:
+ return getLastchange();
+ case FmcPackage.METADATA__VERSION:
+ return getVersion();
+ case FmcPackage.METADATA__LANGUAGE:
+ return getLanguage();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.METADATA__CREATOR:
+ setCreator((String)newValue);
+ return;
+ case FmcPackage.METADATA__CHANGER:
+ setChanger((String)newValue);
+ return;
+ case FmcPackage.METADATA__CREATIONDATE:
+ setCreationdate((Date)newValue);
+ return;
+ case FmcPackage.METADATA__LASTCHANGE:
+ setLastchange((Date)newValue);
+ return;
+ case FmcPackage.METADATA__VERSION:
+ setVersion((Long)newValue);
+ return;
+ case FmcPackage.METADATA__LANGUAGE:
+ setLanguage((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.METADATA__CREATOR:
+ setCreator(CREATOR_EDEFAULT);
+ return;
+ case FmcPackage.METADATA__CHANGER:
+ setChanger(CHANGER_EDEFAULT);
+ return;
+ case FmcPackage.METADATA__CREATIONDATE:
+ setCreationdate(CREATIONDATE_EDEFAULT);
+ return;
+ case FmcPackage.METADATA__LASTCHANGE:
+ setLastchange(LASTCHANGE_EDEFAULT);
+ return;
+ case FmcPackage.METADATA__VERSION:
+ setVersion(VERSION_EDEFAULT);
+ return;
+ case FmcPackage.METADATA__LANGUAGE:
+ setLanguage(LANGUAGE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.METADATA__CREATOR:
+ return CREATOR_EDEFAULT == null ? creator != null : !CREATOR_EDEFAULT.equals(creator);
+ case FmcPackage.METADATA__CHANGER:
+ return CHANGER_EDEFAULT == null ? changer != null : !CHANGER_EDEFAULT.equals(changer);
+ case FmcPackage.METADATA__CREATIONDATE:
+ return CREATIONDATE_EDEFAULT == null ? creationdate != null : !CREATIONDATE_EDEFAULT.equals(creationdate);
+ case FmcPackage.METADATA__LASTCHANGE:
+ return LASTCHANGE_EDEFAULT == null ? lastchange != null : !LASTCHANGE_EDEFAULT.equals(lastchange);
+ case FmcPackage.METADATA__VERSION:
+ return version != VERSION_EDEFAULT;
+ case FmcPackage.METADATA__LANGUAGE:
+ return LANGUAGE_EDEFAULT == null ? language != null : !LANGUAGE_EDEFAULT.equals(language);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (creator: ");
+ result.append(creator);
+ result.append(", changer: ");
+ result.append(changer);
+ result.append(", creationdate: ");
+ result.append(creationdate);
+ result.append(", lastchange: ");
+ result.append(lastchange);
+ result.append(", version: ");
+ result.append(version);
+ result.append(", language: ");
+ result.append(language);
+ result.append(')');
+ return result.toString();
+ }
+
+} //MetadataImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeImpl.java
new file mode 100644
index 0000000..02479da
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeImpl.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.Stereotype;
+import org.eclipse.fmc.mm.StereotypeValue;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Stereotype</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeImpl#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeImpl#getValues <em>Values</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StereotypeImpl extends EObjectImpl implements Stereotype {
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getValues() <em>Values</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValues()
+ * @generated
+ * @ordered
+ */
+ protected EList<StereotypeValue> values;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StereotypeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.STEREOTYPE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setId(String newId) {
+ String oldId = id;
+ id = newId;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.STEREOTYPE__ID, oldId, id));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<StereotypeValue> getValues() {
+ if (values == null) {
+ values = new EObjectContainmentEList<StereotypeValue>(StereotypeValue.class, this, FmcPackage.STEREOTYPE__VALUES);
+ }
+ return values;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE__VALUES:
+ return ((InternalEList<?>)getValues()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE__ID:
+ return getId();
+ case FmcPackage.STEREOTYPE__VALUES:
+ return getValues();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE__ID:
+ setId((String)newValue);
+ return;
+ case FmcPackage.STEREOTYPE__VALUES:
+ getValues().clear();
+ getValues().addAll((Collection<? extends StereotypeValue>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE__ID:
+ setId(ID_EDEFAULT);
+ return;
+ case FmcPackage.STEREOTYPE__VALUES:
+ getValues().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE__ID:
+ return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
+ case FmcPackage.STEREOTYPE__VALUES:
+ return values != null && !values.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (id: ");
+ result.append(id);
+ result.append(')');
+ return result.toString();
+ }
+
+} //StereotypeImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeValueImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeValueImpl.java
new file mode 100644
index 0000000..6a974a9
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StereotypeValueImpl.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.StereotypeValue;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Stereotype Value</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl#getValueString <em>Value String</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl#isValueBoolean <em>Value Boolean</em>}</li>
+ * <li>{@link org.eclipse.fmc.mm.impl.StereotypeValueImpl#getValueInteger <em>Value Integer</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StereotypeValueImpl extends EObjectImpl implements StereotypeValue {
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getValueString() <em>Value String</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueString()
+ * @generated
+ * @ordered
+ */
+ protected static final String VALUE_STRING_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getValueString() <em>Value String</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueString()
+ * @generated
+ * @ordered
+ */
+ protected String valueString = VALUE_STRING_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isValueBoolean() <em>Value Boolean</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isValueBoolean()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean VALUE_BOOLEAN_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isValueBoolean() <em>Value Boolean</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isValueBoolean()
+ * @generated
+ * @ordered
+ */
+ protected boolean valueBoolean = VALUE_BOOLEAN_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getValueInteger() <em>Value Integer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueInteger()
+ * @generated
+ * @ordered
+ */
+ protected static final int VALUE_INTEGER_EDEFAULT = 0;
+
+ /**
+ * The cached value of the '{@link #getValueInteger() <em>Value Integer</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueInteger()
+ * @generated
+ * @ordered
+ */
+ protected int valueInteger = VALUE_INTEGER_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StereotypeValueImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.STEREOTYPE_VALUE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setId(String newId) {
+ String oldId = id;
+ id = newId;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.STEREOTYPE_VALUE__ID, oldId, id));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getValueString() {
+ return valueString;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueString(String newValueString) {
+ String oldValueString = valueString;
+ valueString = newValueString;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.STEREOTYPE_VALUE__VALUE_STRING, oldValueString, valueString));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isValueBoolean() {
+ return valueBoolean;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueBoolean(boolean newValueBoolean) {
+ boolean oldValueBoolean = valueBoolean;
+ valueBoolean = newValueBoolean;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN, oldValueBoolean, valueBoolean));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValueInteger() {
+ return valueInteger;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueInteger(int newValueInteger) {
+ int oldValueInteger = valueInteger;
+ valueInteger = newValueInteger;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER, oldValueInteger, valueInteger));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE_VALUE__ID:
+ return getId();
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_STRING:
+ return getValueString();
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN:
+ return isValueBoolean();
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER:
+ return getValueInteger();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE_VALUE__ID:
+ setId((String)newValue);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_STRING:
+ setValueString((String)newValue);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN:
+ setValueBoolean((Boolean)newValue);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER:
+ setValueInteger((Integer)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE_VALUE__ID:
+ setId(ID_EDEFAULT);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_STRING:
+ setValueString(VALUE_STRING_EDEFAULT);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN:
+ setValueBoolean(VALUE_BOOLEAN_EDEFAULT);
+ return;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER:
+ setValueInteger(VALUE_INTEGER_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STEREOTYPE_VALUE__ID:
+ return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_STRING:
+ return VALUE_STRING_EDEFAULT == null ? valueString != null : !VALUE_STRING_EDEFAULT.equals(valueString);
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_BOOLEAN:
+ return valueBoolean != VALUE_BOOLEAN_EDEFAULT;
+ case FmcPackage.STEREOTYPE_VALUE__VALUE_INTEGER:
+ return valueInteger != VALUE_INTEGER_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (id: ");
+ result.append(id);
+ result.append(", valueString: ");
+ result.append(valueString);
+ result.append(", valueBoolean: ");
+ result.append(valueBoolean);
+ result.append(", valueInteger: ");
+ result.append(valueInteger);
+ result.append(')');
+ return result.toString();
+ }
+
+} //StereotypeValueImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StorageImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StorageImpl.java
new file mode 100644
index 0000000..69af4e0
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StorageImpl.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.Storage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Storage</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.StorageImpl#getConnections <em>Connections</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StorageImpl extends FMCNodeImpl implements Storage {
+ /**
+ * The cached value of the '{@link #getConnections() <em>Connections</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getConnections()
+ * @generated
+ * @ordered
+ */
+ protected EList<Access> connections;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StorageImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.STORAGE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Access> getConnections() {
+ if (connections == null) {
+ connections = new EObjectWithInverseResolvingEList<Access>(Access.class, this, FmcPackage.STORAGE__CONNECTIONS, FmcPackage.ACCESS__TARGET);
+ }
+ return connections;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isShared() {
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getConnections()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ return ((InternalEList<?>)getConnections()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ return getConnections();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ getConnections().clear();
+ getConnections().addAll((Collection<? extends Access>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ getConnections().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STORAGE__CONNECTIONS:
+ return connections != null && !connections.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitStorage(this, object);
+ }
+
+ @Override
+ public EList<Access> getAllConnections() {
+ return getConnections();
+ }
+
+} //StorageImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StructureVarianceImpl.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StructureVarianceImpl.java
new file mode 100644
index 0000000..a29f279
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/impl/StructureVarianceImpl.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.fmc.mm.Access;
+import org.eclipse.fmc.mm.FmcPackage;
+import org.eclipse.fmc.mm.IFMCElementVisitor;
+import org.eclipse.fmc.mm.StructureVariance;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Structure Variance</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.fmc.mm.impl.StructureVarianceImpl#getConnections <em>Connections</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StructureVarianceImpl extends FMCNodeImpl implements StructureVariance {
+ /**
+ * The cached value of the '{@link #getConnections() <em>Connections</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getConnections()
+ * @generated
+ * @ordered
+ */
+ protected EList<Access> connections;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StructureVarianceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FmcPackage.Literals.STRUCTURE_VARIANCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Access> getConnections() {
+ if (connections == null) {
+ connections = new EObjectWithInverseResolvingEList<Access>(Access.class, this, FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS, FmcPackage.ACCESS__TARGET);
+ }
+ return connections;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getConnections()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ return ((InternalEList<?>)getConnections()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ return getConnections();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ getConnections().clear();
+ getConnections().addAll((Collection<? extends Access>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ getConnections().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FmcPackage.STRUCTURE_VARIANCE__CONNECTIONS:
+ return connections != null && !connections.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public Object accept(IFMCElementVisitor visitor, Object object) {
+ return visitor.visitStructureVariance(this, object);
+ }
+
+} //StructureVarianceImpl
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcAdapterFactory.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcAdapterFactory.java
new file mode 100644
index 0000000..e71e3eb
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcAdapterFactory.java
@@ -0,0 +1,385 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.fmc.mm.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage
+ * @generated
+ */
+public class FmcAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static FmcPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = FmcPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FmcSwitch<Adapter> modelSwitch =
+ new FmcSwitch<Adapter>() {
+ @Override
+ public Adapter caseAgent(Agent object) {
+ return createAgentAdapter();
+ }
+ @Override
+ public Adapter caseChannel(Channel object) {
+ return createChannelAdapter();
+ }
+ @Override
+ public Adapter caseStorage(Storage object) {
+ return createStorageAdapter();
+ }
+ @Override
+ public Adapter caseFMCNode(FMCNode object) {
+ return createFMCNodeAdapter();
+ }
+ @Override
+ public Adapter caseFMCConnection(FMCConnection object) {
+ return createFMCConnectionAdapter();
+ }
+ @Override
+ public Adapter caseAccess(Access object) {
+ return createAccessAdapter();
+ }
+ @Override
+ public Adapter caseFMCModel(FMCModel object) {
+ return createFMCModelAdapter();
+ }
+ @Override
+ public Adapter caseStructureVariance(StructureVariance object) {
+ return createStructureVarianceAdapter();
+ }
+ @Override
+ public Adapter caseMetadata(Metadata object) {
+ return createMetadataAdapter();
+ }
+ @Override
+ public Adapter caseAccessTarget(AccessTarget object) {
+ return createAccessTargetAdapter();
+ }
+ @Override
+ public Adapter caseComment(Comment object) {
+ return createCommentAdapter();
+ }
+ @Override
+ public Adapter caseFMCElement(FMCElement object) {
+ return createFMCElementAdapter();
+ }
+ @Override
+ public Adapter caseStereotype(Stereotype object) {
+ return createStereotypeAdapter();
+ }
+ @Override
+ public Adapter caseStereotypeValue(StereotypeValue object) {
+ return createStereotypeValueAdapter();
+ }
+ @Override
+ public Adapter caseIFMCElementVisitor(IFMCElementVisitor object) {
+ return createIFMCElementVisitorAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Agent <em>Agent</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Agent
+ * @generated
+ */
+ public Adapter createAgentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Channel <em>Channel</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Channel
+ * @generated
+ */
+ public Adapter createChannelAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Storage <em>Storage</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Storage
+ * @generated
+ */
+ public Adapter createStorageAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.FMCNode <em>FMC Node</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.FMCNode
+ * @generated
+ */
+ public Adapter createFMCNodeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.FMCConnection <em>FMC Connection</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.FMCConnection
+ * @generated
+ */
+ public Adapter createFMCConnectionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Access <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Access
+ * @generated
+ */
+ public Adapter createAccessAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.FMCModel <em>FMC Model</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.FMCModel
+ * @generated
+ */
+ public Adapter createFMCModelAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.StructureVariance <em>Structure Variance</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.StructureVariance
+ * @generated
+ */
+ public Adapter createStructureVarianceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Metadata <em>Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Metadata
+ * @generated
+ */
+ public Adapter createMetadataAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.AccessTarget <em>Access Target</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.AccessTarget
+ * @generated
+ */
+ public Adapter createAccessTargetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Comment <em>Comment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Comment
+ * @generated
+ */
+ public Adapter createCommentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.FMCElement <em>FMC Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.FMCElement
+ * @generated
+ */
+ public Adapter createFMCElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.Stereotype <em>Stereotype</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.Stereotype
+ * @generated
+ */
+ public Adapter createStereotypeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.StereotypeValue <em>Stereotype Value</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.StereotypeValue
+ * @generated
+ */
+ public Adapter createStereotypeValueAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fmc.mm.IFMCElementVisitor <em>IFMC Element Visitor</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.fmc.mm.IFMCElementVisitor
+ * @generated
+ */
+ public Adapter createIFMCElementVisitorAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //FmcAdapterFactory
diff --git a/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcSwitch.java b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcSwitch.java
new file mode 100644
index 0000000..603949b
--- /dev/null
+++ b/org.eclipse.fmc.mm/src/org/eclipse/fmc/mm/util/FmcSwitch.java
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2013, 2013 SAP AG.
+ * 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:
+ * SAP AG - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.fmc.mm.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.fmc.mm.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.fmc.mm.FmcPackage
+ * @generated
+ */
+public class FmcSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static FmcPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FmcSwitch() {
+ if (modelPackage == null) {
+ modelPackage = FmcPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case FmcPackage.AGENT: {
+ Agent agent = (Agent)theEObject;
+ T result = caseAgent(agent);
+ if (result == null) result = caseFMCNode(agent);
+ if (result == null) result = caseFMCElement(agent);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.CHANNEL: {
+ Channel channel = (Channel)theEObject;
+ T result = caseChannel(channel);
+ if (result == null) result = caseFMCConnection(channel);
+ if (result == null) result = caseFMCElement(channel);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.STORAGE: {
+ Storage storage = (Storage)theEObject;
+ T result = caseStorage(storage);
+ if (result == null) result = caseAccessTarget(storage);
+ if (result == null) result = caseFMCNode(storage);
+ if (result == null) result = caseFMCElement(storage);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.FMC_NODE: {
+ FMCNode fmcNode = (FMCNode)theEObject;
+ T result = caseFMCNode(fmcNode);
+ if (result == null) result = caseFMCElement(fmcNode);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.FMC_CONNECTION: {
+ FMCConnection fmcConnection = (FMCConnection)theEObject;
+ T result = caseFMCConnection(fmcConnection);
+ if (result == null) result = caseFMCElement(fmcConnection);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.ACCESS: {
+ Access access = (Access)theEObject;
+ T result = caseAccess(access);
+ if (result == null) result = caseFMCConnection(access);
+ if (result == null) result = caseFMCElement(access);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.FMC_MODEL: {
+ FMCModel fmcModel = (FMCModel)theEObject;
+ T result = caseFMCModel(fmcModel);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.STRUCTURE_VARIANCE: {
+ StructureVariance structureVariance = (StructureVariance)theEObject;
+ T result = caseStructureVariance(structureVariance);
+ if (result == null) result = caseAccessTarget(structureVariance);
+ if (result == null) result = caseFMCNode(structureVariance);
+ if (result == null) result = caseFMCElement(structureVariance);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.METADATA: {
+ Metadata metadata = (Metadata)theEObject;
+ T result = caseMetadata(metadata);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.ACCESS_TARGET: {
+ AccessTarget accessTarget = (AccessTarget)theEObject;
+ T result = caseAccessTarget(accessTarget);
+ if (result == null) result = caseFMCNode(accessTarget);
+ if (result == null) result = caseFMCElement(accessTarget);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.COMMENT: {
+ Comment comment = (Comment)theEObject;
+ T result = caseComment(comment);
+ if (result == null) result = caseFMCElement(comment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.FMC_ELEMENT: {
+ FMCElement fmcElement = (FMCElement)theEObject;
+ T result = caseFMCElement(fmcElement);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.STEREOTYPE: {
+ Stereotype stereotype = (Stereotype)theEObject;
+ T result = caseStereotype(stereotype);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.STEREOTYPE_VALUE: {
+ StereotypeValue stereotypeValue = (StereotypeValue)theEObject;
+ T result = caseStereotypeValue(stereotypeValue);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FmcPackage.IFMC_ELEMENT_VISITOR: {
+ IFMCElementVisitor ifmcElementVisitor = (IFMCElementVisitor)theEObject;
+ T result = caseIFMCElementVisitor(ifmcElementVisitor);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Agent</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Agent</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAgent(Agent object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Channel</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Channel</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseChannel(Channel object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Storage</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Storage</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStorage(Storage object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>FMC Node</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>FMC Node</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFMCNode(FMCNode object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>FMC Connection</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>FMC Connection</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFMCConnection(FMCConnection object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Access</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Access</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAccess(Access object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>FMC Model</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>FMC Model</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFMCModel(FMCModel object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Structure Variance</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Structure Variance</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStructureVariance(StructureVariance object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Metadata</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Metadata</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMetadata(Metadata object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Access Target</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Access Target</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAccessTarget(AccessTarget object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Comment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Comment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseComment(Comment object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>FMC Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>FMC Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFMCElement(FMCElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Stereotype</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Stereotype</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStereotype(Stereotype object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Stereotype Value</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Stereotype Value</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStereotypeValue(StereotypeValue object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IFMC Element Visitor</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IFMC Element Visitor</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIFMCElementVisitor(IFMCElementVisitor object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //FmcSwitch