diff options
author | ashatalin | 2006-05-15 17:18:06 +0000 |
---|---|---|
committer | ashatalin | 2006-05-15 17:18:06 +0000 |
commit | 80f23362dad2010f1b1105d43aee1f70ddcf7b15 (patch) | |
tree | 17409f1dd989974ad4b2468ae80bba5113c61d6d /plugins | |
parent | b7890dea6b7aef6b9d365c990f7cab2ba9014d64 (diff) | |
download | org.eclipse.gmf-tooling-80f23362dad2010f1b1105d43aee1f70ddcf7b15.tar.gz org.eclipse.gmf-tooling-80f23362dad2010f1b1105d43aee1f70ddcf7b15.tar.xz org.eclipse.gmf-tooling-80f23362dad2010f1b1105d43aee1f70ddcf7b15.zip |
#131543 Obsolete code should be eliminated
Diffstat (limited to 'plugins')
24 files changed, 592 insertions, 401 deletions
diff --git a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties index 17b9dbc23..c11e46d28 100644 --- a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties +++ b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties @@ -101,6 +101,7 @@ _UI_GenDiagram_palette_feature = Palette _UI_GenDiagram_topLevelNodes_feature = Top Level Nodes _UI_GenDiagram_childNodes_feature = Child Nodes _UI_GenDiagram_compartments_feature = Compartments +_UI_GenDiagram_synchronized_feature = Synchronized _UI_GenCommonBase_diagramRunTimeClass_feature = Diagram Run Time Class _UI_GenCommonBase_visualID_feature = Visual ID _UI_GenCommonBase_editPartClassName_feature = Edit Part Class Name @@ -421,4 +422,4 @@ _UI_LabelOffsetAttributes_x_feature = X _UI_LabelOffsetAttributes_y_feature = Y _UI_GenDomainAttributeTarget_type = Gen Domain Attribute Target _UI_GenDomainAttributeTarget_nullAsError_feature = Null As Error -_UI_GenDomainAttributeTarget_attribute_feature = Attribute +_UI_GenDomainAttributeTarget_attribute_feature = Attribute
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java index e03aa5c8b..e654e8915 100644 --- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java +++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java @@ -377,7 +377,15 @@ public class GMFGenEditor else { resourceToDiagnosticMap.remove(resource); } - updateProblemIndication(); + + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + updateProblemIndication(); + } + }); + } } } } @@ -385,6 +393,14 @@ public class GMFGenEditor super.notifyChanged(notification); } } + + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + } }; /** @@ -542,7 +558,7 @@ public class GMFGenEditor BasicDiagnostic diagnostic = new BasicDiagnostic (Diagnostic.OK, - "org.eclipse.gmf.codegen.edit", + "org.eclipse.gmf.codegen.edit", 0, null, new Object [] { editingDomain.getResourceSet() }); @@ -552,7 +568,7 @@ public class GMFGenEditor diagnostic.add(childDiagnostic); } } - + int lastEditorPage = getPageCount() - 1; if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); @@ -565,6 +581,7 @@ public class GMFGenEditor problemEditorPart.setDiagnostic(diagnostic); problemEditorPart.setMarkerHelper(markerHelper); try { + showTabs(); addPage(getPageCount(), problemEditorPart, getEditorInput()); lastEditorPage++; setPageText(lastEditorPage, problemEditorPart.getPartName()); @@ -883,9 +900,9 @@ public class GMFGenEditor BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, - "org.eclipse.gmf.codegen.edit", + "org.eclipse.gmf.codegen.edit", 0, - getString("_UI_CreateModelError_message", resource.getURI()), + getString("_UI_CreateModelError_message", resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; @@ -894,16 +911,16 @@ public class GMFGenEditor return new BasicDiagnostic (Diagnostic.ERROR, - "org.eclipse.gmf.codegen.edit", + "org.eclipse.gmf.codegen.edit", 0, - getString("_UI_CreateModelError_message", resource.getURI()), + getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } } - + /** * This is the method used by the framework to install your own controls. * <!-- begin-user-doc --> @@ -1109,10 +1126,10 @@ public class GMFGenEditor setActivePage(0); } - + // Ensures that this editor will only display the page's tab // area if there are more than one page - // + // getContainer().addControlListener (new ControlAdapter() { boolean guard = false; @@ -1123,7 +1140,7 @@ public class GMFGenEditor guard = false; } } - }); + }); updateProblemIndication(); } @@ -1147,6 +1164,24 @@ public class GMFGenEditor } /** + * If there is just one page in the multi-page editor part, this shows + * the single tab at the bottom. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void showTabs() { + if (getPageCount() == 1) { + setPageText(0, getString("_UI_SelectionPage_label")); + if (getContainer() instanceof CTabFolder) { + ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y - 6); + } + } + } + + /** * This is used to track the active viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1168,7 +1203,7 @@ public class GMFGenEditor */ public Object getAdapter(Class key) { if (key.equals(IContentOutlinePage.class)) { - return getContentOutlinePage(); + return showOutlineView() ? getContentOutlinePage() : null; } else if (key.equals(IPropertySheetPage.class)) { return getPropertySheetPage(); @@ -1369,7 +1404,6 @@ public class GMFGenEditor EditorPlugin.INSTANCE.log(exception); } updateProblemIndication = true; - updateProblemIndication(); } @@ -1421,7 +1455,7 @@ public class GMFGenEditor } } } - + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1545,7 +1579,7 @@ public class GMFGenEditor public void setStatusLineManager(ISelection selection) { IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); - + if (statusLineManager != null) { if (selection instanceof IStructuredSelection) { Collection collection = ((IStructuredSelection)selection).toList(); @@ -1655,4 +1689,13 @@ public class GMFGenEditor super.dispose(); } + /** + * Returns whether the outline view should be presented to the user. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected boolean showOutlineView() { + return true; + } } diff --git a/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 7bd311c82..d62e44574 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 @@ -124,6 +124,7 @@ public class GenDiagramItemProvider addValidationDecoratorsPropertyDescriptor(object); addUnitsPropertyDescriptor(object); addDomainDiagramElementPropertyDescriptor(object); + addSynchronizedPropertyDescriptor(object); } return itemPropertyDescriptors; } @@ -169,6 +170,26 @@ public class GenDiagramItemProvider } /** + * This adds a property descriptor for the Synchronized feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addSynchronizedPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_GenDiagram_synchronized_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_GenDiagram_synchronized_feature", "_UI_GenDiagram_type"), + GMFGenPackage.eINSTANCE.getGenDiagram_Synchronized(), + true, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** * This adds a property descriptor for the Edit Commands Package Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1515,6 +1536,7 @@ public class GenDiagramItemProvider case GMFGenPackage.GEN_DIAGRAM__VALIDATION_DECORATOR_PROVIDER_CLASS_NAME: case GMFGenPackage.GEN_DIAGRAM__VALIDATION_DECORATORS: case GMFGenPackage.GEN_DIAGRAM__UNITS: + case GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case GMFGenPackage.GEN_DIAGRAM__CHILD_NODES: diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore index 5fe35fe92..2c3d54151 100644 --- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore +++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore @@ -95,6 +95,8 @@ eType="#//GenCompartment" containment="true" eOpposite="#//GenCompartment/diagram"/> <eStructuralFeatures xsi:type="ecore:EReference" name="palette" eType="#//Palette" containment="true" eOpposite="#//Palette/diagram"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="synchronized" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" + defaultValueLiteral="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="GenEditorView"> <eOperations name="getActionBarContributorQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel index 059fd4a37..49a3662ca 100644 --- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel +++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel @@ -54,6 +54,7 @@ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenDiagram/links"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenDiagram/compartments"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenDiagram/palette"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenDiagram/synchronized"/> <genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getAllNodes"/> <genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getAllChildContainers"/> <genOperations ecoreOperation="gmfgen.ecore#//GenDiagram/getAllContainers"/> diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java index 6a498b98b..843e6116d 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java @@ -344,9 +344,6 @@ public class NewDiagramFileWizardGenerator { { final StringBuffer stringBuffer = new StringBuffer(); -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; final GenEditorGenerator editorGen = genDiagram.getEditorGen(); @@ -423,7 +420,7 @@ importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_15); } -if (!isSynchronizedDiagram) { +if (!genDiagram.isSynchronized()) { stringBuffer.append(TEXT_16); } @@ -444,7 +441,7 @@ if (!isSynchronizedDiagram) { stringBuffer.append(TEXT_24); stringBuffer.append(pluginActivatorClass); stringBuffer.append(TEXT_25); - if (!isSynchronizedDiagram) { + if (!genDiagram.isSynchronized()) { stringBuffer.append(TEXT_26); List genLinks = genDiagram.getLinks(); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/OptionsFileGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/OptionsFileGenerator.java index b37c8c02d..510976ec8 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/OptionsFileGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/OptionsFileGenerator.java @@ -18,7 +18,9 @@ public class OptionsFileGenerator protected final String TEXT_2 = " plug-in" + NL + "" + NL + "# Turn on general debugging for the "; protected final String TEXT_3 = " plug-in"; protected final String TEXT_4 = NL; - protected final String TEXT_5 = "/debug=false"; + protected final String TEXT_5 = "/debug=false" + NL + "" + NL + "# Turn on debugging of visualID processing"; + protected final String TEXT_6 = NL; + protected final String TEXT_7 = "/debug/visualID=true"; public String generate(Object argument) { @@ -32,6 +34,9 @@ public class OptionsFileGenerator stringBuffer.append(TEXT_4); stringBuffer.append(genPlugin.getID()); stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_6); + stringBuffer.append(genPlugin.getID()); + stringBuffer.append(TEXT_7); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java index 01eb24c4a..cb4b7c030 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java @@ -22,127 +22,128 @@ public class VisualIDRegistryGenerator protected final String TEXT_3 = NL + " */"; protected final String TEXT_4 = NL; protected final String TEXT_5 = NL + NL + "/**" + NL + " * This registry is used to determine which type of visual object should be" + NL + " * created for the corresponding Diagram, Node, ChildNode or Link represented " + NL + " * by a domain model object." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(View view) {" + NL + "\t\tif (view instanceof Diagram) {" + NL + "\t\t\tif ("; - protected final String TEXT_7 = ".MODEL_ID.equals(view.getType())) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_8 = ".VISUAL_ID;" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn getVisualID(view.getType());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getModelID(View view) {" + NL + "\t\tView diagram = view.getDiagram();" + NL + "\t\twhile (view != diagram) {" + NL + "\t\t\t"; - protected final String TEXT_9 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\treturn (String) annotation.getDetails().get(\"modelID\"); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\tview = (View) view.eContainer();" + NL + "\t\t}" + NL + "\t\treturn diagram != null ? diagram.getType() : null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(String type) {" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(type);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_10 = ".getInstance().logInfo(\"Unable to parse view type as a visualID number: \" + type);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getType(int visualID) {" + NL + "\t\treturn String.valueOf(visualID);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getDiagramVisualID(EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getDiagramVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getDiagramVisualID(EObject domainElement, EClass domainElementMetaclass) {"; - protected final String TEXT_11 = NL + "\t\tif ("; - protected final String TEXT_12 = ".eINSTANCE.get"; - protected final String TEXT_13 = "().isSuperTypeOf(domainElementMetaclass) && isDiagram"; - protected final String TEXT_14 = "(("; - protected final String TEXT_15 = ") domainElement)) {" + NL + "\t\t\treturn "; - protected final String TEXT_16 = ".VISUAL_ID;" + NL + "\t\t}"; - protected final String TEXT_17 = NL + "\t\treturn getUnrecognizedDiagramID(domainElement);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getNodeVisualID(View containerView, EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getNodeVisualID(containerView, domainElement, domainElementMetaclass, null);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!"; - protected final String TEXT_18 = ".MODEL_ID.equals(containerModelID)"; - protected final String TEXT_19 = "\t\t\t" + NL + "\t\t\t&& !\""; - protected final String TEXT_20 = "\".equals(containerModelID)"; - protected final String TEXT_21 = NL + "\t\t) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif ("; - protected final String TEXT_22 = ".MODEL_ID.equals(containerModelID)) {" + NL + "\t\t\tcontainerVisualID = getVisualID(containerView);" + NL + "\t\t} else {" + NL + "\t\t\tif (containerView instanceof Diagram) {" + NL + "\t\t\t\tcontainerVisualID = "; - protected final String TEXT_23 = ".VISUAL_ID;\t\t" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tint nodeVisualID = semanticHint != null ? getVisualID(semanticHint) : -1;" + NL + "\t\tswitch (containerVisualID) {"; - protected final String TEXT_24 = NL + "\t\tcase "; - protected final String TEXT_25 = ".VISUAL_ID:"; - protected final String TEXT_26 = NL + "\t\t\tif ("; - protected final String TEXT_27 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_28 = ".VISUAL_ID;" + NL + "\t\t\t}"; - protected final String TEXT_29 = NL + "\t\t\tif ("; - protected final String TEXT_30 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_31 = ".VISUAL_ID;" + NL + "\t\t\t} "; - protected final String TEXT_32 = "\t\t" + NL + "\t\t\tif ((semanticHint == null || "; - protected final String TEXT_33 = ".VISUAL_ID == nodeVisualID) && "; - protected final String TEXT_34 = ".eINSTANCE.get"; - protected final String TEXT_35 = "().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isNode"; - protected final String TEXT_36 = "(("; - protected final String TEXT_37 = ") domainElement))) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_38 = ".VISUAL_ID;" + NL + "\t\t\t} "; - protected final String TEXT_39 = NL + "\t\t\treturn getUnrecognized"; - protected final String TEXT_40 = "ChildNodeID(domainElement, semanticHint);"; - protected final String TEXT_41 = NL + "\t\tcase "; - protected final String TEXT_42 = ".VISUAL_ID:"; - protected final String TEXT_43 = NL + "\t\t\tif ("; - protected final String TEXT_44 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_45 = ".VISUAL_ID;" + NL + "\t\t\t}"; - protected final String TEXT_46 = NL + "\t\t\treturn getUnrecognized"; - protected final String TEXT_47 = "LinkLabelID(semanticHint);"; - protected final String TEXT_48 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getLinkWithClassVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; - protected final String TEXT_49 = NL + "\t\tif ("; - protected final String TEXT_50 = ".eINSTANCE.get"; - protected final String TEXT_51 = "().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isLinkWithClass"; - protected final String TEXT_52 = "(("; - protected final String TEXT_53 = ") domainElement))) {" + NL + "\t\t\treturn "; - protected final String TEXT_54 = ".VISUAL_ID;" + NL + "\t\t} else "; - protected final String TEXT_55 = NL + "\t\t{" + NL + "\t\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t\t}" + NL + "\t}\t" + NL; - protected final String TEXT_56 = NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isDiagram"; - protected final String TEXT_57 = "("; - protected final String TEXT_58 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; - protected final String TEXT_59 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_60 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isNode"; - protected final String TEXT_61 = "("; - protected final String TEXT_62 = " element) {" + NL + "\t\treturn "; - protected final String TEXT_63 = ".matches(element)"; - protected final String TEXT_64 = "true"; - protected final String TEXT_65 = ";" + NL + "\t}\t"; - protected final String TEXT_66 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int getUnrecognized"; - protected final String TEXT_67 = "ChildNodeID(EObject domainElement, String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_68 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int getUnrecognized"; - protected final String TEXT_69 = "LinkLabelID(String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_70 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_71 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isLinkWithClass"; - protected final String TEXT_72 = "("; - protected final String TEXT_73 = " element) {" + NL + "\t\treturn "; - protected final String TEXT_74 = ".matches(element)"; - protected final String TEXT_75 = "true"; - protected final String TEXT_76 = ";" + NL + "\t}"; - protected final String TEXT_77 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final "; - protected final String TEXT_78 = " "; - protected final String TEXT_79 = " = new "; - protected final String TEXT_80 = "("; - protected final String TEXT_81 = "null"; - protected final String TEXT_82 = "."; - protected final String TEXT_83 = "(\""; - protected final String TEXT_84 = "\", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_85 = ", "; - protected final String TEXT_86 = ")"; - protected final String TEXT_87 = "."; - protected final String TEXT_88 = "(\""; - protected final String TEXT_89 = "\", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_90 = ")"; - protected final String TEXT_91 = "new "; - protected final String TEXT_92 = "("; - protected final String TEXT_93 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_94 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_95 = " self = ("; - protected final String TEXT_96 = ")context;"; - protected final String TEXT_97 = "\t" + NL + "\t\t"; - protected final String TEXT_98 = " "; - protected final String TEXT_99 = " = ("; - protected final String TEXT_100 = ")env.get(\""; - protected final String TEXT_101 = "\"); //$NON-NLS-1$"; - protected final String TEXT_102 = NL + "\t\treturn "; - protected final String TEXT_103 = "."; - protected final String TEXT_104 = "(self"; - protected final String TEXT_105 = ", "; - protected final String TEXT_106 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_107 = NL + ");"; - protected final String TEXT_108 = "\t" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated\t" + NL + "\t */" + NL + "\tstatic class "; - protected final String TEXT_109 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t" + NL + "\t\tprivate "; - protected final String TEXT_110 = " condition;" + NL + "\t\t\t\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t" + NL + "\t\t"; - protected final String TEXT_111 = "("; - protected final String TEXT_112 = " conditionExpression) {\t\t\t" + NL + "\t\t\tthis.condition = conditionExpression;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t\t" + NL + "\t\tboolean matches(EObject object) {" + NL + "\t\t\tObject result = condition.evaluate(object);" + NL + "\t\t\treturn result instanceof Boolean && ((Boolean)result).booleanValue();\t\t\t" + NL + "\t\t}" + NL + "\t}// "; - protected final String TEXT_113 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private static class "; - protected final String TEXT_114 = " {"; - protected final String TEXT_115 = NL; - protected final String TEXT_116 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_117 = " "; - protected final String TEXT_118 = "("; - protected final String TEXT_119 = " self"; - protected final String TEXT_120 = ", "; - protected final String TEXT_121 = " "; - protected final String TEXT_122 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '"; - protected final String TEXT_123 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_124 = NL + "\t}// "; - protected final String TEXT_125 = NL + "}" + NL + "\t"; - protected final String TEXT_126 = NL; + protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final String DEBUG_KEY = "; + protected final String TEXT_7 = ".getInstance().getBundle().getSymbolicName() + \"/debug/visualID\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(View view) {" + NL + "\t\tif (view instanceof Diagram) {" + NL + "\t\t\tif ("; + protected final String TEXT_8 = ".MODEL_ID.equals(view.getType())) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_9 = ".VISUAL_ID;" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn getVisualID(view.getType());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getModelID(View view) {" + NL + "\t\tView diagram = view.getDiagram();" + NL + "\t\twhile (view != diagram) {" + NL + "\t\t\t"; + protected final String TEXT_10 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\treturn (String) annotation.getDetails().get(\"modelID\"); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\tview = (View) view.eContainer();" + NL + "\t\t}" + NL + "\t\treturn diagram != null ? diagram.getType() : null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(String type) {" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(type);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\tif (Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption(DEBUG_KEY))) {" + NL + "\t\t\t\t"; + protected final String TEXT_11 = ".getInstance().logError(\"Unable to parse view type as a visualID number: \" + type);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getType(int visualID) {" + NL + "\t\treturn String.valueOf(visualID);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getDiagramVisualID(EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getDiagramVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getDiagramVisualID(EObject domainElement, EClass domainElementMetaclass) {"; + protected final String TEXT_12 = NL + "\t\tif ("; + protected final String TEXT_13 = ".eINSTANCE.get"; + protected final String TEXT_14 = "().isSuperTypeOf(domainElementMetaclass) && isDiagram"; + protected final String TEXT_15 = "(("; + protected final String TEXT_16 = ") domainElement)) {" + NL + "\t\t\treturn "; + protected final String TEXT_17 = ".VISUAL_ID;" + NL + "\t\t}"; + protected final String TEXT_18 = NL + "\t\treturn getUnrecognizedDiagramID(domainElement);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getNodeVisualID(View containerView, EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getNodeVisualID(containerView, domainElement, domainElementMetaclass, null);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!"; + protected final String TEXT_19 = ".MODEL_ID.equals(containerModelID)"; + protected final String TEXT_20 = "\t\t\t" + NL + "\t\t\t&& !\""; + protected final String TEXT_21 = "\".equals(containerModelID)"; + protected final String TEXT_22 = NL + "\t\t) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif ("; + protected final String TEXT_23 = ".MODEL_ID.equals(containerModelID)) {" + NL + "\t\t\tcontainerVisualID = getVisualID(containerView);" + NL + "\t\t} else {" + NL + "\t\t\tif (containerView instanceof Diagram) {" + NL + "\t\t\t\tcontainerVisualID = "; + protected final String TEXT_24 = ".VISUAL_ID;\t\t" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tint nodeVisualID = semanticHint != null ? getVisualID(semanticHint) : -1;" + NL + "\t\tswitch (containerVisualID) {"; + protected final String TEXT_25 = NL + "\t\tcase "; + protected final String TEXT_26 = ".VISUAL_ID:"; + protected final String TEXT_27 = NL + "\t\t\tif ("; + protected final String TEXT_28 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_29 = ".VISUAL_ID;" + NL + "\t\t\t}"; + protected final String TEXT_30 = NL + "\t\t\tif ("; + protected final String TEXT_31 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_32 = ".VISUAL_ID;" + NL + "\t\t\t} "; + protected final String TEXT_33 = "\t\t" + NL + "\t\t\tif ((semanticHint == null || "; + protected final String TEXT_34 = ".VISUAL_ID == nodeVisualID) && "; + protected final String TEXT_35 = ".eINSTANCE.get"; + protected final String TEXT_36 = "().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isNode"; + protected final String TEXT_37 = "(("; + protected final String TEXT_38 = ") domainElement))) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_39 = ".VISUAL_ID;" + NL + "\t\t\t} "; + protected final String TEXT_40 = NL + "\t\t\treturn getUnrecognized"; + protected final String TEXT_41 = "ChildNodeID(domainElement, semanticHint);"; + protected final String TEXT_42 = NL + "\t\tcase "; + protected final String TEXT_43 = ".VISUAL_ID:"; + protected final String TEXT_44 = NL + "\t\t\tif ("; + protected final String TEXT_45 = ".VISUAL_ID == nodeVisualID) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_46 = ".VISUAL_ID;" + NL + "\t\t\t}"; + protected final String TEXT_47 = NL + "\t\t\treturn getUnrecognized"; + protected final String TEXT_48 = "LinkLabelID(semanticHint);"; + protected final String TEXT_49 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getLinkWithClassVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; + protected final String TEXT_50 = NL + "\t\tif ("; + protected final String TEXT_51 = ".eINSTANCE.get"; + protected final String TEXT_52 = "().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isLinkWithClass"; + protected final String TEXT_53 = "(("; + protected final String TEXT_54 = ") domainElement))) {" + NL + "\t\t\treturn "; + protected final String TEXT_55 = ".VISUAL_ID;" + NL + "\t\t} else "; + protected final String TEXT_56 = NL + "\t\t{" + NL + "\t\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t\t}" + NL + "\t}\t" + NL; + protected final String TEXT_57 = NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isDiagram"; + protected final String TEXT_58 = "("; + protected final String TEXT_59 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; + protected final String TEXT_60 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_61 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isNode"; + protected final String TEXT_62 = "("; + protected final String TEXT_63 = " element) {" + NL + "\t\treturn "; + protected final String TEXT_64 = ".matches(element)"; + protected final String TEXT_65 = "true"; + protected final String TEXT_66 = ";" + NL + "\t}\t"; + protected final String TEXT_67 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int getUnrecognized"; + protected final String TEXT_68 = "ChildNodeID(EObject domainElement, String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_69 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int getUnrecognized"; + protected final String TEXT_70 = "LinkLabelID(String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_71 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_72 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isLinkWithClass"; + protected final String TEXT_73 = "("; + protected final String TEXT_74 = " element) {" + NL + "\t\treturn "; + protected final String TEXT_75 = ".matches(element)"; + protected final String TEXT_76 = "true"; + protected final String TEXT_77 = ";" + NL + "\t}"; + protected final String TEXT_78 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final "; + protected final String TEXT_79 = " "; + protected final String TEXT_80 = " = new "; + protected final String TEXT_81 = "("; + protected final String TEXT_82 = "null"; + protected final String TEXT_83 = "."; + protected final String TEXT_84 = "(\""; + protected final String TEXT_85 = "\", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_86 = ", "; + protected final String TEXT_87 = ")"; + protected final String TEXT_88 = "."; + protected final String TEXT_89 = "(\""; + protected final String TEXT_90 = "\", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_91 = ")"; + protected final String TEXT_92 = "new "; + protected final String TEXT_93 = "("; + protected final String TEXT_94 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_95 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_96 = " self = ("; + protected final String TEXT_97 = ")context;"; + protected final String TEXT_98 = "\t" + NL + "\t\t"; + protected final String TEXT_99 = " "; + protected final String TEXT_100 = " = ("; + protected final String TEXT_101 = ")env.get(\""; + protected final String TEXT_102 = "\"); //$NON-NLS-1$"; + protected final String TEXT_103 = NL + "\t\treturn "; + protected final String TEXT_104 = "."; + protected final String TEXT_105 = "(self"; + protected final String TEXT_106 = ", "; + protected final String TEXT_107 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_108 = NL + ");"; + protected final String TEXT_109 = "\t" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated\t" + NL + "\t */" + NL + "\tstatic class "; + protected final String TEXT_110 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t" + NL + "\t\tprivate "; + protected final String TEXT_111 = " condition;" + NL + "\t\t\t\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t" + NL + "\t\t"; + protected final String TEXT_112 = "("; + protected final String TEXT_113 = " conditionExpression) {\t\t\t" + NL + "\t\t\tthis.condition = conditionExpression;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t\t" + NL + "\t\tboolean matches(EObject object) {" + NL + "\t\t\tObject result = condition.evaluate(object);" + NL + "\t\t\treturn result instanceof Boolean && ((Boolean)result).booleanValue();\t\t\t" + NL + "\t\t}" + NL + "\t}// "; + protected final String TEXT_114 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private static class "; + protected final String TEXT_115 = " {"; + protected final String TEXT_116 = NL; + protected final String TEXT_117 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_118 = " "; + protected final String TEXT_119 = "("; + protected final String TEXT_120 = " self"; + protected final String TEXT_121 = ", "; + protected final String TEXT_122 = " "; + protected final String TEXT_123 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '"; + protected final String TEXT_124 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_125 = NL + "\t}// "; + protected final String TEXT_126 = NL + "}" + NL + "\t"; + protected final String TEXT_127 = NL; public String generate(Object argument) { @@ -175,40 +176,43 @@ importManager.addImport("org.eclipse.emf.ecore.EClass"); importManager.addImport("org.eclipse.emf.ecore.EObject"); importManager.addImport("org.eclipse.gmf.runtime.notation.View"); importManager.addImport("org.eclipse.gmf.runtime.notation.Diagram"); +importManager.addImport("org.eclipse.core.runtime.Platform"); importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_5); stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); stringBuffer.append(TEXT_6); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_9); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); stringBuffer.append(TEXT_10); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(TEXT_11); if (genDiagram.getDomainDiagramElement() != null) { String classifierAccessorName = genDiagram.getDomainDiagramElement().getClassifierAccessorName(); String interfaceName = importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()); - stringBuffer.append(TEXT_11); - stringBuffer.append(genDiagram.getMetaPackageName(importManager)); stringBuffer.append(TEXT_12); - stringBuffer.append(classifierAccessorName); + stringBuffer.append(genDiagram.getMetaPackageName(importManager)); stringBuffer.append(TEXT_13); - stringBuffer.append(genDiagram.getUniqueIdentifier()); + stringBuffer.append(classifierAccessorName); stringBuffer.append(TEXT_14); - stringBuffer.append(interfaceName); + stringBuffer.append(genDiagram.getUniqueIdentifier()); stringBuffer.append(TEXT_15); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(interfaceName); stringBuffer.append(TEXT_16); - } - stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_17); + } stringBuffer.append(TEXT_18); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_19); for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext();) { String nextDomainModelName = (String) it.next(); @@ -216,45 +220,45 @@ for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext() continue; } - stringBuffer.append(TEXT_19); - stringBuffer.append(nextDomainModelName); stringBuffer.append(TEXT_20); + stringBuffer.append(nextDomainModelName); + stringBuffer.append(TEXT_21); } - stringBuffer.append(TEXT_21); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_23); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_24); for (Iterator containers = allContainers.iterator(); containers.hasNext();) { GenContainerBase nextContainer = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_24); - stringBuffer.append(importManager.getImportedName(nextContainer.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_25); + stringBuffer.append(importManager.getImportedName(nextContainer.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_26); if (nextContainer instanceof GenNode) { GenNode node = (GenNode) nextContainer; for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_26); - stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_28); + stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_29); } for (Iterator compartments = node.getCompartments().iterator(); compartments.hasNext();) { GenCompartment compartment = (GenCompartment) compartments.next(); - stringBuffer.append(TEXT_29); - stringBuffer.append(importManager.getImportedName(compartment.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName(compartment.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_31); + stringBuffer.append(importManager.getImportedName(compartment.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_32); } } @@ -265,50 +269,50 @@ for (Iterator containers = allContainers.iterator(); containers.hasNext();) { final String interfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getQualifiedInterfaceName()); final String semanticPackageInterfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_32); - stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_33); - stringBuffer.append(semanticPackageInterfaceName); + stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_34); - stringBuffer.append(classifierAccessorName); + stringBuffer.append(semanticPackageInterfaceName); stringBuffer.append(TEXT_35); - stringBuffer.append(childNode.getUniqueIdentifier()); + stringBuffer.append(classifierAccessorName); stringBuffer.append(TEXT_36); - stringBuffer.append(interfaceName); + stringBuffer.append(childNode.getUniqueIdentifier()); stringBuffer.append(TEXT_37); - stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); + stringBuffer.append(interfaceName); stringBuffer.append(TEXT_38); + stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_39); } - stringBuffer.append(TEXT_39); - stringBuffer.append(nextContainer.getUniqueIdentifier()); stringBuffer.append(TEXT_40); + stringBuffer.append(nextContainer.getUniqueIdentifier()); + stringBuffer.append(TEXT_41); } for (Iterator links = genLinks.iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); if (link.getLabels().size() > 0) { - stringBuffer.append(TEXT_41); - stringBuffer.append(importManager.getImportedName(link.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_42); + stringBuffer.append(importManager.getImportedName(link.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_43); for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_43); - stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_45); - } + stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_46); - stringBuffer.append(link.getUniqueIdentifier()); + } stringBuffer.append(TEXT_47); + stringBuffer.append(link.getUniqueIdentifier()); + stringBuffer.append(TEXT_48); } } - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_49); for (int i = 0; i < genLinks.size(); i++) { GenLink genLink = (GenLink) genLinks.get(i); @@ -318,56 +322,56 @@ for (int i = 0; i < genLinks.size(); i++) { final String qualifiedInterfaceName = modelFacet.getMetaClass().getQualifiedInterfaceName(); final String semanticPackageInterfaceName = importManager.getImportedName(modelFacet.getMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_49); - stringBuffer.append(semanticPackageInterfaceName); stringBuffer.append(TEXT_50); - stringBuffer.append(semanticLinkInterfaceName); + stringBuffer.append(semanticPackageInterfaceName); stringBuffer.append(TEXT_51); - stringBuffer.append(genLink.getUniqueIdentifier()); + stringBuffer.append(semanticLinkInterfaceName); stringBuffer.append(TEXT_52); - stringBuffer.append(importManager.getImportedName(qualifiedInterfaceName)); + stringBuffer.append(genLink.getUniqueIdentifier()); stringBuffer.append(TEXT_53); - stringBuffer.append(importManager.getImportedName(genLink.getEditPartQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(qualifiedInterfaceName)); stringBuffer.append(TEXT_54); + stringBuffer.append(importManager.getImportedName(genLink.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_55); } } - stringBuffer.append(TEXT_55); - if (genDiagram.getDomainDiagramElement() != null) { stringBuffer.append(TEXT_56); - stringBuffer.append(genDiagram.getUniqueIdentifier()); + if (genDiagram.getDomainDiagramElement() != null) { stringBuffer.append(TEXT_57); - stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); + stringBuffer.append(genDiagram.getUniqueIdentifier()); stringBuffer.append(TEXT_58); - } + stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); stringBuffer.append(TEXT_59); + } + stringBuffer.append(TEXT_60); for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) { GenNode nextNode = (GenNode) nodes.next(); String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName()); boolean callMatcher = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null; - stringBuffer.append(TEXT_60); - stringBuffer.append(nextNode.getUniqueIdentifier()); stringBuffer.append(TEXT_61); - stringBuffer.append(childNodeInterfaceName); + stringBuffer.append(nextNode.getUniqueIdentifier()); stringBuffer.append(TEXT_62); + stringBuffer.append(childNodeInterfaceName); + stringBuffer.append(TEXT_63); if (callMatcher) { stringBuffer.append(nextNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_63); - } else { stringBuffer.append(TEXT_64); - } + } else { stringBuffer.append(TEXT_65); + } + stringBuffer.append(TEXT_66); } for (Iterator containers = allContainers.iterator(); containers.hasNext();) { GenContainerBase nextContainer = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_66); - stringBuffer.append(nextContainer.getUniqueIdentifier()); stringBuffer.append(TEXT_67); + stringBuffer.append(nextContainer.getUniqueIdentifier()); + stringBuffer.append(TEXT_68); } for (Iterator links = genLinks.iterator(); links.hasNext();) { @@ -376,11 +380,11 @@ for (Iterator links = genLinks.iterator(); links.hasNext();) { continue; } - stringBuffer.append(TEXT_68); - stringBuffer.append(link.getUniqueIdentifier()); stringBuffer.append(TEXT_69); - } + stringBuffer.append(link.getUniqueIdentifier()); stringBuffer.append(TEXT_70); + } + stringBuffer.append(TEXT_71); for (int i = 0; i < genLinks.size(); i++) { GenLink genLink = (GenLink) genLinks.get(i); @@ -389,18 +393,18 @@ for (int i = 0; i < genLinks.size(); i++) { String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName()); boolean callMatcher = modelFacet.getModelElementSelector() != null; - stringBuffer.append(TEXT_71); - stringBuffer.append(genLink.getUniqueIdentifier()); stringBuffer.append(TEXT_72); - stringBuffer.append(interfaceName); + stringBuffer.append(genLink.getUniqueIdentifier()); stringBuffer.append(TEXT_73); + stringBuffer.append(interfaceName); + stringBuffer.append(TEXT_74); if (callMatcher) { stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_74); - } else { stringBuffer.append(TEXT_75); - } + } else { stringBuffer.append(TEXT_76); + } + stringBuffer.append(TEXT_77); } } @@ -434,13 +438,13 @@ for (Iterator it = genDiagram.eAllContents(); it.hasNext() && expressionProvider javaSelectorFacets.add(modelFacet); } - stringBuffer.append(TEXT_77); - stringBuffer.append(matcherClassName); stringBuffer.append(TEXT_78); - stringBuffer.append(id); - stringBuffer.append(TEXT_79); stringBuffer.append(matcherClassName); + stringBuffer.append(TEXT_79); + stringBuffer.append(id); stringBuffer.append(TEXT_80); + stringBuffer.append(matcherClassName); + stringBuffer.append(TEXT_81); { /*begin the scope*/ /* @@ -456,7 +460,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_82); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -465,26 +469,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_82); - stringBuffer.append(__expressionAccessor); stringBuffer.append(TEXT_83); - stringBuffer.append(__genValueExpression.getBody()); + stringBuffer.append(__expressionAccessor); stringBuffer.append(TEXT_84); - stringBuffer.append(__ctxEClassifierAccess); + stringBuffer.append(__genValueExpression.getBody()); stringBuffer.append(TEXT_85); - stringBuffer.append(__outEnvVarName); + stringBuffer.append(__ctxEClassifierAccess); stringBuffer.append(TEXT_86); + stringBuffer.append(__outEnvVarName); + stringBuffer.append(TEXT_87); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_87); - stringBuffer.append(__expressionAccessor); stringBuffer.append(TEXT_88); - stringBuffer.append(__genValueExpression.getBody()); + stringBuffer.append(__expressionAccessor); stringBuffer.append(TEXT_89); - stringBuffer.append(__ctxEClassifierAccess); + stringBuffer.append(__genValueExpression.getBody()); stringBuffer.append(TEXT_90); + stringBuffer.append(__ctxEClassifierAccess); + stringBuffer.append(TEXT_91); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -492,71 +496,71 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_91); - stringBuffer.append(__importedAbstractClass); stringBuffer.append(TEXT_92); - stringBuffer.append(__ctxEClassifierAccess); + stringBuffer.append(__importedAbstractClass); stringBuffer.append(TEXT_93); - stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(__ctxEClassifierAccess); stringBuffer.append(TEXT_94); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); + stringBuffer.append(importManager.getImportedName("java.util.Map")); stringBuffer.append(TEXT_95); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_96); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); + stringBuffer.append(TEXT_97); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String nextVariableName = (String)envVarIt.next(); org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName); String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_97); - stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); stringBuffer.append(TEXT_98); - stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_99); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_99); stringBuffer.append(nextVariableName); + stringBuffer.append(TEXT_100); + stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); stringBuffer.append(TEXT_101); - } + stringBuffer.append(nextVariableName); stringBuffer.append(TEXT_102); + } + stringBuffer.append(TEXT_103); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_104); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_105); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_106); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_107); } } /*end of scope*/ - stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_108); } /* end of selector interation */ if(selectorCounter > 0) { - stringBuffer.append(TEXT_108); - stringBuffer.append(matcherClassName); stringBuffer.append(TEXT_109); - stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_110); stringBuffer.append(matcherClassName); - stringBuffer.append(TEXT_111); + stringBuffer.append(TEXT_110); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); + stringBuffer.append(TEXT_111); + stringBuffer.append(matcherClassName); stringBuffer.append(TEXT_112); + stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); + stringBuffer.append(TEXT_113); stringBuffer.append(matcherClassName); if(!javaSelectorFacets.isEmpty()) { - stringBuffer.append(TEXT_113); - stringBuffer.append(javaMatcherContainer); stringBuffer.append(TEXT_114); + stringBuffer.append(javaMatcherContainer); + stringBuffer.append(TEXT_115); for(Iterator it = javaSelectorFacets.iterator(); it.hasNext();) { TypeModelFacet modelFacet = (TypeModelFacet) it.next(); @@ -564,7 +568,7 @@ if(selectorCounter > 0) { GenClassifier __genExprContext = modelFacet.getMetaClass(); String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$ - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_116); /* ValueExpression __genValueExpression @@ -584,13 +588,13 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression __exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj); String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_116); - stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); stringBuffer.append(TEXT_117); - stringBuffer.append(__exprJavaOperName); + stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); stringBuffer.append(TEXT_118); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); + stringBuffer.append(__exprJavaOperName); stringBuffer.append(TEXT_119); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); + stringBuffer.append(TEXT_120); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -598,30 +602,30 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_120); - stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); stringBuffer.append(TEXT_121); + stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); + stringBuffer.append(TEXT_122); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_122); - stringBuffer.append(__exprJavaOperName); stringBuffer.append(TEXT_123); + stringBuffer.append(__exprJavaOperName); + stringBuffer.append(TEXT_124); } } /* java javaSelectorFacets iteration */ - stringBuffer.append(TEXT_124); + stringBuffer.append(TEXT_125); stringBuffer.append(javaMatcherContainer); } /* !javaSelectorFacets.isEmpty() */ } /* selectorCounter > 0 */ - stringBuffer.append(TEXT_125); - importManager.emitSortedImports(); stringBuffer.append(TEXT_126); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_127); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java index 97ff9ab98..3d4a7fb88 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java @@ -23,24 +23,22 @@ public class EditPartFactoryGenerator protected final String TEXT_5 = ";" + NL; protected final String TEXT_6 = NL + "import org.eclipse.draw2d.FigureUtilities;" + NL + "import org.eclipse.draw2d.IFigure;" + NL + "import org.eclipse.draw2d.Label;" + NL + "import org.eclipse.draw2d.geometry.Dimension;" + NL + "import org.eclipse.draw2d.geometry.Rectangle;" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gef.EditPartFactory;" + NL + "import org.eclipse.gef.tools.CellEditorLocator;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;" + NL + "import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.jface.viewers.CellEditor;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.widgets.Text;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " implements EditPartFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EXTERNAL_NODE_LABELS_LAYER = \"External Node Labels\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPart createEditPart(EditPart context, Object model) {" + NL + "\t\tif (model instanceof View) {" + NL + "\t\t\tView view = (View) model;" + NL + "\t\t\tif (!"; - protected final String TEXT_9 = ".MODEL_ID.equals("; - protected final String TEXT_10 = ".getModelID(view))) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tint viewVisualID = "; - protected final String TEXT_11 = ".getVisualID(view);" + NL + "\t\t\tswitch (viewVisualID) {"; - protected final String TEXT_12 = NL + "\t\t\tcase "; - protected final String TEXT_13 = ".VISUAL_ID:" + NL + "\t\t\t\t return new "; - protected final String TEXT_14 = "(view);"; - protected final String TEXT_15 = NL + "\t\t\tcase "; - protected final String TEXT_16 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; - protected final String TEXT_17 = "(view);"; - protected final String TEXT_18 = "\t\t" + NL + "\t\t\tcase "; - protected final String TEXT_19 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; - protected final String TEXT_20 = "(view);"; - protected final String TEXT_21 = NL + "\t\t\tcase "; - protected final String TEXT_22 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; - protected final String TEXT_23 = "(view);"; - protected final String TEXT_24 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createUnrecognizedEditPart(context, model);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private EditPart createUnrecognizedEditPart(EditPart context, Object model) {" + NL + "\t \t// Handle creation of unrecognized child node EditParts here" + NL + "\t \treturn null;" + NL + "\t }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source){" + NL + " if (source.getFigure() instanceof WrapLabel)" + NL + " return new TextCellEditorLocator((WrapLabel) source.getFigure());" + NL + " else {" + NL + " IFigure figure = source.getFigure();" + NL + " return new LabelCellEditorLocator((Label) figure);" + NL + " }" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic private class TextCellEditorLocator implements CellEditorLocator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate WrapLabel wrapLabel;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic TextCellEditorLocator(WrapLabel wrapLabel) {" + NL + "\t\t\tsuper();" + NL + "\t\t\tthis.wrapLabel = wrapLabel;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic WrapLabel getWrapLabel() {" + NL + "\t\t\treturn wrapLabel;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void relocate(CellEditor celleditor) {" + NL + "\t\t\tText text = (Text) celleditor.getControl();" + NL + "\t\t\tRectangle rect = getWrapLabel().getTextBounds().getCopy();" + NL + "\t\t\tgetWrapLabel().translateToAbsolute(rect);" + NL + "\t\t\t" + NL + "\t\t\tif (getWrapLabel().isTextWrapped() && getWrapLabel().getText().length() > 0)" + NL + "\t\t\t\trect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));" + NL + "\t\t\telse {" + NL + "\t\t\t\tint avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();" + NL + "\t\t\t\trect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr*2, 0));" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tif (!rect.equals(new Rectangle(text.getBounds())))" + NL + "\t\t\t\ttext.setBounds(rect.x, rect.y, rect.width, rect.height);" + NL + "\t\t}" + NL + "" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class LabelCellEditorLocator implements CellEditorLocator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate Label label;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic LabelCellEditorLocator(Label label) {" + NL + "\t\t\tthis.label = label;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Label getLabel() {" + NL + "\t\t\treturn label;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void relocate(CellEditor celleditor) {" + NL + "\t\t\tText text = (Text) celleditor.getControl();" + NL + "\t\t\tRectangle rect = getLabel().getTextBounds().getCopy();" + NL + "\t\t\tgetLabel().translateToAbsolute(rect);" + NL + "" + NL + "\t\t\tint avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();" + NL + "\t\t\trect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));" + NL + "" + NL + "\t\t\tif (!rect.equals(new Rectangle(text.getBounds())))" + NL + "\t\t\t\ttext.setBounds(rect.x, rect.y, rect.width, rect.height);" + NL + "\t\t}" + NL + "\t}" + NL + "}"; - protected final String TEXT_25 = NL; + protected final String TEXT_8 = " implements EditPartFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EXTERNAL_NODE_LABELS_LAYER = \"External Node Labels\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPart createEditPart(EditPart context, Object model) {" + NL + "\t\tif (model instanceof View) {" + NL + "\t\t\tView view = (View) model;" + NL + "\t\t\tint viewVisualID = "; + protected final String TEXT_9 = ".getVisualID(view);" + NL + "\t\t\tswitch (viewVisualID) {"; + protected final String TEXT_10 = NL + "\t\t\tcase "; + protected final String TEXT_11 = ".VISUAL_ID:" + NL + "\t\t\t\t return new "; + protected final String TEXT_12 = "(view);"; + protected final String TEXT_13 = NL + "\t\t\tcase "; + protected final String TEXT_14 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; + protected final String TEXT_15 = "(view);"; + protected final String TEXT_16 = "\t\t" + NL + "\t\t\tcase "; + protected final String TEXT_17 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; + protected final String TEXT_18 = "(view);"; + protected final String TEXT_19 = NL + "\t\t\tcase "; + protected final String TEXT_20 = ".VISUAL_ID:" + NL + "\t\t\t\treturn new "; + protected final String TEXT_21 = "(view);"; + protected final String TEXT_22 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createUnrecognizedEditPart(context, model);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private EditPart createUnrecognizedEditPart(EditPart context, Object model) {" + NL + "\t \t// Handle creation of unrecognized child node EditParts here" + NL + "\t \treturn null;" + NL + "\t }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source){" + NL + " if (source.getFigure() instanceof WrapLabel)" + NL + " return new TextCellEditorLocator((WrapLabel) source.getFigure());" + NL + " else {" + NL + " IFigure figure = source.getFigure();" + NL + " return new LabelCellEditorLocator((Label) figure);" + NL + " }" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic private class TextCellEditorLocator implements CellEditorLocator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate WrapLabel wrapLabel;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic TextCellEditorLocator(WrapLabel wrapLabel) {" + NL + "\t\t\tsuper();" + NL + "\t\t\tthis.wrapLabel = wrapLabel;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic WrapLabel getWrapLabel() {" + NL + "\t\t\treturn wrapLabel;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void relocate(CellEditor celleditor) {" + NL + "\t\t\tText text = (Text) celleditor.getControl();" + NL + "\t\t\tRectangle rect = getWrapLabel().getTextBounds().getCopy();" + NL + "\t\t\tgetWrapLabel().translateToAbsolute(rect);" + NL + "\t\t\t" + NL + "\t\t\tif (getWrapLabel().isTextWrapped() && getWrapLabel().getText().length() > 0)" + NL + "\t\t\t\trect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));" + NL + "\t\t\telse {" + NL + "\t\t\t\tint avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();" + NL + "\t\t\t\trect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr*2, 0));" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tif (!rect.equals(new Rectangle(text.getBounds())))" + NL + "\t\t\t\ttext.setBounds(rect.x, rect.y, rect.width, rect.height);" + NL + "\t\t}" + NL + "" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class LabelCellEditorLocator implements CellEditorLocator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate Label label;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic LabelCellEditorLocator(Label label) {" + NL + "\t\t\tthis.label = label;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Label getLabel() {" + NL + "\t\t\treturn label;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void relocate(CellEditor celleditor) {" + NL + "\t\t\tText text = (Text) celleditor.getControl();" + NL + "\t\t\tRectangle rect = getLabel().getTextBounds().getCopy();" + NL + "\t\t\tgetLabel().translateToAbsolute(rect);" + NL + "" + NL + "\t\t\tint avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();" + NL + "\t\t\trect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));" + NL + "" + NL + "\t\t\tif (!rect.equals(new Rectangle(text.getBounds())))" + NL + "\t\t\t\ttext.setBounds(rect.x, rect.y, rect.width, rect.height);" + NL + "\t\t}" + NL + "\t}" + NL + "}"; + protected final String TEXT_23 = NL; public String generate(Object argument) { @@ -69,32 +67,28 @@ final String visualIDRegistryClassName = importManager.getImportedName(genDiagra stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getEditPartFactoryClassName()); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_9); - stringBuffer.append(visualIDRegistryClassName); - stringBuffer.append(TEXT_10); stringBuffer.append(visualIDRegistryClassName); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_9); for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { GenContainerBase container = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName(container.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_11); stringBuffer.append(container.getEditPartClassName()); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_12); if (container instanceof GenNode) { GenNode node = (GenNode) container; for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_14); stringBuffer.append(label.getEditPartClassName()); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_15); } } @@ -102,27 +96,27 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName(link.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_17); stringBuffer.append(link.getEditPartClassName()); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_18); for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_20); stringBuffer.append(linkLabel.getEditPartClassName()); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_21); } } - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_22); importManager.emitSortedImports(); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_23); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/ChildContainerCanonicalEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/ChildContainerCanonicalEditPolicyGenerator.java index b5e7c64b8..5618fd9e6 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/ChildContainerCanonicalEditPolicyGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/ChildContainerCanonicalEditPolicyGenerator.java @@ -236,9 +236,6 @@ public class ChildContainerCanonicalEditPolicyGenerator { { final StringBuffer stringBuffer = new StringBuffer(); -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - GenChildContainer genContainer = (GenChildContainer) ((Object[]) argument)[0]; GenDiagram genDiagram = genContainer.getDiagram(); @@ -261,7 +258,7 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(genContainer.getCanonicalEditPolicyClassName()); stringBuffer.append(TEXT_8); -if (isSynchronizedDiagram) { +if (genDiagram.isSynchronized()) { List genNodes = genContainer.getChildNodes(); stringBuffer.append(TEXT_9); @@ -372,7 +369,7 @@ for (Iterator entries = entrySet.iterator(); entries.hasNext();) { stringBuffer.append(TEXT_45); } stringBuffer.append(TEXT_46); - if (genContainer instanceof GenNode && isSynchronizedDiagram) { + if (genContainer instanceof GenNode && genDiagram.isSynchronized()) { stringBuffer.append(TEXT_47); // Collecting all phantom elements diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java index 26685705e..1e5196984 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java @@ -389,9 +389,6 @@ public class DiagramCanonicalEditPolicyGenerator { { final StringBuffer stringBuffer = new StringBuffer(); -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; stringBuffer.append(TEXT_1); @@ -414,7 +411,7 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_8); GenClass modelElementInterface = genDiagram.getDomainDiagramElement(); -if (modelElementInterface != null && isSynchronizedDiagram) { +if (modelElementInterface != null && genDiagram.isSynchronized()) { List genNodes = genDiagram.getTopLevelNodes(); stringBuffer.append(TEXT_9); @@ -540,11 +537,11 @@ for (Iterator topLevelNodes = genDiagram.getTopLevelNodes().iterator(); topLevel } stringBuffer.append(TEXT_48); - if (isSynchronizedDiagram && genClass2Phantom.size() > 0) { + if (genDiagram.isSynchronized() && genClass2Phantom.size() > 0) { stringBuffer.append(TEXT_49); } stringBuffer.append(TEXT_50); - if (isSynchronizedDiagram && genClass2Phantom.size() > 0) { + if (genDiagram.isSynchronized() && genClass2Phantom.size() > 0) { stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("java.util.Collection")); stringBuffer.append(TEXT_52); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java index b8be09b77..5a4062af4 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java @@ -1,6 +1,7 @@ package org.eclipse.gmf.codegen.templates.providers; import org.eclipse.gmf.codegen.gmfgen.*; +import org.eclipse.gmf.common.codegen.*; public class EditPartProviderGenerator { @@ -20,16 +21,21 @@ public class EditPartProviderGenerator protected final String TEXT_4 = NL + "package "; protected final String TEXT_5 = ";" + NL + "" + NL + "import java.lang.ref.WeakReference;" + NL + "" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gef.EditPartFactory;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import "; protected final String TEXT_6 = "."; - protected final String TEXT_7 = ";" + NL + "" + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " extends AbstractEditPartProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditPartFactory factory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean allowCaching;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_9 = "() {" + NL + "\t\tsetFactory(new "; - protected final String TEXT_10 = "());" + NL + "\t\tsetAllowCaching(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final EditPartFactory getFactory() {" + NL + "\t\treturn factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFactory(EditPartFactory factory) {" + NL + "\t\tthis.factory = factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isAllowCaching() {" + NL + "\t\treturn allowCaching;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected synchronized void setAllowCaching(boolean allowCaching) {" + NL + "\t\tthis.allowCaching = allowCaching;" + NL + "\t\tif (!allowCaching) {" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart createEditPart(View view) {" + NL + "\t\tEditPart part = factory.createEditPart(null, view);" + NL + "\t\tif (part instanceof IGraphicalEditPart) {" + NL + "\t\t\treturn (IGraphicalEditPart) part;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart getCachedPart(View view) {" + NL + "\t\tif (cachedView != null && cachedView.get() == view) {" + NL + "\t\t\treturn (IGraphicalEditPart) cachedPart.get();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized IGraphicalEditPart createGraphicEditPart(View view) {" + NL + "\t\tif (isAllowCaching()) {" + NL + "\t\t\tIGraphicalEditPart part = getCachedPart(view);" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\treturn part;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createEditPart(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof CreateGraphicEditPartOperation) {" + NL + "\t\t\tView view = ((IEditPartOperation) operation).getView();" + NL + "\t\t\tif (isAllowCaching() && getCachedPart(view) != null) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tIGraphicalEditPart part = createEditPart(view);" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\tif (isAllowCaching()) {" + NL + "\t\t\t\t\tcachedPart = new WeakReference(part);" + NL + "\t\t\t\t\tcachedView = new WeakReference(view);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}"; - protected final String TEXT_11 = NL; + protected final String TEXT_7 = ";"; + protected final String TEXT_8 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_9 = " extends AbstractEditPartProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditPartFactory factory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean allowCaching;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_10 = "() {" + NL + "\t\tsetFactory(new "; + protected final String TEXT_11 = "());" + NL + "\t\tsetAllowCaching(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final EditPartFactory getFactory() {" + NL + "\t\treturn factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFactory(EditPartFactory factory) {" + NL + "\t\tthis.factory = factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isAllowCaching() {" + NL + "\t\treturn allowCaching;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected synchronized void setAllowCaching(boolean allowCaching) {" + NL + "\t\tthis.allowCaching = allowCaching;" + NL + "\t\tif (!allowCaching) {" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart createEditPart(View view) {" + NL + "\t\tEditPart part = factory.createEditPart(null, view);" + NL + "\t\tif (part instanceof IGraphicalEditPart) {" + NL + "\t\t\treturn (IGraphicalEditPart) part;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart getCachedPart(View view) {" + NL + "\t\tif (cachedView != null && cachedView.get() == view) {" + NL + "\t\t\treturn (IGraphicalEditPart) cachedPart.get();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized IGraphicalEditPart createGraphicEditPart(View view) {" + NL + "\t\tif (isAllowCaching()) {" + NL + "\t\t\tIGraphicalEditPart part = getCachedPart(view);" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\treturn part;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createEditPart(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof CreateGraphicEditPartOperation) {" + NL + "\t\t\tView view = ((IEditPartOperation) operation).getView();" + NL + "\t\t\tif (!"; + protected final String TEXT_12 = ".MODEL_ID.equals("; + protected final String TEXT_13 = ".getModelID(view))) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tif (isAllowCaching() && getCachedPart(view) != null) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tIGraphicalEditPart part = createEditPart(view);" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\tif (isAllowCaching()) {" + NL + "\t\t\t\t\tcachedPart = new WeakReference(part);" + NL + "\t\t\t\t\tcachedView = new WeakReference(view);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}"; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); - GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; + +GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; +ImportUtil importManager = new ImportUtil(genDiagram.getProvidersPackageName()); + stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); @@ -46,13 +52,19 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_6); stringBuffer.append(genDiagram.getEditPartFactoryClassName()); stringBuffer.append(TEXT_7); - stringBuffer.append(genDiagram.getEditPartProviderClassName()); + importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_8); stringBuffer.append(genDiagram.getEditPartProviderClassName()); stringBuffer.append(TEXT_9); - stringBuffer.append(genDiagram.getEditPartFactoryClassName()); + stringBuffer.append(genDiagram.getEditPartProviderClassName()); stringBuffer.append(TEXT_10); + stringBuffer.append(genDiagram.getEditPartFactoryClassName()); stringBuffer.append(TEXT_11); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_12); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(TEXT_13); + importManager.emitSortedImports(); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ParserProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ParserProviderGenerator.java index 462c49024..3fa07af60 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ParserProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ParserProviderGenerator.java @@ -61,8 +61,9 @@ public class ParserProviderGenerator protected final String TEXT_42 = "();"; protected final String TEXT_43 = NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IParser getParser(IAdaptable hint) {" + NL + "\t\tString vid = (String) hint.getAdapter(String.class);" + NL + "\t\tif (vid != null) {" + NL + "\t\t\treturn getParser("; protected final String TEXT_44 = ".getVisualID(vid));" + NL + "\t\t}" + NL + "\t\tView view = (View) hint.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\treturn getParser("; - protected final String TEXT_45 = ".getVisualID(view));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetParserOperation) {" + NL + "\t\t\treturn getParser(((GetParserOperation) operation).getHint()) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}"; - protected final String TEXT_46 = NL; + protected final String TEXT_45 = ".getVisualID(view));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetParserOperation) {" + NL + "\t\t\tIAdaptable hint = ((GetParserOperation) operation).getHint();" + NL + "\t\t\tif ("; + protected final String TEXT_46 = ".getElement(hint) == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\treturn getParser(hint) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}"; + protected final String TEXT_47 = NL; public String generate(Object argument) { @@ -226,8 +227,10 @@ for (Iterator it = labelMethodNames.keySet().iterator(); it.hasNext(); ) { stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_45); - importManager.emitSortedImports(); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); stringBuffer.append(TEXT_46); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_47); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java index c7d86ee79..636503000 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java @@ -22,9 +22,11 @@ public class ShortcutsDecoratorProviderGenerator protected final String TEXT_5 = ";" + NL; protected final String TEXT_6 = NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.swt.graphics.Image;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " extends AbstractProvider implements IDecoratorProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String SHORTCUTS_DECORATOR_ID = \"shortcuts\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (!(operation instanceof CreateDecoratorsOperation)) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tIDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();" + NL + "\t\treturn decoratorTarget.getAdapter(View.class) != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createDecorators(IDecoratorTarget decoratorTarget) {" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\tdecoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected class ShortcutsDecorator extends AbstractDecorator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ShortcutsDecorator(IDecoratorTarget decoratorTarget) {" + NL + "\t\t\tsuper(decoratorTarget);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void activate() {" + NL + "\t\t\trefresh();" + NL + "\t\t\tEditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);" + NL + "\t\t\tImage image = "; - protected final String TEXT_9 = ".getInstance().getBundledImage(\"icons/shortcut.gif\");" + NL + "\t\t\tif (editPart instanceof ShapeEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addShapeDecoration(image, IDecoratorTarget.Direction.SOUTH_WEST, 0, false));" + NL + "\t\t\t} else if (editPart instanceof ConnectionEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void refresh() {" + NL + "\t\t\tremoveDecoration();" + NL + "\t\t}" + NL + "\t}" + NL + "}"; - protected final String TEXT_10 = NL; + protected final String TEXT_8 = " extends AbstractProvider implements IDecoratorProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String SHORTCUTS_DECORATOR_ID = \"shortcuts\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (!(operation instanceof CreateDecoratorsOperation)) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tIDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\treturn view != null && "; + protected final String TEXT_9 = ".MODEL_ID.equals("; + protected final String TEXT_10 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createDecorators(IDecoratorTarget decoratorTarget) {" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\tdecoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected class ShortcutsDecorator extends AbstractDecorator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ShortcutsDecorator(IDecoratorTarget decoratorTarget) {" + NL + "\t\t\tsuper(decoratorTarget);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void activate() {" + NL + "\t\t\trefresh();" + NL + "\t\t\tEditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);" + NL + "\t\t\tImage image = "; + protected final String TEXT_11 = ".getInstance().getBundledImage(\"icons/shortcut.gif\");" + NL + "\t\t\tif (editPart instanceof ShapeEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addShapeDecoration(image, IDecoratorTarget.Direction.SOUTH_WEST, 0, false));" + NL + "\t\t\t} else if (editPart instanceof ConnectionEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void refresh() {" + NL + "\t\t\tremoveDecoration();" + NL + "\t\t}" + NL + "\t}" + NL + "}"; + protected final String TEXT_12 = NL; public String generate(Object argument) { @@ -48,10 +50,14 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getShortcutsDecoratorProviderClassName()); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_9); - importManager.emitSortedImports(); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_10); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(TEXT_11); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_12); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java index 9cb93370b..eb1c1be29 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java @@ -21,7 +21,7 @@ public class ViewProviderGenerator protected final String TEXT_3 = NL + " */"; protected final String TEXT_4 = NL + "package "; protected final String TEXT_5 = ";" + NL; - protected final String TEXT_6 = NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EClass;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; + protected final String TEXT_6 = NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EClass;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.IElementType;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; protected final String TEXT_8 = " extends AbstractViewProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {"; protected final String TEXT_9 = NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);"; @@ -30,36 +30,38 @@ public class ViewProviderGenerator protected final String TEXT_12 = NL + "\t\t\t\t&& "; protected final String TEXT_13 = ".getDiagramVisualID(semanticElement) != -1"; protected final String TEXT_14 = NL + "\t\t\t\t) {" + NL + "\t\t\treturn "; - protected final String TEXT_15 = ".class;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tif (containerView == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint nodeVID = "; - protected final String TEXT_16 = ".getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);" + NL + "" + NL + "\t\tswitch (nodeVID) {"; - protected final String TEXT_17 = NL + "\t\tcase "; - protected final String TEXT_18 = ".VISUAL_ID:" + NL + "\t\t\t return "; - protected final String TEXT_19 = ".class;"; - protected final String TEXT_20 = NL + "\t\tcase "; - protected final String TEXT_21 = ".VISUAL_ID:" + NL + "\t\t\treturn "; - protected final String TEXT_22 = ".class;"; - protected final String TEXT_23 = NL + "\t\tcase "; - protected final String TEXT_24 = ".VISUAL_ID:" + NL + "\t\t\treturn "; - protected final String TEXT_25 = ".class;"; - protected final String TEXT_26 = NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {"; - protected final String TEXT_27 = NL + "\t\t"; - protected final String TEXT_28 = " elementType = getSemanticElementType(semanticAdapter);"; - protected final String TEXT_29 = NL + "\t\tif ("; - protected final String TEXT_30 = "."; - protected final String TEXT_31 = ".equals(elementType)) {" + NL + "\t\t\treturn "; - protected final String TEXT_32 = ".class;" + NL + "\t\t}"; - protected final String TEXT_33 = NL + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tif (semanticType == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "" + NL + "\t\tint linkVID = "; - protected final String TEXT_34 = ".getLinkWithClassVisualID(semanticElement, semanticType);" + NL + "\t\t" + NL + "\t\tswitch (linkVID) {"; - protected final String TEXT_35 = NL + "\t\tcase "; - protected final String TEXT_36 = ".VISUAL_ID:" + NL + "\t\t\treturn "; - protected final String TEXT_37 = ".class;"; - protected final String TEXT_38 = NL + "\t\t}" + NL + "\t\treturn getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);" + NL + "\t}"; - protected final String TEXT_39 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_40 = " getSemanticElementType(IAdaptable semanticAdapter) {" + NL + "\t\tif (semanticAdapter == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn ("; - protected final String TEXT_41 = ") semanticAdapter.getAdapter("; - protected final String TEXT_42 = ".class);" + NL + "\t}"; - protected final String TEXT_43 = NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t \t// Handle unrecognized child node classes here" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "}"; - protected final String TEXT_44 = NL; + protected final String TEXT_15 = ".class;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tif (containerView == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tif (semanticAdapter.getAdapter(IElementType.class) != null && "; + protected final String TEXT_16 = ".getElement(semanticAdapter) == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint nodeVID = "; + protected final String TEXT_17 = ".getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);" + NL + "" + NL + "\t\tswitch (nodeVID) {"; + protected final String TEXT_18 = NL + "\t\tcase "; + protected final String TEXT_19 = ".VISUAL_ID:" + NL + "\t\t\t return "; + protected final String TEXT_20 = ".class;"; + protected final String TEXT_21 = NL + "\t\tcase "; + protected final String TEXT_22 = ".VISUAL_ID:" + NL + "\t\t\treturn "; + protected final String TEXT_23 = ".class;"; + protected final String TEXT_24 = NL + "\t\tcase "; + protected final String TEXT_25 = ".VISUAL_ID:" + NL + "\t\t\treturn "; + protected final String TEXT_26 = ".class;"; + protected final String TEXT_27 = NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tif (semanticAdapter.getAdapter(IElementType.class) != null && "; + protected final String TEXT_28 = ".getElement(semanticAdapter) == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}"; + protected final String TEXT_29 = NL + "\t\t"; + protected final String TEXT_30 = " elementType = getSemanticElementType(semanticAdapter);"; + protected final String TEXT_31 = NL + "\t\tif ("; + protected final String TEXT_32 = "."; + protected final String TEXT_33 = ".equals(elementType)) {" + NL + "\t\t\treturn "; + protected final String TEXT_34 = ".class;" + NL + "\t\t}"; + protected final String TEXT_35 = NL + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tif (semanticType == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "" + NL + "\t\tint linkVID = "; + protected final String TEXT_36 = ".getLinkWithClassVisualID(semanticElement, semanticType);" + NL + "\t\t" + NL + "\t\tswitch (linkVID) {"; + protected final String TEXT_37 = NL + "\t\tcase "; + protected final String TEXT_38 = ".VISUAL_ID:" + NL + "\t\t\treturn "; + protected final String TEXT_39 = ".class;"; + protected final String TEXT_40 = NL + "\t\t}" + NL + "\t\treturn getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);" + NL + "\t}"; + protected final String TEXT_41 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_42 = " getSemanticElementType(IAdaptable semanticAdapter) {" + NL + "\t\tif (semanticAdapter == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn ("; + protected final String TEXT_43 = ") semanticAdapter.getAdapter("; + protected final String TEXT_44 = ".class);" + NL + "\t}"; + protected final String TEXT_45 = NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t \t// Handle unrecognized child node classes here" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "}"; + protected final String TEXT_46 = NL; public String generate(Object argument) { @@ -100,28 +102,30 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoryQualifiedClassName())); stringBuffer.append(TEXT_15); - stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); stringBuffer.append(TEXT_16); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(TEXT_17); for (Iterator containers = genDiagram.getAllChildContainers().iterator(); containers.hasNext();) { GenContainerBase container = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_17); - stringBuffer.append(importManager.getImportedName(container.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_18); - stringBuffer.append(importManager.getImportedName(container.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(container.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_19); + stringBuffer.append(importManager.getImportedName(container.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(TEXT_20); if (container instanceof GenNode) { GenNode node = (GenNode) container; for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_20); - stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_21); - stringBuffer.append(importManager.getImportedName(label.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_22); + stringBuffer.append(importManager.getImportedName(label.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(TEXT_23); } } @@ -131,16 +135,18 @@ for (Iterator links = genLinks.iterator(); links.hasNext();) { for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_23); - stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_24); - stringBuffer.append(importManager.getImportedName(linkLabel.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_25); + stringBuffer.append(importManager.getImportedName(linkLabel.getNotationViewFactoryQualifiedClassName())); + stringBuffer.append(TEXT_26); } } - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_27); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); + stringBuffer.append(TEXT_28); boolean elementTypeInitialized = false; for (int i = 0; i < genLinks.size(); i++) { @@ -149,53 +155,53 @@ for (int i = 0; i < genLinks.size(); i++) { if (!elementTypeInitialized) { elementTypeInitialized = true; - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_29); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_30); } - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_32); stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName())); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_34); } } - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_36); for (int i = 0; i < genLinks.size(); i++) { GenLink genLink = (GenLink) genLinks.get(i); if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_37); stringBuffer.append(importManager.getImportedName(genLink.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName())); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_39); } } - stringBuffer.append(TEXT_38); - if (elementTypeInitialized) { - stringBuffer.append(TEXT_39); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_40); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); + if (elementTypeInitialized) { stringBuffer.append(TEXT_41); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_42); - } + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_43); - importManager.emitSortedImports(); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_44); + } + stringBuffer.append(TEXT_45); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_46); return stringBuffer.toString(); } } 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 adb72c678..b38f2b2e7 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 @@ -1084,13 +1084,22 @@ public interface GMFGenPackage extends EPackage { int GEN_DIAGRAM__PALETTE = GEN_CONTAINER_BASE_FEATURE_COUNT + 67; /** + * The feature id for the '<em><b>Synchronized</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GEN_DIAGRAM__SYNCHRONIZED = GEN_CONTAINER_BASE_FEATURE_COUNT + 68; + + /** * 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_CONTAINER_BASE_FEATURE_COUNT + 68; + int GEN_DIAGRAM_FEATURE_COUNT = GEN_CONTAINER_BASE_FEATURE_COUNT + 69; /** * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.GenEditorViewImpl <em>Gen Editor View</em>}' class. @@ -6130,6 +6139,17 @@ public interface GMFGenPackage extends EPackage { EReference getGenDiagram_Palette(); /** + * Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#isSynchronized <em>Synchronized</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Synchronized</em>'. + * @see org.eclipse.gmf.codegen.gmfgen.GenDiagram#isSynchronized() + * @see #getGenDiagram() + * @generated + */ + EAttribute getGenDiagram_Synchronized(); + + /** * Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.GenEditorView <em>Gen Editor View</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 c5842995e..099d693c6 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 @@ -25,6 +25,7 @@ import org.eclipse.gmf.common.codegen.ImportAssistant; * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getLinks <em>Links</em>}</li> * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getCompartments <em>Compartments</em>}</li> * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#getPalette <em>Palette</em>}</li> + * <li>{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#isSynchronized <em>Synchronized</em>}</li> * </ul> * </p> * @@ -177,6 +178,33 @@ public interface GenDiagram extends GenContainerBase, PackageNames, ProviderClas void setPalette(Palette value); /** + * Returns the value of the '<em><b>Synchronized</b></em>' attribute. + * The default value is <code>"true"</code>. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Synchronized</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Synchronized</em>' attribute. + * @see #setSynchronized(boolean) + * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getGenDiagram_Synchronized() + * @model default="true" + * @generated + */ + boolean isSynchronized(); + + /** + * Sets the value of the '{@link org.eclipse.gmf.codegen.gmfgen.GenDiagram#isSynchronized <em>Synchronized</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Synchronized</em>' attribute. + * @see #isSynchronized() + * @generated + */ + void setSynchronized(boolean value); + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @model kind="operation" type="org.eclipse.gmf.codegen.gmfgen.GenNode" 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 364031322..39547aa24 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 @@ -966,6 +966,15 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage { * <!-- end-user-doc --> * @generated */ + public EAttribute getGenDiagram_Synchronized() { + return (EAttribute)genDiagramEClass.getEStructuralFeatures().get(7); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getGenEditorView() { return genEditorViewEClass; } @@ -3633,6 +3642,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage { createEReference(genDiagramEClass, GEN_DIAGRAM__LINKS); createEReference(genDiagramEClass, GEN_DIAGRAM__COMPARTMENTS); createEReference(genDiagramEClass, GEN_DIAGRAM__PALETTE); + createEAttribute(genDiagramEClass, GEN_DIAGRAM__SYNCHRONIZED); genEditorViewEClass = createEClass(GEN_EDITOR_VIEW); createEReference(genEditorViewEClass, GEN_EDITOR_VIEW__EDITOR_GEN); @@ -4129,6 +4139,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage { initEReference(getGenDiagram_Links(), this.getGenLink(), this.getGenLink_Diagram(), "links", null, 0, -1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getGenDiagram_Compartments(), this.getGenCompartment(), this.getGenCompartment_Diagram(), "compartments", null, 0, -1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getGenDiagram_Palette(), this.getPalette(), this.getPalette_Diagram(), "palette", null, 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getGenDiagram_Synchronized(), ecorePackage.getEBoolean(), "synchronized", "true", 0, 1, GenDiagram.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); addEOperation(genDiagramEClass, this.getGenNode(), "getAllNodes", 0, -1); 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 573e32f65..8d7bd0cdb 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 @@ -117,6 +117,7 @@ import org.eclipse.gmf.common.codegen.ImportAssistant; * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getLinks <em>Links</em>}</li> * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getCompartments <em>Compartments</em>}</li> * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#getPalette <em>Palette</em>}</li> + * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.GenDiagramImpl#isSynchronized <em>Synchronized</em>}</li> * </ul> * </p> * @@ -1385,6 +1386,26 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { protected Palette palette = null; /** + * The default value of the '{@link #isSynchronized() <em>Synchronized</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSynchronized() + * @generated + * @ordered + */ + protected static final boolean SYNCHRONIZED_EDEFAULT = true; + + /** + * The cached value of the '{@link #isSynchronized() <em>Synchronized</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSynchronized() + * @generated + * @ordered + */ + protected boolean synchronized_ = SYNCHRONIZED_EDEFAULT; + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1545,6 +1566,27 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { * <!-- end-user-doc --> * @generated */ + public boolean isSynchronized() { + return synchronized_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setSynchronized(boolean newSynchronized) { + boolean oldSynchronized = synchronized_; + synchronized_ = newSynchronized; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED, oldSynchronized, synchronized_)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public String getEditCommandsPackageNameGen() { return editCommandsPackageName; } @@ -3583,6 +3625,8 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { return getCompartments(); case GMFGenPackage.GEN_DIAGRAM__PALETTE: return getPalette(); + case GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED: + return isSynchronized() ? Boolean.TRUE : Boolean.FALSE; } return super.eGet(featureID, resolve, coreType); } @@ -3805,6 +3849,9 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { case GMFGenPackage.GEN_DIAGRAM__PALETTE: setPalette((Palette)newValue); return; + case GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED: + setSynchronized(((Boolean)newValue).booleanValue()); + return; } super.eSet(featureID, newValue); } @@ -4020,6 +4067,9 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { case GMFGenPackage.GEN_DIAGRAM__PALETTE: setPalette((Palette)null); return; + case GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED: + setSynchronized(SYNCHRONIZED_EDEFAULT); + return; } super.eUnset(featureID); } @@ -4169,6 +4219,8 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { return compartments != null && !compartments.isEmpty(); case GMFGenPackage.GEN_DIAGRAM__PALETTE: return palette != null; + case GMFGenPackage.GEN_DIAGRAM__SYNCHRONIZED: + return synchronized_ != SYNCHRONIZED_EDEFAULT; } return super.eIsSet(featureID); } @@ -4831,6 +4883,8 @@ public class GenDiagramImpl extends GenCommonBaseImpl implements GenDiagram { result.append(validationDecorators); result.append(", units: "); result.append(units); + result.append(", synchronized: "); + result.append(synchronized_); result.append(')'); return result.toString(); } diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet index f39e1f353..9734ff222 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet @@ -2,9 +2,6 @@ imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.emf.codegen.ecore.genmodel.* java.util.* org.eclipse.gmf.common.codegen.*" skeleton="../common.skeleton"%> <% -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; final GenEditorGenerator editorGen = genDiagram.getEditorGen(); @@ -149,7 +146,7 @@ public class <%=genDiagram.getNewDiagramFileWizardClassName()%> extends Wizard { diagramResource.getContents().add(diagram.getElement()); <% } -if (!isSynchronizedDiagram) { +if (!genDiagram.isSynchronized()) { %> initDiagramContents(diagram, diagramModelObject); <%}%> @@ -188,7 +185,7 @@ if (!isSynchronizedDiagram) { } return null; } -<%if (!isSynchronizedDiagram) {%> +<%if (!genDiagram.isSynchronized()) {%> <%@ include file="../semanticSync.jetinc/initDiagramContents.jetinc"%> <%}%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet b/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet index 30794e279..82dceb3a1 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet @@ -42,9 +42,6 @@ public class <%=genDiagram.getEditPartFactoryClassName()%> implements EditPartFa public EditPart createEditPart(EditPart context, Object model) { if (model instanceof View) { View view = (View) model; - if (!<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(<%=visualIDRegistryClassName%>.getModelID(view))) { - return null; - } int viewVisualID = <%=visualIDRegistryClassName%>.getVisualID(view); switch (viewVisualID) { <% diff --git a/plugins/org.eclipse.gmf.codegen/templates/policies/ChildContainerCanonicalEditPolicy.javajet b/plugins/org.eclipse.gmf.codegen/templates/policies/ChildContainerCanonicalEditPolicy.javajet index ff093b2eb..535cef0ce 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/policies/ChildContainerCanonicalEditPolicy.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/policies/ChildContainerCanonicalEditPolicy.javajet @@ -2,9 +2,6 @@ imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*" skeleton="../common.skeleton"%> <% -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - GenChildContainer genContainer = (GenChildContainer) ((Object[]) argument)[0]; GenDiagram genDiagram = genContainer.getDiagram(); %> @@ -22,7 +19,7 @@ import org.eclipse.gmf.runtime.notation.View; public class <%=genContainer.getCanonicalEditPolicyClassName()%> extends CanonicalEditPolicy { <% -if (isSynchronizedDiagram) { +if (genDiagram.isSynchronized()) { List genNodes = genContainer.getChildNodes(); %> <%@ include file="../semanticSync.jetinc/getSemanticChildrenList.jetinc"%> @@ -42,7 +39,7 @@ if (isSynchronizedDiagram) { } <%}%> -<%if (genContainer instanceof GenNode && isSynchronizedDiagram) {%> +<%if (genContainer instanceof GenNode && genDiagram.isSynchronized()) {%> <%@ include file="../semanticSync.jetinc/refreshSemanticNode.jetinc"%> <%}%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/policies/DiagramCanonicalEditPolicy.javajet b/plugins/org.eclipse.gmf.codegen/templates/policies/DiagramCanonicalEditPolicy.javajet index 789dcbde8..a03ef017f 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/policies/DiagramCanonicalEditPolicy.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/policies/DiagramCanonicalEditPolicy.javajet @@ -2,9 +2,6 @@ imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*" skeleton="../common.skeleton"%> <% -// TODO: move this attribute to the genmodel -final boolean isSynchronizedDiagram = true; - GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; %> <%@ include file="../copyright4java.jetinc"%> @@ -26,7 +23,7 @@ public class <%=genDiagram.getCanonicalEditPolicyClassName()%> extends Canonical <% GenClass modelElementInterface = genDiagram.getDomainDiagramElement(); -if (modelElementInterface != null && isSynchronizedDiagram) { +if (modelElementInterface != null && genDiagram.isSynchronized()) { List genNodes = genDiagram.getTopLevelNodes(); %> <%@ include file="../semanticSync.jetinc/getSemanticChildrenList.jetinc"%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc index 8d64db47d..1de5b7a6c 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc +++ b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc @@ -4,12 +4,12 @@ */ protected void refreshSemantic() { super.refreshSemantic(); -<%if (isSynchronizedDiagram && genClass2Phantom.size() > 0) {%> +<%if (genDiagram.isSynchronized() && genClass2Phantom.size() > 0) {%> refreshPhantoms(); <%}%> refreshConnections(); } -<%if (isSynchronizedDiagram && genClass2Phantom.size() > 0) {%> +<%if (genDiagram.isSynchronized() && genClass2Phantom.size() > 0) {%> /** * @generated |