diff options
author | mfeldman | 2007-05-20 08:55:36 -0400 |
---|---|---|
committer | mfeldman | 2007-05-20 08:55:36 -0400 |
commit | 0c574d2e1ac1d528d3413721ee5282215d32bb71 (patch) | |
tree | d76ed8e1f630e4d5c9639f5b6f0a995b88bedf21 | |
parent | 676b8b37672a85016e7ace67877a71c8784e3419 (diff) | |
download | org.eclipse.gmf-tooling-0c574d2e1ac1d528d3413721ee5282215d32bb71.tar.gz org.eclipse.gmf-tooling-0c574d2e1ac1d528d3413721ee5282215d32bb71.tar.xz org.eclipse.gmf-tooling-0c574d2e1ac1d528d3413721ee5282215d32bb71.zip |
Anna Karyakina's migration fix
12 files changed, 2488 insertions, 2528 deletions
diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/InitDiagramFileActionGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/InitDiagramFileActionGenerator.java index 2849e6267..dfd005b01 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/InitDiagramFileActionGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/InitDiagramFileActionGenerator.java @@ -15,89 +15,88 @@ public class InitDiagramFileActionGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_5 = " "; - protected final String TEXT_6 = " extends "; - protected final String TEXT_7 = "implements "; - protected final String TEXT_8 = " {"; - protected final String TEXT_9 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_10 = " mySelectedModelFileURI;" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void selectionChanged("; - protected final String TEXT_11 = " action, "; - protected final String TEXT_12 = " selection) {" + NL + "\t\tsuper.selectionChanged(action, selection);" + NL + "\t\tmySelectedModelFileURI = null;" + NL + "\t\tif (selection instanceof "; - protected final String TEXT_13 = " == false || selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tObject firstElement = (("; - protected final String TEXT_14 = ") selection).getFirstElement();" + NL + "\t\tif (firstElement instanceof "; - protected final String TEXT_15 = ") {" + NL + "\t\t\tmySelectedModelFileURI = ("; - protected final String TEXT_16 = ") firstElement;" + NL + "\t\t} else if (firstElement instanceof "; - protected final String TEXT_17 = ") {" + NL + "\t\t\tmySelectedModelFileURI = ("; - protected final String TEXT_18 = ") (("; - protected final String TEXT_19 = ") firstElement).getAdapter("; - protected final String TEXT_20 = ".class);" + NL + "\t\t}" + NL + "\t\tif (mySelectedModelFileURI != null) {" + NL + "\t\t\tmySelectedModelFileURI = mySelectedModelFileURI.trimFragment();" + NL + "\t\t}" + NL + "\t\taction.setEnabled(true);" + NL + "\t}"; - protected final String TEXT_21 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_22 = " myPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_23 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_24 = " mySelection;" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void setActivePart("; - protected final String TEXT_25 = " action, "; - protected final String TEXT_26 = " targetPart) {" + NL + "\t\tmyPart = targetPart;" + NL + "\t}" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void selectionChanged("; - protected final String TEXT_27 = " action, "; - protected final String TEXT_28 = " selection) {" + NL + "\t\tmySelectedModelFile = null;" + NL + "\t\tmySelection = "; - protected final String TEXT_29 = ".EMPTY;" + NL + "\t\taction.setEnabled(false);" + NL + "\t\tif (selection instanceof "; - protected final String TEXT_30 = " == false || selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tmySelection = ("; - protected final String TEXT_31 = ") selection;" + NL + "\t\tmySelectedModelFile = ("; - protected final String TEXT_32 = ") (("; - protected final String TEXT_33 = ") selection).getFirstElement();" + NL + "\t\taction.setEnabled(true);" + NL + "\t}"; - protected final String TEXT_34 = NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void run("; - protected final String TEXT_35 = " action) {" + NL + "\t\t"; - protected final String TEXT_36 = " diagramRoot = null;" + NL + "\t\t"; - protected final String TEXT_37 = " editingDomain = "; - protected final String TEXT_38 = ".INSTANCE.createEditingDomain();"; - protected final String TEXT_39 = NL + "\t\tif (mySelectedModelFileURI != null) {"; - protected final String TEXT_40 = NL + "\t\t"; - protected final String TEXT_41 = " resourceSet = new "; - protected final String TEXT_42 = "();"; - protected final String TEXT_43 = NL + "\t\t"; - protected final String TEXT_44 = " resourceSet = editingDomain.getResourceSet();"; - protected final String TEXT_45 = NL + "\t\ttry {"; - protected final String TEXT_46 = NL + "\t\t\t"; - protected final String TEXT_47 = " resource = resourceSet.getResource(mySelectedModelFileURI, true);"; - protected final String TEXT_48 = NL + "\t\t\t"; - protected final String TEXT_49 = " resource = resourceSet.getResource("; - protected final String TEXT_50 = ".createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);"; - protected final String TEXT_51 = NL + "\t\t\tdiagramRoot = ("; - protected final String TEXT_52 = ") resource.getContents().get(0);" + NL + "\t\t} catch ("; - protected final String TEXT_53 = " ex) {"; - protected final String TEXT_54 = NL + "\t\t\t"; - protected final String TEXT_55 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFileURI.toString(), ex); //$NON-NLS-1$" + NL + "\t\t\t"; - protected final String TEXT_56 = ".openError(getWindow().getShell(), \"Error\", \"Model file loading failed\");"; - protected final String TEXT_57 = NL + "\t\t\t"; - protected final String TEXT_58 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex); //$NON-NLS-1$" + NL + "\t\t\t"; - protected final String TEXT_59 = ".openError(myPart.getSite().getShell(), \"Error\", \"Model file loading failed\");"; - protected final String TEXT_60 = NL + "\t\t\treturn;" + NL + "\t\t}"; - protected final String TEXT_61 = NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_62 = " wizard = new "; - protected final String TEXT_63 = "(mySelectedModelFileURI, diagramRoot, editingDomain);"; - protected final String TEXT_64 = NL + "\t\t"; - protected final String TEXT_65 = " wizard = new "; - protected final String TEXT_66 = "(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);"; - protected final String TEXT_67 = NL + " "; - protected final String TEXT_68 = " pluginDialogSettings = "; - protected final String TEXT_69 = ".getInstance().getDialogSettings();"; - protected final String TEXT_70 = NL + " "; - protected final String TEXT_71 = " initDiagramFileSettings = pluginDialogSettings.getSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " if (initDiagramFileSettings == null) {" + NL + " \tinitDiagramFileSettings = pluginDialogSettings.addNewSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " }" + NL + " wizard.setDialogSettings(initDiagramFileSettings);"; - protected final String TEXT_72 = NL + "\t\twizard.setForcePreviousAndNextButtons(mySelectedModelFileURI != null);"; - protected final String TEXT_73 = NL + "\t\twizard.setForcePreviousAndNextButtons(false);"; - protected final String TEXT_74 = NL + "\t\twizard.setWindowTitle(\"Initialize new \" + "; - protected final String TEXT_75 = ".MODEL_ID + \" diagram file\");" + NL; - protected final String TEXT_76 = NL + " "; - protected final String TEXT_77 = " dialog = new "; - protected final String TEXT_78 = "(getWindow().getShell(), wizard);"; - protected final String TEXT_79 = NL + " "; - protected final String TEXT_80 = " dialog = new "; - protected final String TEXT_81 = "(myPart.getSite().getShell(), wizard);"; - protected final String TEXT_82 = NL + " dialog.create();" + NL + " dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);" + NL + " dialog.open();" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_83 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_4 = " "; + protected final String TEXT_5 = " extends "; + protected final String TEXT_6 = "implements "; + protected final String TEXT_7 = " {"; + protected final String TEXT_8 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_9 = " mySelectedModelFileURI;" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void selectionChanged("; + protected final String TEXT_10 = " action, "; + protected final String TEXT_11 = " selection) {" + NL + "\t\tsuper.selectionChanged(action, selection);" + NL + "\t\tmySelectedModelFileURI = null;" + NL + "\t\tif (selection instanceof "; + protected final String TEXT_12 = " == false || selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tObject firstElement = (("; + protected final String TEXT_13 = ") selection).getFirstElement();" + NL + "\t\tif (firstElement instanceof "; + protected final String TEXT_14 = ") {" + NL + "\t\t\tmySelectedModelFileURI = ("; + protected final String TEXT_15 = ") firstElement;" + NL + "\t\t} else if (firstElement instanceof "; + protected final String TEXT_16 = ") {" + NL + "\t\t\tmySelectedModelFileURI = ("; + protected final String TEXT_17 = ") (("; + protected final String TEXT_18 = ") firstElement).getAdapter("; + protected final String TEXT_19 = ".class);" + NL + "\t\t}" + NL + "\t\tif (mySelectedModelFileURI != null) {" + NL + "\t\t\tmySelectedModelFileURI = mySelectedModelFileURI.trimFragment();" + NL + "\t\t}" + NL + "\t\taction.setEnabled(true);" + NL + "\t}"; + protected final String TEXT_20 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_21 = " myPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_22 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_23 = " mySelection;" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void setActivePart("; + protected final String TEXT_24 = " action, "; + protected final String TEXT_25 = " targetPart) {" + NL + "\t\tmyPart = targetPart;" + NL + "\t}" + NL + "" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void selectionChanged("; + protected final String TEXT_26 = " action, "; + protected final String TEXT_27 = " selection) {" + NL + "\t\tmySelectedModelFile = null;" + NL + "\t\tmySelection = "; + protected final String TEXT_28 = ".EMPTY;" + NL + "\t\taction.setEnabled(false);" + NL + "\t\tif (selection instanceof "; + protected final String TEXT_29 = " == false || selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tmySelection = ("; + protected final String TEXT_30 = ") selection;" + NL + "\t\tmySelectedModelFile = ("; + protected final String TEXT_31 = ") (("; + protected final String TEXT_32 = ") selection).getFirstElement();" + NL + "\t\taction.setEnabled(true);" + NL + "\t}"; + protected final String TEXT_33 = NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void run("; + protected final String TEXT_34 = " action) {" + NL + "\t\t"; + protected final String TEXT_35 = " diagramRoot = null;" + NL + "\t\t"; + protected final String TEXT_36 = " editingDomain = "; + protected final String TEXT_37 = ".INSTANCE.createEditingDomain();"; + protected final String TEXT_38 = NL + "\t\tif (mySelectedModelFileURI != null) {"; + protected final String TEXT_39 = NL + "\t\t"; + protected final String TEXT_40 = " resourceSet = new "; + protected final String TEXT_41 = "();"; + protected final String TEXT_42 = NL + "\t\t"; + protected final String TEXT_43 = " resourceSet = editingDomain.getResourceSet();"; + protected final String TEXT_44 = NL + "\t\ttry {"; + protected final String TEXT_45 = NL + "\t\t\t"; + protected final String TEXT_46 = " resource = resourceSet.getResource(mySelectedModelFileURI, true);"; + protected final String TEXT_47 = NL + "\t\t\t"; + protected final String TEXT_48 = " resource = resourceSet.getResource("; + protected final String TEXT_49 = ".createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);"; + protected final String TEXT_50 = NL + "\t\t\tdiagramRoot = ("; + protected final String TEXT_51 = ") resource.getContents().get(0);" + NL + "\t\t} catch ("; + protected final String TEXT_52 = " ex) {"; + protected final String TEXT_53 = NL + "\t\t\t"; + protected final String TEXT_54 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFileURI.toString(), ex); //$NON-NLS-1$" + NL + "\t\t\t"; + protected final String TEXT_55 = ".openError(getWindow().getShell(), \"Error\", \"Model file loading failed\");"; + protected final String TEXT_56 = NL + "\t\t\t"; + protected final String TEXT_57 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex); //$NON-NLS-1$" + NL + "\t\t\t"; + protected final String TEXT_58 = ".openError(myPart.getSite().getShell(), \"Error\", \"Model file loading failed\");"; + protected final String TEXT_59 = NL + "\t\t\treturn;" + NL + "\t\t}"; + protected final String TEXT_60 = NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_61 = " wizard = new "; + protected final String TEXT_62 = "(mySelectedModelFileURI, diagramRoot, editingDomain);"; + protected final String TEXT_63 = NL + "\t\t"; + protected final String TEXT_64 = " wizard = new "; + protected final String TEXT_65 = "(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);"; + protected final String TEXT_66 = NL + " "; + protected final String TEXT_67 = " pluginDialogSettings = "; + protected final String TEXT_68 = ".getInstance().getDialogSettings();"; + protected final String TEXT_69 = NL + " "; + protected final String TEXT_70 = " initDiagramFileSettings = pluginDialogSettings.getSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " if (initDiagramFileSettings == null) {" + NL + " \tinitDiagramFileSettings = pluginDialogSettings.addNewSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " }" + NL + " wizard.setDialogSettings(initDiagramFileSettings);"; + protected final String TEXT_71 = NL + "\t\twizard.setForcePreviousAndNextButtons(mySelectedModelFileURI != null);"; + protected final String TEXT_72 = NL + "\t\twizard.setForcePreviousAndNextButtons(false);"; + protected final String TEXT_73 = NL + "\t\twizard.setWindowTitle(\"Initialize new \" + "; + protected final String TEXT_74 = ".MODEL_ID + \" diagram file\");" + NL; + protected final String TEXT_75 = NL + " "; + protected final String TEXT_76 = " dialog = new "; + protected final String TEXT_77 = "(getWindow().getShell(), wizard);"; + protected final String TEXT_78 = NL + " "; + protected final String TEXT_79 = " dialog = new "; + protected final String TEXT_80 = "(myPart.getSite().getShell(), wizard);"; + protected final String TEXT_81 = NL + " dialog.create();" + NL + " dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);" + NL + " dialog.open();" + NL + "\t}" + NL + "" + NL + "}"; + protected final String TEXT_82 = NL; public String generate(Object argument) { @@ -109,219 +108,218 @@ final GenEditorGenerator editorGen = genDiagram.getEditorGen(); final String pluginActivatorClass = importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName()); final boolean isRichClientPlatform = genDiagram.getEditorGen().getApplication() != null; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); stringBuffer.append(genDiagram.getInitDiagramFileActionClassName()); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); if (isRichClientPlatform) { - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")); } else { - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IObjectActionDelegate")); } - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); if (isRichClientPlatform) { - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ISelection")); + stringBuffer.append(TEXT_11); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_13); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_15); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); } else { - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPart")); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPart")); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ISelection")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")); + stringBuffer.append(TEXT_28); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_29); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_30); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); } - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.WorkspaceEditingDomainFactory")); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_37); if (isRichClientPlatform) { - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_38); } if (editorGen.isSameFileForDiagramAndModel()) { - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_39); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_41); } else { - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); } - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); if (isRichClientPlatform) { - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); } else { - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_49); } - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.WrappedException")); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); if (isRichClientPlatform) { - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_55); } else { - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_56); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_57); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); } - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_59); if (isRichClientPlatform) { - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_60); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.Wizard")); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName(genDiagram.getNewDiagramFileWizardQualifiedClassName())); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); } else { - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.Wizard")); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(importManager.getImportedName(genDiagram.getNewDiagramFileWizardQualifiedClassName())); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); } - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.IDialogSettings")); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); stringBuffer.append(pluginActivatorClass); + stringBuffer.append(TEXT_68); stringBuffer.append(TEXT_69); - stringBuffer.append(TEXT_70); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.IDialogSettings")); - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); if (isRichClientPlatform) { - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); } else { - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); } - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); if (isRichClientPlatform) { + stringBuffer.append(TEXT_75); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); stringBuffer.append(TEXT_76); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); stringBuffer.append(TEXT_77); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); - stringBuffer.append(TEXT_78); } else { + stringBuffer.append(TEXT_78); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); stringBuffer.append(TEXT_79); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); stringBuffer.append(TEXT_80); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); - stringBuffer.append(TEXT_81); } - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_81); importManager.emitSortedImports(); - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_82); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/NewDiagramFileWizardGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/NewDiagramFileWizardGenerator.java index 23a49f9c4..dd634a8da 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/NewDiagramFileWizardGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/NewDiagramFileWizardGenerator.java @@ -16,238 +16,237 @@ public class NewDiagramFileWizardGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_5 = " extends "; - protected final String TEXT_6 = " {" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_7 = " myEditingDomain;" + NL + "\t\t"; - protected final String TEXT_8 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_9 = " mySelectedModelFileURI;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate DiagramURISelectorPage myDiagramURISelectorPage;" + NL; - protected final String TEXT_10 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_11 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_12 = " myFileCreationPage;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_13 = " myWorkbenchPage;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_14 = " mySelection;" + NL; - protected final String TEXT_15 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_16 = " myDiagramRoot;" + NL; - protected final String TEXT_17 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_18 = "("; - protected final String TEXT_19 = " selectedModelFileURI, "; - protected final String TEXT_20 = " diagramRoot, "; - protected final String TEXT_21 = " editingDomain) {"; - protected final String TEXT_22 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_23 = "("; - protected final String TEXT_24 = " selectedModelFile, "; - protected final String TEXT_25 = " workbenchPage, "; - protected final String TEXT_26 = " selection, "; - protected final String TEXT_27 = " diagramRoot, "; - protected final String TEXT_28 = " editingDomain) {" + NL + "\t\tassert selectedModelFile != null : \"Null selectedModelFile in "; - protected final String TEXT_29 = " constructor\"; //$NON-NLS-1$" + NL + "\t\tassert workbenchPage != null : \"Null workbenchPage in "; - protected final String TEXT_30 = " constructor\"; //$NON-NLS-1$" + NL + "\t\tassert selection != null : \"Null selection in "; - protected final String TEXT_31 = " constructor\"; //$NON-NLS-1$" + NL + "\t assert diagramRoot != null : \"Null diagramRoot in "; - protected final String TEXT_32 = " constructor\"; //$NON-NLS-1$"; - protected final String TEXT_33 = NL + "\t assert editingDomain != null : \"Null editingDomain in "; - protected final String TEXT_34 = " constructor\"; //$NON-NLS-1$" + NL + "\t "; - protected final String TEXT_35 = NL + "\t \tmySelectedModelFileURI = selectedModelFileURI;"; - protected final String TEXT_36 = NL + "\t \tmySelectedModelFile = selectedModelFile;" + NL + "\t \tmyWorkbenchPage = workbenchPage;" + NL + "\t \tmySelection = selection;"; - protected final String TEXT_37 = NL + "\t \tmyDiagramRoot = diagramRoot;" + NL + "\t \tmyEditingDomain = editingDomain;" + NL + "\t\tsetDefaultPageImageDescriptor("; - protected final String TEXT_38 = ".getBundledImageDescriptor(" + NL + "\t\t\t\"icons/wizban/New"; - protected final String TEXT_39 = "Wizard.gif\")); //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {"; - protected final String TEXT_40 = NL + "\t\tif (mySelectedModelFileURI == null) {" + NL + "\t\t\taddPage(new SourceURISelectorPage());" + NL + "\t\t}" + NL + "\t\tmyDiagramURISelectorPage = new DiagramURISelectorPage();" + NL + "\t\taddPage(myDiagramURISelectorPage);"; - protected final String TEXT_41 = NL + "\t\tmyFileCreationPage = new "; - protected final String TEXT_42 = "(\"Initialize new "; - protected final String TEXT_43 = " diagram file\", mySelection) {" + NL + "\t\t\tpublic void createControl("; - protected final String TEXT_44 = " parent) {" + NL + "\t\t\t\tsuper.createControl(parent);" + NL + "\t\t\t\t" + NL + "\t\t\t\t"; - protected final String TEXT_45 = " parentContainer = mySelectedModelFile.getParent();" + NL + "\t\t\t\tString originalFileName = mySelectedModelFile.getProjectRelativePath().removeFileExtension().lastSegment();" + NL + "\t\t\t\tString fileExtension = \"."; - protected final String TEXT_46 = "\"; //$NON-NLS-1$" + NL + "\t\t\t\tString fileName = originalFileName + fileExtension;" + NL + "\t\t\t\tfor (int i = 1; i > 0 && parentContainer.getFile(new "; - protected final String TEXT_47 = "(fileName)).exists(); i++) {" + NL + "\t\t\t\t\tfileName = originalFileName + i + fileExtension;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (parentContainer.getFile(new "; - protected final String TEXT_48 = "(fileName)).exists()) {" + NL + "\t\t\t\t\treturn;\t//failed to set name that does not exist, just leave empty." + NL + "\t\t\t\t}" + NL + "\t\t\t\tsetFileName(fileName);" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tmyFileCreationPage.setTitle(\"Diagram file\");" + NL + "\t\tmyFileCreationPage.setDescription(\"Create new diagram based on "; - protected final String TEXT_49 = " model content\");" + NL + "\t\taddPage(myFileCreationPage);"; - protected final String TEXT_50 = NL + "\t\taddPage(new RootElementSelectorPage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\t"; - protected final String TEXT_51 = " resourceSet = myEditingDomain.getResourceSet();"; - protected final String TEXT_52 = NL + "\t\t"; - protected final String TEXT_53 = " diagramFileURI = myDiagramURISelectorPage.getNewFileURI();"; - protected final String TEXT_54 = NL + "\t\t"; - protected final String TEXT_55 = " diagramFile = myFileCreationPage.createNewFile();" + NL + "\t\t"; - protected final String TEXT_56 = ".setCharset(diagramFile);" + NL + "\t\t"; - protected final String TEXT_57 = " diagramFileURI = "; - protected final String TEXT_58 = ".createPlatformResourceURI(diagramFile.getFullPath().toString(), true);"; - protected final String TEXT_59 = NL + "\t\tfinal "; - protected final String TEXT_60 = " diagramResource = resourceSet.createResource(diagramFileURI);" + NL + "\t\t"; - protected final String TEXT_61 = " command = new "; - protected final String TEXT_62 = "(\"Initializing diagram contents\") { //$NON-NLS-1$" + NL + "\t\t\tprivate "; - protected final String TEXT_63 = " myCreatedDiagram;" + NL + "" + NL + "\t\t\tprotected boolean prepare() {" + NL + "\t\t\t\tint diagramVID = "; - protected final String TEXT_64 = ".INSTANCE.getDiagramVisualID(myDiagramRoot);" + NL + "\t\t\t\tif (diagramVID != "; - protected final String TEXT_65 = ".VISUAL_ID) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tpublic void execute() {" + NL + "\t\t\t\tmyCreatedDiagram = "; - protected final String TEXT_66 = ".createDiagramFor(myDiagramRoot);" + NL + "\t\t\t\tassert myCreatedDiagram != null;" + NL + "\t\t\t\tdiagramResource.getContents().add(myCreatedDiagram);"; - protected final String TEXT_67 = NL + "\t\t\t\tdiagramResource.getContents().add(myCreatedDiagram.getElement());"; - protected final String TEXT_68 = NL + "\t\t\t}" + NL + "\t\t\tpublic void redo() {" + NL + "\t\t\t\texecute();" + NL + "\t\t\t}" + NL + "\t\t\tpublic boolean canUndo() {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\ttry {" + NL + "\t\t\tnew "; - protected final String TEXT_69 = "(myEditingDomain, command).execute();" + NL + "\t\t\tdiagramResource.save("; - protected final String TEXT_70 = ".getSaveOptions());"; - protected final String TEXT_71 = NL + "\t\t\t"; - protected final String TEXT_72 = " editor = "; - protected final String TEXT_73 = ".showView(diagramFileURI);"; - protected final String TEXT_74 = NL + "\t\t\t"; - protected final String TEXT_75 = " editor = "; - protected final String TEXT_76 = ".openEditor(diagramFileURI);"; - protected final String TEXT_77 = NL + "\t\t\t"; - protected final String TEXT_78 = " editor = "; - protected final String TEXT_79 = ".openEditor(myWorkbenchPage, diagramFile);"; - protected final String TEXT_80 = NL + "\t\t\tif (editor != null) {" + NL + "\t\t\t\t"; - protected final String TEXT_81 = " layouter = ("; - protected final String TEXT_82 = ") editor.getAdapter("; - protected final String TEXT_83 = ".class);" + NL + "\t\t\t\tif (layouter != null) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_84 = " graphicalViewer = ("; - protected final String TEXT_85 = ") editor.getAdapter("; - protected final String TEXT_86 = ".class);" + NL + "\t\t\t\t\tif (graphicalViewer != null) {" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_87 = " layoutCommand = layouter.layout(("; - protected final String TEXT_88 = ") graphicalViewer.getContents());" + NL + "\t\t\t\t\t\tif (layoutCommand != null && layoutCommand.canExecute()) {" + NL + "\t\t\t\t\t\t\tgraphicalViewer.getEditDomain().getCommandStack().execute(new "; - protected final String TEXT_89 = "(myEditingDomain, layoutCommand));"; - protected final String TEXT_90 = NL + "\t\t\t\t\t\t\tdiagramResource.save("; - protected final String TEXT_91 = ".getSaveOptions());"; - protected final String TEXT_92 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t} catch ("; - protected final String TEXT_93 = " ex) {"; - protected final String TEXT_94 = NL + "\t\t\t"; - protected final String TEXT_95 = ".getInstance().logError(\"Save operation failed for: \" + diagramFileURI.toString(), ex); //$NON-NLS-1$"; - protected final String TEXT_96 = NL + "\t\t\t"; - protected final String TEXT_97 = ".getInstance().logError(\"Save operation failed for: \" + diagramFile.getFullPath().toString(), ex); //$NON-NLS-1$"; - protected final String TEXT_98 = NL + "\t\t} catch ("; - protected final String TEXT_99 = " ex) {" + NL + "\t\t\t"; - protected final String TEXT_100 = ".getInstance().logError(\"Unable to open editor\", ex); //$NON-NLS-1$"; - protected final String TEXT_101 = NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}" + NL; - protected final String TEXT_102 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate abstract class URISelectorPage extends "; - protected final String TEXT_103 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_104 = " fileField;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected URISelectorPage(String name) {" + NL + "\t\t\tsuper(name);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createControl("; - protected final String TEXT_105 = " parent) {" + NL + "\t\t\t"; - protected final String TEXT_106 = " composite = new "; - protected final String TEXT_107 = "(parent, "; - protected final String TEXT_108 = ".NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; - protected final String TEXT_109 = " layout = new "; - protected final String TEXT_110 = "();" + NL + "\t\t\t\tlayout.numColumns = 1;" + NL + "\t\t\t\tlayout.verticalSpacing = 12;" + NL + "\t\t\t\tcomposite.setLayout(layout);" + NL + "" + NL + "\t\t\t\t"; - protected final String TEXT_111 = " data = new "; - protected final String TEXT_112 = "();" + NL + "\t\t\t\tdata.verticalAlignment = "; - protected final String TEXT_113 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessVerticalSpace = true;" + NL + "\t\t\t\tdata.horizontalAlignment = "; - protected final String TEXT_114 = ".FILL;" + NL + "\t\t\t\tcomposite.setLayoutData(data);" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_115 = " resourceURILabel = new "; - protected final String TEXT_116 = "(composite, "; - protected final String TEXT_117 = ".LEFT);" + NL + "\t\t\t{" + NL + "\t\t\t\tresourceURILabel.setText(\"&File\");" + NL + "" + NL + "\t\t\t\t"; - protected final String TEXT_118 = " data = new "; - protected final String TEXT_119 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; - protected final String TEXT_120 = ".FILL;" + NL + "\t\t\t\tresourceURILabel.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t"; - protected final String TEXT_121 = " fileComposite = new "; - protected final String TEXT_122 = "(composite, "; - protected final String TEXT_123 = ".NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; - protected final String TEXT_124 = " data = new "; - protected final String TEXT_125 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; - protected final String TEXT_126 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tfileComposite.setLayoutData(data);" + NL + "" + NL + "\t\t\t\t"; - protected final String TEXT_127 = " layout = new "; - protected final String TEXT_128 = "();" + NL + "\t\t\t\tlayout.marginHeight = 0;" + NL + "\t\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\t\tlayout.numColumns = 2;" + NL + "\t\t\t\tfileComposite.setLayout(layout);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField = new "; - protected final String TEXT_129 = "(fileComposite, "; - protected final String TEXT_130 = ".BORDER);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; - protected final String TEXT_131 = " data = new "; - protected final String TEXT_132 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; - protected final String TEXT_133 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tdata.horizontalSpan = 1;" + NL + "\t\t\t\tfileField.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField.addModifyListener(validator);" + NL + "\t\t\t"; - protected final String TEXT_134 = " resourceURIBrowseFileSystemButton = new "; - protected final String TEXT_135 = "(fileComposite," + NL + "\t\t\t\t\t"; - protected final String TEXT_136 = ".PUSH);" + NL + "\t\t\tresourceURIBrowseFileSystemButton.setText(\"&Browse\");" + NL + "" + NL + "\t\t\tresourceURIBrowseFileSystemButton" + NL + "\t\t\t\t\t.addSelectionListener(new "; - protected final String TEXT_137 = "() {" + NL + "\t\t\t\t\t\tpublic void widgetSelected("; - protected final String TEXT_138 = " event) {" + NL + "\t\t\t\t\t\t\tString fileExtension = getFileExtension();" + NL + "\t\t\t\t\t\t\tString filePath = "; - protected final String TEXT_139 = ".openFilePathDialog(getShell(), \"*.\" + fileExtension, "; - protected final String TEXT_140 = ".OPEN);" + NL + "\t\t\t\t\t\t\tif (filePath != null) {" + NL + "\t\t\t\t\t\t\t\tif (!filePath.endsWith(\".\" + fileExtension)) {" + NL + "\t\t\t\t\t\t\t\t\tfilePath = filePath + \".\" + fileExtension;" + NL + "\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\tfileField.setText(filePath);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t});" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\tsetControl(composite);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; - protected final String TEXT_141 = " validator = new "; - protected final String TEXT_142 = "() {" + NL + "\t\t\tpublic void modifyText("; - protected final String TEXT_143 = " e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected final void setFile("; - protected final String TEXT_144 = " file) {" + NL + "\t\t\tfileField.setText(file.getPath());" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\t"; - protected final String TEXT_145 = " fileURI = getFileURI();" + NL + "\t\t\tif (fileURI == null || fileURI.isEmpty()) {" + NL + "\t\t\t\tsetErrorMessage(null);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tif (fileURI.isFile()) {" + NL + "\t\t\t\t"; - protected final String TEXT_146 = " file = new "; - protected final String TEXT_147 = "(fileURI.toFileString());" + NL + "\t\t\t\tString fileProblem = validateFile(file);" + NL + "\t\t\t\tif (fileProblem != null) {" + NL + "\t\t\t\t\tsetErrorMessage(fileProblem);" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tString requiredExt = getFileExtension();" + NL + "\t\t\tString enteredExt = fileURI.fileExtension();" + NL + "\t\t\tif (enteredExt == null || !enteredExt.equals(requiredExt)) {" + NL + "\t\t\t\tsetErrorMessage(\"The file name must end in \" + requiredExt);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tsetErrorMessage(null);" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Checks the given file and returns the error message if there are problems or <code>null</code> if the file is OK." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract String validateFile("; - protected final String TEXT_148 = " file);" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract String getFileExtension();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; - protected final String TEXT_149 = " getFileURI() {" + NL + "\t\t\ttry {" + NL + "\t\t\t\treturn "; - protected final String TEXT_150 = ".createFileURI(fileField.getText());" + NL + "\t\t\t} catch (Exception exception) {" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class SourceURISelectorPage extends URISelectorPage {" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic SourceURISelectorPage() {" + NL + "\t\t\tsuper(\"Select source file\");" + NL + "\t\t\tsetTitle(\"Source file\");" + NL + "\t\t\tsetDescription(\"Select file with semantic model element to be depicted on diagram\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getFileExtension() {" + NL + "\t\t\treturn \""; - protected final String TEXT_151 = "\";" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\tif (super.validatePage()) {" + NL + "\t\t\t\tmySelectedModelFileURI = getFileURI();" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String validateFile("; - protected final String TEXT_152 = " file) {" + NL + "\t\t\tif (!file.exists()) {" + NL + "\t\t\t\treturn \"Source file does not exist\";" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class DiagramURISelectorPage extends URISelectorPage {" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_153 = " myNewFileURI;" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DiagramURISelectorPage() {" + NL + "\t\t\tsuper(\"Initialize new "; - protected final String TEXT_154 = " diagram file\");" + NL + "\t\t\tsetTitle(\"Diagram file\");" + NL + "\t\t\tsetDescription(\"Create new diagram based on "; - protected final String TEXT_155 = " model content\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getFileExtension() {" + NL + "\t\t\treturn \""; - protected final String TEXT_156 = "\";" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setVisible(boolean visible) {" + NL + "\t\t\tsuper.setVisible(visible);" + NL + "\t\t\tif (visible && mySelectedModelFileURI != null && getFileURI() == null && mySelectedModelFileURI.isFile()) {" + NL + "\t\t\t\t"; - protected final String TEXT_157 = " originalFile = new "; - protected final String TEXT_158 = "(mySelectedModelFileURI.toFileString());" + NL + "\t\t\t\tString originalFileName = mySelectedModelFileURI.trimFileExtension().lastSegment();" + NL + "\t\t\t\t"; - protected final String TEXT_159 = " parentFile = originalFile.getParentFile();" + NL + "\t\t\t\t"; - protected final String TEXT_160 = " newFile = new "; - protected final String TEXT_161 = "(parentFile, originalFileName + getFileExtension());" + NL + "\t\t\t\tfor(int i = 1; i > 0 && newFile.exists(); i++) {" + NL + "\t\t\t\t\tnewFile = new "; - protected final String TEXT_162 = "(parentFile, originalFileName + i + getFileExtension());" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (newFile.exists()) {" + NL + "\t\t\t\t\treturn;\t//failed to set name that does not exist, just leave empty." + NL + "\t\t\t\t}" + NL + "\t\t\t\tsetFile(newFile);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\tmyNewFileURI = null;" + NL + "\t\t\tif (super.validatePage()) {" + NL + "\t\t\t\tmyNewFileURI = getFileURI();" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; - protected final String TEXT_163 = " getNewFileURI() {" + NL + "\t\t\treturn myNewFileURI;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String validateFile("; - protected final String TEXT_164 = " file) {" + NL + "\t\t\tif (file.exists()) {" + NL + "\t\t\t\treturn \"Diagram file already exists\";" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}"; - protected final String TEXT_165 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class RootElementSelectorPage extends "; - protected final String TEXT_166 = " implements "; - protected final String TEXT_167 = " {"; - protected final String TEXT_168 = NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_169 = " myTreeViewer;"; - protected final String TEXT_170 = NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */" + NL + "\t\tprotected RootElementSelectorPage() {" + NL + "\t\t\tsuper(\"Select diagram root element\");" + NL + "\t\t\tsetTitle(\"Diagram root element\");" + NL + "\t\t\tsetDescription(\"Select semantic model element to be depicted on diagram\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic void createControl("; - protected final String TEXT_171 = " parent) {" + NL + "\t\t\tinitializeDialogUnits(parent);" + NL + "\t\t\t"; - protected final String TEXT_172 = " topLevel = new "; - protected final String TEXT_173 = "(parent, "; - protected final String TEXT_174 = ".NONE);" + NL + "\t\t\ttopLevel.setLayout(new "; - protected final String TEXT_175 = "());" + NL + "\t\t\ttopLevel.setLayoutData(new "; - protected final String TEXT_176 = "("; - protected final String TEXT_177 = ".VERTICAL_ALIGN_FILL | "; - protected final String TEXT_178 = ".HORIZONTAL_ALIGN_FILL));" + NL + "\t\t\ttopLevel.setFont(parent.getFont());" + NL + "\t\t\tsetControl(topLevel);" + NL + "\t\t\tcreateModelBrowser(topLevel);" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void createModelBrowser("; - protected final String TEXT_179 = " parent) {" + NL + "\t\t\t"; - protected final String TEXT_180 = " panel = new "; - protected final String TEXT_181 = "(parent, "; - protected final String TEXT_182 = ".NONE);" + NL + "\t\t\tpanel.setLayoutData(new "; - protected final String TEXT_183 = "("; - protected final String TEXT_184 = ".FILL_BOTH));" + NL + "\t\t\t"; - protected final String TEXT_185 = " layout = new "; - protected final String TEXT_186 = "();" + NL + "\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\tpanel.setLayout(layout);" + NL + "\t\t\t" + NL + "\t\t\t"; - protected final String TEXT_187 = " label = new "; - protected final String TEXT_188 = "(panel, "; - protected final String TEXT_189 = ".NONE);" + NL + "\t\t\tlabel.setText(\"Select diagram root element:\");" + NL + "\t\t\tlabel.setLayoutData(new "; - protected final String TEXT_190 = "("; - protected final String TEXT_191 = ".HORIZONTAL_ALIGN_BEGINNING));"; - protected final String TEXT_192 = NL + "\t\t\t"; - protected final String TEXT_193 = " "; - protected final String TEXT_194 = " = new "; - protected final String TEXT_195 = "(panel, "; - protected final String TEXT_196 = ".SINGLE | "; - protected final String TEXT_197 = ".H_SCROLL | "; - protected final String TEXT_198 = ".V_SCROLL | "; - protected final String TEXT_199 = ".BORDER);" + NL + "\t\t\t"; - protected final String TEXT_200 = " layoutData = new "; - protected final String TEXT_201 = "("; - protected final String TEXT_202 = ".FILL_BOTH);" + NL + "\t\t\tlayoutData.heightHint = 300;" + NL + "\t\t\tlayoutData.widthHint = 300;" + NL + "\t\t\t"; - protected final String TEXT_203 = ".getTree().setLayoutData(layoutData);" + NL + "\t\t\t"; - protected final String TEXT_204 = ".setContentProvider(new "; - protected final String TEXT_205 = "("; - protected final String TEXT_206 = ".getInstance().getItemProvidersAdapterFactory()));" + NL + "\t\t\t"; - protected final String TEXT_207 = ".setLabelProvider(new "; - protected final String TEXT_208 = "("; - protected final String TEXT_209 = ".getInstance().getItemProvidersAdapterFactory()));"; - protected final String TEXT_210 = NL + "\t\t\t"; - protected final String TEXT_211 = ".setInput(myDiagramRoot.eResource());" + NL + "\t\t\t"; - protected final String TEXT_212 = ".setSelection(new "; - protected final String TEXT_213 = "(myDiagramRoot));"; - protected final String TEXT_214 = NL + "\t\t\t"; - protected final String TEXT_215 = ".addSelectionChangedListener(this);" + NL + "\t\t}" + NL; - protected final String TEXT_216 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setVisible(boolean visible) {" + NL + "\t\t\tif (visible) {" + NL + "\t\t\t\t"; - protected final String TEXT_217 = ".setInput(myEditingDomain.getResourceSet().getResource(mySelectedModelFileURI, true));" + NL + "\t\t\t\tif (myDiagramRoot != null) {" + NL + "\t\t\t\t\tmyTreeViewer.setSelection(new "; - protected final String TEXT_218 = "(myDiagramRoot));" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsuper.setVisible(visible);" + NL + "\t\t}" + NL; - protected final String TEXT_219 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectionChanged("; - protected final String TEXT_220 = " event) {" + NL + "\t\t\tmyDiagramRoot = null;" + NL + "\t\t\tif (event.getSelection() instanceof "; - protected final String TEXT_221 = ") {" + NL + "\t\t\t\t"; - protected final String TEXT_222 = " selection = ("; - protected final String TEXT_223 = ") event.getSelection();" + NL + "\t\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\t\tif (selectedElement instanceof "; - protected final String TEXT_224 = ") {" + NL + "\t\t\t\t\t\tselectedElement = (("; - protected final String TEXT_225 = ") selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof "; - protected final String TEXT_226 = ".Entry) {" + NL + "\t\t\t\t\t\tselectedElement = (("; - protected final String TEXT_227 = ".Entry) selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof "; - protected final String TEXT_228 = ") {" + NL + "\t\t\t\t\t\tmyDiagramRoot = ("; - protected final String TEXT_229 = ") selectedElement;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate boolean validatePage() {" + NL + "\t\t\tif (myDiagramRoot == null) {" + NL + "\t\t\t\tsetErrorMessage(\"No diagram root element selected\");" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tboolean result = "; - protected final String TEXT_230 = ".VISUAL_ID == "; - protected final String TEXT_231 = ".INSTANCE.getDiagramVisualID(myDiagramRoot);" + NL + "\t\t\tsetErrorMessage(result ? null : \"Invalid diagram root element was selected\");" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}" + NL + "}"; - protected final String TEXT_232 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_4 = " extends "; + protected final String TEXT_5 = " {" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_6 = " myEditingDomain;" + NL + "\t\t"; + protected final String TEXT_7 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_8 = " mySelectedModelFileURI;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate DiagramURISelectorPage myDiagramURISelectorPage;" + NL; + protected final String TEXT_9 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_10 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_11 = " myFileCreationPage;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_12 = " myWorkbenchPage;" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_13 = " mySelection;" + NL; + protected final String TEXT_14 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_15 = " myDiagramRoot;" + NL; + protected final String TEXT_16 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_17 = "("; + protected final String TEXT_18 = " selectedModelFileURI, "; + protected final String TEXT_19 = " diagramRoot, "; + protected final String TEXT_20 = " editingDomain) {"; + protected final String TEXT_21 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_22 = "("; + protected final String TEXT_23 = " selectedModelFile, "; + protected final String TEXT_24 = " workbenchPage, "; + protected final String TEXT_25 = " selection, "; + protected final String TEXT_26 = " diagramRoot, "; + protected final String TEXT_27 = " editingDomain) {" + NL + "\t\tassert selectedModelFile != null : \"Null selectedModelFile in "; + protected final String TEXT_28 = " constructor\"; //$NON-NLS-1$" + NL + "\t\tassert workbenchPage != null : \"Null workbenchPage in "; + protected final String TEXT_29 = " constructor\"; //$NON-NLS-1$" + NL + "\t\tassert selection != null : \"Null selection in "; + protected final String TEXT_30 = " constructor\"; //$NON-NLS-1$" + NL + "\t assert diagramRoot != null : \"Null diagramRoot in "; + protected final String TEXT_31 = " constructor\"; //$NON-NLS-1$"; + protected final String TEXT_32 = NL + "\t assert editingDomain != null : \"Null editingDomain in "; + protected final String TEXT_33 = " constructor\"; //$NON-NLS-1$" + NL + "\t "; + protected final String TEXT_34 = NL + "\t \tmySelectedModelFileURI = selectedModelFileURI;"; + protected final String TEXT_35 = NL + "\t \tmySelectedModelFile = selectedModelFile;" + NL + "\t \tmyWorkbenchPage = workbenchPage;" + NL + "\t \tmySelection = selection;"; + protected final String TEXT_36 = NL + "\t \tmyDiagramRoot = diagramRoot;" + NL + "\t \tmyEditingDomain = editingDomain;" + NL + "\t\tsetDefaultPageImageDescriptor("; + protected final String TEXT_37 = ".getBundledImageDescriptor(" + NL + "\t\t\t\"icons/wizban/New"; + protected final String TEXT_38 = "Wizard.gif\")); //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {"; + protected final String TEXT_39 = NL + "\t\tif (mySelectedModelFileURI == null) {" + NL + "\t\t\taddPage(new SourceURISelectorPage());" + NL + "\t\t}" + NL + "\t\tmyDiagramURISelectorPage = new DiagramURISelectorPage();" + NL + "\t\taddPage(myDiagramURISelectorPage);"; + protected final String TEXT_40 = NL + "\t\tmyFileCreationPage = new "; + protected final String TEXT_41 = "(\"Initialize new "; + protected final String TEXT_42 = " diagram file\", mySelection) {" + NL + "\t\t\tpublic void createControl("; + protected final String TEXT_43 = " parent) {" + NL + "\t\t\t\tsuper.createControl(parent);" + NL + "\t\t\t\t" + NL + "\t\t\t\t"; + protected final String TEXT_44 = " parentContainer = mySelectedModelFile.getParent();" + NL + "\t\t\t\tString originalFileName = mySelectedModelFile.getProjectRelativePath().removeFileExtension().lastSegment();" + NL + "\t\t\t\tString fileExtension = \"."; + protected final String TEXT_45 = "\"; //$NON-NLS-1$" + NL + "\t\t\t\tString fileName = originalFileName + fileExtension;" + NL + "\t\t\t\tfor (int i = 1; i > 0 && parentContainer.getFile(new "; + protected final String TEXT_46 = "(fileName)).exists(); i++) {" + NL + "\t\t\t\t\tfileName = originalFileName + i + fileExtension;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (parentContainer.getFile(new "; + protected final String TEXT_47 = "(fileName)).exists()) {" + NL + "\t\t\t\t\treturn;\t//failed to set name that does not exist, just leave empty." + NL + "\t\t\t\t}" + NL + "\t\t\t\tsetFileName(fileName);" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tmyFileCreationPage.setTitle(\"Diagram file\");" + NL + "\t\tmyFileCreationPage.setDescription(\"Create new diagram based on "; + protected final String TEXT_48 = " model content\");" + NL + "\t\taddPage(myFileCreationPage);"; + protected final String TEXT_49 = NL + "\t\taddPage(new RootElementSelectorPage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\t"; + protected final String TEXT_50 = " resourceSet = myEditingDomain.getResourceSet();"; + protected final String TEXT_51 = NL + "\t\t"; + protected final String TEXT_52 = " diagramFileURI = myDiagramURISelectorPage.getNewFileURI();"; + protected final String TEXT_53 = NL + "\t\t"; + protected final String TEXT_54 = " diagramFile = myFileCreationPage.createNewFile();" + NL + "\t\t"; + protected final String TEXT_55 = ".setCharset(diagramFile);" + NL + "\t\t"; + protected final String TEXT_56 = " diagramFileURI = "; + protected final String TEXT_57 = ".createPlatformResourceURI(diagramFile.getFullPath().toString(), true);"; + protected final String TEXT_58 = NL + "\t\tfinal "; + protected final String TEXT_59 = " diagramResource = resourceSet.createResource(diagramFileURI);" + NL + "\t\t"; + protected final String TEXT_60 = " command = new "; + protected final String TEXT_61 = "(\"Initializing diagram contents\") { //$NON-NLS-1$" + NL + "\t\t\tprivate "; + protected final String TEXT_62 = " myCreatedDiagram;" + NL + "" + NL + "\t\t\tprotected boolean prepare() {" + NL + "\t\t\t\tint diagramVID = "; + protected final String TEXT_63 = ".INSTANCE.getDiagramVisualID(myDiagramRoot);" + NL + "\t\t\t\tif (diagramVID != "; + protected final String TEXT_64 = ".VISUAL_ID) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tpublic void execute() {" + NL + "\t\t\t\tmyCreatedDiagram = "; + protected final String TEXT_65 = ".createDiagramFor(myDiagramRoot);" + NL + "\t\t\t\tassert myCreatedDiagram != null;" + NL + "\t\t\t\tdiagramResource.getContents().add(myCreatedDiagram);"; + protected final String TEXT_66 = NL + "\t\t\t\tdiagramResource.getContents().add(myCreatedDiagram.getElement());"; + protected final String TEXT_67 = NL + "\t\t\t}" + NL + "\t\t\tpublic void redo() {" + NL + "\t\t\t\texecute();" + NL + "\t\t\t}" + NL + "\t\t\tpublic boolean canUndo() {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\ttry {" + NL + "\t\t\tnew "; + protected final String TEXT_68 = "(myEditingDomain, command).execute();" + NL + "\t\t\tdiagramResource.save("; + protected final String TEXT_69 = ".getSaveOptions());"; + protected final String TEXT_70 = NL + "\t\t\t"; + protected final String TEXT_71 = " editor = "; + protected final String TEXT_72 = ".showView(diagramFileURI);"; + protected final String TEXT_73 = NL + "\t\t\t"; + protected final String TEXT_74 = " editor = "; + protected final String TEXT_75 = ".openEditor(diagramFileURI);"; + protected final String TEXT_76 = NL + "\t\t\t"; + protected final String TEXT_77 = " editor = "; + protected final String TEXT_78 = ".openEditor(myWorkbenchPage, diagramFile);"; + protected final String TEXT_79 = NL + "\t\t\tif (editor != null) {" + NL + "\t\t\t\t"; + protected final String TEXT_80 = " layouter = ("; + protected final String TEXT_81 = ") editor.getAdapter("; + protected final String TEXT_82 = ".class);" + NL + "\t\t\t\tif (layouter != null) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_83 = " graphicalViewer = ("; + protected final String TEXT_84 = ") editor.getAdapter("; + protected final String TEXT_85 = ".class);" + NL + "\t\t\t\t\tif (graphicalViewer != null) {" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_86 = " layoutCommand = layouter.layout(("; + protected final String TEXT_87 = ") graphicalViewer.getContents());" + NL + "\t\t\t\t\t\tif (layoutCommand != null && layoutCommand.canExecute()) {" + NL + "\t\t\t\t\t\t\tgraphicalViewer.getEditDomain().getCommandStack().execute(new "; + protected final String TEXT_88 = "(myEditingDomain, layoutCommand));"; + protected final String TEXT_89 = NL + "\t\t\t\t\t\t\tdiagramResource.save("; + protected final String TEXT_90 = ".getSaveOptions());"; + protected final String TEXT_91 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t} catch ("; + protected final String TEXT_92 = " ex) {"; + protected final String TEXT_93 = NL + "\t\t\t"; + protected final String TEXT_94 = ".getInstance().logError(\"Save operation failed for: \" + diagramFileURI.toString(), ex); //$NON-NLS-1$"; + protected final String TEXT_95 = NL + "\t\t\t"; + protected final String TEXT_96 = ".getInstance().logError(\"Save operation failed for: \" + diagramFile.getFullPath().toString(), ex); //$NON-NLS-1$"; + protected final String TEXT_97 = NL + "\t\t} catch ("; + protected final String TEXT_98 = " ex) {" + NL + "\t\t\t"; + protected final String TEXT_99 = ".getInstance().logError(\"Unable to open editor\", ex); //$NON-NLS-1$"; + protected final String TEXT_100 = NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}" + NL; + protected final String TEXT_101 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate abstract class URISelectorPage extends "; + protected final String TEXT_102 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_103 = " fileField;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected URISelectorPage(String name) {" + NL + "\t\t\tsuper(name);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createControl("; + protected final String TEXT_104 = " parent) {" + NL + "\t\t\t"; + protected final String TEXT_105 = " composite = new "; + protected final String TEXT_106 = "(parent, "; + protected final String TEXT_107 = ".NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_108 = " layout = new "; + protected final String TEXT_109 = "();" + NL + "\t\t\t\tlayout.numColumns = 1;" + NL + "\t\t\t\tlayout.verticalSpacing = 12;" + NL + "\t\t\t\tcomposite.setLayout(layout);" + NL + "" + NL + "\t\t\t\t"; + protected final String TEXT_110 = " data = new "; + protected final String TEXT_111 = "();" + NL + "\t\t\t\tdata.verticalAlignment = "; + protected final String TEXT_112 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessVerticalSpace = true;" + NL + "\t\t\t\tdata.horizontalAlignment = "; + protected final String TEXT_113 = ".FILL;" + NL + "\t\t\t\tcomposite.setLayoutData(data);" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_114 = " resourceURILabel = new "; + protected final String TEXT_115 = "(composite, "; + protected final String TEXT_116 = ".LEFT);" + NL + "\t\t\t{" + NL + "\t\t\t\tresourceURILabel.setText(\"&File\");" + NL + "" + NL + "\t\t\t\t"; + protected final String TEXT_117 = " data = new "; + protected final String TEXT_118 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; + protected final String TEXT_119 = ".FILL;" + NL + "\t\t\t\tresourceURILabel.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t"; + protected final String TEXT_120 = " fileComposite = new "; + protected final String TEXT_121 = "(composite, "; + protected final String TEXT_122 = ".NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_123 = " data = new "; + protected final String TEXT_124 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; + protected final String TEXT_125 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tfileComposite.setLayoutData(data);" + NL + "" + NL + "\t\t\t\t"; + protected final String TEXT_126 = " layout = new "; + protected final String TEXT_127 = "();" + NL + "\t\t\t\tlayout.marginHeight = 0;" + NL + "\t\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\t\tlayout.numColumns = 2;" + NL + "\t\t\t\tfileComposite.setLayout(layout);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField = new "; + protected final String TEXT_128 = "(fileComposite, "; + protected final String TEXT_129 = ".BORDER);" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_130 = " data = new "; + protected final String TEXT_131 = "();" + NL + "\t\t\t\tdata.horizontalAlignment = "; + protected final String TEXT_132 = ".FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tdata.horizontalSpan = 1;" + NL + "\t\t\t\tfileField.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField.addModifyListener(validator);" + NL + "\t\t\t"; + protected final String TEXT_133 = " resourceURIBrowseFileSystemButton = new "; + protected final String TEXT_134 = "(fileComposite," + NL + "\t\t\t\t\t"; + protected final String TEXT_135 = ".PUSH);" + NL + "\t\t\tresourceURIBrowseFileSystemButton.setText(\"&Browse\");" + NL + "" + NL + "\t\t\tresourceURIBrowseFileSystemButton" + NL + "\t\t\t\t\t.addSelectionListener(new "; + protected final String TEXT_136 = "() {" + NL + "\t\t\t\t\t\tpublic void widgetSelected("; + protected final String TEXT_137 = " event) {" + NL + "\t\t\t\t\t\t\tString fileExtension = getFileExtension();" + NL + "\t\t\t\t\t\t\tString filePath = "; + protected final String TEXT_138 = ".openFilePathDialog(getShell(), \"*.\" + fileExtension, "; + protected final String TEXT_139 = ".OPEN);" + NL + "\t\t\t\t\t\t\tif (filePath != null) {" + NL + "\t\t\t\t\t\t\t\tif (!filePath.endsWith(\".\" + fileExtension)) {" + NL + "\t\t\t\t\t\t\t\t\tfilePath = filePath + \".\" + fileExtension;" + NL + "\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\tfileField.setText(filePath);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t});" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\tsetControl(composite);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; + protected final String TEXT_140 = " validator = new "; + protected final String TEXT_141 = "() {" + NL + "\t\t\tpublic void modifyText("; + protected final String TEXT_142 = " e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected final void setFile("; + protected final String TEXT_143 = " file) {" + NL + "\t\t\tfileField.setText(file.getPath());" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\t"; + protected final String TEXT_144 = " fileURI = getFileURI();" + NL + "\t\t\tif (fileURI == null || fileURI.isEmpty()) {" + NL + "\t\t\t\tsetErrorMessage(null);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tif (fileURI.isFile()) {" + NL + "\t\t\t\t"; + protected final String TEXT_145 = " file = new "; + protected final String TEXT_146 = "(fileURI.toFileString());" + NL + "\t\t\t\tString fileProblem = validateFile(file);" + NL + "\t\t\t\tif (fileProblem != null) {" + NL + "\t\t\t\t\tsetErrorMessage(fileProblem);" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tString requiredExt = getFileExtension();" + NL + "\t\t\tString enteredExt = fileURI.fileExtension();" + NL + "\t\t\tif (enteredExt == null || !enteredExt.equals(requiredExt)) {" + NL + "\t\t\t\tsetErrorMessage(\"The file name must end in \" + requiredExt);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tsetErrorMessage(null);" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Checks the given file and returns the error message if there are problems or <code>null</code> if the file is OK." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract String validateFile("; + protected final String TEXT_147 = " file);" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract String getFileExtension();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; + protected final String TEXT_148 = " getFileURI() {" + NL + "\t\t\ttry {" + NL + "\t\t\t\treturn "; + protected final String TEXT_149 = ".createFileURI(fileField.getText());" + NL + "\t\t\t} catch (Exception exception) {" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class SourceURISelectorPage extends URISelectorPage {" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic SourceURISelectorPage() {" + NL + "\t\t\tsuper(\"Select source file\");" + NL + "\t\t\tsetTitle(\"Source file\");" + NL + "\t\t\tsetDescription(\"Select file with semantic model element to be depicted on diagram\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getFileExtension() {" + NL + "\t\t\treturn \""; + protected final String TEXT_150 = "\";" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\tif (super.validatePage()) {" + NL + "\t\t\t\tmySelectedModelFileURI = getFileURI();" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String validateFile("; + protected final String TEXT_151 = " file) {" + NL + "\t\t\tif (!file.exists()) {" + NL + "\t\t\t\treturn \"Source file does not exist\";" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class DiagramURISelectorPage extends URISelectorPage {" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_152 = " myNewFileURI;" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DiagramURISelectorPage() {" + NL + "\t\t\tsuper(\"Initialize new "; + protected final String TEXT_153 = " diagram file\");" + NL + "\t\t\tsetTitle(\"Diagram file\");" + NL + "\t\t\tsetDescription(\"Create new diagram based on "; + protected final String TEXT_154 = " model content\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getFileExtension() {" + NL + "\t\t\treturn \""; + protected final String TEXT_155 = "\";" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setVisible(boolean visible) {" + NL + "\t\t\tsuper.setVisible(visible);" + NL + "\t\t\tif (visible && mySelectedModelFileURI != null && getFileURI() == null && mySelectedModelFileURI.isFile()) {" + NL + "\t\t\t\t"; + protected final String TEXT_156 = " originalFile = new "; + protected final String TEXT_157 = "(mySelectedModelFileURI.toFileString());" + NL + "\t\t\t\tString originalFileName = mySelectedModelFileURI.trimFileExtension().lastSegment();" + NL + "\t\t\t\t"; + protected final String TEXT_158 = " parentFile = originalFile.getParentFile();" + NL + "\t\t\t\t"; + protected final String TEXT_159 = " newFile = new "; + protected final String TEXT_160 = "(parentFile, originalFileName + getFileExtension());" + NL + "\t\t\t\tfor(int i = 1; i > 0 && newFile.exists(); i++) {" + NL + "\t\t\t\t\tnewFile = new "; + protected final String TEXT_161 = "(parentFile, originalFileName + i + getFileExtension());" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (newFile.exists()) {" + NL + "\t\t\t\t\treturn;\t//failed to set name that does not exist, just leave empty." + NL + "\t\t\t\t}" + NL + "\t\t\t\tsetFile(newFile);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage() {" + NL + "\t\t\tmyNewFileURI = null;" + NL + "\t\t\tif (super.validatePage()) {" + NL + "\t\t\t\tmyNewFileURI = getFileURI();" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; + protected final String TEXT_162 = " getNewFileURI() {" + NL + "\t\t\treturn myNewFileURI;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String validateFile("; + protected final String TEXT_163 = " file) {" + NL + "\t\t\tif (file.exists()) {" + NL + "\t\t\t\treturn \"Diagram file already exists\";" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_164 = NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate class RootElementSelectorPage extends "; + protected final String TEXT_165 = " implements "; + protected final String TEXT_166 = " {"; + protected final String TEXT_167 = NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_168 = " myTreeViewer;"; + protected final String TEXT_169 = NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */" + NL + "\t\tprotected RootElementSelectorPage() {" + NL + "\t\t\tsuper(\"Select diagram root element\");" + NL + "\t\t\tsetTitle(\"Diagram root element\");" + NL + "\t\t\tsetDescription(\"Select semantic model element to be depicted on diagram\");" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic void createControl("; + protected final String TEXT_170 = " parent) {" + NL + "\t\t\tinitializeDialogUnits(parent);" + NL + "\t\t\t"; + protected final String TEXT_171 = " topLevel = new "; + protected final String TEXT_172 = "(parent, "; + protected final String TEXT_173 = ".NONE);" + NL + "\t\t\ttopLevel.setLayout(new "; + protected final String TEXT_174 = "());" + NL + "\t\t\ttopLevel.setLayoutData(new "; + protected final String TEXT_175 = "("; + protected final String TEXT_176 = ".VERTICAL_ALIGN_FILL | "; + protected final String TEXT_177 = ".HORIZONTAL_ALIGN_FILL));" + NL + "\t\t\ttopLevel.setFont(parent.getFont());" + NL + "\t\t\tsetControl(topLevel);" + NL + "\t\t\tcreateModelBrowser(topLevel);" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void createModelBrowser("; + protected final String TEXT_178 = " parent) {" + NL + "\t\t\t"; + protected final String TEXT_179 = " panel = new "; + protected final String TEXT_180 = "(parent, "; + protected final String TEXT_181 = ".NONE);" + NL + "\t\t\tpanel.setLayoutData(new "; + protected final String TEXT_182 = "("; + protected final String TEXT_183 = ".FILL_BOTH));" + NL + "\t\t\t"; + protected final String TEXT_184 = " layout = new "; + protected final String TEXT_185 = "();" + NL + "\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\tpanel.setLayout(layout);" + NL + "\t\t\t" + NL + "\t\t\t"; + protected final String TEXT_186 = " label = new "; + protected final String TEXT_187 = "(panel, "; + protected final String TEXT_188 = ".NONE);" + NL + "\t\t\tlabel.setText(\"Select diagram root element:\");" + NL + "\t\t\tlabel.setLayoutData(new "; + protected final String TEXT_189 = "("; + protected final String TEXT_190 = ".HORIZONTAL_ALIGN_BEGINNING));"; + protected final String TEXT_191 = NL + "\t\t\t"; + protected final String TEXT_192 = " "; + protected final String TEXT_193 = " = new "; + protected final String TEXT_194 = "(panel, "; + protected final String TEXT_195 = ".SINGLE | "; + protected final String TEXT_196 = ".H_SCROLL | "; + protected final String TEXT_197 = ".V_SCROLL | "; + protected final String TEXT_198 = ".BORDER);" + NL + "\t\t\t"; + protected final String TEXT_199 = " layoutData = new "; + protected final String TEXT_200 = "("; + protected final String TEXT_201 = ".FILL_BOTH);" + NL + "\t\t\tlayoutData.heightHint = 300;" + NL + "\t\t\tlayoutData.widthHint = 300;" + NL + "\t\t\t"; + protected final String TEXT_202 = ".getTree().setLayoutData(layoutData);" + NL + "\t\t\t"; + protected final String TEXT_203 = ".setContentProvider(new "; + protected final String TEXT_204 = "("; + protected final String TEXT_205 = ".getInstance().getItemProvidersAdapterFactory()));" + NL + "\t\t\t"; + protected final String TEXT_206 = ".setLabelProvider(new "; + protected final String TEXT_207 = "("; + protected final String TEXT_208 = ".getInstance().getItemProvidersAdapterFactory()));"; + protected final String TEXT_209 = NL + "\t\t\t"; + protected final String TEXT_210 = ".setInput(myDiagramRoot.eResource());" + NL + "\t\t\t"; + protected final String TEXT_211 = ".setSelection(new "; + protected final String TEXT_212 = "(myDiagramRoot));"; + protected final String TEXT_213 = NL + "\t\t\t"; + protected final String TEXT_214 = ".addSelectionChangedListener(this);" + NL + "\t\t}" + NL; + protected final String TEXT_215 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setVisible(boolean visible) {" + NL + "\t\t\tif (visible) {" + NL + "\t\t\t\t"; + protected final String TEXT_216 = ".setInput(myEditingDomain.getResourceSet().getResource(mySelectedModelFileURI, true));" + NL + "\t\t\t\tif (myDiagramRoot != null) {" + NL + "\t\t\t\t\tmyTreeViewer.setSelection(new "; + protected final String TEXT_217 = "(myDiagramRoot));" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsuper.setVisible(visible);" + NL + "\t\t}" + NL; + protected final String TEXT_218 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectionChanged("; + protected final String TEXT_219 = " event) {" + NL + "\t\t\tmyDiagramRoot = null;" + NL + "\t\t\tif (event.getSelection() instanceof "; + protected final String TEXT_220 = ") {" + NL + "\t\t\t\t"; + protected final String TEXT_221 = " selection = ("; + protected final String TEXT_222 = ") event.getSelection();" + NL + "\t\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\t\tif (selectedElement instanceof "; + protected final String TEXT_223 = ") {" + NL + "\t\t\t\t\t\tselectedElement = (("; + protected final String TEXT_224 = ") selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof "; + protected final String TEXT_225 = ".Entry) {" + NL + "\t\t\t\t\t\tselectedElement = (("; + protected final String TEXT_226 = ".Entry) selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof "; + protected final String TEXT_227 = ") {" + NL + "\t\t\t\t\t\tmyDiagramRoot = ("; + protected final String TEXT_228 = ") selectedElement;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + " \t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate boolean validatePage() {" + NL + "\t\t\tif (myDiagramRoot == null) {" + NL + "\t\t\t\tsetErrorMessage(\"No diagram root element selected\");" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tboolean result = "; + protected final String TEXT_229 = ".VISUAL_ID == "; + protected final String TEXT_230 = ".INSTANCE.getDiagramVisualID(myDiagramRoot);" + NL + "\t\t\tsetErrorMessage(result ? null : \"Invalid diagram root element was selected\");" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}" + NL + "}"; + protected final String TEXT_231 = NL; public String generate(Object argument) { @@ -260,14 +259,13 @@ final GenModel genModel = editorGen.getDomainGenModel(); final String pluginActivatorClass = importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName()); final boolean isRichClientPlatform = genDiagram.getEditorGen().getApplication() != null; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); @@ -279,64 +277,66 @@ if (isRichClientPlatform) { importManager.registerInnerClass("DiagramURISelectorPage"); } - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.Wizard")); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); if (isRichClientPlatform) { - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); } else { - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.WizardNewFileCreationPage")); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPage")); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); } - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); if (isRichClientPlatform) { - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); } else { - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPage")); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); + stringBuffer.append(TEXT_27); + stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); stringBuffer.append(TEXT_28); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); stringBuffer.append(TEXT_29); @@ -344,210 +344,210 @@ if (isRichClientPlatform) { stringBuffer.append(TEXT_30); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); stringBuffer.append(TEXT_31); - stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); - stringBuffer.append(TEXT_32); } - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); stringBuffer.append(genDiagram.getNewDiagramFileWizardClassName()); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); if (isRichClientPlatform) { - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); } else { - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); } - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_37); stringBuffer.append(genDiagram.getDomainDiagramElement() == null ? "" : genDiagram.getDomainDiagramElement().getGenPackage().getPrefix()); - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_38); if (isRichClientPlatform) { - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_39); } else { - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.WizardNewFileCreationPage")); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_41); stringBuffer.append(genModel.getModelName()); - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IContainer")); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); stringBuffer.append(editorGen.getDiagramFileExtension()); + stringBuffer.append(TEXT_45); + stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Path")); stringBuffer.append(TEXT_46); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Path")); stringBuffer.append(TEXT_47); - stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Path")); - stringBuffer.append(TEXT_48); stringBuffer.append(genModel.getModelName()); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); } - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_49); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); if (isRichClientPlatform) { - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); } else { - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); + stringBuffer.append(TEXT_55); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_56); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_57); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_58); } - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); + stringBuffer.append(TEXT_59); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")); stringBuffer.append(TEXT_60); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")); stringBuffer.append(TEXT_61); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")); - stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); if (editorGen.isSameFileForDiagramAndModel()) { - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); } - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.commands.WrappingCommand")); - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_68); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); if (!genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IViewPart")); - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); } else { if (isRichClientPlatform) { - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart")); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_75); } else { - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_76); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart")); - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_77); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.ide.IDE")); - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_78); } } + stringBuffer.append(TEXT_79); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.services.IDiagramLayouter")); stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.services.IDiagramLayouter")); stringBuffer.append(TEXT_81); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.services.IDiagramLayouter")); stringBuffer.append(TEXT_82); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.services.IDiagramLayouter")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_83); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_84); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_85); - stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); - stringBuffer.append(TEXT_86); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command")); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_86); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_87); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.commands.WrappingCommand")); - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_88); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_89); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_90); } - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_91); stringBuffer.append(importManager.getImportedName("java.io.IOException")); - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_92); if (isRichClientPlatform) { - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_93); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_94); } else { - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_95); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_96); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_97); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_98); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_99); } } - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_100); if (isRichClientPlatform) { - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_101); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardPage")); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_102); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Text")); + stringBuffer.append(TEXT_103); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_104); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_105); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_106); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); - stringBuffer.append(TEXT_107); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_107); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_108); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_109); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_110); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_111); @@ -555,91 +555,91 @@ if (isRichClientPlatform) { stringBuffer.append(TEXT_112); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_113); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); stringBuffer.append(TEXT_114); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); stringBuffer.append(TEXT_115); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); - stringBuffer.append(TEXT_116); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_116); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_117); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_118); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_119); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_120); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_121); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); - stringBuffer.append(TEXT_122); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_122); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_123); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_124); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_125); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_126); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_127); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); - stringBuffer.append(TEXT_128); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Text")); - stringBuffer.append(TEXT_129); + stringBuffer.append(TEXT_128); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_129); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_130); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_131); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_132); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); stringBuffer.append(TEXT_133); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); stringBuffer.append(TEXT_134); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); - stringBuffer.append(TEXT_135); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); - stringBuffer.append(TEXT_136); + stringBuffer.append(TEXT_135); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionAdapter")); - stringBuffer.append(TEXT_137); + stringBuffer.append(TEXT_136); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionEvent")); - stringBuffer.append(TEXT_138); + stringBuffer.append(TEXT_137); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_139); + stringBuffer.append(TEXT_138); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_139); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.ModifyListener")); stringBuffer.append(TEXT_140); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.ModifyListener")); stringBuffer.append(TEXT_141); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.ModifyListener")); - stringBuffer.append(TEXT_142); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.ModifyEvent")); - stringBuffer.append(TEXT_143); + stringBuffer.append(TEXT_142); stringBuffer.append(importManager.getImportedName("java.io.File")); - stringBuffer.append(TEXT_144); + stringBuffer.append(TEXT_143); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); + stringBuffer.append(TEXT_144); + stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_145); stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_146); stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_147); - stringBuffer.append(importManager.getImportedName("java.io.File")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_148); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); stringBuffer.append(TEXT_149); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_150); stringBuffer.append(editorGen.getDomainFileExtension()); - stringBuffer.append(TEXT_151); + stringBuffer.append(TEXT_150); stringBuffer.append(importManager.getImportedName("java.io.File")); - stringBuffer.append(TEXT_152); + stringBuffer.append(TEXT_151); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_153); + stringBuffer.append(TEXT_152); stringBuffer.append(editorGen.getDiagramFileExtension()); - stringBuffer.append(TEXT_154); + stringBuffer.append(TEXT_153); stringBuffer.append(editorGen.getDomainGenModel().getModelName()); - stringBuffer.append(TEXT_155); + stringBuffer.append(TEXT_154); stringBuffer.append(editorGen.getDiagramFileExtension()); + stringBuffer.append(TEXT_155); + stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_156); stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_157); @@ -651,83 +651,83 @@ if (isRichClientPlatform) { stringBuffer.append(TEXT_160); stringBuffer.append(importManager.getImportedName("java.io.File")); stringBuffer.append(TEXT_161); - stringBuffer.append(importManager.getImportedName("java.io.File")); - stringBuffer.append(TEXT_162); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_163); + stringBuffer.append(TEXT_162); stringBuffer.append(importManager.getImportedName("java.io.File")); - stringBuffer.append(TEXT_164); + stringBuffer.append(TEXT_163); } - stringBuffer.append(TEXT_165); + stringBuffer.append(TEXT_164); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardPage")); - stringBuffer.append(TEXT_166); + stringBuffer.append(TEXT_165); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ISelectionChangedListener")); - stringBuffer.append(TEXT_167); + stringBuffer.append(TEXT_166); if (isRichClientPlatform) { - stringBuffer.append(TEXT_168); + stringBuffer.append(TEXT_167); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.TreeViewer")); - stringBuffer.append(TEXT_169); + stringBuffer.append(TEXT_168); } + stringBuffer.append(TEXT_169); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_170); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_171); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_172); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); - stringBuffer.append(TEXT_173); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); - stringBuffer.append(TEXT_174); + stringBuffer.append(TEXT_173); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); + stringBuffer.append(TEXT_174); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_175); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_176); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_177); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_178); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_179); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); stringBuffer.append(TEXT_180); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Composite")); - stringBuffer.append(TEXT_181); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_181); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_182); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_183); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_184); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); stringBuffer.append(TEXT_185); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridLayout")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); stringBuffer.append(TEXT_186); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); stringBuffer.append(TEXT_187); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Label")); - stringBuffer.append(TEXT_188); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(TEXT_188); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_189); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_190); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); - stringBuffer.append(TEXT_191); final String treeViewer = isRichClientPlatform ? "myTreeViewer" : "treeViewer"; - stringBuffer.append(TEXT_192); + stringBuffer.append(TEXT_191); if (!isRichClientPlatform){ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.TreeViewer")); - stringBuffer.append(TEXT_193); + stringBuffer.append(TEXT_192); } stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_194); + stringBuffer.append(TEXT_193); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.TreeViewer")); + stringBuffer.append(TEXT_194); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); stringBuffer.append(TEXT_195); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); stringBuffer.append(TEXT_196); @@ -735,82 +735,80 @@ final String treeViewer = isRichClientPlatform ? "myTreeViewer" : "treeViewer"; stringBuffer.append(TEXT_197); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); stringBuffer.append(TEXT_198); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_199); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_200); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); stringBuffer.append(TEXT_201); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.layout.GridData")); + stringBuffer.append(treeViewer); stringBuffer.append(TEXT_202); stringBuffer.append(treeViewer); stringBuffer.append(TEXT_203); - stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_204); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider")); - stringBuffer.append(TEXT_205); + stringBuffer.append(TEXT_204); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_206); + stringBuffer.append(TEXT_205); stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_207); + stringBuffer.append(TEXT_206); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider")); - stringBuffer.append(TEXT_208); + stringBuffer.append(TEXT_207); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_209); + stringBuffer.append(TEXT_208); if (!isRichClientPlatform) { + stringBuffer.append(TEXT_209); + stringBuffer.append(treeViewer); stringBuffer.append(TEXT_210); stringBuffer.append(treeViewer); stringBuffer.append(TEXT_211); - stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_212); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")); - stringBuffer.append(TEXT_213); + stringBuffer.append(TEXT_212); } - stringBuffer.append(TEXT_214); + stringBuffer.append(TEXT_213); stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_215); + stringBuffer.append(TEXT_214); if (isRichClientPlatform) { - stringBuffer.append(TEXT_216); + stringBuffer.append(TEXT_215); stringBuffer.append(treeViewer); - stringBuffer.append(TEXT_217); + stringBuffer.append(TEXT_216); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")); - stringBuffer.append(TEXT_218); + stringBuffer.append(TEXT_217); } - stringBuffer.append(TEXT_219); + stringBuffer.append(TEXT_218); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.SelectionChangedEvent")); + stringBuffer.append(TEXT_219); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_220); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_221); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_222); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")); stringBuffer.append(TEXT_223); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")); stringBuffer.append(TEXT_224); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); stringBuffer.append(TEXT_225); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); stringBuffer.append(TEXT_226); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_227); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_228); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_229); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_230); + stringBuffer.append(TEXT_229); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_231); + stringBuffer.append(TEXT_230); importManager.emitSortedImports(); - stringBuffer.append(TEXT_232); + stringBuffer.append(TEXT_231); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/OpenDiagramFileInViewGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/OpenDiagramFileInViewGenerator.java index 8b4583909..165cd89c4 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/OpenDiagramFileInViewGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/OpenDiagramFileInViewGenerator.java @@ -15,40 +15,39 @@ public class OpenDiagramFileInViewGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_5 = " implements "; - protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_7 = " myPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_8 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setActivePart("; - protected final String TEXT_9 = " action, "; - protected final String TEXT_10 = " targetPart) {" + NL + "\t\tmyPart = targetPart;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void selectionChanged("; - protected final String TEXT_11 = " action, "; - protected final String TEXT_12 = " selection) {" + NL + "\t\tmySelectedModelFile = null;" + NL + "\t\taction.setEnabled(false);" + NL + "\t\tif (selection instanceof "; - protected final String TEXT_13 = " == false" + NL + "\t\t\t\t|| selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tmySelectedModelFile = ("; - protected final String TEXT_14 = ") (("; - protected final String TEXT_15 = ") selection).getFirstElement();" + NL + "\t\taction.setEnabled(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run("; - protected final String TEXT_16 = " action) {" + NL + "\t\t"; - protected final String TEXT_17 = " diagram = null;" + NL + "\t\t"; - protected final String TEXT_18 = " editingDomain = "; - protected final String TEXT_19 = ".INSTANCE" + NL + "\t\t\t\t.createEditingDomain();" + NL + "\t\t"; - protected final String TEXT_20 = " resourceSet = editingDomain.getResourceSet();" + NL + "\t\ttry {" + NL + "\t\t\t"; - protected final String TEXT_21 = " resource = resourceSet.getResource("; - protected final String TEXT_22 = ".createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);" + NL + "\t\t\tdiagram = ("; - protected final String TEXT_23 = ") resource.getContents().get(0);" + NL + "\t\t} catch ("; - protected final String TEXT_24 = " ex) {" + NL + "\t\t\t"; - protected final String TEXT_25 = ".getInstance().logError(" + NL + "\t\t\t\t\t\t\t\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex);" + NL + "\t\t\t"; - protected final String TEXT_26 = ".openError(myPart.getSite().getShell(), \"Error\"," + NL + "\t\t\t\t\t\"Diagram file failed to load\");" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\t"; - protected final String TEXT_27 = " part = ("; - protected final String TEXT_28 = ") myPart.getSite().getPage().showView("; - protected final String TEXT_29 = ".ID);" + NL + "\t\t\tpart.showDiagram(editingDomain, "; - protected final String TEXT_30 = ".getURI(diagram));" + NL + "\t\t} catch ("; - protected final String TEXT_31 = " ex) {" + NL + "\t\t\t"; - protected final String TEXT_32 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex);" + NL + "\t\t\t"; - protected final String TEXT_33 = ".openError(myPart.getSite().getShell(), \"Error\", \"Unable to open diagram\");" + NL + "\t\t}" + NL + "\t}" + NL + "}"; - protected final String TEXT_34 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_4 = " implements "; + protected final String TEXT_5 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_6 = " myPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_7 = " mySelectedModelFile;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setActivePart("; + protected final String TEXT_8 = " action, "; + protected final String TEXT_9 = " targetPart) {" + NL + "\t\tmyPart = targetPart;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void selectionChanged("; + protected final String TEXT_10 = " action, "; + protected final String TEXT_11 = " selection) {" + NL + "\t\tmySelectedModelFile = null;" + NL + "\t\taction.setEnabled(false);" + NL + "\t\tif (selection instanceof "; + protected final String TEXT_12 = " == false" + NL + "\t\t\t\t|| selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tmySelectedModelFile = ("; + protected final String TEXT_13 = ") (("; + protected final String TEXT_14 = ") selection).getFirstElement();" + NL + "\t\taction.setEnabled(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run("; + protected final String TEXT_15 = " action) {" + NL + "\t\t"; + protected final String TEXT_16 = " diagram = null;" + NL + "\t\t"; + protected final String TEXT_17 = " editingDomain = "; + protected final String TEXT_18 = ".INSTANCE" + NL + "\t\t\t\t.createEditingDomain();" + NL + "\t\t"; + protected final String TEXT_19 = " resourceSet = editingDomain.getResourceSet();" + NL + "\t\ttry {" + NL + "\t\t\t"; + protected final String TEXT_20 = " resource = resourceSet.getResource("; + protected final String TEXT_21 = ".createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);" + NL + "\t\t\tdiagram = ("; + protected final String TEXT_22 = ") resource.getContents().get(0);" + NL + "\t\t} catch ("; + protected final String TEXT_23 = " ex) {" + NL + "\t\t\t"; + protected final String TEXT_24 = ".getInstance().logError(" + NL + "\t\t\t\t\t\t\t\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex);" + NL + "\t\t\t"; + protected final String TEXT_25 = ".openError(myPart.getSite().getShell(), \"Error\"," + NL + "\t\t\t\t\t\"Diagram file failed to load\");" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\t"; + protected final String TEXT_26 = " part = ("; + protected final String TEXT_27 = ") myPart.getSite().getPage().showView("; + protected final String TEXT_28 = ".ID);" + NL + "\t\t\tpart.showDiagram(editingDomain, "; + protected final String TEXT_29 = ".getURI(diagram));" + NL + "\t\t} catch ("; + protected final String TEXT_30 = " ex) {" + NL + "\t\t\t"; + protected final String TEXT_31 = ".getInstance().logError(\"Unable to load resource: \" + mySelectedModelFile.getFullPath().toString(), ex);" + NL + "\t\t\t"; + protected final String TEXT_32 = ".openError(myPart.getSite().getShell(), \"Error\", \"Unable to open diagram\");" + NL + "\t\t}" + NL + "\t}" + NL + "}"; + protected final String TEXT_33 = NL; public String generate(Object argument) { @@ -59,80 +58,79 @@ final GenEditorGenerator editorGen = editorView.getEditorGen(); final GenDiagram genDiagram = editorGen.getDiagram(); final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); stringBuffer.append(importManager.getCompilationUnitName()); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IObjectActionDelegate")); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPart")); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPart")); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ISelection")); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.WorkspaceEditingDomainFactory")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.WrappedException")); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); stringBuffer.append(importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")); + stringBuffer.append(TEXT_25); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_27); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); - stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName(editorView.getQualifiedClassName())); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_29); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); importManager.emitSortedImports(); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PaletteFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PaletteFactoryGenerator.java index 8fa58560a..44bd8ccc9 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PaletteFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PaletteFactoryGenerator.java @@ -67,75 +67,73 @@ public class PaletteFactoryGenerator protected final String TEXT_48 = NL + "\t\t"; protected final String TEXT_49 = " result = new "; protected final String TEXT_50 = "();"; - protected final String TEXT_51 = NL; - protected final String TEXT_52 = NL + "\t\tresult.setToolClass("; - protected final String TEXT_53 = ".class);"; - protected final String TEXT_54 = NL; - protected final String TEXT_55 = NL + "\t\tresult.setToolProperty("; - protected final String TEXT_56 = ", "; - protected final String TEXT_57 = ");"; - protected final String TEXT_58 = NL + "\t\treturn result;"; - protected final String TEXT_59 = NL + "\t}" + NL; - protected final String TEXT_60 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ToolEntry "; - protected final String TEXT_61 = "() {" + NL + "\t\t"; - protected final String TEXT_62 = NL + "\t\t"; - protected final String TEXT_63 = " smallImage = "; - protected final String TEXT_64 = ".findImageDescriptor(\""; - protected final String TEXT_65 = "\");" + NL + "\t\t"; - protected final String TEXT_66 = NL + "\t\t"; - protected final String TEXT_67 = " smallImage = getImageDescriptor("; - protected final String TEXT_68 = "); " + NL + "\t\t"; - protected final String TEXT_69 = NL + "\t\t"; - protected final String TEXT_70 = " smallImage = null;" + NL + "\t\t"; + protected final String TEXT_51 = NL + "\t\tresult.setToolClass("; + protected final String TEXT_52 = ".class);"; + protected final String TEXT_53 = NL; + protected final String TEXT_54 = NL + "\t\tresult.setToolProperty("; + protected final String TEXT_55 = ", "; + protected final String TEXT_56 = ");"; + protected final String TEXT_57 = NL + "\t\treturn result;"; + protected final String TEXT_58 = NL + "\t}" + NL; + protected final String TEXT_59 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ToolEntry "; + protected final String TEXT_60 = "() {" + NL + "\t\t"; + protected final String TEXT_61 = NL + "\t\t"; + protected final String TEXT_62 = " smallImage = "; + protected final String TEXT_63 = ".findImageDescriptor(\""; + protected final String TEXT_64 = "\");" + NL + "\t\t"; + protected final String TEXT_65 = NL + "\t\t"; + protected final String TEXT_66 = " smallImage = getImageDescriptor("; + protected final String TEXT_67 = "); " + NL + "\t\t"; + protected final String TEXT_68 = NL + "\t\t"; + protected final String TEXT_69 = " smallImage = null;" + NL + "\t\t"; + protected final String TEXT_70 = NL + "\t\t"; protected final String TEXT_71 = NL + "\t\t"; - protected final String TEXT_72 = NL + "\t\t"; - protected final String TEXT_73 = " largeImage = "; - protected final String TEXT_74 = ".findImageDescriptor(\""; - protected final String TEXT_75 = "\");" + NL + "\t\t"; - protected final String TEXT_76 = NL + "\t\t"; - protected final String TEXT_77 = " largeImage = smallImage;" + NL + "\t\t"; - protected final String TEXT_78 = NL + "\t\tfinal int[] visualIds = new int[] {"; - protected final String TEXT_79 = NL + "\t\t\t"; - protected final String TEXT_80 = ".VISUAL_ID"; - protected final String TEXT_81 = ","; - protected final String TEXT_82 = NL + "\t\t};"; - protected final String TEXT_83 = NL + "\t\tToolEntry result = new NodeToolEntry(\""; - protected final String TEXT_84 = "\", \""; - protected final String TEXT_85 = "\", smallImage, largeImage, visualIds);"; - protected final String TEXT_86 = NL + "\t\tToolEntry result = new LinkToolEntry(\""; - protected final String TEXT_87 = "\", \""; - protected final String TEXT_88 = "\", smallImage, largeImage, visualIds);"; - protected final String TEXT_89 = NL + "\t\tToolEntry result = new ToolEntry(\""; - protected final String TEXT_90 = "\", \""; - protected final String TEXT_91 = "\", smallImage, largeImage) {};"; - protected final String TEXT_92 = NL; - protected final String TEXT_93 = NL + "\t\tresult.setToolClass("; - protected final String TEXT_94 = ".class);"; - protected final String TEXT_95 = NL; - protected final String TEXT_96 = NL + "\t\tresult.setToolProperty("; - protected final String TEXT_97 = ", "; - protected final String TEXT_98 = ");"; - protected final String TEXT_99 = NL + "\t\treturn result;" + NL + "\t}"; - protected final String TEXT_100 = NL; - protected final String TEXT_101 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class NodeToolEntry extends "; - protected final String TEXT_102 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final int[] myVisualIDs;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate NodeToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, int[] visualIDs) {" + NL + "\t\t\tsuper(title, description, new "; - protected final String TEXT_103 = "("; - protected final String TEXT_104 = ".class), smallIcon, largeIcon);" + NL + "\t\t\tmyVisualIDs = visualIDs;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Tool createTool() {" + NL + "\t\t\tTool result = new CreationTool() {" + NL + "\t\t\t\tprotected Request createTargetRequest() {" + NL + "\t\t\t\t\t"; - protected final String TEXT_105 = " request = new "; - protected final String TEXT_106 = "("; - protected final String TEXT_107 = ".MODEL_ID, myVisualIDs);" + NL + "\t\t\t\t\trequest.setFactory(getFactory());" + NL + "\t\t\t\t\treturn request;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tprotected void performCreation(int button) {" + NL + "\t\t\t\t\tsuper.performCreation(button);" + NL + "\t\t\t\t\tfinal "; - protected final String TEXT_108 = " createdEditPart = ("; - protected final String TEXT_109 = ")getCurrentViewer().getEditPartRegistry().get(getCreateRequest().getNewObject());" + NL + "\t\t\t\t\tif (createdEditPart != null) {" + NL + "\t\t\t\t\t\tgetCurrentViewer().getControl().getDisplay().asyncExec(new Runnable() {" + NL + "\t\t\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t\t\tif (createdEditPart.isActive()) {" + NL + "\t\t\t\t\t\t\t\t\tcreatedEditPart.performRequest(new "; - protected final String TEXT_110 = "("; - protected final String TEXT_111 = ".REQ_DIRECT_EDIT));" + NL + "\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t});" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tresult.setProperties(getToolProperties());" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}"; - protected final String TEXT_112 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class LinkToolEntry extends ConnectionCreationToolEntry {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final int[] myVisualIDs;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate LinkToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, int[] visualIDs) {" + NL + "\t\t\tsuper(title, description, new "; - protected final String TEXT_113 = "("; - protected final String TEXT_114 = ".class), smallIcon, largeIcon);" + NL + "\t\t\tmyVisualIDs = visualIDs;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Tool createTool() {" + NL + "\t\t\tTool result = new ConnectionCreationTool() {" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsetUnloadWhenFinished(true);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tprotected Request createTargetRequest() {" + NL + "\t\t\t\t\t"; - protected final String TEXT_115 = " request = new "; - protected final String TEXT_116 = "("; - protected final String TEXT_117 = ".MODEL_ID, myVisualIDs);" + NL + "\t\t\t\t\trequest.setFactory(getFactory());" + NL + "\t\t\t\t\treturn request;" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tresult.setProperties(getToolProperties());" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}"; - protected final String TEXT_118 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ImageDescriptor getImageDescriptor(Object o) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) domainAdapterFactory.adapt(o, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {" + NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(o));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "}"; - protected final String TEXT_119 = NL; + protected final String TEXT_72 = " largeImage = "; + protected final String TEXT_73 = ".findImageDescriptor(\""; + protected final String TEXT_74 = "\");" + NL + "\t\t"; + protected final String TEXT_75 = NL + "\t\t"; + protected final String TEXT_76 = " largeImage = smallImage;" + NL + "\t\t"; + protected final String TEXT_77 = NL + "\t\tfinal int[] visualIds = new int[] {"; + protected final String TEXT_78 = NL + "\t\t\t"; + protected final String TEXT_79 = ".VISUAL_ID"; + protected final String TEXT_80 = ","; + protected final String TEXT_81 = NL + "\t\t};"; + protected final String TEXT_82 = NL + "\t\tToolEntry result = new NodeToolEntry(\""; + protected final String TEXT_83 = "\", \""; + protected final String TEXT_84 = "\", smallImage, largeImage, visualIds);"; + protected final String TEXT_85 = NL + "\t\tToolEntry result = new LinkToolEntry(\""; + protected final String TEXT_86 = "\", \""; + protected final String TEXT_87 = "\", smallImage, largeImage, visualIds);"; + protected final String TEXT_88 = NL + "\t\tToolEntry result = new ToolEntry(\""; + protected final String TEXT_89 = "\", \""; + protected final String TEXT_90 = "\", smallImage, largeImage) {};"; + protected final String TEXT_91 = NL + "\t\tresult.setToolClass("; + protected final String TEXT_92 = ".class);"; + protected final String TEXT_93 = NL; + protected final String TEXT_94 = NL + "\t\tresult.setToolProperty("; + protected final String TEXT_95 = ", "; + protected final String TEXT_96 = ");"; + protected final String TEXT_97 = NL + "\t\treturn result;" + NL + "\t}"; + protected final String TEXT_98 = NL; + protected final String TEXT_99 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class NodeToolEntry extends "; + protected final String TEXT_100 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final int[] myVisualIDs;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate NodeToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, int[] visualIDs) {" + NL + "\t\t\tsuper(title, description, new "; + protected final String TEXT_101 = "("; + protected final String TEXT_102 = ".class), smallIcon, largeIcon);" + NL + "\t\t\tmyVisualIDs = visualIDs;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Tool createTool() {" + NL + "\t\t\tTool result = new CreationTool() {" + NL + "\t\t\t\tprotected Request createTargetRequest() {" + NL + "\t\t\t\t\t"; + protected final String TEXT_103 = " request = new "; + protected final String TEXT_104 = "("; + protected final String TEXT_105 = ".MODEL_ID, myVisualIDs);" + NL + "\t\t\t\t\trequest.setFactory(getFactory());" + NL + "\t\t\t\t\treturn request;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tprotected void performCreation(int button) {" + NL + "\t\t\t\t\tsuper.performCreation(button);" + NL + "\t\t\t\t\tfinal "; + protected final String TEXT_106 = " createdEditPart = ("; + protected final String TEXT_107 = ")getCurrentViewer().getEditPartRegistry().get(getCreateRequest().getNewObject());" + NL + "\t\t\t\t\tif (createdEditPart != null) {" + NL + "\t\t\t\t\t\tgetCurrentViewer().getControl().getDisplay().asyncExec(new Runnable() {" + NL + "\t\t\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t\t\tif (createdEditPart.isActive()) {" + NL + "\t\t\t\t\t\t\t\t\tcreatedEditPart.performRequest(new "; + protected final String TEXT_108 = "("; + protected final String TEXT_109 = ".REQ_DIRECT_EDIT));" + NL + "\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t});" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tresult.setProperties(getToolProperties());" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_110 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class LinkToolEntry extends ConnectionCreationToolEntry {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final int[] myVisualIDs;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate LinkToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, int[] visualIDs) {" + NL + "\t\t\tsuper(title, description, new "; + protected final String TEXT_111 = "("; + protected final String TEXT_112 = ".class), smallIcon, largeIcon);" + NL + "\t\t\tmyVisualIDs = visualIDs;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Tool createTool() {" + NL + "\t\t\tTool result = new ConnectionCreationTool() {" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsetUnloadWhenFinished(true);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tprotected Request createTargetRequest() {" + NL + "\t\t\t\t\t"; + protected final String TEXT_113 = " request = new "; + protected final String TEXT_114 = "("; + protected final String TEXT_115 = ".MODEL_ID, myVisualIDs);" + NL + "\t\t\t\t\trequest.setFactory(getFactory());" + NL + "\t\t\t\t\treturn request;" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tresult.setProperties(getToolProperties());" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_116 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ImageDescriptor getImageDescriptor(Object o) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) domainAdapterFactory.adapt(o, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {" + NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(o));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "}"; + protected final String TEXT_117 = NL; public String generate(Object argument) { @@ -323,36 +321,35 @@ for(AbstractToolEntry abstractToolEntry : toolsQueue) { stringBuffer.append(TEXT_49); stringBuffer.append(importManager.getImportedName(toolEntryQualifiedName)); stringBuffer.append(TEXT_50); - stringBuffer.append(TEXT_51); // there's a problem with qualifieToolName - we should also respect different tools // in NodeToolEntry and LinkToolEntry (right now there's hardcoded name of the tool) if (toolEntry.getQualifiedToolName() != null && toolEntry.getQualifiedToolName().trim().length() > 0 ) { - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName(toolEntry.getQualifiedToolName())); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); } /*tool class presence*/ - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); if (!toolEntry.getProperties().isEmpty()) { for (Iterator it = toolEntry.getProperties().entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); stringBuffer.append(entry.getKey()); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_55); stringBuffer.append(entry.getValue()); - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_56); } /*properties iterator*/ } /*properties presence check*/ - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_57); } - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); continue; } @@ -378,165 +375,164 @@ if (toolEntry.getQualifiedToolName() != null && toolEntry.getQualifiedToolName() } } - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_59); stringBuffer.append(toolEntry.getCreateMethodName()); - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_60); if (toolEntry.getSmallIconPath() != null) { - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); stringBuffer.append(toolEntry.getSmallIconPath()); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); } else if (domainElementInstanceCreationCode != null) { - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); stringBuffer.append(domainElementInstanceCreationCode); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); } else { - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_68); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); } - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); if (toolEntry.getLargeIconPath() != null) { - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(toolEntry.getLargeIconPath()); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); } else { - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_75); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_76); } if (!toolEntry.getElements().isEmpty()) { - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_77); for (Iterator genElementsIterator = toolEntry.getElements().iterator(); genElementsIterator.hasNext();) { GenCommonBase next = (GenCommonBase) genElementsIterator.next(); - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName(next.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_79); if (genElementsIterator.hasNext()) { - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_80); } } - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_81); } if (firstGenElement instanceof GenNode) { hasNodeEntries = true; - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_82); stringBuffer.append(toolEntry.getTitle()); - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_83); stringBuffer.append(toolEntry.getDescription()); - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_84); } else if (firstGenElement instanceof GenLink) { hasLinkEntries = true; - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_85); stringBuffer.append(toolEntry.getTitle()); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_86); stringBuffer.append(toolEntry.getDescription()); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_87); } else { - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_88); stringBuffer.append(toolEntry.getTitle()); - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_89); stringBuffer.append(toolEntry.getDescription()); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_90); } - stringBuffer.append(TEXT_92); // there's a problem with qualifieToolName - we should also respect different tools // in NodeToolEntry and LinkToolEntry (right now there's hardcoded name of the tool) if (toolEntry.getQualifiedToolName() != null && toolEntry.getQualifiedToolName().trim().length() > 0 ) { - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_91); stringBuffer.append(importManager.getImportedName(toolEntry.getQualifiedToolName())); - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_92); } /*tool class presence*/ - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_93); if (!toolEntry.getProperties().isEmpty()) { for (Iterator it = toolEntry.getProperties().entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_94); stringBuffer.append(entry.getKey()); - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_95); stringBuffer.append(entry.getValue()); - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_96); } /*properties iterator*/ } /*properties presence check*/ - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_97); } /*for*/ - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_98); if (hasNodeEntries) { - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_99); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.palette.CombinedTemplateCreationEntry")); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_100); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.ModelCreationFactory")); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_101); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_102); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.CreateRequestEx")); - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_103); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.CreateRequestEx")); - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_104); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_105); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_108); + stringBuffer.append(TEXT_106); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_109); + stringBuffer.append(TEXT_107); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); - stringBuffer.append(TEXT_110); + stringBuffer.append(TEXT_108); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.RequestConstants")); - stringBuffer.append(TEXT_111); + stringBuffer.append(TEXT_109); } /*if (hasNodeEntries)*/ if (hasLinkEntries) { - stringBuffer.append(TEXT_112); + stringBuffer.append(TEXT_110); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.ModelCreationFactory")); - stringBuffer.append(TEXT_113); + stringBuffer.append(TEXT_111); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")); - stringBuffer.append(TEXT_114); + stringBuffer.append(TEXT_112); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx")); - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_113); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx")); - stringBuffer.append(TEXT_116); + stringBuffer.append(TEXT_114); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_117); + stringBuffer.append(TEXT_115); } /*if (hasLinkEntries)*/ - stringBuffer.append(TEXT_118); + stringBuffer.append(TEXT_116); importManager.emitSortedImports(); - stringBuffer.append(TEXT_119); + stringBuffer.append(TEXT_117); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/VisualIDRegistryGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/VisualIDRegistryGenerator.java index 381453bd0..ae585fd6c 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/VisualIDRegistryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/VisualIDRegistryGenerator.java @@ -17,115 +17,113 @@ public class VisualIDRegistryGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = 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. Note that it only returns semantically complete objects (those who must have an element associated with them)." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; - protected final String TEXT_6 = " INSTANCE = new "; - protected final String TEXT_7 = "();" + 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\t"; - protected final String TEXT_11 = ".getInstance().logInfo(\"Unable to parse view type as a visualID number: \" + type);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getType(int visualID) {" + NL + "\t\treturn String.valueOf(visualID);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic 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 + "\tpublic 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 = "().equals(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 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);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!"; - protected final String TEXT_19 = ".MODEL_ID.equals(containerModelID)) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif ("; - protected final String TEXT_20 = ".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_21 = ".VISUAL_ID;" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tswitch (containerVisualID) {"; - protected final String TEXT_22 = NL + "\t\tcase "; - protected final String TEXT_23 = ".VISUAL_ID:"; - protected final String TEXT_24 = NL + "\t\t\tif ("; - protected final String TEXT_25 = ".eINSTANCE.get"; - protected final String TEXT_26 = "().isSuperTypeOf(domainElementMetaclass) && isNode"; - protected final String TEXT_27 = "(("; - protected final String TEXT_28 = ") domainElement)) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_29 = ".VISUAL_ID;" + NL + "\t\t\t}"; - protected final String TEXT_30 = NL + "\t\t\treturn getUnrecognized"; - protected final String TEXT_31 = "ChildNodeID(domainElement);"; - protected final String TEXT_32 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + 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 int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; - protected final String TEXT_33 = NL + "\t\tif ("; - protected final String TEXT_34 = ".eINSTANCE.get"; - protected final String TEXT_35 = "().isSuperTypeOf(domainElementMetaclass) && isLinkWithClass"; - protected final String TEXT_36 = "(("; - protected final String TEXT_37 = ") domainElement)) {" + NL + "\t\t\treturn "; - protected final String TEXT_38 = ".VISUAL_ID;" + NL + "\t\t}"; - protected final String TEXT_39 = NL + "\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t}" + NL; - protected final String TEXT_40 = 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 boolean isDiagram"; - protected final String TEXT_41 = "("; - protected final String TEXT_42 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; - protected final String TEXT_43 = 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 int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL; - protected final String TEXT_44 = 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 boolean isNode"; - protected final String TEXT_45 = "("; - protected final String TEXT_46 = " element) {" + NL + "\t\treturn "; - protected final String TEXT_47 = ".matches(element)"; - protected final String TEXT_48 = "true"; - protected final String TEXT_49 = ";" + NL + "\t}"; - protected final String TEXT_50 = 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 int getUnrecognized"; - protected final String TEXT_51 = "ChildNodeID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_52 = 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 int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL; - protected final String TEXT_53 = 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 boolean isLinkWithClass"; - protected final String TEXT_54 = "("; - protected final String TEXT_55 = " element) {" + NL + "\t\treturn "; - protected final String TEXT_56 = ".matches(element)"; - protected final String TEXT_57 = "true"; - protected final String TEXT_58 = ";" + NL + "\t}"; - protected final String TEXT_59 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final "; - protected final String TEXT_60 = " "; - protected final String TEXT_61 = " = new "; - protected final String TEXT_62 = "("; - protected final String TEXT_63 = "null"; - protected final String TEXT_64 = "."; - protected final String TEXT_65 = "("; - protected final String TEXT_66 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_67 = ", "; - protected final String TEXT_68 = ")"; - protected final String TEXT_69 = "."; - protected final String TEXT_70 = "("; - protected final String TEXT_71 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_72 = ")"; - protected final String TEXT_73 = "new "; - protected final String TEXT_74 = "("; - protected final String TEXT_75 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_76 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_77 = " self = ("; - protected final String TEXT_78 = ")context;"; - protected final String TEXT_79 = "\t" + NL + "\t\t"; - protected final String TEXT_80 = " "; - protected final String TEXT_81 = " = ("; - protected final String TEXT_82 = ")env.get(\""; - protected final String TEXT_83 = "\"); //$NON-NLS-1$"; - protected final String TEXT_84 = NL + "\t\treturn "; - protected final String TEXT_85 = "."; - protected final String TEXT_86 = "(self"; - protected final String TEXT_87 = ", "; - protected final String TEXT_88 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_89 = NL + ");"; - protected final String TEXT_90 = "\t\t\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic class "; - protected final String TEXT_91 = " {" + 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_92 = " 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_93 = "("; - protected final String TEXT_94 = " 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_95 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private static class "; - protected final String TEXT_96 = " {"; - protected final String TEXT_97 = NL; - protected final String TEXT_98 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_99 = " "; - protected final String TEXT_100 = "("; - protected final String TEXT_101 = " self"; - protected final String TEXT_102 = ", "; - protected final String TEXT_103 = " "; - protected final String TEXT_104 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_105 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_106 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_107 = NL + "\t}// "; - protected final String TEXT_108 = NL + "}" + NL + "\t"; - protected final String TEXT_109 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = 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. Note that it only returns semantically complete objects (those who must have an element associated with them)." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_4 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; + protected final String TEXT_5 = " INSTANCE = new "; + 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 + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getType(int visualID) {" + NL + "\t\treturn String.valueOf(visualID);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic 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 + "\tpublic 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 = "().equals(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 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);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!"; + protected final String TEXT_18 = ".MODEL_ID.equals(containerModelID)) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif ("; + protected final String TEXT_19 = ".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_20 = ".VISUAL_ID;" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tswitch (containerVisualID) {"; + protected final String TEXT_21 = NL + "\t\tcase "; + protected final String TEXT_22 = ".VISUAL_ID:"; + protected final String TEXT_23 = NL + "\t\t\tif ("; + protected final String TEXT_24 = ".eINSTANCE.get"; + protected final String TEXT_25 = "().isSuperTypeOf(domainElementMetaclass) && isNode"; + protected final String TEXT_26 = "(("; + protected final String TEXT_27 = ") domainElement)) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_28 = ".VISUAL_ID;" + NL + "\t\t\t}"; + protected final String TEXT_29 = NL + "\t\t\treturn getUnrecognized"; + protected final String TEXT_30 = "ChildNodeID(domainElement);"; + protected final String TEXT_31 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tif (domainElement == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + 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 int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; + protected final String TEXT_32 = NL + "\t\tif ("; + protected final String TEXT_33 = ".eINSTANCE.get"; + protected final String TEXT_34 = "().isSuperTypeOf(domainElementMetaclass) && isLinkWithClass"; + protected final String TEXT_35 = "(("; + protected final String TEXT_36 = ") domainElement)) {" + NL + "\t\t\treturn "; + protected final String TEXT_37 = ".VISUAL_ID;" + NL + "\t\t}"; + protected final String TEXT_38 = NL + "\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t}" + NL; + protected final String TEXT_39 = 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 boolean isDiagram"; + protected final String TEXT_40 = "("; + protected final String TEXT_41 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; + protected final String TEXT_42 = 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 int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL; + protected final String TEXT_43 = 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 boolean isNode"; + protected final String TEXT_44 = "("; + protected final String TEXT_45 = " element) {" + NL + "\t\treturn "; + protected final String TEXT_46 = ".matches(element)"; + protected final String TEXT_47 = "true"; + protected final String TEXT_48 = ";" + NL + "\t}"; + protected final String TEXT_49 = 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 int getUnrecognized"; + protected final String TEXT_50 = "ChildNodeID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_51 = 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 int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL; + protected final String TEXT_52 = 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 boolean isLinkWithClass"; + protected final String TEXT_53 = "("; + protected final String TEXT_54 = " element) {" + NL + "\t\treturn "; + protected final String TEXT_55 = ".matches(element)"; + protected final String TEXT_56 = "true"; + protected final String TEXT_57 = ";" + NL + "\t}"; + protected final String TEXT_58 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final "; + protected final String TEXT_59 = " "; + protected final String TEXT_60 = " = new "; + protected final String TEXT_61 = "("; + protected final String TEXT_62 = "null"; + protected final String TEXT_63 = "."; + protected final String TEXT_64 = "("; + protected final String TEXT_65 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_66 = ", "; + protected final String TEXT_67 = ")"; + protected final String TEXT_68 = "."; + protected final String TEXT_69 = "("; + protected final String TEXT_70 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_71 = ")"; + protected final String TEXT_72 = "new "; + protected final String TEXT_73 = "("; + protected final String TEXT_74 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_75 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_76 = " self = ("; + protected final String TEXT_77 = ")context;"; + protected final String TEXT_78 = "\t" + NL + "\t\t"; + protected final String TEXT_79 = " "; + protected final String TEXT_80 = " = ("; + protected final String TEXT_81 = ")env.get(\""; + protected final String TEXT_82 = "\"); //$NON-NLS-1$"; + protected final String TEXT_83 = NL + "\t\treturn "; + protected final String TEXT_84 = "."; + protected final String TEXT_85 = "(self"; + protected final String TEXT_86 = ", "; + protected final String TEXT_87 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_88 = NL + ");"; + protected final String TEXT_89 = "\t\t\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic class "; + protected final String TEXT_90 = " {" + 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_91 = " 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_92 = "("; + protected final String TEXT_93 = " 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_94 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private static class "; + protected final String TEXT_95 = " {"; + protected final String TEXT_96 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_97 = " "; + protected final String TEXT_98 = "("; + protected final String TEXT_99 = " self"; + protected final String TEXT_100 = ", "; + protected final String TEXT_101 = " "; + protected final String TEXT_102 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_103 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_104 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_105 = NL + "\t}// "; + protected final String TEXT_106 = NL + "}" + NL + "\t"; + protected final String TEXT_107 = NL; public String generate(Object argument) { @@ -134,14 +132,13 @@ public class VisualIDRegistryGenerator final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); @@ -157,45 +154,45 @@ importManager.addImport("org.eclipse.gmf.runtime.notation.Diagram"); importManager.markImportLocation(stringBuffer); + stringBuffer.append(TEXT_3); + stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); stringBuffer.append(TEXT_4); stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); stringBuffer.append(TEXT_5); stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); stringBuffer.append(TEXT_6); - stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); if (genDiagram.getDomainDiagramElement() != null) { /*we do not support diagrams without domain elements in other places, but keep this copy-pasted occurrence*/ String classifierAccessorName = genDiagram.getDomainDiagramElement().getClassifierAccessorName(); String interfaceName = importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); stringBuffer.append(genDiagram.getMetaPackageName(importManager)); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); stringBuffer.append(classifierAccessorName); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); stringBuffer.append(genDiagram.getUniqueIdentifier()); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); } + stringBuffer.append(TEXT_17); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_20); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_21); List nodeContainers = genDiagram.getAllContainers(); for(Iterator it = nodeContainers.iterator(); it.hasNext(); ) { @@ -204,9 +201,9 @@ for(Iterator it = nodeContainers.iterator(); it.hasNext(); ) { continue; } - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName(nextContainer.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); for (Iterator childNodes = nextContainer.getContainedNodes().iterator(); childNodes.hasNext(); ) { GenNode childNode = (GenNode) childNodes.next(); @@ -214,27 +211,27 @@ for(Iterator it = nodeContainers.iterator(); it.hasNext(); ) { final String interfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getQualifiedInterfaceName()); final String semanticPackageInterfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); stringBuffer.append(semanticPackageInterfaceName); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); stringBuffer.append(classifierAccessorName); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(childNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_28); } - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_29); stringBuffer.append(nextContainer.getUniqueIdentifier()); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); } - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { GenLink genLink = (GenLink) it.next(); @@ -244,30 +241,30 @@ for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { final String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName()); final String semanticPackageInterfaceName = importManager.getImportedName(modelFacet.getMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); stringBuffer.append(semanticPackageInterfaceName); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); stringBuffer.append(semanticLinkInterfaceName); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName(genLink.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_37); } } - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_38); if (genDiagram.getDomainDiagramElement() != null) { - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_39); stringBuffer.append(genDiagram.getUniqueIdentifier()); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_41); } - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_42); for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) { GenNode nextNode = (GenNode) nodes.next(); @@ -277,18 +274,18 @@ for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) { String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName()); boolean callMatcher = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null; - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); stringBuffer.append(nextNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); stringBuffer.append(childNodeInterfaceName); - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); if (callMatcher) { stringBuffer.append(nextNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); } else { - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); } - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); } for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) { @@ -297,13 +294,13 @@ for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) { continue; } - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_49); stringBuffer.append(nextContainer.getUniqueIdentifier()); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); } - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { GenLink genLink = (GenLink) it.next(); @@ -312,18 +309,18 @@ for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName()); boolean callMatcher = modelFacet.getModelElementSelector() != null; - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); if (callMatcher) { stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_55); } else { - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_56); } - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_57); } } @@ -361,13 +358,13 @@ for (Iterator it = genDiagram.eAllContents(); it.hasNext() && expressionProvider javaSelectorFacets.add(modelFacet); } - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); stringBuffer.append(matcherClassName); - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_59); stringBuffer.append(id); - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_60); stringBuffer.append(matcherClassName); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); { /*begin the scope*/ /* @@ -383,7 +380,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -392,26 +389,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_68); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -419,71 +416,71 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(TEXT_75); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_76); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_77); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_78); 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_79); + stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_79); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_81); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_82); } - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_83); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_84); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_85); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_86); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_87); } } /*end of scope*/ - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_88); } /* end of selector interation */ if(selectorCounter > 0) { - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_89); stringBuffer.append(matcherClassName); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_90); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_91); stringBuffer.append(matcherClassName); - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_92); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_93); stringBuffer.append(matcherClassName); if(!javaSelectorFacets.isEmpty()) { - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_94); stringBuffer.append(javaMatcherContainer); - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_95); for(Iterator it = javaSelectorFacets.iterator(); it.hasNext();) { TypeModelFacet modelFacet = (TypeModelFacet) it.next(); @@ -491,7 +488,6 @@ if(selectorCounter > 0) { GenClassifier __genExprContext = modelFacet.getMetaClass(); String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$ - stringBuffer.append(TEXT_97); /* ValueExpression __genValueExpression @@ -512,13 +508,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_98); + stringBuffer.append(TEXT_96); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_97); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_98); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_99); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -526,32 +522,32 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_100); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_101); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_102); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_103); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_104); } /* end of GenJavaExpressionProvider */ } /* java javaSelectorFacets iteration */ - stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_105); stringBuffer.append(javaMatcherContainer); } /* !javaSelectorFacets.isEmpty() */ } /* selectorCounter > 0 */ - stringBuffer.append(TEXT_108); + stringBuffer.append(TEXT_106); importManager.emitSortedImports(); - stringBuffer.append(TEXT_109); + stringBuffer.append(TEXT_107); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorActionProviderGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorActionProviderGenerator.java index 7e9ddd842..dca053109 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorActionProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorActionProviderGenerator.java @@ -15,54 +15,53 @@ public class NavigatorActionProviderGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL; - protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " extends "; - protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myContribute;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate OpenDiagramAction myOpenDiagramAction;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init("; - protected final String TEXT_8 = " aSite) {" + NL + "\t\tsuper.init(aSite);" + NL + "\t\tif (aSite.getViewSite() instanceof "; - protected final String TEXT_9 = ") {" + NL + "\t\t\tmyContribute = true;" + NL + "\t\t\tmakeActions(("; - protected final String TEXT_10 = ") aSite.getViewSite());" + NL + "\t\t} else {" + NL + "\t\t\tmyContribute = false;" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void makeActions("; - protected final String TEXT_11 = " viewerSite) {" + NL + "\t\tmyOpenDiagramAction = new OpenDiagramAction(viewerSite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillActionBars("; - protected final String TEXT_12 = " actionBars) {" + NL + "\t\tif (!myContribute) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_13 = " selection = ("; - protected final String TEXT_14 = ") getContext().getSelection();" + NL + "\t\tmyOpenDiagramAction.selectionChanged(selection);" + NL + "\t\tif (myOpenDiagramAction.isEnabled()) {" + NL + "\t\t\tactionBars.setGlobalActionHandler("; - protected final String TEXT_15 = ".OPEN, myOpenDiagramAction);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillContextMenu("; - protected final String TEXT_16 = " menu) {"; - protected final String TEXT_17 = "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OpenDiagramAction extends "; - protected final String TEXT_18 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_19 = " myDiagram;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_20 = " myViewerSite;" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic OpenDiagramAction("; - protected final String TEXT_21 = " viewerSite) {" + NL + "\t\t\tsuper(\"Open Diagram\");" + NL + "\t\t\tmyViewerSite = viewerSite;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic final void selectionChanged("; - protected final String TEXT_22 = " selection) {" + NL + "\t\t\tmyDiagram = null;" + NL + "\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\tif (selectedElement instanceof "; - protected final String TEXT_23 = ") {" + NL + "\t\t\t\t\tselectedElement = (("; - protected final String TEXT_24 = ") selectedElement).getView();" + NL + "\t\t\t\t} else if (selectedElement instanceof "; - protected final String TEXT_25 = ") {" + NL + "\t\t\t\t\tselectedElement = (("; - protected final String TEXT_26 = ") selectedElement).getAdapter("; - protected final String TEXT_27 = ".class);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (selectedElement instanceof "; - protected final String TEXT_28 = ") {" + NL + "\t\t\t\t\t"; - protected final String TEXT_29 = " diagram = ("; - protected final String TEXT_30 = ") selectedElement;" + NL + "\t\t\t\t\tif ("; - protected final String TEXT_31 = ".MODEL_ID.equals("; - protected final String TEXT_32 = ".getModelID(diagram))) {" + NL + "\t\t\t\t\t\tmyDiagram = diagram;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetEnabled(myDiagram != null);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (myDiagram == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_33 = " page = myViewerSite.getPage();"; - protected final String TEXT_34 = NL + "\t\t\t"; - protected final String TEXT_35 = " editorInput = new "; - protected final String TEXT_36 = "("; - protected final String TEXT_37 = ".getURI(myDiagram));" + NL + "\t\t \ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, "; - protected final String TEXT_38 = ".ID);" + NL + "\t\t\t} catch ("; - protected final String TEXT_39 = " e) {" + NL + "\t\t\t\t"; - protected final String TEXT_40 = ".getInstance().logError(\"Exception while opening diagram\", e);" + NL + "\t\t\t}"; - protected final String TEXT_41 = NL + "\t\t\ttry {" + NL + "\t\t\t\t"; - protected final String TEXT_42 = " diagramView = ("; - protected final String TEXT_43 = ")page.showView("; - protected final String TEXT_44 = ".ID);" + NL + "\t\t\t\tdiagramView.showDiagram(null, "; - protected final String TEXT_45 = ".getURI(myDiagram));" + NL + "\t\t\t} catch ("; - protected final String TEXT_46 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; - protected final String TEXT_47 = NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_48 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL; + protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_5 = " extends "; + protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myContribute;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate OpenDiagramAction myOpenDiagramAction;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init("; + protected final String TEXT_7 = " aSite) {" + NL + "\t\tsuper.init(aSite);" + NL + "\t\tif (aSite.getViewSite() instanceof "; + protected final String TEXT_8 = ") {" + NL + "\t\t\tmyContribute = true;" + NL + "\t\t\tmakeActions(("; + protected final String TEXT_9 = ") aSite.getViewSite());" + NL + "\t\t} else {" + NL + "\t\t\tmyContribute = false;" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void makeActions("; + protected final String TEXT_10 = " viewerSite) {" + NL + "\t\tmyOpenDiagramAction = new OpenDiagramAction(viewerSite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillActionBars("; + protected final String TEXT_11 = " actionBars) {" + NL + "\t\tif (!myContribute) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_12 = " selection = ("; + protected final String TEXT_13 = ") getContext().getSelection();" + NL + "\t\tmyOpenDiagramAction.selectionChanged(selection);" + NL + "\t\tif (myOpenDiagramAction.isEnabled()) {" + NL + "\t\t\tactionBars.setGlobalActionHandler("; + protected final String TEXT_14 = ".OPEN, myOpenDiagramAction);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillContextMenu("; + protected final String TEXT_15 = " menu) {"; + protected final String TEXT_16 = "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OpenDiagramAction extends "; + protected final String TEXT_17 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_18 = " myDiagram;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_19 = " myViewerSite;" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic OpenDiagramAction("; + protected final String TEXT_20 = " viewerSite) {" + NL + "\t\t\tsuper(\"Open Diagram\");" + NL + "\t\t\tmyViewerSite = viewerSite;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic final void selectionChanged("; + protected final String TEXT_21 = " selection) {" + NL + "\t\t\tmyDiagram = null;" + NL + "\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\tif (selectedElement instanceof "; + protected final String TEXT_22 = ") {" + NL + "\t\t\t\t\tselectedElement = (("; + protected final String TEXT_23 = ") selectedElement).getView();" + NL + "\t\t\t\t} else if (selectedElement instanceof "; + protected final String TEXT_24 = ") {" + NL + "\t\t\t\t\tselectedElement = (("; + protected final String TEXT_25 = ") selectedElement).getAdapter("; + protected final String TEXT_26 = ".class);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (selectedElement instanceof "; + protected final String TEXT_27 = ") {" + NL + "\t\t\t\t\t"; + protected final String TEXT_28 = " diagram = ("; + protected final String TEXT_29 = ") selectedElement;" + NL + "\t\t\t\t\tif ("; + protected final String TEXT_30 = ".MODEL_ID.equals("; + protected final String TEXT_31 = ".getModelID(diagram))) {" + NL + "\t\t\t\t\t\tmyDiagram = diagram;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetEnabled(myDiagram != null);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (myDiagram == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_32 = " page = myViewerSite.getPage();"; + protected final String TEXT_33 = NL + "\t\t\t"; + protected final String TEXT_34 = " editorInput = new "; + protected final String TEXT_35 = "("; + protected final String TEXT_36 = ".getURI(myDiagram));" + NL + "\t\t \ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, "; + protected final String TEXT_37 = ".ID);" + NL + "\t\t\t} catch ("; + protected final String TEXT_38 = " e) {" + NL + "\t\t\t\t"; + protected final String TEXT_39 = ".getInstance().logError(\"Exception while opening diagram\", e);" + NL + "\t\t\t}"; + protected final String TEXT_40 = NL + "\t\t\ttry {" + NL + "\t\t\t\t"; + protected final String TEXT_41 = " diagramView = ("; + protected final String TEXT_42 = ")page.showView("; + protected final String TEXT_43 = ".ID);" + NL + "\t\t\t\tdiagramView.showDiagram(null, "; + protected final String TEXT_44 = ".getURI(myDiagram));" + NL + "\t\t\t} catch ("; + protected final String TEXT_45 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; + protected final String TEXT_46 = NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}"; + protected final String TEXT_47 = NL; public String generate(Object argument) { @@ -73,41 +72,40 @@ GenDiagram genDiagram = genNavigator.getEditorGen().getDiagram(); final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; importManager.registerInnerClass("OpenFileAction"); - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(genNavigator.getActionProviderClassName()); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.CommonActionProvider")); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonActionExtensionSite")); + stringBuffer.append(TEXT_7); + stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); stringBuffer.append(TEXT_10); - stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); - stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IActionBars")); + stringBuffer.append(TEXT_11); + stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); stringBuffer.append(TEXT_13); - stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonActionConstants")); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); /* * Put following code into the template to generate popup menu @@ -122,75 +120,75 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { if (myOpenDiagramAction.isEnabled()) { menu.insertAfter(< %=importManager.getImportedName("org.eclipse.ui.navigator.ICommonMenuConstants")% >.GROUP_OPEN, myOpenDiagramAction); }*/ - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Action")); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); + stringBuffer.append(TEXT_18); + stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); stringBuffer.append(TEXT_20); - stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite")); - stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); + stringBuffer.append(TEXT_21); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_23); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); + stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); stringBuffer.append(TEXT_25); - stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); + stringBuffer.append(TEXT_26); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_29); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPage")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_37); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_39); } else { + stringBuffer.append(TEXT_40); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_41); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_42); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); - stringBuffer.append(TEXT_43); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); } - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); importManager.emitSortedImports(); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorLabelProviderGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorLabelProviderGenerator.java index 646b876b0..30fed5318 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorLabelProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/navigator/NavigatorLabelProviderGenerator.java @@ -18,127 +18,125 @@ public class NavigatorLabelProviderGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = "(("; + protected final String TEXT_4 = ")"; protected final String TEXT_5 = "(("; protected final String TEXT_6 = ")"; - protected final String TEXT_7 = "(("; - protected final String TEXT_8 = ")"; - protected final String TEXT_9 = ")"; - protected final String TEXT_10 = ".eGet("; - protected final String TEXT_11 = ".eINSTANCE.get"; - protected final String TEXT_12 = "())"; + protected final String TEXT_7 = ")"; + protected final String TEXT_8 = ".eGet("; + protected final String TEXT_9 = ".eINSTANCE.get"; + protected final String TEXT_10 = "())"; + protected final String TEXT_11 = ")"; + protected final String TEXT_12 = "(("; protected final String TEXT_13 = ")"; - protected final String TEXT_14 = "(("; - protected final String TEXT_15 = ")"; - protected final String TEXT_16 = ")"; - protected final String TEXT_17 = "."; - protected final String TEXT_18 = "()"; - protected final String TEXT_19 = NL; - protected final String TEXT_20 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_21 = " extends "; - protected final String TEXT_22 = " implements "; - protected final String TEXT_23 = ", "; - protected final String TEXT_24 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic {" + NL + "\t\t"; - protected final String TEXT_25 = ".getInstance().getImageRegistry().put(\""; - protected final String TEXT_26 = "\", "; - protected final String TEXT_27 = ".getMissingImageDescriptor());" + NL + "\t\t"; - protected final String TEXT_28 = ".getInstance().getImageRegistry().put(\""; - protected final String TEXT_29 = "\", "; - protected final String TEXT_30 = ".getMissingImageDescriptor());" + NL + "\t\t"; - protected final String TEXT_31 = ".getInstance().getImageRegistry().put(\""; - protected final String TEXT_32 = "\", "; - protected final String TEXT_33 = ".getMissingImageDescriptor());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void updateLabel("; - protected final String TEXT_34 = " label, "; - protected final String TEXT_35 = " elementPath) {" + NL + "\t\tObject element = elementPath.getLastSegment();" + NL + "\t\tif (element instanceof "; - protected final String TEXT_36 = " && !isOwnView((("; - protected final String TEXT_37 = ") element).getView())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tlabel.setText(getText(element));" + NL + "\t\tlabel.setImage(getImage(element));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_38 = " getImage(Object element) {" + NL + "\t\tif (element instanceof "; - protected final String TEXT_39 = ") {" + NL + "\t\t\t"; - protected final String TEXT_40 = " group = ("; - protected final String TEXT_41 = ") element;" + NL + "\t\t\treturn "; - protected final String TEXT_42 = ".getInstance().getBundledImage(group.getIcon());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof "; - protected final String TEXT_43 = ") {" + NL + "\t\t\t"; - protected final String TEXT_44 = " navigatorItem = ("; - protected final String TEXT_45 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn super.getImage(element);" + NL + " \t\t}" + NL + " \t\treturn getImage(navigatorItem.getView());" + NL + "\t\t}" + NL; - protected final String TEXT_46 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof "; - protected final String TEXT_47 = ") {" + NL + "\t\t\t"; - protected final String TEXT_48 = " view = ("; - protected final String TEXT_49 = ") (("; - protected final String TEXT_50 = ") element).getAdapter("; - protected final String TEXT_51 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getImage(view);" + NL + "\t\t\t}" + NL + "\t\t}"; - protected final String TEXT_52 = NL + "\t\treturn super.getImage(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_53 = " getImage("; - protected final String TEXT_54 = " view) {" + NL + "\t\tswitch ("; - protected final String TEXT_55 = ".getVisualID(view)) {"; - protected final String TEXT_56 = NL + "\t\tcase "; - protected final String TEXT_57 = ".VISUAL_ID: {"; - protected final String TEXT_58 = NL + "\t\t\t"; - protected final String TEXT_59 = " target = (("; - protected final String TEXT_60 = ") view).getTarget();" + NL + "\t\t\t"; - protected final String TEXT_61 = " underlyingElement = target == null ? null : target.getElement();"; - protected final String TEXT_62 = NL + "\t\t\treturn getImage(\""; - protected final String TEXT_63 = "\", "; - protected final String TEXT_64 = ");" + NL + "\t\t}"; - protected final String TEXT_65 = NL + "\t\tdefault:" + NL + "\t\t\treturn getImage(\""; - protected final String TEXT_66 = "\", null);" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_67 = " getImage(String key, "; - protected final String TEXT_68 = " object) {" + NL + "\t\t"; - protected final String TEXT_69 = " imageRegistry = "; - protected final String TEXT_70 = ".getInstance().getImageRegistry();" + NL + "\t\t"; - protected final String TEXT_71 = " image = imageRegistry.get(key);" + NL + "\t\tif (image == null && object != null) {" + NL + "\t\t\timage = "; - protected final String TEXT_72 = ".getInstance().getItemImage(object);" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\tif (image == null) {" + NL + "\t\t\timage = imageRegistry.get(\""; - protected final String TEXT_73 = "\");" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(Object element) {" + NL + "\t\tif (element instanceof "; - protected final String TEXT_74 = ") {" + NL + "\t\t\t"; - protected final String TEXT_75 = " group = ("; - protected final String TEXT_76 = ") element;" + NL + "\t\t\treturn group.getGroupName();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof "; - protected final String TEXT_77 = ") {" + NL + "\t\t\t"; - protected final String TEXT_78 = " navigatorItem = ("; - protected final String TEXT_79 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn null;" + NL + " \t\t}" + NL + " \t\treturn getText(navigatorItem.getView());" + NL + "\t\t}" + NL + "\t"; - protected final String TEXT_80 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof "; - protected final String TEXT_81 = ") {" + NL + "\t\t\t"; - protected final String TEXT_82 = " view = ("; - protected final String TEXT_83 = ") (("; - protected final String TEXT_84 = ") element).getAdapter("; - protected final String TEXT_85 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getText(view);" + NL + "\t\t\t}" + NL + "\t\t}"; - protected final String TEXT_86 = NL + "\t\treturn super.getText(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText("; - protected final String TEXT_87 = " view) {" + NL + "\t\tif (view.getElement() != null && view.getElement().eIsProxy()) {" + NL + "\t\t\treturn getUnresolvedDomainElementProxyText(view);" + NL + "\t\t}" + NL + "\t\tswitch ("; - protected final String TEXT_88 = ".getVisualID(view)) {"; - protected final String TEXT_89 = NL + "\t\tcase "; - protected final String TEXT_90 = ".VISUAL_ID:" + NL + "\t\t\treturn get"; - protected final String TEXT_91 = "Text(view);"; - protected final String TEXT_92 = NL + "\t\tdefault:" + NL + "\t\t\treturn getUnknownElementText(view);" + NL + "\t\t}" + NL + "\t}" + NL; - protected final String TEXT_93 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String get"; - protected final String TEXT_94 = "Text("; - protected final String TEXT_95 = " view) {"; - protected final String TEXT_96 = NL + "\t\t"; - protected final String TEXT_97 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement == null) {" + NL + "\t\t\treturn \"\";" + NL + "\t\t}" + NL + "\t\tString result = "; - protected final String TEXT_98 = ".LABEL_DISPLAYER.getDisplayText(domainModelElement);" + NL + "\t\tif (result == null) {" + NL + "\t\t\treturn \"\";" + NL + "\t\t}" + NL + "\t\treturn result;"; - protected final String TEXT_99 = NL + "\t\treturn \"\";"; - protected final String TEXT_100 = NL + "\t\treturn \""; - protected final String TEXT_101 = "\";"; - protected final String TEXT_102 = NL + "\t\t"; - protected final String TEXT_103 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement != null) {" + NL + "\t\t\treturn "; - protected final String TEXT_104 = "String.valueOf("; - protected final String TEXT_105 = "(String) "; - protected final String TEXT_106 = ")"; - protected final String TEXT_107 = ";" + NL + "\t\t} else {" + NL + "\t\t\t"; - protected final String TEXT_108 = ".getInstance().logError(\"No domain element for view with visualID = \" + "; - protected final String TEXT_109 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}"; - protected final String TEXT_110 = NL + "\t\treturn \"\";"; - protected final String TEXT_111 = NL + "\t}"; - protected final String TEXT_112 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnknownElementText("; - protected final String TEXT_113 = " view) {" + NL + "\t\treturn \"<UnknownElement Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnresolvedDomainElementProxyText("; - protected final String TEXT_114 = " view) {" + NL + "\t\treturn \"<Unresolved domain element Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init("; - protected final String TEXT_115 = " aConfig) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void restoreState("; - protected final String TEXT_116 = " aMemento) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void saveState("; - protected final String TEXT_117 = " aMemento) {" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getDescription(Object anElement) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isOwnView("; - protected final String TEXT_118 = " view) {" + NL + "\t\treturn "; - protected final String TEXT_119 = ".MODEL_ID.equals("; - protected final String TEXT_120 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_121 = NL; + protected final String TEXT_14 = ")"; + protected final String TEXT_15 = "."; + protected final String TEXT_16 = "()"; + protected final String TEXT_17 = NL; + protected final String TEXT_18 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_19 = " extends "; + protected final String TEXT_20 = " implements "; + protected final String TEXT_21 = ", "; + protected final String TEXT_22 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic {" + NL + "\t\t"; + protected final String TEXT_23 = ".getInstance().getImageRegistry().put(\""; + protected final String TEXT_24 = "\", "; + protected final String TEXT_25 = ".getMissingImageDescriptor());" + NL + "\t\t"; + protected final String TEXT_26 = ".getInstance().getImageRegistry().put(\""; + protected final String TEXT_27 = "\", "; + protected final String TEXT_28 = ".getMissingImageDescriptor());" + NL + "\t\t"; + protected final String TEXT_29 = ".getInstance().getImageRegistry().put(\""; + protected final String TEXT_30 = "\", "; + protected final String TEXT_31 = ".getMissingImageDescriptor());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void updateLabel("; + protected final String TEXT_32 = " label, "; + protected final String TEXT_33 = " elementPath) {" + NL + "\t\tObject element = elementPath.getLastSegment();" + NL + "\t\tif (element instanceof "; + protected final String TEXT_34 = " && !isOwnView((("; + protected final String TEXT_35 = ") element).getView())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tlabel.setText(getText(element));" + NL + "\t\tlabel.setImage(getImage(element));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_36 = " getImage(Object element) {" + NL + "\t\tif (element instanceof "; + protected final String TEXT_37 = ") {" + NL + "\t\t\t"; + protected final String TEXT_38 = " group = ("; + protected final String TEXT_39 = ") element;" + NL + "\t\t\treturn "; + protected final String TEXT_40 = ".getInstance().getBundledImage(group.getIcon());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof "; + protected final String TEXT_41 = ") {" + NL + "\t\t\t"; + protected final String TEXT_42 = " navigatorItem = ("; + protected final String TEXT_43 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn super.getImage(element);" + NL + " \t\t}" + NL + " \t\treturn getImage(navigatorItem.getView());" + NL + "\t\t}" + NL; + protected final String TEXT_44 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof "; + protected final String TEXT_45 = ") {" + NL + "\t\t\t"; + protected final String TEXT_46 = " view = ("; + protected final String TEXT_47 = ") (("; + protected final String TEXT_48 = ") element).getAdapter("; + protected final String TEXT_49 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getImage(view);" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_50 = NL + "\t\treturn super.getImage(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_51 = " getImage("; + protected final String TEXT_52 = " view) {" + NL + "\t\tswitch ("; + protected final String TEXT_53 = ".getVisualID(view)) {"; + protected final String TEXT_54 = NL + "\t\tcase "; + protected final String TEXT_55 = ".VISUAL_ID: {"; + protected final String TEXT_56 = NL + "\t\t\t"; + protected final String TEXT_57 = " target = (("; + protected final String TEXT_58 = ") view).getTarget();" + NL + "\t\t\t"; + protected final String TEXT_59 = " underlyingElement = target == null ? null : target.getElement();"; + protected final String TEXT_60 = NL + "\t\t\treturn getImage(\""; + protected final String TEXT_61 = "\", "; + protected final String TEXT_62 = ");" + NL + "\t\t}"; + protected final String TEXT_63 = NL + "\t\tdefault:" + NL + "\t\t\treturn getImage(\""; + protected final String TEXT_64 = "\", null);" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_65 = " getImage(String key, "; + protected final String TEXT_66 = " object) {" + NL + "\t\t"; + protected final String TEXT_67 = " imageRegistry = "; + protected final String TEXT_68 = ".getInstance().getImageRegistry();" + NL + "\t\t"; + protected final String TEXT_69 = " image = imageRegistry.get(key);" + NL + "\t\tif (image == null && object != null) {" + NL + "\t\t\timage = "; + protected final String TEXT_70 = ".getInstance().getItemImage(object);" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\tif (image == null) {" + NL + "\t\t\timage = imageRegistry.get(\""; + protected final String TEXT_71 = "\");" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(Object element) {" + NL + "\t\tif (element instanceof "; + protected final String TEXT_72 = ") {" + NL + "\t\t\t"; + protected final String TEXT_73 = " group = ("; + protected final String TEXT_74 = ") element;" + NL + "\t\t\treturn group.getGroupName();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof "; + protected final String TEXT_75 = ") {" + NL + "\t\t\t"; + protected final String TEXT_76 = " navigatorItem = ("; + protected final String TEXT_77 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn null;" + NL + " \t\t}" + NL + " \t\treturn getText(navigatorItem.getView());" + NL + "\t\t}" + NL + "\t"; + protected final String TEXT_78 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof "; + protected final String TEXT_79 = ") {" + NL + "\t\t\t"; + protected final String TEXT_80 = " view = ("; + protected final String TEXT_81 = ") (("; + protected final String TEXT_82 = ") element).getAdapter("; + protected final String TEXT_83 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getText(view);" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_84 = NL + "\t\treturn super.getText(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText("; + protected final String TEXT_85 = " view) {" + NL + "\t\tif (view.getElement() != null && view.getElement().eIsProxy()) {" + NL + "\t\t\treturn getUnresolvedDomainElementProxyText(view);" + NL + "\t\t}" + NL + "\t\tswitch ("; + protected final String TEXT_86 = ".getVisualID(view)) {"; + protected final String TEXT_87 = NL + "\t\tcase "; + protected final String TEXT_88 = ".VISUAL_ID:" + NL + "\t\t\treturn get"; + protected final String TEXT_89 = "Text(view);"; + protected final String TEXT_90 = NL + "\t\tdefault:" + NL + "\t\t\treturn getUnknownElementText(view);" + NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_91 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String get"; + protected final String TEXT_92 = "Text("; + protected final String TEXT_93 = " view) {"; + protected final String TEXT_94 = NL + "\t\t"; + protected final String TEXT_95 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement == null) {" + NL + "\t\t\treturn \"\";" + NL + "\t\t}" + NL + "\t\tString result = "; + protected final String TEXT_96 = ".LABEL_DISPLAYER.getDisplayText(domainModelElement);" + NL + "\t\tif (result == null) {" + NL + "\t\t\treturn \"\";" + NL + "\t\t}" + NL + "\t\treturn result;"; + protected final String TEXT_97 = NL + "\t\treturn \"\";"; + protected final String TEXT_98 = NL + "\t\treturn \""; + protected final String TEXT_99 = "\";"; + protected final String TEXT_100 = NL + "\t\t"; + protected final String TEXT_101 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement != null) {" + NL + "\t\t\treturn "; + protected final String TEXT_102 = "String.valueOf("; + protected final String TEXT_103 = "(String) "; + protected final String TEXT_104 = ")"; + protected final String TEXT_105 = ";" + NL + "\t\t} else {" + NL + "\t\t\t"; + protected final String TEXT_106 = ".getInstance().logError(\"No domain element for view with visualID = \" + "; + protected final String TEXT_107 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}"; + protected final String TEXT_108 = NL + "\t\treturn \"\";"; + protected final String TEXT_109 = NL + "\t}"; + protected final String TEXT_110 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnknownElementText("; + protected final String TEXT_111 = " view) {" + NL + "\t\treturn \"<UnknownElement Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnresolvedDomainElementProxyText("; + protected final String TEXT_112 = " view) {" + NL + "\t\treturn \"<Unresolved domain element Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init("; + protected final String TEXT_113 = " aConfig) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void restoreState("; + protected final String TEXT_114 = " aMemento) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void saveState("; + protected final String TEXT_115 = " aMemento) {" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getDescription(Object anElement) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isOwnView("; + protected final String TEXT_116 = " view) {" + NL + "\t\treturn "; + protected final String TEXT_117 = ".MODEL_ID.equals("; + protected final String TEXT_118 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "}"; + protected final String TEXT_119 = NL; public String generate(Object argument) { @@ -264,16 +262,14 @@ final class RegistryKey { } - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } - stringBuffer.append(TEXT_4); class FeatureGetAccessorHelper { /** @@ -287,16 +283,16 @@ class FeatureGetAccessorHelper { boolean needsCastToEObject = containerMetaClass != null && containerMetaClass.isExternalInterface(); if (needsCastToResultType) { - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_3); stringBuffer.append(importManager.getImportedName(feature.isListType() ? "java.util.Collection" : feature.getTypeGenClass().getQualifiedInterfaceName())); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_4); } if (needsCastToEObject) { - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_6); } @@ -304,28 +300,28 @@ class FeatureGetAccessorHelper { if (needsCastToEObject) { - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_7); } - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName(feature.getGenPackage().getQualifiedPackageInterfaceName())); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_9); stringBuffer.append(feature.getFeatureAccessorName()); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_10); if (needsCastToResultType) { - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_11); } } else { boolean needsCastToFeatureGenType = containerMetaClass == null || containerMetaClass.isExternalInterface(); if (needsCastToFeatureGenType) { - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName(feature.getGenClass().getQualifiedInterfaceName())); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_13); } @@ -333,13 +329,13 @@ class FeatureGetAccessorHelper { if (needsCastToFeatureGenType) { - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_14); } - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_15); stringBuffer.append(feature.getGetAccessor()); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_16); } } @@ -347,89 +343,89 @@ class FeatureGetAccessorHelper { final FeatureGetAccessorHelper myFeatureGetAccessorHelper = new FeatureGetAccessorHelper(); importManager.emitPackageStatement(stringBuffer); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_17); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_18); stringBuffer.append(genNavigator.getLabelProviderClassName()); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.LabelProvider")); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_20); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonLabelProvider")); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ITreePathLabelProvider")); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_23); stringBuffer.append(invalidElementKey); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_26); stringBuffer.append(unknownElementKey); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_29); stringBuffer.append(notFoundElementKey); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ViewerLabel")); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_32); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.TreePath")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_34); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); + stringBuffer.append(TEXT_36); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); + stringBuffer.append(TEXT_37); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); stringBuffer.append(TEXT_39); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_40); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_41); - stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_43); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_44); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_45); if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_45); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_46); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_47); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_48); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_49); } - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_52); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_53); for (GenCommonBase nextCommonBase : commonBaseElements) { if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) { RegistryKey registryKey = new RegistryKey(nextCommonBase); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName(nextCommonBase.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_55); String elementCode = "null"; if (nextCommonBase instanceof GenLabel) { @@ -440,13 +436,13 @@ if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite elementCode = "view.getElement()"; } else if (parent.getModelFacet() instanceof FeatureLinkModelFacet) { - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_56); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_57); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")); - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_59); elementCode = "underlyingElement"; } @@ -464,80 +460,80 @@ if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite elementCode = "view.getElement()"; } - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_60); stringBuffer.append(registryKey.getKey()); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_61); stringBuffer.append(elementCode); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_62); } } - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_63); stringBuffer.append(unknownElementKey); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_64); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_65); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_66); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageRegistry")); + stringBuffer.append(TEXT_67); + stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(TEXT_68); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); stringBuffer.append(TEXT_69); stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_70); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); + stringBuffer.append(notFoundElementKey); stringBuffer.append(TEXT_71); - stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); stringBuffer.append(TEXT_72); - stringBuffer.append(notFoundElementKey); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); stringBuffer.append(TEXT_74); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_75); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_76); stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); stringBuffer.append(TEXT_77); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_78); - stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName())); - stringBuffer.append(TEXT_79); if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_79); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_81); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_82); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_83); } - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_84); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_85); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_86); for (GenCommonBase nextCommonBase : commonBaseElements) { if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) { - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_87); stringBuffer.append(importManager.getImportedName(nextCommonBase.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_88); stringBuffer.append(nextCommonBase.getUniqueIdentifier()); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_89); } } - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_90); for (GenCommonBase nextCommonBase : commonBaseElements) { if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) { - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_91); stringBuffer.append(nextCommonBase.getUniqueIdentifier()); - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_92); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_93); LabelModelFacet labelModelFacet = null; GenCommonBase labelHolder = null; if (nextCommonBase instanceof GenChildLabelNode) { @@ -573,23 +569,23 @@ if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite /* 1. Label was detected. */ if (labelModelFacet instanceof FeatureLabelModelFacet) { - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_94); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_95); stringBuffer.append(importManager.getImportedName(labelHolder.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_96); } else { - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_97); } } else if (nextCommonBase instanceof GenCompartment) { /* 2. Compartment was detected. */ - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_98); stringBuffer.append(((GenCompartment) nextCommonBase).getTitle()); - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_99); } else { GenClass domainElement = null; if (nextCommonBase instanceof GenDiagram) { @@ -609,50 +605,50 @@ if (false && genDiagram.generateShortcutIcon()) { //no shortcuts so far in lite /* 3. Underlying domain model element recognized. */ GenFeature labelFeature = domainElement.getLabelFeature(); boolean notString = EcorePackage.eINSTANCE.getEString() != labelFeature.getEcoreFeature().getEType(); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_100); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_101); if (notString) { - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_102); } else { - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_103); } myFeatureGetAccessorHelper.appendFeatureValueGetter("domainModelElement", domainElement.getLabelFeature(), null, false); if (notString) { - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_104); } - stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_105); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_108); + stringBuffer.append(TEXT_106); stringBuffer.append(String.valueOf(nextCommonBase.getVisualID())); - stringBuffer.append(TEXT_109); + stringBuffer.append(TEXT_107); } else { /* 4. None of above. */ - stringBuffer.append(TEXT_110); + stringBuffer.append(TEXT_108); } } - stringBuffer.append(TEXT_111); + stringBuffer.append(TEXT_109); } } - stringBuffer.append(TEXT_112); + stringBuffer.append(TEXT_110); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_113); + stringBuffer.append(TEXT_111); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_114); + stringBuffer.append(TEXT_112); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonContentExtensionSite")); - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_113); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IMemento")); - stringBuffer.append(TEXT_116); + stringBuffer.append(TEXT_114); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IMemento")); - stringBuffer.append(TEXT_117); + stringBuffer.append(TEXT_115); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_118); + stringBuffer.append(TEXT_116); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_119); + stringBuffer.append(TEXT_117); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_120); + stringBuffer.append(TEXT_118); importManager.emitSortedImports(); - stringBuffer.append(TEXT_121); + stringBuffer.append(TEXT_119); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/EditPartFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/EditPartFactoryGenerator.java index 4b1d0921d..b434877db 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/EditPartFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/EditPartFactoryGenerator.java @@ -16,32 +16,31 @@ public class EditPartFactoryGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL; - protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " 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_7 = ".MODEL_ID.equals("; - protected final String TEXT_8 = ".getModelID(view))) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + 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_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL; + protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_5 = " 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_6 = ".MODEL_ID.equals("; + protected final String TEXT_7 = ".getModelID(view))) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tint viewVisualID = "; + protected final String TEXT_8 = ".getVisualID(view);" + NL + "\t\t\tswitch (viewVisualID) {"; + protected final String TEXT_9 = NL + "\t\t\tcase "; + protected final String TEXT_10 = ".VISUAL_ID:" + NL + "\t\t\t\t return new "; + protected final String TEXT_11 = "("; protected final String TEXT_12 = "("; - protected final String TEXT_13 = "("; - protected final String TEXT_14 = ")"; - protected final String TEXT_15 = "view);"; - protected final String TEXT_16 = 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 = "\t\t" + 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\tcase "; - protected final String TEXT_23 = ".VISUAL_ID:" + NL + "\t\t\t\t\treturn new "; - protected final String TEXT_24 = "(view);"; - protected final String TEXT_25 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createUnrecognizedEditPart(context, model);" + NL + "\t}" + NL + "\t" + 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 + "}"; - protected final String TEXT_26 = NL; + protected final String TEXT_13 = ")"; + 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\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 + "\t" + 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 + "}"; + protected final String TEXT_25 = NL; public String generate(Object argument) { @@ -50,57 +49,56 @@ public class EditPartFactoryGenerator final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); importManager.addImport("org.eclipse.gef.EditPart"); importManager.addImport("org.eclipse.gef.EditPartFactory"); importManager.addImport("org.eclipse.gmf.runtime.notation.View"); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(genDiagram.getEditPartFactoryClassName()); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_6); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_9); for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { GenContainerBase container = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName(container.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(container.getEditPartClassName()); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); if(container instanceof GenDiagram) { - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); } - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); if (container instanceof GenNode) { GenNode node = (GenNode) container; for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(label.getEditPartClassName()); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); } } @@ -108,27 +106,27 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName(link.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(link.getEditPartClassName()); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(linkLabel.getEditPartClassName()); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); } } - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); importManager.emitSortedImports(); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/policies/OpenDiagramPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/policies/OpenDiagramPolicyGenerator.java index 302f92a34..46b26fb8a 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/policies/OpenDiagramPolicyGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/policies/OpenDiagramPolicyGenerator.java @@ -15,74 +15,73 @@ public class OpenDiagramPolicyGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL; - protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " extends "; - protected final String TEXT_7 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; - protected final String TEXT_8 = " getOpenCommand("; - protected final String TEXT_9 = " openRequest) {" + NL + "\t\t"; - protected final String TEXT_10 = " targetEditPart = getTargetEditPart(openRequest);" + NL + "\t\tif (false == targetEditPart.getModel() instanceof "; - protected final String TEXT_11 = ") {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_12 = " view = ("; - protected final String TEXT_13 = ") targetEditPart.getModel();" + NL + "\t\treturn getOpenCommand(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; - protected final String TEXT_14 = " getOpenCommand("; - protected final String TEXT_15 = " view) {" + NL + "\t\t"; - protected final String TEXT_16 = " linkStyle = view.getStyle("; - protected final String TEXT_17 = ".eINSTANCE.getHintedDiagramLinkStyle());" + NL + "\t\tif (false == linkStyle instanceof "; - protected final String TEXT_18 = ") {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_19 = " domain = "; - protected final String TEXT_20 = ".getEditingDomain(linkStyle);" + NL + "\t\t"; - protected final String TEXT_21 = " result = new OpenDiagramCommand(("; - protected final String TEXT_22 = ") linkStyle);" + NL + "\t\treturn new "; - protected final String TEXT_23 = "(domain, result);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected static class OpenDiagramCommand extends "; - protected final String TEXT_24 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final "; - protected final String TEXT_25 = " myDiagramLink;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected OpenDiagramCommand("; - protected final String TEXT_26 = " linkStyle) {" + NL + "\t\t\tmyDiagramLink = linkStyle;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean prepare() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\t"; - protected final String TEXT_27 = " diagramToOpen = getDiagramToOpen();" + NL + "\t\t\tif (diagramToOpen == null) {" + NL + "\t\t\t\tdiagramToOpen = createNewDiagram();" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_28 = " diagramURI = "; - protected final String TEXT_29 = ".getURI(diagramToOpen);" + NL + "\t\t\t"; - protected final String TEXT_30 = " page = "; - protected final String TEXT_31 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage();"; - protected final String TEXT_32 = NL + "\t\t\t"; - protected final String TEXT_33 = " editorInput = new "; - protected final String TEXT_34 = "(diagramURI);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, getEditorID());" + NL + "\t\t\t} catch ("; - protected final String TEXT_35 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; - protected final String TEXT_36 = NL + "\t\t\ttry {" + NL + "\t\t\t\t"; - protected final String TEXT_37 = " diagramView = ("; - protected final String TEXT_38 = ")page.showView(getViewID());" + NL + "\t\t\t\tdiagramView.showDiagram(null, diagramURI);" + NL + "\t\t\t} catch ("; - protected final String TEXT_39 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; - protected final String TEXT_40 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; - protected final String TEXT_41 = " getDiagramToOpen() {" + NL + "\t\t\t"; - protected final String TEXT_42 = " result = myDiagramLink.getDiagramLink();" + NL + "\t\t\t// take first that matches the given model ID." + NL + "\t\t\tif (result != null && result.getType().equals(getDiagramKind())) {" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; - protected final String TEXT_43 = " createNewDiagram() {" + NL + "\t\t\t"; - protected final String TEXT_44 = " result = "; - protected final String TEXT_45 = ".eINSTANCE.createDiagram();" + NL + "\t\t\tmyDiagramLink.setDiagramLink(result);" + NL + "\t\t\tresult.setElement(getDiagramDomainElement());" + NL + "\t\t\taddToResource(result);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tfor ("; - protected final String TEXT_46 = " it = myDiagramLink.eResource().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_47 = " next = ("; - protected final String TEXT_48 = ") it.next();" + NL + "\t\t\t\t\tif (next.isLoaded() && !"; - protected final String TEXT_49 = ".isReadOnly(next)) {" + NL + "\t\t\t\t\t\tnext.save("; - protected final String TEXT_50 = ".getSaveOptions());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch ("; - protected final String TEXT_51 = " e) {" + NL + "\t\t\t\t"; - protected final String TEXT_52 = NL + "\t\t\t\tthrow new RuntimeException(\"Can't create diagram of '\" + getDiagramKind() + \"' kind\", e);" + NL + "\t\t\t}" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Returns the element that should be the underlying model element for the diagram." + NL + "\t\t * By default, the element associated with the edit part is returned." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; - protected final String TEXT_53 = " getDiagramDomainElement() {" + NL + "\t\t\treturn (("; - protected final String TEXT_54 = ") myDiagramLink.eContainer()).getElement();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Adds the created diagram to a resource. By default, the diagram is added to the resource which contains the initiating diagram." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected void addToResource("; - protected final String TEXT_55 = " diagram) {" + NL + "\t\t\tassert diagram.eResource() == null;" + NL + "\t\t\tassert myDiagramLink.eResource() != null;" + NL + "\t\t\tmyDiagramLink.eResource().getContents().add(diagram);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getDiagramKind() {"; - protected final String TEXT_56 = NL + "\t\t\treturn "; - protected final String TEXT_57 = ".MODEL_ID;"; - protected final String TEXT_58 = NL + "\t\t\treturn \""; - protected final String TEXT_59 = "\";"; - protected final String TEXT_60 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */"; - protected final String TEXT_61 = NL + "\t\tprotected String getEditorID() {"; - protected final String TEXT_62 = NL + "\t\tprotected String getViewID() {"; - protected final String TEXT_63 = NL + "\t\t\treturn "; - protected final String TEXT_64 = ".ID;"; - protected final String TEXT_65 = NL + "\t\t\treturn \""; - protected final String TEXT_66 = "\";"; - protected final String TEXT_67 = NL + "\t\t}" + NL + "\t}" + NL + "}"; - protected final String TEXT_68 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL; + protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_5 = " extends "; + protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_7 = " getOpenCommand("; + protected final String TEXT_8 = " openRequest) {" + NL + "\t\t"; + protected final String TEXT_9 = " targetEditPart = getTargetEditPart(openRequest);" + NL + "\t\tif (false == targetEditPart.getModel() instanceof "; + protected final String TEXT_10 = ") {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_11 = " view = ("; + protected final String TEXT_12 = ") targetEditPart.getModel();" + NL + "\t\treturn getOpenCommand(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_13 = " getOpenCommand("; + protected final String TEXT_14 = " view) {" + NL + "\t\t"; + protected final String TEXT_15 = " linkStyle = view.getStyle("; + protected final String TEXT_16 = ".eINSTANCE.getHintedDiagramLinkStyle());" + NL + "\t\tif (false == linkStyle instanceof "; + protected final String TEXT_17 = ") {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_18 = " domain = "; + protected final String TEXT_19 = ".getEditingDomain(linkStyle);" + NL + "\t\t"; + protected final String TEXT_20 = " result = new OpenDiagramCommand(("; + protected final String TEXT_21 = ") linkStyle);" + NL + "\t\treturn new "; + protected final String TEXT_22 = "(domain, result);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected static class OpenDiagramCommand extends "; + protected final String TEXT_23 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final "; + protected final String TEXT_24 = " myDiagramLink;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected OpenDiagramCommand("; + protected final String TEXT_25 = " linkStyle) {" + NL + "\t\t\tmyDiagramLink = linkStyle;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean prepare() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\t"; + protected final String TEXT_26 = " diagramToOpen = getDiagramToOpen();" + NL + "\t\t\tif (diagramToOpen == null) {" + NL + "\t\t\t\tdiagramToOpen = createNewDiagram();" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_27 = " diagramURI = "; + protected final String TEXT_28 = ".getURI(diagramToOpen);" + NL + "\t\t\t"; + protected final String TEXT_29 = " page = "; + protected final String TEXT_30 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage();"; + protected final String TEXT_31 = NL + "\t\t\t"; + protected final String TEXT_32 = " editorInput = new "; + protected final String TEXT_33 = "(diagramURI);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, getEditorID());" + NL + "\t\t\t} catch ("; + protected final String TEXT_34 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; + protected final String TEXT_35 = NL + "\t\t\ttry {" + NL + "\t\t\t\t"; + protected final String TEXT_36 = " diagramView = ("; + protected final String TEXT_37 = ")page.showView(getViewID());" + NL + "\t\t\t\tdiagramView.showDiagram(null, diagramURI);" + NL + "\t\t\t} catch ("; + protected final String TEXT_38 = " e) {" + NL + "\t\t\t\tthrow new RuntimeException(\"Can't open diagram\", e);" + NL + "\t\t\t}"; + protected final String TEXT_39 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; + protected final String TEXT_40 = " getDiagramToOpen() {" + NL + "\t\t\t"; + protected final String TEXT_41 = " result = myDiagramLink.getDiagramLink();" + NL + "\t\t\t// take first that matches the given model ID." + NL + "\t\t\tif (result != null && result.getType().equals(getDiagramKind())) {" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; + protected final String TEXT_42 = " createNewDiagram() {" + NL + "\t\t\t"; + protected final String TEXT_43 = " result = "; + protected final String TEXT_44 = ".eINSTANCE.createDiagram();" + NL + "\t\t\tmyDiagramLink.setDiagramLink(result);" + NL + "\t\t\tresult.setElement(getDiagramDomainElement());" + NL + "\t\t\taddToResource(result);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tfor ("; + protected final String TEXT_45 = " it = myDiagramLink.eResource().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_46 = " next = ("; + protected final String TEXT_47 = ") it.next();" + NL + "\t\t\t\t\tif (next.isLoaded() && !"; + protected final String TEXT_48 = ".isReadOnly(next)) {" + NL + "\t\t\t\t\t\tnext.save("; + protected final String TEXT_49 = ".getSaveOptions());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch ("; + protected final String TEXT_50 = " e) {" + NL + "\t\t\t\t"; + protected final String TEXT_51 = NL + "\t\t\t\tthrow new RuntimeException(\"Can't create diagram of '\" + getDiagramKind() + \"' kind\", e);" + NL + "\t\t\t}" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Returns the element that should be the underlying model element for the diagram." + NL + "\t\t * By default, the element associated with the edit part is returned." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; + protected final String TEXT_52 = " getDiagramDomainElement() {" + NL + "\t\t\treturn (("; + protected final String TEXT_53 = ") myDiagramLink.eContainer()).getElement();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Adds the created diagram to a resource. By default, the diagram is added to the resource which contains the initiating diagram." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected void addToResource("; + protected final String TEXT_54 = " diagram) {" + NL + "\t\t\tassert diagram.eResource() == null;" + NL + "\t\t\tassert myDiagramLink.eResource() != null;" + NL + "\t\t\tmyDiagramLink.eResource().getContents().add(diagram);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getDiagramKind() {"; + protected final String TEXT_55 = NL + "\t\t\treturn "; + protected final String TEXT_56 = ".MODEL_ID;"; + protected final String TEXT_57 = NL + "\t\t\treturn \""; + protected final String TEXT_58 = "\";"; + protected final String TEXT_59 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */"; + protected final String TEXT_60 = NL + "\t\tprotected String getEditorID() {"; + protected final String TEXT_61 = NL + "\t\tprotected String getViewID() {"; + protected final String TEXT_62 = NL + "\t\t\treturn "; + protected final String TEXT_63 = ".ID;"; + protected final String TEXT_64 = NL + "\t\t\treturn \""; + protected final String TEXT_65 = "\";"; + protected final String TEXT_66 = NL + "\t\t}" + NL + "\t}" + NL + "}"; + protected final String TEXT_67 = NL; public String generate(Object argument) { @@ -93,97 +92,98 @@ final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1] final GenDiagram genDiagram = behaviour.getSubject().getDiagram(); final boolean openAsEditor = behaviour.isOpenAsEclipseEditor(); - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); importManager.registerInnerClass("OpenDiagramCommand"); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(importManager.getCompilationUnitName()); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.policies.OpenDiagramEditPolicy")); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); + stringBuffer.append(TEXT_9); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_12); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Style")); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle")); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil")); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command")); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle")); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.commands.WrappingCommand")); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")); + stringBuffer.append(TEXT_23); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle")); stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle")); stringBuffer.append(TEXT_25); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle")); - stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPage")); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_29); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); if (openAsEditor) { - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); } else { + stringBuffer.append(TEXT_35); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); stringBuffer.append(TEXT_37); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.parts.DiagramViewPart")); - stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_38); } + stringBuffer.append(TEXT_39); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_41); @@ -191,63 +191,61 @@ if (openAsEditor) { stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_43); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_45); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); stringBuffer.append(TEXT_46); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); stringBuffer.append(TEXT_47); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); + stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); stringBuffer.append(TEXT_48); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); stringBuffer.append(TEXT_49); - stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); - stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("java.io.IOException")); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); /*XXX: Throwing runtime exceptions is definitely not the most elegant way*/ - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); if (behaviour.getDiagramKind() == null) { - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_55); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_56); } else { - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_57); stringBuffer.append(behaviour.getDiagramKind()); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); } - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_59); if (openAsEditor) { - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_60); } else { - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); } if (behaviour.getEditorID() == null) { - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); } else { - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(behaviour.getEditorID()); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); } - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); importManager.emitSortedImports(); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/DomainElementInitializerGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/DomainElementInitializerGenerator.java index a23e359d0..501a51859 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/DomainElementInitializerGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/DomainElementInitializerGenerator.java @@ -17,218 +17,214 @@ public class DomainElementInitializerGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class DomainElementInitializer "; - protected final String TEXT_5 = "{" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static interface IElementInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void initializeElement("; - protected final String TEXT_6 = " instance);" + NL + "\t}" + NL; - protected final String TEXT_7 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static IElementInitializer NULL_INITIALIZER = new IElementInitializer() {" + NL + "\t\tpublic void initializeElement("; - protected final String TEXT_8 = " instance) {" + NL + "\t\t}" + NL + "\t};" + NL; - protected final String TEXT_9 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static IElementInitializer "; - protected final String TEXT_10 = " = NULL_INITIALIZER;"; - protected final String TEXT_11 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final IElementInitializer "; - protected final String TEXT_12 = " = new ObjectInitializer("; - protected final String TEXT_13 = ") {"; - protected final String TEXT_14 = NL + "\t\tObjectInitializer "; - protected final String TEXT_15 = "() {" + NL + "\t\t\treturn new ObjectInitializer("; - protected final String TEXT_16 = ") {"; - protected final String TEXT_17 = NL + "\t\t \tprotected void init() {\t\t\t\t"; - protected final String TEXT_18 = "\t\t\t" + NL + "\t\t\t\tadd(createNewElementFeatureInitializer("; - protected final String TEXT_19 = ", new ObjectInitializer[] {"; - protected final String TEXT_20 = NL + "\t\t\t\t\t"; - protected final String TEXT_21 = "(), "; - protected final String TEXT_22 = NL + "\t\t\t\t}));"; - protected final String TEXT_23 = "\t\t\t" + NL + "\t\t\t\tadd(createExpressionFeatureInitializer("; - protected final String TEXT_24 = ", "; - protected final String TEXT_25 = "null"; - protected final String TEXT_26 = "."; - protected final String TEXT_27 = "("; - protected final String TEXT_28 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_29 = ", "; - protected final String TEXT_30 = ")"; - protected final String TEXT_31 = "."; - protected final String TEXT_32 = "("; - protected final String TEXT_33 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_34 = ")"; - protected final String TEXT_35 = "new "; - protected final String TEXT_36 = "("; - protected final String TEXT_37 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_38 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_39 = " self = ("; - protected final String TEXT_40 = ")context;"; - protected final String TEXT_41 = "\t" + NL + "\t\t"; - protected final String TEXT_42 = " "; - protected final String TEXT_43 = " = ("; - protected final String TEXT_44 = ")env.get(\""; - protected final String TEXT_45 = "\"); //$NON-NLS-1$"; - protected final String TEXT_46 = NL + "\t\treturn "; - protected final String TEXT_47 = "."; - protected final String TEXT_48 = "(self"; - protected final String TEXT_49 = ", "; - protected final String TEXT_50 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_51 = NL + "));"; - protected final String TEXT_52 = "\t\t\t}"; - protected final String TEXT_53 = NL + "\t\t\t\t}; // "; - protected final String TEXT_54 = " ObjectInitializer" + NL + "\t\t\t}"; - protected final String TEXT_55 = NL + "\t\t}; // "; - protected final String TEXT_56 = " ObjectInitializer"; - protected final String TEXT_57 = NL + "\t/** " + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static abstract class ObjectInitializer implements IElementInitializer {" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal "; - protected final String TEXT_58 = " element;\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate "; - protected final String TEXT_59 = " featureInitializers = new "; - protected final String TEXT_60 = "();" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tObjectInitializer("; - protected final String TEXT_61 = " element) {" + NL + "\t\t\tthis.element = element;" + NL + "\t\t\tinit();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t \t * @generated" + NL + "\t \t */" + NL + "\t \tprotected abstract void init();\t\t\t\t\t\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected final FeatureInitializer add(FeatureInitializer initializer) {" + NL + "\t\t\tfeatureInitializers.add(initializer);" + NL + "\t\t\treturn initializer;" + NL + "\t\t}" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic void initializeElement("; - protected final String TEXT_62 = " instance) {" + NL + "\t\t\tfor ("; - protected final String TEXT_63 = " it = featureInitializers.iterator(); it.hasNext();) {" + NL + "\t\t\t\tFeatureInitializer nextExpr = (FeatureInitializer)it.next();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t\t} catch(RuntimeException e) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_64 = ".getInstance().logError(\"Feature initialization failed\", e);\t//$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t} // end of ObjectInitializer" + NL + "\t" + NL + "\t/** " + NL + "\t * @generated" + NL + "\t */" + NL + "\tinterface FeatureInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tvoid init("; - protected final String TEXT_65 = " contextInstance);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t\t" + NL + "\tstatic FeatureInitializer createNewElementFeatureInitializer("; - protected final String TEXT_66 = " initFeature, ObjectInitializer[] newObjectInitializers) {" + NL + "\t\tfinal "; - protected final String TEXT_67 = " feature = initFeature;" + NL + "\t\tfinal ObjectInitializer[] initializers = newObjectInitializers;" + NL + "\t\treturn new FeatureInitializer() {" + NL + "\t\t\tpublic void init("; - protected final String TEXT_68 = " contextInstance) {" + NL + "\t\t\t\tfor (int i = 0; i < initializers.length; i++) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_69 = " newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);" + NL + "\t\t\t\t\tif(feature.isMany()) {" + NL + "\t\t\t\t\t\t(("; - protected final String TEXT_70 = ")contextInstance.eGet(feature)).add(newInstance);" + NL + "\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\tcontextInstance.eSet(feature, newInstance);" + NL + "\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\tinitializers[i].initializeElement(newInstance);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t\t" + NL + "\tstatic FeatureInitializer createExpressionFeatureInitializer("; - protected final String TEXT_71 = " initFeature, "; - protected final String TEXT_72 = " valueExpression) {" + NL + "\t\tfinal "; - protected final String TEXT_73 = " feature = initFeature;" + NL + "\t\tfinal "; - protected final String TEXT_74 = " expression = valueExpression;" + NL + "\t\treturn new FeatureInitializer() {\t\t\t\t" + NL + "\t\t\tpublic void init("; - protected final String TEXT_75 = " contextInstance) {" + NL + "\t\t\t\texpression.assignTo(feature, contextInstance);" + NL + "\t\t\t}" + NL + "\t\t};\t\t\t" + NL + "\t}"; - protected final String TEXT_76 = NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class "; - protected final String TEXT_77 = " {"; - protected final String TEXT_78 = NL; - protected final String TEXT_79 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_80 = " "; - protected final String TEXT_81 = "("; - protected final String TEXT_82 = " self"; - protected final String TEXT_83 = ", "; - protected final String TEXT_84 = " "; - protected final String TEXT_85 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_86 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_87 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_88 = NL + "\t\t} //"; - protected final String TEXT_89 = NL; - protected final String TEXT_90 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class "; - protected final String TEXT_91 = " {"; - protected final String TEXT_92 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic static final "; - protected final String TEXT_93 = " "; - protected final String TEXT_94 = " = create"; - protected final String TEXT_95 = "();"; - protected final String TEXT_96 = NL; - protected final String TEXT_97 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static "; - protected final String TEXT_98 = " create"; - protected final String TEXT_99 = "() {"; - protected final String TEXT_100 = NL; - protected final String TEXT_101 = " "; - protected final String TEXT_102 = " = new "; - protected final String TEXT_103 = "(3);"; - protected final String TEXT_104 = ".put(\""; - protected final String TEXT_105 = "\", "; - protected final String TEXT_106 = "); //$NON-NLS-1$"; - protected final String TEXT_107 = NL + "\t\t\t"; - protected final String TEXT_108 = " sourceExpression = "; - protected final String TEXT_109 = "null"; - protected final String TEXT_110 = "."; - protected final String TEXT_111 = "("; - protected final String TEXT_112 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_113 = ", "; - protected final String TEXT_114 = ")"; - protected final String TEXT_115 = "."; - protected final String TEXT_116 = "("; - protected final String TEXT_117 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_118 = ")"; - protected final String TEXT_119 = "new "; - protected final String TEXT_120 = "("; - protected final String TEXT_121 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_122 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_123 = " self = ("; - protected final String TEXT_124 = ")context;"; - protected final String TEXT_125 = "\t" + NL + "\t\t"; - protected final String TEXT_126 = " "; - protected final String TEXT_127 = " = ("; - protected final String TEXT_128 = ")env.get(\""; - protected final String TEXT_129 = "\"); //$NON-NLS-1$"; - protected final String TEXT_130 = NL + "\t\treturn "; - protected final String TEXT_131 = "."; - protected final String TEXT_132 = "(self"; - protected final String TEXT_133 = ", "; - protected final String TEXT_134 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_135 = "null"; - protected final String TEXT_136 = ";"; - protected final String TEXT_137 = NL; - protected final String TEXT_138 = " "; - protected final String TEXT_139 = " = new "; - protected final String TEXT_140 = "(3);"; - protected final String TEXT_141 = ".put(\""; - protected final String TEXT_142 = "\", "; - protected final String TEXT_143 = "); //$NON-NLS-1$"; - protected final String TEXT_144 = NL + "\t\t\t"; - protected final String TEXT_145 = " targetExpression = "; - protected final String TEXT_146 = "null"; - protected final String TEXT_147 = "."; - protected final String TEXT_148 = "("; - protected final String TEXT_149 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_150 = ", "; - protected final String TEXT_151 = ")"; - protected final String TEXT_152 = "."; - protected final String TEXT_153 = "("; - protected final String TEXT_154 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_155 = ")"; - protected final String TEXT_156 = "new "; - protected final String TEXT_157 = "("; - protected final String TEXT_158 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_159 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_160 = " self = ("; - protected final String TEXT_161 = ")context;"; - protected final String TEXT_162 = "\t" + NL + "\t\t"; - protected final String TEXT_163 = " "; - protected final String TEXT_164 = " = ("; - protected final String TEXT_165 = ")env.get(\""; - protected final String TEXT_166 = "\"); //$NON-NLS-1$"; - protected final String TEXT_167 = NL + "\t\treturn "; - protected final String TEXT_168 = "."; - protected final String TEXT_169 = "(self"; - protected final String TEXT_170 = ", "; - protected final String TEXT_171 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_172 = "null"; - protected final String TEXT_173 = ";" + NL + "\t\t\treturn new "; - protected final String TEXT_174 = "(sourceExpression, targetExpression);" + NL + "\t\t}"; - protected final String TEXT_175 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate static final String OPPOSITE_END_VAR = \"oppositeEnd\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate "; - protected final String TEXT_176 = " srcEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate "; - protected final String TEXT_177 = " targetEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tpublic "; - protected final String TEXT_178 = "("; - protected final String TEXT_179 = " sourceEnd, "; - protected final String TEXT_180 = " targetEnd) {" + NL + "\t\t\tthis.srcEndInv = sourceEnd;\t\t\t" + NL + "\t\t\tthis.targetEndInv = targetEnd;\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tpublic boolean canCreateLink(Object source, Object target, boolean isBackDirected) {" + NL + "\t\t\tif (source != null) {" + NL + "\t\t\t\t"; - protected final String TEXT_181 = " sourceConstraint = isBackDirected ? targetEndInv : srcEndInv;" + NL + "\t\t\t\tif (sourceConstraint != null && !evaluate(sourceConstraint, source, target, false)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tif (target != null) {" + NL + "\t\t\t\t"; - protected final String TEXT_182 = " targetConstraint = isBackDirected ? srcEndInv : targetEndInv;" + NL + "\t\t\t\tif (targetConstraint != null && !evaluate(targetConstraint, target, source, true)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static boolean evaluate("; - protected final String TEXT_183 = " constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {" + NL + "\t\t\t"; - protected final String TEXT_184 = " evalEnv = "; - protected final String TEXT_185 = ".singletonMap(OPPOSITE_END_VAR, oppositeEnd);\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tObject val = constraint.evaluate(sourceEnd, evalEnv);" + NL + "\t\t\t\treturn (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;" + NL + "\t\t\t} catch(Exception e) {\t" + NL + "\t\t\t\t"; - protected final String TEXT_186 = ".getInstance().logError(\"Link constraint evaluation error\", e); //$NON-NLS-1$" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}"; - protected final String TEXT_187 = "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class "; - protected final String TEXT_188 = " {"; - protected final String TEXT_189 = NL; - protected final String TEXT_190 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_191 = " "; - protected final String TEXT_192 = "("; - protected final String TEXT_193 = " self"; - protected final String TEXT_194 = ", "; - protected final String TEXT_195 = " "; - protected final String TEXT_196 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_197 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_198 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_199 = NL; - protected final String TEXT_200 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class DomainElementInitializer "; + protected final String TEXT_4 = "{" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static interface IElementInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void initializeElement("; + protected final String TEXT_5 = " instance);" + NL + "\t}" + NL; + protected final String TEXT_6 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static IElementInitializer NULL_INITIALIZER = new IElementInitializer() {" + NL + "\t\tpublic void initializeElement("; + protected final String TEXT_7 = " instance) {" + NL + "\t\t}" + NL + "\t};" + NL; + protected final String TEXT_8 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static IElementInitializer "; + protected final String TEXT_9 = " = NULL_INITIALIZER;"; + protected final String TEXT_10 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final IElementInitializer "; + protected final String TEXT_11 = " = new ObjectInitializer("; + protected final String TEXT_12 = ") {"; + protected final String TEXT_13 = NL + "\t\tObjectInitializer "; + protected final String TEXT_14 = "() {" + NL + "\t\t\treturn new ObjectInitializer("; + protected final String TEXT_15 = ") {"; + protected final String TEXT_16 = NL + "\t\t \tprotected void init() {\t\t\t\t"; + protected final String TEXT_17 = "\t\t\t" + NL + "\t\t\t\tadd(createNewElementFeatureInitializer("; + protected final String TEXT_18 = ", new ObjectInitializer[] {"; + protected final String TEXT_19 = NL + "\t\t\t\t\t"; + protected final String TEXT_20 = "(), "; + protected final String TEXT_21 = NL + "\t\t\t\t}));"; + protected final String TEXT_22 = "\t\t\t" + NL + "\t\t\t\tadd(createExpressionFeatureInitializer("; + protected final String TEXT_23 = ", "; + protected final String TEXT_24 = "null"; + protected final String TEXT_25 = "."; + protected final String TEXT_26 = "("; + protected final String TEXT_27 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_28 = ", "; + protected final String TEXT_29 = ")"; + protected final String TEXT_30 = "."; + protected final String TEXT_31 = "("; + protected final String TEXT_32 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_33 = ")"; + protected final String TEXT_34 = "new "; + protected final String TEXT_35 = "("; + protected final String TEXT_36 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_37 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_38 = " self = ("; + protected final String TEXT_39 = ")context;"; + protected final String TEXT_40 = "\t" + NL + "\t\t"; + protected final String TEXT_41 = " "; + protected final String TEXT_42 = " = ("; + protected final String TEXT_43 = ")env.get(\""; + protected final String TEXT_44 = "\"); //$NON-NLS-1$"; + protected final String TEXT_45 = NL + "\t\treturn "; + protected final String TEXT_46 = "."; + protected final String TEXT_47 = "(self"; + protected final String TEXT_48 = ", "; + protected final String TEXT_49 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_50 = NL + "));"; + protected final String TEXT_51 = "\t\t\t}"; + protected final String TEXT_52 = NL + "\t\t\t\t}; // "; + protected final String TEXT_53 = " ObjectInitializer" + NL + "\t\t\t}"; + protected final String TEXT_54 = NL + "\t\t}; // "; + protected final String TEXT_55 = " ObjectInitializer"; + protected final String TEXT_56 = NL + "\t/** " + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static abstract class ObjectInitializer implements IElementInitializer {" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal "; + protected final String TEXT_57 = " element;\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate "; + protected final String TEXT_58 = " featureInitializers = new "; + protected final String TEXT_59 = "();" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tObjectInitializer("; + protected final String TEXT_60 = " element) {" + NL + "\t\t\tthis.element = element;" + NL + "\t\t\tinit();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t \t * @generated" + NL + "\t \t */" + NL + "\t \tprotected abstract void init();\t\t\t\t\t\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected final FeatureInitializer add(FeatureInitializer initializer) {" + NL + "\t\t\tfeatureInitializers.add(initializer);" + NL + "\t\t\treturn initializer;" + NL + "\t\t}" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic void initializeElement("; + protected final String TEXT_61 = " instance) {" + NL + "\t\t\tfor ("; + protected final String TEXT_62 = " it = featureInitializers.iterator(); it.hasNext();) {" + NL + "\t\t\t\tFeatureInitializer nextExpr = (FeatureInitializer)it.next();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t\t} catch(RuntimeException e) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_63 = ".getInstance().logError(\"Feature initialization failed\", e);\t//$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t} // end of ObjectInitializer" + NL + "\t" + NL + "\t/** " + NL + "\t * @generated" + NL + "\t */" + NL + "\tinterface FeatureInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tvoid init("; + protected final String TEXT_64 = " contextInstance);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t\t" + NL + "\tstatic FeatureInitializer createNewElementFeatureInitializer("; + protected final String TEXT_65 = " initFeature, ObjectInitializer[] newObjectInitializers) {" + NL + "\t\tfinal "; + protected final String TEXT_66 = " feature = initFeature;" + NL + "\t\tfinal ObjectInitializer[] initializers = newObjectInitializers;" + NL + "\t\treturn new FeatureInitializer() {" + NL + "\t\t\tpublic void init("; + protected final String TEXT_67 = " contextInstance) {" + NL + "\t\t\t\tfor (int i = 0; i < initializers.length; i++) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_68 = " newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);" + NL + "\t\t\t\t\tif(feature.isMany()) {" + NL + "\t\t\t\t\t\t(("; + protected final String TEXT_69 = ")contextInstance.eGet(feature)).add(newInstance);" + NL + "\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\tcontextInstance.eSet(feature, newInstance);" + NL + "\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\tinitializers[i].initializeElement(newInstance);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t\t" + NL + "\tstatic FeatureInitializer createExpressionFeatureInitializer("; + protected final String TEXT_70 = " initFeature, "; + protected final String TEXT_71 = " valueExpression) {" + NL + "\t\tfinal "; + protected final String TEXT_72 = " feature = initFeature;" + NL + "\t\tfinal "; + protected final String TEXT_73 = " expression = valueExpression;" + NL + "\t\treturn new FeatureInitializer() {\t\t\t\t" + NL + "\t\t\tpublic void init("; + protected final String TEXT_74 = " contextInstance) {" + NL + "\t\t\t\texpression.assignTo(feature, contextInstance);" + NL + "\t\t\t}" + NL + "\t\t};\t\t\t" + NL + "\t}"; + protected final String TEXT_75 = NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class "; + protected final String TEXT_76 = " {"; + protected final String TEXT_77 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_78 = " "; + protected final String TEXT_79 = "("; + protected final String TEXT_80 = " self"; + protected final String TEXT_81 = ", "; + protected final String TEXT_82 = " "; + protected final String TEXT_83 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_84 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_85 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_86 = NL + "\t\t} //"; + protected final String TEXT_87 = NL; + protected final String TEXT_88 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class "; + protected final String TEXT_89 = " {"; + protected final String TEXT_90 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic static final "; + protected final String TEXT_91 = " "; + protected final String TEXT_92 = " = create"; + protected final String TEXT_93 = "();"; + protected final String TEXT_94 = NL; + protected final String TEXT_95 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static "; + protected final String TEXT_96 = " create"; + protected final String TEXT_97 = "() {"; + protected final String TEXT_98 = NL; + protected final String TEXT_99 = " "; + protected final String TEXT_100 = " = new "; + protected final String TEXT_101 = "(3);"; + protected final String TEXT_102 = ".put(\""; + protected final String TEXT_103 = "\", "; + protected final String TEXT_104 = "); //$NON-NLS-1$"; + protected final String TEXT_105 = NL + "\t\t\t"; + protected final String TEXT_106 = " sourceExpression = "; + protected final String TEXT_107 = "null"; + protected final String TEXT_108 = "."; + protected final String TEXT_109 = "("; + protected final String TEXT_110 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_111 = ", "; + protected final String TEXT_112 = ")"; + protected final String TEXT_113 = "."; + protected final String TEXT_114 = "("; + protected final String TEXT_115 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_116 = ")"; + protected final String TEXT_117 = "new "; + protected final String TEXT_118 = "("; + protected final String TEXT_119 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_120 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_121 = " self = ("; + protected final String TEXT_122 = ")context;"; + protected final String TEXT_123 = "\t" + NL + "\t\t"; + protected final String TEXT_124 = " "; + protected final String TEXT_125 = " = ("; + protected final String TEXT_126 = ")env.get(\""; + protected final String TEXT_127 = "\"); //$NON-NLS-1$"; + protected final String TEXT_128 = NL + "\t\treturn "; + protected final String TEXT_129 = "."; + protected final String TEXT_130 = "(self"; + protected final String TEXT_131 = ", "; + protected final String TEXT_132 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_133 = "null"; + protected final String TEXT_134 = ";"; + protected final String TEXT_135 = NL; + protected final String TEXT_136 = " "; + protected final String TEXT_137 = " = new "; + protected final String TEXT_138 = "(3);"; + protected final String TEXT_139 = ".put(\""; + protected final String TEXT_140 = "\", "; + protected final String TEXT_141 = "); //$NON-NLS-1$"; + protected final String TEXT_142 = NL + "\t\t\t"; + protected final String TEXT_143 = " targetExpression = "; + protected final String TEXT_144 = "null"; + protected final String TEXT_145 = "."; + protected final String TEXT_146 = "("; + protected final String TEXT_147 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_148 = ", "; + protected final String TEXT_149 = ")"; + protected final String TEXT_150 = "."; + protected final String TEXT_151 = "("; + protected final String TEXT_152 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_153 = ")"; + protected final String TEXT_154 = "new "; + protected final String TEXT_155 = "("; + protected final String TEXT_156 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_157 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_158 = " self = ("; + protected final String TEXT_159 = ")context;"; + protected final String TEXT_160 = "\t" + NL + "\t\t"; + protected final String TEXT_161 = " "; + protected final String TEXT_162 = " = ("; + protected final String TEXT_163 = ")env.get(\""; + protected final String TEXT_164 = "\"); //$NON-NLS-1$"; + protected final String TEXT_165 = NL + "\t\treturn "; + protected final String TEXT_166 = "."; + protected final String TEXT_167 = "(self"; + protected final String TEXT_168 = ", "; + protected final String TEXT_169 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_170 = "null"; + protected final String TEXT_171 = ";" + NL + "\t\t\treturn new "; + protected final String TEXT_172 = "(sourceExpression, targetExpression);" + NL + "\t\t}"; + protected final String TEXT_173 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate static final String OPPOSITE_END_VAR = \"oppositeEnd\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate "; + protected final String TEXT_174 = " srcEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate "; + protected final String TEXT_175 = " targetEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tpublic "; + protected final String TEXT_176 = "("; + protected final String TEXT_177 = " sourceEnd, "; + protected final String TEXT_178 = " targetEnd) {" + NL + "\t\t\tthis.srcEndInv = sourceEnd;\t\t\t" + NL + "\t\t\tthis.targetEndInv = targetEnd;\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tpublic boolean canCreateLink(Object source, Object target, boolean isBackDirected) {" + NL + "\t\t\tif (source != null) {" + NL + "\t\t\t\t"; + protected final String TEXT_179 = " sourceConstraint = isBackDirected ? targetEndInv : srcEndInv;" + NL + "\t\t\t\tif (sourceConstraint != null && !evaluate(sourceConstraint, source, target, false)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tif (target != null) {" + NL + "\t\t\t\t"; + protected final String TEXT_180 = " targetConstraint = isBackDirected ? srcEndInv : targetEndInv;" + NL + "\t\t\t\tif (targetConstraint != null && !evaluate(targetConstraint, target, source, true)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static boolean evaluate("; + protected final String TEXT_181 = " constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {" + NL + "\t\t\t"; + protected final String TEXT_182 = " evalEnv = "; + protected final String TEXT_183 = ".singletonMap(OPPOSITE_END_VAR, oppositeEnd);\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tObject val = constraint.evaluate(sourceEnd, evalEnv);" + NL + "\t\t\t\treturn (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;" + NL + "\t\t\t} catch(Exception e) {\t" + NL + "\t\t\t\t"; + protected final String TEXT_184 = ".getInstance().logError(\"Link constraint evaluation error\", e); //$NON-NLS-1$" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_185 = "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class "; + protected final String TEXT_186 = " {"; + protected final String TEXT_187 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_188 = " "; + protected final String TEXT_189 = "("; + protected final String TEXT_190 = " self"; + protected final String TEXT_191 = ", "; + protected final String TEXT_192 = " "; + protected final String TEXT_193 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_194 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_195 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_196 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_197 = " "; + protected final String TEXT_198 = "("; + protected final String TEXT_199 = " self"; + protected final String TEXT_200 = ", "; protected final String TEXT_201 = " "; - protected final String TEXT_202 = "("; - protected final String TEXT_203 = " self"; - protected final String TEXT_204 = ", "; - protected final String TEXT_205 = " "; - protected final String TEXT_206 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_207 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_208 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_209 = NL + "\t} // "; - protected final String TEXT_210 = "\t\t" + NL + "\t}"; - protected final String TEXT_211 = "\t" + NL + "}"; - protected final String TEXT_212 = NL; + protected final String TEXT_202 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_203 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_204 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_205 = NL + "\t} // "; + protected final String TEXT_206 = "\t\t" + NL + "\t}"; + protected final String TEXT_207 = "\t" + NL + "}"; + protected final String TEXT_208 = NL; public String generate(Object argument) { @@ -237,14 +233,13 @@ public class DomainElementInitializerGenerator GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } final String javaExprContainer = "JavaInitializers"; @@ -257,11 +252,11 @@ importManager.emitPackageStatement(stringBuffer); importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); /*XXX: class name should be customizable!*/ - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); { //start local block that separates initializers and constraints boolean needsNullInitializer = false; @@ -279,15 +274,15 @@ for (Map.Entry<TypeModelFacet, GenCommonBase> next : genDiagram.getTypeModelFace if (!needsNullInitializer) { needsNullInitializer = true; - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); } - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(id); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); continue; } @@ -298,42 +293,42 @@ for (Map.Entry<TypeModelFacet, GenCommonBase> next : genDiagram.getTypeModelFace boolean isTopLevelObjInit = nextFtSeqInitializer == rootFtSeqInitializer; if(isTopLevelObjInit){ - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id)); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); stringBuffer.append(nextFtSeqInitializer.getElementClassAccessor(importManager)); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); } else { - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id)); - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); stringBuffer.append(nextFtSeqInitializer.getElementClassAccessor(importManager)); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); } - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); for(GenFeatureInitializer nextFtInitializer : (List<GenFeatureInitializer>)nextFtSeqInitializer.getInitializers()) { String metaFeatureAccessor = nextFtSeqInitializer.getFeatureAccessor(nextFtInitializer, importManager); if(nextFtInitializer instanceof GenReferenceNewElementSpec) { GenReferenceNewElementSpec newElementSpec = (GenReferenceNewElementSpec)nextFtInitializer; - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(metaFeatureAccessor); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); for(GenFeatureSeqInitializer newElemInit : (List<GenFeatureSeqInitializer>)newElementSpec.getNewElementInitializers()) { - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(newElemInit.getInitializerFieldName(id)); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); } // end of newElementInitializers - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_21); } // end of GenReferenceNewElementSpec else if(nextFtInitializer instanceof GenFeatureValueSpec) { String __outEnvVarName = ""; // no env to setup; GenClassifier __genExprContext = nextFtSeqInitializer.getElementClass(); GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)nextFtInitializer; - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_22); stringBuffer.append(metaFeatureAccessor); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); { /*begin the scope*/ /* @@ -349,7 +344,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -358,26 +353,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_28); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_29); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -385,113 +380,113 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(TEXT_37); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_39); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_40); 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_41); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_41); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); } - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_49); } } /*end of scope*/ - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); } // end of GenFeatureValueSpec } // end of GenFeatureInitializer iteration - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); if(!isTopLevelObjInit) { - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id)); - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); } // GenFeatureInitializer iteration } // All GenFeatureSeqInitializer iteration - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_54); stringBuffer.append(rootFtSeqInitializer.getInitializerFieldName(id)); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_55); } if (needsObjectInitializer) { - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_56); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_57); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_59); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_60); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_64); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); stringBuffer.append(TEXT_65); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); stringBuffer.append(TEXT_66); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_67); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_68); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_69); stringBuffer.append(importManager.getImportedName("java.util.Collection")); - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); if(!javaInitializers.isEmpty()) { - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_75); stringBuffer.append(javaExprContainer); - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_76); for(GenFeatureValueSpec __genValueExpression : javaInitializers) { GenClassifier __genExprContext = __genValueExpression.getFeatureSeqInitializer().getElementClass(); @@ -499,7 +494,6 @@ if (needsObjectInitializer) { if(!(provider instanceof GenJavaExpressionProvider)) continue; String __genExprResultType = provider.getQualifiedTypeInstanceClassName(__genValueExpression.getFeature()); - stringBuffer.append(TEXT_78); /* ValueExpression __genValueExpression @@ -520,13 +514,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_79); + stringBuffer.append(TEXT_77); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_78); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_79); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_80); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -534,31 +528,31 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_81); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_82); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_83); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_84); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_85); } /* end of GenJavaExpressionProvider */ } - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_86); stringBuffer.append(javaExprContainer); } /* end of javaInitializers */ } } //end local block that separates initializers and constraints - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_87); final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders(); if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) { @@ -566,9 +560,9 @@ if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) { String importedAbstractExprCls = importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()); boolean hasJavaConstraints = false; - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_88); stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_89); for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) { GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints(); @@ -577,17 +571,17 @@ if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) { hasJavaConstraints |= (linkConstraints.getSourceEnd() != null && expressionProviders.getProvider(linkConstraints.getSourceEnd()) instanceof GenJavaExpressionProvider) || (linkConstraints.getTargetEnd() != null && expressionProviders.getProvider(linkConstraints.getTargetEnd()) instanceof GenJavaExpressionProvider); - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_90); stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_91); stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName()); - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_92); stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName()); - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_93); } // end of link iteration - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_94); final String oppositeEndVarName = "oppositeEnd"; for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) { @@ -597,11 +591,11 @@ if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) { GenClass targetContext = linkConstraints.getTargetEndContextClass(); if(srcContext == null || targetContext == null) continue; - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_95); stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_96); stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName()); - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_97); String __javaOperationContainer = javaConstraintsContainer; Map __exprEnvVariables = new java.util.HashMap(); @@ -622,13 +616,13 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_98); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_99); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_100); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_101); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String nextVariableName = (String)envVarIt.next(); @@ -637,11 +631,11 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_102); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_103); stringBuffer.append(varTypeEClassifierAccess); - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_104); } } @@ -649,9 +643,9 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi } /*end the scope*/ - stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_105); stringBuffer.append(importedAbstractExprCls); - stringBuffer.append(TEXT_108); + stringBuffer.append(TEXT_106); if(linkConstraints.getSourceEnd() != null) { @@ -670,7 +664,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_109); + stringBuffer.append(TEXT_107); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -679,26 +673,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_110); + stringBuffer.append(TEXT_108); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_111); + stringBuffer.append(TEXT_109); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_112); + stringBuffer.append(TEXT_110); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_113); + stringBuffer.append(TEXT_111); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_114); + stringBuffer.append(TEXT_112); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_113); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_116); + stringBuffer.append(TEXT_114); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_117); + stringBuffer.append(TEXT_115); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_118); + stringBuffer.append(TEXT_116); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -706,55 +700,55 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_119); + stringBuffer.append(TEXT_117); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_120); + stringBuffer.append(TEXT_118); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_121); + stringBuffer.append(TEXT_119); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_122); + stringBuffer.append(TEXT_120); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_123); + stringBuffer.append(TEXT_121); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_124); + stringBuffer.append(TEXT_122); 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_123); + stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); + stringBuffer.append(TEXT_124); + stringBuffer.append(nextVariableName); stringBuffer.append(TEXT_125); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); stringBuffer.append(TEXT_126); stringBuffer.append(nextVariableName); stringBuffer.append(TEXT_127); - stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_128); - stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_129); } - stringBuffer.append(TEXT_130); + stringBuffer.append(TEXT_128); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_131); + stringBuffer.append(TEXT_129); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_132); + stringBuffer.append(TEXT_130); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_133); + stringBuffer.append(TEXT_131); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_134); + stringBuffer.append(TEXT_132); } } /*end of scope*/ } else - stringBuffer.append(TEXT_135); + stringBuffer.append(TEXT_133); ; - stringBuffer.append(TEXT_136); + stringBuffer.append(TEXT_134); __outEnvVarName = "targetEnv"; __genExprContext = targetContext; @@ -772,13 +766,13 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { - stringBuffer.append(TEXT_137); + stringBuffer.append(TEXT_135); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_138); + stringBuffer.append(TEXT_136); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_139); + stringBuffer.append(TEXT_137); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_140); + stringBuffer.append(TEXT_138); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String nextVariableName = (String)envVarIt.next(); @@ -787,11 +781,11 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_141); + stringBuffer.append(TEXT_139); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_142); + stringBuffer.append(TEXT_140); stringBuffer.append(varTypeEClassifierAccess); - stringBuffer.append(TEXT_143); + stringBuffer.append(TEXT_141); } } @@ -799,9 +793,9 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi } /*end the scope*/ - stringBuffer.append(TEXT_144); + stringBuffer.append(TEXT_142); stringBuffer.append(importedAbstractExprCls); - stringBuffer.append(TEXT_145); + stringBuffer.append(TEXT_143); if(linkConstraints.getTargetEnd() != null) { @@ -820,7 +814,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_146); + stringBuffer.append(TEXT_144); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -829,26 +823,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_147); + stringBuffer.append(TEXT_145); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_148); + stringBuffer.append(TEXT_146); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_149); + stringBuffer.append(TEXT_147); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_150); + stringBuffer.append(TEXT_148); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_151); + stringBuffer.append(TEXT_149); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_152); + stringBuffer.append(TEXT_150); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_153); + stringBuffer.append(TEXT_151); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_154); + stringBuffer.append(TEXT_152); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_155); + stringBuffer.append(TEXT_153); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -856,66 +850,70 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_156); + stringBuffer.append(TEXT_154); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_157); + stringBuffer.append(TEXT_155); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_158); + stringBuffer.append(TEXT_156); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_159); + stringBuffer.append(TEXT_157); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_160); + stringBuffer.append(TEXT_158); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_161); + stringBuffer.append(TEXT_159); 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_160); + stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); + stringBuffer.append(TEXT_161); + stringBuffer.append(nextVariableName); stringBuffer.append(TEXT_162); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); stringBuffer.append(TEXT_163); stringBuffer.append(nextVariableName); stringBuffer.append(TEXT_164); - stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_165); - stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_166); } - stringBuffer.append(TEXT_167); + stringBuffer.append(TEXT_165); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_168); + stringBuffer.append(TEXT_166); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_169); + stringBuffer.append(TEXT_167); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_170); + stringBuffer.append(TEXT_168); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_171); + stringBuffer.append(TEXT_169); } } /*end of scope*/ } else - stringBuffer.append(TEXT_172); + stringBuffer.append(TEXT_170); ; - stringBuffer.append(TEXT_173); + stringBuffer.append(TEXT_171); stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); - stringBuffer.append(TEXT_174); + stringBuffer.append(TEXT_172); } // end of link iteration - stringBuffer.append(TEXT_175); + stringBuffer.append(TEXT_173); stringBuffer.append(importedAbstractExprCls); + stringBuffer.append(TEXT_174); + stringBuffer.append(importedAbstractExprCls); + stringBuffer.append(TEXT_175); + stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); stringBuffer.append(TEXT_176); stringBuffer.append(importedAbstractExprCls); stringBuffer.append(TEXT_177); - stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName()); + stringBuffer.append(importedAbstractExprCls); stringBuffer.append(TEXT_178); stringBuffer.append(importedAbstractExprCls); stringBuffer.append(TEXT_179); @@ -923,22 +921,18 @@ String __javaOperationContainer; stringBuffer.append(TEXT_180); stringBuffer.append(importedAbstractExprCls); stringBuffer.append(TEXT_181); - stringBuffer.append(importedAbstractExprCls); - stringBuffer.append(TEXT_182); - stringBuffer.append(importedAbstractExprCls); - stringBuffer.append(TEXT_183); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_184); + stringBuffer.append(TEXT_182); stringBuffer.append(importManager.getImportedName("java.util.Collections")); - stringBuffer.append(TEXT_185); + stringBuffer.append(TEXT_183); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_186); + stringBuffer.append(TEXT_184); if(hasJavaConstraints) { - stringBuffer.append(TEXT_187); + stringBuffer.append(TEXT_185); stringBuffer.append(javaConstraintsContainer); - stringBuffer.append(TEXT_188); + stringBuffer.append(TEXT_186); for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) { GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints(); @@ -953,7 +947,6 @@ if(hasJavaConstraints) { if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider) { __exprEnvVariables.put(oppositeEndVarName, targetContext); - stringBuffer.append(TEXT_189); /* ValueExpression __genValueExpression @@ -974,13 +967,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_190); + stringBuffer.append(TEXT_187); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_191); + stringBuffer.append(TEXT_188); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_192); + stringBuffer.append(TEXT_189); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_193); + stringBuffer.append(TEXT_190); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -988,17 +981,17 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_194); + stringBuffer.append(TEXT_191); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_195); + stringBuffer.append(TEXT_192); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_196); + stringBuffer.append(TEXT_193); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_197); + stringBuffer.append(TEXT_194); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_198); + stringBuffer.append(TEXT_195); } /* end of GenJavaExpressionProvider */ @@ -1009,7 +1002,6 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression __genExprContext = targetContext; __exprEnvVariables.put(oppositeEndVarName, srcContext); - stringBuffer.append(TEXT_199); /* ValueExpression __genValueExpression @@ -1030,13 +1022,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_200); + stringBuffer.append(TEXT_196); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_201); + stringBuffer.append(TEXT_197); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_202); + stringBuffer.append(TEXT_198); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_203); + stringBuffer.append(TEXT_199); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -1044,17 +1036,17 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_204); + stringBuffer.append(TEXT_200); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_205); + stringBuffer.append(TEXT_201); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_206); + stringBuffer.append(TEXT_202); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_207); + stringBuffer.append(TEXT_203); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_208); + stringBuffer.append(TEXT_204); } /* end of GenJavaExpressionProvider */ @@ -1062,16 +1054,16 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression } } /*java constraints iteration*/ - stringBuffer.append(TEXT_209); + stringBuffer.append(TEXT_205); stringBuffer.append(javaConstraintsContainer); } /* end of hasJavaConstraints */ - stringBuffer.append(TEXT_210); + stringBuffer.append(TEXT_206); } /*end of hasLinkCreationConstraints()*/ - stringBuffer.append(TEXT_211); + stringBuffer.append(TEXT_207); importManager.emitSortedImports(); - stringBuffer.append(TEXT_212); + stringBuffer.append(TEXT_208); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/MetricProviderGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/MetricProviderGenerator.java index 555c520ba..0ee005925 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/MetricProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/MetricProviderGenerator.java @@ -17,191 +17,189 @@ public class MetricProviderGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static "; - protected final String TEXT_6 = " context2MetricsMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static "; - protected final String TEXT_7 = " metricsRegistry;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static "; - protected final String TEXT_8 = " key2MetricMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int MAX_VISIBLE_KEY_CHAR_COUNT = 8;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class MetricsAction extends "; - protected final String TEXT_9 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String ACTION_KEY = \"metricsAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate IWorkbenchPart myWorkbenchPart;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic MetricsAction(IWorkbenchPart workbenchPart) {" + NL + "\t\t\tsetId(ACTION_KEY);" + NL + "\t\t\tsetText(\"Metrics\");" + NL + "\t\t\tmyWorkbenchPart = workbenchPart;" + NL + "\t\t\tsetEnabled(myWorkbenchPart instanceof "; - protected final String TEXT_10 = ");" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\t"; - protected final String TEXT_11 = " metricsView = null;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmetricsView = "; - protected final String TEXT_12 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ResultView.VIEW_ID);\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(metricsView == null) {" + NL + "\t\t\t\t\tmetricsView = "; - protected final String TEXT_13 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ResultView.VIEW_ID);\t\t\t\t\t"; - protected final String TEXT_14 = NL + "\t\t\t\t} else {"; - protected final String TEXT_15 = NL + "\t\t\t\t}" + NL + "\t\t\t\tif (metricsView != null) {"; - protected final String TEXT_16 = NL + "\t\t\t\t\tfinal "; - protected final String TEXT_17 = " part = ("; - protected final String TEXT_18 = ") myWorkbenchPart;" + NL + "\t\t\t\t\t((ResultView)metricsView).setInput(part);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tmyWorkbenchPart.getSite().getPage().activate(metricsView);\t\t\t\t\t" + NL + "\t\t\t} catch ("; - protected final String TEXT_19 = " e) {" + NL + "\t\t\t\t"; - protected final String TEXT_20 = ".getInstance().logError(\"Diagram metric view failure\", e); //$NON-NLS-1$" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tstatic "; - protected final String TEXT_21 = " calculateMetrics("; - protected final String TEXT_22 = " diagramPart) {" + NL + "\t\t"; - protected final String TEXT_23 = " viewer = ("; - protected final String TEXT_24 = ") diagramPart.getAdapter("; - protected final String TEXT_25 = ".class);" + NL + "\t\tfinal "; - protected final String TEXT_26 = " diagram = diagramPart.getDiagram();" + NL + "\t\tif (viewer == null || diagram == null) {" + NL + "\t\t\treturn "; - protected final String TEXT_27 = ".EMPTY_LIST;" + NL + "\t\t}" + NL + "\t\tfinal "; - protected final String TEXT_28 = " viewService = new "; - protected final String TEXT_29 = "(viewer);" + NL + "\t\ttry {" + NL + "\t\t\treturn ("; - protected final String TEXT_30 = ")diagramPart.getEditingDomain().runExclusive(" + NL + "\t\t\t\tnew org.eclipse.emf.transaction.RunnableWithResult.Impl() {" + NL + "\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_31 = " metrics = " + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram, new "; - protected final String TEXT_32 = "(50));" + NL + "\t\t\t\t\t\tif(diagram.getElement() != null) {" + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram.getElement(), metrics);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t// detach from EObject and bind to viewID" + NL + "\t\t\t\t\t\tjava.util.HashSet elements = new java.util.HashSet();" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\telements.add(elementMetrics.target);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\tView targetView = elementMetrics.target instanceof View ? (View) elementMetrics.target : viewService.findView(elementMetrics.target);" + NL + "\t\t\t\t\t\t\tif (targetView != null) {" + NL + "\t\t\t\t\t\t\t\telementMetrics.target = null; // detach EObject" + NL + "\t\t\t\t\t\t\t\telementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tsetResult(metrics);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t});" + NL + "\t\t} catch(InterruptedException e) {" + NL + "\t\t\treturn "; - protected final String TEXT_33 = ".EMPTY_LIST;\t\t" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic "; - protected final String TEXT_34 = " calculateMetrics(EObject target, "; - protected final String TEXT_35 = " metricsList) {" + NL + "\t\tfinal EObject root = target;" + NL + "\t\t"; - protected final String TEXT_36 = " it = new "; - protected final String TEXT_37 = "() {" + NL + "\t\t\t"; - protected final String TEXT_38 = " contentsIt = root.eAllContents();" + NL + "\t\t\tboolean isInRoot = true;" + NL + "\t\t\tpublic boolean hasNext() {" + NL + "\t\t\t\treturn isInRoot || contentsIt.hasNext();" + NL + "\t\t\t}" + NL + "\t\t\tpublic Object next() {" + NL + "\t\t\t\tif(isInRoot) {" + NL + "\t\t\t\t\tisInRoot = false;" + NL + "\t\t\t\t\treturn root;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn contentsIt.next();" + NL + "\t\t\t}" + NL + "\t\t\tpublic void remove() {" + NL + "\t\t\t\tthrow new UnsupportedOperationException();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t" + NL + "\t\t"; - protected final String TEXT_39 = " metricsPerContext = new "; - protected final String TEXT_40 = "();" + NL + "\t\twhile(it.hasNext()) {" + NL + "\t\t\tObject nextElement = it.next();" + NL + "\t\t\tif(nextElement instanceof EObject) {" + NL + "\t\t\t\tEObject nextEObj = (EObject)nextElement;" + NL + "\t\t\t\tEClass nextTarget = nextEObj.eClass();" + NL + "\t\t\t\t"; - protected final String TEXT_41 = " superTypeIt = nextTarget.getEAllSuperTypes().iterator();" + NL + "\t\t\t\twhile(nextTarget != null) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_42 = " metricList = getMetricsForTarget(nextTarget);" + NL + "\t\t\t\t\tif(metricList != null) {" + NL + "\t\t\t\t\t\tfor ("; - protected final String TEXT_43 = " metricIt = metricList.iterator(); metricIt.hasNext(); ) {" + NL + "\t\t\t\t\t\t\tMetricDef nextMetric = (MetricDef) metricIt.next();" + NL + "\t\t\t\t\t\t\tif(nextMetric.appliesTo(nextEObj)) {" + NL + "\t\t\t\t\t\t\t\tMetric metric = new Metric(nextMetric, nextEObj);" + NL + "\t\t\t\t\t\t\t\tmetricsPerContext.add(metric);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tnextTarget = superTypeIt.hasNext() ? (EClass)superTypeIt.next() : null; " + NL + "\t\t\t\t}" + NL + "\t\t\t\t" + NL + "\t\t\t\tif(!metricsPerContext.isEmpty()) {" + NL + "\t\t\t\t\tmetricsList.add(new ElementMetrics(nextEObj, " + NL + "\t\t\t\t\t\t\t(Metric[])metricsPerContext.toArray(new Metric[metricsPerContext.size()])));" + NL + "\t\t\t\t\tmetricsPerContext.clear();\t\t\t\t" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\treturn metricsList;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class ResultView extends "; - protected final String TEXT_44 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String VIEW_ID = \""; - protected final String TEXT_45 = "\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */ " + NL + "\t\tprivate TableViewer viewer;"; - protected final String TEXT_46 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_47 = " editorInput;"; - protected final String TEXT_48 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_49 = " diagramURI;"; - protected final String TEXT_50 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t void setInput("; - protected final String TEXT_51 = " diagramPart) {" + NL + "\t\t\t"; - protected final String TEXT_52 = " resource = diagramPart.getDiagram().eResource();"; - protected final String TEXT_53 = NL + "\t\t\tthis.editorInput = diagramPart.getEditorInput();"; - protected final String TEXT_54 = NL + "\t\t\tthis.diagramURI = resource.getURI();"; - protected final String TEXT_55 = NL + "\t\t\tsetTitleToolTip(resource.getURI().path());" + NL + "" + NL + "\t\t\t"; - protected final String TEXT_56 = " metrics = calculateMetrics(diagramPart);" + NL + "\t \tadjustLayout(metrics);" + NL + "\t \tviewer.setInput(metrics);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t private void adjustLayout("; - protected final String TEXT_57 = " metricResultList) {" + NL + "\t \t"; - protected final String TEXT_58 = " maxValStrMap = calcMetricMaxValueStrLenMap(metricResultList);" + NL + "\t\t\tTable table = viewer.getTable();" + NL + "\t\t\tTableLayout layout = new TableLayout();" + NL + "\t\t\t" + NL + "\t\t\t"; - protected final String TEXT_59 = " gc = new "; - protected final String TEXT_60 = "(table);" + NL + "\t\t\tgc.setFont("; - protected final String TEXT_61 = ".getDialogFont());" + NL + "\t\t\tint padding = gc.stringExtent(\"X\").x * 2; //$NON-NLS-1$" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = (MetricDef)getMetrics().get(i);" + NL + "\t\t\t\tString valueStr = (String)maxValStrMap.get(nextMetric.key);" + NL + "\t\t\t\tint minWidth = valueStr != null ? gc.stringExtent(valueStr).x + padding : 20;\t\t\t" + NL + "\t\t\t\tlayout.addColumnData(new ColumnPixelData(minWidth, true));" + NL + "\t\t\t}" + NL + "\t\t\tgc.dispose();" + NL + "\t\t\t" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(1, 50, true));" + NL + "\t\t\tviewer.getTable().setLayout(layout);" + NL + "\t\t\tviewer.getTable().layout(true, true);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createPartControl(Composite parent) {" + NL + "\t\t\tthis.viewer = new TableViewer(parent, SWT.FULL_SELECTION);" + NL + "\t\t\tfinal Table table = viewer.getTable();" + NL + "\t\t\ttable.setHeaderVisible(true);" + NL + "\t\t\ttable.setLinesVisible(true);" + NL + "" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = ((MetricDef)getMetrics().get(i));" + NL + "\t\t\t\tTableColumn column = new TableColumn(table, SWT.NONE);" + NL + "\t\t\t\tcolumn.setAlignment(SWT.RIGHT);" + NL + "\t\t\t\tcolumn.setMoveable(true);" + NL + "\t\t\t\tcolumn.setText(nextMetric.key);" + NL + "\t\t\t\tcolumn.setToolTipText(nextMetric.getToolTipText());" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tTableColumn objectColumn = new TableColumn(table, SWT.NONE);" + NL + "\t\t\tobjectColumn.setText(\"Element\");" + NL + "\t\t\tobjectColumn.setToolTipText(\"Measurement element\");" + NL + "" + NL + "\t\t\tviewer.setLabelProvider(new Labels());" + NL + "\t\t\tviewer.setContentProvider(new ArrayContentProvider());" + NL + "\t\t\tviewer.addOpenListener(new IOpenListener() {" + NL + "\t\t\t\tpublic void open(OpenEvent event) {" + NL + "\t\t\t\t\thandleOpen(event);" + NL + "\t\t\t\t}" + NL + "\t\t\t});" + NL + "" + NL + "\t\t\t"; - protected final String TEXT_62 = " headerSelListener = new "; - protected final String TEXT_63 = "() {" + NL + "\t\t\t\tpublic void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {" + NL + "\t\t\t\t\ttable.setSortColumn((TableColumn)e.getSource());" + NL + "\t\t\t\t\ttable.setSortDirection((table.getSortDirection() != SWT.DOWN) ? SWT.DOWN : SWT.UP);" + NL + "\t\t\t\t\tviewer.refresh();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tpublic void widgetDefaultSelected("; - protected final String TEXT_64 = " e) {" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTableColumn[] columns = viewer.getTable().getColumns();" + NL + "\t\t\tfor (int i = 0; i < columns.length; i++) {" + NL + "\t\t\t\tcolumns[i].addSelectionListener(headerSelListener);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tviewer.setSorter(" + NL + "\t\t\t\tnew ViewerSorter() {" + NL + "\t\t\t\t\tpublic int compare(Viewer viewer, Object e1, Object e2) {" + NL + "\t\t\t\t\t\tTableColumn c = table.getSortColumn();" + NL + "\t\t\t\t\t\tint result = 0;" + NL + "\t\t\t\t\t\tif(c != null) {" + NL + "\t\t\t\t\t\t\tMetric mc1 = ((ElementMetrics)e1).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tMetric mc2 = ((ElementMetrics)e2).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tresult = (mc1 != null && mc2 != null) ?" + NL + "\t\t\t\t\t\t\t\tmc1.compareTo(mc2) : (mc1 == null ? -1 : 1);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tresult = ((ElementMetrics)e1).targetElementQName.compareTo(((ElementMetrics)e2).targetElementQName);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\treturn table.getSortDirection() == SWT.DOWN ? result : -result;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t);" + NL; - protected final String TEXT_65 = NL + "\t "; - protected final String TEXT_66 = " editor = getSite().getPage().getActiveEditor();" + NL + "\t if(editor instanceof "; - protected final String TEXT_67 = ") {" + NL + "\t\t\t\tsetInput(("; - protected final String TEXT_68 = ") editor);" + NL + "\t }"; - protected final String TEXT_69 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void handleOpen(OpenEvent event) {"; - protected final String TEXT_70 = NL + "\t\t\t"; - protected final String TEXT_71 = " diagramPart;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tif (editorInput == null) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t"; - protected final String TEXT_72 = " editorPart = getSite().getPage()" + NL + "\t\t\t\t\t.openEditor(editorInput," + NL + "\t\t\t\t\t\t\t"; - protected final String TEXT_73 = ".ID);" + NL + "\t\t\t\tif(false == editorPart instanceof "; - protected final String TEXT_74 = ") {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tdiagramPart = ("; - protected final String TEXT_75 = ") editorPart;" + NL + "\t\t\t} catch ("; - protected final String TEXT_76 = " e) {" + NL + "\t\t\t\t"; - protected final String TEXT_77 = ".getInstance().logError(\"Can't open diagram editor\", e); //$NON-NLS-1$" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}"; - protected final String TEXT_78 = NL + "\t\t\tif (diagramURI == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_79 = " viewPart = "; - protected final String TEXT_80 = ".showView(diagramURI);" + NL + "\t\t\tif(false == viewPart instanceof "; - protected final String TEXT_81 = ") {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_82 = " diagramPart = ("; - protected final String TEXT_83 = ") viewPart;"; - protected final String TEXT_84 = NL + "\t\t\t"; - protected final String TEXT_85 = " graphicalViewer = ("; - protected final String TEXT_86 = ") diagramPart.getAdapter("; - protected final String TEXT_87 = ".class);" + NL + "\t\t\tElementMetrics selection = (ElementMetrics)(("; - protected final String TEXT_88 = ")event.getSelection()).getFirstElement();" + NL + "\t\t\tString viewID = selection.diagramElementID;" + NL + "\t\t\tif(viewID != null) {" + NL + "\t\t\t\tView targetView = (View)diagramPart.getDiagram().eResource().getEObject(viewID);" + NL + "\t\t\t\tif(targetView != null) {" + NL + "\t\t\t\t\torg.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart)graphicalViewer.getEditPartRegistry().get(targetView);" + NL + "\t\t\t\t\tif(targetEditPart != null) {" + NL + "\t\t\t\t\t\tgraphicalViewer.setSelection(new "; - protected final String TEXT_89 = "(targetEditPart));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate static "; - protected final String TEXT_90 = " calcMetricMaxValueStrLenMap("; - protected final String TEXT_91 = " allMetrics) {" + NL + "\t\t\t"; - protected final String TEXT_92 = " metric2MaxStrLen = new "; - protected final String TEXT_93 = "();" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tString nextKey = ((MetricDef)getMetrics().get(i)).key; " + NL + "\t\t\t\tint trimPos = Math.min(nextKey.length(), MAX_VISIBLE_KEY_CHAR_COUNT);" + NL + "\t\t\t\tmetric2MaxStrLen.put(nextKey, nextKey.substring(0, trimPos));\t\t\t" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfor ("; - protected final String TEXT_94 = " it = allMetrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\tfor (int i = 0; i < elementMetrics.metrics.length; i++) {" + NL + "\t\t\t\t\tMetric metric = elementMetrics.metrics[i];" + NL + "\t\t\t\t\tString valueStr = (String)metric2MaxStrLen.get(metric.def.key);" + NL + "\t\t\t\t\tif(valueStr == null || metric.displayValue.length() > valueStr.length()) {" + NL + "\t\t\t\t\t\tmetric2MaxStrLen.put(metric.def.key, metric.displayValue);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn metric2MaxStrLen;\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setFocus() {" + NL + "\t\t}\t\t" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate class Labels extends LabelProvider implements ITableLabelProvider, ITableColorProvider {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tprivate boolean isElementColumn(int columnIndex) {" + NL + "\t\t\t\treturn columnIndex >= getMetrics().size();" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; - protected final String TEXT_95 = " getColumnImage(Object element, int columnIndex) {\t\t\t\t" + NL + "\t\t\t\treturn isElementColumn(columnIndex) ? ((ElementMetrics)element).elementImage : null;" + NL + "\t\t\t}\t\t" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic String getColumnText(Object element, int columnIndex) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics)element;" + NL + "\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(columnIndex == getMetrics().size()) {" + NL + "\t\t\t\t\treturn elementMetrics.targetElementQName;" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = elementMetrics.getMetricByKey(key);" + NL + "\t\t\t\treturn (metric != null) ? metric.displayValue : \"-\"; //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; - protected final String TEXT_96 = " getBackground(Object element, int columnIndex) {" + NL + "\t\t\t\treturn null; " + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; - protected final String TEXT_97 = " getForeground(Object element, int columnIndex) {" + NL + "\t\t\t\tif(isElementColumn(columnIndex)) return null;" + NL + "\t\t\t\tElementMetrics columnElement = (ElementMetrics)element;" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = columnElement.getMetricByKey(key);\t\t\t" + NL + "\t\t\t\tif(metric != null && metric.value != null) {" + NL + "\t\t\t\t\tif (metric.def.highLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.highLimit.longValue() < metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn "; - protected final String TEXT_98 = ".red;" + NL + "\t\t\t\t\t} else if (metric.def.lowLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.lowLimit.longValue() > metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn "; - protected final String TEXT_99 = ".blue;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ElementMetrics {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal Metric[] metrics;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String targetElementQName;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal "; - protected final String TEXT_100 = " elementImage;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString diagramElementID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tEObject target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tElementMetrics(EObject target, Metric[] metrics) {" + NL + "\t\t\tthis.metrics = metrics;\t" + NL + "\t\t\tassert metrics.length > 0;" + NL + "\t\t\tthis.target = target;" + NL + "\t\t\t" + NL + "\t\t\tEClass imageTarget = target.eClass();\t\t\t" + NL + "\t\t\tif (target instanceof View) {" + NL + "\t\t\t\tView viewTarget = (View) target;" + NL + "\t\t\t\tStringBuffer notationQNameBuf = new StringBuffer();" + NL + "\t\t\t\tnotationQNameBuf.append(formatElement(viewTarget));" + NL + "\t\t\t\tif (\"\".equals(viewTarget.getType()) && viewTarget.getElement() != null) { //$NON-NLS-1$" + NL + "\t\t\t\t\tnotationQNameBuf" + NL + "\t\t\t\t\t\t.append('-').append('>')" + NL + "\t\t\t\t\t\t.append(formatElement(viewTarget.getElement()));" + NL + "\t\t\t\t\timageTarget = viewTarget.getElement().eClass();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tint visualID = "; - protected final String TEXT_101 = ".getVisualID(viewTarget);" + NL + "\t\t\t\tnotationQNameBuf.append('[').append(visualID < 0 ? Integer.toString(System.identityHashCode(viewTarget)) : Integer.toString(visualID)).append(']');\t\t\t\t" + NL + "" + NL + "\t\t\t\tthis.targetElementQName = notationQNameBuf.toString();" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.targetElementQName = formatElement(target);" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = "; - protected final String TEXT_102 = ".getInstance().getItemImage(imageTarget);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String formatElement("; - protected final String TEXT_103 = " object) {" + NL + "\t\t\tif (object == null) {" + NL + "\t\t\t\treturn String.valueOf((Object)null);" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_104 = " adapterFactory = "; - protected final String TEXT_105 = ".getInstance().getItemProvidersAdapterFactory();" + NL + "\t\t\t"; - protected final String TEXT_106 = " labelProvider = ("; - protected final String TEXT_107 = ") adapterFactory.adapt(object, "; - protected final String TEXT_108 = ".class);" + NL + "\t\t\tif (labelProvider != null) {" + NL + "\t\t\t\treturn object.eClass() + \" \" + labelProvider.getText(object);" + NL + "\t\t\t}" + NL + "\t\t\treturn object.toString();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetric getMetricByKey(String key) {" + NL + "\t\t\tfor (int i = 0; i < metrics.length; i++) {" + NL + "\t\t\t\tif(metrics[i].def.key.equals(key)) {" + NL + "\t\t\t\t\treturn metrics[i]; " + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Metric implements Comparable {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal MetricDef def;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Number value;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String displayValue;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetric(MetricDef def, EObject target) {" + NL + "\t\t\tthis.def = def;" + NL + "\t\t\tvalue = def.calcMetric(target);" + NL + "\t\t\tthis.displayValue = (value != null) ? java.text.NumberFormat.getInstance().format(value) : \"null\"; //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic int compareTo(Object other) {" + NL + "\t\t\tMetric otherMetric = (Metric)other;" + NL + "\t\t\tif(value != null && otherMetric.value != null) {" + NL + "\t\t\t\treturn (value.longValue() < otherMetric.value.longValue()) ? " + NL + "\t\t\t\t\t\t-1 : (value.longValue() == otherMetric.value.longValue() ? 0 : 1);" + NL + "\t\t\t}" + NL + "\t\t\treturn (value == null && otherMetric.value == null) ? " + NL + "\t\t\t\t\t0 : (value == null) ? -1 : 1;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricDef {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Double lowLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Double highLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String key;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal "; - protected final String TEXT_109 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal int[] semanticIDs;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String name;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String description;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetricDef(String key, "; - protected final String TEXT_110 = " expression, int[] semanticIDs, " + NL + "\t\t\tDouble low, Double high, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.expression = expression;" + NL + "\t\t\tthis.semanticIDs = semanticIDs;" + NL + "\t\t\tthis.lowLimit = low;" + NL + "\t\t\tthis.highLimit = high;" + NL + "\t\t\tthis.name = name;" + NL + "\t\t\tthis.description = description;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tNumber calcMetric(Object contextInstance) {" + NL + "\t\t\tObject val = expression.evaluate(contextInstance);" + NL + "\t\t\treturn (val instanceof Number) ? (Number)val : null;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tboolean appliesTo(EObject eObject) {" + NL + "\t\t\tif(eObject instanceof View && semanticIDs != null) {" + NL + "\t\t\t\tint eObjectID = "; - protected final String TEXT_111 = ".getVisualID((View)eObject);" + NL + "\t\t\t\tfor(int i = 0; i < semanticIDs.length; i++) {" + NL + "\t\t\t\t\tif(semanticIDs[i] == eObjectID) {" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && (expression.context() instanceof EClass) && " + NL + "\t\t\t\t((EClass)expression.context()).isSuperTypeOf(eObject.eClass());" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString getToolTipText() {" + NL + "\t\t\tStringBuffer buf = new StringBuffer();" + NL + "\t\t\tif(name != null) buf.append(name);" + NL + "\t\t\tif(description != null) buf.append('\\n').append(description).append('\\n');" + NL + "\t\t\tif(lowLimit != null) buf.append(\"low:\").append(lowLimit);" + NL + "\t\t\tif(highLimit != null) buf.append(\" high:\").append(highLimit);" + NL + "\t\t\treturn buf.toString();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; - protected final String TEXT_112 = "/*MetricDef*/ getMetricsForTarget(EClass target) {" + NL + "\t\tif(context2MetricsMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn ("; - protected final String TEXT_113 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; - protected final String TEXT_114 = " getMetrics() {" + NL + "\t\tif(metricsRegistry == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn metricsRegistry;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static Number calculateMetric(String metricKey, Object contextInstance) {" + NL + "\t\tif (key2MetricMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\tMetricDef metric = (MetricDef)key2MetricMap.get(metricKey);" + NL + "\t\tNumber value = (metric != null) ? metric.calcMetric(contextInstance) : null;" + NL + "\t\treturn (value != null && !(value instanceof Double)) ? new Double(value.doubleValue()) : value;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;"; - protected final String TEXT_115 = "\t\t" + NL + "\t\t"; - protected final String TEXT_116 = NL; - protected final String TEXT_117 = " "; - protected final String TEXT_118 = " = new "; - protected final String TEXT_119 = "(3);"; - protected final String TEXT_120 = ".put(\""; - protected final String TEXT_121 = "\", "; - protected final String TEXT_122 = "); //$NON-NLS-1$"; - protected final String TEXT_123 = NL + "\t\tregister(new MetricDef("; - protected final String TEXT_124 = "," + NL + "\t\t\t"; - protected final String TEXT_125 = "null"; - protected final String TEXT_126 = "."; - protected final String TEXT_127 = "("; - protected final String TEXT_128 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_129 = ", "; - protected final String TEXT_130 = ")"; - protected final String TEXT_131 = "."; - protected final String TEXT_132 = "("; - protected final String TEXT_133 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_134 = ")"; - protected final String TEXT_135 = "new "; - protected final String TEXT_136 = "("; - protected final String TEXT_137 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_138 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_139 = " self = ("; - protected final String TEXT_140 = ")context;"; - protected final String TEXT_141 = "\t" + NL + "\t\t"; - protected final String TEXT_142 = " "; - protected final String TEXT_143 = " = ("; - protected final String TEXT_144 = ")env.get(\""; - protected final String TEXT_145 = "\"); //$NON-NLS-1$"; - protected final String TEXT_146 = NL + "\t\treturn "; - protected final String TEXT_147 = "."; - protected final String TEXT_148 = "(self"; - protected final String TEXT_149 = ", "; - protected final String TEXT_150 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_151 = NL + ","; - protected final String TEXT_152 = NL + "\t\t\t"; - protected final String TEXT_153 = "," + NL + "\t\t\t"; - protected final String TEXT_154 = "new Double("; - protected final String TEXT_155 = ")"; - protected final String TEXT_156 = "null"; - protected final String TEXT_157 = ",\t\t\t\t\t" + NL + "\t\t\t"; - protected final String TEXT_158 = "new Double("; - protected final String TEXT_159 = ")"; - protected final String TEXT_160 = "null"; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_4 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static "; + protected final String TEXT_5 = " context2MetricsMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static "; + protected final String TEXT_6 = " metricsRegistry;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static "; + protected final String TEXT_7 = " key2MetricMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int MAX_VISIBLE_KEY_CHAR_COUNT = 8;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class MetricsAction extends "; + protected final String TEXT_8 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String ACTION_KEY = \"metricsAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate IWorkbenchPart myWorkbenchPart;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic MetricsAction(IWorkbenchPart workbenchPart) {" + NL + "\t\t\tsetId(ACTION_KEY);" + NL + "\t\t\tsetText(\"Metrics\");" + NL + "\t\t\tmyWorkbenchPart = workbenchPart;" + NL + "\t\t\tsetEnabled(myWorkbenchPart instanceof "; + protected final String TEXT_9 = ");" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\t"; + protected final String TEXT_10 = " metricsView = null;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmetricsView = "; + protected final String TEXT_11 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ResultView.VIEW_ID);\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(metricsView == null) {" + NL + "\t\t\t\t\tmetricsView = "; + protected final String TEXT_12 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ResultView.VIEW_ID);\t\t\t\t\t"; + protected final String TEXT_13 = NL + "\t\t\t\t} else {"; + protected final String TEXT_14 = NL + "\t\t\t\t}" + NL + "\t\t\t\tif (metricsView != null) {"; + protected final String TEXT_15 = NL + "\t\t\t\t\tfinal "; + protected final String TEXT_16 = " part = ("; + protected final String TEXT_17 = ") myWorkbenchPart;" + NL + "\t\t\t\t\t((ResultView)metricsView).setInput(part);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tmyWorkbenchPart.getSite().getPage().activate(metricsView);\t\t\t\t\t" + NL + "\t\t\t} catch ("; + protected final String TEXT_18 = " e) {" + NL + "\t\t\t\t"; + protected final String TEXT_19 = ".getInstance().logError(\"Diagram metric view failure\", e); //$NON-NLS-1$" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tstatic "; + protected final String TEXT_20 = " calculateMetrics("; + protected final String TEXT_21 = " diagramPart) {" + NL + "\t\t"; + protected final String TEXT_22 = " viewer = ("; + protected final String TEXT_23 = ") diagramPart.getAdapter("; + protected final String TEXT_24 = ".class);" + NL + "\t\tfinal "; + protected final String TEXT_25 = " diagram = diagramPart.getDiagram();" + NL + "\t\tif (viewer == null || diagram == null) {" + NL + "\t\t\treturn "; + protected final String TEXT_26 = ".EMPTY_LIST;" + NL + "\t\t}" + NL + "\t\tfinal "; + protected final String TEXT_27 = " viewService = new "; + protected final String TEXT_28 = "(viewer);" + NL + "\t\ttry {" + NL + "\t\t\treturn ("; + protected final String TEXT_29 = ")diagramPart.getEditingDomain().runExclusive(" + NL + "\t\t\t\tnew org.eclipse.emf.transaction.RunnableWithResult.Impl() {" + NL + "\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_30 = " metrics = " + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram, new "; + protected final String TEXT_31 = "(50));" + NL + "\t\t\t\t\t\tif(diagram.getElement() != null) {" + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram.getElement(), metrics);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t// detach from EObject and bind to viewID" + NL + "\t\t\t\t\t\tjava.util.HashSet elements = new java.util.HashSet();" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\telements.add(elementMetrics.target);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\tView targetView = elementMetrics.target instanceof View ? (View) elementMetrics.target : viewService.findView(elementMetrics.target);" + NL + "\t\t\t\t\t\t\tif (targetView != null) {" + NL + "\t\t\t\t\t\t\t\telementMetrics.target = null; // detach EObject" + NL + "\t\t\t\t\t\t\t\telementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tsetResult(metrics);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t});" + NL + "\t\t} catch(InterruptedException e) {" + NL + "\t\t\treturn "; + protected final String TEXT_32 = ".EMPTY_LIST;\t\t" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic "; + protected final String TEXT_33 = " calculateMetrics(EObject target, "; + protected final String TEXT_34 = " metricsList) {" + NL + "\t\tfinal EObject root = target;" + NL + "\t\t"; + protected final String TEXT_35 = " it = new "; + protected final String TEXT_36 = "() {" + NL + "\t\t\t"; + protected final String TEXT_37 = " contentsIt = root.eAllContents();" + NL + "\t\t\tboolean isInRoot = true;" + NL + "\t\t\tpublic boolean hasNext() {" + NL + "\t\t\t\treturn isInRoot || contentsIt.hasNext();" + NL + "\t\t\t}" + NL + "\t\t\tpublic Object next() {" + NL + "\t\t\t\tif(isInRoot) {" + NL + "\t\t\t\t\tisInRoot = false;" + NL + "\t\t\t\t\treturn root;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn contentsIt.next();" + NL + "\t\t\t}" + NL + "\t\t\tpublic void remove() {" + NL + "\t\t\t\tthrow new UnsupportedOperationException();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t" + NL + "\t\t"; + protected final String TEXT_38 = " metricsPerContext = new "; + protected final String TEXT_39 = "();" + NL + "\t\twhile(it.hasNext()) {" + NL + "\t\t\tObject nextElement = it.next();" + NL + "\t\t\tif(nextElement instanceof EObject) {" + NL + "\t\t\t\tEObject nextEObj = (EObject)nextElement;" + NL + "\t\t\t\tEClass nextTarget = nextEObj.eClass();" + NL + "\t\t\t\t"; + protected final String TEXT_40 = " superTypeIt = nextTarget.getEAllSuperTypes().iterator();" + NL + "\t\t\t\twhile(nextTarget != null) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_41 = " metricList = getMetricsForTarget(nextTarget);" + NL + "\t\t\t\t\tif(metricList != null) {" + NL + "\t\t\t\t\t\tfor ("; + protected final String TEXT_42 = " metricIt = metricList.iterator(); metricIt.hasNext(); ) {" + NL + "\t\t\t\t\t\t\tMetricDef nextMetric = (MetricDef) metricIt.next();" + NL + "\t\t\t\t\t\t\tif(nextMetric.appliesTo(nextEObj)) {" + NL + "\t\t\t\t\t\t\t\tMetric metric = new Metric(nextMetric, nextEObj);" + NL + "\t\t\t\t\t\t\t\tmetricsPerContext.add(metric);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tnextTarget = superTypeIt.hasNext() ? (EClass)superTypeIt.next() : null; " + NL + "\t\t\t\t}" + NL + "\t\t\t\t" + NL + "\t\t\t\tif(!metricsPerContext.isEmpty()) {" + NL + "\t\t\t\t\tmetricsList.add(new ElementMetrics(nextEObj, " + NL + "\t\t\t\t\t\t\t(Metric[])metricsPerContext.toArray(new Metric[metricsPerContext.size()])));" + NL + "\t\t\t\t\tmetricsPerContext.clear();\t\t\t\t" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\treturn metricsList;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class ResultView extends "; + protected final String TEXT_43 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String VIEW_ID = \""; + protected final String TEXT_44 = "\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */ " + NL + "\t\tprivate TableViewer viewer;"; + protected final String TEXT_45 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_46 = " editorInput;"; + protected final String TEXT_47 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_48 = " diagramURI;"; + protected final String TEXT_49 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t void setInput("; + protected final String TEXT_50 = " diagramPart) {" + NL + "\t\t\t"; + protected final String TEXT_51 = " resource = diagramPart.getDiagram().eResource();"; + protected final String TEXT_52 = NL + "\t\t\tthis.editorInput = diagramPart.getEditorInput();"; + protected final String TEXT_53 = NL + "\t\t\tthis.diagramURI = resource.getURI();"; + protected final String TEXT_54 = NL + "\t\t\tsetTitleToolTip(resource.getURI().path());" + NL + "" + NL + "\t\t\t"; + protected final String TEXT_55 = " metrics = calculateMetrics(diagramPart);" + NL + "\t \tadjustLayout(metrics);" + NL + "\t \tviewer.setInput(metrics);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t private void adjustLayout("; + protected final String TEXT_56 = " metricResultList) {" + NL + "\t \t"; + protected final String TEXT_57 = " maxValStrMap = calcMetricMaxValueStrLenMap(metricResultList);" + NL + "\t\t\tTable table = viewer.getTable();" + NL + "\t\t\tTableLayout layout = new TableLayout();" + NL + "\t\t\t" + NL + "\t\t\t"; + protected final String TEXT_58 = " gc = new "; + protected final String TEXT_59 = "(table);" + NL + "\t\t\tgc.setFont("; + protected final String TEXT_60 = ".getDialogFont());" + NL + "\t\t\tint padding = gc.stringExtent(\"X\").x * 2; //$NON-NLS-1$" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = (MetricDef)getMetrics().get(i);" + NL + "\t\t\t\tString valueStr = (String)maxValStrMap.get(nextMetric.key);" + NL + "\t\t\t\tint minWidth = valueStr != null ? gc.stringExtent(valueStr).x + padding : 20;\t\t\t" + NL + "\t\t\t\tlayout.addColumnData(new ColumnPixelData(minWidth, true));" + NL + "\t\t\t}" + NL + "\t\t\tgc.dispose();" + NL + "\t\t\t" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(1, 50, true));" + NL + "\t\t\tviewer.getTable().setLayout(layout);" + NL + "\t\t\tviewer.getTable().layout(true, true);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createPartControl(Composite parent) {" + NL + "\t\t\tthis.viewer = new TableViewer(parent, SWT.FULL_SELECTION);" + NL + "\t\t\tfinal Table table = viewer.getTable();" + NL + "\t\t\ttable.setHeaderVisible(true);" + NL + "\t\t\ttable.setLinesVisible(true);" + NL + "" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = ((MetricDef)getMetrics().get(i));" + NL + "\t\t\t\tTableColumn column = new TableColumn(table, SWT.NONE);" + NL + "\t\t\t\tcolumn.setAlignment(SWT.RIGHT);" + NL + "\t\t\t\tcolumn.setMoveable(true);" + NL + "\t\t\t\tcolumn.setText(nextMetric.key);" + NL + "\t\t\t\tcolumn.setToolTipText(nextMetric.getToolTipText());" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tTableColumn objectColumn = new TableColumn(table, SWT.NONE);" + NL + "\t\t\tobjectColumn.setText(\"Element\");" + NL + "\t\t\tobjectColumn.setToolTipText(\"Measurement element\");" + NL + "" + NL + "\t\t\tviewer.setLabelProvider(new Labels());" + NL + "\t\t\tviewer.setContentProvider(new ArrayContentProvider());" + NL + "\t\t\tviewer.addOpenListener(new IOpenListener() {" + NL + "\t\t\t\tpublic void open(OpenEvent event) {" + NL + "\t\t\t\t\thandleOpen(event);" + NL + "\t\t\t\t}" + NL + "\t\t\t});" + NL + "" + NL + "\t\t\t"; + protected final String TEXT_61 = " headerSelListener = new "; + protected final String TEXT_62 = "() {" + NL + "\t\t\t\tpublic void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {" + NL + "\t\t\t\t\ttable.setSortColumn((TableColumn)e.getSource());" + NL + "\t\t\t\t\ttable.setSortDirection((table.getSortDirection() != SWT.DOWN) ? SWT.DOWN : SWT.UP);" + NL + "\t\t\t\t\tviewer.refresh();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tpublic void widgetDefaultSelected("; + protected final String TEXT_63 = " e) {" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTableColumn[] columns = viewer.getTable().getColumns();" + NL + "\t\t\tfor (int i = 0; i < columns.length; i++) {" + NL + "\t\t\t\tcolumns[i].addSelectionListener(headerSelListener);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tviewer.setSorter(" + NL + "\t\t\t\tnew ViewerSorter() {" + NL + "\t\t\t\t\tpublic int compare(Viewer viewer, Object e1, Object e2) {" + NL + "\t\t\t\t\t\tTableColumn c = table.getSortColumn();" + NL + "\t\t\t\t\t\tint result = 0;" + NL + "\t\t\t\t\t\tif(c != null) {" + NL + "\t\t\t\t\t\t\tMetric mc1 = ((ElementMetrics)e1).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tMetric mc2 = ((ElementMetrics)e2).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tresult = (mc1 != null && mc2 != null) ?" + NL + "\t\t\t\t\t\t\t\tmc1.compareTo(mc2) : (mc1 == null ? -1 : 1);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tresult = ((ElementMetrics)e1).targetElementQName.compareTo(((ElementMetrics)e2).targetElementQName);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\treturn table.getSortDirection() == SWT.DOWN ? result : -result;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t);" + NL; + protected final String TEXT_64 = NL + "\t "; + protected final String TEXT_65 = " editor = getSite().getPage().getActiveEditor();" + NL + "\t if(editor instanceof "; + protected final String TEXT_66 = ") {" + NL + "\t\t\t\tsetInput(("; + protected final String TEXT_67 = ") editor);" + NL + "\t }"; + protected final String TEXT_68 = NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void handleOpen(OpenEvent event) {"; + protected final String TEXT_69 = NL + "\t\t\t"; + protected final String TEXT_70 = " diagramPart;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tif (editorInput == null) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t"; + protected final String TEXT_71 = " editorPart = getSite().getPage()" + NL + "\t\t\t\t\t.openEditor(editorInput," + NL + "\t\t\t\t\t\t\t"; + protected final String TEXT_72 = ".ID);" + NL + "\t\t\t\tif(false == editorPart instanceof "; + protected final String TEXT_73 = ") {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tdiagramPart = ("; + protected final String TEXT_74 = ") editorPart;" + NL + "\t\t\t} catch ("; + protected final String TEXT_75 = " e) {" + NL + "\t\t\t\t"; + protected final String TEXT_76 = ".getInstance().logError(\"Can't open diagram editor\", e); //$NON-NLS-1$" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}"; + protected final String TEXT_77 = NL + "\t\t\tif (diagramURI == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_78 = " viewPart = "; + protected final String TEXT_79 = ".showView(diagramURI);" + NL + "\t\t\tif(false == viewPart instanceof "; + protected final String TEXT_80 = ") {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_81 = " diagramPart = ("; + protected final String TEXT_82 = ") viewPart;"; + protected final String TEXT_83 = NL + "\t\t\t"; + protected final String TEXT_84 = " graphicalViewer = ("; + protected final String TEXT_85 = ") diagramPart.getAdapter("; + protected final String TEXT_86 = ".class);" + NL + "\t\t\tElementMetrics selection = (ElementMetrics)(("; + protected final String TEXT_87 = ")event.getSelection()).getFirstElement();" + NL + "\t\t\tString viewID = selection.diagramElementID;" + NL + "\t\t\tif(viewID != null) {" + NL + "\t\t\t\tView targetView = (View)diagramPart.getDiagram().eResource().getEObject(viewID);" + NL + "\t\t\t\tif(targetView != null) {" + NL + "\t\t\t\t\torg.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart)graphicalViewer.getEditPartRegistry().get(targetView);" + NL + "\t\t\t\t\tif(targetEditPart != null) {" + NL + "\t\t\t\t\t\tgraphicalViewer.setSelection(new "; + protected final String TEXT_88 = "(targetEditPart));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate static "; + protected final String TEXT_89 = " calcMetricMaxValueStrLenMap("; + protected final String TEXT_90 = " allMetrics) {" + NL + "\t\t\t"; + protected final String TEXT_91 = " metric2MaxStrLen = new "; + protected final String TEXT_92 = "();" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tString nextKey = ((MetricDef)getMetrics().get(i)).key; " + NL + "\t\t\t\tint trimPos = Math.min(nextKey.length(), MAX_VISIBLE_KEY_CHAR_COUNT);" + NL + "\t\t\t\tmetric2MaxStrLen.put(nextKey, nextKey.substring(0, trimPos));\t\t\t" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfor ("; + protected final String TEXT_93 = " it = allMetrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\tfor (int i = 0; i < elementMetrics.metrics.length; i++) {" + NL + "\t\t\t\t\tMetric metric = elementMetrics.metrics[i];" + NL + "\t\t\t\t\tString valueStr = (String)metric2MaxStrLen.get(metric.def.key);" + NL + "\t\t\t\t\tif(valueStr == null || metric.displayValue.length() > valueStr.length()) {" + NL + "\t\t\t\t\t\tmetric2MaxStrLen.put(metric.def.key, metric.displayValue);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn metric2MaxStrLen;\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setFocus() {" + NL + "\t\t}\t\t" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate class Labels extends LabelProvider implements ITableLabelProvider, ITableColorProvider {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tprivate boolean isElementColumn(int columnIndex) {" + NL + "\t\t\t\treturn columnIndex >= getMetrics().size();" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; + protected final String TEXT_94 = " getColumnImage(Object element, int columnIndex) {\t\t\t\t" + NL + "\t\t\t\treturn isElementColumn(columnIndex) ? ((ElementMetrics)element).elementImage : null;" + NL + "\t\t\t}\t\t" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic String getColumnText(Object element, int columnIndex) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics)element;" + NL + "\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(columnIndex == getMetrics().size()) {" + NL + "\t\t\t\t\treturn elementMetrics.targetElementQName;" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = elementMetrics.getMetricByKey(key);" + NL + "\t\t\t\treturn (metric != null) ? metric.displayValue : \"-\"; //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; + protected final String TEXT_95 = " getBackground(Object element, int columnIndex) {" + NL + "\t\t\t\treturn null; " + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic "; + protected final String TEXT_96 = " getForeground(Object element, int columnIndex) {" + NL + "\t\t\t\tif(isElementColumn(columnIndex)) return null;" + NL + "\t\t\t\tElementMetrics columnElement = (ElementMetrics)element;" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = columnElement.getMetricByKey(key);\t\t\t" + NL + "\t\t\t\tif(metric != null && metric.value != null) {" + NL + "\t\t\t\t\tif (metric.def.highLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.highLimit.longValue() < metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn "; + protected final String TEXT_97 = ".red;" + NL + "\t\t\t\t\t} else if (metric.def.lowLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.lowLimit.longValue() > metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn "; + protected final String TEXT_98 = ".blue;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ElementMetrics {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal Metric[] metrics;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String targetElementQName;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal "; + protected final String TEXT_99 = " elementImage;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString diagramElementID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tEObject target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tElementMetrics(EObject target, Metric[] metrics) {" + NL + "\t\t\tthis.metrics = metrics;\t" + NL + "\t\t\tassert metrics.length > 0;" + NL + "\t\t\tthis.target = target;" + NL + "\t\t\t" + NL + "\t\t\tEClass imageTarget = target.eClass();\t\t\t" + NL + "\t\t\tif (target instanceof View) {" + NL + "\t\t\t\tView viewTarget = (View) target;" + NL + "\t\t\t\tStringBuffer notationQNameBuf = new StringBuffer();" + NL + "\t\t\t\tnotationQNameBuf.append(formatElement(viewTarget));" + NL + "\t\t\t\tif (\"\".equals(viewTarget.getType()) && viewTarget.getElement() != null) { //$NON-NLS-1$" + NL + "\t\t\t\t\tnotationQNameBuf" + NL + "\t\t\t\t\t\t.append('-').append('>')" + NL + "\t\t\t\t\t\t.append(formatElement(viewTarget.getElement()));" + NL + "\t\t\t\t\timageTarget = viewTarget.getElement().eClass();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tint visualID = "; + protected final String TEXT_100 = ".getVisualID(viewTarget);" + NL + "\t\t\t\tnotationQNameBuf.append('[').append(visualID < 0 ? Integer.toString(System.identityHashCode(viewTarget)) : Integer.toString(visualID)).append(']');\t\t\t\t" + NL + "" + NL + "\t\t\t\tthis.targetElementQName = notationQNameBuf.toString();" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.targetElementQName = formatElement(target);" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = "; + protected final String TEXT_101 = ".getInstance().getItemImage(imageTarget);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String formatElement("; + protected final String TEXT_102 = " object) {" + NL + "\t\t\tif (object == null) {" + NL + "\t\t\t\treturn String.valueOf((Object)null);" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_103 = " adapterFactory = "; + protected final String TEXT_104 = ".getInstance().getItemProvidersAdapterFactory();" + NL + "\t\t\t"; + protected final String TEXT_105 = " labelProvider = ("; + protected final String TEXT_106 = ") adapterFactory.adapt(object, "; + protected final String TEXT_107 = ".class);" + NL + "\t\t\tif (labelProvider != null) {" + NL + "\t\t\t\treturn object.eClass() + \" \" + labelProvider.getText(object);" + NL + "\t\t\t}" + NL + "\t\t\treturn object.toString();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetric getMetricByKey(String key) {" + NL + "\t\t\tfor (int i = 0; i < metrics.length; i++) {" + NL + "\t\t\t\tif(metrics[i].def.key.equals(key)) {" + NL + "\t\t\t\t\treturn metrics[i]; " + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Metric implements Comparable {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal MetricDef def;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Number value;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String displayValue;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetric(MetricDef def, EObject target) {" + NL + "\t\t\tthis.def = def;" + NL + "\t\t\tvalue = def.calcMetric(target);" + NL + "\t\t\tthis.displayValue = (value != null) ? java.text.NumberFormat.getInstance().format(value) : \"null\"; //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic int compareTo(Object other) {" + NL + "\t\t\tMetric otherMetric = (Metric)other;" + NL + "\t\t\tif(value != null && otherMetric.value != null) {" + NL + "\t\t\t\treturn (value.longValue() < otherMetric.value.longValue()) ? " + NL + "\t\t\t\t\t\t-1 : (value.longValue() == otherMetric.value.longValue() ? 0 : 1);" + NL + "\t\t\t}" + NL + "\t\t\treturn (value == null && otherMetric.value == null) ? " + NL + "\t\t\t\t\t0 : (value == null) ? -1 : 1;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricDef {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Double lowLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal Double highLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String key;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal "; + protected final String TEXT_108 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal int[] semanticIDs;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String name;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tfinal String description;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetricDef(String key, "; + protected final String TEXT_109 = " expression, int[] semanticIDs, " + NL + "\t\t\tDouble low, Double high, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.expression = expression;" + NL + "\t\t\tthis.semanticIDs = semanticIDs;" + NL + "\t\t\tthis.lowLimit = low;" + NL + "\t\t\tthis.highLimit = high;" + NL + "\t\t\tthis.name = name;" + NL + "\t\t\tthis.description = description;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tNumber calcMetric(Object contextInstance) {" + NL + "\t\t\tObject val = expression.evaluate(contextInstance);" + NL + "\t\t\treturn (val instanceof Number) ? (Number)val : null;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tboolean appliesTo(EObject eObject) {" + NL + "\t\t\tif(eObject instanceof View && semanticIDs != null) {" + NL + "\t\t\t\tint eObjectID = "; + protected final String TEXT_110 = ".getVisualID((View)eObject);" + NL + "\t\t\t\tfor(int i = 0; i < semanticIDs.length; i++) {" + NL + "\t\t\t\t\tif(semanticIDs[i] == eObjectID) {" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && (expression.context() instanceof EClass) && " + NL + "\t\t\t\t((EClass)expression.context()).isSuperTypeOf(eObject.eClass());" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString getToolTipText() {" + NL + "\t\t\tStringBuffer buf = new StringBuffer();" + NL + "\t\t\tif(name != null) buf.append(name);" + NL + "\t\t\tif(description != null) buf.append('\\n').append(description).append('\\n');" + NL + "\t\t\tif(lowLimit != null) buf.append(\"low:\").append(lowLimit);" + NL + "\t\t\tif(highLimit != null) buf.append(\" high:\").append(highLimit);" + NL + "\t\t\treturn buf.toString();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; + protected final String TEXT_111 = "/*MetricDef*/ getMetricsForTarget(EClass target) {" + NL + "\t\tif(context2MetricsMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn ("; + protected final String TEXT_112 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; + protected final String TEXT_113 = " getMetrics() {" + NL + "\t\tif(metricsRegistry == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn metricsRegistry;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static Number calculateMetric(String metricKey, Object contextInstance) {" + NL + "\t\tif (key2MetricMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\tMetricDef metric = (MetricDef)key2MetricMap.get(metricKey);" + NL + "\t\tNumber value = (metric != null) ? metric.calcMetric(contextInstance) : null;" + NL + "\t\treturn (value != null && !(value instanceof Double)) ? new Double(value.doubleValue()) : value;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;"; + protected final String TEXT_114 = "\t\t" + NL + "\t\t"; + protected final String TEXT_115 = NL; + protected final String TEXT_116 = " "; + protected final String TEXT_117 = " = new "; + protected final String TEXT_118 = "(3);"; + protected final String TEXT_119 = ".put(\""; + protected final String TEXT_120 = "\", "; + protected final String TEXT_121 = "); //$NON-NLS-1$"; + protected final String TEXT_122 = NL + "\t\tregister(new MetricDef("; + protected final String TEXT_123 = "," + NL + "\t\t\t"; + protected final String TEXT_124 = "null"; + protected final String TEXT_125 = "."; + protected final String TEXT_126 = "("; + protected final String TEXT_127 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_128 = ", "; + protected final String TEXT_129 = ")"; + protected final String TEXT_130 = "."; + protected final String TEXT_131 = "("; + protected final String TEXT_132 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_133 = ")"; + protected final String TEXT_134 = "new "; + protected final String TEXT_135 = "("; + protected final String TEXT_136 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_137 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_138 = " self = ("; + protected final String TEXT_139 = ")context;"; + protected final String TEXT_140 = "\t" + NL + "\t\t"; + protected final String TEXT_141 = " "; + protected final String TEXT_142 = " = ("; + protected final String TEXT_143 = ")env.get(\""; + protected final String TEXT_144 = "\"); //$NON-NLS-1$"; + protected final String TEXT_145 = NL + "\t\treturn "; + protected final String TEXT_146 = "."; + protected final String TEXT_147 = "(self"; + protected final String TEXT_148 = ", "; + protected final String TEXT_149 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_150 = NL + ","; + protected final String TEXT_151 = NL + "\t\t\t"; + protected final String TEXT_152 = "," + NL + "\t\t\t"; + protected final String TEXT_153 = "new Double("; + protected final String TEXT_154 = ")"; + protected final String TEXT_155 = "null"; + protected final String TEXT_156 = ",\t\t\t\t\t" + NL + "\t\t\t"; + protected final String TEXT_157 = "new Double("; + protected final String TEXT_158 = ")"; + protected final String TEXT_159 = "null"; + protected final String TEXT_160 = "," + NL + "\t\t\t"; protected final String TEXT_161 = "," + NL + "\t\t\t"; - protected final String TEXT_162 = "," + NL + "\t\t\t"; - protected final String TEXT_163 = "));"; - protected final String TEXT_164 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static void register(MetricDef metric) {" + NL + "\t\tif (context2MetricsMap == null) {" + NL + "\t\t\tcontext2MetricsMap = new "; - protected final String TEXT_165 = "();" + NL + "\t\t\tmetricsRegistry = new "; - protected final String TEXT_166 = "();" + NL + "\t\t\tkey2MetricMap = new "; - protected final String TEXT_167 = "();" + NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_168 = " metrics = ("; - protected final String TEXT_169 = ")context2MetricsMap.get(metric.expression.context());" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new "; - protected final String TEXT_170 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.expression.context(), metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t\tkey2MetricMap.put(metric.key, metric);" + NL + "\t}" + NL; - protected final String TEXT_171 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class JavaRules {"; - protected final String TEXT_172 = "\t\t"; - protected final String TEXT_173 = NL; - protected final String TEXT_174 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_175 = " "; - protected final String TEXT_176 = "("; - protected final String TEXT_177 = " self"; - protected final String TEXT_178 = ", "; - protected final String TEXT_179 = " "; - protected final String TEXT_180 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_181 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_182 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_183 = NL + "\t} //JavaRules"; - protected final String TEXT_184 = "\t\t" + NL + "" + NL + "}"; - protected final String TEXT_185 = NL; + protected final String TEXT_162 = "));"; + protected final String TEXT_163 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static void register(MetricDef metric) {" + NL + "\t\tif (context2MetricsMap == null) {" + NL + "\t\t\tcontext2MetricsMap = new "; + protected final String TEXT_164 = "();" + NL + "\t\t\tmetricsRegistry = new "; + protected final String TEXT_165 = "();" + NL + "\t\t\tkey2MetricMap = new "; + protected final String TEXT_166 = "();" + NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_167 = " metrics = ("; + protected final String TEXT_168 = ")context2MetricsMap.get(metric.expression.context());" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new "; + protected final String TEXT_169 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.expression.context(), metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t\tkey2MetricMap.put(metric.key, metric);" + NL + "\t}" + NL; + protected final String TEXT_170 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class JavaRules {"; + protected final String TEXT_171 = "\t\t"; + protected final String TEXT_172 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_173 = " "; + protected final String TEXT_174 = "("; + protected final String TEXT_175 = " self"; + protected final String TEXT_176 = ", "; + protected final String TEXT_177 = " "; + protected final String TEXT_178 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_179 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_180 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_181 = NL + "\t} //JavaRules"; + protected final String TEXT_182 = "\t\t" + NL + "" + NL + "}"; + protected final String TEXT_183 = NL; public String generate(Object argument) { @@ -211,14 +209,13 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders(); - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); @@ -254,255 +251,255 @@ importManager.registerInnerClass("ResultView"); importManager.markImportLocation(stringBuffer); final String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); stringBuffer.append(genDiagram.getMetricProviderClassName()); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Action")); - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IViewPart")); + stringBuffer.append(TEXT_10); + stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); stringBuffer.append(TEXT_12); - stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); - stringBuffer.append(TEXT_13); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); } else { - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); } + stringBuffer.append(TEXT_15); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_17); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_20); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); + stringBuffer.append(TEXT_21); + stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_22); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_23); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_24); - stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); - stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("java.util.Collections")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService")); + stringBuffer.append(TEXT_28); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_29); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_30); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("java.util.Collections")); + stringBuffer.append(TEXT_32); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_34); - stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_37); - stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); stringBuffer.append(TEXT_39); - stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_41); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.ViewPart")); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_43); stringBuffer.append(genDiagram.getMetricViewID()); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput")); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); } else { - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); } - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_49); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_51); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_52); } else { - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_53); } + stringBuffer.append(TEXT_54); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_55); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_56); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_57); stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(TEXT_57); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC")); stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC")); stringBuffer.append(TEXT_59); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC")); - stringBuffer.append(TEXT_60); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.JFaceResources")); + stringBuffer.append(TEXT_60); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener")); stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener")); stringBuffer.append(TEXT_62); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener")); - stringBuffer.append(TEXT_63); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionEvent")); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart")); + stringBuffer.append(TEXT_65); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_66); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_67); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_68); } - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_68); if (genDiagram.getEditorGen().getEditor().isEclipseEditor()) { - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart")); + stringBuffer.append(TEXT_71); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_72); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_74); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_75); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_75); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_76); } else { - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_77); stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IViewPart")); - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName())); + stringBuffer.append(TEXT_79); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_81); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_82); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_83); } + stringBuffer.append(TEXT_83); + stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_84); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_85); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_86); - stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); - stringBuffer.append(TEXT_87); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_87); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")); - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_88); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_89); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_90); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_91); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_92); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_93); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); + stringBuffer.append(TEXT_94); + stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); stringBuffer.append(TEXT_95); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); stringBuffer.append(TEXT_96); - stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); + stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants")); stringBuffer.append(TEXT_97); stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants")); stringBuffer.append(TEXT_98); - stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants")); - stringBuffer.append(TEXT_99); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image")); - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_99); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_100); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_101); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_102); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")); - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_103); stringBuffer.append(pluginActivatorClass); + stringBuffer.append(TEXT_104); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_105); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_106); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_107); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); + stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); stringBuffer.append(TEXT_108); stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); stringBuffer.append(TEXT_109); - stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())); - stringBuffer.append(TEXT_110); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(TEXT_110); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_111); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_112); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_113); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_114); List javaRules = new ArrayList(); for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator(); it.hasNext(); ) { @@ -517,7 +514,7 @@ for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator() javaRules.add(nextMetric); } - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_114); { /*begin the scope*/ /* @@ -529,13 +526,13 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { - stringBuffer.append(TEXT_116); + stringBuffer.append(TEXT_115); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_117); + stringBuffer.append(TEXT_116); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_118); + stringBuffer.append(TEXT_117); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_119); + stringBuffer.append(TEXT_118); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String nextVariableName = (String)envVarIt.next(); @@ -544,11 +541,11 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_120); + stringBuffer.append(TEXT_119); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_121); + stringBuffer.append(TEXT_120); stringBuffer.append(varTypeEClassifierAccess); - stringBuffer.append(TEXT_122); + stringBuffer.append(TEXT_121); } } @@ -556,9 +553,9 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi } /*end the scope*/ - stringBuffer.append(TEXT_123); + stringBuffer.append(TEXT_122); stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getKey())); - stringBuffer.append(TEXT_124); + stringBuffer.append(TEXT_123); { /*begin the scope*/ /* @@ -574,7 +571,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_125); + stringBuffer.append(TEXT_124); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -583,26 +580,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_126); + stringBuffer.append(TEXT_125); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_127); + stringBuffer.append(TEXT_126); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_128); + stringBuffer.append(TEXT_127); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_129); + stringBuffer.append(TEXT_128); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_130); + stringBuffer.append(TEXT_129); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_131); + stringBuffer.append(TEXT_130); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_132); + stringBuffer.append(TEXT_131); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_133); + stringBuffer.append(TEXT_132); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_134); + stringBuffer.append(TEXT_133); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -610,51 +607,51 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_135); + stringBuffer.append(TEXT_134); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_136); + stringBuffer.append(TEXT_135); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_137); + stringBuffer.append(TEXT_136); stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(TEXT_137); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_138); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_139); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_140); 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_141); + stringBuffer.append(TEXT_140); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_142); + stringBuffer.append(TEXT_141); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_143); + stringBuffer.append(TEXT_142); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_144); + stringBuffer.append(TEXT_143); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_145); + stringBuffer.append(TEXT_144); } - stringBuffer.append(TEXT_146); + stringBuffer.append(TEXT_145); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_147); + stringBuffer.append(TEXT_146); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_148); + stringBuffer.append(TEXT_147); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_149); + stringBuffer.append(TEXT_148); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_150); + stringBuffer.append(TEXT_149); } } /*end of scope*/ - stringBuffer.append(TEXT_151); + stringBuffer.append(TEXT_150); String IDs = "null"; if(nextMetric.getTarget() instanceof GenDiagramElementTarget) { @@ -668,49 +665,49 @@ String __javaOperationContainer; buf.append(" }"); IDs = buf.toString(); } - stringBuffer.append(TEXT_152); + stringBuffer.append(TEXT_151); stringBuffer.append(IDs); - stringBuffer.append(TEXT_153); + stringBuffer.append(TEXT_152); if(nextMetric.getLowLimit()!=null){ - stringBuffer.append(TEXT_154); + stringBuffer.append(TEXT_153); stringBuffer.append(nextMetric.getLowLimit()); - stringBuffer.append(TEXT_155); + stringBuffer.append(TEXT_154); }else{ - stringBuffer.append(TEXT_156); + stringBuffer.append(TEXT_155); } - stringBuffer.append(TEXT_157); + stringBuffer.append(TEXT_156); if(nextMetric.getHighLimit()!=null){ - stringBuffer.append(TEXT_158); + stringBuffer.append(TEXT_157); stringBuffer.append(nextMetric.getHighLimit()); - stringBuffer.append(TEXT_159); + stringBuffer.append(TEXT_158); }else{ - stringBuffer.append(TEXT_160); + stringBuffer.append(TEXT_159); } - stringBuffer.append(TEXT_161); + stringBuffer.append(TEXT_160); stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getName())); - stringBuffer.append(TEXT_162); + stringBuffer.append(TEXT_161); stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getDescription())); - stringBuffer.append(TEXT_163); + stringBuffer.append(TEXT_162); } /* metrics iteration */ - stringBuffer.append(TEXT_164); + stringBuffer.append(TEXT_163); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_165); + stringBuffer.append(TEXT_164); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_166); + stringBuffer.append(TEXT_165); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); + stringBuffer.append(TEXT_166); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_167); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_168); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_169); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_170); + stringBuffer.append(TEXT_169); if(!javaRules.isEmpty()) { - stringBuffer.append(TEXT_171); + stringBuffer.append(TEXT_170); for(Iterator it = javaRules.iterator(); it.hasNext();) { GenMetricRule nextMetric = (GenMetricRule)it.next(); @@ -719,8 +716,7 @@ if(!javaRules.isEmpty()) { String __genExprResultType = "java.lang.Double"; Map __exprEnvVariables = Collections.EMPTY_MAP; - stringBuffer.append(TEXT_172); - stringBuffer.append(TEXT_173); + stringBuffer.append(TEXT_171); /* ValueExpression __genValueExpression @@ -741,13 +737,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_174); + stringBuffer.append(TEXT_172); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_175); + stringBuffer.append(TEXT_173); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_176); + stringBuffer.append(TEXT_174); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_177); + stringBuffer.append(TEXT_175); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -755,30 +751,30 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_178); + stringBuffer.append(TEXT_176); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_179); + stringBuffer.append(TEXT_177); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_180); + stringBuffer.append(TEXT_178); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_181); + stringBuffer.append(TEXT_179); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_182); + stringBuffer.append(TEXT_180); } /* end of GenJavaExpressionProvider */ } - stringBuffer.append(TEXT_183); + stringBuffer.append(TEXT_181); } /* end of JavaRules */ - stringBuffer.append(TEXT_184); + stringBuffer.append(TEXT_182); importManager.emitSortedImports(); - stringBuffer.append(TEXT_185); + stringBuffer.append(TEXT_183); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/ValidationProviderGenerator.java b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/ValidationProviderGenerator.java index 239c9506f..24401388f 100644 --- a/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/ValidationProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/providers/ValidationProviderGenerator.java @@ -17,159 +17,157 @@ public class ValidationProviderGenerator } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = ""; - protected final String TEXT_2 = NL + "/*" + NL + " * "; - protected final String TEXT_3 = NL + " */"; - protected final String TEXT_4 = NL; - protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean constraintsActive = false;\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean shouldConstraintsBePrivate() {" + NL + "\t\treturn false;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class ValidateAction extends Action {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic static final String VALIDATE_ACTION_KEY = \"validateAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate IWorkbenchPart myWorkbenchPart;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ValidateAction(IWorkbenchPart part) {" + NL + "\t\t\tsetId(VALIDATE_ACTION_KEY);" + NL + "\t\t\tsetText(\"Validate\");" + NL + "\t\t\tmyWorkbenchPart = part;" + NL + "\t\t\tsetEnabled(myWorkbenchPart instanceof "; - protected final String TEXT_7 = ");" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (!isEnabled()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal "; - protected final String TEXT_8 = " part = ("; - protected final String TEXT_9 = ") myWorkbenchPart;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tnew "; - protected final String TEXT_10 = "() {" + NL + "\t\t\t\t\tpublic void run("; - protected final String TEXT_11 = " monitor) throws InterruptedException, "; - protected final String TEXT_12 = " {" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_13 = " viewer = ("; - protected final String TEXT_14 = ") part.getAdapter("; - protected final String TEXT_15 = ".class);" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_16 = " diagram = part.getDiagram();" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_17 = " viewService;" + NL + "\t\t\t\t\t\tif (viewer == null) {" + NL + "\t\t\t\t\t\t\tviewService = new "; - protected final String TEXT_18 = "(diagram);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tviewService = new "; - protected final String TEXT_19 = "(viewer);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\trunValidation(diagram, viewService);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\t.run(new "; - protected final String TEXT_20 = "());" + NL + "\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t"; - protected final String TEXT_21 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static void runValidation(View view, "; - protected final String TEXT_22 = " service) {" + NL + "\t\t\tfinal View target = view;" + NL + "\t\t\tfinal "; - protected final String TEXT_23 = " viewService = service;" + NL + "\t\t\tRunnable task = new Runnable() {" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tconstraintsActive = true;" + NL + "\t\t\t\t\t\tvalidate(target, viewService);" + NL + "\t\t\t\t\t} finally {" + NL + "\t\t\t\t\t\tconstraintsActive = false;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(target);" + NL + "\t\t\tif(txDomain != null) {" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\ttxDomain.runExclusive(task);" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_24 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttask.run();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static Diagnostic runEMFValidator(View target) {" + NL + "\t\t\tif(target.isSetElement() && target.getElement() != null) {" + NL + "\t\t\t\treturn new Diagnostician().validate(target.getElement());" + NL + "\t\t\t}" + NL + "\t\t\treturn Diagnostic.OK_INSTANCE;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static void validate(View target, "; - protected final String TEXT_25 = " viewService) {" + NL + "\t\t\t"; - protected final String TEXT_26 = " diagramUri = (target.getDiagram() != null) ? "; - protected final String TEXT_27 = ".getURI(target.getDiagram()) : null;" + NL + "\t\t\tif (diagramUri != null) {" + NL + "\t\t\t\t"; - protected final String TEXT_28 = " validationState = "; - protected final String TEXT_29 = ".getInstance().getValidationStateManager().getValidationState(diagramUri);" + NL + "\t\t\t\t"; - protected final String TEXT_30 = " updater = validationState.startUpdate();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tDiagnostic diagnostic = runEMFValidator(target);" + NL + "\t\t\t\t\tupdate(updater, diagnostic, viewService);" + NL + "\t\t\t\t\tIBatchValidator validator = (IBatchValidator)ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);" + NL + "\t\t\t\t\tvalidator.setIncludeLiveConstraints(true);" + NL + "\t\t\t\t\tif (target.isSetElement() && target.getElement() != null) {" + NL + "\t\t\t\t\t\tIStatus status = validator.validate(target.getElement());" + NL + "\t\t\t\t\t\tupdate(updater, status, viewService);" + NL + "\t\t\t\t\t}" + NL; - protected final String TEXT_31 = NL + "\t\t\t\t\tvalidator.setTraversalStrategy(getNotationTraversalStrategy(validator));" + NL + "\t\t\t\t\tIStatus status = validator.validate(target);" + NL + "\t\t\t\t\tupdate(updater, status, viewService);"; - protected final String TEXT_32 = NL + "\t\t\t\t\tupdater.commitChanges();" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\tupdater.discardChanges();" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static void update("; - protected final String TEXT_33 = " updater, Diagnostic emfValidationStatus, "; - protected final String TEXT_34 = " viewService) {" + NL + "\t\t\tif (emfValidationStatus.getSeverity() == Diagnostic.OK) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal Diagnostic rootStatus = emfValidationStatus;" + NL + "\t\t\t"; - protected final String TEXT_35 = " allDiagnostics = new "; - protected final String TEXT_36 = "();" + NL + "\t\t\tcollectTargetElements(rootStatus, new "; - protected final String TEXT_37 = "(), allDiagnostics);" + NL + "\t\t\tfor ("; - protected final String TEXT_38 = " it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t\tDiagnostic nextDiagnostic = (Diagnostic) it.next();" + NL + "\t\t\t\t"; - protected final String TEXT_39 = " data = nextDiagnostic.getData();" + NL + "\t\t\t\tif (data != null && !data.isEmpty() && data.get(0) instanceof "; - protected final String TEXT_40 = ") {" + NL + "\t\t\t\t\t"; - protected final String TEXT_41 = " element = ("; - protected final String TEXT_42 = ") data.get(0);" + NL + "\t\t\t\t\tView view = viewService.findView(element);" + NL + "\t\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\t\t"; - protected final String TEXT_43 = " next = "; - protected final String TEXT_44 = ".create(view, nextDiagnostic);" + NL + "\t\t\t\t\t\tif (next != null) {" + NL + "\t\t\t\t\t\t\tupdater.addViolation(next);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t * @elsewhere see XXXMarkerNavigationProvider" + NL + "\t\t */" + NL + "\t\tprivate static void update("; - protected final String TEXT_45 = " updater, IStatus validationStatus, "; - protected final String TEXT_46 = " viewService) {" + NL + "\t\t\tif (validationStatus.isOK()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal IStatus rootStatus = validationStatus;" + NL + "\t\t\t"; - protected final String TEXT_47 = " allStatuses = new "; - protected final String TEXT_48 = "();" + NL + "\t\t\tcollectTargetElements(rootStatus, new "; - protected final String TEXT_49 = "(), allStatuses);" + NL + "\t\t\tfor ("; - protected final String TEXT_50 = " it = allStatuses.iterator(); it.hasNext();) {" + NL + "\t\t\t\t"; - protected final String TEXT_51 = " nextStatus = ("; - protected final String TEXT_52 = ") it.next();" + NL + "\t\t\t\tView view = viewService.findView(nextStatus.getTarget());" + NL + "\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_53 = " next = "; - protected final String TEXT_54 = ".create(view, nextStatus);" + NL + "\t\t\t\t\tif (next != null) {" + NL + "\t\t\t\t\t\tupdater.addViolation(next);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static "; - protected final String TEXT_55 = " collectTargetElements(Diagnostic diagnostic, "; - protected final String TEXT_56 = " targetElementCollector, "; - protected final String TEXT_57 = " allDiagnostics) {" + NL + "\t\t\t"; - protected final String TEXT_58 = " data = diagnostic.getData();" + NL + "\t\t\tEObject target = null;" + NL + "\t\t\tif (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {" + NL + "\t\t\t\ttarget = (EObject) data.get(0);" + NL + "\t\t\t\ttargetElementCollector.add(target);" + NL + "\t\t\t\tallDiagnostics.add(diagnostic);" + NL + "\t\t\t}" + NL + "\t\t\tif (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {" + NL + "\t\t\t\tfor ("; - protected final String TEXT_59 = " it = diagnostic.getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tcollectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn targetElementCollector;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static "; - protected final String TEXT_60 = " collectTargetElements(IStatus status, "; - protected final String TEXT_61 = " targetElementCollector, "; - protected final String TEXT_62 = " allConstraintStatuses) {" + NL + "\t\t\tif (status instanceof IConstraintStatus) {" + NL + "\t\t\t\ttargetElementCollector.add(((IConstraintStatus) status).getTarget());" + NL + "\t\t\t\tallConstraintStatuses.add(status);" + NL + "\t\t\t}" + NL + "\t\t\tif (status.isMultiStatus()) {" + NL + "\t\t\t\tIStatus[] children = status.getChildren();" + NL + "\t\t\t\tfor (int i = 0; i < children.length; i++) {" + NL + "\t\t\t\t\tcollectTargetElements(children[i], targetElementCollector, allConstraintStatuses);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn targetElementCollector;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic boolean isInDefaultEditorContext(Object object) {" + NL + "\t\tif(shouldConstraintsBePrivate() && !constraintsActive) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\treturn constraintsActive && "; - protected final String TEXT_63 = ".MODEL_ID.equals("; - protected final String TEXT_64 = ".getModelID((View)object));" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}\t"; - protected final String TEXT_65 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tpublic static class "; - protected final String TEXT_66 = " implements "; - protected final String TEXT_67 = " {"; - protected final String TEXT_68 = NL + "\t\t/**" + NL + "\t\t* @generated" + NL + "\t\t*/" + NL + "\t\tpublic boolean selects(Object object) {\t\t" + NL + "\t\t\tif(isInDefaultEditorContext(object) && object instanceof View) {" + NL + "\t\t\t\tString id = ((View) object).getType();" + NL + "\t\t\t\treturn id != null && semanticCtxIdMap.get(id) == "; - protected final String TEXT_69 = ".class;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}"; - protected final String TEXT_70 = NL + "\t\t/**" + NL + "\t\t* @generated" + NL + "\t\t*/" + NL + "\t\tpublic boolean selects(Object object) {" + NL + "\t\t\treturn isInDefaultEditorContext(object);\t" + NL + "\t\t}\t" + NL + "\t}\t\t"; - protected final String TEXT_71 = NL + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final "; - protected final String TEXT_72 = " semanticCtxIdMap = new "; - protected final String TEXT_73 = "();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {"; - protected final String TEXT_74 = NL + "\t\tsemanticCtxIdMap.put(String.valueOf("; - protected final String TEXT_75 = "), "; - protected final String TEXT_76 = ".class); //$NON-NLS-1$"; - protected final String TEXT_77 = NL + "\t}"; - protected final String TEXT_78 = NL; - protected final String TEXT_79 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic "; - protected final String TEXT_80 = " getNotationTraversalStrategy(IBatchValidator validator) {"; - protected final String TEXT_81 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);"; - protected final String TEXT_82 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();"; - protected final String TEXT_83 = NL + "\t}"; - protected final String TEXT_84 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements "; - protected final String TEXT_85 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_86 = " defaultStrategy;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate String currentSemanticCtxId;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate boolean ctxChanged = true;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate EObject currentTarget;\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate EObject preFetchedNextTarget;\t\t" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tCtxSwitchStrategy(IBatchValidator validator) {" + NL + "\t\t\tthis.defaultStrategy = validator.getDefaultTraversalStrategy();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void elementValidated(EObject element, IStatus status) {" + NL + "\t\t\tdefaultStrategy.elementValidated(element, status);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean hasNext() {" + NL + "\t\t\treturn defaultStrategy.hasNext();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isClientContextChanged() {" + NL + "\t\t\tif(preFetchedNextTarget == null) {" + NL + "\t\t\t\tpreFetchedNextTarget = next();" + NL + "\t\t\t\tprepareNextClientContext(preFetchedNextTarget);\t\t\t\t" + NL + "\t\t\t}\t\t\t \t\t\t" + NL + "\t\t\treturn ctxChanged;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic EObject next() {" + NL + "\t\t\tEObject nextTarget = preFetchedNextTarget;" + NL + "\t\t\tif(nextTarget == null) {" + NL + "\t\t\t\tnextTarget = defaultStrategy.next();" + NL + "\t\t\t}" + NL + "\t\t\tthis.preFetchedNextTarget = null;" + NL + "\t\t\treturn this.currentTarget = nextTarget;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void startTraversal("; - protected final String TEXT_87 = " traversalRoots," + NL + "\t\t\t\t"; - protected final String TEXT_88 = " monitor) {" + NL + "\t\t\tdefaultStrategy.startTraversal(traversalRoots, monitor);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void prepareNextClientContext(EObject nextTarget) { " + NL + "\t\t\tif (nextTarget != null && currentTarget != null) {" + NL + "\t\t\t\tif (nextTarget instanceof View) {" + NL + "\t\t\t\t\tString id = ((View) nextTarget).getType();" + NL + "\t\t\t\t\tString nextSemanticId = id != null" + NL + "\t\t\t\t\t\t\t&& semanticCtxIdMap.containsKey(id) ? id : null;" + NL + "\t\t\t\t\tif ((currentSemanticCtxId != null && !currentSemanticCtxId" + NL + "\t\t\t\t\t\t\t.equals(nextSemanticId))" + NL + "\t\t\t\t\t\t\t|| (nextSemanticId != null && !nextSemanticId" + NL + "\t\t\t\t\t\t\t\t\t.equals(currentSemanticCtxId))) {" + NL + "\t\t\t\t\t\tthis.ctxChanged = true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcurrentSemanticCtxId = nextSemanticId;" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// context of domain model" + NL + "\t\t\t\t\tthis.ctxChanged = currentSemanticCtxId != null;" + NL + "\t\t\t\t\tcurrentSemanticCtxId = null;" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.ctxChanged = false;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}// CtxSwitchStrategy"; - protected final String TEXT_89 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class "; - protected final String TEXT_90 = " extends "; - protected final String TEXT_91 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_92 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; - protected final String TEXT_93 = "() {" + NL + "\t\t\texpression = "; - protected final String TEXT_94 = "null"; - protected final String TEXT_95 = "."; - protected final String TEXT_96 = "("; - protected final String TEXT_97 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_98 = ", "; - protected final String TEXT_99 = ")"; - protected final String TEXT_100 = "."; - protected final String TEXT_101 = "("; - protected final String TEXT_102 = ", //$NON-NLS-1$" + NL + "\t"; - protected final String TEXT_103 = ")"; - protected final String TEXT_104 = "new "; - protected final String TEXT_105 = "("; - protected final String TEXT_106 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; - protected final String TEXT_107 = " env) {\t" + NL + "\t\t"; - protected final String TEXT_108 = " self = ("; - protected final String TEXT_109 = ")context;"; - protected final String TEXT_110 = "\t" + NL + "\t\t"; - protected final String TEXT_111 = " "; - protected final String TEXT_112 = " = ("; - protected final String TEXT_113 = ")env.get(\""; - protected final String TEXT_114 = "\"); //$NON-NLS-1$"; - protected final String TEXT_115 = NL + "\t\treturn "; - protected final String TEXT_116 = "."; - protected final String TEXT_117 = "(self"; - protected final String TEXT_118 = ", "; - protected final String TEXT_119 = ");" + NL + "\t}" + NL + "}"; - protected final String TEXT_120 = NL + ";\t\t" + NL + "\t\t}\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic IStatus validate("; - protected final String TEXT_121 = " ctx) {" + NL + "\t\t\tObject evalCtx = ctx.getTarget();"; - protected final String TEXT_122 = NL + "\t\t\tif(evalCtx instanceof EObject) evalCtx = ((EObject)evalCtx).eGet("; - protected final String TEXT_123 = "());" + NL + "\t\t\tif(evalCtx == null) {"; - protected final String TEXT_124 = NL + "\t\t\t\treturn ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) });"; - protected final String TEXT_125 = NL + "\t\t\t\treturn "; - protected final String TEXT_126 = ".OK_STATUS;"; - protected final String TEXT_127 = NL + "\t\t\t}\t\t\t"; - protected final String TEXT_128 = "\t\t\t" + NL + "\t\t\tevalCtx = "; - protected final String TEXT_129 = ".calculateMetric("; - protected final String TEXT_130 = ", evalCtx);"; - protected final String TEXT_131 = "\t\t" + NL + "\t\t\tObject result = expression.evaluate(evalCtx);" + NL + "\t\t\tif(result instanceof Boolean && ((Boolean)result).booleanValue()) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_132 = ".OK_STATUS;" + NL + "\t\t\t}" + NL + "\t\t\treturn ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) }); " + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String formatElement("; - protected final String TEXT_133 = " object) {" + NL + "\t\t\tif (object == null) {" + NL + "\t\t\t\treturn String.valueOf((Object)null);" + NL + "\t\t\t}" + NL + "\t\t\t"; - protected final String TEXT_134 = " adapterFactory = "; - protected final String TEXT_135 = ".getInstance().getItemProvidersAdapterFactory();" + NL + "\t\t\t"; - protected final String TEXT_136 = " labelProvider = ("; - protected final String TEXT_137 = ") adapterFactory.adapt(object, "; - protected final String TEXT_138 = ".class);" + NL + "\t\t\tif (labelProvider != null) {" + NL + "\t\t\t\treturn object.eClass() + \" \" + labelProvider.getText(object);" + NL + "\t\t\t}" + NL + "\t\t\treturn object.toString();" + NL + "\t\t}" + NL + "\t}"; - protected final String TEXT_139 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "static class "; - protected final String TEXT_140 = " {"; - protected final String TEXT_141 = NL; - protected final String TEXT_142 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; - protected final String TEXT_143 = " "; - protected final String TEXT_144 = "("; - protected final String TEXT_145 = " self"; - protected final String TEXT_146 = ", "; - protected final String TEXT_147 = " "; - protected final String TEXT_148 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; - protected final String TEXT_149 = ".NoImplException(\"No user java implementation provided in '"; - protected final String TEXT_150 = "' operation\"); //$NON-NLS-1$" + NL + "}"; - protected final String TEXT_151 = NL + "} //"; - protected final String TEXT_152 = NL + "} //"; - protected final String TEXT_153 = NL; + protected final String TEXT_1 = "/*" + NL + " * "; + protected final String TEXT_2 = NL + " */"; + protected final String TEXT_3 = NL; + protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_5 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean constraintsActive = false;\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean shouldConstraintsBePrivate() {" + NL + "\t\treturn false;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class ValidateAction extends Action {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic static final String VALIDATE_ACTION_KEY = \"validateAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate IWorkbenchPart myWorkbenchPart;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ValidateAction(IWorkbenchPart part) {" + NL + "\t\t\tsetId(VALIDATE_ACTION_KEY);" + NL + "\t\t\tsetText(\"Validate\");" + NL + "\t\t\tmyWorkbenchPart = part;" + NL + "\t\t\tsetEnabled(myWorkbenchPart instanceof "; + protected final String TEXT_6 = ");" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (!isEnabled()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal "; + protected final String TEXT_7 = " part = ("; + protected final String TEXT_8 = ") myWorkbenchPart;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tnew "; + protected final String TEXT_9 = "() {" + NL + "\t\t\t\t\tpublic void run("; + protected final String TEXT_10 = " monitor) throws InterruptedException, "; + protected final String TEXT_11 = " {" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_12 = " viewer = ("; + protected final String TEXT_13 = ") part.getAdapter("; + protected final String TEXT_14 = ".class);" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_15 = " diagram = part.getDiagram();" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_16 = " viewService;" + NL + "\t\t\t\t\t\tif (viewer == null) {" + NL + "\t\t\t\t\t\t\tviewService = new "; + protected final String TEXT_17 = "(diagram);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tviewService = new "; + protected final String TEXT_18 = "(viewer);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\trunValidation(diagram, viewService);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\t.run(new "; + protected final String TEXT_19 = "());" + NL + "\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t"; + protected final String TEXT_20 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static void runValidation(View view, "; + protected final String TEXT_21 = " service) {" + NL + "\t\t\tfinal View target = view;" + NL + "\t\t\tfinal "; + protected final String TEXT_22 = " viewService = service;" + NL + "\t\t\tRunnable task = new Runnable() {" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tconstraintsActive = true;" + NL + "\t\t\t\t\t\tvalidate(target, viewService);" + NL + "\t\t\t\t\t} finally {" + NL + "\t\t\t\t\t\tconstraintsActive = false;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(target);" + NL + "\t\t\tif(txDomain != null) {" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\ttxDomain.runExclusive(task);" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_23 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttask.run();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static Diagnostic runEMFValidator(View target) {" + NL + "\t\t\tif(target.isSetElement() && target.getElement() != null) {" + NL + "\t\t\t\treturn new Diagnostician().validate(target.getElement());" + NL + "\t\t\t}" + NL + "\t\t\treturn Diagnostic.OK_INSTANCE;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static void validate(View target, "; + protected final String TEXT_24 = " viewService) {" + NL + "\t\t\t"; + protected final String TEXT_25 = " diagramUri = (target.getDiagram() != null) ? "; + protected final String TEXT_26 = ".getURI(target.getDiagram()) : null;" + NL + "\t\t\tif (diagramUri != null) {" + NL + "\t\t\t\t"; + protected final String TEXT_27 = " validationState = "; + protected final String TEXT_28 = ".getInstance().getValidationStateManager().getValidationState(diagramUri);" + NL + "\t\t\t\t"; + protected final String TEXT_29 = " updater = validationState.startUpdate();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tDiagnostic diagnostic = runEMFValidator(target);" + NL + "\t\t\t\t\tupdate(updater, diagnostic, viewService);" + NL + "\t\t\t\t\tIBatchValidator validator = (IBatchValidator)ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);" + NL + "\t\t\t\t\tvalidator.setIncludeLiveConstraints(true);" + NL + "\t\t\t\t\tif (target.isSetElement() && target.getElement() != null) {" + NL + "\t\t\t\t\t\tIStatus status = validator.validate(target.getElement());" + NL + "\t\t\t\t\t\tupdate(updater, status, viewService);" + NL + "\t\t\t\t\t}" + NL; + protected final String TEXT_30 = NL + "\t\t\t\t\tvalidator.setTraversalStrategy(getNotationTraversalStrategy(validator));" + NL + "\t\t\t\t\tIStatus status = validator.validate(target);" + NL + "\t\t\t\t\tupdate(updater, status, viewService);"; + protected final String TEXT_31 = NL + "\t\t\t\t\tupdater.commitChanges();" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\tupdater.discardChanges();" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static void update("; + protected final String TEXT_32 = " updater, Diagnostic emfValidationStatus, "; + protected final String TEXT_33 = " viewService) {" + NL + "\t\t\tif (emfValidationStatus.getSeverity() == Diagnostic.OK) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal Diagnostic rootStatus = emfValidationStatus;" + NL + "\t\t\t"; + protected final String TEXT_34 = " allDiagnostics = new "; + protected final String TEXT_35 = "();" + NL + "\t\t\tcollectTargetElements(rootStatus, new "; + protected final String TEXT_36 = "(), allDiagnostics);" + NL + "\t\t\tfor ("; + protected final String TEXT_37 = " it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t\tDiagnostic nextDiagnostic = (Diagnostic) it.next();" + NL + "\t\t\t\t"; + protected final String TEXT_38 = " data = nextDiagnostic.getData();" + NL + "\t\t\t\tif (data != null && !data.isEmpty() && data.get(0) instanceof "; + protected final String TEXT_39 = ") {" + NL + "\t\t\t\t\t"; + protected final String TEXT_40 = " element = ("; + protected final String TEXT_41 = ") data.get(0);" + NL + "\t\t\t\t\tView view = viewService.findView(element);" + NL + "\t\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\t\t"; + protected final String TEXT_42 = " next = "; + protected final String TEXT_43 = ".create(view, nextDiagnostic);" + NL + "\t\t\t\t\t\tif (next != null) {" + NL + "\t\t\t\t\t\t\tupdater.addViolation(next);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t * @elsewhere see XXXMarkerNavigationProvider" + NL + "\t\t */" + NL + "\t\tprivate static void update("; + protected final String TEXT_44 = " updater, IStatus validationStatus, "; + protected final String TEXT_45 = " viewService) {" + NL + "\t\t\tif (validationStatus.isOK()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal IStatus rootStatus = validationStatus;" + NL + "\t\t\t"; + protected final String TEXT_46 = " allStatuses = new "; + protected final String TEXT_47 = "();" + NL + "\t\t\tcollectTargetElements(rootStatus, new "; + protected final String TEXT_48 = "(), allStatuses);" + NL + "\t\t\tfor ("; + protected final String TEXT_49 = " it = allStatuses.iterator(); it.hasNext();) {" + NL + "\t\t\t\t"; + protected final String TEXT_50 = " nextStatus = ("; + protected final String TEXT_51 = ") it.next();" + NL + "\t\t\t\tView view = viewService.findView(nextStatus.getTarget());" + NL + "\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_52 = " next = "; + protected final String TEXT_53 = ".create(view, nextStatus);" + NL + "\t\t\t\t\tif (next != null) {" + NL + "\t\t\t\t\t\tupdater.addViolation(next);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static "; + protected final String TEXT_54 = " collectTargetElements(Diagnostic diagnostic, "; + protected final String TEXT_55 = " targetElementCollector, "; + protected final String TEXT_56 = " allDiagnostics) {" + NL + "\t\t\t"; + protected final String TEXT_57 = " data = diagnostic.getData();" + NL + "\t\t\tEObject target = null;" + NL + "\t\t\tif (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {" + NL + "\t\t\t\ttarget = (EObject) data.get(0);" + NL + "\t\t\t\ttargetElementCollector.add(target);" + NL + "\t\t\t\tallDiagnostics.add(diagnostic);" + NL + "\t\t\t}" + NL + "\t\t\tif (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {" + NL + "\t\t\t\tfor ("; + protected final String TEXT_58 = " it = diagnostic.getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tcollectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn targetElementCollector;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static "; + protected final String TEXT_59 = " collectTargetElements(IStatus status, "; + protected final String TEXT_60 = " targetElementCollector, "; + protected final String TEXT_61 = " allConstraintStatuses) {" + NL + "\t\t\tif (status instanceof IConstraintStatus) {" + NL + "\t\t\t\ttargetElementCollector.add(((IConstraintStatus) status).getTarget());" + NL + "\t\t\t\tallConstraintStatuses.add(status);" + NL + "\t\t\t}" + NL + "\t\t\tif (status.isMultiStatus()) {" + NL + "\t\t\t\tIStatus[] children = status.getChildren();" + NL + "\t\t\t\tfor (int i = 0; i < children.length; i++) {" + NL + "\t\t\t\t\tcollectTargetElements(children[i], targetElementCollector, allConstraintStatuses);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn targetElementCollector;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic boolean isInDefaultEditorContext(Object object) {" + NL + "\t\tif(shouldConstraintsBePrivate() && !constraintsActive) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\treturn constraintsActive && "; + protected final String TEXT_62 = ".MODEL_ID.equals("; + protected final String TEXT_63 = ".getModelID((View)object));" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}\t"; + protected final String TEXT_64 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tpublic static class "; + protected final String TEXT_65 = " implements "; + protected final String TEXT_66 = " {"; + protected final String TEXT_67 = NL + "\t\t/**" + NL + "\t\t* @generated" + NL + "\t\t*/" + NL + "\t\tpublic boolean selects(Object object) {\t\t" + NL + "\t\t\tif(isInDefaultEditorContext(object) && object instanceof View) {" + NL + "\t\t\t\tString id = ((View) object).getType();" + NL + "\t\t\t\treturn id != null && semanticCtxIdMap.get(id) == "; + protected final String TEXT_68 = ".class;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_69 = NL + "\t\t/**" + NL + "\t\t* @generated" + NL + "\t\t*/" + NL + "\t\tpublic boolean selects(Object object) {" + NL + "\t\t\treturn isInDefaultEditorContext(object);\t" + NL + "\t\t}\t" + NL + "\t}\t\t"; + protected final String TEXT_70 = NL + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final "; + protected final String TEXT_71 = " semanticCtxIdMap = new "; + protected final String TEXT_72 = "();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {"; + protected final String TEXT_73 = NL + "\t\tsemanticCtxIdMap.put(String.valueOf("; + protected final String TEXT_74 = "), "; + protected final String TEXT_75 = ".class); //$NON-NLS-1$"; + protected final String TEXT_76 = NL + "\t}"; + protected final String TEXT_77 = NL; + protected final String TEXT_78 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic "; + protected final String TEXT_79 = " getNotationTraversalStrategy(IBatchValidator validator) {"; + protected final String TEXT_80 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);"; + protected final String TEXT_81 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();"; + protected final String TEXT_82 = NL + "\t}"; + protected final String TEXT_83 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements "; + protected final String TEXT_84 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_85 = " defaultStrategy;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate String currentSemanticCtxId;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate boolean ctxChanged = true;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate EObject currentTarget;\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate EObject preFetchedNextTarget;\t\t" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tCtxSwitchStrategy(IBatchValidator validator) {" + NL + "\t\t\tthis.defaultStrategy = validator.getDefaultTraversalStrategy();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void elementValidated(EObject element, IStatus status) {" + NL + "\t\t\tdefaultStrategy.elementValidated(element, status);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean hasNext() {" + NL + "\t\t\treturn defaultStrategy.hasNext();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isClientContextChanged() {" + NL + "\t\t\tif(preFetchedNextTarget == null) {" + NL + "\t\t\t\tpreFetchedNextTarget = next();" + NL + "\t\t\t\tprepareNextClientContext(preFetchedNextTarget);\t\t\t\t" + NL + "\t\t\t}\t\t\t \t\t\t" + NL + "\t\t\treturn ctxChanged;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic EObject next() {" + NL + "\t\t\tEObject nextTarget = preFetchedNextTarget;" + NL + "\t\t\tif(nextTarget == null) {" + NL + "\t\t\t\tnextTarget = defaultStrategy.next();" + NL + "\t\t\t}" + NL + "\t\t\tthis.preFetchedNextTarget = null;" + NL + "\t\t\treturn this.currentTarget = nextTarget;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void startTraversal("; + protected final String TEXT_86 = " traversalRoots," + NL + "\t\t\t\t"; + protected final String TEXT_87 = " monitor) {" + NL + "\t\t\tdefaultStrategy.startTraversal(traversalRoots, monitor);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void prepareNextClientContext(EObject nextTarget) { " + NL + "\t\t\tif (nextTarget != null && currentTarget != null) {" + NL + "\t\t\t\tif (nextTarget instanceof View) {" + NL + "\t\t\t\t\tString id = ((View) nextTarget).getType();" + NL + "\t\t\t\t\tString nextSemanticId = id != null" + NL + "\t\t\t\t\t\t\t&& semanticCtxIdMap.containsKey(id) ? id : null;" + NL + "\t\t\t\t\tif ((currentSemanticCtxId != null && !currentSemanticCtxId" + NL + "\t\t\t\t\t\t\t.equals(nextSemanticId))" + NL + "\t\t\t\t\t\t\t|| (nextSemanticId != null && !nextSemanticId" + NL + "\t\t\t\t\t\t\t\t\t.equals(currentSemanticCtxId))) {" + NL + "\t\t\t\t\t\tthis.ctxChanged = true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcurrentSemanticCtxId = nextSemanticId;" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// context of domain model" + NL + "\t\t\t\t\tthis.ctxChanged = currentSemanticCtxId != null;" + NL + "\t\t\t\t\tcurrentSemanticCtxId = null;" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.ctxChanged = false;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}// CtxSwitchStrategy"; + protected final String TEXT_88 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class "; + protected final String TEXT_89 = " extends "; + protected final String TEXT_90 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_91 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; + protected final String TEXT_92 = "() {" + NL + "\t\t\texpression = "; + protected final String TEXT_93 = "null"; + protected final String TEXT_94 = "."; + protected final String TEXT_95 = "("; + protected final String TEXT_96 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_97 = ", "; + protected final String TEXT_98 = ")"; + protected final String TEXT_99 = "."; + protected final String TEXT_100 = "("; + protected final String TEXT_101 = ", //$NON-NLS-1$" + NL + "\t"; + protected final String TEXT_102 = ")"; + protected final String TEXT_103 = "new "; + protected final String TEXT_104 = "("; + protected final String TEXT_105 = ") {" + NL + "\tprotected Object doEvaluate(Object context, "; + protected final String TEXT_106 = " env) {\t" + NL + "\t\t"; + protected final String TEXT_107 = " self = ("; + protected final String TEXT_108 = ")context;"; + protected final String TEXT_109 = "\t" + NL + "\t\t"; + protected final String TEXT_110 = " "; + protected final String TEXT_111 = " = ("; + protected final String TEXT_112 = ")env.get(\""; + protected final String TEXT_113 = "\"); //$NON-NLS-1$"; + protected final String TEXT_114 = NL + "\t\treturn "; + protected final String TEXT_115 = "."; + protected final String TEXT_116 = "(self"; + protected final String TEXT_117 = ", "; + protected final String TEXT_118 = ");" + NL + "\t}" + NL + "}"; + protected final String TEXT_119 = NL + ";\t\t" + NL + "\t\t}\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic IStatus validate("; + protected final String TEXT_120 = " ctx) {" + NL + "\t\t\tObject evalCtx = ctx.getTarget();"; + protected final String TEXT_121 = NL + "\t\t\tif(evalCtx instanceof EObject) evalCtx = ((EObject)evalCtx).eGet("; + protected final String TEXT_122 = "());" + NL + "\t\t\tif(evalCtx == null) {"; + protected final String TEXT_123 = NL + "\t\t\t\treturn ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) });"; + protected final String TEXT_124 = NL + "\t\t\t\treturn "; + protected final String TEXT_125 = ".OK_STATUS;"; + protected final String TEXT_126 = NL + "\t\t\t}\t\t\t"; + protected final String TEXT_127 = "\t\t\t" + NL + "\t\t\tevalCtx = "; + protected final String TEXT_128 = ".calculateMetric("; + protected final String TEXT_129 = ", evalCtx);"; + protected final String TEXT_130 = "\t\t" + NL + "\t\t\tObject result = expression.evaluate(evalCtx);" + NL + "\t\t\tif(result instanceof Boolean && ((Boolean)result).booleanValue()) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_131 = ".OK_STATUS;" + NL + "\t\t\t}" + NL + "\t\t\treturn ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) }); " + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String formatElement("; + protected final String TEXT_132 = " object) {" + NL + "\t\t\tif (object == null) {" + NL + "\t\t\t\treturn String.valueOf((Object)null);" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_133 = " adapterFactory = "; + protected final String TEXT_134 = ".getInstance().getItemProvidersAdapterFactory();" + NL + "\t\t\t"; + protected final String TEXT_135 = " labelProvider = ("; + protected final String TEXT_136 = ") adapterFactory.adapt(object, "; + protected final String TEXT_137 = ".class);" + NL + "\t\t\tif (labelProvider != null) {" + NL + "\t\t\t\treturn object.eClass() + \" \" + labelProvider.getText(object);" + NL + "\t\t\t}" + NL + "\t\t\treturn object.toString();" + NL + "\t\t}" + NL + "\t}"; + protected final String TEXT_138 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "static class "; + protected final String TEXT_139 = " {"; + protected final String TEXT_140 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static "; + protected final String TEXT_141 = " "; + protected final String TEXT_142 = "("; + protected final String TEXT_143 = " self"; + protected final String TEXT_144 = ", "; + protected final String TEXT_145 = " "; + protected final String TEXT_146 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new "; + protected final String TEXT_147 = ".NoImplException(\"No user java implementation provided in '"; + protected final String TEXT_148 = "' operation\"); //$NON-NLS-1$" + NL + "}"; + protected final String TEXT_149 = NL + "} //"; + protected final String TEXT_150 = NL + "} //"; + protected final String TEXT_151 = NL; public String generate(Object argument) { @@ -195,17 +193,16 @@ final boolean hasNotationModelAudit; } - stringBuffer.append(TEXT_1); String copyrightText = genDiagram.getEditorGen().getCopyrightText(); if (copyrightText != null && copyrightText.trim().length() > 0) { - stringBuffer.append(TEXT_2); + stringBuffer.append(TEXT_1); stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); - stringBuffer.append(TEXT_3); + stringBuffer.append(TEXT_2); } importManager.emitPackageStatement(stringBuffer); - stringBuffer.append(TEXT_4); + stringBuffer.append(TEXT_3); final java.util.List<String> innerClasses = new java.util.ArrayList<String>(); final String __javaOperationContainer = "JavaAudits"; @@ -252,125 +249,125 @@ importManager.addImport("org.eclipse.ui.IWorkbenchPart"); importManager.addImport("org.eclipse.ui.IEditorPart"); importManager.addImport("org.eclipse.ui.PlatformUI"); - stringBuffer.append(TEXT_5); + stringBuffer.append(TEXT_4); stringBuffer.append(genDiagram.getValidationProviderClassName()); + stringBuffer.append(TEXT_5); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_6); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName())); - stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress")); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor")); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("java.lang.reflect.InvocationTargetException")); + stringBuffer.append(TEXT_11); + stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); stringBuffer.append(TEXT_14); - stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalViewer")); - stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_15); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_16); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.NaiveViewService")); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_17); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService")); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_18); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.NullProgressMonitor")); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_19); stringBuffer.append(pluginActivatorClass); + stringBuffer.append(TEXT_20); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); stringBuffer.append(TEXT_21); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); stringBuffer.append(TEXT_22); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_23); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_23); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ValidationState")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_27); stringBuffer.append(pluginActivatorClass); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater")); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_29); if(hasNotationModelAudit) { - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_30); } - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater")); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_32); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_34); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_35); stringBuffer.append(importManager.getImportedName("java.util.HashSet")); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_37); stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(TEXT_38); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_39); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_41); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); stringBuffer.append(TEXT_43); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); - stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater")); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_44); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService")); - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_45); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_46); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_47); stringBuffer.append(importManager.getImportedName("java.util.HashSet")); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_48); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_49); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.model.IConstraintStatus")); stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.model.IConstraintStatus")); stringBuffer.append(TEXT_51); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.model.IConstraintStatus")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); stringBuffer.append(TEXT_52); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); stringBuffer.append(TEXT_53); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor")); + stringBuffer.append(importManager.getImportedName("java.util.Set")); stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName("java.util.Set")); stringBuffer.append(TEXT_55); - stringBuffer.append(importManager.getImportedName("java.util.Set")); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_56); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_57); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_58); + stringBuffer.append(importManager.getImportedName("java.util.Set")); stringBuffer.append(TEXT_59); stringBuffer.append(importManager.getImportedName("java.util.Set")); stringBuffer.append(TEXT_60); - stringBuffer.append(importManager.getImportedName("java.util.Set")); - stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_62); stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_63); boolean usesNotationContextSwitch = false; java.util.List allAudits = (audits != null) ? audits.getRules() : java.util.Collections.EMPTY_LIST; @@ -386,11 +383,11 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) { for (GenAuditRule audit : contextId2Audit.values()) { String selectorClassName = audit.getContextSelectorLocalClassName(); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_64); stringBuffer.append(selectorClassName); - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_65); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.model.IClientSelector")); - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_66); if(audit.getTarget() instanceof GenDiagramElementTarget) { usesNotationContextSwitch = true; @@ -400,59 +397,59 @@ for (GenAuditRule audit : contextId2Audit.values()) { view2SelectorMap.put(nextElement, selectorClassName); } - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_67); stringBuffer.append(selectorClassName); - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_68); } else { - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_69); } } // end of audits iteration if(usesNotationContextSwitch) { - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_70); stringBuffer.append(importManager.getImportedName("java.util.Map")); - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_71); stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_72); for(java.util.Iterator it = view2SelectorMap.keySet().iterator(); it.hasNext();) { GenCommonBase nextView = (GenCommonBase)it.next(); - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_73); stringBuffer.append(importManager.getImportedName(nextView.getEditPartQualifiedClassName()) + ".VISUAL_ID"); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_74); stringBuffer.append(view2SelectorMap.get(nextView)); - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_75); } // end of view ID iteration - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_76); } // end of context map generation //usesNotationContextSwitch - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_77); if(hasNotationModelAudit) { - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_79); if(usesNotationContextSwitch) { - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_80); } else { - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_81); } // end of usesNotationContextSwitch - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_82); } // end of hasNotationModelAudit if(usesNotationContextSwitch) { + stringBuffer.append(TEXT_83); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); stringBuffer.append(TEXT_84); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); stringBuffer.append(TEXT_85); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); - stringBuffer.append(TEXT_86); stringBuffer.append(importManager.getImportedName("java.util.Collection")); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_86); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor")); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_87); } // end of usesNotationContextSwitch final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders(); @@ -465,15 +462,15 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) { ValueExpression __genValueExpression = nextAudit.getRule(); String importedExpressionBase = (expressionProviders != null) ? importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()) : "null"; //$NON-NLS-1$ - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_88); stringBuffer.append(nextAudit.getConstraintAdapterLocalClassName()); - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_89); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.AbstractModelConstraint")); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_90); stringBuffer.append(importedExpressionBase); - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_91); stringBuffer.append(nextAudit.getConstraintAdapterLocalClassName()); - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_92); { /*begin the scope*/ /* @@ -489,7 +486,7 @@ String __javaOperationContainer; if(__genExprProvider == null || __importedAbstractClass == null) { - stringBuffer.append(TEXT_94); + stringBuffer.append(TEXT_93); } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) { org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider; @@ -498,26 +495,26 @@ String __javaOperationContainer; if(!__exprEnvVariables.isEmpty()) { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_94); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_95); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_96); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_97); stringBuffer.append(__outEnvVarName); - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_98); } else { stringBuffer.append(providerImportedClass); - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_99); stringBuffer.append(__expressionAccessor); - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_100); stringBuffer.append(__genValueExpression.getBodyString()); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_101); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_102); } } else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/ @@ -525,97 +522,97 @@ String __javaOperationContainer; String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression); - stringBuffer.append(TEXT_104); + stringBuffer.append(TEXT_103); stringBuffer.append(__importedAbstractClass); - stringBuffer.append(TEXT_105); + stringBuffer.append(TEXT_104); stringBuffer.append(__ctxEClassifierAccess); - stringBuffer.append(TEXT_106); + stringBuffer.append(TEXT_105); stringBuffer.append(importManager.getImportedName("java.util.Map")); + stringBuffer.append(TEXT_106); + stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_107); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); stringBuffer.append(TEXT_108); - stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_109); 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_110); + stringBuffer.append(TEXT_109); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_111); + stringBuffer.append(TEXT_110); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_112); + stringBuffer.append(TEXT_111); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_113); + stringBuffer.append(TEXT_112); stringBuffer.append(nextVariableName); - stringBuffer.append(TEXT_114); + stringBuffer.append(TEXT_113); } - stringBuffer.append(TEXT_115); + stringBuffer.append(TEXT_114); if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_116); + stringBuffer.append(TEXT_115); } stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_117); + stringBuffer.append(TEXT_116); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){ - stringBuffer.append(TEXT_118); + stringBuffer.append(TEXT_117); stringBuffer.append((String)envVarIt.next()); } - stringBuffer.append(TEXT_119); + stringBuffer.append(TEXT_118); } } /*end of scope*/ - stringBuffer.append(TEXT_120); + stringBuffer.append(TEXT_119); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.IValidationContext")); - stringBuffer.append(TEXT_121); + stringBuffer.append(TEXT_120); if(nextAudit.getTarget() instanceof GenDomainAttributeTarget) { GenDomainAttributeTarget attrTarget = (GenDomainAttributeTarget) nextAudit.getTarget(); if(attrTarget.getAttribute() != null) { String fGetter = (attrTarget.getAttribute() != null) ? importManager.getImportedName(attrTarget.getAttribute().getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + attrTarget.getAttribute().getFeatureAccessorName() : ""; //$NON-NLS-1$ //$NON-NLS-2$ - stringBuffer.append(TEXT_122); + stringBuffer.append(TEXT_121); stringBuffer.append(fGetter); - stringBuffer.append(TEXT_123); + stringBuffer.append(TEXT_122); if(attrTarget.isNullAsError()) { - stringBuffer.append(TEXT_124); + stringBuffer.append(TEXT_123); } else { - stringBuffer.append(TEXT_125); + stringBuffer.append(TEXT_124); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status")); - stringBuffer.append(TEXT_126); + stringBuffer.append(TEXT_125); } - stringBuffer.append(TEXT_127); + stringBuffer.append(TEXT_126); } } else if(nextAudit.getTarget() instanceof GenAuditedMetricTarget) { GenAuditedMetricTarget metricTarget = (GenAuditedMetricTarget)nextAudit.getTarget(); String metricKey = (metricTarget.getMetric() != null) ? metricTarget.getMetric().getKey() : ""; String metricProviderClassName = importManager.getImportedName(genDiagram.getMetricProviderQualifiedClassName()); - stringBuffer.append(TEXT_128); + stringBuffer.append(TEXT_127); stringBuffer.append(metricProviderClassName); - stringBuffer.append(TEXT_129); + stringBuffer.append(TEXT_128); stringBuffer.append(Conversions.toStringLiteral(metricKey)); - stringBuffer.append(TEXT_130); + stringBuffer.append(TEXT_129); } - stringBuffer.append(TEXT_131); + stringBuffer.append(TEXT_130); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status")); - stringBuffer.append(TEXT_132); + stringBuffer.append(TEXT_131); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_133); + stringBuffer.append(TEXT_132); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.AdapterFactory")); - stringBuffer.append(TEXT_134); + stringBuffer.append(TEXT_133); stringBuffer.append(pluginActivatorClass); + stringBuffer.append(TEXT_134); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_135); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_136); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); stringBuffer.append(TEXT_137); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IItemLabelProvider")); - stringBuffer.append(TEXT_138); } } /*end of Adapters iteration*/ @@ -633,9 +630,9 @@ if (audits != null && audits.getEditorGen().getExpressionProviders() != null) { if(!javaExpressions.isEmpty()) { - stringBuffer.append(TEXT_139); + stringBuffer.append(TEXT_138); stringBuffer.append(__javaOperationContainer); - stringBuffer.append(TEXT_140); + stringBuffer.append(TEXT_139); for (java.util.Iterator it = javaExpressions.iterator(); it.hasNext();) { GenAuditRule nextJavaRule = (GenAuditRule) it.next(); @@ -643,7 +640,6 @@ if(!javaExpressions.isEmpty()) { ValueExpression __genValueExpression = nextJavaRule.getRule(); String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$ - stringBuffer.append(TEXT_141); /* ValueExpression __genValueExpression @@ -664,13 +660,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_142); + stringBuffer.append(TEXT_140); stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName)); - stringBuffer.append(TEXT_143); + stringBuffer.append(TEXT_141); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_144); + stringBuffer.append(TEXT_142); stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName)); - stringBuffer.append(TEXT_145); + stringBuffer.append(TEXT_143); for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) { String __nextVarName = (String)envVarIt.next(); @@ -678,32 +674,32 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType); - stringBuffer.append(TEXT_146); + stringBuffer.append(TEXT_144); stringBuffer.append(importManager.getImportedName(qualifiedTypeName)); - stringBuffer.append(TEXT_147); + stringBuffer.append(TEXT_145); stringBuffer.append(__nextVarName); } - stringBuffer.append(TEXT_148); + stringBuffer.append(TEXT_146); stringBuffer.append(__importedAbstractExpr); - stringBuffer.append(TEXT_149); + stringBuffer.append(TEXT_147); stringBuffer.append(__exprJavaOperName); - stringBuffer.append(TEXT_150); + stringBuffer.append(TEXT_148); } /* end of GenJavaExpressionProvider */ } - stringBuffer.append(TEXT_151); + stringBuffer.append(TEXT_149); stringBuffer.append(__javaOperationContainer); } /* end of Java expression methods */ - stringBuffer.append(TEXT_152); + stringBuffer.append(TEXT_150); stringBuffer.append(genDiagram.getValidationProviderClassName()); importManager.emitSortedImports(); - stringBuffer.append(TEXT_153); + stringBuffer.append(TEXT_151); return stringBuffer.toString(); } } |