diff options
author | ashatalin | 2006-04-13 22:22:22 +0000 |
---|---|---|
committer | ashatalin | 2006-04-13 22:22:22 +0000 |
commit | 4b1b72affead95dfa83cd1c48398f04d7ef5e918 (patch) | |
tree | 8d462a97961212b5fc4284d233e8187f4c13b7ca /plugins/org.eclipse.gmf.codegen | |
parent | edaed89079b6b1e45f3e64153a3ce265ef07323a (diff) | |
download | org.eclipse.gmf-tooling-4b1b72affead95dfa83cd1c48398f04d7ef5e918.tar.gz org.eclipse.gmf-tooling-4b1b72affead95dfa83cd1c48398f04d7ef5e918.tar.xz org.eclipse.gmf-tooling-4b1b72affead95dfa83cd1c48398f04d7ef5e918.zip |
#125900 Redundant annotations added to View in generated view factory
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen')
39 files changed, 967 insertions, 983 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java index 5f1f5699b..993fd436c 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java @@ -18,18 +18,19 @@ public class CreateShortcutActionGenerator 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 + "import org.eclipse.core.commands.ExecutionException;" + NL + "import org.eclipse.core.commands.operations.OperationHistoryFactory;" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.core.runtime.NullProgressMonitor;" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "import org.eclipse.emf.common.util.WrappedException;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EcoreFactory;" + NL + "import org.eclipse.gmf.runtime.common.core.command.CommandResult;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;" + NL + "import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.jface.action.IAction;" + NL + "import org.eclipse.jface.viewers.ISelection;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.window.Window;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.IObjectActionDelegate;" + NL + "import org.eclipse.ui.IWorkbenchPart;"; - protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " implements IObjectActionDelegate {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_7 = " mySelectedElement;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Shell myShell;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setActivePart(IAction action, IWorkbenchPart targetPart) {" + NL + "\t\tmyShell = targetPart.getSite().getShell();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\tfinal View view = (View) mySelectedElement.getModel();" + NL + "\t\t"; - protected final String TEXT_8 = " elementChooser = new "; - protected final String TEXT_9 = "(myShell, view);" + NL + "\t\tint result = elementChooser.open();" + NL + "\t\tif (result != Window.OK) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tURI selectedModelElementURI = elementChooser.getSelectedModelElementURI();" + NL + "\t\tfinal EObject selectedElement;" + NL + "\t\ttry {" + NL + "\t\t\tselectedElement = mySelectedElement.getEditingDomain().getResourceSet().getEObject(selectedModelElementURI, true);" + NL + "\t\t} catch (WrappedException e) {" + NL + "\t\t\t"; - protected final String TEXT_10 = ".getInstance().logError(\"Exception while loading object: \" + selectedModelElementURI.toString(), e); //$NON-NLS-1$" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "" + NL + "\t\tif (selectedElement == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tCreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(selectedElement), "; - protected final String TEXT_11 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\tCreateCommand command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view) {" + NL + "" + NL + "\t\t\tprotected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {" + NL + "\t\t\t\tCommandResult result = super.doExecuteWithResult(monitor, info);" + NL + "\t\t\t\tView view = (View) ((IAdaptable) result.getReturnValue()).getAdapter(View.class);" + NL + "\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\tEAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "\t\t\t\t\tannotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\t\t\tview.getEAnnotations().add(annotation);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t};" + NL + "\t\ttry {" + NL + "\t\t\tOperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);" + NL + "\t\t} catch (ExecutionException e) {" + NL + "\t\t\t"; - protected final String TEXT_12 = ".getInstance().logError(\"Unable to create shortcut\", e); //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void selectionChanged(IAction action, ISelection selection) {" + NL + "\t\tmySelectedElement = null;" + NL + "\t\tif (selection instanceof IStructuredSelection) {" + NL + "\t\t\tIStructuredSelection structuredSelection = (IStructuredSelection) selection;" + NL + "\t\t\tif (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof "; - protected final String TEXT_13 = ") {" + NL + "\t\t\t\tmySelectedElement = ("; - protected final String TEXT_14 = ") structuredSelection.getFirstElement();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\taction.setEnabled(isEnabled());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isEnabled() {" + NL + "\t\treturn mySelectedElement != null;" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_15 = NL; + protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_5 = " implements IObjectActionDelegate {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_6 = " mySelectedElement;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Shell myShell;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setActivePart(IAction action, IWorkbenchPart targetPart) {" + NL + "\t\tmyShell = targetPart.getSite().getShell();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\tfinal View view = (View) mySelectedElement.getModel();" + NL + "\t\t"; + protected final String TEXT_7 = " elementChooser = new "; + protected final String TEXT_8 = "(myShell, view);" + NL + "\t\tint result = elementChooser.open();" + NL + "\t\tif (result != Window.OK) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tURI selectedModelElementURI = elementChooser.getSelectedModelElementURI();" + NL + "\t\tfinal EObject selectedElement;" + NL + "\t\ttry {" + NL + "\t\t\tselectedElement = mySelectedElement.getEditingDomain().getResourceSet().getEObject(selectedModelElementURI, true);" + NL + "\t\t} catch (WrappedException e) {" + NL + "\t\t\t"; + protected final String TEXT_9 = ".getInstance().logError(\"Exception while loading object: \" + selectedModelElementURI.toString(), e); //$NON-NLS-1$" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "" + NL + "\t\tif (selectedElement == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tCreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(selectedElement), Node.class, null, "; + protected final String TEXT_10 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\tCreateCommand command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view) {" + NL + "" + NL + "\t\t\tprotected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {" + NL + "\t\t\t\tCommandResult result = super.doExecuteWithResult(monitor, info);" + NL + "\t\t\t\tView view = (View) ((IAdaptable) result.getReturnValue()).getAdapter(View.class);" + NL + "\t\t\t\tif (view != null && view.getEAnnotation(\"Shortcut\") == null) { //$NON-NLS-1$"; + protected final String TEXT_11 = NL + "\t\t\t\t\tEAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "\t\t\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", "; + protected final String TEXT_12 = ".MODEL_ID); //$NON-NLS-1$" + NL + "\t\t\t\t\tview.getEAnnotations().add(shortcutAnnotation);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t};\t\ttry {" + NL + "\t\t\tOperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);" + NL + "\t\t} catch (ExecutionException e) {" + NL + "\t\t\t"; + protected final String TEXT_13 = ".getInstance().logError(\"Unable to create shortcut\", e); //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void selectionChanged(IAction action, ISelection selection) {" + NL + "\t\tmySelectedElement = null;" + NL + "\t\tif (selection instanceof IStructuredSelection) {" + NL + "\t\t\tIStructuredSelection structuredSelection = (IStructuredSelection) selection;" + NL + "\t\t\tif (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof "; + protected final String TEXT_14 = ") {" + NL + "\t\t\t\tmySelectedElement = ("; + protected final String TEXT_15 = ") structuredSelection.getFirstElement();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\taction.setEnabled(isEnabled());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isEnabled() {" + NL + "\t\treturn mySelectedElement != null;" + NL + "\t}" + NL + "" + NL + "}"; + protected final String TEXT_16 = NL; public String generate(Object argument) { @@ -48,29 +49,57 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_3); } importManager.emitPackageStatement(stringBuffer); + +importManager.getImportedName("org.eclipse.core.commands.ExecutionException"); +importManager.getImportedName("org.eclipse.core.commands.operations.OperationHistoryFactory"); +importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"); +importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor"); +importManager.getImportedName("org.eclipse.core.runtime.NullProgressMonitor"); +importManager.getImportedName("org.eclipse.emf.common.util.URI"); +importManager.getImportedName("org.eclipse.emf.common.util.WrappedException"); +importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"); +importManager.getImportedName("org.eclipse.emf.ecore.EObject"); +importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory"); +importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CommandResult"); +importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand"); +importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"); +importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter"); +importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"); +importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"); +importManager.getImportedName("org.eclipse.jface.action.IAction"); +importManager.getImportedName("org.eclipse.jface.viewers.ISelection"); +importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"); +importManager.getImportedName("org.eclipse.jface.window.Window"); +importManager.getImportedName("org.eclipse.swt.widgets.Shell"); +importManager.getImportedName("org.eclipse.ui.IObjectActionDelegate"); +importManager.getImportedName("org.eclipse.ui.IWorkbenchPart"); + +importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_4); - importManager.markImportLocation(stringBuffer); - stringBuffer.append(TEXT_5); stringBuffer.append(genDiagram.getCreateShortcutActionClassName()); - stringBuffer.append(TEXT_6); + stringBuffer.append(TEXT_5); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_6); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName())); stringBuffer.append(TEXT_7); stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName())); stringBuffer.append(TEXT_8); - stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_10); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + /* Shortcut was created on the diagram with the same modelID */ stringBuffer.append(TEXT_11); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_12); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_13); stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_14); - importManager.emitSortedImports(); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_15); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_16); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardPageGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardPageGenerator.java index 9548e675f..38baa25a5 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardPageGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardPageGenerator.java @@ -25,8 +25,8 @@ public class CreationWizardPageGenerator protected final String TEXT_8 = " Diagram\"); //$NON-NLS-1$" + NL + "\t\tsetDescription(\"Create a new "; protected final String TEXT_9 = " diagram.\"); //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFile createAndOpenDiagram(IPath containerPath, String fileName, InputStream initialContents, String kind, IWorkbenchWindow dWindow, IProgressMonitor progressMonitor, boolean saveDiagram) {" + NL + "\t\treturn "; protected final String TEXT_10 = ".createAndOpenDiagram(getDiagramFileCreator(), containerPath, fileName, initialContents, kind, dWindow, progressMonitor, isOpenNewlyCreatedDiagramEditor(), saveDiagram);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getDefaultFileName() {" + NL + "\t\treturn \"default\"; //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic DiagramFileCreator getDiagramFileCreator() {" + NL + "\t\treturn "; - protected final String TEXT_11 = ".getInstance();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getDiagramKind() {" + NL + "\t\treturn \""; - protected final String TEXT_12 = "\"; //$NON-NLS-1$" + NL + "\t}" + NL + "\t"; + protected final String TEXT_11 = ".getInstance();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getDiagramKind() {" + NL + "\t\treturn "; + protected final String TEXT_12 = ".MODEL_ID;" + NL + "\t}" + NL + "\t"; protected final String TEXT_13 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validatePage() {" + NL + "\t\tif (super.validatePage()) {" + NL + "\t\t\tString fileName = getFileName();" + NL + "\t\t\tif (fileName == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\t// appending file extension to correctly process file names including \".\" symbol" + NL + "\t\t\tIPath path = getContainerFullPath().append(getDiagramFileCreator().appendExtensionToFileName(fileName));" + NL + "\t\t\tpath = path.removeFileExtension().addFileExtension(\""; protected final String TEXT_14 = "\"); //$NON-NLS-1$" + NL + "\t\t\tif ("; protected final String TEXT_15 = ".getWorkspace().getRoot().exists(path)) {" + NL + "\t\t\t\tsetErrorMessage(\"Model File already exists: \" + path.lastSegment());" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "\t"; @@ -66,7 +66,7 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_10); stringBuffer.append(genDiagram.getDiagramFileCreatorClassName()); stringBuffer.append(TEXT_11); - stringBuffer.append(editorGen.getModelID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_12); if (!editorGen.isSameFileForDiagramAndModel()) { stringBuffer.append(TEXT_13); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/InitDiagramFileActionGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/InitDiagramFileActionGenerator.java index 5ba9b4872..368c3b35c 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/InitDiagramFileActionGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/InitDiagramFileActionGenerator.java @@ -24,8 +24,8 @@ public class InitDiagramFileActionGenerator { protected final String TEXT_6 = " implements IObjectActionDelegate, IInputValidator {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IWorkbenchPart myPart;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IFile mySelectedModelFile;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IStructuredSelection mySelection;" + NL + " " + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void setActivePart(IAction action, IWorkbenchPart targetPart) {" + NL + "\t\tmyPart = targetPart;" + NL + "\t}" + NL + "\t" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void selectionChanged(IAction action, ISelection selection) {" + NL + "\t\tmySelectedModelFile = null;" + NL + "\t\tmySelection = StructuredSelection.EMPTY;" + NL + "\t\taction.setEnabled(false);" + NL + "\t\tif (selection instanceof IStructuredSelection == false || selection.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tmySelection = (IStructuredSelection) selection;" + NL + "\t\tmySelectedModelFile = (IFile) ((IStructuredSelection) selection).getFirstElement();" + NL + "\t\taction.setEnabled(true);" + NL + "\t}" + NL + "\t" + NL + " /**" + NL + " * @generated" + NL + " */\t" + NL + "\tpublic String isValid(String newText) {" + NL + "\t\tIStatus status = ResourcesPlugin.getWorkspace().validateName(newText, IResource.FILE);" + NL + "\t\tif (!status.isOK()) {" + NL + "\t\t\treturn status.getMessage();" + NL + "\t\t}" + NL + "\t\tif (mySelectedModelFile.getParent().getFile(new Path(newText).addFileExtension(\""; protected final String TEXT_7 = "\")).exists()) {" + NL + "\t\t\treturn \"File already exists, choose another name\";" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + " /**" + NL + " * @generated" + NL + " */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\tWizard wizard = new "; protected final String TEXT_8 = "(mySelectedModelFile, myPart.getSite().getPage(), mySelection);" + NL + " IDialogSettings pluginDialogSettings = "; - protected final String TEXT_9 = ".getInstance().getDialogSettings();" + NL + " IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " if (initDiagramFileSettings == null) {" + NL + " \tinitDiagramFileSettings = pluginDialogSettings.addNewSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " }" + NL + " wizard.setDialogSettings(initDiagramFileSettings);" + NL + "\t\twizard.setForcePreviousAndNextButtons(false);" + NL + "\t\twizard.setWindowTitle(\"Initialize new "; - protected final String TEXT_10 = " diagram file\");" + NL + "" + NL + " WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);" + 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_9 = ".getInstance().getDialogSettings();" + NL + " IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " if (initDiagramFileSettings == null) {" + NL + " \tinitDiagramFileSettings = pluginDialogSettings.addNewSection(\"InisDiagramFile\"); //$NON-NLS-1$" + NL + " }" + NL + " wizard.setDialogSettings(initDiagramFileSettings);" + NL + "\t\twizard.setForcePreviousAndNextButtons(false);" + NL + "\t\twizard.setWindowTitle(\"Initialize new \" + "; + protected final String TEXT_10 = ".MODEL_ID + \" diagram file\");" + NL + "" + NL + " WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);" + 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 getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) { StringBuffer result = new StringBuffer(); @@ -171,7 +171,7 @@ importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_8); stringBuffer.append(pluginActivatorClass); stringBuffer.append(TEXT_9); - stringBuffer.append(editorGen.getModelID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_10); importManager.emitSortedImports(); return stringBuffer.toString(); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java index 1770b30da..2d2c77d65 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/NewDiagramFileWizardGenerator.java @@ -23,13 +23,13 @@ public class NewDiagramFileWizardGenerator { protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; protected final String TEXT_5 = " extends Wizard {" + NL + "" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();" + NL + "\t\t" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate WizardNewFileCreationPage myFileCreationPage;" + NL + "\t\t" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate IFile mySelectedModelFile;" + NL + "\t\t" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate IWorkbenchPage myWorkbenchPage;" + NL + "\t\t" + NL + "\t/**" + NL + " * @generated" + NL + "\t */" + NL + "\tprivate IStructuredSelection mySelection;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; protected final String TEXT_6 = "(IFile selectedModelFile, IWorkbenchPage workbenchPage, IStructuredSelection selection) {" + NL + "\t \tmySelectedModelFile = selectedModelFile;" + NL + "\t \tmyWorkbenchPage = workbenchPage;" + NL + "\t \tmySelection = selection;" + NL + "\t}" + NL + "\t \t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {" + NL + "\t\tmyFileCreationPage = new WizardNewFileCreationPage(\"Initialize new Ecore diagram file\", mySelection);" + NL + "\t\tmyFileCreationPage.setFileName(mySelectedModelFile.getProjectRelativePath().removeFileExtension().addFileExtension(\""; - protected final String TEXT_7 = "\").lastSegment());" + NL + "\t\tmyFileCreationPage.setTitle(\"Diagram file\");" + NL + "\t\tmyFileCreationPage.setDescription(\"Create new diagram and initialize it using specified "; - protected final String TEXT_8 = " model content\");" + NL + "\t\taddPage(myFileCreationPage);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tfinal EObject diagramModelObject = load();" + NL + "\t\tif (diagramModelObject == null) {" + NL + "\t\t\tMessageDialog.openError(getShell(), \"Error\", \"Failed to load user model\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\t\t" + NL + "\t\tIFile diagramFile = myFileCreationPage.createNewFile();" + NL + "\t\ttry {" + NL + "\t\t\tdiagramFile.setCharset(\"UTF-8\", new NullProgressMonitor()); //$NON-NLS-1$" + NL + "\t\t} catch ("; + protected final String TEXT_7 = "\").lastSegment());" + NL + "\t\tmyFileCreationPage.setTitle(\"Diagram file\");" + NL + "\t\tmyFileCreationPage.setDescription(\"Create new diagram and initialize it using specified \" + "; + protected final String TEXT_8 = ".MODEL_ID + \" model content\");" + NL + "\t\taddPage(myFileCreationPage);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tfinal EObject diagramModelObject = load();" + NL + "\t\tif (diagramModelObject == null) {" + NL + "\t\t\tMessageDialog.openError(getShell(), \"Error\", \"Failed to load user model\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\t\t" + NL + "\t\tIFile diagramFile = myFileCreationPage.createNewFile();" + NL + "\t\ttry {" + NL + "\t\t\tdiagramFile.setCharset(\"UTF-8\", new NullProgressMonitor()); //$NON-NLS-1$" + NL + "\t\t} catch ("; protected final String TEXT_9 = " e) {" + NL + "\t\t\t"; protected final String TEXT_10 = ".getInstance().logError(\"Unable to set charset for diagram file\", e); //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tResourceSet resourceSet = myEditingDomain.getResourceSet();" + NL + "\t\tfinal Resource diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFile.getFullPath().toString()));" + NL + "" + NL + "\t\tList affectedFiles = new LinkedList();" + NL + "\t\taffectedFiles.add(mySelectedModelFile);" + NL + "\t\taffectedFiles.add(diagramFile);" + NL + "\t\t\t" + NL + "\t\tAbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, \"Initializing diagram contents\", affectedFiles) { //$NON-NLS-1$" + NL + "\t\t\tprotected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {" + NL + "\t\t\t\tint diagramVID = "; protected final String TEXT_11 = ".INSTANCE.getDiagramVisualID(diagramModelObject);" + NL + "\t\t\t\tif (diagramVID != "; - protected final String TEXT_12 = ") {" + NL + "\t\t\t\t\treturn CommandResult.newErrorCommandResult(\"Incorrect model object stored as a root resource object\"); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t\tDiagram diagram = ViewService.createDiagram(diagramModelObject, \""; - protected final String TEXT_13 = "\", "; + protected final String TEXT_12 = ") {" + NL + "\t\t\t\t\treturn CommandResult.newErrorCommandResult(\"Incorrect model object stored as a root resource object\"); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t\tDiagram diagram = ViewService.createDiagram(diagramModelObject, "; + protected final String TEXT_13 = ".MODEL_ID, "; protected final String TEXT_14 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\t\t\tdiagramResource.getContents().add(diagram);"; protected final String TEXT_15 = NL + "\t\t\t\tdiagramResource.getContents().add(diagram.getElement());"; protected final String TEXT_16 = NL + "\t\t\t\tinitDiagramContents(diagram, diagramModelObject);"; @@ -346,7 +346,6 @@ final boolean isSynchronizedDiagram = true; final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; final GenEditorGenerator editorGen = genDiagram.getEditorGen(); -final String modelID = editorGen.getModelID(); final String pluginActivatorClass = importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName()); stringBuffer.append(TEXT_1); @@ -399,7 +398,7 @@ importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_6); stringBuffer.append(editorGen.getDiagramFileExtension()); stringBuffer.append(TEXT_7); - stringBuffer.append(modelID); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.CoreException")); stringBuffer.append(TEXT_9); @@ -409,7 +408,7 @@ importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_11); stringBuffer.append(genDiagram.getVisualID()); stringBuffer.append(TEXT_12); - stringBuffer.append(modelID); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_13); stringBuffer.append(pluginActivatorClass); stringBuffer.append(TEXT_14); @@ -815,7 +814,7 @@ if (phantomsOnly ? (!genFeature.isContains() || phantomNode == null) : (genFeatu stringBuffer.append(TEXT_159); stringBuffer.append(importManager.getImportedName(phantomNode.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_160); - stringBuffer.append(pluginActivatorClass); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_161); stringBuffer.append(phantomNode.getUniqueIdentifier()); stringBuffer.append(TEXT_162); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java index 568938467..920b67f1f 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/VisualIDRegistryGenerator.java @@ -21,92 +21,89 @@ public class VisualIDRegistryGenerator protected final String TEXT_3 = NL + " */"; protected final String TEXT_4 = NL; protected final String TEXT_5 = NL + NL + "/**" + NL + " * This registry is used to determine which type of visual object should be" + NL + " * created for the corresponding Diagram, Node, ChildNode or Link represented " + NL + " * by a domain model object." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_6 = " {" + NL + "" + NL + "\tpublic static final "; + protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; protected final String TEXT_7 = " INSTANCE = new "; - protected final String TEXT_8 = "();" + NL + "\t\t" + 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_9 = NL + "\t\tif ("; - protected final String TEXT_10 = ".eINSTANCE.get"; - protected final String TEXT_11 = "().equals(domainElementMetaclass) && (domainElement == null || isDiagram"; - protected final String TEXT_12 = "(("; - protected final String TEXT_13 = ") domainElement))) {" + NL + "\t\t\treturn "; - protected final String TEXT_14 = ";" + NL + "\t\t}"; - protected final String TEXT_15 = 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, null);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!\""; - protected final String TEXT_16 = "\".equals(containerModelID)"; - protected final String TEXT_17 = "\t\t\t" + NL + "\t\t\t&& !\""; - protected final String TEXT_18 = "\".equals(containerModelID)"; - protected final String TEXT_19 = NL + "\t\t) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif (\""; - protected final String TEXT_20 = "\".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 = ";\t\t" + 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 = ":"; - protected final String TEXT_24 = NL + "\t\t\tif ("; - protected final String TEXT_25 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_26 = ";" + NL + "\t\t\t}"; - protected final String TEXT_27 = NL + "\t\t\tif ("; - protected final String TEXT_28 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_29 = ";" + NL + "\t\t\t} "; - protected final String TEXT_30 = "\t\t" + NL + "\t\t\tif ((semanticHint == null || "; - protected final String TEXT_31 = ".VISUAL_ID.equals(semanticHint)) && "; - protected final String TEXT_32 = ".eINSTANCE.get"; - protected final String TEXT_33 = "().equals(domainElementMetaclass) && (domainElement == null || isNode"; - protected final String TEXT_34 = "(("; - protected final String TEXT_35 = ") domainElement))) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_36 = ";" + NL + "\t\t\t} "; - protected final String TEXT_37 = NL + "\t\t\treturn getUnrecognized"; - protected final String TEXT_38 = "ChildNodeID(domainElement, semanticHint);"; - protected final String TEXT_39 = NL + "\t\tcase "; - protected final String TEXT_40 = ":"; - protected final String TEXT_41 = NL + "\t\t\tif ("; - protected final String TEXT_42 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; - protected final String TEXT_43 = ";" + NL + "\t\t\t}"; - protected final String TEXT_44 = NL + "\t\t\treturn getUnrecognized"; - protected final String TEXT_45 = "LinkLabelID(semanticHint);"; - protected final String TEXT_46 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getLinkWithClassVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; - protected final String TEXT_47 = NL + "\t\tif ("; - protected final String TEXT_48 = ".eINSTANCE.get"; - protected final String TEXT_49 = "().equals(domainElementMetaclass) && (domainElement == null || isLinkWithClass"; - protected final String TEXT_50 = "(("; - protected final String TEXT_51 = ") domainElement))) {" + NL + "\t\t\treturn "; - protected final String TEXT_52 = ";" + NL + "\t\t} else "; - protected final String TEXT_53 = NL + "\t\t{" + NL + "\t\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t\t}" + NL + "\t}\t" + NL; - protected final String TEXT_54 = 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_55 = "("; - protected final String TEXT_56 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; - protected final String TEXT_57 = 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}"; - protected final String TEXT_58 = 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_8 = "();" + NL + "\t" + 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_9 = ".MODEL_ID.equals(view.getType())) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_10 = ";" + NL + "\t\t\t} else {" + NL + "\t\t\t\treturn -1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(view.getType());" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; + protected final String TEXT_11 = ".getInstance().logError(\"Unable to parse view type as a visualID number: \" + view.getType(), e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + 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_12 = " 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.getType();" + NL + "\t}" + NL + "\t\t" + 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_13 = NL + "\t\tif ("; + protected final String TEXT_14 = ".eINSTANCE.get"; + protected final String TEXT_15 = "().equals(domainElementMetaclass) && (domainElement == null || isDiagram"; + protected final String TEXT_16 = "(("; + protected final String TEXT_17 = ") domainElement))) {" + NL + "\t\t\treturn "; + protected final String TEXT_18 = ";" + NL + "\t\t}"; + protected final String TEXT_19 = 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, null);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) {" + NL + "\t\tString containerModelID = getModelID(containerView);" + NL + "\t\tif (!"; + protected final String TEXT_20 = ".MODEL_ID.equals(containerModelID)"; + protected final String TEXT_21 = "\t\t\t" + NL + "\t\t\t&& !\""; + protected final String TEXT_22 = "\".equals(containerModelID)"; + protected final String TEXT_23 = NL + "\t\t) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tint containerVisualID;" + NL + "\t\tif ("; + protected final String TEXT_24 = ".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_25 = ";\t\t" + 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_26 = NL + "\t\tcase "; + protected final String TEXT_27 = ":"; + protected final String TEXT_28 = NL + "\t\t\tif ("; + protected final String TEXT_29 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_30 = ";" + NL + "\t\t\t}"; + protected final String TEXT_31 = NL + "\t\t\tif ("; + protected final String TEXT_32 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_33 = ";" + NL + "\t\t\t} "; + protected final String TEXT_34 = "\t\t" + NL + "\t\t\tif ((semanticHint == null || "; + protected final String TEXT_35 = ".VISUAL_ID.equals(semanticHint)) && "; + protected final String TEXT_36 = ".eINSTANCE.get"; + protected final String TEXT_37 = "().equals(domainElementMetaclass) && (domainElement == null || isNode"; + protected final String TEXT_38 = "(("; + protected final String TEXT_39 = ") domainElement))) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_40 = ";" + NL + "\t\t\t} "; + protected final String TEXT_41 = NL + "\t\t\treturn getUnrecognized"; + protected final String TEXT_42 = "ChildNodeID(domainElement, semanticHint);"; + protected final String TEXT_43 = NL + "\t\tcase "; + protected final String TEXT_44 = ":"; + protected final String TEXT_45 = NL + "\t\t\tif ("; + protected final String TEXT_46 = ".VISUAL_ID.equals(semanticHint)) {" + NL + "\t\t\t\treturn "; + protected final String TEXT_47 = ";" + NL + "\t\t\t}"; + protected final String TEXT_48 = NL + "\t\t\treturn getUnrecognized"; + protected final String TEXT_49 = "LinkLabelID(semanticHint);"; + protected final String TEXT_50 = NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement) {" + NL + "\t\tEClass domainElementMetaclass = domainElement.eClass();" + NL + "\t\treturn getLinkWithClassVisualID(domainElement, domainElementMetaclass);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {"; + protected final String TEXT_51 = NL + "\t\tif ("; + protected final String TEXT_52 = ".eINSTANCE.get"; + protected final String TEXT_53 = "().equals(domainElementMetaclass) && (domainElement == null || isLinkWithClass"; + protected final String TEXT_54 = "(("; + protected final String TEXT_55 = ") domainElement))) {" + NL + "\t\t\treturn "; + protected final String TEXT_56 = ";" + NL + "\t\t} else "; + protected final String TEXT_57 = NL + "\t\t{" + NL + "\t\t\treturn getUnrecognizedLinkWithClassID(domainElement);" + NL + "\t\t}" + NL + "\t}\t" + NL; + protected final String TEXT_58 = 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_59 = "("; - protected final String TEXT_60 = " element) {" + NL + "\t\treturn ElementSelectors."; - protected final String TEXT_61 = ".matches(element);" + NL + "\t}\t"; - protected final String TEXT_62 = 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_63 = "ChildNodeID(EObject domainElement, String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_64 = 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_65 = "LinkLabelID(String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_66 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; - protected final String TEXT_67 = 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_68 = "("; - protected final String TEXT_69 = " element) {" + NL + "\t\treturn ElementSelectors."; - protected final String TEXT_70 = ".matches(element);" + NL + "\t}"; - protected final String TEXT_71 = NL; - protected final String TEXT_72 = NL; - protected final String TEXT_73 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getModelID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_74 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn (String) annotation.getDetails().get(\"modelID\"); //$NON-NLS-1$" + NL + "\t}" + NL; - protected final String TEXT_75 = NL; - protected final String TEXT_76 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_77 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_78 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ElementSelectors {\t"; - protected final String TEXT_79 = NL + NL + "\t\t/**" + NL + "\t\t * Element matching condition for "; - protected final String TEXT_80 = "." + NL + "\t\t * <pre>language: "; - protected final String TEXT_81 = "</pre>\t" + NL + "\t\t * <pre>body : "; - protected final String TEXT_82 = "</pre>" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final Matcher "; - protected final String TEXT_83 = " = new Matcher(\""; - protected final String TEXT_84 = "\");"; - protected final String TEXT_85 = NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ElementSelectors() {" + NL + "\t\t}"; - protected final String TEXT_86 = "\t\t\t" + NL + "\t\t/**" + NL + "\t\t* @generated\t" + NL + "\t\t*/" + NL + "\t\tstatic class Matcher {" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate EClass evalContext;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate "; - protected final String TEXT_87 = " condition;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate String body;\t\t" + NL + "\t\t\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t" + NL + "\t\t\tMatcher(String expressionBody) {\t\t\t" + NL + "\t\t\t\tbody = expressionBody;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tboolean matches(EObject object) {\t\t" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tBoolean result = (object != null) ? evaluate(object) : Boolean.FALSE;" + NL + "\t\t\t\t\treturn result.booleanValue();" + NL + "\t\t\t\t} catch(IllegalArgumentException e) {" + NL + "\t\t\t\t\t"; - protected final String TEXT_88 = ".getInstance().logError(null, e);" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t" + NL + "\t\t\tprivate Boolean evaluate(EObject context) {" + NL + "\t\t\t\tthis.evalContext = context.eClass();" + NL + "\t\t\t\tif(condition == null) {\t\t\t\t\t" + NL + "\t\t\t\t\tcondition = new "; - protected final String TEXT_89 = "(body, evalContext);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif(condition != null) {" + NL + "\t\t\t\t\treturn booleanCast(condition.evaluate(context));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate static Boolean booleanCast(Object value) {" + NL + "\t\t\t\tif(value == null) {" + NL + "\t\t\t\t\treturn null;" + NL + "\t\t\t\t} else if(value instanceof Boolean) {" + NL + "\t\t\t\t\t return (Boolean)value;\t" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t\t} // end of Matcher"; - protected final String TEXT_90 = "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class AcceptAllMatcher {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tstatic final AcceptAllMatcher INSTANCE = new AcceptAllMatcher();" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t\t\t" + NL + "\t\t\tboolean matches(Object element) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic AcceptAllMatcher acceptAllMatcher() {" + NL + "\t\t\treturn AcceptAllMatcher.INSTANCE;" + NL + "\t\t}" + NL + "\t} // end of ElementSelectors" + NL + "}" + NL + "\t"; - protected final String TEXT_91 = NL; + protected final String TEXT_60 = " element) {" + NL + "\t\treturn true;" + NL + "\t}"; + protected final String TEXT_61 = 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}"; + protected final String TEXT_62 = 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_63 = "("; + protected final String TEXT_64 = " element) {" + NL + "\t\treturn ElementSelectors."; + protected final String TEXT_65 = ".matches(element);" + NL + "\t}\t"; + protected final String TEXT_66 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate int getUnrecognized"; + protected final String TEXT_67 = "ChildNodeID(EObject domainElement, String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_68 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate int getUnrecognized"; + protected final String TEXT_69 = "LinkLabelID(String semanticHint) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_70 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}"; + protected final String TEXT_71 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isLinkWithClass"; + protected final String TEXT_72 = "("; + protected final String TEXT_73 = " element) {" + NL + "\t\treturn ElementSelectors."; + protected final String TEXT_74 = ".matches(element);" + NL + "\t}"; + protected final String TEXT_75 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ElementSelectors {\t"; + protected final String TEXT_76 = NL + NL + "\t\t/**" + NL + "\t\t * Element matching condition for "; + protected final String TEXT_77 = "." + NL + "\t\t * <pre>language: "; + protected final String TEXT_78 = "</pre>\t" + NL + "\t\t * <pre>body : "; + protected final String TEXT_79 = "</pre>" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final Matcher "; + protected final String TEXT_80 = " = new Matcher(\""; + protected final String TEXT_81 = "\");"; + protected final String TEXT_82 = NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ElementSelectors() {" + NL + "\t\t}"; + protected final String TEXT_83 = "\t\t\t" + NL + "\t\t/**" + NL + "\t\t* @generated\t" + NL + "\t\t*/" + NL + "\t\tstatic class Matcher {" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate EClass evalContext;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate "; + protected final String TEXT_84 = " condition;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate String body;\t\t" + NL + "\t\t\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t" + NL + "\t\t\tMatcher(String expressionBody) {\t\t\t" + NL + "\t\t\t\tbody = expressionBody;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tboolean matches(EObject object) {\t\t" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tBoolean result = (object != null) ? evaluate(object) : Boolean.FALSE;" + NL + "\t\t\t\t\treturn result.booleanValue();" + NL + "\t\t\t\t} catch(IllegalArgumentException e) {" + NL + "\t\t\t\t\t"; + protected final String TEXT_85 = ".getInstance().logError(null, e);" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t" + NL + "\t\t\tprivate Boolean evaluate(EObject context) {" + NL + "\t\t\t\tthis.evalContext = context.eClass();" + NL + "\t\t\t\tif(condition == null) {\t\t\t\t\t" + NL + "\t\t\t\t\tcondition = new "; + protected final String TEXT_86 = "(body, evalContext);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif(condition != null) {" + NL + "\t\t\t\t\treturn booleanCast(condition.evaluate(context));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate static Boolean booleanCast(Object value) {" + NL + "\t\t\t\tif(value == null) {" + NL + "\t\t\t\t\treturn null;" + NL + "\t\t\t\t} else if(value instanceof Boolean) {" + NL + "\t\t\t\t\t return (Boolean)value;\t" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t\t} // end of Matcher"; + protected final String TEXT_87 = "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class AcceptAllMatcher {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tstatic final AcceptAllMatcher INSTANCE = new AcceptAllMatcher();" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t\t\t" + NL + "\t\t\tboolean matches(Object element) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic AcceptAllMatcher acceptAllMatcher() {" + NL + "\t\t\treturn AcceptAllMatcher.INSTANCE;" + NL + "\t\t}" + NL + "\t} // end of ElementSelectors" + NL + "}" + NL + "\t"; + protected final String TEXT_88 = NL; public String generate(Object argument) { @@ -144,26 +141,34 @@ importManager.markImportLocation(stringBuffer); stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getVisualIDRegistryClassName()); stringBuffer.append(TEXT_8); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_9); + stringBuffer.append(genDiagram.getVisualID()); + stringBuffer.append(TEXT_10); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); + stringBuffer.append(TEXT_11); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); + stringBuffer.append(TEXT_12); if (genDiagram.getDomainDiagramElement() != null) { String classifierAccessorName = genDiagram.getDomainDiagramElement().getClassifierAccessorName(); String interfaceName = importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()); - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_13); stringBuffer.append(genDiagram.getMetaPackageName(importManager)); - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_14); stringBuffer.append(classifierAccessorName); - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_15); stringBuffer.append(genDiagram.getUniqueIdentifier()); - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_16); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_17); stringBuffer.append(genDiagram.getVisualID()); - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_18); } - stringBuffer.append(TEXT_15); - stringBuffer.append(modelID); - stringBuffer.append(TEXT_16); + stringBuffer.append(TEXT_19); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_20); for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext();) { String nextDomainModelName = (String) it.next(); @@ -171,45 +176,45 @@ for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext() continue; } - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_21); stringBuffer.append(nextDomainModelName); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_22); } - stringBuffer.append(TEXT_19); - stringBuffer.append(modelID); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_23); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_24); stringBuffer.append(genDiagram.getVisualID()); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_25); for (Iterator containers = allContainers.iterator(); containers.hasNext();) { GenContainerBase nextContainer = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_26); stringBuffer.append(nextContainer.getVisualID()); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_27); if (nextContainer instanceof GenNode) { GenNode node = (GenNode) nextContainer; for (Iterator labels = node.getLabels().iterator(); labels.hasNext() && !node.isListContainerEntry();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_28); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_29); stringBuffer.append(label.getVisualID()); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_30); } for (Iterator compartments = node.getCompartments().iterator(); compartments.hasNext();) { GenCompartment compartment = (GenCompartment) compartments.next(); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName(compartment.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_32); stringBuffer.append(compartment.getVisualID()); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_33); } } @@ -220,48 +225,48 @@ for (Iterator containers = allContainers.iterator(); containers.hasNext();) { final String interfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getQualifiedInterfaceName()); final String semanticPackageInterfaceName = importManager.getImportedName(childNode.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_34); stringBuffer.append(importManager.getImportedName(childNode.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_35); stringBuffer.append(semanticPackageInterfaceName); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_36); stringBuffer.append(classifierAccessorName); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_37); stringBuffer.append(childNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_38); stringBuffer.append(interfaceName); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_39); stringBuffer.append(childNode.getVisualID()); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_40); } - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_41); stringBuffer.append(nextContainer.getUniqueIdentifier()); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_42); } for (Iterator links = genLinks.iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_43); stringBuffer.append(link.getVisualID()); - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_44); for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_45); stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_46); stringBuffer.append(linkLabel.getVisualID()); - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_47); } - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_48); stringBuffer.append(link.getUniqueIdentifier()); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_49); } - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_50); for (int i = 0; i < genLinks.size(); i++) { GenLink genLink = (GenLink) genLinks.get(i); @@ -271,30 +276,30 @@ for (int i = 0; i < genLinks.size(); i++) { final String qualifiedInterfaceName = modelFacet.getMetaClass().getQualifiedInterfaceName(); final String semanticPackageInterfaceName = importManager.getImportedName(modelFacet.getMetaClass().getGenPackage().getQualifiedPackageInterfaceName()); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_51); stringBuffer.append(semanticPackageInterfaceName); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_52); stringBuffer.append(semanticLinkInterfaceName); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_53); stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName(qualifiedInterfaceName)); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_55); stringBuffer.append(genLink.getVisualID()); - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_56); } } - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_57); if (genDiagram.getDomainDiagramElement() != null) { - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_58); stringBuffer.append(genDiagram.getUniqueIdentifier()); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_59); stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_60); } - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_61); String acceptAllMatcherAccessor = "acceptAllMatcher()"; //$NON-NLS-1$ for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) { @@ -302,31 +307,31 @@ for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) { String qualifiedChildNodeInterfaceName = nextNode.getDomainMetaClass().getQualifiedInterfaceName(); String childNodeSelector = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null ? nextNode.getUniqueIdentifier() : acceptAllMatcherAccessor; - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_62); stringBuffer.append(nextNode.getUniqueIdentifier()); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_63); stringBuffer.append(importManager.getImportedName(qualifiedChildNodeInterfaceName)); - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_64); stringBuffer.append(childNodeSelector); - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_65); } for (Iterator containers = allContainers.iterator(); containers.hasNext();) { GenContainerBase nextContainer = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_66); stringBuffer.append(nextContainer.getUniqueIdentifier()); - stringBuffer.append(TEXT_63); + stringBuffer.append(TEXT_67); } for (Iterator links = genLinks.iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); - stringBuffer.append(TEXT_64); + stringBuffer.append(TEXT_68); stringBuffer.append(link.getUniqueIdentifier()); - stringBuffer.append(TEXT_65); + stringBuffer.append(TEXT_69); } - stringBuffer.append(TEXT_66); + stringBuffer.append(TEXT_70); for (int i = 0; i < genLinks.size(); i++) { GenLink genLink = (GenLink) genLinks.get(i); @@ -335,28 +340,18 @@ for (int i = 0; i < genLinks.size(); i++) { String qualifiedInterfaceName = modelFacet.getMetaClass().getQualifiedInterfaceName(); String linkSelector = modelFacet.getModelElementSelector() != null ? genLink.getUniqueIdentifier() : acceptAllMatcherAccessor; - stringBuffer.append(TEXT_67); + stringBuffer.append(TEXT_71); stringBuffer.append(genLink.getUniqueIdentifier()); - stringBuffer.append(TEXT_68); + stringBuffer.append(TEXT_72); stringBuffer.append(importManager.getImportedName(qualifiedInterfaceName)); - stringBuffer.append(TEXT_69); + stringBuffer.append(TEXT_73); stringBuffer.append(linkSelector); - stringBuffer.append(TEXT_70); + stringBuffer.append(TEXT_74); } } - stringBuffer.append(TEXT_71); - stringBuffer.append(TEXT_72); - stringBuffer.append(TEXT_73); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_74); stringBuffer.append(TEXT_75); - stringBuffer.append(TEXT_76); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_77); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_78); int selectorCounter = 0; for (Iterator it = genDiagram.eAllContents(); it.hasNext();) { @@ -376,31 +371,31 @@ for (Iterator it = genDiagram.eAllContents(); it.hasNext();) { GenConstraint selector = modelFacet.getModelElementSelector(); selectorCounter++; - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_76); stringBuffer.append(id); - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_77); stringBuffer.append(selector.getLanguage()); - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_78); stringBuffer.append(selector.getBody()); - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_79); stringBuffer.append(id); - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_80); stringBuffer.append(selector.getBody()); - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_81); } - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_82); if(selectorCounter > 0) { - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_83); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition")); - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_84); stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_85); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition")); - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_86); } - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_87); importManager.emitSortedImports(); - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_88); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ChildNodeEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ChildNodeEditPartGenerator.java index f0ac57c0c..39adb98c1 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ChildNodeEditPartGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ChildNodeEditPartGenerator.java @@ -98,9 +98,9 @@ public class ChildNodeEditPartGenerator protected final String TEXT_81 = ") {" + NL + "\t\t\t(("; protected final String TEXT_82 = ") getManager()).show(initialCharacter);" + NL + "\t\t} else {" + NL + "\t\t\tperformDirectEdit();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performDirectEditRequest("; protected final String TEXT_83 = " request) {" + NL + "\t\tfinal "; - protected final String TEXT_84 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest instanceof "; - protected final String TEXT_85 = ") {" + NL + "\t\t\t\t\t\t\tchar c = (("; - protected final String TEXT_86 = ") theRequest).getInitialCharacter();" + NL + "\t\t\t\t\t\t\tperformDirectEdit(c);" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; + protected final String TEXT_84 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest.getExtendedData().get("; + protected final String TEXT_85 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {" + NL + "\t\t\t\t\t\t\tCharacter initialChar = (Character) theRequest.getExtendedData().get("; + protected final String TEXT_86 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);" + NL + "\t\t\t\t\t\t\tperformDirectEdit(initialChar.charValue());" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; protected final String TEXT_87 = ") && (getEditText().equals(getLabelText()))) {" + NL + "\t\t\t\t\t\t\t"; protected final String TEXT_88 = " editRequest =" + NL + "\t\t\t\t\t\t\t\t("; protected final String TEXT_89 = ") theRequest;" + NL + "\t\t\t\t\t\t\tperformDirectEdit(editRequest.getLocation());" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tperformDirectEdit();" + 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 (InterruptedException e) {" + NL + "\t\t\te.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshLabel();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshFontColor();" + NL + "\t\trefreshUnderline();" + NL + "\t\trefreshStrikeThrough();"; @@ -318,9 +318,9 @@ GenCommonBase genCommonBase = genChildNode; stringBuffer.append(TEXT_83); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); stringBuffer.append(TEXT_84); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_85); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_86); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")); stringBuffer.append(TEXT_87); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/DiagramEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/DiagramEditPartGenerator.java index 27aaa7366..bdbdda3af 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/DiagramEditPartGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/DiagramEditPartGenerator.java @@ -22,11 +22,12 @@ public class DiagramEditPartGenerator protected final String TEXT_5 = ";" + NL; protected final String TEXT_6 = NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " extends DiagramEditPart {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; - protected final String TEXT_9 = "(View view) {" + NL + "\t\tsuper(view);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createDefaultEditPolicies() {" + NL + "\t\tsuper.createDefaultEditPolicies();" + NL + "\t\tinstallEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new "; - protected final String TEXT_10 = "());" + NL + "\t\tinstallEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new "; - protected final String TEXT_11 = "());" + NL + "\t}" + NL + "}"; - protected final String TEXT_12 = NL; + protected final String TEXT_8 = " extends DiagramEditPart {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String MODEL_ID = \""; + protected final String TEXT_9 = "\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_10 = "(View view) {" + NL + "\t\tsuper(view);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createDefaultEditPolicies() {" + NL + "\t\tsuper.createDefaultEditPolicies();" + NL + "\t\tinstallEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new "; + protected final String TEXT_11 = "());" + NL + "\t\tinstallEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new "; + protected final String TEXT_12 = "());" + NL + "\t}" + NL + "}"; + protected final String TEXT_13 = NL; public String generate(Object argument) { @@ -52,14 +53,16 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getEditPartClassName()); stringBuffer.append(TEXT_8); - stringBuffer.append(genDiagram.getEditPartClassName()); + stringBuffer.append(genDiagram.getEditorGen().getModelID()); stringBuffer.append(TEXT_9); - stringBuffer.append(importManager.getImportedName(genDiagram.getItemSemanticEditPolicyQualifiedClassName())); + stringBuffer.append(genDiagram.getEditPartClassName()); stringBuffer.append(TEXT_10); - stringBuffer.append(importManager.getImportedName(genDiagram.getCanonicalEditPolicyQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getItemSemanticEditPolicyQualifiedClassName())); stringBuffer.append(TEXT_11); - importManager.emitSortedImports(); + stringBuffer.append(importManager.getImportedName(genDiagram.getCanonicalEditPolicyQualifiedClassName())); stringBuffer.append(TEXT_12); + importManager.emitSortedImports(); + stringBuffer.append(TEXT_13); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java index 29535dfcd..7fe6dfcd9 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/EditPartFactoryGenerator.java @@ -23,29 +23,24 @@ public class EditPartFactoryGenerator protected final String TEXT_5 = ";" + NL; protected final String TEXT_6 = NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gef.EditPartFactory;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " implements EditPartFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EXTERNAL_NODE_LABELS_LAYER = \"External Node Labels\";" + NL; - protected final String TEXT_9 = NL; - protected final String TEXT_10 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getModelID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_11 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn (String) annotation.getDetails().get(\"modelID\"); //$NON-NLS-1$" + NL + "\t}" + NL; - protected final String TEXT_12 = NL; - protected final String TEXT_13 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_14 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_15 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + 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_16 = "\".equals(getModelID(view))) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tint viewVisualID = getVisualID(view);" + NL + "\t\t\tswitch (viewVisualID) {"; - protected final String TEXT_17 = NL + "\t\t\tcase "; - protected final String TEXT_18 = ":" + NL + "\t\t\t\t return new "; - protected final String TEXT_19 = "(view);"; - protected final String TEXT_20 = NL + "\t\t\tcase "; - protected final String TEXT_21 = ":" + NL + "\t\t\t\treturn new "; - protected final String TEXT_22 = "(view);"; - protected final String TEXT_23 = "\t\t" + NL + "\t\t\tcase "; - protected final String TEXT_24 = ":" + NL + "\t\t\t\treturn new "; - protected final String TEXT_25 = "(view);"; - protected final String TEXT_26 = NL + "\t\t\tcase "; - protected final String TEXT_27 = ":" + NL + "\t\t\t\treturn new "; - protected final String TEXT_28 = "(view);"; - protected final String TEXT_29 = 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_30 = NL; + protected final String TEXT_8 = " implements EditPartFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EXTERNAL_NODE_LABELS_LAYER = \"External Node Labels\";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPart createEditPart(EditPart context, Object model) {" + NL + "\t\tif (model instanceof View) {" + NL + "\t\t\tView view = (View) model;" + NL + "\t\t\tif (!"; + protected final String TEXT_9 = ".MODEL_ID.equals("; + protected final String TEXT_10 = ".getModelID(view))) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tint viewVisualID = "; + protected final String TEXT_11 = ".getVisualID(view);" + NL + "\t\t\tswitch (viewVisualID) {"; + protected final String TEXT_12 = NL + "\t\t\tcase "; + protected final String TEXT_13 = ":" + NL + "\t\t\t\t return new "; + protected final String TEXT_14 = "(view);"; + protected final String TEXT_15 = NL + "\t\t\tcase "; + protected final String TEXT_16 = ":" + 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 = ":" + 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 = ":" + NL + "\t\t\t\treturn new "; + protected final String TEXT_23 = "(view);"; + protected final String TEXT_24 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createUnrecognizedEditPart(context, model);" + NL + "\t}" + NL + "\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) { @@ -68,42 +63,39 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_5); ImportUtil importManager = new ImportUtil(genDiagram.getEditPartsPackageName()); stringBuffer.append(TEXT_6); - importManager.markImportLocation(stringBuffer); + +importManager.markImportLocation(stringBuffer); +final String visualIDRegistryClassName = importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()); + stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getEditPartFactoryClassName()); stringBuffer.append(TEXT_8); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_9); + stringBuffer.append(visualIDRegistryClassName); stringBuffer.append(TEXT_10); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); + stringBuffer.append(visualIDRegistryClassName); stringBuffer.append(TEXT_11); - stringBuffer.append(TEXT_12); - stringBuffer.append(TEXT_13); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_14); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_15); - stringBuffer.append(modelID); - stringBuffer.append(TEXT_16); for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { GenContainerBase container = (GenContainerBase) containers.next(); - stringBuffer.append(TEXT_17); + stringBuffer.append(TEXT_12); stringBuffer.append(container.getVisualID()); - stringBuffer.append(TEXT_18); + stringBuffer.append(TEXT_13); stringBuffer.append(container.getEditPartClassName()); - stringBuffer.append(TEXT_19); + stringBuffer.append(TEXT_14); if (container instanceof GenNode && !((GenNode) container).isListContainerEntry()) { GenNode node = (GenNode) container; for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) { GenNodeLabel label = (GenNodeLabel) labels.next(); - stringBuffer.append(TEXT_20); + stringBuffer.append(TEXT_15); stringBuffer.append(label.getVisualID()); - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_16); stringBuffer.append(label.getEditPartClassName()); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_17); } } @@ -111,27 +103,27 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext();) { GenLink link = (GenLink) links.next(); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_18); stringBuffer.append(link.getVisualID()); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_19); stringBuffer.append(link.getEditPartClassName()); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_20); for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) { GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next(); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_21); stringBuffer.append(linkLabel.getVisualID()); - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_22); stringBuffer.append(linkLabel.getEditPartClassName()); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_23); } } - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_24); importManager.emitSortedImports(); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_25); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ExternalNodeLabelEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ExternalNodeLabelEditPartGenerator.java index 73b0c560e..ba6ab8847 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ExternalNodeLabelEditPartGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/ExternalNodeLabelEditPartGenerator.java @@ -95,9 +95,9 @@ public class ExternalNodeLabelEditPartGenerator protected final String TEXT_78 = ") {" + NL + "\t\t\t(("; protected final String TEXT_79 = ") getManager()).show(initialCharacter);" + NL + "\t\t} else {" + NL + "\t\t\tperformDirectEdit();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performDirectEditRequest("; protected final String TEXT_80 = " request) {" + NL + "\t\tfinal "; - protected final String TEXT_81 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest instanceof "; - protected final String TEXT_82 = ") {" + NL + "\t\t\t\t\t\t\tchar c = (("; - protected final String TEXT_83 = ") theRequest).getInitialCharacter();" + NL + "\t\t\t\t\t\t\tperformDirectEdit(c);" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; + protected final String TEXT_81 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest.getExtendedData().get("; + protected final String TEXT_82 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {" + NL + "\t\t\t\t\t\t\tCharacter initialChar = (Character) theRequest.getExtendedData().get("; + protected final String TEXT_83 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);" + NL + "\t\t\t\t\t\t\tperformDirectEdit(initialChar.charValue());" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; protected final String TEXT_84 = ") && (getEditText().equals(getLabelText()))) {" + NL + "\t\t\t\t\t\t\t"; protected final String TEXT_85 = " editRequest =" + NL + "\t\t\t\t\t\t\t\t("; protected final String TEXT_86 = ") theRequest;" + NL + "\t\t\t\t\t\t\tperformDirectEdit(editRequest.getLocation());" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tperformDirectEdit();" + 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 (InterruptedException e) {" + NL + "\t\t\te.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshLabel();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshFontColor();" + NL + "\t\trefreshUnderline();" + NL + "\t\trefreshStrikeThrough();"; @@ -320,9 +320,9 @@ GenCommonBase genCommonBase = genLabel; stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); stringBuffer.append(TEXT_81); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_82); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_83); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")); stringBuffer.append(TEXT_84); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/LinkLabelEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/LinkLabelEditPartGenerator.java index 7e586731f..332eb450c 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/LinkLabelEditPartGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/LinkLabelEditPartGenerator.java @@ -93,9 +93,9 @@ public class LinkLabelEditPartGenerator protected final String TEXT_76 = ") {" + NL + "\t\t\t(("; protected final String TEXT_77 = ") getManager()).show(initialCharacter);" + NL + "\t\t} else {" + NL + "\t\t\tperformDirectEdit();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performDirectEditRequest("; protected final String TEXT_78 = " request) {" + NL + "\t\tfinal "; - protected final String TEXT_79 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest instanceof "; - protected final String TEXT_80 = ") {" + NL + "\t\t\t\t\t\t\tchar c = (("; - protected final String TEXT_81 = ") theRequest).getInitialCharacter();" + NL + "\t\t\t\t\t\t\tperformDirectEdit(c);" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; + protected final String TEXT_79 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest.getExtendedData().get("; + protected final String TEXT_80 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {" + NL + "\t\t\t\t\t\t\tCharacter initialChar = (Character) theRequest.getExtendedData().get("; + protected final String TEXT_81 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);" + NL + "\t\t\t\t\t\t\tperformDirectEdit(initialChar.charValue());" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; protected final String TEXT_82 = ") && (getEditText().equals(getLabelText()))) {" + NL + "\t\t\t\t\t\t\t"; protected final String TEXT_83 = " editRequest =" + NL + "\t\t\t\t\t\t\t\t("; protected final String TEXT_84 = ") theRequest;" + NL + "\t\t\t\t\t\t\tperformDirectEdit(editRequest.getLocation());" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tperformDirectEdit();" + 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 (InterruptedException e) {" + NL + "\t\t\te.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshLabel();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshFontColor();" + NL + "\t\trefreshUnderline();" + NL + "\t\trefreshStrikeThrough();"; @@ -316,9 +316,9 @@ GenCommonBase genCommonBase = genLabel; stringBuffer.append(TEXT_78); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); stringBuffer.append(TEXT_79); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_80); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_81); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")); stringBuffer.append(TEXT_82); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeLabelEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeLabelEditPartGenerator.java index 4ad5be84e..be6ede2e2 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeLabelEditPartGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeLabelEditPartGenerator.java @@ -95,9 +95,9 @@ public class NodeLabelEditPartGenerator protected final String TEXT_78 = ") {" + NL + "\t\t\t(("; protected final String TEXT_79 = ") getManager()).show(initialCharacter);" + NL + "\t\t} else {" + NL + "\t\t\tperformDirectEdit();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performDirectEditRequest("; protected final String TEXT_80 = " request) {" + NL + "\t\tfinal "; - protected final String TEXT_81 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest instanceof "; - protected final String TEXT_82 = ") {" + NL + "\t\t\t\t\t\t\tchar c = (("; - protected final String TEXT_83 = ") theRequest).getInitialCharacter();" + NL + "\t\t\t\t\t\t\tperformDirectEdit(c);" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; + protected final String TEXT_81 = " theRequest = request;" + NL + "\t\ttry {" + NL + "\t\t\tgetEditingDomain().runExclusive(new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\tif (isActive() && isEditable()) {" + NL + "\t\t\t\t\t\tif (theRequest.getExtendedData().get("; + protected final String TEXT_82 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {" + NL + "\t\t\t\t\t\t\tCharacter initialChar = (Character) theRequest.getExtendedData().get("; + protected final String TEXT_83 = ".REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);" + NL + "\t\t\t\t\t\t\tperformDirectEdit(initialChar.charValue());" + NL + "\t\t\t\t\t\t} else if ((theRequest instanceof "; protected final String TEXT_84 = ") && (getEditText().equals(getLabelText()))) {" + NL + "\t\t\t\t\t\t\t"; protected final String TEXT_85 = " editRequest =" + NL + "\t\t\t\t\t\t\t\t("; protected final String TEXT_86 = ") theRequest;" + NL + "\t\t\t\t\t\t\tperformDirectEdit(editRequest.getLocation());" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tperformDirectEdit();" + 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 (InterruptedException e) {" + NL + "\t\t\te.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshLabel();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshFontColor();" + NL + "\t\trefreshUnderline();" + NL + "\t\trefreshStrikeThrough();"; @@ -359,9 +359,9 @@ GenCommonBase genCommonBase = genLabel; stringBuffer.append(TEXT_80); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); stringBuffer.append(TEXT_81); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_82); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); stringBuffer.append(TEXT_83); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")); stringBuffer.append(TEXT_84); diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java index f87150ef5..677c37fa8 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramCanonicalEditPolicyGenerator.java @@ -133,164 +133,162 @@ public class DiagramCanonicalEditPolicyGenerator { protected final String TEXT_114 = " diagramLinks = existingLinks.iterator(); diagramLinks.hasNext();) {" + NL + "\t\t\t\tEdge nextDiagramLink = (Edge) diagramLinks.next();" + NL + "\t\t\t\t"; protected final String TEXT_115 = " diagramLinkObject = nextDiagramLink.getElement();" + NL + "\t\t\t\t"; protected final String TEXT_116 = " diagramLinkSrc = nextDiagramLink.getSource().getElement();" + NL + "\t\t\t\t"; - protected final String TEXT_117 = " diagramLinkDst = nextDiagramLink.getTarget().getElement();" + NL + "\t\t\t\tint diagramLinkVisualID = getVisualID(nextDiagramLink);" + NL + "\t\t\t\tfor ("; - protected final String TEXT_118 = " modelLinkDescriptors = myLinkDescriptors.iterator(); modelLinkDescriptors.hasNext();) {" + NL + "\t\t\t\t\tLinkDescriptor nextLinkDescriptor = (LinkDescriptor) modelLinkDescriptors.next();" + NL + "\t\t\t\t\tif (diagramLinkObject == nextLinkDescriptor.getLinkElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {" + NL + "\t\t\t\t\t\tdiagramLinks.remove();" + NL + "\t\t\t\t\t\tmodelLinkDescriptors.remove();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tdeleteViews(existingLinks.iterator());" + NL + "\t\t\tcreateConnections(myLinkDescriptors);" + NL + "\t\t} finally {" + NL + "\t\t\tmyLinkDescriptors.clear();" + NL + "\t\t\tmyEObject2ViewMap.clear();" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void collectAllLinks("; - protected final String TEXT_119 = " view) {" + NL + "\t\t"; - protected final String TEXT_120 = " modelElement = view.getElement();" + NL + "\t\tint diagramElementVisualID = getVisualID(view);" + NL + "\t\tswitch (diagramElementVisualID) {"; - protected final String TEXT_121 = NL + "\t\tcase "; - protected final String TEXT_122 = ":"; - protected final String TEXT_123 = " { myEObject2ViewMap.put(modelElement, view);" + NL + "\t\t\tstoreLinks(modelElement, getDiagram());" + NL + "\t\t}" + NL + "\t\tdefault: {" + NL + "\t\t}" + NL + "\t\tfor ("; - protected final String TEXT_124 = " children = view.getChildren().iterator(); children.hasNext();) {" + NL + "\t\t\t"; - protected final String TEXT_125 = " childView = ("; - protected final String TEXT_126 = ") children.next();" + NL + "\t\t\tcollectAllLinks(childView);" + NL + "\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createConnections("; - protected final String TEXT_127 = " linkDescriptors) {" + NL + "\t\tif (linkDescriptors.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tfor ("; - protected final String TEXT_128 = " linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {" + NL + "\t\t\tfinal LinkDescriptor nextLinkDescriptor = (LinkDescriptor) linkDescriptorsIterator.next();" + NL + "\t\t\t"; - protected final String TEXT_129 = " sourceEditPart = getEditPartFor(nextLinkDescriptor.getSource());" + NL + "\t\t\t"; - protected final String TEXT_130 = " targetEditPart = getEditPartFor(nextLinkDescriptor.getDestination());" + NL + "\t\t\tif (sourceEditPart == null || targetEditPart == null) {" + NL + "\t\t\t\tcontinue;" + NL + "\t\t\t}" + NL + "\t\t\tString factoryHint = \"\";" + NL + "\t\t\t"; - protected final String TEXT_131 = ".ConnectionViewDescriptor descriptor = new "; - protected final String TEXT_132 = ".ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), getFactoryHint(nextLinkDescriptor.getSemanticAdapter(), factoryHint), "; - protected final String TEXT_133 = ".APPEND, false, (("; - protected final String TEXT_134 = ") getHost()).getDiagramPreferencesHint());" + NL + "\t\t\t"; - protected final String TEXT_135 = " ccr = new "; - protected final String TEXT_136 = "(descriptor);" + NL + "\t\t\tccr.setType("; - protected final String TEXT_137 = ".REQ_CONNECTION_START);" + NL + "\t\t\tccr.setSourceEditPart(sourceEditPart);" + NL + "\t\t\tsourceEditPart.getCommand(ccr);" + NL + "\t\t\tccr.setTargetEditPart(targetEditPart);" + NL + "\t\t\tccr.setType("; - protected final String TEXT_138 = ".REQ_CONNECTION_END);" + NL + "\t\t\t"; - protected final String TEXT_139 = " cmd = targetEditPart.getCommand(ccr);" + NL + "\t\t\tif (cmd != null && cmd.canExecute()) {" + NL + "\t\t\t\texecuteCommand(cmd);" + NL + "\t\t\t\t"; - protected final String TEXT_140 = " viewAdapter = ("; - protected final String TEXT_141 = ") ccr.getNewObject();" + NL + "\t\t\t\t"; - protected final String TEXT_142 = ".makeImmutable(viewAdapter).execute();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; - protected final String TEXT_143 = " getEditPartFor("; - protected final String TEXT_144 = " modelElement) {" + NL + "\t\t"; - protected final String TEXT_145 = " view = ("; - protected final String TEXT_146 = ") myEObject2ViewMap.get(modelElement);" + NL + "\t\tif (view != null) {" + NL + "\t\t\treturn ("; - protected final String TEXT_147 = ") getHost().getViewer().getEditPartRegistry().get(view);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t"; - protected final String TEXT_148 = NL; - protected final String TEXT_149 = "/**" + NL + " *@generated" + NL + " */" + NL + "private void storeLinks("; - protected final String TEXT_150 = " container, "; - protected final String TEXT_151 = " diagram) {" + NL + "\t"; - protected final String TEXT_152 = " containerMetaclass = container.eClass();" + NL + "\tstoreFeatureModelFacetLinks(container, containerMetaclass, diagram);" + NL + "\tstoreTypeModelFacetLinks(container, containerMetaclass);" + NL + "}" + NL + "\t" + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private void storeTypeModelFacetLinks("; - protected final String TEXT_153 = " container, "; - protected final String TEXT_154 = " containerMetaclass) {\t"; - protected final String TEXT_155 = "\t\t" + NL + "\tif ("; - protected final String TEXT_156 = ".eINSTANCE.get"; - protected final String TEXT_157 = "().isSuperTypeOf(containerMetaclass)) {"; - protected final String TEXT_158 = "\t\t" + NL + "\t\tfor ("; - protected final String TEXT_159 = " values = "; - protected final String TEXT_160 = ".iterator(); values.hasNext();) {" + NL + "\t\t\t"; - protected final String TEXT_161 = " nextValue = (("; - protected final String TEXT_162 = ") values.next());"; - protected final String TEXT_163 = NL + "\t\t"; - protected final String TEXT_164 = " nextValue = ("; - protected final String TEXT_165 = ") "; - protected final String TEXT_166 = ";"; - protected final String TEXT_167 = NL + "\t\tObject structuralFeatureResult = "; - protected final String TEXT_168 = ";" + NL + "\t\tif (structuralFeatureResult instanceof "; - protected final String TEXT_169 = ") {" + NL + "\t\t\t"; - protected final String TEXT_170 = " dst = ("; - protected final String TEXT_171 = ") structuralFeatureResult;"; - protected final String TEXT_172 = NL + "\t\t\tstructuralFeatureResult = "; - protected final String TEXT_173 = ";" + NL + "\t\t\tif (structuralFeatureResult instanceof "; - protected final String TEXT_174 = ") {" + NL + "\t\t\t\t"; - protected final String TEXT_175 = " src = ("; - protected final String TEXT_176 = ") structuralFeatureResult;"; - protected final String TEXT_177 = NL + "\t\t\t"; - protected final String TEXT_178 = " src = container;"; - protected final String TEXT_179 = NL + "\t\t\tint linkVID = "; - protected final String TEXT_180 = ".INSTANCE.getLinkWithClassVisualID(nextValue);" + NL + "\t\t\tif ("; - protected final String TEXT_181 = " == linkVID) {" + NL + "\t\t\t\tmyLinkDescriptors.add(new LinkDescriptor(src, dst, nextValue, linkVID));" + NL + "\t\t\t}"; - protected final String TEXT_182 = NL + "\t\t\t}"; - protected final String TEXT_183 = NL + "\t\t}"; - protected final String TEXT_184 = NL + "\t\t}"; - protected final String TEXT_185 = NL + "\t}"; - protected final String TEXT_186 = NL + "}" + NL + "" + NL + "/**" + NL + " *@generated" + NL + " */" + NL + "private void storeFeatureModelFacetLinks("; - protected final String TEXT_187 = " container, "; - protected final String TEXT_188 = " containerMetaclass, Diagram diagram) {"; - protected final String TEXT_189 = NL; - protected final String TEXT_190 = "\tif ("; - protected final String TEXT_191 = ".eINSTANCE.get"; - protected final String TEXT_192 = "().isSuperTypeOf(containerMetaclass)) {"; - protected final String TEXT_193 = NL + "\t\tfor ("; - protected final String TEXT_194 = " destinations = "; - protected final String TEXT_195 = ".iterator(); destinations.hasNext();) {" + NL + "\t\t\t"; - protected final String TEXT_196 = " nextDestination = ("; - protected final String TEXT_197 = ") destinations.next();"; - protected final String TEXT_198 = NL + "\t\t"; - protected final String TEXT_199 = " nextDestination = ("; - protected final String TEXT_200 = ") "; - protected final String TEXT_201 = ";"; - protected final String TEXT_202 = NL + "\t\tif ("; - protected final String TEXT_203 = " == "; - protected final String TEXT_204 = ".INSTANCE.getNodeVisualID(diagram, nextDestination)) {"; - protected final String TEXT_205 = NL + "\t\tmyLinkDescriptors.add(new LinkDescriptor(container, nextDestination, "; - protected final String TEXT_206 = "."; - protected final String TEXT_207 = ", "; - protected final String TEXT_208 = "));"; - protected final String TEXT_209 = NL + "\t\t"; - protected final String TEXT_210 = " nextNode = ViewService.createNode(diagram, nextDestination, "; - protected final String TEXT_211 = ".VISUAL_ID, "; - protected final String TEXT_212 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\tmyEObject2NodeMap.put(nextDestination, nextNode);" + NL + "\t\tcreate"; - protected final String TEXT_213 = "Children(nextNode, nextDestination);"; - protected final String TEXT_214 = NL; - protected final String TEXT_215 = NL + "\t\t}"; - protected final String TEXT_216 = NL + "\t\t}"; - protected final String TEXT_217 = NL + "\t}"; - protected final String TEXT_218 = NL; - protected final String TEXT_219 = "\tif ("; - protected final String TEXT_220 = ".eINSTANCE.get"; - protected final String TEXT_221 = "().isSuperTypeOf(containerMetaclass)) {"; - protected final String TEXT_222 = NL + "\t\tfor ("; - protected final String TEXT_223 = " destinations = "; - protected final String TEXT_224 = ".iterator(); destinations.hasNext();) {" + NL + "\t\t\t"; - protected final String TEXT_225 = " nextDestination = ("; - protected final String TEXT_226 = ") destinations.next();"; - protected final String TEXT_227 = NL + "\t\t"; - protected final String TEXT_228 = " nextDestination = ("; - protected final String TEXT_229 = ") "; - protected final String TEXT_230 = ";"; - protected final String TEXT_231 = NL + "\t\tif ("; - protected final String TEXT_232 = " == "; - protected final String TEXT_233 = ".INSTANCE.getNodeVisualID(diagram, nextDestination)) {"; - protected final String TEXT_234 = NL + "\t\tmyLinkDescriptors.add(new LinkDescriptor(container, nextDestination, "; - protected final String TEXT_235 = "."; - protected final String TEXT_236 = ", "; - protected final String TEXT_237 = "));"; - protected final String TEXT_238 = NL; - protected final String TEXT_239 = NL + "\t\t}"; - protected final String TEXT_240 = NL + "\t\t}"; - protected final String TEXT_241 = NL + "\t}"; - protected final String TEXT_242 = NL + "}" + NL + "\t"; - protected final String TEXT_243 = NL; - protected final String TEXT_244 = "/**" + NL + " * @generated" + NL + " */" + NL + "private "; - protected final String TEXT_245 = " getDiagram() {" + NL + "\treturn (("; - protected final String TEXT_246 = ") getHost().getModel()).getDiagram();" + NL + "}" + NL; - protected final String TEXT_247 = NL; - protected final String TEXT_248 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_249 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_250 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL; - protected final String TEXT_251 = NL; - protected final String TEXT_252 = "/**" + NL + " * @generated" + NL + " */" + NL + "private class LinkDescriptor {" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; - protected final String TEXT_253 = " mySource;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; - protected final String TEXT_254 = " myDestination;" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; - protected final String TEXT_255 = " myLinkElement;" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate int myVisualID;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; - protected final String TEXT_256 = " mySemanticAdapter;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected LinkDescriptor("; - protected final String TEXT_257 = " source, "; - protected final String TEXT_258 = " destination, "; - protected final String TEXT_259 = " linkElement, int linkVID) {" + NL + "\t\tthis(source, destination, linkVID);" + NL + "\t\tmyLinkElement = linkElement;" + NL + "\t\tmySemanticAdapter = new "; - protected final String TEXT_260 = "(linkElement);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected LinkDescriptor("; - protected final String TEXT_261 = " source, "; - protected final String TEXT_262 = " destination, "; - protected final String TEXT_263 = " elementType, int linkVID) {" + NL + "\t\tthis(source, destination, linkVID);" + NL + "\t\tmyLinkElement = null;" + NL + "\t\tfinal "; - protected final String TEXT_264 = " elementTypeCopy = elementType;" + NL + "\t\tmySemanticAdapter = new "; - protected final String TEXT_265 = "() {" + NL + "\t\t\tpublic Object getAdapter(Class adapter) {" + NL + "\t\t\t\tif ("; - protected final String TEXT_266 = ".class.equals(adapter)) {" + NL + "\t\t\t\t\treturn elementTypeCopy;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate LinkDescriptor("; - protected final String TEXT_267 = " source, "; - protected final String TEXT_268 = " destination, int linkVID) {" + NL + "\t\tmySource = source;" + NL + "\t\tmyDestination = destination;" + NL + "\t\tmyVisualID = linkVID;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; - protected final String TEXT_269 = " getSource() {" + NL + "\t\treturn mySource;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; - protected final String TEXT_270 = " getDestination() {" + NL + "\t\treturn myDestination;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; - protected final String TEXT_271 = " getLinkElement() {" + NL + "\t\treturn myLinkElement;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected int getVisualID() {" + NL + "\t\treturn myVisualID;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; - protected final String TEXT_272 = " getSemanticAdapter() {" + NL + "\t\treturn mySemanticAdapter;" + NL + "\t}" + NL + "}"; - protected final String TEXT_273 = NL + NL + "}"; - protected final String TEXT_274 = NL; + protected final String TEXT_117 = " diagramLinkDst = nextDiagramLink.getTarget().getElement();" + NL + "\t\t\t\tint diagramLinkVisualID = "; + protected final String TEXT_118 = ".getVisualID(nextDiagramLink);" + NL + "\t\t\t\tfor ("; + protected final String TEXT_119 = " modelLinkDescriptors = myLinkDescriptors.iterator(); modelLinkDescriptors.hasNext();) {" + NL + "\t\t\t\t\tLinkDescriptor nextLinkDescriptor = (LinkDescriptor) modelLinkDescriptors.next();" + NL + "\t\t\t\t\tif (diagramLinkObject == nextLinkDescriptor.getLinkElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {" + NL + "\t\t\t\t\t\tdiagramLinks.remove();" + NL + "\t\t\t\t\t\tmodelLinkDescriptors.remove();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tdeleteViews(existingLinks.iterator());" + NL + "\t\t\tcreateConnections(myLinkDescriptors);" + NL + "\t\t} finally {" + NL + "\t\t\tmyLinkDescriptors.clear();" + NL + "\t\t\tmyEObject2ViewMap.clear();" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void collectAllLinks("; + protected final String TEXT_120 = " view) {" + NL + "\t\t"; + protected final String TEXT_121 = " modelElement = view.getElement();" + NL + "\t\tint diagramElementVisualID = "; + protected final String TEXT_122 = ".getVisualID(view);" + NL + "\t\tswitch (diagramElementVisualID) {"; + protected final String TEXT_123 = NL + "\t\tcase "; + protected final String TEXT_124 = ":"; + protected final String TEXT_125 = " { myEObject2ViewMap.put(modelElement, view);" + NL + "\t\t\tstoreLinks(modelElement, getDiagram());" + NL + "\t\t}" + NL + "\t\tdefault: {" + NL + "\t\t}" + NL + "\t\tfor ("; + protected final String TEXT_126 = " children = view.getChildren().iterator(); children.hasNext();) {" + NL + "\t\t\t"; + protected final String TEXT_127 = " childView = ("; + protected final String TEXT_128 = ") children.next();" + NL + "\t\t\tcollectAllLinks(childView);" + NL + "\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createConnections("; + protected final String TEXT_129 = " linkDescriptors) {" + NL + "\t\tif (linkDescriptors.isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tfor ("; + protected final String TEXT_130 = " linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {" + NL + "\t\t\tfinal LinkDescriptor nextLinkDescriptor = (LinkDescriptor) linkDescriptorsIterator.next();" + NL + "\t\t\t"; + protected final String TEXT_131 = " sourceEditPart = getEditPartFor(nextLinkDescriptor.getSource());" + NL + "\t\t\t"; + protected final String TEXT_132 = " targetEditPart = getEditPartFor(nextLinkDescriptor.getDestination());" + NL + "\t\t\tif (sourceEditPart == null || targetEditPart == null) {" + NL + "\t\t\t\tcontinue;" + NL + "\t\t\t}" + NL + "\t\t\t"; + protected final String TEXT_133 = ".ConnectionViewDescriptor descriptor = new "; + protected final String TEXT_134 = ".ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, "; + protected final String TEXT_135 = ".APPEND, false, (("; + protected final String TEXT_136 = ") getHost()).getDiagramPreferencesHint());" + NL + "\t\t\t"; + protected final String TEXT_137 = " ccr = new "; + protected final String TEXT_138 = "(descriptor);" + NL + "\t\t\tccr.setType("; + protected final String TEXT_139 = ".REQ_CONNECTION_START);" + NL + "\t\t\tccr.setSourceEditPart(sourceEditPart);" + NL + "\t\t\tsourceEditPart.getCommand(ccr);" + NL + "\t\t\tccr.setTargetEditPart(targetEditPart);" + NL + "\t\t\tccr.setType("; + protected final String TEXT_140 = ".REQ_CONNECTION_END);" + NL + "\t\t\t"; + protected final String TEXT_141 = " cmd = targetEditPart.getCommand(ccr);" + NL + "\t\t\tif (cmd != null && cmd.canExecute()) {" + NL + "\t\t\t\texecuteCommand(cmd);" + NL + "\t\t\t\t"; + protected final String TEXT_142 = " viewAdapter = ("; + protected final String TEXT_143 = ") ccr.getNewObject();" + NL + "\t\t\t\t"; + protected final String TEXT_144 = ".makeImmutable(viewAdapter).execute();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; + protected final String TEXT_145 = " getEditPartFor("; + protected final String TEXT_146 = " modelElement) {" + NL + "\t\t"; + protected final String TEXT_147 = " view = ("; + protected final String TEXT_148 = ") myEObject2ViewMap.get(modelElement);" + NL + "\t\tif (view != null) {" + NL + "\t\t\treturn ("; + protected final String TEXT_149 = ") getHost().getViewer().getEditPartRegistry().get(view);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t"; + protected final String TEXT_150 = NL; + protected final String TEXT_151 = "/**" + NL + " *@generated" + NL + " */" + NL + "private void storeLinks("; + protected final String TEXT_152 = " container, "; + protected final String TEXT_153 = " diagram) {" + NL + "\t"; + protected final String TEXT_154 = " containerMetaclass = container.eClass();" + NL + "\tstoreFeatureModelFacetLinks(container, containerMetaclass, diagram);" + NL + "\tstoreTypeModelFacetLinks(container, containerMetaclass);" + NL + "}" + NL + "\t" + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private void storeTypeModelFacetLinks("; + protected final String TEXT_155 = " container, "; + protected final String TEXT_156 = " containerMetaclass) {\t"; + protected final String TEXT_157 = "\t\t" + NL + "\tif ("; + protected final String TEXT_158 = ".eINSTANCE.get"; + protected final String TEXT_159 = "().isSuperTypeOf(containerMetaclass)) {"; + protected final String TEXT_160 = "\t\t" + NL + "\t\tfor ("; + protected final String TEXT_161 = " values = "; + protected final String TEXT_162 = ".iterator(); values.hasNext();) {" + NL + "\t\t\t"; + protected final String TEXT_163 = " nextValue = (("; + protected final String TEXT_164 = ") values.next());"; + protected final String TEXT_165 = NL + "\t\t"; + protected final String TEXT_166 = " nextValue = ("; + protected final String TEXT_167 = ") "; + protected final String TEXT_168 = ";"; + protected final String TEXT_169 = NL + "\t\tObject structuralFeatureResult = "; + protected final String TEXT_170 = ";" + NL + "\t\tif (structuralFeatureResult instanceof "; + protected final String TEXT_171 = ") {" + NL + "\t\t\t"; + protected final String TEXT_172 = " dst = ("; + protected final String TEXT_173 = ") structuralFeatureResult;"; + protected final String TEXT_174 = NL + "\t\t\tstructuralFeatureResult = "; + protected final String TEXT_175 = ";" + NL + "\t\t\tif (structuralFeatureResult instanceof "; + protected final String TEXT_176 = ") {" + NL + "\t\t\t\t"; + protected final String TEXT_177 = " src = ("; + protected final String TEXT_178 = ") structuralFeatureResult;"; + protected final String TEXT_179 = NL + "\t\t\t"; + protected final String TEXT_180 = " src = container;"; + protected final String TEXT_181 = NL + "\t\t\tint linkVID = "; + protected final String TEXT_182 = ".INSTANCE.getLinkWithClassVisualID(nextValue);" + NL + "\t\t\tif ("; + protected final String TEXT_183 = " == linkVID) {" + NL + "\t\t\t\tmyLinkDescriptors.add(new LinkDescriptor(src, dst, nextValue, linkVID));" + NL + "\t\t\t}"; + protected final String TEXT_184 = NL + "\t\t\t}"; + protected final String TEXT_185 = NL + "\t\t}"; + protected final String TEXT_186 = NL + "\t\t}"; + protected final String TEXT_187 = NL + "\t}"; + protected final String TEXT_188 = NL + "}" + NL + "" + NL + "/**" + NL + " *@generated" + NL + " */" + NL + "private void storeFeatureModelFacetLinks("; + protected final String TEXT_189 = " container, "; + protected final String TEXT_190 = " containerMetaclass, Diagram diagram) {"; + protected final String TEXT_191 = NL; + protected final String TEXT_192 = "\tif ("; + protected final String TEXT_193 = ".eINSTANCE.get"; + protected final String TEXT_194 = "().isSuperTypeOf(containerMetaclass)) {"; + protected final String TEXT_195 = NL + "\t\tfor ("; + protected final String TEXT_196 = " destinations = "; + protected final String TEXT_197 = ".iterator(); destinations.hasNext();) {" + NL + "\t\t\t"; + protected final String TEXT_198 = " nextDestination = ("; + protected final String TEXT_199 = ") destinations.next();"; + protected final String TEXT_200 = NL + "\t\t"; + protected final String TEXT_201 = " nextDestination = ("; + protected final String TEXT_202 = ") "; + protected final String TEXT_203 = ";"; + protected final String TEXT_204 = NL + "\t\tif ("; + protected final String TEXT_205 = " == "; + protected final String TEXT_206 = ".INSTANCE.getNodeVisualID(diagram, nextDestination)) {"; + protected final String TEXT_207 = NL + "\t\tmyLinkDescriptors.add(new LinkDescriptor(container, nextDestination, "; + protected final String TEXT_208 = "."; + protected final String TEXT_209 = ", "; + protected final String TEXT_210 = "));"; + protected final String TEXT_211 = NL + "\t\t"; + protected final String TEXT_212 = " nextNode = ViewService.createNode(diagram, nextDestination, "; + protected final String TEXT_213 = ".VISUAL_ID, "; + protected final String TEXT_214 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\tmyEObject2NodeMap.put(nextDestination, nextNode);" + NL + "\t\tcreate"; + protected final String TEXT_215 = "Children(nextNode, nextDestination);"; + protected final String TEXT_216 = NL; + protected final String TEXT_217 = NL + "\t\t}"; + protected final String TEXT_218 = NL + "\t\t}"; + protected final String TEXT_219 = NL + "\t}"; + protected final String TEXT_220 = NL; + protected final String TEXT_221 = "\tif ("; + protected final String TEXT_222 = ".eINSTANCE.get"; + protected final String TEXT_223 = "().isSuperTypeOf(containerMetaclass)) {"; + protected final String TEXT_224 = NL + "\t\tfor ("; + protected final String TEXT_225 = " destinations = "; + protected final String TEXT_226 = ".iterator(); destinations.hasNext();) {" + NL + "\t\t\t"; + protected final String TEXT_227 = " nextDestination = ("; + protected final String TEXT_228 = ") destinations.next();"; + protected final String TEXT_229 = NL + "\t\t"; + protected final String TEXT_230 = " nextDestination = ("; + protected final String TEXT_231 = ") "; + protected final String TEXT_232 = ";"; + protected final String TEXT_233 = NL + "\t\tif ("; + protected final String TEXT_234 = " == "; + protected final String TEXT_235 = ".INSTANCE.getNodeVisualID(diagram, nextDestination)) {"; + protected final String TEXT_236 = NL + "\t\tmyLinkDescriptors.add(new LinkDescriptor(container, nextDestination, "; + protected final String TEXT_237 = "."; + protected final String TEXT_238 = ", "; + protected final String TEXT_239 = "));"; + protected final String TEXT_240 = NL; + protected final String TEXT_241 = NL + "\t\t}"; + protected final String TEXT_242 = NL + "\t\t}"; + protected final String TEXT_243 = NL + "\t}"; + protected final String TEXT_244 = NL + "}" + NL + "\t"; + protected final String TEXT_245 = NL; + protected final String TEXT_246 = "/**" + NL + " * @generated" + NL + " */" + NL + "private "; + protected final String TEXT_247 = " getDiagram() {" + NL + "\treturn (("; + protected final String TEXT_248 = ") getHost().getModel()).getDiagram();" + NL + "}" + NL; + protected final String TEXT_249 = NL; + protected final String TEXT_250 = "/**" + NL + " * @generated" + NL + " */" + NL + "private class LinkDescriptor {" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; + protected final String TEXT_251 = " mySource;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; + protected final String TEXT_252 = " myDestination;" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; + protected final String TEXT_253 = " myLinkElement;" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate int myVisualID;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate "; + protected final String TEXT_254 = " mySemanticAdapter;" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected LinkDescriptor("; + protected final String TEXT_255 = " source, "; + protected final String TEXT_256 = " destination, "; + protected final String TEXT_257 = " linkElement, int linkVID) {" + NL + "\t\tthis(source, destination, linkVID);" + NL + "\t\tmyLinkElement = linkElement;" + NL + "\t\tmySemanticAdapter = new "; + protected final String TEXT_258 = "(linkElement);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected LinkDescriptor("; + protected final String TEXT_259 = " source, "; + protected final String TEXT_260 = " destination, "; + protected final String TEXT_261 = " elementType, int linkVID) {" + NL + "\t\tthis(source, destination, linkVID);" + NL + "\t\tmyLinkElement = null;" + NL + "\t\tfinal "; + protected final String TEXT_262 = " elementTypeCopy = elementType;" + NL + "\t\tmySemanticAdapter = new "; + protected final String TEXT_263 = "() {" + NL + "\t\t\tpublic Object getAdapter(Class adapter) {" + NL + "\t\t\t\tif ("; + protected final String TEXT_264 = ".class.equals(adapter)) {" + NL + "\t\t\t\t\treturn elementTypeCopy;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprivate LinkDescriptor("; + protected final String TEXT_265 = " source, "; + protected final String TEXT_266 = " destination, int linkVID) {" + NL + "\t\tmySource = source;" + NL + "\t\tmyDestination = destination;" + NL + "\t\tmyVisualID = linkVID;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; + protected final String TEXT_267 = " getSource() {" + NL + "\t\treturn mySource;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; + protected final String TEXT_268 = " getDestination() {" + NL + "\t\treturn myDestination;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; + protected final String TEXT_269 = " getLinkElement() {" + NL + "\t\treturn myLinkElement;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected int getVisualID() {" + NL + "\t\treturn myVisualID;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + " \t * @generated" + NL + " */" + NL + "\tprotected "; + protected final String TEXT_270 = " getSemanticAdapter() {" + NL + "\t\treturn mySemanticAdapter;" + NL + "\t}" + NL + "}"; + protected final String TEXT_271 = NL + NL + "}"; + protected final String TEXT_272 = NL; protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) { StringBuffer result = new StringBuffer(); @@ -683,12 +681,16 @@ if (!genClass2Phantom.isEmpty()) { stringBuffer.append(TEXT_116); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_117); - stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_118); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); + stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_119); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_120); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_121); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(TEXT_122); for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { GenContainerBase nextContainer = (GenContainerBase) containers.next(); @@ -696,77 +698,76 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. continue; } - stringBuffer.append(TEXT_121); + stringBuffer.append(TEXT_123); stringBuffer.append(nextContainer.getVisualID()); - stringBuffer.append(TEXT_122); + stringBuffer.append(TEXT_124); } - stringBuffer.append(TEXT_123); + stringBuffer.append(TEXT_125); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_124); + stringBuffer.append(TEXT_126); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_125); + stringBuffer.append(TEXT_127); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_126); + stringBuffer.append(TEXT_128); stringBuffer.append(importManager.getImportedName("java.util.Collection")); - stringBuffer.append(TEXT_127); + stringBuffer.append(TEXT_129); stringBuffer.append(importManager.getImportedName("java.util.Iterator")); - stringBuffer.append(TEXT_128); + stringBuffer.append(TEXT_130); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_129); + stringBuffer.append(TEXT_131); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_130); + stringBuffer.append(TEXT_132); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")); - stringBuffer.append(TEXT_131); + stringBuffer.append(TEXT_133); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")); - stringBuffer.append(TEXT_132); + stringBuffer.append(TEXT_134); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_133); + stringBuffer.append(TEXT_135); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart")); - stringBuffer.append(TEXT_134); + stringBuffer.append(TEXT_136); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")); - stringBuffer.append(TEXT_135); + stringBuffer.append(TEXT_137); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")); - stringBuffer.append(TEXT_136); + stringBuffer.append(TEXT_138); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); - stringBuffer.append(TEXT_137); + stringBuffer.append(TEXT_139); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")); - stringBuffer.append(TEXT_138); + stringBuffer.append(TEXT_140); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); - stringBuffer.append(TEXT_139); + stringBuffer.append(TEXT_141); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_140); + stringBuffer.append(TEXT_142); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_141); + stringBuffer.append(TEXT_143); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand")); - stringBuffer.append(TEXT_142); + stringBuffer.append(TEXT_144); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_143); + stringBuffer.append(TEXT_145); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_144); + stringBuffer.append(TEXT_146); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_145); + stringBuffer.append(TEXT_147); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); - stringBuffer.append(TEXT_146); + stringBuffer.append(TEXT_148); stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); - stringBuffer.append(TEXT_147); + stringBuffer.append(TEXT_149); boolean createPhantoms = false; List genLinks = genDiagram.getLinks(); -String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()); - stringBuffer.append(TEXT_148); - stringBuffer.append(TEXT_149); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_150); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_151); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); - stringBuffer.append(TEXT_152); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_152); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_153); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); stringBuffer.append(TEXT_154); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_155); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); + stringBuffer.append(TEXT_156); for (Iterator it = genLinks.iterator(); it.hasNext();) { GenLink nextLink = (GenLink) it.next(); @@ -774,85 +775,85 @@ for (Iterator it = genLinks.iterator(); it.hasNext();) { TypeLinkModelFacet typeLinkModelFacet = (TypeLinkModelFacet) nextLink.getModelFacet(); GenFeature childMetaFeature = typeLinkModelFacet.getChildMetaFeature(); - stringBuffer.append(TEXT_155); - stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName())); - stringBuffer.append(TEXT_156); - stringBuffer.append(childMetaFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_157); - if (childMetaFeature.isListType()) { + stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName())); stringBuffer.append(TEXT_158); - stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(childMetaFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_159); - stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, true, importManager)); + if (childMetaFeature.isListType()) { stringBuffer.append(TEXT_160); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_161); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, true, importManager)); stringBuffer.append(TEXT_162); - } else { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_163); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_164); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + } else { stringBuffer.append(TEXT_165); - stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, true, importManager)); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_166); - } + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_167); - stringBuffer.append(getFeatureValueGetter("nextValue", typeLinkModelFacet.getTargetMetaFeature(), true, importManager)); + stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, true, importManager)); stringBuffer.append(TEXT_168); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + } stringBuffer.append(TEXT_169); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(getFeatureValueGetter("nextValue", typeLinkModelFacet.getTargetMetaFeature(), true, importManager)); stringBuffer.append(TEXT_170); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_171); - if (typeLinkModelFacet.getSourceMetaFeature() != null) { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_172); - stringBuffer.append(getFeatureValueGetter("nextValue", typeLinkModelFacet.getSourceMetaFeature(), true, importManager)); - stringBuffer.append(TEXT_173); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_173); + if (typeLinkModelFacet.getSourceMetaFeature() != null) { stringBuffer.append(TEXT_174); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(getFeatureValueGetter("nextValue", typeLinkModelFacet.getSourceMetaFeature(), true, importManager)); stringBuffer.append(TEXT_175); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_176); - } else { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_177); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_178); - } + } else { stringBuffer.append(TEXT_179); - stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_180); - stringBuffer.append(nextLink.getVisualID()); + } stringBuffer.append(TEXT_181); - if (typeLinkModelFacet.getSourceMetaFeature() != null) { + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_182); - } + stringBuffer.append(nextLink.getVisualID()); stringBuffer.append(TEXT_183); + if (typeLinkModelFacet.getSourceMetaFeature() != null) { + stringBuffer.append(TEXT_184); + } + stringBuffer.append(TEXT_185); if (childMetaFeature.isListType()) { - stringBuffer.append(TEXT_184); + stringBuffer.append(TEXT_186); } - stringBuffer.append(TEXT_185); + stringBuffer.append(TEXT_187); } } - stringBuffer.append(TEXT_186); + stringBuffer.append(TEXT_188); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_187); + stringBuffer.append(TEXT_189); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); - stringBuffer.append(TEXT_188); + stringBuffer.append(TEXT_190); for (int linkIndex = 0; linkIndex < genLinks.size(); linkIndex++) { boolean phantomsOnly = true; - stringBuffer.append(TEXT_189); + stringBuffer.append(TEXT_191); GenLink nextLink = (GenLink) genLinks.get(linkIndex); if (false == nextLink.getModelFacet() instanceof FeatureModelFacet) { @@ -866,70 +867,70 @@ if (phantomsOnly ? (!genFeature.isContains() || phantomNode == null) : (genFeatu continue; } - stringBuffer.append(TEXT_190); - stringBuffer.append(importManager.getImportedName(genFeature.getGenPackage().getQualifiedPackageInterfaceName())); - stringBuffer.append(TEXT_191); - stringBuffer.append(genFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_192); - if (genFeature.isListType()) { + stringBuffer.append(importManager.getImportedName(genFeature.getGenPackage().getQualifiedPackageInterfaceName())); stringBuffer.append(TEXT_193); - stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(genFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_194); - stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); + if (genFeature.isListType()) { stringBuffer.append(TEXT_195); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_196); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); stringBuffer.append(TEXT_197); - } else { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_198); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_199); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + } else { stringBuffer.append(TEXT_200); - stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_201); - } - if (phantomsOnly) { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_202); - stringBuffer.append(phantomNode.getVisualID()); + stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); stringBuffer.append(TEXT_203); - stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_204); } + if (phantomsOnly) { + stringBuffer.append(TEXT_204); + stringBuffer.append(phantomNode.getVisualID()); stringBuffer.append(TEXT_205); - stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_206); - stringBuffer.append(nextLink.getUniqueIdentifier()); + } stringBuffer.append(TEXT_207); - stringBuffer.append(nextLink.getVisualID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); stringBuffer.append(TEXT_208); - if (createPhantoms) { + stringBuffer.append(nextLink.getUniqueIdentifier()); stringBuffer.append(TEXT_209); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); + stringBuffer.append(nextLink.getVisualID()); stringBuffer.append(TEXT_210); - stringBuffer.append(importManager.getImportedName(phantomNode.getEditPartQualifiedClassName())); + if (createPhantoms) { stringBuffer.append(TEXT_211); - stringBuffer.append(pluginActivatorClass); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); stringBuffer.append(TEXT_212); - stringBuffer.append(phantomNode.getUniqueIdentifier()); + stringBuffer.append(importManager.getImportedName(phantomNode.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_213); - } + stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); stringBuffer.append(TEXT_214); - if (phantomsOnly) { + stringBuffer.append(phantomNode.getUniqueIdentifier()); stringBuffer.append(TEXT_215); } - if (genFeature.isListType()) { stringBuffer.append(TEXT_216); - } + if (phantomsOnly) { stringBuffer.append(TEXT_217); + } + if (genFeature.isListType()) { + stringBuffer.append(TEXT_218); + } + stringBuffer.append(TEXT_219); } for (int linkIndex = 0; linkIndex < genLinks.size(); linkIndex++) { boolean phantomsOnly = false; - stringBuffer.append(TEXT_218); + stringBuffer.append(TEXT_220); GenLink nextLink = (GenLink) genLinks.get(linkIndex); if (false == nextLink.getModelFacet() instanceof FeatureModelFacet) { @@ -943,98 +944,96 @@ if (phantomsOnly ? (!genFeature.isContains() || phantomNode == null) : (genFeatu continue; } - stringBuffer.append(TEXT_219); - stringBuffer.append(importManager.getImportedName(genFeature.getGenPackage().getQualifiedPackageInterfaceName())); - stringBuffer.append(TEXT_220); - stringBuffer.append(genFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_221); - if (genFeature.isListType()) { + stringBuffer.append(importManager.getImportedName(genFeature.getGenPackage().getQualifiedPackageInterfaceName())); stringBuffer.append(TEXT_222); - stringBuffer.append(importManager.getImportedName("java.util.Iterator")); + stringBuffer.append(genFeature.getGenClass().getClassifierAccessorName()); stringBuffer.append(TEXT_223); - stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); + if (genFeature.isListType()) { stringBuffer.append(TEXT_224); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("java.util.Iterator")); stringBuffer.append(TEXT_225); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); stringBuffer.append(TEXT_226); - } else { + 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")); + } else { stringBuffer.append(TEXT_229); - stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_230); - } - if (phantomsOnly) { + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_231); - stringBuffer.append(phantomNode.getVisualID()); + stringBuffer.append(getFeatureValueGetter("container", genFeature, true, importManager)); stringBuffer.append(TEXT_232); - stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); - stringBuffer.append(TEXT_233); } + if (phantomsOnly) { + stringBuffer.append(TEXT_233); + stringBuffer.append(phantomNode.getVisualID()); stringBuffer.append(TEXT_234); - stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_235); - stringBuffer.append(nextLink.getUniqueIdentifier()); + } stringBuffer.append(TEXT_236); - stringBuffer.append(nextLink.getVisualID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); stringBuffer.append(TEXT_237); + stringBuffer.append(nextLink.getUniqueIdentifier()); stringBuffer.append(TEXT_238); - if (phantomsOnly) { + stringBuffer.append(nextLink.getVisualID()); stringBuffer.append(TEXT_239); - } - if (genFeature.isListType()) { stringBuffer.append(TEXT_240); - } + if (phantomsOnly) { stringBuffer.append(TEXT_241); - } + } + if (genFeature.isListType()) { stringBuffer.append(TEXT_242); + } stringBuffer.append(TEXT_243); + } stringBuffer.append(TEXT_244); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_245); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_246); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); stringBuffer.append(TEXT_247); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); stringBuffer.append(TEXT_248); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); stringBuffer.append(TEXT_249); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_250); - stringBuffer.append(TEXT_251); // an inner class + stringBuffer.append(TEXT_250); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_251); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_252); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_253); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); stringBuffer.append(TEXT_254); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_255); - stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_256); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_257); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter")); stringBuffer.append(TEXT_258); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_259); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter")); - stringBuffer.append(TEXT_260); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_260); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_261); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_262); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); + stringBuffer.append(TEXT_262); + stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); stringBuffer.append(TEXT_263); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); stringBuffer.append(TEXT_264); - stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_265); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_266); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_267); @@ -1042,16 +1041,12 @@ if (phantomsOnly ? (!genFeature.isContains() || phantomNode == null) : (genFeatu stringBuffer.append(TEXT_268); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); stringBuffer.append(TEXT_269); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_270); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); - stringBuffer.append(TEXT_271); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); - stringBuffer.append(TEXT_272); + stringBuffer.append(TEXT_270); } - stringBuffer.append(TEXT_273); + stringBuffer.append(TEXT_271); importManager.emitSortedImports(); - stringBuffer.append(TEXT_274); + stringBuffer.append(TEXT_272); return stringBuffer.toString(); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelTextViewFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelTextViewFactoryGenerator.java index 9a0538aa1..2511538ae 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelTextViewFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelTextViewFactoryGenerator.java @@ -23,11 +23,8 @@ public class LabelTextViewFactoryGenerator protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; protected final String TEXT_7 = " extends "; protected final String TEXT_8 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {" + NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);"; - protected final String TEXT_9 = NL; - protected final String TEXT_10 = "EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "annotation.setSource(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "view.getEAnnotations().add(annotation);" + NL + "annotation.getDetails().put(\"modelID\", \""; - protected final String TEXT_11 = "\"); //$NON-NLS-1$" + NL + "annotation.getDetails().put(\"visualID\", \""; - protected final String TEXT_12 = "\"); //$NON-NLS-1$" + NL + "\t}" + NL + "}"; - protected final String TEXT_13 = NL; + protected final String TEXT_9 = NL + "\t}" + NL + "}"; + protected final String TEXT_10 = NL; public String generate(Object argument) { @@ -51,8 +48,6 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_5); importManager.markImportLocation(stringBuffer); -importManager.addImport("org.eclipse.emf.ecore.EAnnotation"); -importManager.addImport("org.eclipse.emf.ecore.EcoreFactory"); stringBuffer.append(TEXT_6); stringBuffer.append(genLabel.getNotationViewFactoryClassName()); @@ -63,13 +58,8 @@ importManager.addImport("org.eclipse.emf.ecore.EcoreFactory"); stringBuffer.append(TEXT_8); GenCommonBase genElement = genLabel; stringBuffer.append(TEXT_9); - stringBuffer.append(TEXT_10); - stringBuffer.append(genDiagram.getEditorGen().getModelID()); - stringBuffer.append(TEXT_11); - stringBuffer.append(genElement.getVisualID()); - stringBuffer.append(TEXT_12); importManager.emitSortedImports(); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_10); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelViewFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelViewFactoryGenerator.java index ec74eb40d..872328f2e 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelViewFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelViewFactoryGenerator.java @@ -20,14 +20,11 @@ public class LabelViewFactoryGenerator protected final String TEXT_3 = NL + " */"; protected final String TEXT_4 = NL + "package "; protected final String TEXT_5 = ";" + NL; - protected final String TEXT_6 = NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.emf.ecore.EcoreFactory;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; + protected final String TEXT_6 = NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; protected final String TEXT_8 = " extends AbstractLabelViewFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void decorateView(View containerView, View view, IAdaptable semanticAdapter," + NL + "\t\tString semanticHint, int index, boolean persisted) {" + NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);"; - protected final String TEXT_9 = NL; - protected final String TEXT_10 = "EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "annotation.setSource(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "view.getEAnnotations().add(annotation);" + NL + "annotation.getDetails().put(\"modelID\", \""; - protected final String TEXT_11 = "\"); //$NON-NLS-1$" + NL + "annotation.getDetails().put(\"visualID\", \""; - protected final String TEXT_12 = "\"); //$NON-NLS-1$" + NL + "\t}" + NL + "}"; - protected final String TEXT_13 = NL; + protected final String TEXT_9 = NL + "\t}" + NL + "}"; + protected final String TEXT_10 = NL; public String generate(Object argument) { @@ -54,13 +51,8 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_8); GenCommonBase genElement = genLabel; stringBuffer.append(TEXT_9); - stringBuffer.append(TEXT_10); - stringBuffer.append(genDiagram.getEditorGen().getModelID()); - stringBuffer.append(TEXT_11); - stringBuffer.append(genElement.getVisualID()); - stringBuffer.append(TEXT_12); importManager.emitSortedImports(); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_10); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/MetricProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/MetricProviderGenerator.java index d4728431f..2e65e97ba 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/MetricProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/MetricProviderGenerator.java @@ -81,44 +81,42 @@ public class MetricProviderGenerator protected final String TEXT_62 = ".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_63 = " elementImage;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tElementMetrics(EObject target, Metric[] metrics) {" + NL + "\t\t\tthis.metrics = metrics;" + NL + "\t\t\tassert metrics.length > 0;" + 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("; protected final String TEXT_64 = ".getQualifiedName(viewTarget, true));" + 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("; - protected final String TEXT_65 = ".getQualifiedName(viewTarget.getElement(), true));" + NL + "\t\t\t\t\timageTarget = viewTarget.getElement().eClass();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tint visualID = 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 = "; - protected final String TEXT_66 = ".getQualifiedName(target, true);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = "; - protected final String TEXT_67 = ".getImage(imageTarget);\t\t\t" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\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}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static class Metric implements Comparable {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal MetricDef def;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal Number value;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\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 + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricDef {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal Double lowLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal Double highLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String key;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal org.eclipse.emf.ocl.query.Query expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal EClass ctxClass;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal int semanticID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String name;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String description;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetricDef(String key, String body, EClass context, int semanticID, " + NL + "\t\t\tDouble high, Double low, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.ctxClass = context;" + NL + "\t\t\tthis.expression = org.eclipse.emf.ocl.query.QueryFactory.eINSTANCE.createQuery(body, context);\t\t\t" + NL + "\t\t\tthis.semanticID = semanticID;\t\t\t" + 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 */\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 && semanticID >= 0) { " + NL + "\t\t\t\treturn semanticID == getVisualID((View)eObject);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && ctxClass.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}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static "; - protected final String TEXT_68 = "/*MetricDef*/ getMetricsForTarget(EClass target) {" + NL + "\t\tif(context2MetricsMap == null) {" + NL + "\t\t\tinitializeRegistry();\t\t\t" + NL + "\t\t}" + NL + "\t\treturn ("; - protected final String TEXT_69 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; - protected final String TEXT_70 = " getMetrics() {" + NL + "\t\tif(metricsRegistry == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn metricsRegistry;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;"; - protected final String TEXT_71 = "\t\t" + NL + "\t\tregister(new MetricDef(\""; - protected final String TEXT_72 = "\", \""; - protected final String TEXT_73 = "\", " + NL + "\t\t\t\t\t"; - protected final String TEXT_74 = ", "; - protected final String TEXT_75 = "," + NL + "\t\t\t\t\t"; - protected final String TEXT_76 = "new Double("; - protected final String TEXT_77 = ")"; - protected final String TEXT_78 = "null"; - protected final String TEXT_79 = ",\t\t\t\t\t" + NL + "\t\t\t\t\t"; - protected final String TEXT_80 = "new Double("; - protected final String TEXT_81 = ")"; - protected final String TEXT_82 = "null"; - protected final String TEXT_83 = "," + NL + "\t\t\t\t\t"; - protected final String TEXT_84 = "\""; - protected final String TEXT_85 = "\""; - protected final String TEXT_86 = "null"; - protected final String TEXT_87 = "," + NL + "\t\t\t\t\t"; - protected final String TEXT_88 = "\""; - protected final String TEXT_89 = "\""; - protected final String TEXT_90 = "null"; - protected final String TEXT_91 = "));"; - protected final String TEXT_92 = "\t\t" + NL + "\t}" + NL + "\t" + 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_93 = "();" + NL + "\t\t\tmetricsRegistry = new "; - protected final String TEXT_94 = "();" + NL + "\t\t}" + NL + "\t\t"; - protected final String TEXT_95 = " metrics = ("; - protected final String TEXT_96 = ")context2MetricsMap.get(metric.ctxClass);" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new "; - protected final String TEXT_97 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.ctxClass, metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t}\t" + NL + "\t"; - protected final String TEXT_98 = NL; - protected final String TEXT_99 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_100 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_101 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_102 = NL; + protected final String TEXT_65 = ".getQualifiedName(viewTarget.getElement(), true));" + NL + "\t\t\t\t\timageTarget = viewTarget.getElement().eClass();" + NL + "\t\t\t\t}" + NL + "\t\t\t\tint visualID = "; + protected final String TEXT_66 = ".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 = "; + protected final String TEXT_67 = ".getQualifiedName(target, true);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = "; + protected final String TEXT_68 = ".getImage(imageTarget);\t\t\t" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\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}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static class Metric implements Comparable {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal MetricDef def;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal Number value;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\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 + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricDef {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tfinal Double lowLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal Double highLimit;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String key;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal org.eclipse.emf.ocl.query.Query expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal EClass ctxClass;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal int semanticID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String name;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal String description;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tMetricDef(String key, String body, EClass context, int semanticID, " + NL + "\t\t\tDouble high, Double low, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.ctxClass = context;" + NL + "\t\t\tthis.expression = org.eclipse.emf.ocl.query.QueryFactory.eINSTANCE.createQuery(body, context);\t\t\t" + NL + "\t\t\tthis.semanticID = semanticID;\t\t\t" + 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 */\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 && semanticID >= 0) { " + NL + "\t\t\t\treturn semanticID == "; + protected final String TEXT_69 = ".getVisualID((View)eObject);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && ctxClass.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}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static "; + protected final String TEXT_70 = "/*MetricDef*/ getMetricsForTarget(EClass target) {" + NL + "\t\tif(context2MetricsMap == null) {" + NL + "\t\t\tinitializeRegistry();\t\t\t" + NL + "\t\t}" + NL + "\t\treturn ("; + protected final String TEXT_71 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static "; + protected final String TEXT_72 = " getMetrics() {" + NL + "\t\tif(metricsRegistry == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\treturn metricsRegistry;" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;"; + protected final String TEXT_73 = "\t\t" + NL + "\t\tregister(new MetricDef(\""; + protected final String TEXT_74 = "\", \""; + protected final String TEXT_75 = "\", " + NL + "\t\t\t\t\t"; + protected final String TEXT_76 = ", "; + protected final String TEXT_77 = "," + NL + "\t\t\t\t\t"; + protected final String TEXT_78 = "new Double("; + protected final String TEXT_79 = ")"; + protected final String TEXT_80 = "null"; + protected final String TEXT_81 = ",\t\t\t\t\t" + NL + "\t\t\t\t\t"; + protected final String TEXT_82 = "new Double("; + protected final String TEXT_83 = ")"; + protected final String TEXT_84 = "null"; + protected final String TEXT_85 = "," + NL + "\t\t\t\t\t"; + protected final String TEXT_86 = "\""; + protected final String TEXT_87 = "\""; + protected final String TEXT_88 = "null"; + protected final String TEXT_89 = "," + NL + "\t\t\t\t\t"; + protected final String TEXT_90 = "\""; + protected final String TEXT_91 = "\""; + protected final String TEXT_92 = "null"; + protected final String TEXT_93 = "));"; + protected final String TEXT_94 = "\t\t" + NL + "\t}" + NL + "\t" + 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_95 = "();" + NL + "\t\t\tmetricsRegistry = new "; + protected final String TEXT_96 = "();" + NL + "\t\t}" + NL + "\t\t"; + protected final String TEXT_97 = " metrics = ("; + protected final String TEXT_98 = ")context2MetricsMap.get(metric.ctxClass);" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new "; + protected final String TEXT_99 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.ctxClass, metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t}\t" + NL + "" + NL + "}"; + protected final String TEXT_100 = NL; public String generate(Object argument) { @@ -293,16 +291,20 @@ final String pluginActivatorClass = importManager.getImportedName(genDiagram.get stringBuffer.append(TEXT_64); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil")); stringBuffer.append(TEXT_65); - stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil")); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_66); - stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); + stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil")); stringBuffer.append(TEXT_67); - stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())); stringBuffer.append(TEXT_68); - stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_69); stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_70); + stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(TEXT_71); + stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(TEXT_72); for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator(); it.hasNext();) { GenMetricRule nextMetric = (GenMetricRule)it.next(); @@ -312,69 +314,63 @@ for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator() String body = nextMetric.getRule() != null ? nextMetric.getRule().getBody() : null; int visualID = nextMetric.getTarget() instanceof GenDiagramElementTarget ? ((GenDiagramElementTarget)nextMetric.getTarget()).getElement().getVisualID() : -1; - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_73); stringBuffer.append(nextMetric.getKey()); - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_74); stringBuffer.append(body); - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_75); stringBuffer.append(ctxAccessor); - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_76); stringBuffer.append(visualID); - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_77); if(nextMetric.getLowLimit()!=null){ - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_78); stringBuffer.append(nextMetric.getLowLimit()); - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_79); }else{ - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_80); } - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_81); if(nextMetric.getHighLimit()!=null){ - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_82); stringBuffer.append(nextMetric.getHighLimit()); - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_83); }else{ - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_84); } - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_85); if(nextMetric.getName()!=null){ - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_86); stringBuffer.append(nextMetric.getName()); - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_87); }else{ - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_88); } - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_89); if(nextMetric.getDescription()!=null){ - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_90); stringBuffer.append(nextMetric.getDescription()); - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_91); }else{ - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_92); } - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_93); } - stringBuffer.append(TEXT_92); - stringBuffer.append(importManager.getImportedName("java.util.HashMap")); - stringBuffer.append(TEXT_93); - stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); stringBuffer.append(TEXT_94); - stringBuffer.append(importManager.getImportedName("java.util.List")); + stringBuffer.append(importManager.getImportedName("java.util.HashMap")); stringBuffer.append(TEXT_95); - stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_96); stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); + stringBuffer.append(TEXT_96); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_97); + stringBuffer.append(importManager.getImportedName("java.util.List")); stringBuffer.append(TEXT_98); + stringBuffer.append(importManager.getImportedName("java.util.ArrayList")); stringBuffer.append(TEXT_99); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_100); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_101); importManager.emitSortedImports(); - stringBuffer.append(TEXT_102); + stringBuffer.append(TEXT_100); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/PropertyProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/PropertyProviderGenerator.java index 3a6d10ddf..d2273278d 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/PropertyProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/PropertyProviderGenerator.java @@ -22,12 +22,10 @@ public class PropertyProviderGenerator protected final String TEXT_5 = ";" + NL; protected final String TEXT_6 = NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.properties.GetPropertySourceOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.properties.ICompositePropertySource;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.properties.IPropertiesProvider;" + NL + "import org.eclipse.gmf.runtime.emf.ui.properties.providers.GenericEMFPropertiesProvider;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " extends GenericEMFPropertiesProvider implements IPropertiesProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetPropertySourceOperation) {" + NL + "\t\t\tObject object = ((GetPropertySourceOperation) operation).getObject();" + NL + "\t\t\treturn getSemanticElement(object) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ICompositePropertySource getPropertySource(Object object) {" + NL + "\t\tEObject element = getSemanticElement(object);" + NL + "\t\tif (element != null) {" + NL + "\t\t\treturn super.getPropertySource(element);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject getSemanticElement(Object object) {" + NL + "\t\tView view = null;" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\tview = (View) object;" + NL + "\t\t} else if (object instanceof EditPart) {" + NL + "\t\t\tEditPart editPart = (EditPart) object;" + NL + "\t\t\tif (editPart.getModel() instanceof View) {" + NL + "\t\t\t\tview = (View) editPart.getModel();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (view != null && \""; - protected final String TEXT_9 = "\".equals(getModelID(view))) {" + NL + "\t\t\treturn view.getElement();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t"; - protected final String TEXT_10 = NL; - protected final String TEXT_11 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getModelID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_12 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn (String) annotation.getDetails().get(\"modelID\"); //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_13 = NL; + protected final String TEXT_8 = " extends GenericEMFPropertiesProvider implements IPropertiesProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetPropertySourceOperation) {" + NL + "\t\t\tObject object = ((GetPropertySourceOperation) operation).getObject();" + NL + "\t\t\treturn getSemanticElement(object) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ICompositePropertySource getPropertySource(Object object) {" + NL + "\t\tEObject element = getSemanticElement(object);" + NL + "\t\tif (element != null) {" + NL + "\t\t\treturn super.getPropertySource(element);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject getSemanticElement(Object object) {" + NL + "\t\tView view = null;" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\tview = (View) object;" + NL + "\t\t} else if (object instanceof EditPart) {" + NL + "\t\t\tEditPart editPart = (EditPart) object;" + NL + "\t\t\tif (editPart.getModel() instanceof View) {" + NL + "\t\t\t\tview = (View) editPart.getModel();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (view != null && "; + protected final String TEXT_9 = ".MODEL_ID.equals("; + protected final String TEXT_10 = ".getModelID(view))) {" + NL + "\t\t\treturn view.getElement();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "}"; + protected final String TEXT_11 = NL; public String generate(Object argument) { @@ -53,14 +51,12 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_7); stringBuffer.append(genDiagram.getPropertyProviderClassName()); stringBuffer.append(TEXT_8); - stringBuffer.append(genDiagram.getEditorGen().getModelID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_9); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_10); - stringBuffer.append(TEXT_11); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_12); importManager.emitSortedImports(); - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_11); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ValidationProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ValidationProviderGenerator.java index 9a040a0af..6da179a92 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ValidationProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ValidationProviderGenerator.java @@ -37,31 +37,27 @@ public class ValidationProviderGenerator protected final String TEXT_19 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tpublic static class "; protected final String TEXT_20 = " implements "; protected final String TEXT_21 = " {"; - protected final String TEXT_22 = 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 = getViewSemanticId((View) object);" + NL + "\t\t\t\treturn id != null && semanticCtxIdMap.get(id) == "; + protected final String TEXT_22 = 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_23 = ".class;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}"; protected final String TEXT_24 = 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_25 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic String getViewSemanticId(View view) {" + NL + "\t\tString id = Integer.toString(getVisualID(view));" + NL + "\t\treturn id != null && id.length() > 0 ? id : null; " + NL + "\t}"; - protected final String TEXT_26 = NL; - protected final String TEXT_27 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID(View containerView) {" + NL + "\t\t"; - protected final String TEXT_28 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; - protected final String TEXT_29 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + NL + "\t}\t\t\t" + NL + "\t\t" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final Map semanticCtxIdMap = new HashMap();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {"; - protected final String TEXT_30 = NL + "\t\tsemanticCtxIdMap.put(\""; - protected final String TEXT_31 = "\", "; - protected final String TEXT_32 = ".class); //$NON-NLS-1$"; - protected final String TEXT_33 = NL + "\t}"; - protected final String TEXT_34 = NL; - protected final String TEXT_35 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic "; - protected final String TEXT_36 = " getNotationTraversalStrategy(IBatchValidator validator) {"; - protected final String TEXT_37 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);"; - protected final String TEXT_38 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();"; - protected final String TEXT_39 = NL + "\t}"; - protected final String TEXT_40 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements "; - protected final String TEXT_41 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; - protected final String TEXT_42 = " 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_43 = " traversalRoots," + NL + "\t\t\t\t"; - protected final String TEXT_44 = " 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 = getViewSemanticId((View) nextTarget);" + 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}"; - protected final String TEXT_45 = NL + "}"; - protected final String TEXT_46 = NL; + protected final String TEXT_25 = NL + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final Map semanticCtxIdMap = new HashMap();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {"; + protected final String TEXT_26 = NL + "\t\tsemanticCtxIdMap.put(\""; + protected final String TEXT_27 = "\", "; + protected final String TEXT_28 = ".class); //$NON-NLS-1$"; + protected final String TEXT_29 = NL + "\t}"; + protected final String TEXT_30 = NL; + protected final String TEXT_31 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic "; + protected final String TEXT_32 = " getNotationTraversalStrategy(IBatchValidator validator) {"; + protected final String TEXT_33 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);"; + protected final String TEXT_34 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();"; + protected final String TEXT_35 = NL + "\t}"; + protected final String TEXT_36 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements "; + protected final String TEXT_37 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate "; + protected final String TEXT_38 = " 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_39 = " traversalRoots," + NL + "\t\t\t\t"; + protected final String TEXT_40 = " 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}"; + protected final String TEXT_41 = NL + "}"; + protected final String TEXT_42 = NL; public String generate(Object argument) { @@ -185,53 +181,47 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) { if(usesNotationContextSwitch) { stringBuffer.append(TEXT_25); - stringBuffer.append(TEXT_26); - stringBuffer.append(TEXT_27); - stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); - stringBuffer.append(TEXT_28); - stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); - stringBuffer.append(TEXT_29); for(java.util.Iterator it = viewID2SelectorMap.keySet().iterator(); it.hasNext();) { String viewID = (String)it.next(); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_26); stringBuffer.append(viewID); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_27); stringBuffer.append(viewID2SelectorMap.get(viewID)); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_28); } // end of view ID iteration - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_29); } // end of context map generation //usesNotationContextSwitch - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_30); if(hasNotationModelAudit) { - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_32); if(usesNotationContextSwitch) { - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_33); } else { - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_34); } // end of usesNotationContextSwitch - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_35); } // end of hasNotationModelAudit if(usesNotationContextSwitch) { - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_37); stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy")); - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_38); stringBuffer.append(importManager.getImportedName("java.util.Collection")); - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_39); stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor")); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_40); } // end of usesNotationContextSwitch - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_41); importManager.emitSortedImports(); - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_42); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewFactoryGenerator.java index f54ffbd40..6d4da6c72 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewFactoryGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewFactoryGenerator.java @@ -21,63 +21,66 @@ public class ViewFactoryGenerator protected final String TEXT_3 = NL + " */"; protected final String TEXT_4 = NL + "package "; protected final String TEXT_5 = ";" + NL; - protected final String TEXT_6 = NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.emf.ecore.EcoreFactory;" + NL + "import org.eclipse.gmf.runtime.notation.View;"; - protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; - protected final String TEXT_8 = " extends "; + protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; + protected final String TEXT_7 = " extends "; + protected final String TEXT_8 = NL + "\t"; protected final String TEXT_9 = NL + "\t"; - protected final String TEXT_10 = NL + "\t"; - protected final String TEXT_11 = NL + " "; - protected final String TEXT_12 = " " + NL + "\t"; - protected final String TEXT_13 = NL + "\t"; - protected final String TEXT_14 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; - protected final String TEXT_15 = NL + "\tprotected void decorateView(View view, IAdaptable semanticAdapter, String diagramKind){" + NL + "\t\tsuper.decorateView(view, semanticAdapter, diagramKind);"; - protected final String TEXT_16 = NL + "\tprotected void decorateView(View containerView, View view, IAdaptable semanticAdapter," + NL + "\t\t\tString semanticHint, int index, boolean persisted) {" + NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);"; - protected final String TEXT_17 = NL; - protected final String TEXT_18 = "EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();" + NL + "annotation.setSource(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "view.getEAnnotations().add(annotation);" + NL + "annotation.getDetails().put(\"modelID\", \""; - protected final String TEXT_19 = "\"); //$NON-NLS-1$" + NL + "annotation.getDetails().put(\"visualID\", \""; - protected final String TEXT_20 = "\"); //$NON-NLS-1$"; - protected final String TEXT_21 = NL + "\t\t"; - protected final String TEXT_22 = ".setStructuralFeatureValue(view, "; - protected final String TEXT_23 = ".eINSTANCE.getLineStyle_LineColor()," + NL + "\t\t\t"; - protected final String TEXT_24 = ".colorToInteger("; - protected final String TEXT_25 = "."; - protected final String TEXT_26 = "));"; - protected final String TEXT_27 = NL + "\t\t"; - protected final String TEXT_28 = ".setStructuralFeatureValue(view, "; - protected final String TEXT_29 = ".eINSTANCE.getFillStyle_FillColor()," + NL + "\t\t\t"; - protected final String TEXT_30 = ".colorToInteger("; - protected final String TEXT_31 = "."; - protected final String TEXT_32 = "));"; - protected final String TEXT_33 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, "; - protected final String TEXT_34 = ".VISUAL_ID," + NL + "\t\t\t"; - protected final String TEXT_35 = ".APPEND, true, getPreferencesHint());"; + protected final String TEXT_10 = NL + " "; + protected final String TEXT_11 = " " + NL + "\t"; + protected final String TEXT_12 = NL + "\t"; + protected final String TEXT_13 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_14 = NL + "\tprotected void decorateView(View view, IAdaptable semanticAdapter, String diagramKind){" + NL + "\t\tsuper.decorateView(view, semanticAdapter, diagramKind);"; + protected final String TEXT_15 = NL + "\tprotected void decorateView(View containerView, View view, IAdaptable semanticAdapter," + NL + "\t\t\tString semanticHint, int index, boolean persisted) {" + NL + "\t\tif (semanticHint == null) { "; + protected final String TEXT_16 = NL + "\t\t\tsemanticHint = "; + protected final String TEXT_17 = ".VISUAL_ID;" + NL + "\t\t\tview.setType(semanticHint);" + NL + "\t\t}"; + protected final String TEXT_18 = NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);" + NL + "\t\tif (!"; + protected final String TEXT_19 = ".MODEL_ID.equals("; + protected final String TEXT_20 = ".getModelID(containerView))) {" + NL + "\t\t\t"; + protected final String TEXT_21 = " shortcutAnnotation = "; + protected final String TEXT_22 = ".eINSTANCE.createEAnnotation();" + NL + "\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", "; + protected final String TEXT_23 = ".MODEL_ID);" + NL + "\t\t}"; + protected final String TEXT_24 = NL + "\t\t"; + protected final String TEXT_25 = ".setStructuralFeatureValue(view, "; + protected final String TEXT_26 = ".eINSTANCE.getLineStyle_LineColor()," + NL + "\t\t\t"; + protected final String TEXT_27 = ".colorToInteger("; + protected final String TEXT_28 = "."; + protected final String TEXT_29 = "));"; + protected final String TEXT_30 = NL + "\t\t"; + protected final String TEXT_31 = ".setStructuralFeatureValue(view, "; + protected final String TEXT_32 = ".eINSTANCE.getFillStyle_FillColor()," + NL + "\t\t\t"; + protected final String TEXT_33 = ".colorToInteger("; + protected final String TEXT_34 = "."; + protected final String TEXT_35 = "));"; protected final String TEXT_36 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, "; protected final String TEXT_37 = ".VISUAL_ID," + NL + "\t\t\t"; protected final String TEXT_38 = ".APPEND, true, getPreferencesHint());"; protected final String TEXT_39 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, "; protected final String TEXT_40 = ".VISUAL_ID," + NL + "\t\t\t"; protected final String TEXT_41 = ".APPEND, true, getPreferencesHint());"; - protected final String TEXT_42 = NL + "\t}"; - protected final String TEXT_43 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; - protected final String TEXT_44 = " createStyles(View view) {" + NL + "\t\t"; - protected final String TEXT_45 = " styles = super.createStyles(view);" + NL + "\t\tstyles.add("; - protected final String TEXT_46 = ".eINSTANCE.createShapeStyle());" + NL + "\t\treturn styles;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; - protected final String TEXT_47 = " createLayoutConstraint() {" + NL + "\t\treturn "; - protected final String TEXT_48 = ".eINSTANCE.createBounds();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void initializeFromPreferences(View view) {" + NL + "\t\tsuper.initializeFromPreferences(view);" + NL + "" + NL + "\t\t"; - protected final String TEXT_49 = " store = ("; - protected final String TEXT_50 = ") getPreferencesHint().getPreferenceStore();" + NL + "" + NL + "\t\t// fill color" + NL + "\t\t"; - protected final String TEXT_51 = " fillRGB = "; - protected final String TEXT_52 = ".getColor(store, "; - protected final String TEXT_53 = ".PREF_FILL_COLOR);" + NL + "\t\t"; - protected final String TEXT_54 = ".setStructuralFeatureValue(view, "; - protected final String TEXT_55 = ".eINSTANCE.getFillStyle_FillColor(), "; - protected final String TEXT_56 = ".RGBToInteger(fillRGB));" + NL + "\t}"; - protected final String TEXT_57 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; - protected final String TEXT_58 = " getMeasurementUnit() {" + NL + "\t\treturn "; - protected final String TEXT_59 = "."; - protected final String TEXT_60 = "_LITERAL;" + NL + "\t}"; - protected final String TEXT_61 = NL + "}"; - protected final String TEXT_62 = NL; + protected final String TEXT_42 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, "; + protected final String TEXT_43 = ".VISUAL_ID," + NL + "\t\t\t"; + protected final String TEXT_44 = ".APPEND, true, getPreferencesHint());"; + protected final String TEXT_45 = NL + "\t}"; + protected final String TEXT_46 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_47 = " createStyles(View view) {" + NL + "\t\t"; + protected final String TEXT_48 = " styles = super.createStyles(view);" + NL + "\t\tstyles.add("; + protected final String TEXT_49 = ".eINSTANCE.createShapeStyle());" + NL + "\t\treturn styles;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_50 = " createLayoutConstraint() {" + NL + "\t\treturn "; + protected final String TEXT_51 = ".eINSTANCE.createBounds();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void initializeFromPreferences(View view) {" + NL + "\t\tsuper.initializeFromPreferences(view);" + NL + "" + NL + "\t\t"; + protected final String TEXT_52 = " store = ("; + protected final String TEXT_53 = ") getPreferencesHint().getPreferenceStore();" + NL + "" + NL + "\t\t// fill color" + NL + "\t\t"; + protected final String TEXT_54 = " fillRGB = "; + protected final String TEXT_55 = ".getColor(store, "; + protected final String TEXT_56 = ".PREF_FILL_COLOR);" + NL + "\t\t"; + protected final String TEXT_57 = ".setStructuralFeatureValue(view, "; + protected final String TEXT_58 = ".eINSTANCE.getFillStyle_FillColor(), "; + protected final String TEXT_59 = ".RGBToInteger(fillRGB));" + NL + "\t}"; + protected final String TEXT_60 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_61 = " getMeasurementUnit() {" + NL + "\t\treturn "; + protected final String TEXT_62 = "."; + protected final String TEXT_63 = "_LITERAL;" + NL + "\t}"; + protected final String TEXT_64 = NL + "}"; + protected final String TEXT_65 = NL; public String generate(Object argument) { @@ -97,9 +100,13 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(genDiagram.getNotationViewFactoriesPackageName()); stringBuffer.append(TEXT_5); ImportUtil importManager = new ImportUtil(genDiagram.getNotationViewFactoriesPackageName()); - stringBuffer.append(TEXT_6); - importManager.markImportLocation(stringBuffer); - + +importManager.addImport("org.eclipse.core.runtime.IAdaptable"); +importManager.addImport("org.eclipse.gmf.runtime.notation.View"); + +importManager.markImportLocation(stringBuffer); + + boolean isLink = genElement instanceof GenLink; boolean isDiagram = genElement instanceof GenDiagram; boolean isCompartment = genElement instanceof GenCompartment; @@ -107,73 +114,82 @@ boolean isNode = !isLink && !isDiagram && !isCompartment; boolean isLeaf = genElement instanceof GenNode && ((GenNode) genElement).isListContainerEntry(); boolean isFlowLayout = isCompartment && !((GenCompartment) genElement).getNode().isListLayout(); - stringBuffer.append(TEXT_7); + stringBuffer.append(TEXT_6); stringBuffer.append(genElement.getNotationViewFactoryClassName()); - stringBuffer.append(TEXT_8); + stringBuffer.append(TEXT_7); if (isLink) { - stringBuffer.append(TEXT_9); + stringBuffer.append(TEXT_8); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory")); } else if (isLeaf) { - stringBuffer.append(TEXT_10); + stringBuffer.append(TEXT_9); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory")); } else if (isCompartment) { - stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_10); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory")); } else if (isDiagram) { - stringBuffer.append(TEXT_12); + stringBuffer.append(TEXT_11); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory")); } else { - stringBuffer.append(TEXT_13); + stringBuffer.append(TEXT_12); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory")); } - stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_13); if (isDiagram) { - stringBuffer.append(TEXT_15); + stringBuffer.append(TEXT_14); } else { + stringBuffer.append(TEXT_15); + /* [++] importmant for the create shortcut functionality*/ stringBuffer.append(TEXT_16); - -} - + stringBuffer.append(genElement.getEditPartQualifiedClassName()); stringBuffer.append(TEXT_17); + /* [--] importmant for the create shortcut functionality*/ stringBuffer.append(TEXT_18); - stringBuffer.append(genDiagram.getEditorGen().getModelID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_19); - stringBuffer.append(genElement.getVisualID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); stringBuffer.append(TEXT_20); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); + stringBuffer.append(TEXT_21); + stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory")); + stringBuffer.append(TEXT_22); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); + stringBuffer.append(TEXT_23); +} + ColorAttributes colorAttrs = genElement.getViewmap() != null ? (ColorAttributes) genElement.getViewmap().find(ColorAttributes.class) : null; if (colorAttrs != null && colorAttrs.getForegroundColor() != null && colorAttrs.getForegroundColor().trim().length() > 0) { - stringBuffer.append(TEXT_21); + stringBuffer.append(TEXT_24); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_22); + stringBuffer.append(TEXT_25); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); - stringBuffer.append(TEXT_23); + stringBuffer.append(TEXT_26); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities")); - stringBuffer.append(TEXT_24); + stringBuffer.append(TEXT_27); stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants")); - stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_28); stringBuffer.append(colorAttrs.getForegroundColor()); - stringBuffer.append(TEXT_26); + stringBuffer.append(TEXT_29); } if (isNode) { GenNode genNode = (GenNode) genElement; if (colorAttrs != null && colorAttrs.getBackgroundColor() != null && colorAttrs.getBackgroundColor().trim().length() > 0) { - stringBuffer.append(TEXT_27); + stringBuffer.append(TEXT_30); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_28); + stringBuffer.append(TEXT_31); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); - stringBuffer.append(TEXT_29); + stringBuffer.append(TEXT_32); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities")); - stringBuffer.append(TEXT_30); + stringBuffer.append(TEXT_33); stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants")); - stringBuffer.append(TEXT_31); + stringBuffer.append(TEXT_34); stringBuffer.append(colorAttrs.getBackgroundColor()); - stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_35); } if (!isLeaf) { @@ -181,11 +197,11 @@ if (isNode) { for (int j = 0; j < labels.size(); j++) { GenNodeLabel label = (GenNodeLabel) labels.get(j); - stringBuffer.append(TEXT_33); + stringBuffer.append(TEXT_36); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_34); + stringBuffer.append(TEXT_37); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_35); + stringBuffer.append(TEXT_38); } } @@ -193,11 +209,11 @@ if (isNode) { for (int j = 0; j < genChildContainers.size(); j++) { GenCompartment genChildContainer = (GenCompartment) genChildContainers.get(j); - stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_39); stringBuffer.append(importManager.getImportedName(genChildContainer.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_37); + stringBuffer.append(TEXT_40); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_38); + stringBuffer.append(TEXT_41); } } else if (isLink) { @@ -206,57 +222,57 @@ if (isNode) { for (int j = 0; j < labels.size(); j++) { GenLinkLabel label = (GenLinkLabel) labels.get(j); - stringBuffer.append(TEXT_39); + stringBuffer.append(TEXT_42); stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); - stringBuffer.append(TEXT_40); + stringBuffer.append(TEXT_43); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_41); + stringBuffer.append(TEXT_44); } } - stringBuffer.append(TEXT_42); + stringBuffer.append(TEXT_45); if (isFlowLayout) { - stringBuffer.append(TEXT_43); + stringBuffer.append(TEXT_46); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_44); + stringBuffer.append(TEXT_47); stringBuffer.append(importManager.getImportedName("java.util.List")); - stringBuffer.append(TEXT_45); + stringBuffer.append(TEXT_48); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); - stringBuffer.append(TEXT_46); + stringBuffer.append(TEXT_49); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LayoutConstraint")); - stringBuffer.append(TEXT_47); + stringBuffer.append(TEXT_50); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); - stringBuffer.append(TEXT_48); + stringBuffer.append(TEXT_51); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.IPreferenceStore")); - stringBuffer.append(TEXT_49); + stringBuffer.append(TEXT_52); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.IPreferenceStore")); - stringBuffer.append(TEXT_50); + stringBuffer.append(TEXT_53); stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.RGB")); - stringBuffer.append(TEXT_51); + stringBuffer.append(TEXT_54); stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.PreferenceConverter")); - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_55); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants")); - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_56); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")); - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_57); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_58); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities")); - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_59); } if (isDiagram && genDiagram.getUnits() != null && genDiagram.getUnits().trim().length() > 0) { - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_60); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.MeasurementUnit")); - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_61); stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.MeasurementUnit")); - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_62); stringBuffer.append(genDiagram.getUnits().toUpperCase()); - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_63); } - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_64); importManager.emitSortedImports(); - stringBuffer.append(TEXT_62); + stringBuffer.append(TEXT_65); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java index a42566c03..c2864b33e 100644 --- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java +++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java @@ -25,8 +25,8 @@ public class ViewProviderGenerator protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; protected final String TEXT_8 = " extends AbstractViewProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {"; protected final String TEXT_9 = NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);"; - protected final String TEXT_10 = NL + "\t\tif (\""; - protected final String TEXT_11 = "\".equals(diagramKind)"; + protected final String TEXT_10 = NL + "\t\tif ("; + protected final String TEXT_11 = ".MODEL_ID.equals(diagramKind)"; protected final String TEXT_12 = NL + "\t\t\t\t&& "; protected final String TEXT_13 = ".INSTANCE.getDiagramVisualID(semanticElement) != -1"; protected final String TEXT_14 = NL + "\t\t\t\t) {" + NL + "\t\t\treturn "; @@ -90,7 +90,7 @@ if (copyrightText != null && copyrightText.trim().length() > 0) { stringBuffer.append(TEXT_9); } stringBuffer.append(TEXT_10); - stringBuffer.append(genDiagram.getEditorGen().getModelID()); + stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())); stringBuffer.append(TEXT_11); if (genDiagram.getDomainDiagramElement() != null) { stringBuffer.append(TEXT_12); diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet index 3be33a3d8..8e07bd3f3 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/CreateShortcutAction.javajet @@ -5,31 +5,33 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; %> <%@ include file="../copyright4java.jetinc"%> -<%importManager.emitPackageStatement(stringBuffer);%> +<%importManager.emitPackageStatement(stringBuffer); -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.OperationHistoryFactory; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -<%importManager.markImportLocation(stringBuffer);%> +importManager.getImportedName("org.eclipse.core.commands.ExecutionException"); +importManager.getImportedName("org.eclipse.core.commands.operations.OperationHistoryFactory"); +importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"); +importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor"); +importManager.getImportedName("org.eclipse.core.runtime.NullProgressMonitor"); +importManager.getImportedName("org.eclipse.emf.common.util.URI"); +importManager.getImportedName("org.eclipse.emf.common.util.WrappedException"); +importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"); +importManager.getImportedName("org.eclipse.emf.ecore.EObject"); +importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory"); +importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CommandResult"); +importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand"); +importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"); +importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter"); +importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"); +importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"); +importManager.getImportedName("org.eclipse.jface.action.IAction"); +importManager.getImportedName("org.eclipse.jface.viewers.ISelection"); +importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"); +importManager.getImportedName("org.eclipse.jface.window.Window"); +importManager.getImportedName("org.eclipse.swt.widgets.Shell"); +importManager.getImportedName("org.eclipse.ui.IObjectActionDelegate"); +importManager.getImportedName("org.eclipse.ui.IWorkbenchPart"); + +importManager.markImportLocation(stringBuffer);%> /** * @generated @@ -75,22 +77,23 @@ public class <%=genDiagram.getCreateShortcutActionClassName()%> implements IObje if (selectedElement == null) { return; } - CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(selectedElement), <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.DIAGRAM_PREFERENCES_HINT); + CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(selectedElement), Node.class, null, <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.DIAGRAM_PREFERENCES_HINT); CreateCommand command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view) { protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { CommandResult result = super.doExecuteWithResult(monitor, info); View view = (View) ((IAdaptable) result.getReturnValue()).getAdapter(View.class); - if (view != null) { - EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation(); - annotation.setSource("Shortcut"); //$NON-NLS-1$ - view.getEAnnotations().add(annotation); + if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$ +<%/* Shortcut was created on the diagram with the same modelID */%> + EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); + shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ + shortcutAnnotation.getDetails().put("modelID", <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID); //$NON-NLS-1$ + view.getEAnnotations().add(shortcutAnnotation); } return result; } - }; - try { + }; try { OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null); } catch (ExecutionException e) { <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.getInstance().logError("Unable to create shortcut", e); //$NON-NLS-1$ diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/CreationWizardPage.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/CreationWizardPage.javajet index 3be8f3fc4..8e04588d9 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/CreationWizardPage.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/CreationWizardPage.javajet @@ -60,7 +60,7 @@ public class <%=genDiagram.getCreationWizardPageClassName()%> extends EditorWiza * @generated */ protected String getDiagramKind() { - return "<%=editorGen.getModelID()%>"; //$NON-NLS-1$ + return <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID; } <%if (!editorGen.isSameFileForDiagramAndModel()) {%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/InitDiagramFileAction.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/InitDiagramFileAction.javajet index 9c49b59c8..60ea299fb 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/InitDiagramFileAction.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/InitDiagramFileAction.javajet @@ -98,7 +98,7 @@ public class <%=genDiagram.getInitDiagramFileActionClassName()%> implements IObj } wizard.setDialogSettings(initDiagramFileSettings); wizard.setForcePreviousAndNextButtons(false); - wizard.setWindowTitle("Initialize new <%=editorGen.getModelID()%> diagram file"); + wizard.setWindowTitle("Initialize new " + <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID + " diagram file"); WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard); dialog.create(); diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet index 0801c0eae..182397a92 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet @@ -8,7 +8,6 @@ final boolean isSynchronizedDiagram = true; final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; final GenEditorGenerator editorGen = genDiagram.getEditorGen(); -final String modelID = editorGen.getModelID(); final String pluginActivatorClass = importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName()); %> <%@ include file="../copyright4java.jetinc"%> @@ -93,7 +92,7 @@ public class <%=genDiagram.getNewDiagramFileWizardClassName()%> extends Wizard { myFileCreationPage = new WizardNewFileCreationPage("Initialize new Ecore diagram file", mySelection); myFileCreationPage.setFileName(mySelectedModelFile.getProjectRelativePath().removeFileExtension().addFileExtension("<%=editorGen.getDiagramFileExtension()%>").lastSegment()); myFileCreationPage.setTitle("Diagram file"); - myFileCreationPage.setDescription("Create new diagram and initialize it using specified <%=modelID%> model content"); + myFileCreationPage.setDescription("Create new diagram and initialize it using specified " + <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID + " model content"); addPage(myFileCreationPage); } @@ -127,7 +126,7 @@ public class <%=genDiagram.getNewDiagramFileWizardClassName()%> extends Wizard { if (diagramVID != <%=genDiagram.getVisualID()%>) { return CommandResult.newErrorCommandResult("Incorrect model object stored as a root resource object"); //$NON-NLS-1$ } - Diagram diagram = ViewService.createDiagram(diagramModelObject, "<%=modelID%>", <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT); + Diagram diagram = ViewService.createDiagram(diagramModelObject, <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT); diagramResource.getContents().add(diagram); <%if (editorGen.isSameFileForDiagramAndModel()) {%> diagramResource.getContents().add(diagram.getElement()); diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/VisualIDRegistry.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/VisualIDRegistry.javajet index 8023cdc46..80dbd196c 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/VisualIDRegistry.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/editor/VisualIDRegistry.javajet @@ -28,7 +28,44 @@ importManager.markImportLocation(stringBuffer); */ public class <%=genDiagram.getVisualIDRegistryClassName()%> { + /** + * @generated + */ public static final <%=genDiagram.getVisualIDRegistryClassName()%> INSTANCE = new <%=genDiagram.getVisualIDRegistryClassName()%>(); + + /** + * @generated + */ + public static int getVisualID(View view) { + if (view instanceof Diagram) { + if (<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(view.getType())) { + return <%=genDiagram.getVisualID()%>; + } else { + return -1; + } + } + try { + return Integer.parseInt(view.getType()); + } catch (NumberFormatException e) { + <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.getInstance().logError("Unable to parse view type as a visualID number: " + view.getType(), e); + } + return -1; + } + + /** + * @generated + */ + public static String getModelID(View view) { + View diagram = view.getDiagram(); + while (view != diagram) { + <%=importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")%> annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ + if (annotation != null) { + return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ + } + view = (View) view.eContainer(); + } + return diagram.getType(); + } /** * @generated @@ -73,7 +110,7 @@ if (genDiagram.getDomainDiagramElement() != null) { */ public int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) { String containerModelID = getModelID(containerView); - if (!"<%=modelID%>".equals(containerModelID) + if (!<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(containerModelID) <% for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext();) { String nextDomainModelName = (String) it.next(); @@ -89,7 +126,7 @@ for (Iterator it = genDiagram.getShortcutsProvidedFor().iterator(); it.hasNext() return -1; } int containerVisualID; - if ("<%=modelID%>".equals(containerModelID)) { + if (<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(containerModelID)) { containerVisualID = getVisualID(containerView); } else { if (containerView instanceof Diagram) { @@ -293,10 +330,6 @@ for (int i = 0; i < genLinks.size(); i++) { } %> -<%@ include file="getModelID.jetinc" %> - -<%@ include file="getVisualID.jetinc" %> - /** * @generated */ diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/getModelID.jetinc b/plugins/org.eclipse.gmf.codegen/templates/editor/getModelID.jetinc deleted file mode 100644 index 1ccaef4aa..000000000 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/getModelID.jetinc +++ /dev/null @@ -1,10 +0,0 @@ - /** - * @generated - */ - private String getModelID(View containerView) { - <%=importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")%> annotation = containerView.getEAnnotation("ViewIdentifier"); //$NON-NLS-1$ - if (annotation == null) { - return null; - } - return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ - }
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/getVisualID.jetinc b/plugins/org.eclipse.gmf.codegen/templates/editor/getVisualID.jetinc deleted file mode 100644 index 3d64473cd..000000000 --- a/plugins/org.eclipse.gmf.codegen/templates/editor/getVisualID.jetinc +++ /dev/null @@ -1,19 +0,0 @@ - /** - * @generated - */ - private static int getVisualID(View containerView) { - <%=importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")%> annotation = containerView.getEAnnotation("ViewIdentifier"); //$NON-NLS-1$ - if (annotation == null) { - return -1; - } - String visualID = (String) annotation.getDetails().get("visualID"); //$NON-NLS-1$ - if (visualID == null) { - return -1; - } - try { - return Integer.parseInt(visualID); - } catch (NumberFormatException e) { - <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.getInstance().logError("Unable to parse \"visualID\" annotation: " + visualID, e); - } - return -1; - }
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/DiagramEditPart.javajet b/plugins/org.eclipse.gmf.codegen/templates/parts/DiagramEditPart.javajet index 752d9b345..26ab43012 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/parts/DiagramEditPart.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/parts/DiagramEditPart.javajet @@ -20,6 +20,11 @@ public class <%=genDiagram.getEditPartClassName()%> extends DiagramEditPart { /** * @generated */ + public static String MODEL_ID = "<%=genDiagram.getEditorGen().getModelID()%>"; + + /** + * @generated + */ public <%=genDiagram.getEditPartClassName()%>(View view) { super(view); } diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet b/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet index 8ddd16768..69868c592 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/parts/EditPartFactory.javajet @@ -11,7 +11,10 @@ package <%=genDiagram.getEditPartsPackageName()%>; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; import org.eclipse.gmf.runtime.notation.View; -<%importManager.markImportLocation(stringBuffer);%> +<% +importManager.markImportLocation(stringBuffer); +final String visualIDRegistryClassName = importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()); +%> /** * @generated @@ -23,21 +26,17 @@ public class <%=genDiagram.getEditPartFactoryClassName()%> implements EditPartFa */ public static final String EXTERNAL_NODE_LABELS_LAYER = "External Node Labels"; -<%@ include file="../editor/getModelID.jetinc" %> - -<%@ include file="../editor/getVisualID.jetinc" %> - /** * @generated */ public EditPart createEditPart(EditPart context, Object model) { if (model instanceof View) { View view = (View) model; - if (!"<%=modelID%>".equals(getModelID(view))) { + if (!<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(<%=visualIDRegistryClassName%>.getModelID(view))) { return null; } - int viewVisualID = getVisualID(view); + int viewVisualID = <%=visualIDRegistryClassName%>.getVisualID(view); switch (viewVisualID) { <% for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/textAware.jetinc b/plugins/org.eclipse.gmf.codegen/templates/parts/textAware.jetinc index 89f847658..77cf6abc3 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/parts/textAware.jetinc +++ b/plugins/org.eclipse.gmf.codegen/templates/parts/textAware.jetinc @@ -183,9 +183,9 @@ public void run() { if (isActive() && isEditable()) { - if (theRequest instanceof <%=importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")%>) { - char c = ((<%=importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.internal.requests.DirectEditRequestWrapper")%>) theRequest).getInitialCharacter(); - performDirectEdit(c); + if (theRequest.getExtendedData().get(<%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")%>.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(<%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")%>.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof <%=importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")%>) && (getEditText().equals(getLabelText()))) { <%=importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")%> editRequest = (<%=importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest")%>) theRequest; diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/LabelTextViewFactory.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/LabelTextViewFactory.javajet index a9efa90c2..e7e35ec64 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/LabelTextViewFactory.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/LabelTextViewFactory.javajet @@ -12,8 +12,6 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.gmf.runtime.notation.View; <% importManager.markImportLocation(stringBuffer); -importManager.addImport("org.eclipse.emf.ecore.EAnnotation"); -importManager.addImport("org.eclipse.emf.ecore.EcoreFactory"); %> /** @@ -29,7 +27,6 @@ public class <%=genLabel.getNotationViewFactoryClassName()%> extends <%=genLabel protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); <%GenCommonBase genElement = genLabel;%> -<%@ include file="createVIDAnnotation.jetinc"%> } } <%importManager.emitSortedImports();%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/LabelViewFactory.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/LabelViewFactory.javajet index 3bb5de0d2..9b74f92d1 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/LabelViewFactory.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/LabelViewFactory.javajet @@ -7,8 +7,6 @@ package <%=genDiagram.getNotationViewFactoriesPackageName()%>; <%ImportUtil importManager = new ImportUtil(genDiagram.getNotationViewFactoriesPackageName());%> import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; import org.eclipse.gmf.runtime.notation.View; <%importManager.markImportLocation(stringBuffer);%> @@ -25,7 +23,6 @@ public class <%=genLabel.getNotationViewFactoryClassName()%> extends AbstractLab String semanticHint, int index, boolean persisted) { super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); <%GenCommonBase genElement = genLabel;%> -<%@ include file="createVIDAnnotation.jetinc"%> } } <%importManager.emitSortedImports();%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/MetricProvider.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/MetricProvider.javajet index 47747fece..eccfef13c 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/MetricProvider.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/MetricProvider.javajet @@ -422,7 +422,7 @@ public class <%=genDiagram.getMetricProviderClassName()%> extends <%=importManag .append(<%=importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil")%>.getQualifiedName(viewTarget.getElement(), true)); imageTarget = viewTarget.getElement().eClass(); } - int visualID = getVisualID(viewTarget); + int visualID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getVisualID(viewTarget); notationQNameBuf.append('[').append(visualID < 0 ? Integer.toString(System.identityHashCode(viewTarget)) : Integer.toString(visualID)).append(']'); this.targetElementQName = notationQNameBuf.toString(); @@ -544,7 +544,7 @@ public class <%=genDiagram.getMetricProviderClassName()%> extends <%=importManag */ boolean appliesTo(EObject eObject) { if(eObject instanceof View && semanticID >= 0) { - return semanticID == getVisualID((View)eObject); + return semanticID == <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getVisualID((View)eObject); } return eObject != null && ctxClass.isSuperTypeOf(eObject.eClass()); } @@ -622,7 +622,5 @@ for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator() metricsRegistry.add(metric); metrics.add(metric); } - -<%@ include file="../editor/getVisualID.jetinc"%> }<%importManager.emitSortedImports();%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/PropertyProvider.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/PropertyProvider.javajet index 986b54462..50e14c90f 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/PropertyProvider.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/PropertyProvider.javajet @@ -57,13 +57,11 @@ public class <%=genDiagram.getPropertyProviderClassName()%> extends GenericEMFPr view = (View) editPart.getModel(); } } - if (view != null && "<%=genDiagram.getEditorGen().getModelID()%>".equals(getModelID(view))) { + if (view != null && <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(<%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getModelID(view))) { return view.getElement(); } return null; } - -<%@ include file="../editor/getModelID.jetinc" %> } <%importManager.emitSortedImports();%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/ValidationProvider.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/ValidationProvider.javajet index 0cc996779..572f6c596 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/ValidationProvider.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/ValidationProvider.javajet @@ -307,7 +307,7 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) { */ public boolean selects(Object object) { if(isInDefaultEditorContext(object) && object instanceof View) { - String id = getViewSemanticId((View) object); + String id = ((View) object).getType(); return id != null && semanticCtxIdMap.get(id) == <%=selectorClassName%>.class; } return false; @@ -327,15 +327,7 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) { if(usesNotationContextSwitch) { %> - /** - * @generated - */ - static String getViewSemanticId(View view) { - String id = Integer.toString(getVisualID(view)); - return id != null && id.length() > 0 ? id : null; - } -<%@ include file="../editor/getVisualID.jetinc"%> - + /** * @generated */ @@ -452,7 +444,7 @@ if(usesNotationContextSwitch) {%> private void prepareNextClientContext(EObject nextTarget) { if (nextTarget != null && currentTarget != null) { if (nextTarget instanceof View) { - String id = getViewSemanticId((View) nextTarget); + String id = ((View) nextTarget).getType(); String nextSemanticId = id != null && semanticCtxIdMap.containsKey(id) ? id : null; if ((currentSemanticCtxId != null && !currentSemanticCtxId diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/ViewFactory.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/ViewFactory.javajet index 62525db89..11b3371cb 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/ViewFactory.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/ViewFactory.javajet @@ -5,13 +5,14 @@ <%@ include file="../copyright4java.jetinc"%> package <%=genDiagram.getNotationViewFactoriesPackageName()%>; -<%ImportUtil importManager = new ImportUtil(genDiagram.getNotationViewFactoriesPackageName());%> -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gmf.runtime.notation.View; -<%importManager.markImportLocation(stringBuffer);%> -<% +<%ImportUtil importManager = new ImportUtil(genDiagram.getNotationViewFactoriesPackageName()); + +importManager.addImport("org.eclipse.core.runtime.IAdaptable"); +importManager.addImport("org.eclipse.gmf.runtime.notation.View"); + +importManager.markImportLocation(stringBuffer); + + boolean isLink = genElement instanceof GenLink; boolean isDiagram = genElement instanceof GenDiagram; boolean isCompartment = genElement instanceof GenCompartment; @@ -50,12 +51,19 @@ if (isDiagram) { %> protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { + if (semanticHint == null) { <%/* [++] importmant for the create shortcut functionality*/%> + semanticHint = <%=genElement.getEditPartQualifiedClassName()%>.VISUAL_ID; + view.setType(semanticHint); + }<%/* [--] importmant for the create shortcut functionality*/%> super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); + if (!<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(<%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getModelID(containerView))) { + <%=importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")%> shortcutAnnotation = <%=importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory")%>.eINSTANCE.createEAnnotation(); + shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ + shortcutAnnotation.getDetails().put("modelID", <%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID); + } <% } -%> -<%@ include file="createVIDAnnotation.jetinc"%> -<% + ColorAttributes colorAttrs = genElement.getViewmap() != null ? (ColorAttributes) genElement.getViewmap().find(ColorAttributes.class) : null; if (colorAttrs != null && colorAttrs.getForegroundColor() != null && colorAttrs.getForegroundColor().trim().length() > 0) {%> <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")%>.setStructuralFeatureValue(view, <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")%>.eINSTANCE.getLineStyle_LineColor(), diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/ViewProvider.javajet b/plugins/org.eclipse.gmf.codegen/templates/providers/ViewProvider.javajet index 8a1ba3760..115b67027 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/ViewProvider.javajet +++ b/plugins/org.eclipse.gmf.codegen/templates/providers/ViewProvider.javajet @@ -27,7 +27,7 @@ public class <%=genDiagram.getNotationViewProviderClassName()%> extends Abstract <%if (genDiagram.getDomainDiagramElement() != null) {%> EObject semanticElement = getSemanticElement(semanticAdapter); <%}%> - if ("<%=genDiagram.getEditorGen().getModelID()%>".equals(diagramKind) + if (<%=importManager.getImportedName(genDiagram.getEditPartQualifiedClassName())%>.MODEL_ID.equals(diagramKind) <%if (genDiagram.getDomainDiagramElement() != null) {%> && <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getDiagramVisualID(semanticElement) != -1 <%}%> diff --git a/plugins/org.eclipse.gmf.codegen/templates/providers/createVIDAnnotation.jetinc b/plugins/org.eclipse.gmf.codegen/templates/providers/createVIDAnnotation.jetinc deleted file mode 100644 index 62b7271c6..000000000 --- a/plugins/org.eclipse.gmf.codegen/templates/providers/createVIDAnnotation.jetinc +++ /dev/null @@ -1,5 +0,0 @@ -EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation(); -annotation.setSource("ViewIdentifier"); //$NON-NLS-1$ -view.getEAnnotations().add(annotation); -annotation.getDetails().put("modelID", "<%=genDiagram.getEditorGen().getModelID()%>"); //$NON-NLS-1$ -annotation.getDetails().put("visualID", "<%=genElement.getVisualID()%>"); //$NON-NLS-1$ diff --git a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc index 9929a9ecd..f37db4c3b 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc +++ b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/refreshSemanticDiagram.jetinc @@ -51,7 +51,7 @@ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> diagramLinkObject = nextDiagramLink.getElement(); <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> diagramLinkSrc = nextDiagramLink.getSource().getElement(); <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> diagramLinkDst = nextDiagramLink.getTarget().getElement(); - int diagramLinkVisualID = getVisualID(nextDiagramLink); + int diagramLinkVisualID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getVisualID(nextDiagramLink); for (<%=importManager.getImportedName("java.util.Iterator")%> modelLinkDescriptors = myLinkDescriptors.iterator(); modelLinkDescriptors.hasNext();) { LinkDescriptor nextLinkDescriptor = (LinkDescriptor) modelLinkDescriptors.next(); if (diagramLinkObject == nextLinkDescriptor.getLinkElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) { @@ -73,7 +73,7 @@ */ private void collectAllLinks(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> view) { <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> modelElement = view.getElement(); - int diagramElementVisualID = getVisualID(view); + int diagramElementVisualID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getVisualID(view); switch (diagramElementVisualID) { <% for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) { @@ -109,8 +109,7 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. if (sourceEditPart == null || targetEditPart == null) { continue; } - String factoryHint = ""; - <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%>.ConnectionViewDescriptor descriptor = new <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%>.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), getFactoryHint(nextLinkDescriptor.getSemanticAdapter(), factoryHint), <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")%>.APPEND, false, ((<%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart")%>) getHost()).getDiagramPreferencesHint()); + <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%>.ConnectionViewDescriptor descriptor = new <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%>.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")%>.APPEND, false, ((<%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart")%>) getHost()).getDiagramPreferencesHint()); <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%> ccr = new <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest")%>(descriptor); ccr.setType(<%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants")%>.REQ_CONNECTION_START); ccr.setSourceEditPart(sourceEditPart); @@ -140,12 +139,9 @@ for (Iterator containers = genDiagram.getAllContainers().iterator(); containers. <% boolean createPhantoms = false; List genLinks = genDiagram.getLinks(); -String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()); %> <%@ include file="storeLinks.jetinc"%> <%@ include file="getDiagram.jetinc" %> -<%@ include file="../editor/getVisualID.jetinc" %> - <%@ include file="linkDescriptor.jetinc"%>
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/storeLinks.jetinc b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/storeLinks.jetinc index babc2980b..fef4a8bb0 100644 --- a/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/storeLinks.jetinc +++ b/plugins/org.eclipse.gmf.codegen/templates/semanticSync.jetinc/storeLinks.jetinc @@ -68,7 +68,7 @@ for (int linkIndex = 0; linkIndex < genLinks.size(); linkIndex++) { <%@ include file="collectFMFLinks_header.jetinc"%> myLinkDescriptors.add(new LinkDescriptor(container, nextDestination, <%=importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())%>.<%=nextLink.getUniqueIdentifier()%>, <%=nextLink.getVisualID()%>)); <% if (createPhantoms) {%> - <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode = ViewService.createNode(diagram, nextDestination, <%=importManager.getImportedName(phantomNode.getEditPartQualifiedClassName())%>.VISUAL_ID, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT); + <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode = ViewService.createNode(diagram, nextDestination, <%=importManager.getImportedName(phantomNode.getEditPartQualifiedClassName())%>.VISUAL_ID, <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.DIAGRAM_PREFERENCES_HINT); myEObject2NodeMap.put(nextDestination, nextNode); create<%=phantomNode.getUniqueIdentifier()%>Children(nextNode, nextDestination); <% }%> |