Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2008-10-14 08:53:48 -0400
committeratikhomirov2008-10-14 08:53:48 -0400
commit9e1d0dfc4844bb7b1d1391f4cdb3c1ab9ae53275 (patch)
tree5cfb83e5899c91ac71583b95c8f747ea93ca1db1
parentd07d93b4e5feeee69290000d5b0a9ba673da3922 (diff)
downloadorg.eclipse.gmf-tooling-9e1d0dfc4844bb7b1d1391f4cdb3c1ab9ae53275.tar.gz
org.eclipse.gmf-tooling-9e1d0dfc4844bb7b1d1391f4cdb3c1ab9ae53275.tar.xz
org.eclipse.gmf-tooling-9e1d0dfc4844bb7b1d1391f4cdb3c1ab9ae53275.zip
[174961] Menu actions - refactor LoadResource and CreateShortcut actions to use generic genmodel action infrastructure
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore1
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel1
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/EditorCandies.java8
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java49
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenAction.java27
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/Shortcuts.java5
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/CreateShortcutActionImpl.java7
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java67
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenActionImpl.java54
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/InitDiagramActionImpl.java9
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/LoadResourceActionImpl.java9
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java19
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java34
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt98
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt42
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt22
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt20
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt6
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreateShortcutAction.xpt130
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt28
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/LoadResourceAction.xpt81
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext31
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt32
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt4
26 files changed, 447 insertions, 343 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
index 9dc8422de..aed45cab4 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
@@ -2065,6 +2065,7 @@
<details key="documentation" value="Action that is generated along with diagram action, i.e. there's a template that provides its implementation"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="qualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LoadResourceAction" eSuperTypes="#//GenAction"/>
<eClassifiers xsi:type="ecore:EClass" name="InitDiagramAction" eSuperTypes="#//GenAction"/>
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
index 8702a29d6..f0d7ed23b 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
@@ -934,6 +934,7 @@
</genClasses>
<genClasses image="false" ecoreClass="gmfgen.ecore#//GenAction">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenAction/qualifiedClassName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenAction/name"/>
</genClasses>
<genClasses ecoreClass="gmfgen.ecore#//LoadResourceAction"/>
<genClasses ecoreClass="gmfgen.ecore#//InitDiagramAction"/>
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/EditorCandies.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/EditorCandies.java
index fc895f550..3018617d1 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/EditorCandies.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/EditorCandies.java
@@ -212,7 +212,7 @@ public interface EditorCandies extends EObject {
* @return the value of the '<em>Init Diagram File Action Class Name</em>' attribute.
* @see #setInitDiagramFileActionClassName(String)
* @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getEditorCandies_InitDiagramFileActionClassName()
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use InitDiagramAction instead'"
* @generated
*/
String getInitDiagramFileActionClassName();
@@ -368,7 +368,7 @@ public interface EditorCandies extends EObject {
* @return the value of the '<em>Load Resource Action Class Name</em>' attribute.
* @see #setLoadResourceActionClassName(String)
* @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getEditorCandies_LoadResourceActionClassName()
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use LoadResourceAction instead'"
* @generated
*/
String getLoadResourceActionClassName();
@@ -445,6 +445,7 @@ public interface EditorCandies extends EObject {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation"
+ * annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use InitDiagramAction instead'"
* @generated
*/
String getInitDiagramFileActionQualifiedClassName();
@@ -493,6 +494,7 @@ public interface EditorCandies extends EObject {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation"
+ * annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use LoadResourceAction instead'"
* @generated
*/
String getLoadResourceActionQualifiedClassName();
@@ -500,7 +502,7 @@ public interface EditorCandies extends EObject {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use InitDiagramAction instead'"
* @generated
*/
boolean generateInitDiagramAction();
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 827378ef9..6c3a075d7 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
@@ -9651,13 +9651,22 @@ public interface GMFGenPackage extends EPackage {
int GEN_ACTION__QUALIFIED_CLASS_NAME = GEN_CONTRIBUTION_ITEM_FEATURE_COUNT + 0;
/**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GEN_ACTION__NAME = GEN_CONTRIBUTION_ITEM_FEATURE_COUNT + 1;
+
+ /**
* The number of structural features of the '<em>Gen Action</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int GEN_ACTION_FEATURE_COUNT = GEN_CONTRIBUTION_ITEM_FEATURE_COUNT + 1;
+ int GEN_ACTION_FEATURE_COUNT = GEN_CONTRIBUTION_ITEM_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.LoadResourceActionImpl <em>Load Resource Action</em>}' class.
@@ -9688,6 +9697,15 @@ public interface GMFGenPackage extends EPackage {
int LOAD_RESOURCE_ACTION__QUALIFIED_CLASS_NAME = GEN_ACTION__QUALIFIED_CLASS_NAME;
/**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LOAD_RESOURCE_ACTION__NAME = GEN_ACTION__NAME;
+
+ /**
* The number of structural features of the '<em>Load Resource Action</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -9725,6 +9743,15 @@ public interface GMFGenPackage extends EPackage {
int INIT_DIAGRAM_ACTION__QUALIFIED_CLASS_NAME = GEN_ACTION__QUALIFIED_CLASS_NAME;
/**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INIT_DIAGRAM_ACTION__NAME = GEN_ACTION__NAME;
+
+ /**
* The number of structural features of the '<em>Init Diagram Action</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -9762,6 +9789,15 @@ public interface GMFGenPackage extends EPackage {
int CREATE_SHORTCUT_ACTION__QUALIFIED_CLASS_NAME = GEN_ACTION__QUALIFIED_CLASS_NAME;
/**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CREATE_SHORTCUT_ACTION__NAME = GEN_ACTION__NAME;
+
+ /**
* The number of structural features of the '<em>Create Shortcut Action</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -16507,6 +16543,17 @@ public interface GMFGenPackage extends EPackage {
EAttribute getGenAction_QualifiedClassName();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.GenAction#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.gmf.codegen.gmfgen.GenAction#getName()
+ * @see #getGenAction()
+ * @generated
+ */
+ EAttribute getGenAction_Name();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.LoadResourceAction <em>Load Resource Action</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenAction.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenAction.java
index 9253625e1..60df12a40 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenAction.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GenAction.java
@@ -20,6 +20,7 @@ package org.eclipse.gmf.codegen.gmfgen;
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.GenAction#getQualifiedClassName <em>Qualified Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenAction#getName <em>Name</em>}</li>
* </ul>
* </p>
*
@@ -54,4 +55,30 @@ public interface GenAction extends GenContributionItem {
*/
void setQualifiedClassName(String value);
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getGenAction_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.gmf.codegen.gmfgen.GenAction#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
} // GenAction
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/Shortcuts.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/Shortcuts.java
index 43b9ce2ee..42cff409e 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/Shortcuts.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/Shortcuts.java
@@ -99,7 +99,7 @@ public interface Shortcuts extends EObject {
* @return the value of the '<em>Create Shortcut Action Class Name</em>' attribute.
* @see #setCreateShortcutActionClassName(String)
* @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getShortcuts_CreateShortcutActionClassName()
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use CreateShortcutAction instead'"
* @generated
*/
String getCreateShortcutActionClassName();
@@ -208,6 +208,7 @@ public interface Shortcuts extends EObject {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation"
+ * annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use CreateShortcutAction instead'"
* @generated
*/
String getCreateShortcutActionQualifiedClassName();
@@ -231,7 +232,7 @@ public interface Shortcuts extends EObject {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model
+ * @model annotation="http://www.eclipse.org/gmf/2006/deprecated documentation='Use CreateShortcutAction instead'"
* @generated
*/
boolean generateCreateShortcutAction();
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/CreateShortcutActionImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/CreateShortcutActionImpl.java
index eba2c6f7c..f6415e1b1 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/CreateShortcutActionImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/CreateShortcutActionImpl.java
@@ -63,4 +63,11 @@ public class CreateShortcutActionImpl extends GenActionImpl implements CreateSho
}
return getQualifiedClassNameGen();
}
+
+ public String getName() {
+ if (GenCommonBaseImpl.isEmpty(getNameGen())) {
+ return "Create Shortcut...";
+ }
+ return getNameGen();
+ }
} //CreateShortcutActionImpl
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 cb9265cf2..b42421944 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
@@ -5996,6 +5996,15 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getGenAction_Name() {
+ return (EAttribute)genActionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getLoadResourceAction() {
return loadResourceActionEClass;
}
@@ -7260,6 +7269,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
genActionEClass = createEClass(GEN_ACTION);
createEAttribute(genActionEClass, GEN_ACTION__QUALIFIED_CLASS_NAME);
+ createEAttribute(genActionEClass, GEN_ACTION__NAME);
loadResourceActionEClass = createEClass(LOAD_RESOURCE_ACTION);
@@ -8395,6 +8405,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
initEClass(genActionEClass, GenAction.class, "GenAction", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getGenAction_QualifiedClassName(), ecorePackage.getEString(), "qualifiedClassName", null, 0, 1, GenAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenAction_Name(), ecorePackage.getEString(), "name", null, 0, 1, GenAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(loadResourceActionEClass, LoadResourceAction.class, "LoadResourceAction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -8636,7 +8647,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
"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"
- });
+ });
}
/**
@@ -8666,7 +8677,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
new String[] {
"ocl", "diagramRunTimeClass.ecoreClass.eAllSuperTypes->including(diagramRunTimeClass.ecoreClass)->one(ePackage.name = \'notation\' and name = \'Diagram\')",
"description", "\'Diagram Runtime Class\' must be a notation::Diagram or sub-class"
- });
+ });
addAnnotation
(genCommonBaseEClass,
source,
@@ -8909,6 +8920,24 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
source,
new String[] {
"documentation", "Actions are no longer contributed using ContributionItemService"
+ });
+ addAnnotation
+ (shortcutsEClass.getEOperations().get(1),
+ source,
+ new String[] {
+ "documentation", "Use CreateShortcutAction instead"
+ });
+ addAnnotation
+ (shortcutsEClass.getEOperations().get(4),
+ source,
+ new String[] {
+ "documentation", "Use CreateShortcutAction instead"
+ });
+ addAnnotation
+ (getShortcuts_CreateShortcutActionClassName(),
+ source,
+ new String[] {
+ "documentation", "Use CreateShortcutAction instead"
});
addAnnotation
(getPackageNames_ParsersPackageName(),
@@ -8921,7 +8950,37 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
source,
new String[] {
"documentation", "LinkCreationConstants should be generated if diagram has any links"
- });
+ });
+ addAnnotation
+ (editorCandiesEClass.getEOperations().get(4),
+ source,
+ new String[] {
+ "documentation", "Use InitDiagramAction instead"
+ });
+ addAnnotation
+ (editorCandiesEClass.getEOperations().get(10),
+ source,
+ new String[] {
+ "documentation", "Use LoadResourceAction instead"
+ });
+ addAnnotation
+ (editorCandiesEClass.getEOperations().get(11),
+ source,
+ new String[] {
+ "documentation", "Use InitDiagramAction instead"
+ });
+ addAnnotation
+ (getEditorCandies_InitDiagramFileActionClassName(),
+ source,
+ new String[] {
+ "documentation", "Use InitDiagramAction instead"
+ });
+ addAnnotation
+ (getEditorCandies_LoadResourceActionClassName(),
+ source,
+ new String[] {
+ "documentation", "Use LoadResourceAction instead"
+ });
addAnnotation
(getFeatureLabelModelFacet_ViewMethod(),
source,
@@ -8943,7 +9002,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* @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/GenActionImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenActionImpl.java
index 18c9a8bb6..557c50488 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenActionImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GenActionImpl.java
@@ -28,6 +28,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenContributionManager;
* <ul>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenActionImpl#getOwner <em>Owner</em>}</li>
* <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenActionImpl#getQualifiedClassName <em>Qualified Class Name</em>}</li>
+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenActionImpl#getName <em>Name</em>}</li>
* </ul>
* </p>
*
@@ -55,6 +56,26 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
protected String qualifiedClassName = QUALIFIED_CLASS_NAME_EDEFAULT;
/**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -109,6 +130,27 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
* <!-- end-user-doc -->
* @generated
*/
+ public String getNameGen() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_ACTION__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
@@ -160,6 +202,8 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
return getOwner();
case GMFGenPackage.GEN_ACTION__QUALIFIED_CLASS_NAME:
return getQualifiedClassName();
+ case GMFGenPackage.GEN_ACTION__NAME:
+ return getName();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -175,6 +219,9 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
case GMFGenPackage.GEN_ACTION__QUALIFIED_CLASS_NAME:
setQualifiedClassName((String)newValue);
return;
+ case GMFGenPackage.GEN_ACTION__NAME:
+ setName((String)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -190,6 +237,9 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
case GMFGenPackage.GEN_ACTION__QUALIFIED_CLASS_NAME:
setQualifiedClassName(QUALIFIED_CLASS_NAME_EDEFAULT);
return;
+ case GMFGenPackage.GEN_ACTION__NAME:
+ setName(NAME_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -206,6 +256,8 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
return getOwner() != null;
case GMFGenPackage.GEN_ACTION__QUALIFIED_CLASS_NAME:
return QUALIFIED_CLASS_NAME_EDEFAULT == null ? qualifiedClassName != null : !QUALIFIED_CLASS_NAME_EDEFAULT.equals(qualifiedClassName);
+ case GMFGenPackage.GEN_ACTION__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
}
@@ -222,6 +274,8 @@ public abstract class GenActionImpl extends EObjectImpl implements GenAction {
StringBuffer result = new StringBuffer(super.toString());
result.append(" (qualifiedClassName: ");
result.append(qualifiedClassName);
+ result.append(", name: ");
+ result.append(name);
result.append(')');
return result.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/InitDiagramActionImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/InitDiagramActionImpl.java
index 8983bcaab..dc0e9dd43 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/InitDiagramActionImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/InitDiagramActionImpl.java
@@ -7,7 +7,6 @@
package org.eclipse.gmf.codegen.gmfgen.impl;
import org.eclipse.emf.ecore.EClass;
-
import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
import org.eclipse.gmf.codegen.gmfgen.InitDiagramAction;
@@ -63,4 +62,12 @@ public class InitDiagramActionImpl extends GenActionImpl implements InitDiagramA
}
return getQualifiedClassNameGen();
}
+
+ public String getName() {
+ if (GenCommonBaseImpl.isEmpty(getNameGen())) {
+ String fe = (getOwner() != null && getOwner().getEditorGen() != null) ? getOwner().getEditorGen().getDiagramFileExtension() : null;
+ return String.format("Initialize %s diagram file", fe);
+ }
+ return getNameGen();
+ }
} //InitDiagramActionImpl
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/LoadResourceActionImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/LoadResourceActionImpl.java
index 730b358e9..7bcc88148 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/LoadResourceActionImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/LoadResourceActionImpl.java
@@ -51,7 +51,7 @@ public class LoadResourceActionImpl extends GenActionImpl implements LoadResourc
}
}
// FIXME < TEMP CODE
- String className = "LoadResourceAction";
+ String className = "LoadResourceAction"; //$NON-NLS-1$
if (getOwner() != null && getOwner().getEditorGen() != null && getOwner().getEditorGen().getEditor() != null) {
final String packageName = getOwner().getEditorGen().getEditor().getPackageName();
if (GenCommonBaseImpl.isEmpty(packageName)) {
@@ -63,4 +63,11 @@ public class LoadResourceActionImpl extends GenActionImpl implements LoadResourc
}
return getQualifiedClassNameGen();
}
+
+ public String getName() {
+ if (GenCommonBaseImpl.isEmpty(getNameGen())) {
+ return "Load Resource";
+ }
+ return getNameGen();
+ }
} //LoadResourceActionImpl
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
index f68dc05cf..70c40dd96 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
@@ -413,14 +413,6 @@ public class CodegenEmitters {
return getPrimaryEmitter("xpt::editor::ModelElementSelectionPage"); //$NON-NLS-1$
}
- public String getInitDiagramFileActionName(Object... input) throws UnexpectedBehaviourException {
- return getQualifiedClassName("xpt::editor::InitDiagramFileAction", input); //$NON-NLS-1$
- }
-
- public TextEmitter getInitDiagramFileActionEmitter() throws UnexpectedBehaviourException {
- return getPrimaryEmitter("xpt::editor::InitDiagramFileAction"); //$NON-NLS-1$
- }
-
public String getNewDiagramFileWizardName(Object... input) throws UnexpectedBehaviourException {
return getQualifiedClassName("xpt::editor::NewDiagramFileWizard", input); //$NON-NLS-1$
}
@@ -469,14 +461,6 @@ public class CodegenEmitters {
return getPrimaryEmitter("xpt::editor::Editor"); //$NON-NLS-1$
}
- public TextEmitter getCreateShortcutActionEmitter() {
- return getPrimaryEmitter("xpt::editor::CreateShortcutAction"); //$NON-NLS-1$
- }
-
- public TextEmitter getLoadResourceActionEmitter() {
- return getPrimaryEmitter("xpt::editor::LoadResourceAction"); //$NON-NLS-1$
- }
-
public TextEmitter getElementChooserEmitter() {
return getPrimaryEmitter("xpt::editor::ElementChooser"); //$NON-NLS-1$
}
@@ -651,6 +635,9 @@ public class CodegenEmitters {
return newXpandEmitter("impl::actions::CustomAction::Main"); //$NON-NLS-1$
}
+ public TextEmitter getPredefinedActionEmitter() {
+ return newXpandEmitter("impl::actions::PredefinedAction::Main"); //$NON-NLS-1$
+ }
// util
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 43c29a8e1..bf2991361 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
@@ -26,7 +26,9 @@ import org.eclipse.emf.codegen.util.CodeGenUtil;
import org.eclipse.gmf.codegen.gmfgen.ElementType;
import org.eclipse.gmf.codegen.gmfgen.ExternalParser;
import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory;
import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
+import org.eclipse.gmf.codegen.gmfgen.GenAction;
import org.eclipse.gmf.codegen.gmfgen.GenApplication;
import org.eclipse.gmf.codegen.gmfgen.GenChildContainer;
import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode;
@@ -57,6 +59,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenPropertyTab;
import org.eclipse.gmf.codegen.gmfgen.GenSharedContributionItem;
import org.eclipse.gmf.codegen.gmfgen.GenStandardPreferencePage;
import org.eclipse.gmf.codegen.gmfgen.GenTopLevelNode;
+import org.eclipse.gmf.codegen.gmfgen.InitDiagramAction;
import org.eclipse.gmf.codegen.gmfgen.MetamodelType;
import org.eclipse.gmf.codegen.gmfgen.OpenDiagramBehaviour;
import org.eclipse.gmf.codegen.gmfgen.PredefinedParser;
@@ -218,16 +221,17 @@ public class Generator extends GeneratorBase implements Runnable {
generateDiagramEditorContextMenuProvider();
generateEditor();
generateDocumentProvider();
- generateLoadResourceAction();
- if (myDiagram.generateInitDiagramAction() || myDiagram.generateCreateShortcutAction()) {
+ if (myDiagram.generateInitDiagramAction() || myDiagram.generateCreateShortcutAction() /*FIXME use another condition here*/) {
generateModelElementSelectionPage();
}
- if (myDiagram.generateInitDiagramAction()) {
- generateInitDiagramFileAction();
+ if (myDiagram.generateInitDiagramAction() /*FIXME use another condition here*/) {
+ // FIXME HACK!!! until I decide how to contribute action against IFile
+ InitDiagramAction fakeAction = GMFGenFactory.eINSTANCE.createInitDiagramAction();
+ fakeAction.setQualifiedClassName(myDiagram.getInitDiagramFileActionQualifiedClassName());
+ doGenerateJavaClass(myEmitters.getPredefinedActionEmitter(), fakeAction.getQualifiedClassName(), fakeAction, myEditorGen);
generateNewDiagramFileWizard();
}
- if (myDiagram.generateCreateShortcutAction()) {
- generateCreateShortcutAction();
+ if (myDiagram.generateCreateShortcutAction() /*FIXME use another condition here*/) {
generateCreateShortcutDecorationsCommand();
if (myEditorGen.getApplication() == null) {
generateElementChooser();
@@ -667,10 +671,6 @@ public class Generator extends GeneratorBase implements Runnable {
doGenerateJavaClass(myEmitters.getModelElementSelectionPageEmitter(), myEmitters.getModelElementSelectionPageName(myDiagram), myDiagram);
}
- private void generateInitDiagramFileAction() throws UnexpectedBehaviourException, InterruptedException {
- doGenerateJavaClass(myEmitters.getInitDiagramFileActionEmitter(), myEmitters.getInitDiagramFileActionName(myDiagram), myDiagram);
- }
-
private void generateNewDiagramFileWizard() throws UnexpectedBehaviourException, InterruptedException {
if (!myDiagram.isSynchronized()) {
doGenerateJavaClass(myEmitters.getDiagramContentInitializerEmitter(), myDiagram.getDiagramContentInitializerQualifiedClassName(), myDiagram);
@@ -719,17 +719,6 @@ public class Generator extends GeneratorBase implements Runnable {
doGenerateJavaClass(myEmitters.getEditorEmitter(), editor.getQualifiedClassName(), editor);
}
- private void generateCreateShortcutAction() throws InterruptedException {
- if (!myDiagram.generateCreateShortcutAction()) {
- return;
- }
- doGenerateJavaClass(myEmitters.getCreateShortcutActionEmitter(), myDiagram.getCreateShortcutActionQualifiedClassName(), myDiagram);
- }
-
- private void generateLoadResourceAction() throws InterruptedException {
- doGenerateJavaClass(myEmitters.getLoadResourceActionEmitter(), myDiagram.getLoadResourceActionQualifiedClassName(), myDiagram);
- }
-
private void generateElementChooser() throws InterruptedException {
if (!myDiagram.generateCreateShortcutAction()) {
return;
@@ -1003,6 +992,9 @@ public class Generator extends GeneratorBase implements Runnable {
items.addAll(((GenContributionManager) ci).getItems());
} else if (ci instanceof GenSharedContributionItem) {
items.addLast(((GenSharedContributionItem) ci).getActualItem());
+ } else if (ci instanceof GenAction) {
+ doGenerateJavaClass(myEmitters.getPredefinedActionEmitter(), ((GenAction) ci).getQualifiedClassName(), ci);
+ processedItems.add(ci);
}
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt
new file mode 100644
index 000000000..8f0b9d439
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2006, 2008 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [174961] migration to Commands/Handlers
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE Main FOR gmfgen::CreateShortcutAction-»
+«EXPAND xpt::Common::copyright FOR owner.editorGen-»
+«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «qualifiedClassName.split('\\.').last()»«EXPAND extendsList»«EXPAND implementsList» {
+«EXPAND executeMethod»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR CreateShortcutAction» extends org.eclipse.core.commands.AbstractHandler«ENDDEFINE»
+«DEFINE implementsList FOR CreateShortcutAction»«ENDDEFINE»
+
+«DEFINE executeMethod FOR gmfgen::CreateShortcutAction-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
+ org.eclipse.ui.IEditorPart diagramEditor = org.eclipse.ui.handlers.HandlerUtil.getActiveEditorChecked(event);
+ org.eclipse.swt.widgets.Shell shell = diagramEditor.getEditorSite().getShell();
+ assert diagramEditor instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) diagramEditor).getEditingDomain();
+ org.eclipse.jface.viewers.ISelection selection = org.eclipse.ui.handlers.HandlerUtil.getCurrentSelectionChecked(event);
+ assert selection instanceof org.eclipse.jface.viewers.IStructuredSelection;
+ assert ((org.eclipse.jface.viewers.IStructuredSelection) selection).size() == 1;
+ assert ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement() instanceof org.eclipse.gef.EditPart;
+ org.eclipse.gef.EditPart selectedDiagramPart = (org.eclipse.gef.EditPart) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
+ final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) selectedDiagramPart.getModel();
+«IF null == owner.editorGen.application-»
+ «owner.editorGen.diagram.getElementChooserQualifiedClassName()» elementChooser = new «owner.editorGen.diagram.getElementChooserQualifiedClassName()»(shell, view);
+ int result = elementChooser.open();
+ if (result != org.eclipse.jface.window.Window.OK) {
+ return;
+ }
+ org.eclipse.emf.common.util.URI selectedModelElementURI = elementChooser.getSelectedModelElementURI();
+ final org.eclipse.emf.ecore.EObject selectedElement;
+ try {
+ selectedElement = editingDomain.getResourceSet().getEObject(selectedModelElementURI, true);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ «owner.editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while loading object: " + selectedModelElementURI.toString(), e);«EXPAND xpt::Common::nonNLS»
+ return;
+ }
+
+ if (selectedElement == null) {
+ return;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedElement), org.eclipse.gmf.runtime.notation.Node.class, null,
+«REM»FIXME prefhintaccess is common code«ENDREM»
+ «owner.editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(editingDomain, viewDescriptor, view);
+ command = command.compose(new «owner.editorGen.diagram.getCreateShortcutDecorationsCommandQualifiedClassName()»(editingDomain, view, viewDescriptor));
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «owner.editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", e);«EXPAND xpt::Common::nonNLS»
+ }
+«ELSE-»
+ org.eclipse.emf.ecore.resource.Resource resource = «owner.editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openModel(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcutOpenModel())) FOR owner.editorGen», editingDomain);
+ if (resource == null || resource.getContents().isEmpty()) {
+ return;
+ }
+ «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName FOR owner.editorGen.diagram» wizard = new «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName FOR owner.editorGen.diagram»((org.eclipse.emf.ecore.EObject) resource.getContents().get(0), view, editingDomain);
+ wizard.setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcutWizard())) FOR owner.editorGen»);
+ «owner.editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(myShell, wizard, "CreateShortcut");«EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::CreateShortcutAction»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF null != editorGen.application-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcutOpenModel()), "Select model to reference")-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcutWizard()), "Create shortcut")-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF null != editorGen.application-»
+«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcutOpenModel()))-»
+«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcutWizard()))-»
+«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt
index 6784d0f05..f1f4d8e5c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt
@@ -15,7 +15,7 @@
«DEFINE Main FOR gmfgen::GenCustomAction-»
«EXPAND xpt::Common::copyright FOR owner.editorGen-»
-package «FOREACH qualifiedClassName.split('\\.').withoutLast() AS s SEPARATOR "."»«s»«ENDFOREACH»;
+«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
«EXPAND xpt::Common::generatedClassComment»
public class «qualifiedClassName.split('\\.').last()» extends org.eclipse.core.commands.AbstractHandler {
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt
new file mode 100644
index 000000000..98d1be68d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2008 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [174961] migration to Commands/Handlers
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::LoadResourceAction-»
+«EXPAND xpt::Common::copyright FOR owner.editorGen-»
+«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «qualifiedClassName.split('\\.').last()»«EXPAND extendsList»«EXPAND implementsList» {
+«EXPAND executeMethod»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR LoadResourceAction» extends org.eclipse.core.commands.AbstractHandler«ENDDEFINE»
+«DEFINE implementsList FOR LoadResourceAction»«ENDDEFINE»
+
+«DEFINE executeMethod FOR gmfgen::LoadResourceAction-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
+ org.eclipse.ui.IEditorPart diagramEditor = org.eclipse.ui.handlers.HandlerUtil.getActiveEditorChecked(event);
+ org.eclipse.swt.widgets.Shell shell = diagramEditor.getEditorSite().getShell();
+ assert diagramEditor instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) diagramEditor).getEditingDomain();
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(shell, editingDomain);
+ loadResourceDialog.open();
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::LoadResourceAction»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt
new file mode 100644
index 000000000..a34ba7693
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2008 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE Main FOR gmfgen::GenAction»«ERROR "Asbtract template for " + this»«ENDDEFINE»
+
+«DEFINE Main FOR gmfgen::LoadResourceAction»«EXPAND LoadResourceAction::Main»«ENDDEFINE»
+
+«DEFINE Main(gmfgen::GenEditorGenerator editorGen) FOR gmfgen::InitDiagramAction»«EXPAND xpt::editor::InitDiagramFileAction::InitDiagramFileAction(editorGen)»«ENDDEFINE»
+
+«DEFINE Main FOR gmfgen::CreateShortcutAction»«EXPAND CreateShortcutAction::Main»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt
index fcbcae588..eb91a1707 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt
@@ -61,6 +61,7 @@
«DEFINE commandContribution FOR gmfgen::GenContributionManager-»
«EXPAND commandContribution FOREACH items.typeSelect(GenCustomAction)-»
+«EXPAND commandContribution FOREACH items.typeSelect(GenAction)-»
«EXPAND commandContribution FOREACH items.typeSelect(GenContributionManager)-»
«ENDDEFINE»
@@ -76,6 +77,13 @@
defaultHandler="«qualifiedClassName»"/>
«ENDDEFINE»
+«DEFINE commandContribution FOR gmfgen::GenAction-»
+ <command id="«EXPAND commandIdentifier»"
+ name="«name/*FIXME: into i18n keys*/»"
+ categoryId="«owner.editorGen.editor.iD»"
+ defaultHandler="«qualifiedClassName»"/>
+«ENDDEFINE»
+
«DEFINE handlerContribution FOR gmfgen::GenCustomAction-»
<handler
commandId="«EXPAND commandIdentifier»"
@@ -89,9 +97,8 @@
</handler>
«ENDDEFINE»
-«DEFINE commandIdentifier FOR gmfgen::GenCustomAction-»
-«owner.editorGen.plugin.iD».«qualifiedClassName.split('\\.').last()-»
-«ENDDEFINE»
+«DEFINE commandIdentifier FOR gmfgen::GenCustomAction»«owner.editorGen.plugin.iD».«qualifiedClassName.split('\\.').last()»«ENDDEFINE»
+«DEFINE commandIdentifier FOR gmfgen::GenAction»«owner.editorGen.plugin.iD».«qualifiedClassName.split('\\.').last()»«ENDDEFINE»
«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenContributionItem»«REM»NO-OP XXX or ERROR?«ENDREM»«ENDDEFINE»
«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenSeparator-»
@@ -114,6 +121,13 @@
</visibleWhen>
</command>
«ENDDEFINE»
+«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenAction-»
+ <command commandId="«EXPAND commandIdentifier»">
+ <visibleWhen>
+«EXPAND menuCondition FOR contextMenu-»
+ </visibleWhen>
+ </command>
+«ENDDEFINE»
«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenMenuManager»
<menu id="«iD»" label="«name»">
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
index e854b6944..c347a7882 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
@@ -71,3 +71,9 @@
shortcutAnnotation.getDetails().put("modelID", «getEditPartQualifiedClassName()».MODEL_ID); «EXPAND xpt::Common::nonNLS»
«viewVar».getEAnnotations().add(shortcutAnnotation);
«ENDDEFINE»
+
+
+«DEFINE packageStatement FOR String-»
+«IF this.split('\\.').size() > 1-»
+package «FOREACH this.split('\\.').withoutLast() AS s SEPARATOR "."»«s»«ENDFOREACH»;«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt
index 920f243c6..677f9235d 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt
@@ -37,7 +37,7 @@ public class «getExternalizerClassName()» extends org.eclipse.osgi.util.NLS {
«ENDDEFINE»
«DEFINE Fields FOR gmfgen::GenEditorGenerator»
- «EXPAND xpt::editor::CreateShortcutAction::i18nAccessors FOR diagram-»
+ «EXPAND impl::actions::CreateShortcutAction::i18nAccessors FOR diagram-»
«EXPAND xpt::editor::CreationWizard::i18nAccessors FOR diagram-»
«EXPAND xpt::editor::CreationWizardPage::i18nAccessors FOR diagram-»
«EXPAND xpt::editor::DiagramEditorUtil::i18nAccessors FOR diagram-»
@@ -64,7 +64,7 @@ public class «getExternalizerClassName()» extends org.eclipse.osgi.util.NLS {
«DEFINE Values FOR gmfgen::GenEditorGenerator»
# TODO: manually put keys and values
-«EXPAND xpt::editor::CreateShortcutAction::i18nValues FOR diagram-»
+«EXPAND impl::actions::CreateShortcutAction::i18nValues FOR diagram-»
«EXPAND xpt::editor::CreationWizard::i18nValues FOR diagram-»
«EXPAND xpt::editor::CreationWizardPage::i18nValues FOR diagram-»
«EXPAND xpt::editor::DiagramEditorUtil::i18nValues FOR diagram-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreateShortcutAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreateShortcutAction.xpt
deleted file mode 100644
index 799ddc1a1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreateShortcutAction.xpt
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2006,2007 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE CreateShortcutAction FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «createShortcutActionClassName» implements org.eclipse.ui.IObjectActionDelegate {
-
- «EXPAND attributes-»
-
- «EXPAND setActivePart-»
-
- «EXPAND selectionChanged-»
-
- «EXPAND isEnabled-»
-
- «EXPAND run-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private «getEditPartQualifiedClassName()» mySelectedElement;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.swt.widgets.Shell myShell;
-«ENDDEFINE»
-
-«DEFINE setActivePart FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
- myShell = targetPart.getSite().getShell();
-}
-«ENDDEFINE»
-
-«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- mySelectedElement = null;
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
- if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof «getEditPartQualifiedClassName()») {
- mySelectedElement = («getEditPartQualifiedClassName()») structuredSelection.getFirstElement();
- }
- }
- action.setEnabled(isEnabled());
-}
-«ENDDEFINE»
-
-«DEFINE isEnabled FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean isEnabled() {
- return mySelectedElement != null;
-}
-«ENDDEFINE»
-
-«DEFINE run FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void run(org.eclipse.jface.action.IAction action) {
- final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) mySelectedElement.getModel();
- «IF null == editorGen.application-»
- «getElementChooserQualifiedClassName()» elementChooser = new «getElementChooserQualifiedClassName()»(myShell, view);
- int result = elementChooser.open();
- if (result != org.eclipse.jface.window.Window.OK) {
- return;
- }
- org.eclipse.emf.common.util.URI selectedModelElementURI = elementChooser.getSelectedModelElementURI();
- final org.eclipse.emf.ecore.EObject selectedElement;
- try {
- selectedElement = mySelectedElement.getEditingDomain().getResourceSet().getEObject(selectedModelElementURI, true);
- } catch (org.eclipse.emf.common.util.WrappedException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while loading object: " + selectedModelElementURI.toString(), e); «EXPAND xpt::Common::nonNLS»
- return;
- }
-
- if (selectedElement == null) {
- return;
- }
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedElement), org.eclipse.gmf.runtime.notation.Node.class, null, «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
- org.eclipse.gmf.runtime.common.core.command.ICommand command = new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view);
- command = command.compose(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(mySelectedElement.getEditingDomain(), view, viewDescriptor));
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", e); «EXPAND xpt::Common::nonNLS»
- }
- «ELSE-»
- org.eclipse.emf.ecore.resource.Resource resource = «getDiagramEditorUtilQualifiedClassName()».openModel(myShell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForOpenModel(this))) FOR editorGen», mySelectedElement.getEditingDomain());
- if (resource == null || resource.getContents().isEmpty()) {
- return;
- }
- «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName» wizard = new «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName»((org.eclipse.emf.ecore.EObject) resource.getContents().get(0), view, mySelectedElement.getEditingDomain());
- wizard.setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcus(this))) FOR editorGen»);
- «getDiagramEditorUtilQualifiedClassName()».runWizard(myShell, wizard, "CreateShortcut"); «EXPAND xpt::Common::nonNLS»
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«IF null != editorGen.application-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForOpenModel(this)), "Select model to reference")-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcus(this)), "Create shortcut")-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «IF null != editorGen.application-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForOpenModel(this)))-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcus(this)))-»
- «ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt
index 4c19fde76..b211b1d2c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Borland Software Corporation
+ * Copyright (c) 2007, 2008 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -16,16 +16,12 @@
«EXTENSION xpt::editor::Utils»
-«DEFINE className FOR gmfgen::GenDiagram»«initDiagramFileActionClassName»«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE InitDiagramFileAction FOR gmfgen::GenDiagram-»
+«DEFINE InitDiagramFileAction(gmfgen::GenEditorGenerator editorGen) FOR gmfgen::InitDiagramAction-»
«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
+«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className»
+public class «qualifiedClassName.split('\\.').last()»
«IF editorGen.application == null-»
implements org.eclipse.ui.IObjectActionDelegate {
@@ -73,7 +69,7 @@ implements org.eclipse.ui.IObjectActionDelegate {
diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
} catch (org.eclipse.emf.common.util.WrappedException ex) {
«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Unable to load resource: " + domainModelURI, ex); «EXPAND xpt::Common::nonNLS»
+ "Unable to load resource: " + domainModelURI, ex);«EXPAND xpt::Common::nonNLS»
}
if (diagramRoot == null) {
org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
@@ -81,11 +77,11 @@ implements org.eclipse.ui.IObjectActionDelegate {
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey()) FOR editorGen»);
return;
}
- org.eclipse.jface.wizard.Wizard wizard = new «getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
+ org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
- «EXPAND xpt::editor::VisualIDRegistry::modelID»));
- «getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile"); «EXPAND xpt::Common::nonNLS»
+ «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram»));
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile");«EXPAND xpt::Common::nonNLS»
}
«ELSE-»
implements org.eclipse.ui.IWorkbenchWindowActionDelegate {
@@ -117,17 +113,17 @@ implements org.eclipse.ui.IWorkbenchWindowActionDelegate {
org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
org.eclipse.emf.ecore.resource.Resource resource =
- «getDiagramEditorUtilQualifiedClassName()».openModel(getShell(),
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openModel(getShell(),
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramOpenFileDialogTitle()) FOR editorGen», editingDomain);
if (resource == null || resource.getContents().isEmpty()) {
return;
}
org.eclipse.emf.ecore.EObject diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
- org.eclipse.jface.wizard.Wizard wizard = new «getNewDiagramFileWizardQualifiedClassName()»(resource.getURI(), diagramRoot, editingDomain);
+ org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(resource.getURI(), diagramRoot, editingDomain);
wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
- «EXPAND xpt::editor::VisualIDRegistry::modelID»));
- «getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile"); «EXPAND xpt::Common::nonNLS»
+ «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram»));
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile");«EXPAND xpt::Common::nonNLS»
}
«ENDIF-»
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/LoadResourceAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/LoadResourceAction.xpt
deleted file mode 100644
index 01ebd3fbc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/LoadResourceAction.xpt
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2007 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE LoadResourceAction FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «loadResourceActionClassName» implements org.eclipse.ui.IObjectActionDelegate {
-
- «EXPAND attributes-»
-
- «EXPAND setActivePart-»
-
- «EXPAND run-»
-
- «EXPAND selectionChanged-»
-
- «EXPAND isEnabled-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private «getEditPartQualifiedClassName()» mySelectedElement;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.swt.widgets.Shell myShell;
-«ENDDEFINE»
-
-«DEFINE setActivePart FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
- myShell = targetPart.getSite().getShell();
-}
-«ENDDEFINE»
-
-«DEFINE run FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());
- loadResourceDialog.open();
-}
-«ENDDEFINE»
-
-«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- mySelectedElement = null;
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
- if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof «getEditPartQualifiedClassName()») {
- mySelectedElement = («getEditPartQualifiedClassName()») structuredSelection.getFirstElement();
- }
- }
- action.setEnabled(isEnabled());
-}
-«ENDDEFINE»
-
-«DEFINE isEnabled FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean isEnabled() {
- return mySelectedElement != null;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext
index 9399c85c2..61f3212ed 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext
@@ -137,21 +137,9 @@ String i18nKeyForCreateDiagramCommandLabel(gmfgen::GenDiagram diagram) :
diagram.i18nKeyForDiagramEditorUtil()+".CreateDiagramCommandLabel"
;
-private String i18nKeyForInitDiagramFileAction(gmfgen::GenDiagram diagram) :
- diagram.initDiagramFileActionClassName
-;
-
-String i18nKeyForInitDiagramFileResourceErrorDialog(gmfgen::GenDiagram diagram) :
- diagram.i18nKeyForInitDiagramFileAction()+".InitDiagramFileResourceErrorDialog"
-;
-
-String i18nKeyForInitDiagramFileWizardTitle(gmfgen::GenDiagram diagram) :
- diagram.i18nKeyForInitDiagramFileAction()+".InitDiagramFileWizardTitle"
-;
-
-String i18nKeyForInitDiagramOpenFileDialogTitle(gmfgen::GenDiagram diagram) :
- diagram.i18nKeyForInitDiagramFileAction()+".OpenModelFileDialogTitle"
-;
+String i18nKeyForInitDiagramFileResourceErrorDialog() : "InitDiagramFile.ResourceErrorDialog" ;
+String i18nKeyForInitDiagramFileWizardTitle() : "InitDiagramFile.WizardTitle" ;
+String i18nKeyForInitDiagramOpenFileDialogTitle() : "InitDiagramFile.OpenModelFileDialogTitle" ;
private String i18nKeyForNewDiagramFileWizard(gmfgen::GenDiagram diagram) :
diagram.newDiagramFileWizardClassName
@@ -209,17 +197,8 @@ private String i18nKeyForElementChooser(gmfgen::GenDiagram diagram) :
diagram.elementChooserClassName
;
-String i18nKeyForOpenModel(gmfgen::GenDiagram diagram) :
- i18nKeyForCreateShortcutAction(diagram) + ".OpenModel"
-;
-
-String i18nKeyForCreateShortcus(gmfgen::GenDiagram diagram) :
- i18nKeyForCreateShortcutAction(diagram) + ".CreateShortcut"
-;
-
-private String i18nKeyForCreateShortcutAction(gmfgen::GenDiagram diagram) :
- diagram.createShortcutActionClassName
-;
+String i18nKeyForCreateShortcutOpenModel() : "CreateShortcutAction.OpenModel" ;
+String i18nKeyForCreateShortcutWizard() : "CreateShortcutAction.Wizard" ;
String i18nKeyForShortcutWizardReferencedElementPage(gmfgen::GenDiagram diagram) :
diagram.defaultShortcutCreationWizardClassName()+".ReferencedElementSelectionPage"
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt
index 7709a7e4c..db4d5e28c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Borland Software Corporation
+ * Copyright (c) 2007, 2008 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -50,37 +50,7 @@
</wizard>
</extension>
- <extension point="org.eclipse.ui.popupMenus">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«IF diagram.generateCreateShortcutAction()-»
- <objectContribution
- adaptable="false"
- id="«plugin.iD».CreateShortcut"
- objectClass="«diagram.getEditPartQualifiedClassName()»">
- <action
- class="«diagram.getCreateShortcutActionQualifiedClassName()»"
- enablesFor="1"
- id="«plugin.iD».CreateShortcutAction"
- label="%createShortcutActionLabel"
- menubarPath="additions">
- </action>
- </objectContribution>
-«ENDIF-»
- <objectContribution
- adaptable="false"
- id="«plugin.iD».LoadResource"
- objectClass="«diagram.getEditPartQualifiedClassName()»">
- <action
- class="«diagram.getLoadResourceActionQualifiedClassName()»"
- enablesFor="1"
- id="«plugin.iD».LoadResourceAction"
- label="%loadResourceActionLabel"
- menubarPath="additions">
- </action>
- </objectContribution>
- </extension>
«IF diagram.generateInitDiagramAction()-»
-
«IF null == application»<extension point="org.eclipse.ui.popupMenus">
«EXPAND xpt::Common::xmlGeneratedTag»
<objectContribution
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt
index 168a694d6..387c9b80a 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt
@@ -27,10 +27,6 @@ newWizardDesc=Creates «editorGen.modelID» diagram.
«IF editorGen.diagram.generateInitDiagramAction()-»
initDiagramActionLabel=Initialize «editorGen.diagramFileExtension» diagram file
«ENDIF-»
-«IF editorGen.diagram.generateCreateShortcutAction()-»
-createShortcutActionLabel=Create Shortcut...
-«ENDIF-»
-loadResourceActionLabel=Load Resource...
«IF null != editorGen.application-»
perspectiveName=«editorGen.modelID» Perspective

Back to the top