Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2006-01-10 16:16:49 +0000
committerashatalin2006-01-10 16:16:49 +0000
commite05f13c0962c0b216c5523c33196c526c311fba3 (patch)
treeb8775be1b6dd34e95cd922f1b14578a524c62d9e
parentae4e2ba638944201f4cfea59a453b09758781c17 (diff)
downloadorg.eclipse.gmf-tooling-e05f13c0962c0b216c5523c33196c526c311fba3.tar.gz
org.eclipse.gmf-tooling-e05f13c0962c0b216c5523c33196c526c311fba3.tar.xz
org.eclipse.gmf-tooling-e05f13c0962c0b216c5523c33196c526c311fba3.zip
As a part of implementstion
#114178,114179 "Shortcutting" diagram elements.
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/icons/shortcut.gifbin0 -> 93 bytes
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/models/ecore.gmfgen10
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/plugin.xml15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EAnnotation3EditPart.java52
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EClassEditPart.java36
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EDataType2EditPart.java52
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EEnum2EditPart.java52
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EPackage2EditPart.java52
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReference2EditPart.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReferenceEditPart.java18
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation3ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation4ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation5ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java14
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java15
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/providers/EcoreElementTypes.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreCreateShortcutAction.java106
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDiagramEditorPlugin.java18
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDocumentProvider.java1
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreElementChooserDialog.java322
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreInitDiagramFileAction.java3
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcorePaletteFactory.java9
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreVisualIDRegistry.java1
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/plugin.properties2
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenDiagramItemProvider.java44
-rw-r--r--plugins/org.eclipse.gmf.codegen.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModel.java19
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore10
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel4
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java52
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java52
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java4
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginXML.java159
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java77
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java4
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java44
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenDiagram.java70
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenNode.java4
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java53
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenDiagramImpl.java142
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/EmitterFactory.java14
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/GIFEmitter.java48
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java43
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet109
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet323
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/Plugin.javajet18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/plugin.xmljet14
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/shortcut.gifbin0 -> 93 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/policies/NodeItemSemanticEditPolicy.javajet14
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ConnectionGenerator.java197
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/DecorationFigureGenerator.java133
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc1
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/HandcodedImplTest.java2
67 files changed, 2340 insertions, 357 deletions
diff --git a/examples/org.eclipse.gmf.ecore.editor/icons/shortcut.gif b/examples/org.eclipse.gmf.ecore.editor/icons/shortcut.gif
new file mode 100644
index 000000000..c8ebb3156
--- /dev/null
+++ b/examples/org.eclipse.gmf.ecore.editor/icons/shortcut.gif
Binary files differ
diff --git a/examples/org.eclipse.gmf.ecore.editor/models/ecore.gmfgen b/examples/org.eclipse.gmf.ecore.editor/models/ecore.gmfgen
index 48ec52b29..d69ac5e6e 100644
--- a/examples/org.eclipse.gmf.ecore.editor/models/ecore.gmfgen
+++ b/examples/org.eclipse.gmf.ecore.editor/models/ecore.gmfgen
@@ -82,7 +82,7 @@
</nodes>
<nodes visualID="1002" editPartClassName="EPackage2EditPart" itemSemanticEditPolicyClassName="EPackage2ItemSemanticEditPolicy" notationViewFactoryClassName="EPackage2ViewFactory" canonicalEditPolicyClassName="EPackage2CanonicalEditPolicy" graphicalNodeEditPolicyClassName="EPackageGraphicalNodeEditPolicy">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="NodeRectangle" classBody="&#xD;&#xA;/**&#xD;&#xA; * @generated&#xD;&#xA; */&#xD;&#xA;public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {&#xD;&#xA;&#xD;&#xA;&#x9;/**&#xD;&#xA;&#x9; * @generated&#xD;&#xA;&#x9; */&#xD;&#xA;&#x9;public NodeRectangle() {&#xD;&#xA;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;}"/>
<modelFacet>
<metaClass href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage"/>
<containmentMetaFeature href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eSubpackages"/>
@@ -198,7 +198,7 @@
</nodes>
<nodes visualID="1003" editPartClassName="EAnnotation3EditPart" itemSemanticEditPolicyClassName="EAnnotation3ItemSemanticEditPolicy" notationViewFactoryClassName="EAnnotation3ViewFactory" canonicalEditPolicyClassName="EAnnotation3CanonicalEditPolicy" graphicalNodeEditPolicyClassName="EAnnotation3GraphicalNodeEditPolicy">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="NodeRectangle" classBody="&#xD;&#xA;/**&#xD;&#xA; * @generated&#xD;&#xA; */&#xD;&#xA;public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {&#xD;&#xA;&#xD;&#xA;&#x9;/**&#xD;&#xA;&#x9; * @generated&#xD;&#xA;&#x9; */&#xD;&#xA;&#x9;public NodeRectangle() {&#xD;&#xA;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;}"/>
<modelFacet>
<metaClass href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation"/>
<containmentMetaFeature href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EModelElement/eAnnotations"/>
@@ -234,7 +234,7 @@
</nodes>
<nodes visualID="1004" editPartClassName="EDataType2EditPart" itemSemanticEditPolicyClassName="EDataType2ItemSemanticEditPolicy" notationViewFactoryClassName="EDataType2ViewFactory" canonicalEditPolicyClassName="EDataType2CanonicalEditPolicy" graphicalNodeEditPolicyClassName="EDataType2GraphicalNodeEditPolicy">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="NodeRectangle" classBody="&#xD;&#xA;/**&#xD;&#xA; * @generated&#xD;&#xA; */&#xD;&#xA;public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {&#xD;&#xA;&#xD;&#xA;&#x9;/**&#xD;&#xA;&#x9; * @generated&#xD;&#xA;&#x9; */&#xD;&#xA;&#x9;public NodeRectangle() {&#xD;&#xA;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;}"/>
<modelFacet>
<metaClass href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EDataType"/>
<containmentMetaFeature href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
@@ -270,7 +270,7 @@
</nodes>
<nodes visualID="1005" editPartClassName="EEnum2EditPart" itemSemanticEditPolicyClassName="EEnum2ItemSemanticEditPolicy" notationViewFactoryClassName="EEnum2ViewFactory" canonicalEditPolicyClassName="EEnum2CanonicalEditPolicy" graphicalNodeEditPolicyClassName="EEnum2GraphicalNodeEditPolicy">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="NodeRectangle" classBody="&#xD;&#xA;/**&#xD;&#xA; * @generated&#xD;&#xA; */&#xD;&#xA;public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {&#xD;&#xA;&#xD;&#xA;&#x9;/**&#xD;&#xA;&#x9; * @generated&#xD;&#xA;&#x9; */&#xD;&#xA;&#x9;public NodeRectangle() {&#xD;&#xA;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;}"/>
<modelFacet>
<metaClass href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnum"/>
<containmentMetaFeature href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
@@ -333,7 +333,7 @@
</links>
<links visualID="3002" editPartClassName="EReferenceEditPart" itemSemanticEditPolicyClassName="EReferenceItemSemanticEditPolicy" notationViewFactoryClassName="EReferenceViewFactory">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <viewmap xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx"/>
+ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="ConnectionLine" classBody="&#xD;&#xA;&#xD;&#xA;/**&#xD;&#xA; * @generated&#xD;&#xA; */&#xD;&#xA;public class ConnectionLine extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {&#xD;&#xA;&#xD;&#xA;&#x9;/**&#xD;&#xA;&#x9; * @generated&#xD;&#xA;&#x9; */&#xD;&#xA;&#x9;public ConnectionLine() {&#xD;&#xA;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;}&#xD;&#xA;"/>
<modelFacet xsi:type="gmfgen:TypeLinkModelFacet">
<metaClass href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EReference"/>
<containmentMetaFeature href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eStructuralFeatures"/>
diff --git a/examples/org.eclipse.gmf.ecore.editor/plugin.xml b/examples/org.eclipse.gmf.ecore.editor/plugin.xml
index 34006f094..1f0beb645 100644
--- a/examples/org.eclipse.gmf.ecore.editor/plugin.xml
+++ b/examples/org.eclipse.gmf.ecore.editor/plugin.xml
@@ -58,7 +58,19 @@
enablesFor="1"
id="org.eclipse.gmf.ecore.editor.EcoreInitDiagramFileActionID">
</action>
- </objectContribution>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="org.eclipse.gmf.ecore.editor.ui.objectContribution.FileEditorInputProxy1"
+ objectClass="org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy">
+ <action
+ class="org.eclipse.gmf.ecore.editor.EcoreCreateShortcutAction"
+ enablesFor="1"
+ id="org.eclipse.gmf.ecore.editor.EcoreCreateShortcutActionID"
+ label="Create Shortcut"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
</extension>
<extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders">
@@ -150,4 +162,5 @@
</IconProvider>
</extension>
+
</plugin>
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EAnnotation3EditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EAnnotation3EditPart.java
index 18ba92f03..0d68ce644 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EAnnotation3EditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EAnnotation3EditPart.java
@@ -1,5 +1,6 @@
package org.eclipse.gmf.ecore.edit.parts;
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -9,7 +10,9 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
+import org.eclipse.draw2d.Figure;
import org.eclipse.gef.EditPart;
@@ -18,6 +21,8 @@ import org.eclipse.gmf.ecore.edit.policies.EAnnotation3ItemSemanticEditPolicy;
import org.eclipse.gmf.ecore.edit.providers.EcoreSemanticHints;
+import org.eclipse.gmf.ecore.editor.EcoreDiagramEditorPlugin;
+
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
/**
@@ -50,7 +55,7 @@ public class EAnnotation3EditPart extends ShapeNodeEditPart {
* @generated
*/
protected IFigure createNodeShape() {
- return new RectangleFigure();
+ return new NodeRectangle();
}
/**
@@ -74,15 +79,41 @@ public class EAnnotation3EditPart extends ShapeNodeEditPart {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
/**
* @generated
*/
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
+
+ /**
+ * @generated
+ */
protected void addContentPane(IFigure shape) {
- contentPane = shape;
+ contentPane = new Figure();
+ shape.add(contentPane, BorderLayout.CENTER);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(getMapMode().DPtoLP(5));
contentPane.setLayoutManager(layout);
@@ -105,4 +136,17 @@ public class EAnnotation3EditPart extends ShapeNodeEditPart {
return getChildBySemanticHint(EcoreSemanticHints.EAnnotation_1003Labels.EANNOTATIONSOURCE_4011_TEXT);
}
+ /**
+ * @generated
+ */
+ public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {
+
+ /**
+ * @generated
+ */
+ public NodeRectangle() {
+
+ }
+
+ }
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EClassEditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EClassEditPart.java
index 375878016..3ded1f05c 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EClassEditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EClassEditPart.java
@@ -1,5 +1,6 @@
package org.eclipse.gmf.ecore.edit.parts;
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -9,6 +10,9 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
+import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.gef.EditPart;
@@ -18,6 +22,8 @@ import org.eclipse.gmf.ecore.edit.policies.EClassItemSemanticEditPolicy;
import org.eclipse.gmf.ecore.edit.providers.EcoreSemanticHints;
+import org.eclipse.gmf.ecore.editor.EcoreDiagramEditorPlugin;
+
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
/**
@@ -74,15 +80,41 @@ public class EClassEditPart extends ShapeNodeEditPart {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
/**
* @generated
*/
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
+
+ /**
+ * @generated
+ */
protected void addContentPane(IFigure shape) {
- contentPane = shape;
+ contentPane = new Figure();
+ shape.add(contentPane, BorderLayout.CENTER);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(getMapMode().DPtoLP(5));
contentPane.setLayoutManager(layout);
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EDataType2EditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EDataType2EditPart.java
index 2bddd8028..e2082224f 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EDataType2EditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EDataType2EditPart.java
@@ -1,5 +1,6 @@
package org.eclipse.gmf.ecore.edit.parts;
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -9,7 +10,9 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
+import org.eclipse.draw2d.Figure;
import org.eclipse.gef.EditPart;
@@ -18,6 +21,8 @@ import org.eclipse.gmf.ecore.edit.policies.EDataType2ItemSemanticEditPolicy;
import org.eclipse.gmf.ecore.edit.providers.EcoreSemanticHints;
+import org.eclipse.gmf.ecore.editor.EcoreDiagramEditorPlugin;
+
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
/**
@@ -50,7 +55,7 @@ public class EDataType2EditPart extends ShapeNodeEditPart {
* @generated
*/
protected IFigure createNodeShape() {
- return new RectangleFigure();
+ return new NodeRectangle();
}
/**
@@ -74,15 +79,41 @@ public class EDataType2EditPart extends ShapeNodeEditPart {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
/**
* @generated
*/
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
+
+ /**
+ * @generated
+ */
protected void addContentPane(IFigure shape) {
- contentPane = shape;
+ contentPane = new Figure();
+ shape.add(contentPane, BorderLayout.CENTER);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(getMapMode().DPtoLP(5));
contentPane.setLayoutManager(layout);
@@ -105,4 +136,17 @@ public class EDataType2EditPart extends ShapeNodeEditPart {
return getChildBySemanticHint(EcoreSemanticHints.EDataType_1004Labels.EDATATYPENAME_4013_TEXT);
}
+ /**
+ * @generated
+ */
+ public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {
+
+ /**
+ * @generated
+ */
+ public NodeRectangle() {
+
+ }
+
+ }
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EEnum2EditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EEnum2EditPart.java
index 75ea7b39b..0ecb784b7 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EEnum2EditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EEnum2EditPart.java
@@ -1,5 +1,6 @@
package org.eclipse.gmf.ecore.edit.parts;
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -9,7 +10,9 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
+import org.eclipse.draw2d.Figure;
import org.eclipse.gef.EditPart;
@@ -18,6 +21,8 @@ import org.eclipse.gmf.ecore.edit.policies.EEnum2ItemSemanticEditPolicy;
import org.eclipse.gmf.ecore.edit.providers.EcoreSemanticHints;
+import org.eclipse.gmf.ecore.editor.EcoreDiagramEditorPlugin;
+
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
/**
@@ -50,7 +55,7 @@ public class EEnum2EditPart extends ShapeNodeEditPart {
* @generated
*/
protected IFigure createNodeShape() {
- return new RectangleFigure();
+ return new NodeRectangle();
}
/**
@@ -74,15 +79,41 @@ public class EEnum2EditPart extends ShapeNodeEditPart {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
/**
* @generated
*/
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
+
+ /**
+ * @generated
+ */
protected void addContentPane(IFigure shape) {
- contentPane = shape;
+ contentPane = new Figure();
+ shape.add(contentPane, BorderLayout.CENTER);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(getMapMode().DPtoLP(5));
contentPane.setLayoutManager(layout);
@@ -105,4 +136,17 @@ public class EEnum2EditPart extends ShapeNodeEditPart {
return getChildBySemanticHint(EcoreSemanticHints.EEnum_1005Labels.EENUMNAME_4015_TEXT);
}
+ /**
+ * @generated
+ */
+ public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {
+
+ /**
+ * @generated
+ */
+ public NodeRectangle() {
+
+ }
+
+ }
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EPackage2EditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EPackage2EditPart.java
index fe3001c0e..be94d4e57 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EPackage2EditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EPackage2EditPart.java
@@ -1,5 +1,6 @@
package org.eclipse.gmf.ecore.edit.parts;
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -9,7 +10,9 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
+import org.eclipse.draw2d.Figure;
import org.eclipse.gef.EditPart;
@@ -18,6 +21,8 @@ import org.eclipse.gmf.ecore.edit.policies.EPackageGraphicalNodeEditPolicy;
import org.eclipse.gmf.ecore.edit.providers.EcoreSemanticHints;
+import org.eclipse.gmf.ecore.editor.EcoreDiagramEditorPlugin;
+
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
/**
@@ -50,7 +55,7 @@ public class EPackage2EditPart extends ShapeNodeEditPart {
* @generated
*/
protected IFigure createNodeShape() {
- return new RectangleFigure();
+ return new NodeRectangle();
}
/**
@@ -74,15 +79,41 @@ public class EPackage2EditPart extends ShapeNodeEditPart {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
/**
* @generated
*/
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
+
+ /**
+ * @generated
+ */
protected void addContentPane(IFigure shape) {
- contentPane = shape;
+ contentPane = new Figure();
+ shape.add(contentPane, BorderLayout.CENTER);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(getMapMode().DPtoLP(5));
contentPane.setLayoutManager(layout);
@@ -105,4 +136,17 @@ public class EPackage2EditPart extends ShapeNodeEditPart {
return getChildBySemanticHint(EcoreSemanticHints.EPackage_1002Labels.EPACKAGENAME_4005_TEXT);
}
+ /**
+ * @generated
+ */
+ public class NodeRectangle extends org.eclipse.draw2d.RectangleFigure {
+
+ /**
+ * @generated
+ */
+ public NodeRectangle() {
+
+ }
+
+ }
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReference2EditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReference2EditPart.java
index ec5e568c5..006142328 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReference2EditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReference2EditPart.java
@@ -1,10 +1,10 @@
package org.eclipse.gmf.ecore.edit.parts;
import org.eclipse.draw2d.Connection;
-import org.eclipse.gmf.ecore.edit.policies.EReference2ItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.ecore.edit.policies.EReference2ItemSemanticEditPolicy;
/**
* @generated
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReferenceEditPart.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReferenceEditPart.java
index 230babc7a..2baf7bda5 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReferenceEditPart.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/parts/EReferenceEditPart.java
@@ -6,8 +6,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.ecore.edit.policies.EReferenceItemSemanticEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
-
/**
* @generated
*/
@@ -37,7 +35,21 @@ public class EReferenceEditPart extends ConnectionNodeEditPart {
* @generated
*/
protected Connection createConnectionFigure() {
- return new PolylineConnectionEx();
+ return new ConnectionLine();
+ }
+
+ /**
+ * @generated
+ */
+ public class ConnectionLine extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public ConnectionLine() {
+
+ }
+
}
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
index 452dea8c8..bfb75a1cd 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAnnotation2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation3ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation3ItemSemanticEditPolicy.java
index 4e95c0318..00650b576 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation3ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation3ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAnnotation3ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation4ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation4ItemSemanticEditPolicy.java
index 035c28d24..b5ee960d6 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation4ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation4ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAnnotation4ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation5ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation5ItemSemanticEditPolicy.java
index f52a85c0c..1e376ff48 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation5ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation5ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAnnotation5ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
index 7608a5e97..8784eca3d 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
index 8e55af2d8..1a9682f47 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EAttributeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
index c8193f0b5..a7ea4d64d 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
index 26c897bce..26c74dd40 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
index 01e9e6543..6035a6112 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
index 8d386651a..79caa0187 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
index 07f49ae27..5de0a6387 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
index a2f47f144..771ca6aa4 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
@@ -4,10 +4,11 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
@@ -30,7 +31,17 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
index d884698e4..18f6bc9e3 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EEnumLiteralItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
index f7f7acc71..c4c105d44 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EOperationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
index cbc6918e2..6aa4bb46a 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
index b4c3b79bd..df9f57b7d 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
@@ -4,7 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -24,7 +26,17 @@ public class EPackage3ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
index 8b9ad108a..e8dafa26c 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
@@ -4,6 +4,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -14,7 +17,17 @@ public class EStringToStringMapEntryItemSemanticEditPolicy extends EcoreBaseItem
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/providers/EcoreElementTypes.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/providers/EcoreElementTypes.java
index 266e28cec..9c5305f4a 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/providers/EcoreElementTypes.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/providers/EcoreElementTypes.java
@@ -368,6 +368,7 @@ public class EcoreElementTypes {
* @generated
*/
public static class ObjectInitializer {
+
/**
* @generated
*/
@@ -395,6 +396,7 @@ public class EcoreElementTypes {
* @generated
*/
static class FeatureInitializer {
+
/**
* @generated
*/
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreCreateShortcutAction.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreCreateShortcutAction.java
new file mode 100644
index 000000000..2f0ad34d5
--- /dev/null
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreCreateShortcutAction.java
@@ -0,0 +1,106 @@
+package org.eclipse.gmf.ecore.editor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy;
+import org.eclipse.gmf.runtime.emf.core.edit.MRunnable;
+import org.eclipse.gmf.runtime.emf.core.util.OperationUtil;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class EcoreCreateShortcutAction implements IObjectActionDelegate {
+
+ private FileEditorInputProxy mySelectedElement;
+
+ private Shell myShell;
+
+ private DiagramEditor myDiagramEditor;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ myDiagramEditor = targetPart instanceof DiagramEditor ? (DiagramEditor) targetPart : null;
+ myShell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ EcoreElementChooserDialog elementChooser = new EcoreElementChooserDialog(myShell);
+ int result = elementChooser.open();
+ if (result != Window.OK) {
+ return;
+ }
+ final EObject selectedElement = elementChooser.getSelectedModelElement();
+ if (selectedElement == null) {
+ return;
+ }
+
+ OperationUtil.runAsUnchecked(new MRunnable() {
+
+ public Object run() {
+ Node shortcutNode = ViewService.createNode(myDiagramEditor.getDiagram(), selectedElement, null, EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+
+ Collection allNodes = new ArrayList();
+ getAllNodes(allNodes, shortcutNode);
+ for (Iterator it = allNodes.iterator(); it.hasNext();) {
+ Node nextNode = (Node) it.next();
+ EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource("Shortcutted"); //$NON-NLS-1$
+ nextNode.getEAnnotations().add(annotation);
+ }
+ return null;
+ }
+ });
+
+ }
+
+ /**
+ * @generated
+ */
+ private void getAllNodes(Collection initial, Node node) {
+ initial.add(node);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ getAllNodes(initial, (Node) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof FileEditorInputProxy) {
+ mySelectedElement = (FileEditorInputProxy) structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isEnabled() {
+ return myDiagramEditor != null && mySelectedElement != null;
+ }
+
+}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDiagramEditorPlugin.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDiagramEditorPlugin.java
index 799092166..e63e02e6a 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDiagramEditorPlugin.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDiagramEditorPlugin.java
@@ -11,6 +11,7 @@ import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.emf.core.internal.util.MSLAdapterFactoryManager;
import org.eclipse.gmf.runtime.emf.core.internal.util.MSLMetaModelManager;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.eclipse.emf.ecore.EcorePackage;
@@ -126,4 +127,21 @@ public class EcoreDiagramEditorPlugin extends AbstractUIPlugin {
public static ImageDescriptor getBundledImageDescriptor(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
}
+
+ /**
+ * Returns an image for the image file at the given plug-in relative path.
+ * Client do not need to dispose this image. Images will be disposed automatically.
+ *
+ * @generated
+ * @param path the path
+ * @return image instance
+ */
+ public Image getBundledImage(String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDocumentProvider.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDocumentProvider.java
index 683f90047..c63c518ee 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDocumentProvider.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreDocumentProvider.java
@@ -148,6 +148,7 @@ public class EcoreDocumentProvider extends FileDiagramDocumentProvider {
super(documentProviderParameter, documentParameter, inputParameter);
final DiagramDocument document = documentParameter;
MFilter diagramResourceSavedFilter = new MFilter() {
+
public boolean matches(Notification notification) {
Diagram diagram = document.getDiagram();
Object notifier = notification.getNotifier();
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreElementChooserDialog.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreElementChooserDialog.java
new file mode 100644
index 000000000..125cec2e5
--- /dev/null
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreElementChooserDialog.java
@@ -0,0 +1,322 @@
+package org.eclipse.gmf.ecore.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+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.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gmf.runtime.emf.core.util.ResourceUtil;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+
+/**
+ * @generated
+ */
+public class EcoreElementChooserDialog extends Dialog {
+
+ private AdapterFactory myModelAdapterFactory = null;
+
+ private TreeViewer myTreeViewer;
+
+ private EObject mySelectedModelElement;
+
+ /**
+ * @generated
+ */
+ public EcoreElementChooserDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ createModelBrowser(composite);
+ return composite;
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createButtonBar(Composite parent) {
+ Control buttonBar = super.createButtonBar(parent);
+ setOkButtonEnabled(false);
+ return buttonBar;
+ }
+
+ /**
+ * @generated
+ */
+ private void createModelBrowser(Composite composite) {
+ myTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
+ myTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ myTreeViewer.addFilter(new ModelFilesFilter());
+ myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
+ }
+
+ /**
+ * @generated
+ */
+ private void setOkButtonEnabled(boolean enabled) {
+ getButton(IDialogConstants.OK_ID).setEnabled(enabled);
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isValidModelFile(IFile file) {
+ return "ecore".equals(file.getFullPath().getFileExtension());
+ }
+
+ /**
+ * @generated
+ */
+ private AdapterFactory getModelAdapterFactory() {
+ if (myModelAdapterFactory == null) {
+ List factories = new ArrayList();
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ myModelAdapterFactory = new ComposedAdapterFactory(factories);
+ }
+ return myModelAdapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getSelectedModelElement() {
+ return mySelectedModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeContentProvider implements ITreeContentProvider {
+
+ private ITreeContentProvider myWorkbenchContentProvider = new WorkbenchContentProvider();
+
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(getModelAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
+ if (result != null && result.length > 0) {
+ return result;
+ }
+ if (parentElement instanceof IFile) {
+ IFile modelFile = (IFile) parentElement;
+ String resourcePath = modelFile.getLocation().toOSString();
+ Resource modelResource = ResourceUtil.findResource(resourcePath);
+ if (modelResource == null) {
+ modelResource = ResourceUtil.create(resourcePath);
+ }
+ if (!modelResource.isLoaded()) {
+ try {
+ ResourceUtil.load(modelResource);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return myAdapterFctoryContentProvier.getChildren(modelResource);
+ }
+ return myAdapterFctoryContentProvier.getChildren(parentElement);
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ Object parent = myWorkbenchContentProvider.getParent(element);
+ if (parent != null) {
+ return parent;
+ }
+ if (element instanceof EObject) {
+ EObject eObject = (EObject) element;
+ if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
+ String path = eObject.eResource().getURI().path();
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
+ }
+ return myAdapterFctoryContentProvier.getParent(eObject);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ if (element instanceof IFile) {
+ return isValidModelFile((IFile) element);
+ }
+ return myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
+ return elements;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchContentProvider.dispose();
+ myAdapterFctoryContentProvier.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
+ myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeLabelProvider implements ILabelProvider {
+
+ private WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();
+
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(getModelAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ Image result = myWorkbenchLabelProvider.getImage(element);
+ return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ String result = myWorkbenchLabelProvider.getText(element);
+ return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelFilesFilter extends ViewerFilter {
+
+ /**
+ * @generated
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IContainer) {
+ return true;
+ }
+ if (element instanceof IFile) {
+ IFile file = (IFile) element;
+ return isValidModelFile(file);
+ }
+ return true;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class OkButtonEnabler implements ISelectionChangedListener {
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.size() == 1 && selection.getFirstElement() instanceof EObject) {
+ mySelectedModelElement = (EObject) selection.getFirstElement();
+ setOkButtonEnabled(true);
+ return;
+ }
+ }
+ mySelectedModelElement = null;
+ setOkButtonEnabled(false);
+ }
+
+ }
+
+}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreInitDiagramFileAction.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreInitDiagramFileAction.java
index 5bfdf1179..4b37f4f7a 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreInitDiagramFileAction.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreInitDiagramFileAction.java
@@ -149,6 +149,7 @@ public class EcoreInitDiagramFileAction implements IObjectActionDelegate, IInput
return;
}
OperationUtil.runAsUnchecked(new MRunnable() {
+
public Object run() {
EObject diagram = create(diagramModelObject);
if (diagram == null) {
@@ -743,6 +744,7 @@ public class EcoreInitDiagramFileAction implements IObjectActionDelegate, IInput
Node dstNode = (Node) myEObject2NodeMap.get(dst);
if (dstNode != null) {
Edge edge = (Edge) ViewService.getInstance().createEdge(new IAdaptable() {
+
public Object getAdapter(Class adapter) {
if (IElementType.class.equals(adapter)) {
return EcoreElementTypes.EAnnotationReferences_3001;
@@ -810,6 +812,7 @@ public class EcoreInitDiagramFileAction implements IObjectActionDelegate, IInput
Node dstNode = (Node) myEObject2NodeMap.get(dst);
if (dstNode != null) {
Edge edge = (Edge) ViewService.getInstance().createEdge(new IAdaptable() {
+
public Object getAdapter(Class adapter) {
if (IElementType.class.equals(adapter)) {
return EcoreElementTypes.EClassESuperTypes_3004;
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcorePaletteFactory.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcorePaletteFactory.java
index f639e6237..df3db44db 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcorePaletteFactory.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcorePaletteFactory.java
@@ -138,6 +138,7 @@ public class EcorePaletteFactory {
elementTypes.add(EcoreElementTypes.EClass_1001);
elementTypes.add(EcoreElementTypes.EClass_2004);
return new ToolEntry("EClass", "EClass", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -161,6 +162,7 @@ public class EcorePaletteFactory {
elementTypes.add(EcoreElementTypes.EPackage_1002);
elementTypes.add(EcoreElementTypes.EPackage_2005);
return new ToolEntry("EPackage", "EPackage", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -187,6 +189,7 @@ public class EcorePaletteFactory {
elementTypes.add(EcoreElementTypes.EAnnotation_2010);
elementTypes.add(EcoreElementTypes.EAnnotation_2012);
return new ToolEntry("EAnnotation", "EAnnotation", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -210,6 +213,7 @@ public class EcorePaletteFactory {
elementTypes.add(EcoreElementTypes.EDataType_1004);
elementTypes.add(EcoreElementTypes.EDataType_2006);
return new ToolEntry("EDataType", "EDataType", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -233,6 +237,7 @@ public class EcorePaletteFactory {
elementTypes.add(EcoreElementTypes.EEnum_1005);
elementTypes.add(EcoreElementTypes.EEnum_2007);
return new ToolEntry("EEnum", "EEnum", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -255,6 +260,7 @@ public class EcorePaletteFactory {
final List elementTypes = new ArrayList();
elementTypes.add(EcoreElementTypes.EAttribute_2001);
return new ToolEntry("EAttribute", "EAttribute", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -277,6 +283,7 @@ public class EcorePaletteFactory {
final List elementTypes = new ArrayList();
elementTypes.add(EcoreElementTypes.EOperation_2002);
return new ToolEntry("EOperation", "EOperation", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -299,6 +306,7 @@ public class EcorePaletteFactory {
final List elementTypes = new ArrayList();
elementTypes.add(EcoreElementTypes.EStringToStringMapEntry_2009);
return new ToolEntry("Annotation Details", "EStringToStringMapEntry", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
@@ -321,6 +329,7 @@ public class EcorePaletteFactory {
final List elementTypes = new ArrayList();
elementTypes.add(EcoreElementTypes.EEnumLiteral_2011);
return new ToolEntry("EEnumLiteral", "EEnumLiteral", smallImage, largeImage) {
+
public Tool createTool() {
Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
tool.setProperties(getToolProperties());
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreVisualIDRegistry.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreVisualIDRegistry.java
index 155b5a9d7..b720bfcd8 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreVisualIDRegistry.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/editor/EcoreVisualIDRegistry.java
@@ -1392,6 +1392,7 @@ public class EcoreVisualIDRegistry {
* @generated
*/
static class AcceptAllMatcher {
+
/**
* @generated
*/
diff --git a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
index 69651075b..b9bdd61b6 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
@@ -326,3 +326,5 @@ _UI_GenAuditRule_container_feature = Container
_UI_GenSeverity_INFO_literal = INFO
_UI_GenSeverity_WARNING_literal = WARNING
_UI_GenSeverity_ERROR_literal = ERROR
+_UI_GenDiagram_createShortcutActionClassName_feature = Create Shortcut Action Class Name
+_UI_GenDiagram_elementChooserClassName_feature = Element Chooser Class Name
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenDiagramItemProvider.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenDiagramItemProvider.java
index aa7e6e3c6..6a9093a7b 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenDiagramItemProvider.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenDiagramItemProvider.java
@@ -102,6 +102,8 @@ public class GenDiagramItemProvider
addPluginClassNamePropertyDescriptor(object);
addPreferenceInitializerClassNamePropertyDescriptor(object);
addVisualIDRegistryClassNamePropertyDescriptor(object);
+ addCreateShortcutActionClassNamePropertyDescriptor(object);
+ addElementChooserClassNamePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -327,6 +329,46 @@ public class GenDiagramItemProvider
}
/**
+ * This adds a property descriptor for the Create Shortcut Action Class Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCreateShortcutActionClassNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_GenDiagram_createShortcutActionClassName_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_GenDiagram_createShortcutActionClassName_feature", "_UI_GenDiagram_type"),
+ GMFGenPackage.eINSTANCE.getGenDiagram_CreateShortcutActionClassName(),
+ true,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Element Chooser Class Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addElementChooserClassNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_GenDiagram_elementChooserClassName_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_GenDiagram_elementChooserClassName_feature", "_UI_GenDiagram_type"),
+ GMFGenPackage.eINSTANCE.getGenDiagram_ElementChooserClassName(),
+ true,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
* This adds a property descriptor for the Editor Package Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1030,6 +1072,8 @@ public class GenDiagramItemProvider
case GMFGenPackage.GEN_DIAGRAM__PLUGIN_CLASS_NAME:
case GMFGenPackage.GEN_DIAGRAM__PREFERENCE_INITIALIZER_CLASS_NAME:
case GMFGenPackage.GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME:
+ case GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME:
+ case GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case GMFGenPackage.GEN_DIAGRAM__NODES:
diff --git a/plugins/org.eclipse.gmf.codegen.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.codegen.ui/META-INF/MANIFEST.MF
index e0bb19880..643429eb7 100644
--- a/plugins/org.eclipse.gmf.codegen.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.codegen.ui/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.gmf.bridge
+ org.eclipse.gmf.bridge,
+ org.eclipse.emf.ecore.xmi
Eclipse-LazyStart: true
Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModel.java b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModel.java
index a20e7a744..93008e38e 100644
--- a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModel.java
+++ b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModel.java
@@ -12,7 +12,8 @@
package org.eclipse.gmf.internal.codegen.popup.actions;
import java.io.IOException;
-import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -30,6 +31,7 @@ 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.util.Diagnostician;
+import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.gmf.bridge.genmodel.BasicDiagramRunTimeModelHelper;
import org.eclipse.gmf.bridge.genmodel.DefaultNamingStrategy;
import org.eclipse.gmf.bridge.genmodel.DiagramGenModelTransformer;
@@ -59,7 +61,8 @@ public class TransformToGenModel implements IObjectActionDelegate {
private IFile myMapFile;
private IWorkbenchPart myPart;
- private IFile myDestFile;
+ private IFile myDestFile;
+ private Map mySaveOptions = null;
private static final Boolean THERE_IS_NO_SPECIFIC_RT = Boolean.TRUE;
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
@@ -154,12 +157,20 @@ public class TransformToGenModel implements IObjectActionDelegate {
}
private void save(GenDiagram gd) throws IOException {
Resource dgmmRes = resSet.createResource(getGenModelURI());
- dgmmRes.getContents().add(gd);
- dgmmRes.save(Collections.EMPTY_MAP);
+ dgmmRes.getContents().add(gd);
+ dgmmRes.save(getSaveOptions());
}
}.schedule();
}
+ protected Map getSaveOptions() {
+ if (mySaveOptions == null) {
+ mySaveOptions = new HashMap();
+ mySaveOptions.put(XMIResource.OPTION_ENCODING, "UTF-8");
+ }
+ return mySaveOptions;
+ }
+
private IStatus validate(Mapping mapping) {
return BasicDiagnostic.toIStatus(Diagnostician.INSTANCE.validate(mapping));
}
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
index ceacbb9f3..7dfc7ecc6 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
@@ -6,6 +6,7 @@
<eAnnotations source="http://www.eclipse.org/emf/2004/EmfaticAnnotationMap">
<details key="constraints" value="http://www.eclipse.org/gmf/2005/constraints"/>
<details key="meta" value="http://www.eclipse.org/gmf/2005/constraints/meta"/>
+ <details key="deprecated" value="http://www.eclipse.org/gmf/2006/deprecated"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/gmf/2005/constraints">
<details key="import" value="platform:/resource/org.eclipse.gmf.runtime.notation/model/notation.ecore"/>
@@ -77,6 +78,8 @@
<eOperations name="getPluginQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eOperations name="getPreferenceInitializerQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eOperations name="getVisualIDRegistryQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eOperations name="getCreateShortcutActionQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eOperations name="getElementChooserQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="domainMetaModel" lowerBound="1"
eType="ecore:EClass ../../../plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore#//GenPackage"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="domainDiagramElement" eType="ecore:EClass ../../../plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore#//GenClass"/>
@@ -165,6 +168,10 @@
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="visualIDRegistryClassName"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="createShortcutActionClassName"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="elementChooserClassName"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GenCommonBase" abstract="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
@@ -238,6 +245,9 @@
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="explicitContentPane" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
+ <eAnnotations source="http://www.eclipse.org/gmf/2006/deprecated">
+ <details key="documentation" value="Obsolete with new gmfgraph. Should be removed form the model."/>
+ </eAnnotations>
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Add distinct figure to the node shape that will be used as a content pane"/>
</eAnnotations>
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
index b053c48f9..52d036ae4 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
@@ -76,6 +76,8 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/pluginClassName"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/preferenceInitializerClassName"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/visualIDRegistryClassName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/createShortcutActionClassName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/elementChooserClassName"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getEMFGenModel"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getRequiredPluginIDs"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getElementInitializersClassName"/>
@@ -110,6 +112,8 @@
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getPluginQualifiedClassName"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getPreferenceInitializerQualifiedClassName"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getVisualIDRegistryQualifiedClassName"/>
+ <genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getCreateShortcutActionQualifiedClassName"/>
+ <genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getElementChooserQualifiedClassName"/>
</genClasses>
<genClasses image="false" ecoreClass="gmfgen.ecore#//GenCommonBase">
<genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgen.ecore#//GenCommonBase/diagramRunTimeClass"/>
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java
new file mode 100644
index 000000000..7db3ceea4
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java
@@ -0,0 +1,52 @@
+package org.eclipse.gmf.codegen.templates.editor;
+
+import org.eclipse.emf.codegen.ecore.genmodel.*;
+import org.eclipse.gmf.codegen.gmfgen.*;
+import org.eclipse.gmf.codegen.util.ImportUtil;
+
+public class CreateShortcutActionGenerator
+{
+ protected static String nl;
+ public static synchronized CreateShortcutActionGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ CreateShortcutActionGenerator result = new CreateShortcutActionGenerator();
+ nl = null;
+ return result;
+ }
+
+ protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
+ protected final String TEXT_1 = "package ";
+ protected final String TEXT_2 = ";" + NL;
+ protected final String TEXT_3 = NL + "import java.util.ArrayList;" + NL + "import java.util.Collection;" + NL + "import java.util.Iterator;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EcoreFactory;" + NL + "import org.eclipse.gmf.runtime.diagram.core.services.ViewService;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy;" + NL + "import org.eclipse.gmf.runtime.emf.core.edit.MRunnable;" + NL + "import org.eclipse.gmf.runtime.emf.core.util.OperationUtil;" + NL + "import org.eclipse.gmf.runtime.notation.Node;" + NL + "import org.eclipse.jface.action.IAction;" + NL + "import org.eclipse.jface.viewers.ISelection;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.window.Window;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.IObjectActionDelegate;" + NL + "import org.eclipse.ui.IWorkbenchPart;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " implements IObjectActionDelegate {" + NL + "" + NL + "\tprivate FileEditorInputProxy mySelectedElement;" + NL + "\tprivate Shell myShell;" + NL + "\tprivate DiagramEditor myDiagramEditor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setActivePart(IAction action, IWorkbenchPart targetPart) {" + NL + "\t\tmyDiagramEditor = targetPart instanceof DiagramEditor ? (DiagramEditor) targetPart : null;" + NL + "\t\tmyShell = targetPart.getSite().getShell();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\t";
+ protected final String TEXT_6 = " elementChooser = new ";
+ protected final String TEXT_7 = "(myShell);" + NL + "\t\tint result = elementChooser.open();" + NL + "\t\tif (result != Window.OK) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tfinal EObject selectedElement = elementChooser.getSelectedModelElement();" + NL + "\t\tif (selectedElement == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tOperationUtil.runAsUnchecked(new MRunnable() {" + NL + "\t\t\tpublic Object run() {" + NL + "\t\t\t\tNode shortcutNode = ViewService.createNode(myDiagramEditor.getDiagram(), selectedElement, null, ";
+ protected final String TEXT_8 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\t\t\t" + NL + "\t\t\t\tCollection allNodes = new ArrayList();" + NL + "\t\t\t\tgetAllNodes(allNodes, shortcutNode);" + NL + "\t\t\t\tfor (Iterator it = allNodes.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tNode nextNode = (Node) it.next();" + NL + "\t\t\t\t\tEAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "\t\t\t\t\tannotation.setSource(\"Shortcutted\"); //$NON-NLS-1$" + NL + "\t\t\t\t\tnextNode.getEAnnotations().add(annotation);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void getAllNodes(Collection initial, Node node) {" + NL + "\t\tinitial.add(node);" + NL + "\t\tfor (Iterator it = node.getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\tgetAllNodes(initial, (Node) it.next());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void selectionChanged(IAction action, ISelection selection) {" + NL + "\t\tmySelectedElement = null;" + NL + "\t\tif (selection instanceof IStructuredSelection) {" + NL + "\t\t\tIStructuredSelection structuredSelection = (IStructuredSelection) selection;" + NL + "\t\t\tif (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof FileEditorInputProxy) {" + NL + "\t\t\t\tmySelectedElement = (FileEditorInputProxy) structuredSelection.getFirstElement();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\taction.setEnabled(isEnabled());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isEnabled() {" + NL + "\t\treturn myDiagramEditor != null && mySelectedElement != null;" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_9 = NL;
+
+ public String generate(Object argument)
+ {
+ StringBuffer stringBuffer = new StringBuffer();
+ GenDiagram genDiagram = (GenDiagram) argument;
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append(genDiagram.getEditorPackageName());
+ stringBuffer.append(TEXT_2);
+ ImportUtil importManager = new ImportUtil(genDiagram.getEditorPackageName());
+ stringBuffer.append(TEXT_3);
+ importManager.markImportLocation(stringBuffer);
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(genDiagram.getCreateShortcutActionClassName());
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName()));
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName()));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getPluginQualifiedClassName()));
+ stringBuffer.append(TEXT_8);
+ importManager.emitSortedImports();
+ stringBuffer.append(TEXT_9);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java
new file mode 100644
index 000000000..ee5a4e46c
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java
@@ -0,0 +1,52 @@
+package org.eclipse.gmf.codegen.templates.editor;
+
+import org.eclipse.emf.codegen.ecore.genmodel.*;
+import org.eclipse.gmf.codegen.gmfgen.*;
+import org.eclipse.gmf.codegen.util.ImportUtil;
+
+public class ElementChooserGenerator
+{
+ protected static String nl;
+ public static synchronized ElementChooserGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ ElementChooserGenerator result = new ElementChooserGenerator();
+ nl = null;
+ return result;
+ }
+
+ protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
+ protected final String TEXT_1 = "package ";
+ protected final String TEXT_2 = ";" + NL;
+ protected final String TEXT_3 = NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.resources.IContainer;" + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.emf.common.notify.AdapterFactory;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;" + NL + "import org.eclipse.gmf.runtime.emf.core.util.ResourceUtil;" + NL + "import org.eclipse.jface.dialogs.Dialog;" + NL + "import org.eclipse.jface.dialogs.IDialogConstants;" + NL + "import org.eclipse.jface.viewers.ILabelProvider;" + NL + "import org.eclipse.jface.viewers.ILabelProviderListener;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.viewers.ITreeContentProvider;" + NL + "import org.eclipse.jface.viewers.SelectionChangedEvent;" + NL + "import org.eclipse.jface.viewers.TreeViewer;" + NL + "import org.eclipse.jface.viewers.Viewer;" + NL + "import org.eclipse.jface.viewers.ViewerFilter;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.Control;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.model.WorkbenchContentProvider;" + NL + "import org.eclipse.ui.model.WorkbenchLabelProvider;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends Dialog {" + NL + "" + NL + "\tprivate AdapterFactory myModelAdapterFactory = null;" + NL + "\tprivate TreeViewer myTreeViewer;" + NL + "\tprivate EObject mySelectedModelElement;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_6 = "(Shell parentShell) {" + NL + "\t\tsuper(parentShell);" + NL + "\t\tsetShellStyle(getShellStyle() | SWT.RESIZE);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createDialogArea(Composite parent) {" + NL + "\t\tComposite composite = (Composite) super.createDialogArea(parent);" + NL + "\t\tcreateModelBrowser(composite);" + NL + "\t\treturn composite;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createButtonBar(Composite parent) {" + NL + "\t\tControl buttonBar = super.createButtonBar(parent);" + NL + "\t\tsetOkButtonEnabled(false);" + NL + "\t\treturn buttonBar;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createModelBrowser(Composite composite) {" + NL + "\t\tmyTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);" + NL + "\t\tGridData layoutData = new GridData(GridData.FILL_BOTH);" + NL + "\t\tlayoutData.heightHint = 300;" + NL + "\t\tlayoutData.widthHint = 300;" + NL + "\t\tmyTreeViewer.getTree().setLayoutData(layoutData);" + NL + "\t\tmyTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());" + NL + "\t\tmyTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());" + NL + "\t\tmyTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());" + NL + "\t\tmyTreeViewer.addFilter(new ModelFilesFilter());" + NL + "\t\tmyTreeViewer.addSelectionChangedListener(new OkButtonEnabler());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setOkButtonEnabled(boolean enabled) {" + NL + "\t\tgetButton(IDialogConstants.OK_ID).setEnabled(enabled);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isValidModelFile(IFile file) {" + NL + "\t\treturn \"";
+ protected final String TEXT_7 = "\".equals(file.getFullPath().getFileExtension());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate AdapterFactory getModelAdapterFactory() {" + NL + "\t\tif (myModelAdapterFactory == null) {" + NL + "\t\t\tList factories = new ArrayList();" + NL + "\t\t\tfactories.add(new ResourceItemProviderAdapterFactory());" + NL + "\t\t\tfactories.add(new ";
+ protected final String TEXT_8 = "());" + NL + "\t\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t\t\tmyModelAdapterFactory = new ComposedAdapterFactory(factories);" + NL + "\t\t}" + NL + "\t\treturn myModelAdapterFactory;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EObject getSelectedModelElement() {" + NL + "\t\treturn mySelectedModelElement;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeContentProvider implements ITreeContentProvider {" + NL + "\t\t" + NL + "\t\tprivate ITreeContentProvider myWorkbenchContentProvider = new WorkbenchContentProvider();" + NL + "\t\tprivate AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(getModelAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getChildren(Object parentElement) {" + NL + "\t\t\tObject[] result = myWorkbenchContentProvider.getChildren(parentElement);" + NL + "\t\t\tif (result != null && result.length > 0) {" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\tif (parentElement instanceof IFile) {" + NL + "\t\t\t\tIFile modelFile = (IFile) parentElement;" + NL + "\t\t\t\tString resourcePath = modelFile.getLocation().toOSString();" + NL + "\t\t\t\tResource modelResource = ResourceUtil.findResource(resourcePath);" + NL + "\t\t\t\tif (modelResource == null) {" + NL + "\t\t\t\t\tmodelResource = ResourceUtil.create(resourcePath);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (!modelResource.isLoaded()) {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tResourceUtil.load(modelResource);" + NL + "\t\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\t\te.printStackTrace();" + NL + "\t\t\t\t\t\treturn null;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn myAdapterFctoryContentProvier.getChildren(modelResource);" + NL + "\t\t\t}" + NL + "\t\t\treturn myAdapterFctoryContentProvier.getChildren(parentElement);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object getParent(Object element) {" + NL + "\t\t\tObject parent = myWorkbenchContentProvider.getParent(element);" + NL + "\t\t\tif (parent != null) {" + NL + "\t\t\t\treturn parent;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof EObject) {" + NL + "\t\t\t\tEObject eObject = (EObject) element;" + NL + "\t\t\t\tif (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {" + NL + "\t\t\t\t\tString path = eObject.eResource().getURI().path();" + NL + "\t\t\t\t\treturn ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn myAdapterFctoryContentProvier.getParent(eObject);" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean hasChildren(Object element) {" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\treturn isValidModelFile((IFile) element);" + NL + "\t\t\t}" + NL + "\t\t\treturn myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getElements(Object inputElement) {" + NL + "\t\t\tObject[] elements = myWorkbenchContentProvider.getElements(inputElement);" + NL + "\t\t\treturn elements;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchContentProvider.dispose();" + NL + "\t\t\tmyAdapterFctoryContentProvier.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void inputChanged(Viewer viewer, Object oldInput, Object newInput) {" + NL + "\t\t\tmyWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t\tmyAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeLabelProvider implements ILabelProvider {" + NL + "\t\t" + NL + "\t\tprivate WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();" + NL + "\t\tprivate AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(getModelAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Image getImage(Object element) {" + NL + "\t\t\tImage result = myWorkbenchLabelProvider.getImage(element);" + NL + "\t\t\treturn result != null ? result : myAdapterFactoryLabelProvider.getImage(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getText(Object element) {" + NL + "\t\t\tString result = myWorkbenchLabelProvider.getText(element);" + NL + "\t\t\treturn result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.addListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.addListener(listener);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchLabelProvider.dispose();" + NL + "\t\t\tmyAdapterFactoryLabelProvider.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isLabelProperty(Object element, String property) {" + NL + "\t\t\treturn myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.removeListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.removeListener(listener);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelFilesFilter extends ViewerFilter {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean select(Viewer viewer, Object parentElement, Object element) {" + NL + "\t\t\tif (element instanceof IContainer) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\tIFile file = (IFile) element;" + NL + "\t\t\t\treturn isValidModelFile(file);" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OkButtonEnabler implements ISelectionChangedListener {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectionChanged(SelectionChangedEvent event) {" + NL + "\t\t\tif (event.getSelection() instanceof IStructuredSelection) {" + NL + "\t\t\t\tIStructuredSelection selection = (IStructuredSelection) event.getSelection();" + NL + "\t\t\t\tif (selection.size() == 1 && selection.getFirstElement() instanceof EObject) {" + NL + "\t\t\t\t\tmySelectedModelElement = (EObject) selection.getFirstElement();" + NL + "\t\t\t\t\tsetOkButtonEnabled(true);" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tmySelectedModelElement = null;" + NL + "\t\t\tsetOkButtonEnabled(false);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_9 = NL;
+
+ public String generate(Object argument)
+ {
+ StringBuffer stringBuffer = new StringBuffer();
+ GenDiagram genDiagram = (GenDiagram) argument;
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append(genDiagram.getEditorPackageName());
+ stringBuffer.append(TEXT_2);
+ ImportUtil importManager = new ImportUtil(genDiagram.getEditorPackageName());
+ stringBuffer.append(TEXT_3);
+ importManager.markImportLocation(stringBuffer);
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(genDiagram.getElementChooserClassName());
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(genDiagram.getElementChooserClassName());
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(genDiagram.getDomainDiagramElement().getGenPackage().getPrefix().toLowerCase());
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getDomainMetaModel().getQualifiedItemProviderAdapterFactoryClassName()));
+ stringBuffer.append(TEXT_8);
+ importManager.emitSortedImports();
+ stringBuffer.append(TEXT_9);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
index 77a020d0d..6bf26c087 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
@@ -19,7 +19,7 @@ public class PluginGenerator
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "package ";
protected final String TEXT_2 = ";" + NL;
- protected final String TEXT_3 = NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.IItemLabelProvider;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.gmf.runtime.emf.core.internal.util.MSLAdapterFactoryManager;" + NL + "import org.eclipse.gmf.runtime.emf.core.internal.util.MSLMetaModelManager;" + NL + "import org.eclipse.jface.resource.ImageDescriptor;" + NL + "import org.eclipse.ui.plugin.AbstractUIPlugin;" + NL + "import org.osgi.framework.BundleContext;";
+ protected final String TEXT_3 = NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.IItemLabelProvider;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.gmf.runtime.emf.core.internal.util.MSLAdapterFactoryManager;" + NL + "import org.eclipse.gmf.runtime.emf.core.internal.util.MSLMetaModelManager;" + NL + "import org.eclipse.jface.resource.ImageDescriptor;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.ui.plugin.AbstractUIPlugin;" + NL + "import org.osgi.framework.BundleContext;";
protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
protected final String TEXT_5 = " extends AbstractUIPlugin {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
protected final String TEXT_6 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EDITOR_ID = \"";
@@ -37,7 +37,7 @@ public class PluginGenerator
protected final String TEXT_18 = NL + "\t\tfactories.add(new ";
protected final String TEXT_19 = "());";
protected final String TEXT_20 = NL + "\t\tfactories.add(new ResourceItemProviderAdapterFactory());" + NL + "\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ImageDescriptor getItemImageDescriptor(Object item) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {";
- protected final String TEXT_21 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "}";
+ protected final String TEXT_21 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Returns an image for the image file at the given plug-in relative path." + NL + "\t * Client do not need to dispose this image. Images will be disposed automatically." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return image instance" + NL + "\t */" + NL + "\tpublic Image getBundledImage(String path) {" + NL + "\t\tImage image = getImageRegistry().get(path);" + NL + "\t\tif (image == null) {" + NL + "\t\t\tgetImageRegistry().put(path, getBundledImageDescriptor(path));" + NL + "\t\t\timage = getImageRegistry().get(path);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "}";
protected final String TEXT_22 = NL;
public String generate(Object argument)
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginXML.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginXML.java
index 8d54db43a..1aa8f4790 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginXML.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginXML.java
@@ -35,47 +35,50 @@ public class PluginXML
protected final String TEXT_18 = "\"" + NL + " objectClass=\"org.eclipse.core.resources.IFile\">" + NL + " <action" + NL + " label=\"Initialize ";
protected final String TEXT_19 = " diagram file\"" + NL + " class=\"";
protected final String TEXT_20 = "\"" + NL + " menubarPath=\"additions\"" + NL + " enablesFor=\"1\"" + NL + " id=\"";
- protected final String TEXT_21 = "ID\">" + NL + " </action>" + NL + " </objectContribution> " + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders\">" + NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider\"" + NL + " id=\"";
- protected final String TEXT_22 = "Presentation\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
- protected final String TEXT_23 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"delete\"/>" + NL + " </ElementType>" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart\">" + NL + " <GlobalActionId actionId=\"save\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>";
- protected final String TEXT_24 = NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.printing.render.providers.DiagramWithPrintGlobalActionHandlerProvider\"" + NL + " id=\"";
- protected final String TEXT_25 = "PresentationPrint\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
- protected final String TEXT_26 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"print\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>";
- protected final String TEXT_27 = NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider\"" + NL + " id=\"";
- protected final String TEXT_28 = "PresentationIDE\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
- protected final String TEXT_29 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"bookmark\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>" + NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider\"" + NL + " id=\"";
- protected final String TEXT_30 = "Render\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
- protected final String TEXT_31 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"cut\"/>" + NL + " <GlobalActionId actionId=\"copy\"/>" + NL + " <GlobalActionId actionId=\"paste\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.diagram.core.viewProviders\">" + NL + " <viewProvider class=\"";
- protected final String TEXT_32 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Diagram\" semanticHints=\"";
- protected final String TEXT_33 = "\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Node\" semanticHints=\"\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Edge\" semanticHints=\"\"/>" + NL + " </viewProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.diagram.ui.editpartProviders\">" + NL + " <editpartProvider class=\"";
- protected final String TEXT_34 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </editpartProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.emf.core.MetaModelProviders\">" + NL + " <MetaModelProvider class=\"";
- protected final String TEXT_35 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </MetaModelProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders\">" + NL + " <modelingAssistantProvider class=\"";
- protected final String TEXT_36 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </modelingAssistantProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.properties.propertiesProviders\">" + NL + " <PropertiesProvider" + NL + " verifyPluginLoaded=\"false\"" + NL + " class=\"";
- protected final String TEXT_37 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </PropertiesProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.iconProviders\">" + NL + " <IconProvider class=\"";
- protected final String TEXT_38 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </IconProvider>" + NL + " </extension>" + NL;
- protected final String TEXT_39 = NL + " ";
- protected final String TEXT_40 = NL + "<extension point=\"org.eclipse.emf.validation.constraintProviders\">";
- protected final String TEXT_41 = NL + "\t<category" + NL + "\t\tid=\"";
- protected final String TEXT_42 = "\"" + NL + "\t\tmandatory=\"false\"" + NL + "\t\tname=\"";
- protected final String TEXT_43 = "\"/>";
- protected final String TEXT_44 = NL + "\t<constraintProvider cache=\"true\">" + NL + "\t\t<package namespaceUri=\"";
- protected final String TEXT_45 = "\"/>";
- protected final String TEXT_46 = NL + "\t\t<constraints categories=\"";
- protected final String TEXT_47 = "\">" + NL + "\t\t\t<constraint id=\"";
- protected final String TEXT_48 = "\"" + NL + "\t\t\t\tlang=\"OCL\" ";
- protected final String TEXT_49 = NL + "\t\t\t\tname=\"";
- protected final String TEXT_50 = "\"" + NL + "\t\t\t\tseverity=\"";
- protected final String TEXT_51 = "\" statusCode=\"";
- protected final String TEXT_52 = "\">" + NL + "\t\t\t\t<![CDATA[";
- protected final String TEXT_53 = "]]>" + NL + "\t\t\t\t<description>" + NL + "\t </description>" + NL + "\t <message><![CDATA[";
- protected final String TEXT_54 = " audit violated]]></message>" + NL + "\t\t\t\t<target class=\"";
- protected final String TEXT_55 = "\"/>" + NL + "\t\t\t</constraint>" + NL + "\t\t</constraints>";
- protected final String TEXT_56 = NL + "\t</constraintProvider>" + NL + "</extension>" + NL + "" + NL + "<extension point=\"org.eclipse.emf.validation.constraintBindings\">" + NL + "\t<clientContext default=\"true\" id=\"";
- protected final String TEXT_57 = ".clientContext\">" + NL + "\t\t<enablement/>" + NL + "\t</clientContext>" + NL + "\t<binding category=\"";
- protected final String TEXT_58 = "\"" + NL + "\t\tcontext=\"";
- protected final String TEXT_59 = ".clientContext\"/>" + NL + "</extension>";
- protected final String TEXT_60 = NL + "</plugin>";
- protected final String TEXT_61 = NL;
+ protected final String TEXT_21 = "ID\">" + NL + " </action>" + NL + " </objectContribution> " + NL + " <objectContribution" + NL + " adaptable=\"false\"" + NL + " id=\"";
+ protected final String TEXT_22 = ".ui.objectContribution.FileEditorInputProxy1\"" + NL + " objectClass=\"org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy\">" + NL + " <action" + NL + " class=\"";
+ protected final String TEXT_23 = "\"" + NL + " enablesFor=\"1\"" + NL + " id=\"";
+ protected final String TEXT_24 = "ID\"" + NL + " label=\"Create Shortcut\"" + NL + " menubarPath=\"additions\">" + NL + " </action>" + NL + " </objectContribution> " + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders\">" + NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider\"" + NL + " id=\"";
+ protected final String TEXT_25 = "Presentation\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
+ protected final String TEXT_26 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"delete\"/>" + NL + " </ElementType>" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart\">" + NL + " <GlobalActionId actionId=\"save\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>";
+ protected final String TEXT_27 = NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.printing.render.providers.DiagramWithPrintGlobalActionHandlerProvider\"" + NL + " id=\"";
+ protected final String TEXT_28 = "PresentationPrint\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
+ protected final String TEXT_29 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"print\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>";
+ protected final String TEXT_30 = NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider\"" + NL + " id=\"";
+ protected final String TEXT_31 = "PresentationIDE\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
+ protected final String TEXT_32 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"bookmark\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>" + NL + " <GlobalActionHandlerProvider" + NL + " class=\"org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider\"" + NL + " id=\"";
+ protected final String TEXT_33 = "Render\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <ViewId id=\"";
+ protected final String TEXT_34 = "ID\">" + NL + " <ElementType class=\"org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart\">" + NL + " <GlobalActionId actionId=\"cut\"/>" + NL + " <GlobalActionId actionId=\"copy\"/>" + NL + " <GlobalActionId actionId=\"paste\"/>" + NL + " </ElementType>" + NL + " </ViewId>" + NL + " </GlobalActionHandlerProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.diagram.core.viewProviders\">" + NL + " <viewProvider class=\"";
+ protected final String TEXT_35 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Diagram\" semanticHints=\"";
+ protected final String TEXT_36 = "\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Node\" semanticHints=\"\"/>" + NL + " <context viewClass=\"org.eclipse.gmf.runtime.notation.Edge\" semanticHints=\"\"/>" + NL + " </viewProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.diagram.ui.editpartProviders\">" + NL + " <editpartProvider class=\"";
+ protected final String TEXT_37 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </editpartProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.emf.core.MetaModelProviders\">" + NL + " <MetaModelProvider class=\"";
+ protected final String TEXT_38 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </MetaModelProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders\">" + NL + " <modelingAssistantProvider class=\"";
+ protected final String TEXT_39 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </modelingAssistantProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.properties.propertiesProviders\">" + NL + " <PropertiesProvider" + NL + " verifyPluginLoaded=\"false\"" + NL + " class=\"";
+ protected final String TEXT_40 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </PropertiesProvider>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.gmf.runtime.common.ui.services.iconProviders\">" + NL + " <IconProvider class=\"";
+ protected final String TEXT_41 = "\">" + NL + " <Priority name=\"Medium\"/>" + NL + " </IconProvider>" + NL + " </extension>" + NL;
+ protected final String TEXT_42 = NL + " ";
+ protected final String TEXT_43 = NL + "<extension point=\"org.eclipse.emf.validation.constraintProviders\">";
+ protected final String TEXT_44 = NL + "\t<category" + NL + "\t\tid=\"";
+ protected final String TEXT_45 = "\"" + NL + "\t\tmandatory=\"false\"" + NL + "\t\tname=\"";
+ protected final String TEXT_46 = "\"/>";
+ protected final String TEXT_47 = NL + "\t<constraintProvider cache=\"true\">" + NL + "\t\t<package namespaceUri=\"";
+ protected final String TEXT_48 = "\"/>";
+ protected final String TEXT_49 = NL + "\t\t<constraints categories=\"";
+ protected final String TEXT_50 = "\">" + NL + "\t\t\t<constraint id=\"";
+ protected final String TEXT_51 = "\"" + NL + "\t\t\t\tlang=\"OCL\" ";
+ protected final String TEXT_52 = NL + "\t\t\t\tname=\"";
+ protected final String TEXT_53 = "\"" + NL + "\t\t\t\tseverity=\"";
+ protected final String TEXT_54 = "\" statusCode=\"";
+ protected final String TEXT_55 = "\">" + NL + "\t\t\t\t<![CDATA[";
+ protected final String TEXT_56 = "]]>" + NL + "\t\t\t\t<description>" + NL + "\t </description>" + NL + "\t <message><![CDATA[";
+ protected final String TEXT_57 = " audit violated]]></message>" + NL + "\t\t\t\t<target class=\"";
+ protected final String TEXT_58 = "\"/>" + NL + "\t\t\t</constraint>" + NL + "\t\t</constraints>";
+ protected final String TEXT_59 = NL + "\t</constraintProvider>" + NL + "</extension>" + NL + "" + NL + "<extension point=\"org.eclipse.emf.validation.constraintBindings\">" + NL + "\t<clientContext default=\"true\" id=\"";
+ protected final String TEXT_60 = ".clientContext\">" + NL + "\t\t<enablement/>" + NL + "\t</clientContext>" + NL + "\t<binding category=\"";
+ protected final String TEXT_61 = "\"" + NL + "\t\tcontext=\"";
+ protected final String TEXT_62 = ".clientContext\"/>" + NL + "</extension>";
+ protected final String TEXT_63 = NL + "</plugin>";
+ protected final String TEXT_64 = NL;
public String generate(Object argument)
{
@@ -125,47 +128,53 @@ final GenModel genModel = genDiagram.getEMFGenModel();
stringBuffer.append(TEXT_20);
stringBuffer.append(genDiagram.getInitDiagramFileActionQualifiedClassName());
stringBuffer.append(TEXT_21);
- stringBuffer.append(genModel.getModelName());
+ stringBuffer.append(genDiagram.getPluginID());
stringBuffer.append(TEXT_22);
- stringBuffer.append(genDiagram.getEditorQualifiedClassName());
+ stringBuffer.append(genDiagram.getCreateShortcutActionQualifiedClassName());
stringBuffer.append(TEXT_23);
- if (genDiagram.isPrintingEnabled()) {
+ stringBuffer.append(genDiagram.getCreateShortcutActionQualifiedClassName());
stringBuffer.append(TEXT_24);
stringBuffer.append(genModel.getModelName());
stringBuffer.append(TEXT_25);
stringBuffer.append(genDiagram.getEditorQualifiedClassName());
stringBuffer.append(TEXT_26);
- }
+ if (genDiagram.isPrintingEnabled()) {
stringBuffer.append(TEXT_27);
stringBuffer.append(genModel.getModelName());
stringBuffer.append(TEXT_28);
stringBuffer.append(genDiagram.getEditorQualifiedClassName());
stringBuffer.append(TEXT_29);
- stringBuffer.append(genModel.getModelName());
+ }
stringBuffer.append(TEXT_30);
- stringBuffer.append(genDiagram.getEditorQualifiedClassName());
+ stringBuffer.append(genModel.getModelName());
stringBuffer.append(TEXT_31);
- stringBuffer.append(genDiagram.getNotationViewProviderQualifiedClassName());
+ stringBuffer.append(genDiagram.getEditorQualifiedClassName());
stringBuffer.append(TEXT_32);
stringBuffer.append(genModel.getModelName());
stringBuffer.append(TEXT_33);
- stringBuffer.append(genDiagram.getEditPartProviderQualifiedClassName());
+ stringBuffer.append(genDiagram.getEditorQualifiedClassName());
stringBuffer.append(TEXT_34);
- stringBuffer.append(genDiagram.getMetamodelSupportProviderQualifiedClassName());
+ stringBuffer.append(genDiagram.getNotationViewProviderQualifiedClassName());
stringBuffer.append(TEXT_35);
- stringBuffer.append(genDiagram.getModelingAssistantProviderQualifiedClassName());
+ stringBuffer.append(genModel.getModelName());
stringBuffer.append(TEXT_36);
- stringBuffer.append(genDiagram.getPropertyProviderQualifiedClassName());
+ stringBuffer.append(genDiagram.getEditPartProviderQualifiedClassName());
stringBuffer.append(TEXT_37);
- stringBuffer.append(genDiagram.getIconProviderQualifiedClassName());
+ stringBuffer.append(genDiagram.getMetamodelSupportProviderQualifiedClassName());
stringBuffer.append(TEXT_38);
+ stringBuffer.append(genDiagram.getModelingAssistantProviderQualifiedClassName());
stringBuffer.append(TEXT_39);
+ stringBuffer.append(genDiagram.getPropertyProviderQualifiedClassName());
+ stringBuffer.append(TEXT_40);
+ stringBuffer.append(genDiagram.getIconProviderQualifiedClassName());
+ stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_42);
GenAuditContainer rootContainer = genDiagram.getAudits();
if(rootContainer != null) {
java.util.List containers = rootContainer != null ? rootContainer.getAllAuditContainers() : java.util.Collections.EMPTY_LIST;
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_43);
java.util.HashMap idMap = new java.util.HashMap();
for(int i = 0; i < containers.size(); i++) {
@@ -183,18 +192,18 @@ if(rootContainer != null) {
}
pathMap.put(category, id.toString());
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(id.toString());
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(category.getName());
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_46);
} // end of categories loop
String rootCategoryId = (String)pathMap.get(rootContainer);
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(genDiagram.getDomainMetaModel().getNSURI());
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_48);
int rulePos = 0;
for(java.util.Iterator catIt = containers.iterator(); catIt.hasNext(); rulePos++) {
@@ -205,41 +214,41 @@ if(rootContainer != null) {
String targetClassName = (targetClass != null) ? targetClass.getGenPackage().getNSName() + "." + targetClass.getInterfaceName() : "null";
String modeAttr = audit.isUseInLiveMode() ? "" : "mode=\"Batch\"";
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(pathMap.get(category));
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(audit.getId());
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_51);
stringBuffer.append(modeAttr);
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(audit.getName());
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(audit.getSeverity().getName());
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(Integer.toString(200 + rulePos));
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(audit.getRule() != null ? audit.getRule().getBody() : "");
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(audit.getName());
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(targetClassName);
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_58);
} // end of audits in category
} // end of category loop
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(rootCategoryId);
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(rootCategoryId);
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(rootCategoryId);
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_62);
}
- stringBuffer.append(TEXT_60);
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_64);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
index b7b8e2e2c..2b1366ca4 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
@@ -18,7 +18,7 @@ public class NodeEditPartGenerator {
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "package ";
protected final String TEXT_2 = ";" + NL;
- protected final String TEXT_3 = NL + "import org.eclipse.draw2d.IFigure;" + NL + "import org.eclipse.draw2d.StackLayout;" + NL + "import org.eclipse.gef.EditPolicy;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;" + NL + "import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder;" + NL + "import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;" + NL + "import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
+ protected final String TEXT_3 = NL + "import org.eclipse.draw2d.BorderLayout;" + NL + "import org.eclipse.draw2d.IFigure;" + NL + "import org.eclipse.draw2d.StackLayout;" + NL + "import org.eclipse.gef.EditPolicy;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;" + NL + "import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder;" + NL + "import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;" + NL + "import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;";
protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
protected final String TEXT_5 = " extends ShapeNodeEditPart {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure contentPane;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
protected final String TEXT_6 = "(View view) {" + NL + "\t\tsuper(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createDefaultEditPolicies() {";
@@ -47,26 +47,25 @@ public class NodeEditPartGenerator {
protected final String TEXT_29 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected NodeFigure createNodePlate() {";
protected final String TEXT_30 = NL + "\t\treturn new DefaultSizeNodeFigure(getMapMode().DPtoLP(";
protected final String TEXT_31 = "), getMapMode().DPtoLP(";
- protected final String TEXT_32 = "));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected NodeFigure createNodeFigure() {" + NL + "\t\tNodeFigure figure = createNodePlate();" + NL + "\t\tfigure.setBorder(new RectangularDropShadowLineBorder(0));" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\taddContentPane(shape);" + NL + "\t\treturn figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addContentPane(IFigure shape) {";
- protected final String TEXT_33 = NL + "\t\tcontentPane = new ";
- protected final String TEXT_34 = "();" + NL + "\t\tshape.setLayoutManager(new StackLayout());" + NL + "\t\tshape.add(contentPane);";
- protected final String TEXT_35 = NL + "\t\tcontentPane = shape;";
- protected final String TEXT_36 = NL + "\t\t";
- protected final String TEXT_37 = " layout = new ";
- protected final String TEXT_38 = "();" + NL + "\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\tcontentPane.setLayoutManager(layout);";
- protected final String TEXT_39 = NL + "\t\tcontentPane.setLayoutManager(new ";
- protected final String TEXT_40 = "() {" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
- protected final String TEXT_41 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
- protected final String TEXT_42 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}";
- protected final String TEXT_43 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_44 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint(";
- protected final String TEXT_45 = ".";
- protected final String TEXT_46 = "Labels.";
- protected final String TEXT_47 = ");" + NL + "\t}";
+ protected final String TEXT_32 = "));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected NodeFigure createNodeFigure() {" + NL + "\t\tNodeFigure figure = createNodePlate();" + NL + "\t\tfigure.setBorder(new RectangularDropShadowLineBorder(0));" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\tshape.setLayoutManager(new StackLayout());" + NL + "\t\t" + NL + "\t\tIFigure shapeContents = new Figure();" + NL + "\t\tshape.add(shapeContents);" + NL + "\t\tshapeContents.setLayoutManager(new BorderLayout());" + NL + "\t\taddContentPane(shapeContents);" + NL + "\t\tdecorateShape(shapeContents);" + NL + "" + NL + "\t\treturn figure;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void decorateShape(IFigure shapeContents) {" + NL + "\t\tView view = (View) getModel();" + NL + "\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcutted\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tFigure decorationPane = new Figure();" + NL + "\t\tdecorationPane.setLayoutManager(new BorderLayout());" + NL + "\t\tshapeContents.add(decorationPane, BorderLayout.BOTTOM);" + NL + "\t\t" + NL + "\t\tImageFigureEx imageFigure = new ImageFigureEx(";
+ protected final String TEXT_33 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"));" + NL + "\t\tdecorationPane.add(imageFigure, BorderLayout.RIGHT);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addContentPane(IFigure shape) {" + NL + "\t\tcontentPane = new ";
+ protected final String TEXT_34 = "();" + NL + "\t\tshape.add(contentPane, BorderLayout.CENTER);";
+ protected final String TEXT_35 = NL + "\t\t";
+ protected final String TEXT_36 = " layout = new ";
+ protected final String TEXT_37 = "();" + NL + "\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\tcontentPane.setLayoutManager(layout);";
+ protected final String TEXT_38 = NL + "\t\tcontentPane.setLayoutManager(new ";
+ protected final String TEXT_39 = "() {" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
+ protected final String TEXT_40 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
+ protected final String TEXT_41 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}";
+ protected final String TEXT_42 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_43 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint(";
+ protected final String TEXT_44 = ".";
+ protected final String TEXT_45 = "Labels.";
+ protected final String TEXT_46 = ");" + NL + "\t}";
+ protected final String TEXT_47 = NL;
protected final String TEXT_48 = NL;
- protected final String TEXT_49 = NL;
- protected final String TEXT_50 = NL + "}";
- protected final String TEXT_51 = NL;
+ protected final String TEXT_49 = NL + "}";
+ protected final String TEXT_50 = NL;
protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportUtil importManager) {
StringBuffer result = new StringBuffer();
@@ -213,7 +212,7 @@ if (viewmap instanceof FigureViewmap) {
figureQualifiedClassName = ((FigureViewmap) viewmap).getFigureQualifiedClassName();
if (figureQualifiedClassName == null || figureQualifiedClassName.trim().length() == 0) {
figureQualifiedClassName = "org.eclipse.draw2d.RectangleFigure";
-}
+ }
stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName(figureQualifiedClassName));
@@ -248,59 +247,55 @@ if (defSizeAttrs != null) {
stringBuffer.append(TEXT_31);
stringBuffer.append(height);
stringBuffer.append(TEXT_32);
- if (genNode.isExplicitContentPane()) {
+ stringBuffer.append(importManager.getImportedName(genDiagram.getPluginQualifiedClassName()));
stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
stringBuffer.append(TEXT_34);
- } else {
- stringBuffer.append(TEXT_35);
-}
-
if (!useFlowLayout) {
String layoutClassName = importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout");
+ stringBuffer.append(TEXT_35);
+ stringBuffer.append(layoutClassName);
stringBuffer.append(TEXT_36);
stringBuffer.append(layoutClassName);
stringBuffer.append(TEXT_37);
- stringBuffer.append(layoutClassName);
- stringBuffer.append(TEXT_38);
} else {
// Flow layout
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
}
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
if (!genNode.getLabels().isEmpty()) {
GenNodeLabel primaryLabel = (GenNodeLabel) genNode.getLabels().get(0);
String semanticHintsClassName = importManager.getImportedName(genDiagram.getSemanticHintsQualifiedClassName());
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(semanticHintsClassName);
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(genNode.getUniqueIdentifier());
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(primaryLabel.getSemanticHintFieldName());
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
}
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
if (genNode.getViewmap() instanceof InnerClassViewmap) {
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
stringBuffer.append(((InnerClassViewmap) genNode.getViewmap()).getClassBody());
}
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
return stringBuffer.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
index d7fea2c1d..7848aba4a 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
@@ -19,7 +19,7 @@ public class NodeItemSemanticEditPolicyGenerator {
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "package ";
protected final String TEXT_2 = ";" + NL;
- protected final String TEXT_3 = NL + "import org.eclipse.gef.commands.Command;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;";
+ protected final String TEXT_3 = NL + "import org.eclipse.gef.commands.Command;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
protected final String TEXT_5 = " extends ";
protected final String TEXT_6 = " {";
@@ -82,7 +82,7 @@ public class NodeItemSemanticEditPolicyGenerator {
protected final String TEXT_63 = ".init(newElement);";
protected final String TEXT_64 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
protected final String TEXT_65 = NL + "\t}";
- protected final String TEXT_66 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn getMSLWrapper(new MSLDestroyElementCommand(req));" + NL + "\t}";
+ protected final String TEXT_66 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn getMSLWrapper(new MSLDestroyElementCommand(req) {" + NL + "\t\t\tprotected EObject getElementToDestroy() {" + NL + "\t\t\t\tView view = (View) getHost().getModel();" + NL + "\t\t\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcutted\"); //$NON-NLS-1$" + NL + "\t\t\t\tif (annotation != null) {" + NL + "\t\t\t\t\treturn view;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn super.getElementToDestroy();" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}";
protected final String TEXT_67 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {";
protected final String TEXT_68 = NL + "\t\tif (";
protected final String TEXT_69 = ".";
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
index 3404f7b3c..bda1b6972 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
@@ -25,7 +25,7 @@ import org.eclipse.emf.ecore.EReference;
* <!-- end-user-doc -->
* @see org.eclipse.gmf.codegen.gmfgen.GMFGenFactory
* @model kind="package"
- * annotation="http://www.eclipse.org/emf/2004/EmfaticAnnotationMap constraints='http://www.eclipse.org/gmf/2005/constraints' meta='http://www.eclipse.org/gmf/2005/constraints/meta'"
+ * annotation="http://www.eclipse.org/emf/2004/EmfaticAnnotationMap constraints='http://www.eclipse.org/gmf/2005/constraints' meta='http://www.eclipse.org/gmf/2005/constraints/meta' deprecated='http://www.eclipse.org/gmf/2006/deprecated'"
* annotation="http://www.eclipse.org/gmf/2005/constraints import='platform:/resource/org.eclipse.gmf.runtime.notation/model/notation.ecore'"
* @generated
*/
@@ -605,13 +605,31 @@ public interface GMFGenPackage extends EPackage {
int GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME = GEN_COMMON_BASE_FEATURE_COUNT + 44;
/**
+ * The feature id for the '<em><b>Create Shortcut Action Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME = GEN_COMMON_BASE_FEATURE_COUNT + 45;
+
+ /**
+ * The feature id for the '<em><b>Element Chooser Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME = GEN_COMMON_BASE_FEATURE_COUNT + 46;
+
+ /**
* The number of structural features of the '<em>Gen Diagram</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int GEN_DIAGRAM_FEATURE_COUNT = GEN_COMMON_BASE_FEATURE_COUNT + 45;
+ int GEN_DIAGRAM_FEATURE_COUNT = GEN_COMMON_BASE_FEATURE_COUNT + 47;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.GenNodeImpl <em>Gen Node</em>}' class.
@@ -3231,6 +3249,28 @@ public interface GMFGenPackage extends EPackage {
EAttribute getGenDiagram_VisualIDRegistryClassName();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getCreateShortcutActionClassName <em>Create Shortcut Action Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Create Shortcut Action Class Name</em>'.
+ * @see org.eclipse.gmf.codegen.gmfgen.GenDiagram#getCreateShortcutActionClassName()
+ * @see #getGenDiagram()
+ * @generated
+ */
+ EAttribute getGenDiagram_CreateShortcutActionClassName();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getElementChooserClassName <em>Element Chooser Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Element Chooser Class Name</em>'.
+ * @see org.eclipse.gmf.codegen.gmfgen.GenDiagram#getElementChooserClassName()
+ * @see #getGenDiagram()
+ * @generated
+ */
+ EAttribute getGenDiagram_ElementChooserClassName();
+
+ /**
* Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getEditorPackageName <em>Editor Package Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenDiagram.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenDiagram.java
index b65651b8d..776a91a34 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenDiagram.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenDiagram.java
@@ -64,6 +64,8 @@ import org.eclipse.emf.common.util.EList;
* <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getPluginClassName <em>Plugin Class Name</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getPreferenceInitializerClassName <em>Preference Initializer Class Name</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getVisualIDRegistryClassName <em>Visual ID Registry Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getCreateShortcutActionClassName <em>Create Shortcut Action Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getElementChooserClassName <em>Element Chooser Class Name</em>}</li>
* </ul>
* </p>
*
@@ -453,6 +455,58 @@ public interface GenDiagram extends GenCommonBase {
void setVisualIDRegistryClassName(String value);
/**
+ * Returns the value of the '<em><b>Create Shortcut Action Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Create Shortcut Action Class 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>Create Shortcut Action Class Name</em>' attribute.
+ * @see #setCreateShortcutActionClassName(String)
+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getGenDiagram_CreateShortcutActionClassName()
+ * @model
+ * @generated
+ */
+ String getCreateShortcutActionClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getCreateShortcutActionClassName <em>Create Shortcut Action Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Create Shortcut Action Class Name</em>' attribute.
+ * @see #getCreateShortcutActionClassName()
+ * @generated
+ */
+ void setCreateShortcutActionClassName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Element Chooser Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Element Chooser Class 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>Element Chooser Class Name</em>' attribute.
+ * @see #setElementChooserClassName(String)
+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getGenDiagram_ElementChooserClassName()
+ * @model
+ * @generated
+ */
+ String getElementChooserClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getElementChooserClassName <em>Element Chooser Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Element Chooser Class Name</em>' attribute.
+ * @see #getElementChooserClassName()
+ * @generated
+ */
+ void setElementChooserClassName(String value);
+
+ /**
* Returns the value of the '<em><b>Editor Package Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
@@ -1269,6 +1323,22 @@ public interface GenDiagram extends GenCommonBase {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ String getCreateShortcutActionQualifiedClassName();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ String getElementChooserQualifiedClassName();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Indicates whether this diagram contains link creation constraints or not
* <!-- end-model-doc -->
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenNode.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenNode.java
index 0342d9232..66f6dbf99 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenNode.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenNode.java
@@ -35,7 +35,7 @@ import org.eclipse.emf.common.util.EList;
* @model annotation="http://www.eclipse.org/gmf/2005/constraints ocl='let c: ecore::EClass = diagramRunTimeClass.ecoreClass.oclAsType(ecore::EClass) in c = notation::Node or c.eAllSuperTypes->includes(notation::Node)'"
* @generated
*/
-public interface GenNode extends GenChildContainer{
+public interface GenNode extends GenChildContainer {
/**
* Returns the value of the '<em><b>Diagram</b></em>' container reference.
* It is bidirectional and its opposite is '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getNodes <em>Nodes</em>}'.
@@ -151,7 +151,7 @@ public interface GenNode extends GenChildContainer{
* @return the value of the '<em>Explicit Content Pane</em>' attribute.
* @see #setExplicitContentPane(boolean)
* @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getGenNode_ExplicitContentPane()
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Obsolete with new gmfgraph. Should be removed form the model.'"
* @generated
*/
boolean isExplicitContentPane();
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
index 735ef58bc..e3dfefda7 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
@@ -574,6 +574,24 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getGenDiagram_CreateShortcutActionClassName() {
+ return (EAttribute)genDiagramEClass.getEStructuralFeatures().get(45);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getGenDiagram_ElementChooserClassName() {
+ return (EAttribute)genDiagramEClass.getEStructuralFeatures().get(46);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EAttribute getGenDiagram_EditorPackageName() {
return (EAttribute)genDiagramEClass.getEStructuralFeatures().get(9);
}
@@ -2128,6 +2146,8 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
createEAttribute(genDiagramEClass, GEN_DIAGRAM__PLUGIN_CLASS_NAME);
createEAttribute(genDiagramEClass, GEN_DIAGRAM__PREFERENCE_INITIALIZER_CLASS_NAME);
createEAttribute(genDiagramEClass, GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME);
+ createEAttribute(genDiagramEClass, GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME);
+ createEAttribute(genDiagramEClass, GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME);
genCommonBaseEClass = createEClass(GEN_COMMON_BASE);
createEReference(genCommonBaseEClass, GEN_COMMON_BASE__DIAGRAM_RUN_TIME_CLASS);
@@ -2406,6 +2426,8 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
initEAttribute(getGenDiagram_PluginClassName(), ecorePackage.getEString(), "pluginClassName", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGenDiagram_PreferenceInitializerClassName(), ecorePackage.getEString(), "preferenceInitializerClassName", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGenDiagram_VisualIDRegistryClassName(), ecorePackage.getEString(), "visualIDRegistryClassName", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenDiagram_CreateShortcutActionClassName(), ecorePackage.getEString(), "createShortcutActionClassName", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenDiagram_ElementChooserClassName(), ecorePackage.getEString(), "elementChooserClassName", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
addEOperation(genDiagramEClass, theGenModelPackage.getGenModel(), "getEMFGenModel", 0, 1);
@@ -2475,6 +2497,10 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
addEOperation(genDiagramEClass, ecorePackage.getEString(), "getVisualIDRegistryQualifiedClassName", 0, 1);
+ addEOperation(genDiagramEClass, ecorePackage.getEString(), "getCreateShortcutActionQualifiedClassName", 0, 1);
+
+ addEOperation(genDiagramEClass, ecorePackage.getEString(), "getElementChooserQualifiedClassName", 0, 1);
+
initEClass(genCommonBaseEClass, GenCommonBase.class, "GenCommonBase", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getGenCommonBase_DiagramRunTimeClass(), theGenModelPackage.getGenClass(), null, "diagramRunTimeClass", null, 1, 1, GenCommonBase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGenCommonBase_VisualID(), ecorePackage.getEInt(), "visualID", null, 1, 1, GenCommonBase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -2735,6 +2761,8 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
createEmfaticAnnotationMapAnnotations();
// http://www.eclipse.org/gmf/2005/constraints
createConstraintsAnnotations();
+ // http://www.eclipse.org/gmf/2006/deprecated
+ createDeprecatedAnnotations();
// http://www.eclipse.org/gmf/2005/constraints/meta
createMetaAnnotations();
}
@@ -2752,8 +2780,9 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
source,
new String[] {
"constraints", "http://www.eclipse.org/gmf/2005/constraints",
- "meta", "http://www.eclipse.org/gmf/2005/constraints/meta"
- });
+ "meta", "http://www.eclipse.org/gmf/2005/constraints/meta",
+ "deprecated", "http://www.eclipse.org/gmf/2006/deprecated"
+ });
}
/**
@@ -2781,7 +2810,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
source,
new String[] {
"ocl", "let c: ecore::EClass = diagramRunTimeClass.ecoreClass.oclAsType(ecore::EClass) in c = notation::Node or c.eAllSuperTypes->includes(notation::Node)"
- });
+ });
addAnnotation
(genLinkEClass,
source,
@@ -2839,13 +2868,29 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
}
/**
+ * Initializes the annotations for <b>http://www.eclipse.org/gmf/2006/deprecated</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createDeprecatedAnnotations() {
+ String source = "http://www.eclipse.org/gmf/2006/deprecated";
+ addAnnotation
+ (getGenNode_ExplicitContentPane(),
+ source,
+ new String[] {
+ "documentation", "Obsolete with new gmfgraph. Should be removed form the model."
+ });
+ }
+
+ /**
* Initializes the annotations for <b>http://www.eclipse.org/gmf/2005/constraints/meta</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createMetaAnnotations() {
- String source = "http://www.eclipse.org/gmf/2005/constraints/meta";
+ String source = "http://www.eclipse.org/gmf/2005/constraints/meta";
addAnnotation
(getTypeModelFacet_ModelElementSelector(),
source,
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenDiagramImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenDiagramImpl.java
index 27f7f743a..c4801c6c7 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenDiagramImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenDiagramImpl.java
@@ -90,6 +90,8 @@ import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet;
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getPluginClassName <em>Plugin Class Name</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getPreferenceInitializerClassName <em>Preference Initializer Class Name</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getVisualIDRegistryClassName <em>Visual ID Registry Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getCreateShortcutActionClassName <em>Create Shortcut Action Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getElementChooserClassName <em>Element Chooser Class Name</em>}</li>
* </ul>
* </p>
*
@@ -937,6 +939,46 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
*/
protected String visualIDRegistryClassName = VISUAL_ID_REGISTRY_CLASS_NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getCreateShortcutActionClassName() <em>Create Shortcut Action Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreateShortcutActionClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String CREATE_SHORTCUT_ACTION_CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCreateShortcutActionClassName() <em>Create Shortcut Action Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCreateShortcutActionClassName()
+ * @generated
+ * @ordered
+ */
+ protected String createShortcutActionClassName = CREATE_SHORTCUT_ACTION_CLASS_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getElementChooserClassName() <em>Element Chooser Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getElementChooserClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String ELEMENT_CHOOSER_CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getElementChooserClassName() <em>Element Chooser Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getElementChooserClassName()
+ * @generated
+ * @ordered
+ */
+ protected String elementChooserClassName = ELEMENT_CHOOSER_CLASS_NAME_EDEFAULT;
+
private static final String DIAGRAM_EDITOR_TOKEN = "gmf.editor";
/**
@@ -1413,6 +1455,64 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
* <!-- end-user-doc -->
* @generated
*/
+ public String getCreateShortcutActionClassNameGen() {
+ return createShortcutActionClassName;
+ }
+
+ public String getCreateShortcutActionClassName() {
+ String value = getCreateShortcutActionClassNameGen();
+ if (isEmpty(value)) {
+ value = getDomainPackageCapName() + "CreateShortcutAction"; //$NON-NLS-1$
+ }
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCreateShortcutActionClassName(String newCreateShortcutActionClassName) {
+ String oldCreateShortcutActionClassName = createShortcutActionClassName;
+ createShortcutActionClassName = newCreateShortcutActionClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME, oldCreateShortcutActionClassName, createShortcutActionClassName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getElementChooserClassNameGen() {
+ return elementChooserClassName;
+ }
+
+ public String getElementChooserClassName() {
+ String value = getElementChooserClassNameGen();
+ if (isEmpty(value)) {
+ value = getDomainPackageCapName() + "ElementChooserDialog"; //$NON-NLS-1$
+ }
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setElementChooserClassName(String newElementChooserClassName) {
+ String oldElementChooserClassName = elementChooserClassName;
+ elementChooserClassName = newElementChooserClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME, oldElementChooserClassName, elementChooserClassName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public String getEditorPackageNameGen() {
return editorPackageName;
}
@@ -2301,6 +2401,24 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String getCreateShortcutActionQualifiedClassName() {
+ return getEditorPackageName() + '.' + getCreateShortcutActionClassName();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String getElementChooserQualifiedClassName() {
+ return getEditorPackageName() + '.' + getElementChooserClassName();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
@@ -2435,6 +2553,10 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
return getPreferenceInitializerClassName();
case GMFGenPackage.GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME:
return getVisualIDRegistryClassName();
+ case GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME:
+ return getCreateShortcutActionClassName();
+ case GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME:
+ return getElementChooserClassName();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -2583,6 +2705,12 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
case GMFGenPackage.GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME:
setVisualIDRegistryClassName((String)newValue);
return;
+ case GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME:
+ setCreateShortcutActionClassName((String)newValue);
+ return;
+ case GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME:
+ setElementChooserClassName((String)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -2729,6 +2857,12 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
case GMFGenPackage.GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME:
setVisualIDRegistryClassName(VISUAL_ID_REGISTRY_CLASS_NAME_EDEFAULT);
return;
+ case GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME:
+ setCreateShortcutActionClassName(CREATE_SHORTCUT_ACTION_CLASS_NAME_EDEFAULT);
+ return;
+ case GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME:
+ setElementChooserClassName(ELEMENT_CHOOSER_CLASS_NAME_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -2830,6 +2964,10 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
return PREFERENCE_INITIALIZER_CLASS_NAME_EDEFAULT == null ? preferenceInitializerClassName != null : !PREFERENCE_INITIALIZER_CLASS_NAME_EDEFAULT.equals(preferenceInitializerClassName);
case GMFGenPackage.GEN_DIAGRAM__VISUAL_ID_REGISTRY_CLASS_NAME:
return VISUAL_ID_REGISTRY_CLASS_NAME_EDEFAULT == null ? visualIDRegistryClassName != null : !VISUAL_ID_REGISTRY_CLASS_NAME_EDEFAULT.equals(visualIDRegistryClassName);
+ case GMFGenPackage.GEN_DIAGRAM__CREATE_SHORTCUT_ACTION_CLASS_NAME:
+ return CREATE_SHORTCUT_ACTION_CLASS_NAME_EDEFAULT == null ? createShortcutActionClassName != null : !CREATE_SHORTCUT_ACTION_CLASS_NAME_EDEFAULT.equals(createShortcutActionClassName);
+ case GMFGenPackage.GEN_DIAGRAM__ELEMENT_CHOOSER_CLASS_NAME:
+ return ELEMENT_CHOOSER_CLASS_NAME_EDEFAULT == null ? elementChooserClassName != null : !ELEMENT_CHOOSER_CLASS_NAME_EDEFAULT.equals(elementChooserClassName);
}
return super.eIsSet(featureID);
}
@@ -3219,6 +3357,10 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram {
result.append(preferenceInitializerClassName);
result.append(", visualIDRegistryClassName: ");
result.append(visualIDRegistryClassName);
+ result.append(", createShortcutActionClassName: ");
+ result.append(createShortcutActionClassName);
+ result.append(", elementChooserClassName: ");
+ result.append(elementChooserClassName);
result.append(')');
return result.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/EmitterFactory.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/EmitterFactory.java
index ae0d41fdf..f86efb61f 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/EmitterFactory.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/EmitterFactory.java
@@ -20,12 +20,14 @@ import org.eclipse.emf.codegen.jet.JETException;
import org.eclipse.gmf.codegen.templates.commands.ReorientConnectionViewCommandGenerator;
import org.eclipse.gmf.codegen.templates.editor.ActionBarContributorGenerator;
import org.eclipse.gmf.codegen.templates.editor.BuildPropertiesGenerator;
+import org.eclipse.gmf.codegen.templates.editor.CreateShortcutActionGenerator;
import org.eclipse.gmf.codegen.templates.editor.CreationWizardGenerator;
import org.eclipse.gmf.codegen.templates.editor.CreationWizardPageGenerator;
import org.eclipse.gmf.codegen.templates.editor.DiagramEditorUtilGenerator;
import org.eclipse.gmf.codegen.templates.editor.DiagramFileCreatorGenerator;
import org.eclipse.gmf.codegen.templates.editor.DocumentProviderGenerator;
import org.eclipse.gmf.codegen.templates.editor.EditorGenerator;
+import org.eclipse.gmf.codegen.templates.editor.ElementChooserGenerator;
import org.eclipse.gmf.codegen.templates.editor.InitDiagramFileActionGenerator;
import org.eclipse.gmf.codegen.templates.editor.ManifestGenerator;
import org.eclipse.gmf.codegen.templates.editor.MatchingStrategyGenerator;
@@ -258,7 +260,15 @@ public class EmitterFactory {
public static JETEmitter getEditorEmitter() throws JETException {
return initializeEmitter("/templates/editor/Editor.javajet", EditorGenerator.class);
}
+
+ public static JETEmitter getCreateShortcutActionEmitter() throws JETException {
+ return initializeEmitter("/templates/editor/CreateShortcutAction.javajet", CreateShortcutActionGenerator.class);
+ }
+ public static JETEmitter getElementChooserEmitter() throws JETException {
+ return initializeEmitter("/templates/editor/ElementChooser.javajet", ElementChooserGenerator.class);
+ }
+
public static JETEmitter getDocumentProviderEmitter() throws JETException {
return initializeEmitter("/templates/editor/DocumentProvider.javajet", DocumentProviderGenerator.class);
}
@@ -294,6 +304,10 @@ public class EmitterFactory {
public static JETEmitter getBuildPropertiesEmitter() throws JETException {
return initializeEmitter("/templates/editor/build.propertiesjet", BuildPropertiesGenerator.class);
}
+
+ public static GIFEmitter getShortcutImageEmitter() {
+ return new GIFEmitter("/templates/editor/shortcut.gif", getTemplatesBundle());
+ }
private static JETEmitter initializeEmitter(String relativeTemplatePath, Class precompiledTemplate) throws JETException {
String path = relativeTemplatePath;
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/GIFEmitter.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/GIFEmitter.java
new file mode 100644
index 000000000..cf24b0e9f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/GIFEmitter.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2006 Eclipse.org
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * vano - initial API and implementation
+ */
+package org.eclipse.gmf.codegen.util;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.osgi.framework.Bundle;
+
+
+public class GIFEmitter {
+
+ private String myInputFile;
+ private Bundle myTemplatesBundle;
+
+ public GIFEmitter(String fileName, Bundle templatesBundle) {
+ myInputFile = fileName;
+ myTemplatesBundle = templatesBundle;
+ }
+
+ public byte[] generateGif() {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ try {
+ URL url = myTemplatesBundle.getEntry(myInputFile);
+ InputStream is = new BufferedInputStream(url.openStream());
+ for (int next = is.read(); next != -1; next = is.read()) {
+ outputStream.write(next);
+ }
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return outputStream.toByteArray();
+ }
+
+}
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
index e7a93f713..867c93bb8 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
@@ -149,6 +149,8 @@ public class Generator implements Runnable {
generateCreationWizard();
generateCreationWizardPage();
generateEditor();
+ generateCreateShortcutAction();
+ generateElementChooser();
generateDocumentProvider();
generateActionBarContributor();
generateMatchingStrategy();
@@ -158,6 +160,7 @@ public class Generator implements Runnable {
generatePluginProperties();
generatePluginXml();
generateBuildProperties();
+ generateShortcutIcon();
if (myExceptions.isEmpty()) {
myRunStatus = Status.OK_STATUS;
@@ -605,6 +608,24 @@ public class Generator implements Runnable {
);
}
+ private void generateCreateShortcutAction() throws JETException, InterruptedException {
+ doGenerateJavaClass(
+ EmitterFactory.getCreateShortcutActionEmitter(),
+ myDiagram.getEditorPackageName(),
+ myDiagram.getCreateShortcutActionClassName(),
+ myDiagram
+ );
+ }
+
+ private void generateElementChooser() throws JETException, InterruptedException {
+ doGenerateJavaClass(
+ EmitterFactory.getElementChooserEmitter(),
+ myDiagram.getEditorPackageName(),
+ myDiagram.getElementChooserClassName(),
+ myDiagram
+ );
+ }
+
private void generateDocumentProvider() throws JETException, InterruptedException {
doGenerateJavaClass(
EmitterFactory.getDocumentProviderEmitter(),
@@ -665,7 +686,29 @@ public class Generator implements Runnable {
private void generateBuildProperties() throws JETException, InterruptedException {
doGenerateFile(EmitterFactory.getBuildPropertiesEmitter(), new Path("build.properties"));
}
+
+ private void generateShortcutIcon() throws InterruptedException {
+ Path iconPath = new Path("icons/shortcut.gif");
+ IProgressMonitor pm = getNextStepMonitor();
+ try {
+ pm.beginTask(iconPath.lastSegment(), 3);
+ IPath containerPath = myDestProject.getFullPath().append(iconPath.removeLastSegments(1));
+ CodeGenUtil.findOrCreateContainer(containerPath, false, (IPath) null, new SubProgressMonitor(pm, 1));
+ IFile f = myDestProject.getFile(iconPath);
+ if (f.exists()) {
+ f.setContents(new ByteArrayInputStream(EmitterFactory.getShortcutImageEmitter().generateGif()), true, true, new SubProgressMonitor(pm, 1));
+ } else {
+ f.create(new ByteArrayInputStream(EmitterFactory.getShortcutImageEmitter().generateGif()), true, new SubProgressMonitor(pm, 1));
+ }
+ f.getParent().refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1));
+ } catch (CoreException ex) {
+ myExceptions.add(ex.getStatus());
+ } finally {
+ pm.done();
+ }
+ }
+
/**
* Generate ordinary file. No merge is performed at the moment.
* @param emitter template to use
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet
new file mode 100644
index 000000000..3e8ccb4cc
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet
@@ -0,0 +1,109 @@
+<%@ jet package="org.eclipse.gmf.codegen.templates.editor" class="CreateShortcutActionGenerator"
+ imports="org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.codegen.util.ImportUtil"%>
+<%GenDiagram genDiagram = (GenDiagram) argument;%>
+package <%=genDiagram.getEditorPackageName()%>;
+
+<%ImportUtil importManager = new ImportUtil(genDiagram.getEditorPackageName());%>
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy;
+import org.eclipse.gmf.runtime.emf.core.edit.MRunnable;
+import org.eclipse.gmf.runtime.emf.core.util.OperationUtil;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+<%importManager.markImportLocation(stringBuffer);%>
+
+/**
+ * @generated
+ */
+public class <%=genDiagram.getCreateShortcutActionClassName()%> implements IObjectActionDelegate {
+
+ private FileEditorInputProxy mySelectedElement;
+ private Shell myShell;
+ private DiagramEditor myDiagramEditor;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ myDiagramEditor = targetPart instanceof DiagramEditor ? (DiagramEditor) targetPart : null;
+ myShell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ <%=importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName())%> elementChooser = new <%=importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName())%>(myShell);
+ int result = elementChooser.open();
+ if (result != Window.OK) {
+ return;
+ }
+ final EObject selectedElement = elementChooser.getSelectedModelElement();
+ if (selectedElement == null) {
+ return;
+ }
+
+ OperationUtil.runAsUnchecked(new MRunnable() {
+ public Object run() {
+ Node shortcutNode = ViewService.createNode(myDiagramEditor.getDiagram(), selectedElement, null, <%=importManager.getImportedName(genDiagram.getPluginQualifiedClassName())%>.DIAGRAM_PREFERENCES_HINT);
+
+ Collection allNodes = new ArrayList();
+ getAllNodes(allNodes, shortcutNode);
+ for (Iterator it = allNodes.iterator(); it.hasNext();) {
+ Node nextNode = (Node) it.next();
+ EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource("Shortcutted"); //$NON-NLS-1$
+ nextNode.getEAnnotations().add(annotation);
+ }
+ return null;
+ }
+ });
+
+ }
+
+ /**
+ * @generated
+ */
+ private void getAllNodes(Collection initial, Node node) {
+ initial.add(node);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ getAllNodes(initial, (Node) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof FileEditorInputProxy) {
+ mySelectedElement = (FileEditorInputProxy) structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isEnabled() {
+ return myDiagramEditor != null && mySelectedElement != null;
+ }
+
+}
+<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet
new file mode 100644
index 000000000..e32777de9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet
@@ -0,0 +1,323 @@
+<%@ jet package="org.eclipse.gmf.codegen.templates.editor" class="ElementChooserGenerator"
+ imports="org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.codegen.util.ImportUtil"%>
+<%GenDiagram genDiagram = (GenDiagram) argument;%>
+package <%=genDiagram.getEditorPackageName()%>;
+
+<%ImportUtil importManager = new ImportUtil(genDiagram.getEditorPackageName());%>
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+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.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gmf.runtime.emf.core.util.ResourceUtil;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+<%importManager.markImportLocation(stringBuffer);%>
+
+/**
+ * @generated
+ */
+public class <%=genDiagram.getElementChooserClassName()%> extends Dialog {
+
+ private AdapterFactory myModelAdapterFactory = null;
+ private TreeViewer myTreeViewer;
+ private EObject mySelectedModelElement;
+
+ /**
+ * @generated
+ */
+ public <%=genDiagram.getElementChooserClassName()%>(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ createModelBrowser(composite);
+ return composite;
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createButtonBar(Composite parent) {
+ Control buttonBar = super.createButtonBar(parent);
+ setOkButtonEnabled(false);
+ return buttonBar;
+ }
+
+ /**
+ * @generated
+ */
+ private void createModelBrowser(Composite composite) {
+ myTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
+ myTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ myTreeViewer.addFilter(new ModelFilesFilter());
+ myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
+ }
+
+ /**
+ * @generated
+ */
+ private void setOkButtonEnabled(boolean enabled) {
+ getButton(IDialogConstants.OK_ID).setEnabled(enabled);
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isValidModelFile(IFile file) {
+ return "<%=genDiagram.getDomainDiagramElement().getGenPackage().getPrefix().toLowerCase()%>".equals(file.getFullPath().getFileExtension());
+ }
+
+ /**
+ * @generated
+ */
+ private AdapterFactory getModelAdapterFactory() {
+ if (myModelAdapterFactory == null) {
+ List factories = new ArrayList();
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new <%=importManager.getImportedName(genDiagram.getDomainMetaModel().getQualifiedItemProviderAdapterFactoryClassName())%>());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ myModelAdapterFactory = new ComposedAdapterFactory(factories);
+ }
+ return myModelAdapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getSelectedModelElement() {
+ return mySelectedModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeContentProvider implements ITreeContentProvider {
+
+ private ITreeContentProvider myWorkbenchContentProvider = new WorkbenchContentProvider();
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(getModelAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
+ if (result != null && result.length > 0) {
+ return result;
+ }
+ if (parentElement instanceof IFile) {
+ IFile modelFile = (IFile) parentElement;
+ String resourcePath = modelFile.getLocation().toOSString();
+ Resource modelResource = ResourceUtil.findResource(resourcePath);
+ if (modelResource == null) {
+ modelResource = ResourceUtil.create(resourcePath);
+ }
+ if (!modelResource.isLoaded()) {
+ try {
+ ResourceUtil.load(modelResource);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return myAdapterFctoryContentProvier.getChildren(modelResource);
+ }
+ return myAdapterFctoryContentProvier.getChildren(parentElement);
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ Object parent = myWorkbenchContentProvider.getParent(element);
+ if (parent != null) {
+ return parent;
+ }
+ if (element instanceof EObject) {
+ EObject eObject = (EObject) element;
+ if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
+ String path = eObject.eResource().getURI().path();
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
+ }
+ return myAdapterFctoryContentProvier.getParent(eObject);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ if (element instanceof IFile) {
+ return isValidModelFile((IFile) element);
+ }
+ return myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
+ return elements;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchContentProvider.dispose();
+ myAdapterFctoryContentProvier.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
+ myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeLabelProvider implements ILabelProvider {
+
+ private WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(getModelAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ Image result = myWorkbenchLabelProvider.getImage(element);
+ return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ String result = myWorkbenchLabelProvider.getText(element);
+ return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelFilesFilter extends ViewerFilter {
+
+ /**
+ * @generated
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IContainer) {
+ return true;
+ }
+ if (element instanceof IFile) {
+ IFile file = (IFile) element;
+ return isValidModelFile(file);
+ }
+ return true;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class OkButtonEnabler implements ISelectionChangedListener {
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.size() == 1 && selection.getFirstElement() instanceof EObject) {
+ mySelectedModelElement = (EObject) selection.getFirstElement();
+ setOkButtonEnabled(true);
+ return;
+ }
+ }
+ mySelectedModelElement = null;
+ setOkButtonEnabled(false);
+ }
+
+ }
+
+}
+<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/Plugin.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/Plugin.javajet
index 8588c7bd7..7b7414ab0 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/editor/Plugin.javajet
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/Plugin.javajet
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.emf.core.internal.util.MSLAdapterFactoryManager;
import org.eclipse.gmf.runtime.emf.core.internal.util.MSLMetaModelManager;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
<%importManager.markImportLocation(stringBuffer);%>
@@ -157,5 +158,22 @@ for (int i = 0; i < genPackages.size(); i++) {
public static ImageDescriptor getBundledImageDescriptor(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
}
+
+ /**
+ * Returns an image for the image file at the given plug-in relative path.
+ * Client do not need to dispose this image. Images will be disposed automatically.
+ *
+ * @generated
+ * @param path the path
+ * @return image instance
+ */
+ public Image getBundledImage(String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
}
<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/plugin.xmljet b/plugins/org.eclipse.gmf.codegen/templates/editor/plugin.xmljet
index c101f02be..8698aa212 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/editor/plugin.xmljet
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/plugin.xmljet
@@ -64,7 +64,19 @@ final GenModel genModel = genDiagram.getEMFGenModel();
enablesFor="1"
id="<%=genDiagram.getInitDiagramFileActionQualifiedClassName()%>ID">
</action>
- </objectContribution>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="<%=genDiagram.getPluginID()%>.ui.objectContribution.FileEditorInputProxy1"
+ objectClass="org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy">
+ <action
+ class="<%=genDiagram.getCreateShortcutActionQualifiedClassName()%>"
+ enablesFor="1"
+ id="<%=genDiagram.getCreateShortcutActionQualifiedClassName()%>ID"
+ label="Create Shortcut"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
</extension>
<extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders">
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/shortcut.gif b/plugins/org.eclipse.gmf.codegen/templates/editor/shortcut.gif
new file mode 100644
index 000000000..c8ebb3156
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/shortcut.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet b/plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet
index 9da5dc278..a91b707b5 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet
+++ b/plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet
@@ -9,6 +9,7 @@ boolean useFlowLayout = genNode.getChildContainersPlacement() == CompartmentPlac
package <%=genDiagram.getEditPartsPackageName()%>;
<%ImportUtil importManager = new ImportUtil(genDiagram.getEditPartsPackageName());%>
+import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPolicy;
@@ -18,6 +19,8 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.RectangularDropShadowLineBorder
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ImageFigureEx;
<%importManager.markImportLocation(stringBuffer);%>
/**
@@ -79,7 +82,7 @@ if (viewmap instanceof FigureViewmap) {
figureQualifiedClassName = ((FigureViewmap) viewmap).getFigureQualifiedClassName();
if (figureQualifiedClassName == null || figureQualifiedClassName.trim().length() == 0) {
figureQualifiedClassName = "org.eclipse.draw2d.RectangleFigure";
-}
+ }
%>
return new <%=importManager.getImportedName(figureQualifiedClassName)%>()<%if (useFlowLayout) {%> {
protected boolean useLocalCoordinates() {
@@ -125,23 +128,42 @@ if (defSizeAttrs != null) {
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
- addContentPane(shape);
+ shape.setLayoutManager(new StackLayout());
+
+ IFigure shapeContents = new Figure();
+ shape.add(shapeContents);
+ shapeContents.setLayoutManager(new BorderLayout());
+ addContentPane(shapeContents);
+ decorateShape(shapeContents);
+
return figure;
}
+
+ /**
+ * @generated
+ */
+ private void decorateShape(IFigure shapeContents) {
+ View view = (View) getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation == null) {
+ return;
+ }
+
+ Figure decorationPane = new Figure();
+ decorationPane.setLayoutManager(new BorderLayout());
+ shapeContents.add(decorationPane, BorderLayout.BOTTOM);
+
+ ImageFigureEx imageFigure = new ImageFigureEx(<%=importManager.getImportedName(genDiagram.getPluginQualifiedClassName())%>.getInstance().getBundledImage("icons/shortcut.gif"));
+ decorationPane.add(imageFigure, BorderLayout.RIGHT);
+ }
/**
* @generated
*/
protected void addContentPane(IFigure shape) {
-<%if (genNode.isExplicitContentPane()) {%>
contentPane = new <%=importManager.getImportedName("org.eclipse.draw2d.Figure")%>();
- shape.setLayoutManager(new StackLayout());
- shape.add(contentPane);
-<%} else {%>
- contentPane = shape;
+ shape.add(contentPane, BorderLayout.CENTER);
<%
-}
-
if (!useFlowLayout) {
String layoutClassName = importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout");
%>
diff --git a/plugins/org.eclipse.gmf.codegen/templates/policies/NodeItemSemanticEditPolicy.javajet b/plugins/org.eclipse.gmf.codegen/templates/policies/NodeItemSemanticEditPolicy.javajet
index 95ba285f3..7b84c5cfd 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/policies/NodeItemSemanticEditPolicy.javajet
+++ b/plugins/org.eclipse.gmf.codegen/templates/policies/NodeItemSemanticEditPolicy.javajet
@@ -12,6 +12,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.commands.core.commands.MSLDestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gmf.runtime.notation.View;
<%importManager.markImportLocation(stringBuffer);%>
/**
@@ -31,7 +34,16 @@ if (genNode.getChildNodes().size() > 0) {
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new MSLDestroyElementCommand(req));
+ return getMSLWrapper(new MSLDestroyElementCommand(req) {
+ protected EObject getElementToDestroy() {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcutted"); //$NON-NLS-1$
+ if (annotation != null) {
+ return view;
+ }
+ return super.getElementToDestroy();
+ }
+ });
}
<%
GenPackage genPackage = genDiagram.getDomainMetaModel();
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ConnectionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ConnectionGenerator.java
index 90100f309..7dad890eb 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ConnectionGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ConnectionGenerator.java
@@ -18,54 +18,54 @@ public class ConnectionGenerator
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "";
protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_3 = " extends ";
- protected final String TEXT_4 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_5 = "() {";
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = ".setFill(";
- protected final String TEXT_9 = ");";
- protected final String TEXT_10 = NL + "\t\t";
- protected final String TEXT_11 = ".setOutline(";
- protected final String TEXT_12 = ");";
- protected final String TEXT_13 = NL + "\t\t";
- protected final String TEXT_14 = ".setLineWidth(";
- protected final String TEXT_15 = ");";
- protected final String TEXT_16 = NL + "\t\t";
- protected final String TEXT_17 = ".setLineStyle(org.eclipse.draw2d.Graphics.";
- protected final String TEXT_18 = ");";
- protected final String TEXT_19 = NL + "\t\t";
- protected final String TEXT_20 = ".setFillXOR(";
- protected final String TEXT_21 = ");";
- protected final String TEXT_22 = NL + "\t\t";
- protected final String TEXT_23 = ".setOutlineXOR(";
- protected final String TEXT_24 = ");";
- protected final String TEXT_25 = NL + "\t\t";
- protected final String TEXT_26 = ".addPoint(new org.eclipse.draw2d.geometry.Point(";
- protected final String TEXT_27 = ", ";
- protected final String TEXT_28 = "));";
- protected final String TEXT_29 = NL + "\t\t";
- protected final String TEXT_30 = ".setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(";
- protected final String TEXT_31 = ", ";
- protected final String TEXT_32 = "));";
- protected final String TEXT_33 = NL + "\t\tsetSourceDecoration(createSourceDecoration());";
- protected final String TEXT_34 = NL + "\t\tsetTargetDecoration(createTargetDecoration());";
- protected final String TEXT_35 = NL + "\t}" + NL;
- protected final String TEXT_36 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_37 = " createSourceDecoration() {";
- protected final String TEXT_38 = NL;
- protected final String TEXT_39 = "\t\t";
- protected final String TEXT_40 = " ";
- protected final String TEXT_41 = " = new ";
- protected final String TEXT_42 = "();";
- protected final String TEXT_43 = NL;
- protected final String TEXT_44 = NL + "\t\torg.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();";
- protected final String TEXT_45 = NL + "\t\tpl.addPoint(";
- protected final String TEXT_46 = ", ";
- protected final String TEXT_47 = ");";
- protected final String TEXT_48 = NL + "\t\t";
- protected final String TEXT_49 = ".setTemplate(pl);";
- protected final String TEXT_50 = NL + "\t\treturn ";
+ protected final String TEXT_3 = " extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_4 = "() {";
+ protected final String TEXT_5 = NL;
+ protected final String TEXT_6 = NL + "\t\t";
+ protected final String TEXT_7 = ".setFill(";
+ protected final String TEXT_8 = ");";
+ protected final String TEXT_9 = NL + "\t\t";
+ protected final String TEXT_10 = ".setOutline(";
+ protected final String TEXT_11 = ");";
+ protected final String TEXT_12 = NL + "\t\t";
+ protected final String TEXT_13 = ".setLineWidth(";
+ protected final String TEXT_14 = ");";
+ protected final String TEXT_15 = NL + "\t\t";
+ protected final String TEXT_16 = ".setLineStyle(org.eclipse.draw2d.Graphics.";
+ protected final String TEXT_17 = ");";
+ protected final String TEXT_18 = NL + "\t\t";
+ protected final String TEXT_19 = ".setFillXOR(";
+ protected final String TEXT_20 = ");";
+ protected final String TEXT_21 = NL + "\t\t";
+ protected final String TEXT_22 = ".setOutlineXOR(";
+ protected final String TEXT_23 = ");";
+ protected final String TEXT_24 = NL + "\t\t";
+ protected final String TEXT_25 = ".addPoint(new org.eclipse.draw2d.geometry.Point(";
+ protected final String TEXT_26 = ", ";
+ protected final String TEXT_27 = "));";
+ protected final String TEXT_28 = NL + "\t\t";
+ protected final String TEXT_29 = ".setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(";
+ protected final String TEXT_30 = ", ";
+ protected final String TEXT_31 = "));";
+ protected final String TEXT_32 = NL + "\t\tsetSourceDecoration(createSourceDecoration());";
+ protected final String TEXT_33 = NL + "\t\tsetTargetDecoration(createTargetDecoration());";
+ protected final String TEXT_34 = NL + "\t}" + NL;
+ protected final String TEXT_35 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_36 = " createSourceDecoration() {";
+ protected final String TEXT_37 = NL;
+ protected final String TEXT_38 = "\t\t";
+ protected final String TEXT_39 = " ";
+ protected final String TEXT_40 = " = new ";
+ protected final String TEXT_41 = "();";
+ protected final String TEXT_42 = NL;
+ protected final String TEXT_43 = NL + "\t\torg.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();";
+ protected final String TEXT_44 = NL + "\t\tpl.addPoint(";
+ protected final String TEXT_45 = ", ";
+ protected final String TEXT_46 = ");";
+ protected final String TEXT_47 = NL + "\t\t";
+ protected final String TEXT_48 = ".setTemplate(pl);";
+ protected final String TEXT_49 = NL + "\t\t";
+ protected final String TEXT_50 = ".setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));" + NL + "\t\treturn ";
protected final String TEXT_51 = ";" + NL + "\t}";
protected final String TEXT_52 = NL;
protected final String TEXT_53 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
@@ -82,10 +82,11 @@ public class ConnectionGenerator
protected final String TEXT_64 = ");";
protected final String TEXT_65 = NL + "\t\t";
protected final String TEXT_66 = ".setTemplate(pl);";
- protected final String TEXT_67 = NL + "\t\treturn ";
- protected final String TEXT_68 = ";" + NL + "\t}";
- protected final String TEXT_69 = NL + "}";
- protected final String TEXT_70 = NL;
+ protected final String TEXT_67 = NL + "\t\t";
+ protected final String TEXT_68 = ".setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));" + NL + "\t\treturn ";
+ protected final String TEXT_69 = ";" + NL + "\t}";
+ protected final String TEXT_70 = NL + "}";
+ protected final String TEXT_71 = NL;
public String generate(Object argument)
{
@@ -98,110 +99,110 @@ final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
stringBuffer.append(TEXT_2);
stringBuffer.append(figure.getName());
stringBuffer.append(TEXT_3);
- stringBuffer.append(fqnSwitch.doSwitch(figure));
- stringBuffer.append(TEXT_4);
stringBuffer.append(figure.getName());
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
Shape shapeFigure = figure;
String shapeVarName = "this";
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
// PERHAPS, do this with reflection?
if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(shapeFigure.isFill());
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(shapeFigure.isOutline());
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(shapeFigure.getLineWidth());
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(shapeFigure.getLineKind().getName());
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(shapeFigure.isXorFill());
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
stringBuffer.append(shapeFigure.isXorOutline());
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
} if (shapeFigure instanceof Polyline && !((Polyline) shapeFigure).getTemplate().isEmpty()) {
for (Iterator pointIt = ((Polyline) shapeFigure).getTemplate().iterator(); pointIt.hasNext(); ) {
Point p = (Point) pointIt.next();
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(p.getX());
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(p.getY());
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
}
} else if (shapeFigure instanceof RoundedRectangle) {
RoundedRectangle rrFigure = (RoundedRectangle) shapeFigure;
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(rrFigure.getCornerWidth());
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(rrFigure.getCornerHeight());
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
}
if (figure.getSourceDecoration() != null) {
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
}
if (figure.getTargetDecoration() != null) {
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
}
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
String decFigVarName = "df";
if (figure.getSourceDecoration() != null) {
DecorationFigure df = figure.getSourceDecoration();
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(fqnSwitch.doSwitch(df));
+ stringBuffer.append(TEXT_36);
stringBuffer.append(TEXT_37);
stringBuffer.append(TEXT_38);
- stringBuffer.append(TEXT_39);
stringBuffer.append(fqnSwitch.doSwitch(df));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(decFigVarName);
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(fqnSwitch.doSwitch(df));
+ stringBuffer.append(TEXT_41);
stringBuffer.append(TEXT_42);
- stringBuffer.append(TEXT_43);
/*include FigureChildren*/
if ((df instanceof PolylineDecoration || df instanceof PolygonDecoration) && !((Polyline) df).getTemplate().isEmpty()) {
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
for (Iterator pointIt = ((Polyline) df).getTemplate().iterator(); pointIt.hasNext(); ) {
Point p = (Point) pointIt.next();
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(p.getX());
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(p.getY());
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
} /*for*/
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(decFigVarName);
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
} /*if instanceof */
+ stringBuffer.append(TEXT_49);
+ stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_50);
stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_51);
@@ -239,9 +240,11 @@ DecorationFigure df = figure.getTargetDecoration();
stringBuffer.append(TEXT_67);
stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_68);
- }
+ stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_69);
+ }
stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_71);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/DecorationFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/DecorationFigureGenerator.java
index 5cce529f2..1d3a0fe9f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/DecorationFigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/DecorationFigureGenerator.java
@@ -32,38 +32,40 @@ public class DecorationFigureGenerator
protected final String TEXT_14 = ");";
protected final String TEXT_15 = NL + "\t\t";
protected final String TEXT_16 = ".setTemplate(pl);";
- protected final String TEXT_17 = NL + "\t\tsetScale(";
- protected final String TEXT_18 = ", ";
- protected final String TEXT_19 = ");";
- protected final String TEXT_20 = NL;
- protected final String TEXT_21 = NL + "\t\t";
- protected final String TEXT_22 = ".setFill(";
- protected final String TEXT_23 = ");";
- protected final String TEXT_24 = NL + "\t\t";
- protected final String TEXT_25 = ".setOutline(";
- protected final String TEXT_26 = ");";
- protected final String TEXT_27 = NL + "\t\t";
- protected final String TEXT_28 = ".setLineWidth(";
- protected final String TEXT_29 = ");";
- protected final String TEXT_30 = NL + "\t\t";
- protected final String TEXT_31 = ".setLineStyle(org.eclipse.draw2d.Graphics.";
- protected final String TEXT_32 = ");";
- protected final String TEXT_33 = NL + "\t\t";
- protected final String TEXT_34 = ".setFillXOR(";
- protected final String TEXT_35 = ");";
- protected final String TEXT_36 = NL + "\t\t";
- protected final String TEXT_37 = ".setOutlineXOR(";
- protected final String TEXT_38 = ");";
- protected final String TEXT_39 = NL + "\t\t";
- protected final String TEXT_40 = ".addPoint(new org.eclipse.draw2d.geometry.Point(";
- protected final String TEXT_41 = ", ";
- protected final String TEXT_42 = "));";
- protected final String TEXT_43 = NL + "\t\t";
- protected final String TEXT_44 = ".setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(";
- protected final String TEXT_45 = ", ";
- protected final String TEXT_46 = "));";
- protected final String TEXT_47 = NL + "\t}" + NL + "}";
- protected final String TEXT_48 = NL;
+ protected final String TEXT_17 = NL + "\t\t";
+ protected final String TEXT_18 = ".setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));";
+ protected final String TEXT_19 = NL + "\t\tsetScale(";
+ protected final String TEXT_20 = ", ";
+ protected final String TEXT_21 = ");";
+ protected final String TEXT_22 = NL;
+ protected final String TEXT_23 = NL + "\t\t";
+ protected final String TEXT_24 = ".setFill(";
+ protected final String TEXT_25 = ");";
+ protected final String TEXT_26 = NL + "\t\t";
+ protected final String TEXT_27 = ".setOutline(";
+ protected final String TEXT_28 = ");";
+ protected final String TEXT_29 = NL + "\t\t";
+ protected final String TEXT_30 = ".setLineWidth(";
+ protected final String TEXT_31 = ");";
+ protected final String TEXT_32 = NL + "\t\t";
+ protected final String TEXT_33 = ".setLineStyle(org.eclipse.draw2d.Graphics.";
+ protected final String TEXT_34 = ");";
+ protected final String TEXT_35 = NL + "\t\t";
+ protected final String TEXT_36 = ".setFillXOR(";
+ protected final String TEXT_37 = ");";
+ protected final String TEXT_38 = NL + "\t\t";
+ protected final String TEXT_39 = ".setOutlineXOR(";
+ protected final String TEXT_40 = ");";
+ protected final String TEXT_41 = NL + "\t\t";
+ protected final String TEXT_42 = ".addPoint(new org.eclipse.draw2d.geometry.Point(";
+ protected final String TEXT_43 = ", ";
+ protected final String TEXT_44 = "));";
+ protected final String TEXT_45 = NL + "\t\t";
+ protected final String TEXT_46 = ".setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(";
+ protected final String TEXT_47 = ", ";
+ protected final String TEXT_48 = "));";
+ protected final String TEXT_49 = NL + "\t}" + NL + "}";
+ protected final String TEXT_50 = NL;
public String generate(Object argument)
{
@@ -109,80 +111,83 @@ String decFigVarName = "this";
stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_16);
} /*if instanceof */
- if (scale != null) {
stringBuffer.append(TEXT_17);
- stringBuffer.append(scale.getX());
+ stringBuffer.append(decFigVarName);
stringBuffer.append(TEXT_18);
- stringBuffer.append(scale.getY());
+ if (scale != null) {
stringBuffer.append(TEXT_19);
+ stringBuffer.append(scale.getX());
+ stringBuffer.append(TEXT_20);
+ stringBuffer.append(scale.getY());
+ stringBuffer.append(TEXT_21);
}
Shape shapeFigure = (Shape) figure;
String shapeVarName = "this";
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_22);
// PERHAPS, do this with reflection?
if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_23);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(shapeFigure.isFill());
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_25);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_27);
stringBuffer.append(shapeFigure.isOutline());
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_28);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(shapeFigure.getLineWidth());
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_31);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(shapeFigure.getLineKind().getName());
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_34);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(shapeFigure.isXorFill());
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_37);
} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(shapeFigure.isXorOutline());
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_40);
} if (shapeFigure instanceof Polyline && !((Polyline) shapeFigure).getTemplate().isEmpty()) {
for (Iterator pointIt = ((Polyline) shapeFigure).getTemplate().iterator(); pointIt.hasNext(); ) {
Point p = (Point) pointIt.next();
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(p.getX());
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(p.getY());
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_44);
}
} else if (shapeFigure instanceof RoundedRectangle) {
RoundedRectangle rrFigure = (RoundedRectangle) shapeFigure;
- stringBuffer.append(TEXT_43);
- stringBuffer.append(shapeVarName);
- stringBuffer.append(TEXT_44);
- stringBuffer.append(rrFigure.getCornerWidth());
stringBuffer.append(TEXT_45);
- stringBuffer.append(rrFigure.getCornerHeight());
+ stringBuffer.append(shapeVarName);
stringBuffer.append(TEXT_46);
- }
+ stringBuffer.append(rrFigure.getCornerWidth());
stringBuffer.append(TEXT_47);
+ stringBuffer.append(rrFigure.getCornerHeight());
stringBuffer.append(TEXT_48);
+ }
+ stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_50);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
index cc17acc7b..21a6552b7 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
@@ -9,7 +9,7 @@ final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
/**
* @generated
*/
-public class <%=figure.getName()%> extends <%=fqnSwitch.doSwitch(figure)%> {
+public class <%=figure.getName()%> extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {
/**
* @generated
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
index 447a41e18..a87684ad9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
@@ -9,3 +9,4 @@
<%} /*for*/ %>
<%=decFigVarName%>.setTemplate(pl);
<%} /*if instanceof */ %>
+ <%=decFigVarName%>.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); \ No newline at end of file
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/HandcodedImplTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/HandcodedImplTest.java
index 9e6e27cf1..9dad59d8c 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/HandcodedImplTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/HandcodedImplTest.java
@@ -143,6 +143,8 @@ public class HandcodedImplTest extends ConfiguredTestCase {
checkClassName(state, "GenDiagram:PreferenceInitializer", genDiagram.getPreferenceInitializerClassName(), genDiagram.getPreferenceInitializerQualifiedClassName());
checkClassName(state, "GenDiagram:VisualIDRegistry", genDiagram.getVisualIDRegistryClassName(), genDiagram.getVisualIDRegistryQualifiedClassName());
checkClassName(state, "GenDiagram:LinkCreationConstraints", genDiagram.getLinkCreationConstraintsClassName(), genDiagram.getLinkCreationConstraintsQualifiedClassName());
+ checkClassName(state, "GenDiagram:CreateShortcutAction", genDiagram.getCreateShortcutActionClassName(), genDiagram.getCreateShortcutActionQualifiedClassName());
+ checkClassName(state, "GenDiagram:ElementChooser", genDiagram.getElementChooserClassName(), genDiagram.getElementChooserQualifiedClassName());
Palette palette = genDiagram.getPalette();
checkClassName(state, "Palette:Factory", palette.getFactoryClassName(), palette.getFactoryQualifiedClassName());
for (GenCommonBaseIterator entities = new GenCommonBaseIterator(genDiagram); entities.hasNext();) {

Back to the top