Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormfeldman2007-05-20 08:56:51 -0400
committermfeldman2007-05-20 08:56:51 -0400
commit57152607b81d0e9764d422719df7f374b3d91cd9 (patch)
treeeef68de625bfc754f91fba20447bac84dd10a4d1
parent0c574d2e1ac1d528d3413721ee5282215d32bb71 (diff)
downloadorg.eclipse.gmf-tooling-57152607b81d0e9764d422719df7f374b3d91cd9.tar.gz
org.eclipse.gmf-tooling-57152607b81d0e9764d422719df7f374b3d91cd9.tar.xz
org.eclipse.gmf-tooling-57152607b81d0e9764d422719df7f374b3d91cd9.zip
Anna Karyakina's migration fix
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/application/WizardNewFileCreationPageGenerator.java22
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateShortcutDecorationsCommand.java126
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateTypeNodeCommandGenerator.java244
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/ReorientConnectionViewCommandGenerator.java32
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ActionBarContributorGenerator.java26
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreateShortcutActionGenerator.java72
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardGenerator.java138
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardPageGenerator.java70
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/EditorGenerator.java398
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java88
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/LoadResourceActionGenerator.java34
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java72
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/AbstractExpressionGenerator.java52
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/OCLExpressionFactoryGenerator.java42
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/RegexpExpressionFactoryGenerator.java40
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/BaseEditHelperGenerator.java22
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperAdviceGenerator.java22
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperGenerator.java22
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorActionProviderGenerator.java172
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorLabelProviderGenerator.java430
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorSorterGenerator.java66
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java90
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramItemSemanticEditPolicyGenerator.java88
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/GraphicalNodeEditPolicyGenerator.java134
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ContributionItemProviderGenerator.java50
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java44
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ElementInitializersGenerator.java330
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/IconProviderGenerator.java30
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelTextViewFactoryGenerator.java68
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/LabelViewFactoryGenerator.java68
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/MetricProviderGenerator.java574
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ModelingAssistantProviderGenerator.java242
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java38
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsPropertyTester.java46
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ValidationProviderGenerator.java366
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewFactoryGenerator.java368
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ViewProviderGenerator.java146
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/MigrationDelegate.java73
38 files changed, 2452 insertions, 2493 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/application/WizardNewFileCreationPageGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/application/WizardNewFileCreationPageGenerator.java
index e234a2e37..b5555fb09 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/application/WizardNewFileCreationPageGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/application/WizardNewFileCreationPageGenerator.java
@@ -15,12 +15,11 @@ public class WizardNewFileCreationPageGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.wizard.WizardPage;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.events.ModifyEvent;" + NL + "import org.eclipse.swt.events.ModifyListener;" + NL + "import org.eclipse.swt.events.SelectionEvent;" + NL + "import org.eclipse.swt.events.SelectionListener;" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.layout.GridLayout;" + NL + "import org.eclipse.swt.widgets.Button;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.FileDialog;" + NL + "import org.eclipse.swt.widgets.Label;" + NL + "import org.eclipse.swt.widgets.Text;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class WizardNewFileCreationPage extends WizardPage {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final IStructuredSelection currentSelection;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String initialFileName;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IPath initialContainerFullPath;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Text fileNameEditor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic WizardNewFileCreationPage(String name, IStructuredSelection currentSelection) {" + NL + "\t\tsuper(name);" + NL + "\t\tthis.currentSelection = currentSelection;" + NL + "\t\tString home = System.getProperty(\"user.home\"); //$NON-NLS-1$" + NL + "\t\tif (home != null) {" + NL + "\t\t\tinitialContainerFullPath = new Path(home);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IStructuredSelection getSelection() {" + NL + "\t\treturn currentSelection;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getFileName() {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\treturn initialFileName;" + NL + "\t\t}" + NL + "\t\tIPath path = getFilePath();" + NL + "\t\tif (path == null || path.isEmpty() || path.hasTrailingSeparator()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn path.lastSegment();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFileName(String fileName) {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\tinitialFileName = fileName;" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tsetFilePath(getContainerFullPath(), fileName);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IPath getContainerFullPath() {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\treturn initialContainerFullPath;" + NL + "\t\t}" + NL + "\t\tIPath path = getFilePath();" + NL + "\t\tif (path == null || path.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tif (path.hasTrailingSeparator()) {" + NL + "\t\t\treturn path;" + NL + "\t\t}" + NL + "\t\tpath = path.removeLastSegments(1);" + NL + "\t\tif (path.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn path.addTrailingSeparator();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setContainerFullPath(IPath containerPath) {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\tinitialContainerFullPath = containerPath;" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tsetFilePath(containerPath, getFileName());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IPath getFilePath() {" + NL + "\t\tString fileName = fileNameEditor.getText().trim();" + NL + "\t\tif (fileName.length() == 0) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn new Path(fileNameEditor.getText());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFilePath(IPath containerPath, String fileName) {" + NL + "\t\tif (fileName == null) {" + NL + "\t\t\tfileName = \"\"; //$NON-NLS-1$" + NL + "\t\t} else {" + NL + "\t\t\tfileName = fileName.trim();" + NL + "\t\t}" + NL + "\t\tif (containerPath == null) {" + NL + "\t\t\tfileNameEditor.setText(fileName);" + NL + "\t\t} else {" + NL + "\t\t\tif (!containerPath.hasTrailingSeparator()) {" + NL + "\t\t\t\tcontainerPath = containerPath.addTrailingSeparator();" + NL + "\t\t\t}" + NL + "\t\t\tIPath path = fileName.length() == 0 ? containerPath : containerPath.append(fileName);" + NL + "\t\t\tfileNameEditor.setText(path.toOSString());" + NL + "\t\t}" + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent) {" + NL + "\t\tComposite plate = new Composite(parent, SWT.NONE);" + NL + "\t\tplate.setLayout(new GridLayout(2, false));" + NL + "\t\tLabel label = new Label(plate, SWT.NONE);" + NL + "\t\tlabel.setText(\"File:\");" + NL + "\t\tlabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1));" + NL + "\t\tfileNameEditor = new Text(plate, SWT.SINGLE | SWT.BORDER);" + NL + "\t\tfileNameEditor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));" + NL + "\t\tButton button = new Button(plate, SWT.PUSH);" + NL + "\t\tbutton.setText(\"Browse\");" + NL + "\t\tbutton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));" + NL + "" + NL + "\t\t// logic" + NL + "\t\tfileNameEditor.addModifyListener(new ModifyListener() {" + NL + "" + NL + "\t\t\tpublic void modifyText(ModifyEvent e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\tbutton.addSelectionListener(new SelectionListener() {" + NL + "" + NL + "\t\t\tpublic void widgetSelected(SelectionEvent e) {" + NL + "\t\t\t\tFileDialog dialog = new FileDialog(getShell(), SWT.SAVE);" + NL + "\t\t\t\tdialog.setText(\"Select new file\");" + NL + "\t\t\t\tdialog.setFileName(getFileName());" + NL + "\t\t\t\tString fileName = dialog.open();" + NL + "\t\t\t\tif (fileName != null) {" + NL + "\t\t\t\t\tfileNameEditor.setText(fileName);" + NL + "\t\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tpublic void widgetDefaultSelected(SelectionEvent e) {" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "" + NL + "\t\t// init" + NL + "\t\tsetFilePath(initialContainerFullPath, initialFileName);" + NL + "\t\tsetControl(plate);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validatePage() {" + NL + "\t\tString fileName = fileNameEditor.getText().trim();" + NL + "\t\tif (fileName.length() == 0) {" + NL + "\t\t\tsetErrorMessage(\"Specify file name\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (!new Path(\"\").isValidPath(fileName)) { //$NON-NLS-1$" + NL + "\t\t\tsetErrorMessage(\"Invalid file name\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tsetErrorMessage(null);" + NL + "\t\treturn true;" + NL + "\t}" + NL + "}";
- protected final String TEXT_6 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.wizard.WizardPage;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.events.ModifyEvent;" + NL + "import org.eclipse.swt.events.ModifyListener;" + NL + "import org.eclipse.swt.events.SelectionEvent;" + NL + "import org.eclipse.swt.events.SelectionListener;" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.layout.GridLayout;" + NL + "import org.eclipse.swt.widgets.Button;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.FileDialog;" + NL + "import org.eclipse.swt.widgets.Label;" + NL + "import org.eclipse.swt.widgets.Text;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class WizardNewFileCreationPage extends WizardPage {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final IStructuredSelection currentSelection;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String initialFileName;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IPath initialContainerFullPath;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Text fileNameEditor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic WizardNewFileCreationPage(String name, IStructuredSelection currentSelection) {" + NL + "\t\tsuper(name);" + NL + "\t\tthis.currentSelection = currentSelection;" + NL + "\t\tString home = System.getProperty(\"user.home\"); //$NON-NLS-1$" + NL + "\t\tif (home != null) {" + NL + "\t\t\tinitialContainerFullPath = new Path(home);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IStructuredSelection getSelection() {" + NL + "\t\treturn currentSelection;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getFileName() {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\treturn initialFileName;" + NL + "\t\t}" + NL + "\t\tIPath path = getFilePath();" + NL + "\t\tif (path == null || path.isEmpty() || path.hasTrailingSeparator()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn path.lastSegment();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFileName(String fileName) {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\tinitialFileName = fileName;" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tsetFilePath(getContainerFullPath(), fileName);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IPath getContainerFullPath() {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\treturn initialContainerFullPath;" + NL + "\t\t}" + NL + "\t\tIPath path = getFilePath();" + NL + "\t\tif (path == null || path.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tif (path.hasTrailingSeparator()) {" + NL + "\t\t\treturn path;" + NL + "\t\t}" + NL + "\t\tpath = path.removeLastSegments(1);" + NL + "\t\tif (path.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn path.addTrailingSeparator();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setContainerFullPath(IPath containerPath) {" + NL + "\t\tif (fileNameEditor == null) {" + NL + "\t\t\tinitialContainerFullPath = containerPath;" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tsetFilePath(containerPath, getFileName());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IPath getFilePath() {" + NL + "\t\tString fileName = fileNameEditor.getText().trim();" + NL + "\t\tif (fileName.length() == 0) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn new Path(fileNameEditor.getText());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFilePath(IPath containerPath, String fileName) {" + NL + "\t\tif (fileName == null) {" + NL + "\t\t\tfileName = \"\"; //$NON-NLS-1$" + NL + "\t\t} else {" + NL + "\t\t\tfileName = fileName.trim();" + NL + "\t\t}" + NL + "\t\tif (containerPath == null) {" + NL + "\t\t\tfileNameEditor.setText(fileName);" + NL + "\t\t} else {" + NL + "\t\t\tif (!containerPath.hasTrailingSeparator()) {" + NL + "\t\t\t\tcontainerPath = containerPath.addTrailingSeparator();" + NL + "\t\t\t}" + NL + "\t\t\tIPath path = fileName.length() == 0 ? containerPath : containerPath.append(fileName);" + NL + "\t\t\tfileNameEditor.setText(path.toOSString());" + NL + "\t\t}" + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent) {" + NL + "\t\tComposite plate = new Composite(parent, SWT.NONE);" + NL + "\t\tplate.setLayout(new GridLayout(2, false));" + NL + "\t\tLabel label = new Label(plate, SWT.NONE);" + NL + "\t\tlabel.setText(\"File:\");" + NL + "\t\tlabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1));" + NL + "\t\tfileNameEditor = new Text(plate, SWT.SINGLE | SWT.BORDER);" + NL + "\t\tfileNameEditor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));" + NL + "\t\tButton button = new Button(plate, SWT.PUSH);" + NL + "\t\tbutton.setText(\"Browse\");" + NL + "\t\tbutton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));" + NL + "" + NL + "\t\t// logic" + NL + "\t\tfileNameEditor.addModifyListener(new ModifyListener() {" + NL + "" + NL + "\t\t\tpublic void modifyText(ModifyEvent e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\tbutton.addSelectionListener(new SelectionListener() {" + NL + "" + NL + "\t\t\tpublic void widgetSelected(SelectionEvent e) {" + NL + "\t\t\t\tFileDialog dialog = new FileDialog(getShell(), SWT.SAVE);" + NL + "\t\t\t\tdialog.setText(\"Select new file\");" + NL + "\t\t\t\tdialog.setFileName(getFileName());" + NL + "\t\t\t\tString fileName = dialog.open();" + NL + "\t\t\t\tif (fileName != null) {" + NL + "\t\t\t\t\tfileNameEditor.setText(fileName);" + NL + "\t\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tpublic void widgetDefaultSelected(SelectionEvent e) {" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "" + NL + "\t\t// init" + NL + "\t\tsetFilePath(initialContainerFullPath, initialFileName);" + NL + "\t\tsetControl(plate);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validatePage() {" + NL + "\t\tString fileName = fileNameEditor.getText().trim();" + NL + "\t\tif (fileName.length() == 0) {" + NL + "\t\t\tsetErrorMessage(\"Specify file name\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (!new Path(\"\").isValidPath(fileName)) { //$NON-NLS-1$" + NL + "\t\t\tsetErrorMessage(\"Invalid file name\");" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tsetErrorMessage(null);" + NL + "\t\treturn true;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_5 = NL;
public String generate(Object argument)
{
@@ -29,7 +28,6 @@ public class WizardNewFileCreationPageGenerator
final GenApplication application = (GenApplication) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
{
GenDiagram genDiagram = application.getEditorGen().getDiagram();
@@ -37,17 +35,17 @@ final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateShortcutDecorationsCommand.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateShortcutDecorationsCommand.java
index b7f2aaafc..897d3d8c0 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateShortcutDecorationsCommand.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateShortcutDecorationsCommand.java
@@ -15,116 +15,114 @@ public class CreateShortcutDecorationsCommand
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_8 = " myDescriptors;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_9 = "(";
- protected final String TEXT_10 = " editingDomain, ";
- protected final String TEXT_11 = " parentView, ";
- protected final String TEXT_12 = " viewDescriptors) {" + NL + "\t\tsuper(editingDomain, \"Create Shortcuts\", getWorkspaceFiles(parentView)); //$NON-NLS-1$" + NL + "\t\tmyDescriptors = viewDescriptors;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_13 = "(";
- protected final String TEXT_14 = " editingDomain, ";
- protected final String TEXT_15 = " parentView, ";
- protected final String TEXT_16 = ".ViewDescriptor viewDescriptor) {" + NL + "\t\tthis(editingDomain, parentView, ";
- protected final String TEXT_17 = ".singletonList(viewDescriptor));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_18 = " doExecuteWithResult(";
- protected final String TEXT_19 = " monitor, ";
- protected final String TEXT_20 = " info) throws ";
- protected final String TEXT_21 = " {" + NL + "\t\tfor (";
- protected final String TEXT_22 = " it = myDescriptors.iterator(); it.hasNext();) {" + NL + "\t\t\t";
- protected final String TEXT_23 = ".ViewDescriptor nextDescriptor = (";
- protected final String TEXT_24 = ".ViewDescriptor) it.next();" + NL + "\t\t\t";
- protected final String TEXT_25 = " view = (";
- protected final String TEXT_26 = ") nextDescriptor.getAdapter(";
- protected final String TEXT_27 = ".class);" + NL + "\t\t\tif (view != null && view.getEAnnotation(\"Shortcut\") == null) { //$NON-NLS-1$" + NL + "\t\t\t\t";
- protected final String TEXT_28 = NL;
- protected final String TEXT_29 = "\t\t\t";
- protected final String TEXT_30 = " shortcutAnnotation = ";
- protected final String TEXT_31 = ".eINSTANCE.createEAnnotation();" + NL + "\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", ";
- protected final String TEXT_32 = ".MODEL_ID); //$NON-NLS-1$" + NL + "\t\t\tview.getEAnnotations().add(shortcutAnnotation);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn ";
- protected final String TEXT_33 = ".newOKCommandResult();" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_34 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_7 = " myDescriptors;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_8 = "(";
+ protected final String TEXT_9 = " editingDomain, ";
+ protected final String TEXT_10 = " parentView, ";
+ protected final String TEXT_11 = " viewDescriptors) {" + NL + "\t\tsuper(editingDomain, \"Create Shortcuts\", getWorkspaceFiles(parentView)); //$NON-NLS-1$" + NL + "\t\tmyDescriptors = viewDescriptors;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_12 = "(";
+ protected final String TEXT_13 = " editingDomain, ";
+ protected final String TEXT_14 = " parentView, ";
+ protected final String TEXT_15 = ".ViewDescriptor viewDescriptor) {" + NL + "\t\tthis(editingDomain, parentView, ";
+ protected final String TEXT_16 = ".singletonList(viewDescriptor));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_17 = " doExecuteWithResult(";
+ protected final String TEXT_18 = " monitor, ";
+ protected final String TEXT_19 = " info) throws ";
+ protected final String TEXT_20 = " {" + NL + "\t\tfor (";
+ protected final String TEXT_21 = " it = myDescriptors.iterator(); it.hasNext();) {" + NL + "\t\t\t";
+ protected final String TEXT_22 = ".ViewDescriptor nextDescriptor = (";
+ protected final String TEXT_23 = ".ViewDescriptor) it.next();" + NL + "\t\t\t";
+ protected final String TEXT_24 = " view = (";
+ protected final String TEXT_25 = ") nextDescriptor.getAdapter(";
+ protected final String TEXT_26 = ".class);" + NL + "\t\t\tif (view != null && view.getEAnnotation(\"Shortcut\") == null) { //$NON-NLS-1$" + NL + "\t\t\t\t";
+ protected final String TEXT_27 = NL;
+ protected final String TEXT_28 = "\t\t\t";
+ protected final String TEXT_29 = " shortcutAnnotation = ";
+ protected final String TEXT_30 = ".eINSTANCE.createEAnnotation();" + NL + "\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", ";
+ protected final String TEXT_31 = ".MODEL_ID); //$NON-NLS-1$" + NL + "\t\t\tview.getEAnnotations().add(shortcutAnnotation);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn ";
+ protected final String TEXT_32 = ".newOKCommandResult();" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_33 = NL;
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getCreateShortcutDecorationsCommandClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(genDiagram.getCreateShortcutDecorationsCommandClassName());
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(genDiagram.getCreateShortcutDecorationsCommandClassName());
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName("java.util.Collections"));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CommandResult"));
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.commands.ExecutionException"));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"));
stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"));
stringBuffer.append(TEXT_23);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_26);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_27);
/* Shortcut was created on the diagram with the same modelID */
+ stringBuffer.append(TEXT_27);
stringBuffer.append(TEXT_28);
- stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory"));
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CommandResult"));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateTypeNodeCommandGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateTypeNodeCommandGenerator.java
index a05526705..e3814e1c4 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateTypeNodeCommandGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/CreateTypeNodeCommandGenerator.java
@@ -16,70 +16,69 @@ public class CreateTypeNodeCommandGenerator {
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
- protected final String TEXT_8 = "(";
- protected final String TEXT_9 = " req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL;
- protected final String TEXT_10 = NL + "\t\tfalse" + NL + "\t\t/* " + NL + "\t\tFIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually" + NL + "\t\tIf you rely on superclass behaviour, simply delete this comment" + NL + "\t\t*/" + NL + "}";
- protected final String TEXT_11 = NL;
- protected final String TEXT_12 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_13 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
- protected final String TEXT_14 = ".eINSTANCE.get";
- protected final String TEXT_15 = "();" + NL + "\t\t}";
- protected final String TEXT_16 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_17 = " getElementToEdit() {" + NL + "\t\t\t";
- protected final String TEXT_18 = " container = ((";
- protected final String TEXT_19 = ") getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
- protected final String TEXT_20 = ") {" + NL + "\t\t\t\tcontainer = ((";
- protected final String TEXT_21 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}" + NL;
- protected final String TEXT_22 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_23 = " doDefaultElementCreation() {" + NL + "\t\t\t";
- protected final String TEXT_24 = " newElement = (";
- protected final String TEXT_25 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {";
- protected final String TEXT_26 = NL + "\t\t\t\t ";
- protected final String TEXT_27 = " container = (";
- protected final String TEXT_28 = ") getElementToEdit();" + NL + "\t\t\t\t if (container != null) {";
- protected final String TEXT_29 = NL + "\t\t\t\t\t";
- protected final String TEXT_30 = " featureValues = container.";
- protected final String TEXT_31 = "();" + NL + "\t\t\t\t\tfeatureValues.add(newElement);";
- protected final String TEXT_32 = NL + "\t\t\t\t \t";
- protected final String TEXT_33 = "newElement);";
- protected final String TEXT_34 = NL + "\t\t\t\t }";
- protected final String TEXT_35 = "\t\t" + NL + "\t\t\t\t";
- protected final String TEXT_36 = ".Initializers.";
- protected final String TEXT_37 = ".init(newElement);";
- protected final String TEXT_38 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
- protected final String TEXT_39 = NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\t";
- protected final String TEXT_40 = " container = (";
- protected final String TEXT_41 = ") getElementToEdit();";
- protected final String TEXT_42 = NL + "\t\t\tif (";
- protected final String TEXT_43 = " != null) {";
- protected final String TEXT_44 = NL + "\t\t\tif (";
- protected final String TEXT_45 = ".size() >= ";
- protected final String TEXT_46 = ") {";
- protected final String TEXT_47 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
- protected final String TEXT_48 = NL + "\t\t\tif (";
- protected final String TEXT_49 = " != null) {";
- protected final String TEXT_50 = NL + "\t\t\tif (";
- protected final String TEXT_51 = ".size() >= ";
- protected final String TEXT_52 = ") {";
- protected final String TEXT_53 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
- protected final String TEXT_54 = NL + "\t\t\treturn true;" + NL + "\t\t}";
- protected final String TEXT_55 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\tif (getEClass() != null) {" + NL + "\t\t\t\treturn getEClass().isSuperTypeOf(getEClassToEdit());" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_56 = " getContainmentFeature() {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_57 = " doDefaultElementCreation() {" + NL + "\t\t\t// Uncomment to put \"phantom\" objects into the diagram file.\t\t" + NL + "\t\t\t//";
- protected final String TEXT_58 = " resource = ((";
- protected final String TEXT_59 = ") getRequest()).getContainer().eResource();" + NL + "\t\t\t//if (resource == null) {" + NL + "\t\t\t//\treturn null;" + NL + "\t\t\t//}" + NL + "\t\t\t";
- protected final String TEXT_60 = " resource = getElementToEdit().eResource();" + NL + "\t\t\t";
- protected final String TEXT_61 = " eClass = getElementType().getEClass();" + NL + "\t\t\t";
- protected final String TEXT_62 = " eObject = eClass.getEPackage().getEFactoryInstance().create(eClass);" + NL + "\t\t\tresource.getContents().add(eObject);" + NL + "\t\t\treturn eObject;" + NL + "\t\t}";
- protected final String TEXT_63 = NL + NL + "}";
- protected final String TEXT_64 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_7 = "(";
+ protected final String TEXT_8 = " req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL;
+ protected final String TEXT_9 = NL + "\t\tfalse" + NL + "\t\t/* " + NL + "\t\tFIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually" + NL + "\t\tIf you rely on superclass behaviour, simply delete this comment" + NL + "\t\t*/" + NL + "}";
+ protected final String TEXT_10 = NL;
+ protected final String TEXT_11 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_12 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_13 = ".eINSTANCE.get";
+ protected final String TEXT_14 = "();" + NL + "\t\t}";
+ protected final String TEXT_15 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_16 = " getElementToEdit() {" + NL + "\t\t\t";
+ protected final String TEXT_17 = " container = ((";
+ protected final String TEXT_18 = ") getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
+ protected final String TEXT_19 = ") {" + NL + "\t\t\t\tcontainer = ((";
+ protected final String TEXT_20 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}" + NL;
+ protected final String TEXT_21 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_22 = " doDefaultElementCreation() {" + NL + "\t\t\t";
+ protected final String TEXT_23 = " newElement = (";
+ protected final String TEXT_24 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {";
+ protected final String TEXT_25 = NL + "\t\t\t\t ";
+ protected final String TEXT_26 = " container = (";
+ protected final String TEXT_27 = ") getElementToEdit();" + NL + "\t\t\t\t if (container != null) {";
+ protected final String TEXT_28 = NL + "\t\t\t\t\t";
+ protected final String TEXT_29 = " featureValues = container.";
+ protected final String TEXT_30 = "();" + NL + "\t\t\t\t\tfeatureValues.add(newElement);";
+ protected final String TEXT_31 = NL + "\t\t\t\t \t";
+ protected final String TEXT_32 = "newElement);";
+ protected final String TEXT_33 = NL + "\t\t\t\t }";
+ protected final String TEXT_34 = "\t\t" + NL + "\t\t\t\t";
+ protected final String TEXT_35 = ".Initializers.";
+ protected final String TEXT_36 = ".init(newElement);";
+ protected final String TEXT_37 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
+ protected final String TEXT_38 = NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\t";
+ protected final String TEXT_39 = " container = (";
+ protected final String TEXT_40 = ") getElementToEdit();";
+ protected final String TEXT_41 = NL + "\t\t\tif (";
+ protected final String TEXT_42 = " != null) {";
+ protected final String TEXT_43 = NL + "\t\t\tif (";
+ protected final String TEXT_44 = ".size() >= ";
+ protected final String TEXT_45 = ") {";
+ protected final String TEXT_46 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
+ protected final String TEXT_47 = NL + "\t\t\tif (";
+ protected final String TEXT_48 = " != null) {";
+ protected final String TEXT_49 = NL + "\t\t\tif (";
+ protected final String TEXT_50 = ".size() >= ";
+ protected final String TEXT_51 = ") {";
+ protected final String TEXT_52 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
+ protected final String TEXT_53 = NL + "\t\t\treturn true;" + NL + "\t\t}";
+ protected final String TEXT_54 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\tif (getEClass() != null) {" + NL + "\t\t\t\treturn getEClass().isSuperTypeOf(getEClassToEdit());" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_55 = " getContainmentFeature() {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_56 = " doDefaultElementCreation() {" + NL + "\t\t\t// Uncomment to put \"phantom\" objects into the diagram file.\t\t" + NL + "\t\t\t//";
+ protected final String TEXT_57 = " resource = ((";
+ protected final String TEXT_58 = ") getRequest()).getContainer().eResource();" + NL + "\t\t\t//if (resource == null) {" + NL + "\t\t\t//\treturn null;" + NL + "\t\t\t//}" + NL + "\t\t\t";
+ protected final String TEXT_59 = " resource = getElementToEdit().eResource();" + NL + "\t\t\t";
+ protected final String TEXT_60 = " eClass = getElementType().getEClass();" + NL + "\t\t\t";
+ protected final String TEXT_61 = " eObject = eClass.getEPackage().getEFactoryInstance().create(eClass);" + NL + "\t\t\tresource.getContents().add(eObject);" + NL + "\t\t\treturn eObject;" + NL + "\t\t}";
+ protected final String TEXT_62 = NL + NL + "}";
+ protected final String TEXT_63 = NL;
protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
StringBuffer result = new StringBuffer();
@@ -197,96 +196,95 @@ if (modelFacet == null) {
}
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
if (!modelFacet.isPhantomElement() && modelFacet.getContainmentMetaFeature() == null && modelFacet.getChildMetaFeature() == null) {
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
importManager.emitSortedImports();
return stringBuffer.toString(); // ATTENTION !!! CHANGE OF CONTROL FLOW - the template below is NOT processed when both features are null
// I don't want to wrap rest of the template into huge else block, hence this hack, which I believe will fade away with xpand.
}
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
if (!modelFacet.isPhantomElement()) {
GenClass containerGenClass = modelFacet.getContainmentMetaFeature().getGenClass();
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(containerGenClass.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(containerGenClass.getClassifierAccessorName());
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
}
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_17);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest"));
+ stringBuffer.append(TEXT_18);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_20);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_21);
if (!modelFacet.isPhantomElement()) {
GenClass containerGenClass = modelFacet.getContainmentMetaFeature().getGenClass();
boolean initChildMetafeature = !modelFacet.getChildMetaFeature().isDerived() && !modelFacet.getChildMetaFeature().equals(modelFacet.getContainmentMetaFeature());
if (modelFacet.getModelElementInitializer() != null || initChildMetafeature) {
String metaClassName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_22);
+ stringBuffer.append(metaClassName);
stringBuffer.append(TEXT_23);
stringBuffer.append(metaClassName);
stringBuffer.append(TEXT_24);
- stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_25);
if (initChildMetafeature) {
String containerMetaClass = importManager.getImportedName(modelFacet.getChildMetaFeature().getGenClass().getQualifiedInterfaceName());
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append(containerMetaClass);
stringBuffer.append(TEXT_26);
stringBuffer.append(containerMetaClass);
stringBuffer.append(TEXT_27);
- stringBuffer.append(containerMetaClass);
- stringBuffer.append(TEXT_28);
if (modelFacet.getChildMetaFeature().isListType()) {
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(modelFacet.getChildMetaFeature().getGetAccessor());
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
} else {
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(getFeatureValueSetterPrefix("container", modelFacet.getChildMetaFeature(), false, importManager));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
}
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
}
if (modelFacet.getModelElementInitializer() != null) {
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(node.getUniqueIdentifier());
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
}
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
}
GenFeature containmentMetaFeature = modelFacet.getContainmentMetaFeature();
@@ -296,62 +294,62 @@ if (copyrightText != null && copyrightText.trim().length() > 0) {
boolean checkChildMetafeature = !childMetaFeature.equals(containmentMetaFeature) && upperChildBound > 0;
if (upperContainmentBound > 0 || checkChildMetafeature) {
String containerInterfaceName = importManager.getImportedName(containerGenClass.getQualifiedInterfaceName());
+ stringBuffer.append(TEXT_38);
+ stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_39);
stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_40);
- stringBuffer.append(containerInterfaceName);
- stringBuffer.append(TEXT_41);
if (upperContainmentBound > 0) {
if (upperContainmentBound == 1) {
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(getFeatureValueGetter("container", containmentMetaFeature, false, importManager));
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
} else {
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(getFeatureValueGetter("container", containmentMetaFeature, false, importManager));
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(upperContainmentBound);
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
}
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
}
if (checkChildMetafeature) {
if (upperChildBound == 1) {
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, false, importManager));
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
} else {
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(getFeatureValueGetter("container", childMetaFeature, false, importManager));
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(upperChildBound);
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
}
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
}
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
}
} else {
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EReference"));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest"));
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
}
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_63);
return stringBuffer.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/ReorientConnectionViewCommandGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/ReorientConnectionViewCommandGenerator.java
index 46a89da2a..9e2bde15f 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/ReorientConnectionViewCommandGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/commands/ReorientConnectionViewCommandGenerator.java
@@ -15,34 +15,34 @@ public class ReorientConnectionViewCommandGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;" + NL + "import org.eclipse.gmf.runtime.common.core.command.CommandResult;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;" + NL + "import org.eclipse.gmf.runtime.notation.Edge;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractTransactionalCommand {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IAdaptable edgeAdaptor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_7 = "(TransactionalEditingDomain editingDomain, String label) {" + NL + "\t\tsuper(editingDomain, label, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getAffectedFiles() {" + NL + "\t\tView view = (View) edgeAdaptor.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\treturn getWorkspaceFiles(view);" + NL + "\t\t}" + NL + "\t\treturn super.getAffectedFiles();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IAdaptable getEdgeAdaptor() {" + NL + "\t\treturn edgeAdaptor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setEdgeAdaptor(IAdaptable edgeAdaptor) {" + NL + "\t\tthis.edgeAdaptor = edgeAdaptor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {" + NL + "\t\tassert null != edgeAdaptor : \"Null child in ";
- protected final String TEXT_8 = "\"; //$NON-NLS-1$" + NL + "\t\tEdge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class);" + NL + "\t\tassert null != edge : \"Null edge in ";
- protected final String TEXT_9 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t\tView tempView = edge.getSource();" + NL + "\t\tedge.setSource(edge.getTarget());" + NL + "\t\tedge.setTarget(tempView);" + NL + "" + NL + "\t\treturn CommandResult.newOKCommandResult();" + NL + "\t}" + NL + "}";
- protected final String TEXT_10 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;" + NL + "import org.eclipse.gmf.runtime.common.core.command.CommandResult;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;" + NL + "import org.eclipse.gmf.runtime.notation.Edge;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractTransactionalCommand {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IAdaptable edgeAdaptor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_6 = "(TransactionalEditingDomain editingDomain, String label) {" + NL + "\t\tsuper(editingDomain, label, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getAffectedFiles() {" + NL + "\t\tView view = (View) edgeAdaptor.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\treturn getWorkspaceFiles(view);" + NL + "\t\t}" + NL + "\t\treturn super.getAffectedFiles();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IAdaptable getEdgeAdaptor() {" + NL + "\t\treturn edgeAdaptor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setEdgeAdaptor(IAdaptable edgeAdaptor) {" + NL + "\t\tthis.edgeAdaptor = edgeAdaptor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {" + NL + "\t\tassert null != edgeAdaptor : \"Null child in ";
+ protected final String TEXT_7 = "\"; //$NON-NLS-1$" + NL + "\t\tEdge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class);" + NL + "\t\tassert null != edge : \"Null edge in ";
+ protected final String TEXT_8 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t\tView tempView = edge.getSource();" + NL + "\t\tedge.setSource(edge.getTarget());" + NL + "\t\tedge.setTarget(tempView);" + NL + "" + NL + "\t\treturn CommandResult.newOKCommandResult();" + NL + "\t}" + NL + "}";
+ protected final String TEXT_9 = NL;
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(genDiagram.getReorientConnectionViewCommandClassName());
stringBuffer.append(TEXT_5);
stringBuffer.append(genDiagram.getReorientConnectionViewCommandClassName());
stringBuffer.append(TEXT_6);
@@ -50,10 +50,8 @@ if (copyrightText != null && copyrightText.trim().length() > 0) {
stringBuffer.append(TEXT_7);
stringBuffer.append(genDiagram.getReorientConnectionViewCommandClassName());
stringBuffer.append(TEXT_8);
- stringBuffer.append(genDiagram.getReorientConnectionViewCommandClassName());
- stringBuffer.append(TEXT_9);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ActionBarContributorGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ActionBarContributorGenerator.java
index 3040638fc..09bc054f9 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ActionBarContributorGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ActionBarContributorGenerator.java
@@ -15,14 +15,13 @@ public class ActionBarContributorGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;" + NL + "" + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_5 = " extends DiagramActionBarContributor {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEditorClass() {" + NL + "\t\treturn ";
- protected final String TEXT_6 = ".class;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getEditorId() {" + NL + "\t\treturn ";
- protected final String TEXT_7 = ".ID;" + NL + "\t}" + NL + "}";
- protected final String TEXT_8 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;" + NL + "" + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_4 = " extends DiagramActionBarContributor {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEditorClass() {" + NL + "\t\treturn ";
+ protected final String TEXT_5 = ".class;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getEditorId() {" + NL + "\t\treturn ";
+ protected final String TEXT_6 = ".ID;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_7 = NL;
public String generate(Object argument)
{
@@ -32,24 +31,23 @@ final GenEditorView editorView = (GenEditorView) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
GenDiagram genDiagram = editorView.getEditorGen().getDiagram();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
stringBuffer.append(editorView.getActionBarContributorClassName());
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(editorView.getClassName());
stringBuffer.append(TEXT_5);
stringBuffer.append(editorView.getClassName());
stringBuffer.append(TEXT_6);
- stringBuffer.append(editorView.getClassName());
stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
return stringBuffer.toString();
}
}
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 134505e02..81e8252ba 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
@@ -15,27 +15,26 @@ public class CreateShortcutActionGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_5 = " implements 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 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_7 = ") {" + NL + "\t\t\t\tmySelectedElement = (";
- protected final String TEXT_8 = ") 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 + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\tfinal View view = (View) mySelectedElement.getModel();";
- protected final String TEXT_9 = NL + "\t\t";
- protected final String TEXT_10 = " elementChooser = new ";
- protected final String TEXT_11 = "(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_12 = ".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_13 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\t";
- protected final String TEXT_14 = " command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view);" + NL + "\t\tcommand = command.compose(new ";
- protected final String TEXT_15 = "(mySelectedElement.getEditingDomain(), view, viewDescriptor));" + 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_16 = ".getInstance().logError(\"Unable to create shortcut\", e); //$NON-NLS-1$" + NL + "\t\t}";
- protected final String TEXT_17 = NL + "\t\torg.eclipse.emf.ecore.resource.Resource resource =" + NL + "\t\t\t\t";
- protected final String TEXT_18 = ".openModel(" + NL + "\t\t\t\t\t\tmyShell, \"Select model to reference\", mySelectedElement.getEditingDomain());" + NL + "\t\tif (resource == null || resource.getContents().isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tShortcutCreationWizard wizard = new ShortcutCreationWizard((EObject) resource.getContents().get(0), view, mySelectedElement.getEditingDomain());" + NL + "\t\twizard.setWindowTitle(\"Create shortcut\");" + NL + "\t\t";
- protected final String TEXT_19 = ".runWizard(myShell, wizard, \"CreateShortcut\"); //$NON-NLS-1$";
- protected final String TEXT_20 = NL + "\t}" + NL + "}";
- protected final String TEXT_21 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_4 = " implements IObjectActionDelegate {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_5 = " 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 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_6 = ") {" + NL + "\t\t\t\tmySelectedElement = (";
+ protected final String TEXT_7 = ") 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 + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void run(IAction action) {" + NL + "\t\tfinal View view = (View) mySelectedElement.getModel();";
+ protected final String TEXT_8 = NL + "\t\t";
+ protected final String TEXT_9 = " elementChooser = new ";
+ protected final String TEXT_10 = "(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_11 = ".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_12 = ".DIAGRAM_PREFERENCES_HINT);" + NL + "\t\t";
+ protected final String TEXT_13 = " command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view);" + NL + "\t\tcommand = command.compose(new ";
+ protected final String TEXT_14 = "(mySelectedElement.getEditingDomain(), view, viewDescriptor));" + 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_15 = ".getInstance().logError(\"Unable to create shortcut\", e); //$NON-NLS-1$" + NL + "\t\t}";
+ protected final String TEXT_16 = NL + "\t\torg.eclipse.emf.ecore.resource.Resource resource =" + NL + "\t\t\t\t";
+ protected final String TEXT_17 = ".openModel(" + NL + "\t\t\t\t\t\tmyShell, \"Select model to reference\", mySelectedElement.getEditingDomain());" + NL + "\t\tif (resource == null || resource.getContents().isEmpty()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tShortcutCreationWizard wizard = new ShortcutCreationWizard((EObject) resource.getContents().get(0), view, mySelectedElement.getEditingDomain());" + NL + "\t\twizard.setWindowTitle(\"Create shortcut\");" + NL + "\t\t";
+ protected final String TEXT_18 = ".runWizard(myShell, wizard, \"CreateShortcut\"); //$NON-NLS-1$";
+ protected final String TEXT_19 = NL + "\t}" + NL + "}";
+ protected final String TEXT_20 = NL;
public String generate(Object argument)
{
@@ -44,14 +43,13 @@ public class CreateShortcutActionGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
@@ -75,41 +73,41 @@ importManager.getImportedName("org.eclipse.ui.IObjectActionDelegate");
importManager.getImportedName("org.eclipse.ui.IWorkbenchPart");
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
stringBuffer.append(genDiagram.getCreateShortcutActionClassName());
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_7);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_8);
if(genDiagram.getEditorGen().getApplication() == null) {
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName()));
stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName()));
stringBuffer.append(TEXT_10);
- stringBuffer.append(importManager.getImportedName(genDiagram.getElementChooserQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_12);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.ICommand"));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName(genDiagram.getCreateShortcutDecorationsCommandQualifiedClassName()));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
} else {
+ stringBuffer.append(TEXT_16);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
stringBuffer.append(TEXT_18);
- stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
- stringBuffer.append(TEXT_19);
}
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardGenerator.java
index f9b1d2c91..1cae714c4 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/CreationWizardGenerator.java
@@ -15,41 +15,40 @@ public class CreationWizardGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.lang.reflect.InvocationTargetException;" + NL + "" + NL + "import org.eclipse.core.runtime.CoreException;" + NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.jface.dialogs.ErrorDialog;" + NL + "import org.eclipse.jface.operation.IRunnableWithProgress;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.wizard.Wizard;" + NL + "import org.eclipse.ui.INewWizard;" + NL + "import org.eclipse.ui.IWorkbench;" + NL + "import org.eclipse.ui.PartInitException;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends Wizard implements INewWizard {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IWorkbench workbench;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " protected IStructuredSelection selection;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_7 = " diagramModelFilePage;";
- protected final String TEXT_8 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_9 = " domainModelFilePage;";
- protected final String TEXT_10 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Resource diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean openNewlyCreatedDiagramEditor = true;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " public IWorkbench getWorkbench() {" + NL + " return workbench;" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IStructuredSelection getSelection() {" + NL + " return selection;" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final Resource getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isOpenNewlyCreatedDiagramEditor() {" + NL + "\t\treturn openNewlyCreatedDiagramEditor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {" + NL + "\t\tthis.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IWorkbench workbench, IStructuredSelection selection) {" + NL + " this.workbench = workbench;" + NL + " this.selection = selection;" + NL + "\t\tsetWindowTitle(\"New ";
- protected final String TEXT_11 = " Diagram\");";
- protected final String TEXT_12 = NL + "\t\tsetDefaultPageImageDescriptor(";
- protected final String TEXT_13 = ".getBundledImageDescriptor(\"icons/wizban/New";
- protected final String TEXT_14 = "Wizard.gif\")); //$NON-NLS-1$" + NL + "\t\tsetNeedsProgressMonitor(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {" + NL + "\t\tdiagramModelFilePage = new ";
- protected final String TEXT_15 = "(\"DiagramModelFile\", getSelection(), \"";
- protected final String TEXT_16 = "\"); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\tdiagramModelFilePage.setTitle(\"Create ";
- protected final String TEXT_17 = " Diagram\");";
- protected final String TEXT_18 = NL + "\t\tdiagramModelFilePage.setDescription(\"Select file that will contain diagram model.\");";
- protected final String TEXT_19 = NL + "\t\tdiagramModelFilePage.setDescription(\"Select file that will contain diagram and domain models.\");";
- protected final String TEXT_20 = NL + "\t\taddPage(diagramModelFilePage);";
- protected final String TEXT_21 = NL + NL + "\t\tdomainModelFilePage = new ";
- protected final String TEXT_22 = "(\"DomainModelFile\", getSelection(), \"";
- protected final String TEXT_23 = "\"); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\tdomainModelFilePage.setTitle(\"Create ";
- protected final String TEXT_24 = " Diagram\");" + NL + "\t\tdomainModelFilePage.setDescription(\"Select file that will contain domain model.\");" + NL + "\t\taddPage(domainModelFilePage);";
- protected final String TEXT_25 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tIRunnableWithProgress op =";
- protected final String TEXT_26 = NL + "\t\t\t\tnew ";
- protected final String TEXT_27 = "(null) {" + NL + "" + NL + "\t\t\tprotected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {";
- protected final String TEXT_28 = NL + "\t\t\t\tnew IRunnableWithProgress() {" + NL + "" + NL + "\t\t\tpublic void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {";
- protected final String TEXT_29 = NL + "\t\t\t\tdiagram = ";
- protected final String TEXT_30 = ".createDiagram(diagramModelFilePage.getURI(),";
- protected final String TEXT_31 = NL + "\t\t\t\t\t\tdomainModelFilePage.getURI(),";
- protected final String TEXT_32 = NL + "\t\t\t\t\t\tmonitor);" + NL + "\t\t\t\tif (isOpenNewlyCreatedDiagramEditor() && diagram != null) {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_33 = ".openDiagram(diagram);" + NL + "\t\t\t\t\t} catch (PartInitException e) {" + NL + "\t\t\t\t\t\tErrorDialog.openError(getContainer().getShell(), \"Error opening diagram editor\", null, e.getStatus());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\ttry {" + NL + "\t\t\tgetContainer().run(false, true, op);" + NL + "\t\t} catch (InterruptedException e) {" + NL + "\t\t\treturn false;" + NL + "\t\t} catch (InvocationTargetException e) {" + NL + "\t\t\tif (e.getTargetException() instanceof CoreException) {" + NL + "\t\t\t\tErrorDialog.openError(getContainer().getShell(), \"Creation Problems\", null, ((CoreException) e.getTargetException()).getStatus());" + NL + "\t\t\t} else {" + NL + "\t\t\t\t";
- protected final String TEXT_34 = ".getInstance().logError(\"Error creating diagram\", e.getTargetException()); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn diagram != null;" + NL + "\t}" + NL + "}";
- protected final String TEXT_35 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.lang.reflect.InvocationTargetException;" + NL + "" + NL + "import org.eclipse.core.runtime.CoreException;" + NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.jface.dialogs.ErrorDialog;" + NL + "import org.eclipse.jface.operation.IRunnableWithProgress;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.wizard.Wizard;" + NL + "import org.eclipse.ui.INewWizard;" + NL + "import org.eclipse.ui.IWorkbench;" + NL + "import org.eclipse.ui.PartInitException;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends Wizard implements INewWizard {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IWorkbench workbench;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " protected IStructuredSelection selection;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_6 = " diagramModelFilePage;";
+ protected final String TEXT_7 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_8 = " domainModelFilePage;";
+ protected final String TEXT_9 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Resource diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean openNewlyCreatedDiagramEditor = true;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " public IWorkbench getWorkbench() {" + NL + " return workbench;" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IStructuredSelection getSelection() {" + NL + " return selection;" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final Resource getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isOpenNewlyCreatedDiagramEditor() {" + NL + "\t\treturn openNewlyCreatedDiagramEditor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {" + NL + "\t\tthis.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IWorkbench workbench, IStructuredSelection selection) {" + NL + " this.workbench = workbench;" + NL + " this.selection = selection;" + NL + "\t\tsetWindowTitle(\"New ";
+ protected final String TEXT_10 = " Diagram\");";
+ protected final String TEXT_11 = NL + "\t\tsetDefaultPageImageDescriptor(";
+ protected final String TEXT_12 = ".getBundledImageDescriptor(\"icons/wizban/New";
+ protected final String TEXT_13 = "Wizard.gif\")); //$NON-NLS-1$" + NL + "\t\tsetNeedsProgressMonitor(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {" + NL + "\t\tdiagramModelFilePage = new ";
+ protected final String TEXT_14 = "(\"DiagramModelFile\", getSelection(), \"";
+ protected final String TEXT_15 = "\"); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\tdiagramModelFilePage.setTitle(\"Create ";
+ protected final String TEXT_16 = " Diagram\");";
+ protected final String TEXT_17 = NL + "\t\tdiagramModelFilePage.setDescription(\"Select file that will contain diagram model.\");";
+ protected final String TEXT_18 = NL + "\t\tdiagramModelFilePage.setDescription(\"Select file that will contain diagram and domain models.\");";
+ protected final String TEXT_19 = NL + "\t\taddPage(diagramModelFilePage);";
+ protected final String TEXT_20 = NL + NL + "\t\tdomainModelFilePage = new ";
+ protected final String TEXT_21 = "(\"DomainModelFile\", getSelection(), \"";
+ protected final String TEXT_22 = "\"); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\tdomainModelFilePage.setTitle(\"Create ";
+ protected final String TEXT_23 = " Diagram\");" + NL + "\t\tdomainModelFilePage.setDescription(\"Select file that will contain domain model.\");" + NL + "\t\taddPage(domainModelFilePage);";
+ protected final String TEXT_24 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tIRunnableWithProgress op =";
+ protected final String TEXT_25 = NL + "\t\t\t\tnew ";
+ protected final String TEXT_26 = "(null) {" + NL + "" + NL + "\t\t\tprotected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {";
+ protected final String TEXT_27 = NL + "\t\t\t\tnew IRunnableWithProgress() {" + NL + "" + NL + "\t\t\tpublic void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {";
+ protected final String TEXT_28 = NL + "\t\t\t\tdiagram = ";
+ protected final String TEXT_29 = ".createDiagram(diagramModelFilePage.getURI(),";
+ protected final String TEXT_30 = NL + "\t\t\t\t\t\tdomainModelFilePage.getURI(),";
+ protected final String TEXT_31 = NL + "\t\t\t\t\t\tmonitor);" + NL + "\t\t\t\tif (isOpenNewlyCreatedDiagramEditor() && diagram != null) {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_32 = ".openDiagram(diagram);" + NL + "\t\t\t\t\t} catch (PartInitException e) {" + NL + "\t\t\t\t\t\tErrorDialog.openError(getContainer().getShell(), \"Error opening diagram editor\", null, e.getStatus());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\ttry {" + NL + "\t\t\tgetContainer().run(false, true, op);" + NL + "\t\t} catch (InterruptedException e) {" + NL + "\t\t\treturn false;" + NL + "\t\t} catch (InvocationTargetException e) {" + NL + "\t\t\tif (e.getTargetException() instanceof CoreException) {" + NL + "\t\t\t\tErrorDialog.openError(getContainer().getShell(), \"Creation Problems\", null, ((CoreException) e.getTargetException()).getStatus());" + NL + "\t\t\t} else {" + NL + "\t\t\t\t";
+ protected final String TEXT_33 = ".getInstance().logError(\"Error creating diagram\", e.getTargetException()); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn diagram != null;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_34 = NL;
public String generate(Object argument)
{
@@ -59,31 +58,30 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final boolean standaloneDomainModel = !genDiagram.getEditorGen().isSameFileForDiagramAndModel() && genDiagram.getDomainDiagramElement() != null;
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName()));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
if (standaloneDomainModel) {
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName()));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
}
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(genDiagram.getEditorGen().getModelID());
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
final String iconNameStem;
// @see Generator#generateWizardBanner
@@ -94,53 +92,53 @@ if (genDiagram.getDomainDiagramElement() != null) {
}
final String pluginClassName = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName());
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(pluginClassName);
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(iconNameStem);
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName()));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(genDiagram.getEditorGen().getDiagramFileExtension());
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(genDiagram.getEditorGen().getModelID());
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
if (standaloneDomainModel) {
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
} else {
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
}
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
if (standaloneDomainModel) {
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName()));
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(genDiagram.getEditorGen().getDomainFileExtension());
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
stringBuffer.append(genDiagram.getEditorGen().getModelID());
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
}
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
if (genDiagram.getEditorGen().getApplication() == null) {
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.WorkspaceModifyOperation"));
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
} else {
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
}
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
if (standaloneDomainModel) {
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
}
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(pluginClassName);
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
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 34a6d42b0..46cebdfb7 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
@@ -15,24 +15,23 @@ public class CreationWizardPageGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.osgi.util.NLS;" + NL + "import org.eclipse.swt.widgets.Composite;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends";
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "\t";
- protected final String TEXT_9 = NL;
- protected final String TEXT_10 = "\t";
- protected final String TEXT_11 = NL + "\t{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final String fileExtension;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_12 = "(String pageName, IStructuredSelection selection, String fileExtension) {" + NL + "\t\tsuper(pageName, selection);" + NL + "\t\tthis.fileExtension = fileExtension;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Override to create files with this extension." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getExtension() {" + NL + "\t\treturn fileExtension;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getURI() {";
- protected final String TEXT_13 = NL + "\t\treturn URI.createPlatformResourceURI(getFilePath().toString(), false);";
- protected final String TEXT_14 = NL + "\t\treturn URI.createFileURI(getFilePath().toString());";
- protected final String TEXT_15 = NL + "\t}";
- protected final String TEXT_16 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IPath getFilePath() {" + NL + "\t\tIPath path = getContainerFullPath();" + NL + "\t\tif (path == null) {" + NL + "\t\t\tpath = new Path(\"\"); //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\tString fileName = getFileName();" + NL + "\t\tif (fileName != null) {" + NL + "\t\t\tpath = path.append(fileName);" + NL + "\t\t}" + NL + "\t\treturn path;" + NL + "\t}";
- protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent) {" + NL + "\t\tsuper.createControl(parent);" + NL + "\t\tsetFileName(";
- protected final String TEXT_18 = ".getUniqueFileName(" + NL + "\t\t\t\tgetContainerFullPath(), getFileName(), getExtension()));" + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validatePage() {" + NL + "\t\tif (!super.validatePage()) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tString extension = getExtension();" + NL + "\t\tif (extension != null && !getFilePath().toString().endsWith(\".\" + extension)) {" + NL + "\t\t\tsetErrorMessage(NLS.bind(\"File name should have ''{0}'' extension.\", extension));" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.osgi.util.NLS;" + NL + "import org.eclipse.swt.widgets.Composite;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends";
+ protected final String TEXT_6 = NL;
+ protected final String TEXT_7 = "\t";
+ protected final String TEXT_8 = NL;
+ protected final String TEXT_9 = "\t";
+ protected final String TEXT_10 = NL + "\t{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final String fileExtension;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_11 = "(String pageName, IStructuredSelection selection, String fileExtension) {" + NL + "\t\tsuper(pageName, selection);" + NL + "\t\tthis.fileExtension = fileExtension;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Override to create files with this extension." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getExtension() {" + NL + "\t\treturn fileExtension;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getURI() {";
+ protected final String TEXT_12 = NL + "\t\treturn URI.createPlatformResourceURI(getFilePath().toString(), false);";
+ protected final String TEXT_13 = NL + "\t\treturn URI.createFileURI(getFilePath().toString());";
+ protected final String TEXT_14 = NL + "\t}";
+ protected final String TEXT_15 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IPath getFilePath() {" + NL + "\t\tIPath path = getContainerFullPath();" + NL + "\t\tif (path == null) {" + NL + "\t\t\tpath = new Path(\"\"); //$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\tString fileName = getFileName();" + NL + "\t\tif (fileName != null) {" + NL + "\t\t\tpath = path.append(fileName);" + NL + "\t\t}" + NL + "\t\treturn path;" + NL + "\t}";
+ protected final String TEXT_16 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent) {" + NL + "\t\tsuper.createControl(parent);" + NL + "\t\tsetFileName(";
+ protected final String TEXT_17 = ".getUniqueFileName(" + NL + "\t\t\t\tgetContainerFullPath(), getFileName(), getExtension()));" + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validatePage() {" + NL + "\t\tif (!super.validatePage()) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tString extension = getExtension();" + NL + "\t\tif (extension != null && !getFilePath().toString().endsWith(\".\" + extension)) {" + NL + "\t\t\tsetErrorMessage(NLS.bind(\"File name should have ''{0}'' extension.\", extension));" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}" + NL + "}";
public String generate(Object argument)
{
@@ -43,45 +42,44 @@ final GenEditorGenerator editorGen = genDiagram.getEditorGen();
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final GenApplication application = editorGen.getApplication();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
if (application == null) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.WizardNewFileCreationPage"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
} else {
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName(application.getPackageName() + ".WizardNewFileCreationPage"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
}
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
if (application == null) {
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
} else {
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
}
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
if (application == null) {
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
}
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName(genDiagram.getDiagramEditorUtilQualifiedClassName()));
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/EditorGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/EditorGenerator.java
index 566572524..f83f6cb37 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/EditorGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/EditorGenerator.java
@@ -16,112 +16,111 @@ public class EditorGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.gef.palette.PaletteRoot;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;" + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends DiagramDocumentEditor";
- protected final String TEXT_7 = NL + "\t\timplements ";
- protected final String TEXT_8 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
- protected final String TEXT_9 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_10 = "() {" + NL + "\t\tsuper(";
- protected final String TEXT_11 = ");" + NL + "\t}" + NL;
- protected final String TEXT_12 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {" + NL + "\t\tPaletteRoot root = super.createPaletteRoot(existingPaletteRoot);" + NL + "\t\tnew ";
- protected final String TEXT_13 = "().fillPalette(root);" + NL + "\t\treturn root;" + NL + "\t}";
- protected final String TEXT_14 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_15 = " getPreferencesHint() {";
- protected final String TEXT_16 = NL + "\t\treturn ";
- protected final String TEXT_17 = ".DIAGRAM_PREFERENCES_HINT;" + NL + "\t}";
- protected final String TEXT_18 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getContributorId() {" + NL + "\t\treturn ";
- protected final String TEXT_19 = ".ID;" + NL + "\t}";
- protected final String TEXT_20 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == ";
- protected final String TEXT_21 = ".class) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}";
- protected final String TEXT_22 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_23 = " getDocumentProvider(";
- protected final String TEXT_24 = " input) {" + NL + "\t\tif (";
- protected final String TEXT_25 = "input instanceof ";
- protected final String TEXT_26 = " || ";
- protected final String TEXT_27 = "input instanceof ";
- protected final String TEXT_28 = ") {" + NL + "\t\t\treturn ";
- protected final String TEXT_29 = ".getInstance().getDocumentProvider();" + NL + "\t\t}" + NL + "\t\treturn super.getDocumentProvider(input);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " public ";
- protected final String TEXT_30 = " getEditingDomain() {" + NL + " \torg.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;" + NL + " \tif (document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {" + NL + " \t\treturn ((org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document).getEditingDomain();" + NL + " \t}" + NL + " return super.getEditingDomain();" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setDocumentProvider(";
- protected final String TEXT_31 = " input) {" + NL + "\t\tif (";
- protected final String TEXT_32 = "input instanceof ";
- protected final String TEXT_33 = " || ";
- protected final String TEXT_34 = "input instanceof ";
- protected final String TEXT_35 = ") {" + NL + "\t\t\tsetDocumentProvider(";
- protected final String TEXT_36 = ".getInstance().getDocumentProvider());" + NL + "\t\t} else {" + NL + "\t\t\tsuper.setDocumentProvider(input);" + NL + "\t\t}" + NL + "\t}" + NL + "\t";
- protected final String TEXT_37 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void gotoMarker(";
- protected final String TEXT_38 = " marker) {";
- protected final String TEXT_39 = NL + " ";
- protected final String TEXT_40 = ".getInstance().gotoMarker(this, marker);" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\tperformSaveAs(new ";
- protected final String TEXT_41 = "());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performSaveAs(";
- protected final String TEXT_42 = " progressMonitor) {" + NL + "\t\t";
- protected final String TEXT_43 = " shell = getSite().getShell();" + NL + "\t\t";
- protected final String TEXT_44 = " input = getEditorInput();" + NL + "\t\t";
- protected final String TEXT_45 = " dialog = new ";
- protected final String TEXT_46 = "(shell);" + NL + "\t\t";
- protected final String TEXT_47 = " original = input instanceof ";
- protected final String TEXT_48 = " ? ((";
- protected final String TEXT_49 = ") input).getFile() : null;" + NL + "\t\tif (original != null) {" + NL + "\t\t\tdialog.setOriginalFile(original);" + NL + "\t\t}" + NL + "\t\tdialog.create();" + NL + "\t\t";
- protected final String TEXT_50 = " provider = getDocumentProvider();" + NL + "\t\tif (provider == null) {" + NL + "\t\t\t// editor has been programmatically closed while the dialog was open" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (provider.isDeleted(input) && original != null) {" + NL + "\t\t\tString message = ";
- protected final String TEXT_51 = ".bind(\"The original file ''{0}'' has been deleted.\", original.getName());" + NL + "\t\t\tdialog.setErrorMessage(null);" + NL + "\t\t\tdialog.setMessage(message, ";
- protected final String TEXT_52 = ".WARNING);" + NL + "\t\t}" + NL + "\t\tif (dialog.open() == ";
- protected final String TEXT_53 = ".CANCEL) {" + NL + "\t\t\tif (progressMonitor != null) {" + NL + "\t\t\t\tprogressMonitor.setCanceled(true);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_54 = " filePath = dialog.getResult();" + NL + "\t\tif (filePath == null) {" + NL + "\t\t\tif (progressMonitor != null) {" + NL + "\t\t\t\tprogressMonitor.setCanceled(true);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_55 = " workspaceRoot = ";
- protected final String TEXT_56 = ".getWorkspace().getRoot();" + NL + "\t\t";
- protected final String TEXT_57 = " file = workspaceRoot.getFile(filePath);" + NL + "\t\tfinal ";
- protected final String TEXT_58 = " newInput = new ";
- protected final String TEXT_59 = "(file);" + NL + "\t\t// Check if the editor is already open" + NL + "\t\t";
- protected final String TEXT_60 = " matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();" + NL + "\t\t";
- protected final String TEXT_61 = "[] editorRefs = ";
- protected final String TEXT_62 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();" + NL + "\t\tfor (int i = 0; i < editorRefs.length; i++) {" + NL + "\t\t\tif (matchingStrategy.matches(editorRefs[i], newInput)) {" + NL + "\t\t\t\t";
- protected final String TEXT_63 = ".openWarning(shell, \"Problem During Save As...\", \"Save could not be completed. Target file is already open in another editor.\");" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tboolean success = false;" + NL + "\t\ttry {" + NL + "\t\t\tprovider.aboutToChange(newInput);" + NL + "\t\t\tgetDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);" + NL + "\t\t\tsuccess = true;" + NL + "\t\t} catch (";
- protected final String TEXT_64 = " x) {" + NL + "\t\t\t";
- protected final String TEXT_65 = " status = x.getStatus();" + NL + "\t\t\tif (status == null || status.getSeverity() != ";
- protected final String TEXT_66 = ".CANCEL) {" + NL + "\t\t\t\t";
- protected final String TEXT_67 = ".openError(shell, \"Save Problems\", \"Could not save file.\", x.getStatus());" + NL + "\t\t\t}" + NL + "\t\t} finally {" + NL + "\t\t\tprovider.changed(newInput);" + NL + "\t\t\tif (success) {" + NL + "\t\t\t\tsetInput(newInput);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (progressMonitor != null) {" + NL + "\t\t\tprogressMonitor.setCanceled(!success);" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_68 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void initializeGraphicalViewer() {" + NL + "\t\tsuper.initializeGraphicalViewer();" + NL + "\t\tgetDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), ";
- protected final String TEXT_69 = ".getTransfer()) {" + NL + "" + NL + "\t\t\tprotected Object getJavaObject(";
- protected final String TEXT_70 = " data) {" + NL + "\t\t\t\treturn ";
- protected final String TEXT_71 = ".getTransfer().nativeToJava(data);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t});" + NL + "\t\tgetDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), ";
- protected final String TEXT_72 = ".getInstance()) {" + NL + "" + NL + "\t\t\tprotected Object getJavaObject(";
- protected final String TEXT_73 = " data) {" + NL + "\t\t\t\treturn ";
- protected final String TEXT_74 = ".getInstance().nativeToJava(data);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t});" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate abstract class DropTargetListener extends ";
- protected final String TEXT_75 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DropTargetListener(";
- protected final String TEXT_76 = " viewer, ";
- protected final String TEXT_77 = " xfer) {" + NL + "\t\t\tsuper(viewer, xfer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_78 = " getObjectsBeingDropped() {" + NL + "\t\t\t";
- protected final String TEXT_79 = " data = getCurrentEvent().currentDataType;" + NL + "\t\t\t";
- protected final String TEXT_80 = " uris = new ";
- protected final String TEXT_81 = "();" + NL + "" + NL + "\t\t\tObject transferedObject = getJavaObject(data);" + NL + "\t\t\tif (transferedObject instanceof ";
- protected final String TEXT_82 = ") {" + NL + "\t\t\t\t";
- protected final String TEXT_83 = " selection = (";
- protected final String TEXT_84 = ") transferedObject;" + NL + "\t\t\t\tfor (";
- protected final String TEXT_85 = " it = selection.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tObject nextSelectedObject = it.next();";
- protected final String TEXT_86 = NL + "\t\t\t\t\tif (nextSelectedObject instanceof ";
- protected final String TEXT_87 = ") {" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_88 = " view = ((";
- protected final String TEXT_89 = ") nextSelectedObject).getView();" + NL + "\t\t\t\t\t\tnextSelectedObject = view.getElement();" + NL + "\t\t\t\t\t} else ";
- protected final String TEXT_90 = "if (nextSelectedObject instanceof ";
- protected final String TEXT_91 = ") {" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_92 = " adaptable = (";
- protected final String TEXT_93 = ") nextSelectedObject;" + NL + "\t\t\t\t\t\tnextSelectedObject = adaptable.getAdapter(";
- protected final String TEXT_94 = ".class);" + NL + "\t\t\t\t\t}" + NL + "\t" + NL + "\t\t\t\t\tif (nextSelectedObject instanceof ";
- protected final String TEXT_95 = ") {" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_96 = " modelElement = (";
- protected final String TEXT_97 = ") nextSelectedObject;" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_98 = " modelElementResource = modelElement.eResource();" + NL + "\t\t\t\t\t\turis.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));\t" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t";
- protected final String TEXT_99 = " result = new ";
- protected final String TEXT_100 = "();" + NL + "\t\t\tfor (";
- protected final String TEXT_101 = " it = uris.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
- protected final String TEXT_102 = " nextURI = (";
- protected final String TEXT_103 = ") it.next();" + NL + "\t\t\t\t";
- protected final String TEXT_104 = " modelObject = getEditingDomain().getResourceSet().getEObject(nextURI, true);" + NL + "\t\t\t\tresult.add(modelObject);" + NL + "\t\t\t}" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract Object getJavaObject(";
- protected final String TEXT_105 = " data);" + NL + "\t" + NL + "\t}";
- protected final String TEXT_106 = NL + "\t" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.gef.palette.PaletteRoot;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;" + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends DiagramDocumentEditor";
+ protected final String TEXT_6 = NL + "\t\timplements ";
+ protected final String TEXT_7 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
+ protected final String TEXT_8 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_9 = "() {" + NL + "\t\tsuper(";
+ protected final String TEXT_10 = ");" + NL + "\t}" + NL;
+ protected final String TEXT_11 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {" + NL + "\t\tPaletteRoot root = super.createPaletteRoot(existingPaletteRoot);" + NL + "\t\tnew ";
+ protected final String TEXT_12 = "().fillPalette(root);" + NL + "\t\treturn root;" + NL + "\t}";
+ protected final String TEXT_13 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_14 = " getPreferencesHint() {";
+ protected final String TEXT_15 = NL + "\t\treturn ";
+ protected final String TEXT_16 = ".DIAGRAM_PREFERENCES_HINT;" + NL + "\t}";
+ protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getContributorId() {" + NL + "\t\treturn ";
+ protected final String TEXT_18 = ".ID;" + NL + "\t}";
+ protected final String TEXT_19 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == ";
+ protected final String TEXT_20 = ".class) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}";
+ protected final String TEXT_21 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_22 = " getDocumentProvider(";
+ protected final String TEXT_23 = " input) {" + NL + "\t\tif (";
+ protected final String TEXT_24 = "input instanceof ";
+ protected final String TEXT_25 = " || ";
+ protected final String TEXT_26 = "input instanceof ";
+ protected final String TEXT_27 = ") {" + NL + "\t\t\treturn ";
+ protected final String TEXT_28 = ".getInstance().getDocumentProvider();" + NL + "\t\t}" + NL + "\t\treturn super.getDocumentProvider(input);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + " public ";
+ protected final String TEXT_29 = " getEditingDomain() {" + NL + " \torg.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;" + NL + " \tif (document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {" + NL + " \t\treturn ((org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document).getEditingDomain();" + NL + " \t}" + NL + " return super.getEditingDomain();" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setDocumentProvider(";
+ protected final String TEXT_30 = " input) {" + NL + "\t\tif (";
+ protected final String TEXT_31 = "input instanceof ";
+ protected final String TEXT_32 = " || ";
+ protected final String TEXT_33 = "input instanceof ";
+ protected final String TEXT_34 = ") {" + NL + "\t\t\tsetDocumentProvider(";
+ protected final String TEXT_35 = ".getInstance().getDocumentProvider());" + NL + "\t\t} else {" + NL + "\t\t\tsuper.setDocumentProvider(input);" + NL + "\t\t}" + NL + "\t}" + NL + "\t";
+ protected final String TEXT_36 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void gotoMarker(";
+ protected final String TEXT_37 = " marker) {";
+ protected final String TEXT_38 = NL + " ";
+ protected final String TEXT_39 = ".getInstance().gotoMarker(this, marker);" + NL + " }" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\tperformSaveAs(new ";
+ protected final String TEXT_40 = "());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void performSaveAs(";
+ protected final String TEXT_41 = " progressMonitor) {" + NL + "\t\t";
+ protected final String TEXT_42 = " shell = getSite().getShell();" + NL + "\t\t";
+ protected final String TEXT_43 = " input = getEditorInput();" + NL + "\t\t";
+ protected final String TEXT_44 = " dialog = new ";
+ protected final String TEXT_45 = "(shell);" + NL + "\t\t";
+ protected final String TEXT_46 = " original = input instanceof ";
+ protected final String TEXT_47 = " ? ((";
+ protected final String TEXT_48 = ") input).getFile() : null;" + NL + "\t\tif (original != null) {" + NL + "\t\t\tdialog.setOriginalFile(original);" + NL + "\t\t}" + NL + "\t\tdialog.create();" + NL + "\t\t";
+ protected final String TEXT_49 = " provider = getDocumentProvider();" + NL + "\t\tif (provider == null) {" + NL + "\t\t\t// editor has been programmatically closed while the dialog was open" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (provider.isDeleted(input) && original != null) {" + NL + "\t\t\tString message = ";
+ protected final String TEXT_50 = ".bind(\"The original file ''{0}'' has been deleted.\", original.getName());" + NL + "\t\t\tdialog.setErrorMessage(null);" + NL + "\t\t\tdialog.setMessage(message, ";
+ protected final String TEXT_51 = ".WARNING);" + NL + "\t\t}" + NL + "\t\tif (dialog.open() == ";
+ protected final String TEXT_52 = ".CANCEL) {" + NL + "\t\t\tif (progressMonitor != null) {" + NL + "\t\t\t\tprogressMonitor.setCanceled(true);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_53 = " filePath = dialog.getResult();" + NL + "\t\tif (filePath == null) {" + NL + "\t\t\tif (progressMonitor != null) {" + NL + "\t\t\t\tprogressMonitor.setCanceled(true);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_54 = " workspaceRoot = ";
+ protected final String TEXT_55 = ".getWorkspace().getRoot();" + NL + "\t\t";
+ protected final String TEXT_56 = " file = workspaceRoot.getFile(filePath);" + NL + "\t\tfinal ";
+ protected final String TEXT_57 = " newInput = new ";
+ protected final String TEXT_58 = "(file);" + NL + "\t\t// Check if the editor is already open" + NL + "\t\t";
+ protected final String TEXT_59 = " matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();" + NL + "\t\t";
+ protected final String TEXT_60 = "[] editorRefs = ";
+ protected final String TEXT_61 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();" + NL + "\t\tfor (int i = 0; i < editorRefs.length; i++) {" + NL + "\t\t\tif (matchingStrategy.matches(editorRefs[i], newInput)) {" + NL + "\t\t\t\t";
+ protected final String TEXT_62 = ".openWarning(shell, \"Problem During Save As...\", \"Save could not be completed. Target file is already open in another editor.\");" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tboolean success = false;" + NL + "\t\ttry {" + NL + "\t\t\tprovider.aboutToChange(newInput);" + NL + "\t\t\tgetDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);" + NL + "\t\t\tsuccess = true;" + NL + "\t\t} catch (";
+ protected final String TEXT_63 = " x) {" + NL + "\t\t\t";
+ protected final String TEXT_64 = " status = x.getStatus();" + NL + "\t\t\tif (status == null || status.getSeverity() != ";
+ protected final String TEXT_65 = ".CANCEL) {" + NL + "\t\t\t\t";
+ protected final String TEXT_66 = ".openError(shell, \"Save Problems\", \"Could not save file.\", x.getStatus());" + NL + "\t\t\t}" + NL + "\t\t} finally {" + NL + "\t\t\tprovider.changed(newInput);" + NL + "\t\t\tif (success) {" + NL + "\t\t\t\tsetInput(newInput);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (progressMonitor != null) {" + NL + "\t\t\tprogressMonitor.setCanceled(!success);" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_67 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void initializeGraphicalViewer() {" + NL + "\t\tsuper.initializeGraphicalViewer();" + NL + "\t\tgetDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), ";
+ protected final String TEXT_68 = ".getTransfer()) {" + NL + "" + NL + "\t\t\tprotected Object getJavaObject(";
+ protected final String TEXT_69 = " data) {" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_70 = ".getTransfer().nativeToJava(data);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t});" + NL + "\t\tgetDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), ";
+ protected final String TEXT_71 = ".getInstance()) {" + NL + "" + NL + "\t\t\tprotected Object getJavaObject(";
+ protected final String TEXT_72 = " data) {" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_73 = ".getInstance().nativeToJava(data);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t});" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate abstract class DropTargetListener extends ";
+ protected final String TEXT_74 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DropTargetListener(";
+ protected final String TEXT_75 = " viewer, ";
+ protected final String TEXT_76 = " xfer) {" + NL + "\t\t\tsuper(viewer, xfer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_77 = " getObjectsBeingDropped() {" + NL + "\t\t\t";
+ protected final String TEXT_78 = " data = getCurrentEvent().currentDataType;" + NL + "\t\t\t";
+ protected final String TEXT_79 = " uris = new ";
+ protected final String TEXT_80 = "();" + NL + "" + NL + "\t\t\tObject transferedObject = getJavaObject(data);" + NL + "\t\t\tif (transferedObject instanceof ";
+ protected final String TEXT_81 = ") {" + NL + "\t\t\t\t";
+ protected final String TEXT_82 = " selection = (";
+ protected final String TEXT_83 = ") transferedObject;" + NL + "\t\t\t\tfor (";
+ protected final String TEXT_84 = " it = selection.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tObject nextSelectedObject = it.next();";
+ protected final String TEXT_85 = NL + "\t\t\t\t\tif (nextSelectedObject instanceof ";
+ protected final String TEXT_86 = ") {" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_87 = " view = ((";
+ protected final String TEXT_88 = ") nextSelectedObject).getView();" + NL + "\t\t\t\t\t\tnextSelectedObject = view.getElement();" + NL + "\t\t\t\t\t} else ";
+ protected final String TEXT_89 = "if (nextSelectedObject instanceof ";
+ protected final String TEXT_90 = ") {" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_91 = " adaptable = (";
+ protected final String TEXT_92 = ") nextSelectedObject;" + NL + "\t\t\t\t\t\tnextSelectedObject = adaptable.getAdapter(";
+ protected final String TEXT_93 = ".class);" + NL + "\t\t\t\t\t}" + NL + "\t" + NL + "\t\t\t\t\tif (nextSelectedObject instanceof ";
+ protected final String TEXT_94 = ") {" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_95 = " modelElement = (";
+ protected final String TEXT_96 = ") nextSelectedObject;" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_97 = " modelElementResource = modelElement.eResource();" + NL + "\t\t\t\t\t\turis.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));\t" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t";
+ protected final String TEXT_98 = " result = new ";
+ protected final String TEXT_99 = "();" + NL + "\t\t\tfor (";
+ protected final String TEXT_100 = " it = uris.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
+ protected final String TEXT_101 = " nextURI = (";
+ protected final String TEXT_102 = ") it.next();" + NL + "\t\t\t\t";
+ protected final String TEXT_103 = " modelObject = getEditingDomain().getResourceSet().getEObject(nextURI, true);" + NL + "\t\t\t\tresult.add(modelObject);" + NL + "\t\t\t}" + NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected abstract Object getJavaObject(";
+ protected final String TEXT_104 = " data);" + NL + "\t" + NL + "\t}";
+ protected final String TEXT_105 = NL + "\t" + NL + "}";
public String generate(Object argument)
{
@@ -133,21 +132,20 @@ final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]
final GenPropertySheet propertySheet = genDiagram.getEditorGen().getPropertySheet();
importManager.registerInnerClass("DropTargetListener");
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
Set<String> ifaces = new LinkedHashSet<String>();
if (genEditor.getEditorGen().getApplication() == null) {
@@ -158,185 +156,187 @@ if (propertySheet != null && propertySheet.isReadOnly()) {
}
if (!ifaces.isEmpty()) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(ifaces.toString().substring(1, ifaces.toString().length() - 1));
}
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(genEditor.getID());
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(genDiagram.getPalette() != null && genDiagram.getPalette().isFlyout());
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
if (genDiagram.getPalette() != null) {
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
}
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
/*XXX seems better we use preference store directly (in configureGraphicalViewer) instead all these indirect ids */
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(genDiagram.getEditorGen().getPlugin().getActivatorClassName());
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
if (genDiagram.getEditorGen().getPropertySheet() != null) { /*perhaps, we should override contributor id regardless of sheet presence, there's no much sense in default id either.*/
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(genDiagram.getEditorGen().getPlugin().getActivatorClassName());
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
} else {
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.views.properties.IPropertySheetPage"));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
}
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider"));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
if (genDiagram.getEditorGen().getApplication() == null) {
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
}
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput"));
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName("TransactionalEditingDomain"));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
if (genDiagram.getEditorGen().getApplication() == null) {
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
}
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput"));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
if (genDiagram.getEditorGen().getApplication() == null) {
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IMarker"));
+ stringBuffer.append(TEXT_37);
stringBuffer.append(TEXT_38);
- stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService"));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.NullProgressMonitor"));
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor"));
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Shell"));
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
+ stringBuffer.append(TEXT_43);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.SaveAsDialog"));
stringBuffer.append(TEXT_44);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.SaveAsDialog"));
stringBuffer.append(TEXT_45);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.dialogs.SaveAsDialog"));
- stringBuffer.append(TEXT_46);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile"));
+ stringBuffer.append(TEXT_46);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
stringBuffer.append(TEXT_47);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
stringBuffer.append(TEXT_48);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider"));
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.osgi.util.NLS"));
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.IMessageProvider"));
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.window.Window"));
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IPath"));
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IWorkspaceRoot"));
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin"));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile"));
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.FileEditorInput"));
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorMatchingStrategy"));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorReference"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI"));
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog"));
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.CoreException"));
+ stringBuffer.append(TEXT_63);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus"));
stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus"));
stringBuffer.append(TEXT_65);
- stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus"));
- stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.ErrorDialog"));
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
}
if (genDiagram.generateCreateShortcutAction()) {
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.util.LocalSelectionTransfer"));
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.dnd.TransferData"));
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.util.LocalSelectionTransfer"));
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_70);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.dnd.LocalTransfer"));
- stringBuffer.append(TEXT_72);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.dnd.TransferData"));
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_72);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.dnd.LocalTransfer"));
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_73);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener"));
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_74);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPartViewer"));
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_75);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.dnd.Transfer"));
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_76);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.dnd.TransferData"));
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_79);
stringBuffer.append(importManager.getImportedName("java.util.HashSet"));
+ stringBuffer.append(TEXT_80);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
stringBuffer.append(TEXT_81);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
stringBuffer.append(TEXT_82);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
stringBuffer.append(TEXT_83);
- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
- stringBuffer.append(TEXT_84);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_84);
/*
* TODO: move NavigatorItem to some place available in runtime and remove
* "genEditor.getEditorGen().getNavigator() != null" test
*/
if (genEditor.getEditorGen().getNavigator() != null) {
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName(genEditor.getEditorGen().getNavigator().getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(importManager.getImportedName(genEditor.getEditorGen().getNavigator().getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_88);
}
+ stringBuffer.append(TEXT_89);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
stringBuffer.append(TEXT_90);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
stringBuffer.append(TEXT_91);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
stringBuffer.append(TEXT_92);
- stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_93);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_94);
@@ -344,26 +344,24 @@ if (genDiagram.generateCreateShortcutAction()) {
stringBuffer.append(TEXT_95);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_96);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_97);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_97);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_99);
+ stringBuffer.append(TEXT_98);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_99);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_100);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI"));
stringBuffer.append(TEXT_101);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI"));
stringBuffer.append(TEXT_102);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI"));
- stringBuffer.append(TEXT_103);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_103);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.dnd.TransferData"));
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_104);
}
- stringBuffer.append(TEXT_106);
+ stringBuffer.append(TEXT_105);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java
index d799ae33b..75234bd99 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/ElementChooserGenerator.java
@@ -16,31 +16,30 @@ public class ElementChooserGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.util.Collections;" + NL + "" + NL + "import org.eclipse.core.resources.IContainer;" + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;" + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "import org.eclipse.emf.common.util.WrappedException;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.emf.ecore.resource.ResourceSet;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.core.services.ViewService;" + NL + "import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;" + NL + "import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;" + NL + "import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;" + NL + "import org.eclipse.gmf.runtime.notation.Node;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.jface.dialogs.Dialog;" + NL + "import org.eclipse.jface.dialogs.IDialogConstants;" + NL + "import org.eclipse.jface.viewers.ILabelProvider;" + NL + "import org.eclipse.jface.viewers.ILabelProviderListener;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.viewers.ITreeContentProvider;" + NL + "import org.eclipse.jface.viewers.SelectionChangedEvent;" + NL + "import org.eclipse.jface.viewers.TreeViewer;" + NL + "import org.eclipse.jface.viewers.Viewer;" + NL + "import org.eclipse.jface.viewers.ViewerFilter;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.Control;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.model.WorkbenchLabelProvider;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends Dialog {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate TreeViewer myTreeViewer;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_7 = " mySelectedModelElementURI;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate View myView;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_8 = " myEditingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_9 = "(Shell parentShell, View view) {" + NL + "\t\tsuper(parentShell);" + NL + "\t\tsetShellStyle(getShellStyle() | SWT.RESIZE);" + NL + "\t\tmyView = view;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createDialogArea(Composite parent) {" + NL + "\t\tComposite composite = (Composite) super.createDialogArea(parent);" + NL + "\t\tgetShell().setText(\"Select model element\");" + NL + "\t\tcreateModelBrowser(composite);" + NL + "\t\treturn composite;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createButtonBar(Composite parent) {" + NL + "\t\tControl buttonBar = super.createButtonBar(parent);" + NL + "\t\tsetOkButtonEnabled(false);" + NL + "\t\treturn buttonBar;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createModelBrowser(Composite composite) {" + NL + "\t\tmyTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);" + NL + "\t\tGridData layoutData = new GridData(GridData.FILL_BOTH);" + NL + "\t\tlayoutData.heightHint = 300;" + NL + "\t\tlayoutData.widthHint = 300;" + NL + "\t\tmyTreeViewer.getTree().setLayoutData(layoutData);" + NL + "\t\tmyTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());" + NL + "\t\tmyTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());" + NL + "\t\tmyTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());" + NL + "\t\tmyTreeViewer.addFilter(new ModelFilesFilter());" + NL + "\t\tmyTreeViewer.addSelectionChangedListener(new OkButtonEnabler());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setOkButtonEnabled(boolean enabled) {" + NL + "\t\tgetButton(IDialogConstants.OK_ID).setEnabled(enabled);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isValidModelFile(IFile file) {" + NL + "\t\tString fileExtension = file.getFullPath().getFileExtension();" + NL + "\t\treturn ";
- protected final String TEXT_10 = NL + "\t\t\t\"";
- protected final String TEXT_11 = "\".equals(fileExtension) ";
- protected final String TEXT_12 = NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getSelectedModelElementURI() {" + NL + "\t\treturn mySelectedModelElementURI;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int open() {" + NL + "\t\tint result = super.open();" + NL + "\t\tfor (";
- protected final String TEXT_13 = " it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {" + NL + "\t\t\t";
- protected final String TEXT_14 = " resource = (";
- protected final String TEXT_15 = ") it.next();" + NL + "\t\t\tresource.unload();" + NL + "\t\t}" + NL + "\t\tmyEditingDomain.dispose();" + NL + "\t\treturn result;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeContentProvider implements ITreeContentProvider {" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate ITreeContentProvider myWorkbenchContentProvider = new ";
- protected final String TEXT_16 = "();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(" + NL + "\t\t\t\t";
- protected final String TEXT_17 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getChildren(Object parentElement) {" + NL + "\t\t\tObject[] result = myWorkbenchContentProvider.getChildren(parentElement);" + NL + "\t\t\tif (result != null && result.length > 0) {" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\tif (parentElement instanceof IFile) {" + NL + "\t\t\t\tIFile modelFile = (IFile) parentElement;" + NL + "\t\t\t\tIPath resourcePath = modelFile.getFullPath();" + NL + "\t\t\t\tResourceSet resourceSet = myEditingDomain.getResourceSet();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tResource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resourcePath.toString(), true), true);" + NL + "\t\t\t\t\treturn myAdapterFctoryContentProvier.getChildren(modelResource);" + NL + "\t\t\t\t} catch (WrappedException e) {" + NL + "\t\t\t\t\t";
- protected final String TEXT_18 = ".getInstance().logError(" + NL + "\t\t\t\t\t\t\t\"Unable to load resource: \" + resourcePath.toString(), e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Collections.EMPTY_LIST.toArray();" + NL + "\t\t\t}" + NL + "\t\t\treturn myAdapterFctoryContentProvier.getChildren(parentElement);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object getParent(Object element) {" + NL + "\t\t\tObject parent = myWorkbenchContentProvider.getParent(element);" + NL + "\t\t\tif (parent != null) {" + NL + "\t\t\t\treturn parent;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof EObject) {" + NL + "\t\t\t\tEObject eObject = (EObject) element;" + NL + "\t\t\t\tif (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {" + NL + "\t\t\t\t\tString path = eObject.eResource().getURI().path();" + NL + "\t\t\t\t\treturn ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn myAdapterFctoryContentProvier.getParent(eObject);" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean hasChildren(Object element) {" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\treturn isValidModelFile((IFile) element);" + NL + "\t\t\t}" + NL + "\t\t\treturn myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getElements(Object inputElement) {" + NL + "\t\t\tObject[] elements = myWorkbenchContentProvider.getElements(inputElement);" + NL + "\t\t\treturn elements;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchContentProvider.dispose();" + NL + "\t\t\tmyAdapterFctoryContentProvier.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void inputChanged(Viewer viewer, Object oldInput, Object newInput) {" + NL + "\t\t\tmyWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t\tmyAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeLabelProvider implements ILabelProvider {" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(" + NL + "\t\t\t\t";
- protected final String TEXT_19 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Image getImage(Object element) {" + NL + "\t\t\tImage result = myWorkbenchLabelProvider.getImage(element);" + NL + "\t\t\treturn result != null ? result : myAdapterFactoryLabelProvider.getImage(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getText(Object element) {" + NL + "\t\t\tString result = myWorkbenchLabelProvider.getText(element);" + NL + "\t\t\treturn result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.addListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.addListener(listener);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchLabelProvider.dispose();" + NL + "\t\t\tmyAdapterFactoryLabelProvider.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isLabelProperty(Object element, String property) {" + NL + "\t\t\treturn myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.removeListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.removeListener(listener);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelFilesFilter extends ViewerFilter {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean select(Viewer viewer, Object parentElement, Object element) {" + NL + "\t\t\tif (element instanceof IContainer) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\tIFile file = (IFile) element;" + NL + "\t\t\t\treturn isValidModelFile(file);" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OkButtonEnabler implements ISelectionChangedListener {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectionChanged(SelectionChangedEvent event) {" + NL + "\t\t\tif (event.getSelection() instanceof IStructuredSelection) {" + NL + "\t\t\t\tIStructuredSelection selection = (IStructuredSelection) event.getSelection();" + NL + "\t\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\t\tif (selectedElement instanceof ";
- protected final String TEXT_20 = ") {" + NL + "\t\t\t\t\t\tselectedElement = ((";
- protected final String TEXT_21 = ") selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof ";
- protected final String TEXT_22 = ".Entry) {" + NL + "\t\t\t\t\t\tselectedElement = ((";
- protected final String TEXT_23 = ".Entry) selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof EObject) {" + NL + "\t\t\t\t\t\tEObject selectedModelElement = (EObject) selectedElement;" + NL + "\t\t\t\t\t\tsetOkButtonEnabled(ViewService.getInstance().provides(Node.class, new EObjectAdapter(selectedModelElement), myView, null, ViewUtil.APPEND," + NL + "\t\t\t\t\t\t\t\ttrue, ";
- protected final String TEXT_24 = ".DIAGRAM_PREFERENCES_HINT));" + NL + "\t\t\t\t\t\tmySelectedModelElementURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(selectedModelElement);" + NL + "\t\t\t\t\t\treturn;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tmySelectedModelElementURI = null;" + NL + "\t\t\tsetOkButtonEnabled(false);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_25 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.util.Collections;" + NL + "" + NL + "import org.eclipse.core.resources.IContainer;" + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;" + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "import org.eclipse.emf.common.util.WrappedException;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.emf.ecore.resource.ResourceSet;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.core.services.ViewService;" + NL + "import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;" + NL + "import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;" + NL + "import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;" + NL + "import org.eclipse.gmf.runtime.notation.Node;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.jface.dialogs.Dialog;" + NL + "import org.eclipse.jface.dialogs.IDialogConstants;" + NL + "import org.eclipse.jface.viewers.ILabelProvider;" + NL + "import org.eclipse.jface.viewers.ILabelProviderListener;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.viewers.ITreeContentProvider;" + NL + "import org.eclipse.jface.viewers.SelectionChangedEvent;" + NL + "import org.eclipse.jface.viewers.TreeViewer;" + NL + "import org.eclipse.jface.viewers.Viewer;" + NL + "import org.eclipse.jface.viewers.ViewerFilter;" + NL + "import org.eclipse.swt.SWT;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.Control;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.model.WorkbenchLabelProvider;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends Dialog {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate TreeViewer myTreeViewer;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_6 = " mySelectedModelElementURI;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate View myView;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_7 = " myEditingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_8 = "(Shell parentShell, View view) {" + NL + "\t\tsuper(parentShell);" + NL + "\t\tsetShellStyle(getShellStyle() | SWT.RESIZE);" + NL + "\t\tmyView = view;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createDialogArea(Composite parent) {" + NL + "\t\tComposite composite = (Composite) super.createDialogArea(parent);" + NL + "\t\tgetShell().setText(\"Select model element\");" + NL + "\t\tcreateModelBrowser(composite);" + NL + "\t\treturn composite;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Control createButtonBar(Composite parent) {" + NL + "\t\tControl buttonBar = super.createButtonBar(parent);" + NL + "\t\tsetOkButtonEnabled(false);" + NL + "\t\treturn buttonBar;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createModelBrowser(Composite composite) {" + NL + "\t\tmyTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);" + NL + "\t\tGridData layoutData = new GridData(GridData.FILL_BOTH);" + NL + "\t\tlayoutData.heightHint = 300;" + NL + "\t\tlayoutData.widthHint = 300;" + NL + "\t\tmyTreeViewer.getTree().setLayoutData(layoutData);" + NL + "\t\tmyTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());" + NL + "\t\tmyTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());" + NL + "\t\tmyTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());" + NL + "\t\tmyTreeViewer.addFilter(new ModelFilesFilter());" + NL + "\t\tmyTreeViewer.addSelectionChangedListener(new OkButtonEnabler());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setOkButtonEnabled(boolean enabled) {" + NL + "\t\tgetButton(IDialogConstants.OK_ID).setEnabled(enabled);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isValidModelFile(IFile file) {" + NL + "\t\tString fileExtension = file.getFullPath().getFileExtension();" + NL + "\t\treturn ";
+ protected final String TEXT_9 = NL + "\t\t\t\"";
+ protected final String TEXT_10 = "\".equals(fileExtension) ";
+ protected final String TEXT_11 = NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getSelectedModelElementURI() {" + NL + "\t\treturn mySelectedModelElementURI;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int open() {" + NL + "\t\tint result = super.open();" + NL + "\t\tfor (";
+ protected final String TEXT_12 = " it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {" + NL + "\t\t\t";
+ protected final String TEXT_13 = " resource = (";
+ protected final String TEXT_14 = ") it.next();" + NL + "\t\t\tresource.unload();" + NL + "\t\t}" + NL + "\t\tmyEditingDomain.dispose();" + NL + "\t\treturn result;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeContentProvider implements ITreeContentProvider {" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate ITreeContentProvider myWorkbenchContentProvider = new ";
+ protected final String TEXT_15 = "();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(" + NL + "\t\t\t\t";
+ protected final String TEXT_16 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getChildren(Object parentElement) {" + NL + "\t\t\tObject[] result = myWorkbenchContentProvider.getChildren(parentElement);" + NL + "\t\t\tif (result != null && result.length > 0) {" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t\tif (parentElement instanceof IFile) {" + NL + "\t\t\t\tIFile modelFile = (IFile) parentElement;" + NL + "\t\t\t\tIPath resourcePath = modelFile.getFullPath();" + NL + "\t\t\t\tResourceSet resourceSet = myEditingDomain.getResourceSet();" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tResource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resourcePath.toString(), true), true);" + NL + "\t\t\t\t\treturn myAdapterFctoryContentProvier.getChildren(modelResource);" + NL + "\t\t\t\t} catch (WrappedException e) {" + NL + "\t\t\t\t\t";
+ protected final String TEXT_17 = ".getInstance().logError(" + NL + "\t\t\t\t\t\t\t\"Unable to load resource: \" + resourcePath.toString(), e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Collections.EMPTY_LIST.toArray();" + NL + "\t\t\t}" + NL + "\t\t\treturn myAdapterFctoryContentProvier.getChildren(parentElement);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object getParent(Object element) {" + NL + "\t\t\tObject parent = myWorkbenchContentProvider.getParent(element);" + NL + "\t\t\tif (parent != null) {" + NL + "\t\t\t\treturn parent;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof EObject) {" + NL + "\t\t\t\tEObject eObject = (EObject) element;" + NL + "\t\t\t\tif (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {" + NL + "\t\t\t\t\tString path = eObject.eResource().getURI().path();" + NL + "\t\t\t\t\treturn ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn myAdapterFctoryContentProvier.getParent(eObject);" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean hasChildren(Object element) {" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\treturn isValidModelFile((IFile) element);" + NL + "\t\t\t}" + NL + "\t\t\treturn myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object[] getElements(Object inputElement) {" + NL + "\t\t\tObject[] elements = myWorkbenchContentProvider.getElements(inputElement);" + NL + "\t\t\treturn elements;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchContentProvider.dispose();" + NL + "\t\t\tmyAdapterFctoryContentProvier.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void inputChanged(Viewer viewer, Object oldInput, Object newInput) {" + NL + "\t\t\tmyWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t\tmyAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelElementsTreeLabelProvider implements ILabelProvider {" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(" + NL + "\t\t\t\t";
+ protected final String TEXT_18 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Image getImage(Object element) {" + NL + "\t\t\tImage result = myWorkbenchLabelProvider.getImage(element);" + NL + "\t\t\treturn result != null ? result : myAdapterFactoryLabelProvider.getImage(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getText(Object element) {" + NL + "\t\t\tString result = myWorkbenchLabelProvider.getText(element);" + NL + "\t\t\treturn result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.addListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.addListener(listener);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void dispose() {" + NL + "\t\t\tmyWorkbenchLabelProvider.dispose();" + NL + "\t\t\tmyAdapterFactoryLabelProvider.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isLabelProperty(Object element, String property) {" + NL + "\t\t\treturn myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeListener(ILabelProviderListener listener) {" + NL + "\t\t\tmyWorkbenchLabelProvider.removeListener(listener);" + NL + "\t\t\tmyAdapterFactoryLabelProvider.removeListener(listener);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ModelFilesFilter extends ViewerFilter {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean select(Viewer viewer, Object parentElement, Object element) {" + NL + "\t\t\tif (element instanceof IContainer) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tif (element instanceof IFile) {" + NL + "\t\t\t\tIFile file = (IFile) element;" + NL + "\t\t\t\treturn isValidModelFile(file);" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OkButtonEnabler implements ISelectionChangedListener {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectionChanged(SelectionChangedEvent event) {" + NL + "\t\t\tif (event.getSelection() instanceof IStructuredSelection) {" + NL + "\t\t\t\tIStructuredSelection selection = (IStructuredSelection) event.getSelection();" + NL + "\t\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\t\tif (selectedElement instanceof ";
+ protected final String TEXT_19 = ") {" + NL + "\t\t\t\t\t\tselectedElement = ((";
+ protected final String TEXT_20 = ") selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof ";
+ protected final String TEXT_21 = ".Entry) {" + NL + "\t\t\t\t\t\tselectedElement = ((";
+ protected final String TEXT_22 = ".Entry) selectedElement).getValue();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (selectedElement instanceof EObject) {" + NL + "\t\t\t\t\t\tEObject selectedModelElement = (EObject) selectedElement;" + NL + "\t\t\t\t\t\tsetOkButtonEnabled(ViewService.getInstance().provides(Node.class, new EObjectAdapter(selectedModelElement), myView, null, ViewUtil.APPEND," + NL + "\t\t\t\t\t\t\t\ttrue, ";
+ protected final String TEXT_23 = ".DIAGRAM_PREFERENCES_HINT));" + NL + "\t\t\t\t\t\tmySelectedModelElementURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(selectedModelElement);" + NL + "\t\t\t\t\t\treturn;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tmySelectedModelElementURI = null;" + NL + "\t\t\tsetOkButtonEnabled(false);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_24 = NL;
public String generate(Object argument)
{
@@ -49,66 +48,65 @@ public class ElementChooserGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getElementChooserClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(genDiagram.getElementChooserClassName());
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
for (Iterator it = genDiagram.getContainsShortcutsTo().iterator(); it.hasNext();) {
String nextFileExtension = (String) it.next();
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(nextFileExtension);
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(it.hasNext() ? "||" : ";");
}
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
stringBuffer.append(TEXT_14);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
- stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getApplication() == null ?
"org.eclipse.ui.model.WorkbenchContentProvider" : "org.eclipse.ui.model.BaseWorkbenchContentProvider"));
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_18);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider"));
stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider"));
stringBuffer.append(TEXT_20);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap"));
stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap"));
stringBuffer.append(TEXT_22);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap"));
- stringBuffer.append(TEXT_23);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/LoadResourceActionGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/LoadResourceActionGenerator.java
index d256e62ad..f8b7b7002 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/LoadResourceActionGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/LoadResourceActionGenerator.java
@@ -15,16 +15,15 @@ public class LoadResourceActionGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog;" + 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.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\tLoadResourceDialog loadResourceDialog = new LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());" + NL + "\t\tloadResourceDialog.open();" + 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_8 = ") {" + NL + "\t\t\t\tmySelectedElement = (";
- protected final String TEXT_9 = ") 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_10 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog;" + 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.swt.widgets.Shell;" + NL + "import org.eclipse.ui.IObjectActionDelegate;" + NL + "import org.eclipse.ui.IWorkbenchPart;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " implements IObjectActionDelegate {" + NL + "" + NL + "\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\tLoadResourceDialog loadResourceDialog = new LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());" + NL + "\t\tloadResourceDialog.open();" + 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_7 = ") {" + NL + "\t\t\t\tmySelectedElement = (";
+ protected final String TEXT_8 = ") 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_9 = NL;
public String generate(Object argument)
{
@@ -33,29 +32,28 @@ public class LoadResourceActionGenerator
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getLoadResourceActionClassName());
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
stringBuffer.append(TEXT_8);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_9);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
index ab543653c..118e614b8 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/editor/PluginGenerator.java
@@ -17,26 +17,25 @@ public class PluginGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.IStatus;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.core.runtime.Platform;" + NL + "import org.eclipse.core.runtime.Status;" + NL + "" + NL + "import org.eclipse.emf.common.notify.AdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.IItemLabelProvider;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.jface.resource.ImageDescriptor;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.ui.plugin.AbstractUIPlugin;" + NL + "import org.osgi.framework.BundleContext;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractUIPlugin {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
- protected final String TEXT_7 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
- protected final String TEXT_8 = " instance;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory adapterFactory;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_9 = " myDocumentProvider;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_10 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void start(BundleContext context) throws Exception {" + NL + "\t\tsuper.start(context);" + NL + "\t\tinstance = this;" + NL + "\t\tPreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());" + NL + "\t\tadapterFactory = createAdapterFactory();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void stop(BundleContext context) throws Exception {" + NL + "\t\tadapterFactory.dispose();" + NL + "\t\tadapterFactory = null;" + NL + "\t\tinstance = null;" + NL + "\t\tsuper.stop(context);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_11 = " getInstance() {" + NL + "\t\treturn instance;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ComposedAdapterFactory createAdapterFactory() {" + NL + "\t\tList factories = new ArrayList();" + NL + "\t\tfillItemProviderFactories(factories);" + NL + "\t\treturn new ComposedAdapterFactory(factories);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void fillItemProviderFactories(List factories) {";
- protected final String TEXT_12 = NL + "\t\tfactories.add(new ";
- protected final String TEXT_13 = "());";
- protected final String TEXT_14 = NL + "\t\tfactories.add(new ResourceItemProviderAdapterFactory());" + NL + "\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic AdapterFactory getItemProvidersAdapterFactory() {" + NL + "\t\treturn adapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ImageDescriptor getItemImageDescriptor(Object item) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {";
- protected final String TEXT_15 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Respects images residing in any plug-in. If path is relative," + NL + "\t * then this bundle is looked up for the image, otherwise, for absolute " + NL + "\t * path, first segment is taken as id of plug-in with image" + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor findImageDescriptor(String path) {" + NL + "\t\tfinal IPath p = new Path(path);" + NL + "\t\tif (p.isAbsolute() && p.segmentCount() > 1) {" + NL + "\t\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());" + NL + "\t\t} else {" + NL + "\t\t\treturn getBundledImageDescriptor(p.makeAbsolute().toString());" + NL + "\t\t} " + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns string from plug-in's resource bundle" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getString(String key) {" + NL + "\t\treturn Platform.getResourceString(getInstance().getBundle(), \"%\" + key); //$NON-NLS-1$" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Returns an image for the image file at the given plug-in relative path." + NL + "\t * Client do not need to dispose this image. Images will be disposed automatically." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return image instance" + NL + "\t */" + NL + "\tpublic Image getBundledImage(String path) {" + NL + "\t\tImage image = getImageRegistry().get(path);" + NL + "\t\tif (image == null) {" + NL + "\t\t\tgetImageRegistry().put(path, getBundledImageDescriptor(path));" + NL + "\t\t\timage = getImageRegistry().get(path);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_16 = " getDocumentProvider() {" + NL + "\t\tif (myDocumentProvider == null) {" + NL + "\t\t\tmyDocumentProvider = new ";
- protected final String TEXT_17 = "();" + NL + "\t\t}" + NL + "\t\treturn myDocumentProvider;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error) {" + NL + "\t\tlogError(error, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error, Throwable throwable) {" + NL + "\t\tif (error == null && throwable != null) {" + NL + "\t\t\terror = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.ERROR, ";
- protected final String TEXT_18 = ".ID, IStatus.OK, error, throwable));" + NL + "\t\tdebug(error, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message) {" + NL + "\t\tlogInfo(message, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message, Throwable throwable) {" + NL + "\t\tif (message == null && throwable != null) {" + NL + "\t\t\tmessage = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.INFO, ";
- protected final String TEXT_19 = ".ID, IStatus.OK, message, throwable));" + NL + "\t\tdebug(message, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void debug(String message, Throwable throwable) {" + NL + "\t\tif (!isDebugging()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (message != null) {" + NL + "\t\t\tSystem.err.println(message);" + NL + "\t\t}" + NL + "\t\tif (throwable != null) {" + NL + "\t\t\tthrowable.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "}";
- protected final String TEXT_20 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IPath;" + NL + "import org.eclipse.core.runtime.IStatus;" + NL + "import org.eclipse.core.runtime.Path;" + NL + "import org.eclipse.core.runtime.Platform;" + NL + "import org.eclipse.core.runtime.Status;" + NL + "" + NL + "import org.eclipse.emf.common.notify.AdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.IItemLabelProvider;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.jface.resource.ImageDescriptor;" + NL + "import org.eclipse.swt.graphics.Image;" + NL + "import org.eclipse.ui.plugin.AbstractUIPlugin;" + NL + "import org.osgi.framework.BundleContext;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractUIPlugin {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
+ protected final String TEXT_6 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
+ protected final String TEXT_7 = " instance;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory adapterFactory;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_8 = " myDocumentProvider;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_9 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void start(BundleContext context) throws Exception {" + NL + "\t\tsuper.start(context);" + NL + "\t\tinstance = this;" + NL + "\t\tPreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());" + NL + "\t\tadapterFactory = createAdapterFactory();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void stop(BundleContext context) throws Exception {" + NL + "\t\tadapterFactory.dispose();" + NL + "\t\tadapterFactory = null;" + NL + "\t\tinstance = null;" + NL + "\t\tsuper.stop(context);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
+ protected final String TEXT_10 = " getInstance() {" + NL + "\t\treturn instance;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ComposedAdapterFactory createAdapterFactory() {" + NL + "\t\tList factories = new ArrayList();" + NL + "\t\tfillItemProviderFactories(factories);" + NL + "\t\treturn new ComposedAdapterFactory(factories);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void fillItemProviderFactories(List factories) {";
+ protected final String TEXT_11 = NL + "\t\tfactories.add(new ";
+ protected final String TEXT_12 = "());";
+ protected final String TEXT_13 = NL + "\t\tfactories.add(new ResourceItemProviderAdapterFactory());" + NL + "\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic AdapterFactory getItemProvidersAdapterFactory() {" + NL + "\t\treturn adapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ImageDescriptor getItemImageDescriptor(Object item) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {";
+ protected final String TEXT_14 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Respects images residing in any plug-in. If path is relative," + NL + "\t * then this bundle is looked up for the image, otherwise, for absolute " + NL + "\t * path, first segment is taken as id of plug-in with image" + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor findImageDescriptor(String path) {" + NL + "\t\tfinal IPath p = new Path(path);" + NL + "\t\tif (p.isAbsolute() && p.segmentCount() > 1) {" + NL + "\t\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());" + NL + "\t\t} else {" + NL + "\t\t\treturn getBundledImageDescriptor(p.makeAbsolute().toString());" + NL + "\t\t} " + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns string from plug-in's resource bundle" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String getString(String key) {" + NL + "\t\treturn Platform.getResourceString(getInstance().getBundle(), \"%\" + key); //$NON-NLS-1$" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Returns an image for the image file at the given plug-in relative path." + NL + "\t * Client do not need to dispose this image. Images will be disposed automatically." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return image instance" + NL + "\t */" + NL + "\tpublic Image getBundledImage(String path) {" + NL + "\t\tImage image = getImageRegistry().get(path);" + NL + "\t\tif (image == null) {" + NL + "\t\t\tgetImageRegistry().put(path, getBundledImageDescriptor(path));" + NL + "\t\t\timage = getImageRegistry().get(path);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_15 = " getDocumentProvider() {" + NL + "\t\tif (myDocumentProvider == null) {" + NL + "\t\t\tmyDocumentProvider = new ";
+ protected final String TEXT_16 = "();" + NL + "\t\t}" + NL + "\t\treturn myDocumentProvider;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error) {" + NL + "\t\tlogError(error, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error, Throwable throwable) {" + NL + "\t\tif (error == null && throwable != null) {" + NL + "\t\t\terror = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.ERROR, ";
+ protected final String TEXT_17 = ".ID, IStatus.OK, error, throwable));" + NL + "\t\tdebug(error, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message) {" + NL + "\t\tlogInfo(message, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message, Throwable throwable) {" + NL + "\t\tif (message == null && throwable != null) {" + NL + "\t\t\tmessage = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.INFO, ";
+ protected final String TEXT_18 = ".ID, IStatus.OK, message, throwable));" + NL + "\t\tdebug(message, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void debug(String message, Throwable throwable) {" + NL + "\t\tif (!isDebugging()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (message != null) {" + NL + "\t\t\tSystem.err.println(message);" + NL + "\t\t}" + NL + "\t\tif (throwable != null) {" + NL + "\t\t\tthrowable.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "}";
+ protected final String TEXT_19 = NL;
public String generate(Object argument)
{
@@ -47,55 +46,54 @@ final GenDiagram genDiagram = genPlugin.getEditorGen().getDiagram();
final EList genPackages = genPlugin.getEditorGen().getAllDomainGenPackages(true);
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genPlugin.getActivatorClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(genPlugin.getID());
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(genPlugin.getActivatorClassName());
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(genDiagram.getDocumentProviderQualifiedClassName()));
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(genPlugin.getActivatorClassName());
stringBuffer.append(TEXT_9);
stringBuffer.append(genPlugin.getActivatorClassName());
stringBuffer.append(TEXT_10);
- stringBuffer.append(genPlugin.getActivatorClassName());
- stringBuffer.append(TEXT_11);
for (int i = 0; i < genPackages.size(); i++) {
GenPackage genPackage = (GenPackage) genPackages.get(i);
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedItemProviderAdapterFactoryClassName()));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
}
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
// XXX dependency org.eclipse.emf.edit.ui is for ExtendedImageRegistry only.
// FIXME move image registry to plugin class code
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getDocumentProviderQualifiedClassName()));
stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName(genDiagram.getDocumentProviderQualifiedClassName()));
stringBuffer.append(TEXT_16);
- stringBuffer.append(importManager.getImportedName(genDiagram.getDocumentProviderQualifiedClassName()));
+ stringBuffer.append(genPlugin.getActivatorClassName());
stringBuffer.append(TEXT_17);
stringBuffer.append(genPlugin.getActivatorClassName());
stringBuffer.append(TEXT_18);
- stringBuffer.append(genPlugin.getActivatorClassName());
- stringBuffer.append(TEXT_19);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/AbstractExpressionGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/AbstractExpressionGenerator.java
index 3944852ad..9d432f922 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/AbstractExpressionGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/AbstractExpressionGenerator.java
@@ -15,22 +15,21 @@ public class AbstractExpressionGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public abstract class ";
- protected final String TEXT_7 = " {\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean.valueOf(Platform.getDebugOption(";
- protected final String TEXT_8 = ".getInstance().getBundle().getSymbolicName() + \"/debug/disableNoExprImplExceptionLog\")).booleanValue();" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final String body;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final EClassifier context;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate IStatus status = Status.OK_STATUS;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_9 = "(EClassifier context) {" + NL + "\t\tthis(null, context);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected ";
- protected final String TEXT_10 = "(String body, EClassifier context) {" + NL + "\t\tthis.body = body;" + NL + "\t\tthis.context = context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected void setStatus(int severity, String message, Throwable throwable) {\t\t" + NL + "\t\tString pluginID = ";
- protected final String TEXT_11 = ".ID;" + NL + "\t\tthis.status = new Status(severity, pluginID, -1, (message != null) ? message : \"\", throwable); //$NON-NLS-1$" + NL + "\t\tif(!this.status.isOK()) {" + NL + "\t\t\t";
- protected final String TEXT_12 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression problem:\" + message + \"body:\"+ body, throwable); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\t" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected abstract Object doEvaluate(Object context, Map env);" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context) {" + NL + "\t\treturn evaluate(context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context, Map env) {" + NL + "\t\tif(context().isInstance(context)) {" + NL + "\t\t\ttry {" + NL + "\t\t\t\treturn doEvaluate(context, env);" + NL + "\t\t\t} catch(Exception e) {" + NL + "\t\t\t\tif(DISABLED_NO_IMPL_EXCEPTION_LOG && e instanceof NoImplException) {" + NL + "\t\t\t\t\treturn null;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t";
- protected final String TEXT_13 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression evaluation failure: \" + body, e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic IStatus getStatus() {" + NL + "\t\treturn status;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic String body() {" + NL + "\t\treturn body;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EClassifier context() {" + NL + "\t\treturn context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic void assignTo(EStructuralFeature feature, EObject target) {" + NL + "\t\tObject value = evaluate(target);" + NL + "\t\tvalue = (value != null) ? performCast(value, feature) : null;" + NL + "\t\tif (feature.isMany()) {" + NL + "\t\t\tCollection destCollection = (Collection) target.eGet(feature);" + NL + "\t\t\tdestCollection.clear();" + NL + "\t\t\tif(value instanceof Collection) {" + NL + "\t\t\t\tCollection valueCollection = (Collection) value;" + NL + "\t\t\t\tfor (Iterator it = valueCollection.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tdestCollection.add(performCast(it.next(), feature));" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tdestCollection.add(value);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\ttarget.eSet(feature, value);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected Object performCast(Object value, ETypedElement targetType) {" + NL + "\t\tif(targetType.getEType() == null || targetType.getEType().getInstanceClass() == null) {" + NL + "\t\t\treturn value;" + NL + "\t\t}" + NL + "\t\tClass targetClass = targetType.getEType().getInstanceClass();\t" + NL + "\t\tif(value != null && value instanceof Number) {" + NL + "\t\t\tNumber num = (Number)value;" + NL + "\t\t\tClass valClass = value.getClass();\t\t\t" + NL + "\t\t\tClass targetWrapperClass = targetClass;" + NL + "\t\t\tif(targetClass.isPrimitive()) {" + NL + "\t\t\t\ttargetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);" + NL + "\t\t\t}\t\t\t" + NL + "\t\t\tif(valClass.equals(targetWrapperClass)) {" + NL + "\t\t\t\treturn value;\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tif(Number.class.isAssignableFrom(targetWrapperClass)) {" + NL + "\t\t\t\tif(targetWrapperClass.equals(Byte.class)) return new Byte(num.byteValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Integer.class)) return new Integer(num.intValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Short.class)) return new Short(num.shortValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Long.class)) return new Long(num.longValue());\t\t\t\t\t" + NL + "\t\t\t\tif(targetWrapperClass.equals(BigInteger.class)) return BigInteger.valueOf(num.longValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Float.class)) return new Float(num.floatValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Double.class)) return new Double(num.doubleValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(BigDecimal.class)) return new BigDecimal(num.doubleValue());" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn value;" + NL + "\t}\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static final ";
- protected final String TEXT_14 = " createNullExpression(EClassifier context) {" + NL + "\t\treturn new ";
- protected final String TEXT_15 = "(context) {" + NL + "\t\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\t\t// TODO - log entry about not provider available for this expression" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class NoImplException extends RuntimeException {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tpublic NoImplException(String message) {" + NL + "\t\t\tsuper(message);" + NL + "\t\t}" + NL + "\t}\t" + NL + "}";
- protected final String TEXT_16 = NL;
+ protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public abstract class ";
+ protected final String TEXT_6 = " {\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean.valueOf(Platform.getDebugOption(";
+ protected final String TEXT_7 = ".getInstance().getBundle().getSymbolicName() + \"/debug/disableNoExprImplExceptionLog\")).booleanValue();" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final String body;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final EClassifier context;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate IStatus status = Status.OK_STATUS;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_8 = "(EClassifier context) {" + NL + "\t\tthis(null, context);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected ";
+ protected final String TEXT_9 = "(String body, EClassifier context) {" + NL + "\t\tthis.body = body;" + NL + "\t\tthis.context = context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected void setStatus(int severity, String message, Throwable throwable) {\t\t" + NL + "\t\tString pluginID = ";
+ protected final String TEXT_10 = ".ID;" + NL + "\t\tthis.status = new Status(severity, pluginID, -1, (message != null) ? message : \"\", throwable); //$NON-NLS-1$" + NL + "\t\tif(!this.status.isOK()) {" + NL + "\t\t\t";
+ protected final String TEXT_11 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression problem:\" + message + \"body:\"+ body, throwable); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\t" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected abstract Object doEvaluate(Object context, Map env);" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context) {" + NL + "\t\treturn evaluate(context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context, Map env) {" + NL + "\t\tif(context().isInstance(context)) {" + NL + "\t\t\ttry {" + NL + "\t\t\t\treturn doEvaluate(context, env);" + NL + "\t\t\t} catch(Exception e) {" + NL + "\t\t\t\tif(DISABLED_NO_IMPL_EXCEPTION_LOG && e instanceof NoImplException) {" + NL + "\t\t\t\t\treturn null;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t";
+ protected final String TEXT_12 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression evaluation failure: \" + body, e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic IStatus getStatus() {" + NL + "\t\treturn status;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic String body() {" + NL + "\t\treturn body;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EClassifier context() {" + NL + "\t\treturn context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic void assignTo(EStructuralFeature feature, EObject target) {" + NL + "\t\tObject value = evaluate(target);" + NL + "\t\tvalue = (value != null) ? performCast(value, feature) : null;" + NL + "\t\tif (feature.isMany()) {" + NL + "\t\t\tCollection destCollection = (Collection) target.eGet(feature);" + NL + "\t\t\tdestCollection.clear();" + NL + "\t\t\tif(value instanceof Collection) {" + NL + "\t\t\t\tCollection valueCollection = (Collection) value;" + NL + "\t\t\t\tfor (Iterator it = valueCollection.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tdestCollection.add(performCast(it.next(), feature));" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tdestCollection.add(value);" + NL + "\t\t\t}" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\ttarget.eSet(feature, value);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected Object performCast(Object value, ETypedElement targetType) {" + NL + "\t\tif(targetType.getEType() == null || targetType.getEType().getInstanceClass() == null) {" + NL + "\t\t\treturn value;" + NL + "\t\t}" + NL + "\t\tClass targetClass = targetType.getEType().getInstanceClass();\t" + NL + "\t\tif(value != null && value instanceof Number) {" + NL + "\t\t\tNumber num = (Number)value;" + NL + "\t\t\tClass valClass = value.getClass();\t\t\t" + NL + "\t\t\tClass targetWrapperClass = targetClass;" + NL + "\t\t\tif(targetClass.isPrimitive()) {" + NL + "\t\t\t\ttargetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);" + NL + "\t\t\t}\t\t\t" + NL + "\t\t\tif(valClass.equals(targetWrapperClass)) {" + NL + "\t\t\t\treturn value;\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tif(Number.class.isAssignableFrom(targetWrapperClass)) {" + NL + "\t\t\t\tif(targetWrapperClass.equals(Byte.class)) return new Byte(num.byteValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Integer.class)) return new Integer(num.intValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Short.class)) return new Short(num.shortValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Long.class)) return new Long(num.longValue());\t\t\t\t\t" + NL + "\t\t\t\tif(targetWrapperClass.equals(BigInteger.class)) return BigInteger.valueOf(num.longValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Float.class)) return new Float(num.floatValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(Double.class)) return new Double(num.doubleValue());" + NL + "\t\t\t\tif(targetWrapperClass.equals(BigDecimal.class)) return new BigDecimal(num.doubleValue());" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn value;" + NL + "\t}\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static final ";
+ protected final String TEXT_13 = " createNullExpression(EClassifier context) {" + NL + "\t\treturn new ";
+ protected final String TEXT_14 = "(context) {" + NL + "\t\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\t\t// TODO - log entry about not provider available for this expression" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class NoImplException extends RuntimeException {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tpublic NoImplException(String message) {" + NL + "\t\t\tsuper(message);" + NL + "\t\t}" + NL + "\t}\t" + NL + "}";
+ protected final String TEXT_15 = NL;
public String generate(Object argument)
{
@@ -40,19 +39,18 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final GenExpressionProviderContainer providerContainer = genDiagram.getEditorGen().getExpressionProviders();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
importManager.registerInnerClass("NoImplException");
importManager.addImport("java.math.BigDecimal");
@@ -70,27 +68,27 @@ importManager.addImport("org.eclipse.emf.ecore.EClassifier");
importManager.addImport("org.eclipse.emf.ecore.util.EcoreUtil");
importManager.addImport("org.eclipse.core.runtime.Platform");
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(providerContainer.getAbstractExpressionClassName());
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(providerContainer.getAbstractExpressionClassName());
stringBuffer.append(TEXT_8);
stringBuffer.append(providerContainer.getAbstractExpressionClassName());
stringBuffer.append(TEXT_9);
- stringBuffer.append(providerContainer.getAbstractExpressionClassName());
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
stringBuffer.append(TEXT_12);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
+ stringBuffer.append(providerContainer.getAbstractExpressionClassName());
stringBuffer.append(TEXT_13);
stringBuffer.append(providerContainer.getAbstractExpressionClassName());
stringBuffer.append(TEXT_14);
- stringBuffer.append(providerContainer.getAbstractExpressionClassName());
- stringBuffer.append(TEXT_15);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/OCLExpressionFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/OCLExpressionFactoryGenerator.java
index a9be4e422..d89a9702b 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/OCLExpressionFactoryGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/OCLExpressionFactoryGenerator.java
@@ -15,19 +15,18 @@ public class OCLExpressionFactoryGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t";
- protected final String TEXT_8 = NL + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_9 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
- protected final String TEXT_10 = " getExpression(String body, EClassifier context, Map environment) {\t\t" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
- protected final String TEXT_11 = " getExpression(String body, EClassifier context) {\t\t" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tprivate static class Expression extends ";
- protected final String TEXT_12 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate WeakReference queryRef;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate final OCL oclInstance;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t\t" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context);" + NL + "\t\t\toclInstance = OCL.newInstance();" + NL + "\t\t\tinitCustomEnv(oclInstance.getEnvironment(), environment);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprotected Query getQuery() {" + NL + "\t\t\tQuery oclQuery = null;" + NL + "\t\t\tif(this.queryRef != null) {" + NL + "\t\t\t\toclQuery = (Query)this.queryRef.get();" + NL + "\t\t\t}" + NL + "\t\t\tif(oclQuery == null) {" + NL + "\t\t\t\tOCLHelper oclHelper = oclInstance.createOCLHelper();" + NL + "\t\t\t\toclHelper.setContext(context());" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tOCLExpression oclExpression = oclHelper.createQuery(body());" + NL + "\t\t\t\t\toclQuery = oclInstance.createQuery(oclExpression);" + NL + "\t\t\t\t\tthis.queryRef = new WeakReference(oclQuery);" + NL + "\t\t\t\t\tsetStatus(IStatus.OK, null, null);" + NL + "\t\t\t\t} catch (ParserException e) {" + NL + "\t\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn oclQuery;\t\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\tQuery oclQuery = getQuery();\t\t\t\t\t" + NL + "\t\t\tif (oclQuery == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tEvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();" + NL + "\t\t\t// init environment" + NL + "\t\t\tfor (Iterator it = env.entrySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\tMap.Entry nextEntry = (Map.Entry) it.next();" + NL + "\t\t\t\tevalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());\t\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tinitExtentMap(context);" + NL + "\t\t\t\tObject result = oclQuery.evaluate(context);" + NL + "\t\t\t\treturn (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;" + NL + "\t\t\t} finally {\t\t\t\t" + NL + "\t\t\t\tevalEnv.clear();" + NL + "\t\t\t\toclQuery.getExtentMap().clear();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprotected Object performCast(Object value, ETypedElement targetType) {" + NL + "\t\t\tif (targetType.getEType() instanceof EEnum) {" + NL + "\t\t\t\tif(value instanceof EEnumLiteral) {" + NL + "\t\t\t\t\tEEnumLiteral literal = (EEnumLiteral)value;" + NL + "\t\t\t\t\treturn (literal.getInstance() != null) ? literal.getInstance() : literal;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn super.performCast(value, targetType);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate void initExtentMap(Object context) {" + NL + "\t\t\tif (!getStatus().isOK() || context == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal Query queryToInit = getQuery();" + NL + "\t\t\tfinal Object extentContext = context;" + NL + "\t\t\t" + NL + "\t\t\tqueryToInit.getExtentMap().clear();" + NL + "\t\t\tif (queryToInit.queryText() != null && queryToInit.queryText().indexOf(PredefinedType.ALL_INSTANCES_NAME) >= 0) {" + NL + "\t\t\t\tAbstractVisitor visitior = new AbstractVisitor() {" + NL + "\t\t\t\t\tprivate boolean usesAllInstances = false;" + NL + "\t\t\t\t\t" + NL + "\t\t\t\t\tpublic Object visitOperationCallExp(OperationCallExp oc) {" + NL + "\t\t\t\t\t\tif(!usesAllInstances) {" + NL + "\t\t\t\t\t\t\tusesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();" + NL + "\t\t\t\t\t\t\tif(usesAllInstances) {" + NL + "\t\t\t\t\t\t\t\tqueryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\treturn super.visitOperationCallExp(oc);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t\tqueryToInit.getExpression().accept(visitior);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static void initCustomEnv(Environment ecoreEnv, Map environment) {" + NL + "\t\t\tfor (Iterator it = environment.keySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\tString varName = (String)it.next();" + NL + "\t\t\t\tEClassifier varType = (EClassifier) environment.get(varName);" + NL + "\t\t\t\tecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);" + NL + "\t\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static Variable createVar(Environment ecoreEnv, String name, EClassifier type) {" + NL + "\t\t\tVariable var = EcoreFactory.eINSTANCE.createVariable(); // or ecoreEnv.getOCLFactory().createVariable()?" + NL + "\t\t\tvar.setName(name);" + NL + "\t\t\tvar.setType(ecoreEnv.getUMLReflection().getOCLType(type));" + NL + "\t\t\treturn var;" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "}";
- protected final String TEXT_13 = NL;
+ protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t";
+ protected final String TEXT_7 = NL + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_8 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
+ protected final String TEXT_9 = " getExpression(String body, EClassifier context, Map environment) {\t\t" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
+ protected final String TEXT_10 = " getExpression(String body, EClassifier context) {\t\t" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tprivate static class Expression extends ";
+ protected final String TEXT_11 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate WeakReference queryRef;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate final OCL oclInstance;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t\t" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context);" + NL + "\t\t\toclInstance = OCL.newInstance();" + NL + "\t\t\tinitCustomEnv(oclInstance.getEnvironment(), environment);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprotected Query getQuery() {" + NL + "\t\t\tQuery oclQuery = null;" + NL + "\t\t\tif(this.queryRef != null) {" + NL + "\t\t\t\toclQuery = (Query)this.queryRef.get();" + NL + "\t\t\t}" + NL + "\t\t\tif(oclQuery == null) {" + NL + "\t\t\t\tOCLHelper oclHelper = oclInstance.createOCLHelper();" + NL + "\t\t\t\toclHelper.setContext(context());" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tOCLExpression oclExpression = oclHelper.createQuery(body());" + NL + "\t\t\t\t\toclQuery = oclInstance.createQuery(oclExpression);" + NL + "\t\t\t\t\tthis.queryRef = new WeakReference(oclQuery);" + NL + "\t\t\t\t\tsetStatus(IStatus.OK, null, null);" + NL + "\t\t\t\t} catch (ParserException e) {" + NL + "\t\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn oclQuery;\t\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\tQuery oclQuery = getQuery();\t\t\t\t\t" + NL + "\t\t\tif (oclQuery == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tEvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();" + NL + "\t\t\t// init environment" + NL + "\t\t\tfor (Iterator it = env.entrySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\tMap.Entry nextEntry = (Map.Entry) it.next();" + NL + "\t\t\t\tevalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());\t\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tinitExtentMap(context);" + NL + "\t\t\t\tObject result = oclQuery.evaluate(context);" + NL + "\t\t\t\treturn (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;" + NL + "\t\t\t} finally {\t\t\t\t" + NL + "\t\t\t\tevalEnv.clear();" + NL + "\t\t\t\toclQuery.getExtentMap().clear();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprotected Object performCast(Object value, ETypedElement targetType) {" + NL + "\t\t\tif (targetType.getEType() instanceof EEnum) {" + NL + "\t\t\t\tif(value instanceof EEnumLiteral) {" + NL + "\t\t\t\t\tEEnumLiteral literal = (EEnumLiteral)value;" + NL + "\t\t\t\t\treturn (literal.getInstance() != null) ? literal.getInstance() : literal;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn super.performCast(value, targetType);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate void initExtentMap(Object context) {" + NL + "\t\t\tif (!getStatus().isOK() || context == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tfinal Query queryToInit = getQuery();" + NL + "\t\t\tfinal Object extentContext = context;" + NL + "\t\t\t" + NL + "\t\t\tqueryToInit.getExtentMap().clear();" + NL + "\t\t\tif (queryToInit.queryText() != null && queryToInit.queryText().indexOf(PredefinedType.ALL_INSTANCES_NAME) >= 0) {" + NL + "\t\t\t\tAbstractVisitor visitior = new AbstractVisitor() {" + NL + "\t\t\t\t\tprivate boolean usesAllInstances = false;" + NL + "\t\t\t\t\t" + NL + "\t\t\t\t\tpublic Object visitOperationCallExp(OperationCallExp oc) {" + NL + "\t\t\t\t\t\tif(!usesAllInstances) {" + NL + "\t\t\t\t\t\t\tusesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();" + NL + "\t\t\t\t\t\t\tif(usesAllInstances) {" + NL + "\t\t\t\t\t\t\t\tqueryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\treturn super.visitOperationCallExp(oc);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t\tqueryToInit.getExpression().accept(visitior);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static void initCustomEnv(Environment ecoreEnv, Map environment) {" + NL + "\t\t\tfor (Iterator it = environment.keySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\tString varName = (String)it.next();" + NL + "\t\t\t\tEClassifier varType = (EClassifier) environment.get(varName);" + NL + "\t\t\t\tecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);" + NL + "\t\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static Variable createVar(Environment ecoreEnv, String name, EClassifier type) {" + NL + "\t\t\tVariable var = EcoreFactory.eINSTANCE.createVariable(); // or ecoreEnv.getOCLFactory().createVariable()?" + NL + "\t\t\tvar.setName(name);" + NL + "\t\t\tvar.setType(ecoreEnv.getUMLReflection().getOCLType(type));" + NL + "\t\t\treturn var;" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "}";
+ protected final String TEXT_12 = NL;
public String generate(Object argument)
{
@@ -39,19 +38,18 @@ final GenDiagram genDiagram = genInterpreter.getContainer().getEditorGen().getDi
final String factoryClassName = genInterpreter.getClassName();
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
importManager.registerInnerClass("Expression");
importManager.addImport("java.util.Collections");
@@ -78,20 +76,20 @@ importManager.addImport("org.eclipse.ocl.utilities.AbstractVisitor");
importManager.addImport("org.eclipse.ocl.utilities.PredefinedType");
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(factoryClassName);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
stringBuffer.append(factoryClassName);
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_11);
- stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
- stringBuffer.append(TEXT_12);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/RegexpExpressionFactoryGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/RegexpExpressionFactoryGenerator.java
index 309377471..e950deeea 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/RegexpExpressionFactoryGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/expressions/RegexpExpressionFactoryGenerator.java
@@ -15,18 +15,17 @@ public class RegexpExpressionFactoryGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_7 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_8 = " getExpression(String body," + NL + "\t\t\tEClassifier context, Map environment) {" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_9 = " getExpression(String body," + NL + "\t\t\tEClassifier context) {" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate static class Expression extends ";
- protected final String TEXT_10 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate final Pattern pattern;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context);" + NL + "\t\t\tPattern p;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tp = Pattern.compile(body);" + NL + "\t\t\t} catch (PatternSyntaxException e) {" + NL + "\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t\tp = null;" + NL + "\t\t\t}" + NL + "\t\t\tthis.pattern = p;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprotected Object doEvaluate(Object contextInstance, Map env) {" + NL + "\t\t\tif (pattern == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tif(context() instanceof EDataType) {" + NL + "\t\t\t\tcontextInstance = EcoreUtil.convertToString((EDataType)context(), contextInstance);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tMatcher matcher = this.pattern.matcher(String.valueOf(contextInstance));" + NL + "\t\t\treturn Boolean.valueOf(";
- protected final String TEXT_11 = "matcher.matches());" + NL + "\t\t}" + NL + "\t}" + NL + "}";
- protected final String TEXT_12 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " {" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_6 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
+ protected final String TEXT_7 = " getExpression(String body," + NL + "\t\t\tEClassifier context, Map environment) {" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
+ protected final String TEXT_8 = " getExpression(String body," + NL + "\t\t\tEClassifier context) {" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate static class Expression extends ";
+ protected final String TEXT_9 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate final Pattern pattern;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context);" + NL + "\t\t\tPattern p;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tp = Pattern.compile(body);" + NL + "\t\t\t} catch (PatternSyntaxException e) {" + NL + "\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t\tp = null;" + NL + "\t\t\t}" + NL + "\t\t\tthis.pattern = p;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprotected Object doEvaluate(Object contextInstance, Map env) {" + NL + "\t\t\tif (pattern == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tif(context() instanceof EDataType) {" + NL + "\t\t\t\tcontextInstance = EcoreUtil.convertToString((EDataType)context(), contextInstance);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tMatcher matcher = this.pattern.matcher(String.valueOf(contextInstance));" + NL + "\t\t\treturn Boolean.valueOf(";
+ protected final String TEXT_10 = "matcher.matches());" + NL + "\t\t}" + NL + "\t}" + NL + "}";
+ protected final String TEXT_11 = NL;
public String generate(Object argument)
{
@@ -39,17 +38,16 @@ final String factoryClassName = genInterpreter.getClassName();
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
final boolean isNegationRegexp = !GenLanguage.REGEXP_LITERAL.equals(genInterpreter.getLanguage());
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
importManager.registerInnerClass("Expression");
@@ -63,21 +61,21 @@ importManager.addImport("org.eclipse.emf.ecore.EClassifier");
importManager.addImport("org.eclipse.emf.ecore.EDataType");
importManager.addImport("org.eclipse.emf.ecore.util.EcoreUtil");
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(factoryClassName);
stringBuffer.append(TEXT_5);
stringBuffer.append(factoryClassName);
stringBuffer.append(TEXT_6);
- stringBuffer.append(factoryClassName);
+ stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
stringBuffer.append(TEXT_9);
- stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
- stringBuffer.append(TEXT_10);
stringBuffer.append(isNegationRegexp ? "!" : "");
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/BaseEditHelperGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/BaseEditHelperGenerator.java
index 5b7c1aa94..08e0f8d29 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/BaseEditHelperGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/BaseEditHelperGenerator.java
@@ -15,12 +15,11 @@ public class BaseEditHelperGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;" + NL + "import org.eclipse.gmf.runtime.common.core.command.ICommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractEditHelper {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EDIT_POLICY_COMMAND = \"edit policy command\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getInsteadCommand(IEditCommandRequest req) {" + NL + "\t\tICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);" + NL + "\t\treq.setParameter(EDIT_POLICY_COMMAND, null);" + NL + "\t\tICommand ehCommand = super.getInsteadCommand(req);" + NL + "\t\tif (epCommand == null) {" + NL + "\t\t\treturn ehCommand;" + NL + "\t\t}" + NL + "\t\tif (ehCommand == null) {" + NL + "\t\t\treturn epCommand;" + NL + "\t\t}" + NL + "\t\tCompositeCommand command = new CompositeCommand(null);" + NL + "\t\tcommand.add(epCommand);" + NL + "\t\tcommand.add(ehCommand);" + NL + "\t\treturn command;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getCreateCommand(CreateElementRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;" + NL + "import org.eclipse.gmf.runtime.common.core.command.ICommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractEditHelper {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String EDIT_POLICY_COMMAND = \"edit policy command\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getInsteadCommand(IEditCommandRequest req) {" + NL + "\t\tICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);" + NL + "\t\treq.setParameter(EDIT_POLICY_COMMAND, null);" + NL + "\t\tICommand ehCommand = super.getInsteadCommand(req);" + NL + "\t\tif (epCommand == null) {" + NL + "\t\t\treturn ehCommand;" + NL + "\t\t}" + NL + "\t\tif (ehCommand == null) {" + NL + "\t\t\treturn epCommand;" + NL + "\t\t}" + NL + "\t\tCompositeCommand command = new CompositeCommand(null);" + NL + "\t\tcommand.add(epCommand);" + NL + "\t\tcommand.add(ehCommand);" + NL + "\t\treturn command;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getCreateCommand(CreateElementRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "}";
public String generate(Object argument)
{
@@ -29,21 +28,20 @@ public class BaseEditHelperGenerator
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getBaseEditHelperClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperAdviceGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperAdviceGenerator.java
index 19b056315..fba7ac76d 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperAdviceGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperAdviceGenerator.java
@@ -15,12 +15,11 @@ public class EditHelperAdviceGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractEditHelperAdvice {" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractEditHelperAdvice {" + NL + "}";
public String generate(Object argument)
{
@@ -30,23 +29,22 @@ SpecializationType genType = (SpecializationType) ((Object[]) argument)[0];
GenDiagram genDiagram = genType.getDiagramElement().getDiagram();
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genType.getEditHelperAdviceClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperGenerator.java
index c0dd43dc3..5b58d551c 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/helpers/EditHelperGenerator.java
@@ -15,12 +15,11 @@ public class EditHelperGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_5 = " extends ";
- protected final String TEXT_6 = " {" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_4 = " extends ";
+ protected final String TEXT_5 = " {" + NL + "}";
public String generate(Object argument)
{
@@ -30,24 +29,23 @@ MetamodelType genType = (MetamodelType) ((Object[]) argument)[0];
GenDiagram genDiagram = genType.getDiagramElement().getDiagram();
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
stringBuffer.append(genType.getEditHelperClassName());
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(importManager.getImportedName(genDiagram.getBaseEditHelperQualifiedClassName()));
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorActionProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorActionProviderGenerator.java
index cd8bb6e6e..a89f81bdb 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorActionProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorActionProviderGenerator.java
@@ -15,54 +15,53 @@ public class NavigatorActionProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myContribute;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate OpenDiagramAction myOpenDiagramAction;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(";
- protected final String TEXT_8 = " aSite) {" + NL + "\t\tsuper.init(aSite);" + NL + "\t\tif (aSite.getViewSite() instanceof ";
- protected final String TEXT_9 = ") {" + NL + "\t\t\tmyContribute = true;" + NL + "\t\t\tmakeActions((";
- protected final String TEXT_10 = ") aSite.getViewSite());" + NL + "\t\t} else {" + NL + "\t\t\tmyContribute = false;" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void makeActions(";
- protected final String TEXT_11 = " viewerSite) {" + NL + "\t\tmyOpenDiagramAction = new OpenDiagramAction(viewerSite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillActionBars(";
- protected final String TEXT_12 = " actionBars) {" + NL + "\t\tif (!myContribute) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_13 = " selection = (";
- protected final String TEXT_14 = ") getContext().getSelection();" + NL + "\t\tmyOpenDiagramAction.selectionChanged(selection);" + NL + "\t\tif (myOpenDiagramAction.isEnabled()) {" + NL + "\t\t\tactionBars.setGlobalActionHandler(";
- protected final String TEXT_15 = ".OPEN, myOpenDiagramAction);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillContextMenu(";
- protected final String TEXT_16 = " menu) {";
- protected final String TEXT_17 = "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OpenDiagramAction extends ";
- protected final String TEXT_18 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_19 = " myDiagram;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_20 = " myViewerSite;" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic OpenDiagramAction(";
- protected final String TEXT_21 = " viewerSite) {" + NL + "\t\t\tsuper(\"Open Diagram\");" + NL + "\t\t\tmyViewerSite = viewerSite;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic final void selectionChanged(";
- protected final String TEXT_22 = " selection) {" + NL + "\t\t\tmyDiagram = null;" + NL + "\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\tif (selectedElement instanceof ";
- protected final String TEXT_23 = ") {" + NL + "\t\t\t\t\tselectedElement = ((";
- protected final String TEXT_24 = ") selectedElement).getView();" + NL + "\t\t\t\t} else if (selectedElement instanceof ";
- protected final String TEXT_25 = ") {" + NL + "\t\t\t\t\tselectedElement = ((";
- protected final String TEXT_26 = ") selectedElement).getAdapter(";
- protected final String TEXT_27 = ".class);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (selectedElement instanceof ";
- protected final String TEXT_28 = ") {" + NL + "\t\t\t\t\t";
- protected final String TEXT_29 = " diagram = (";
- protected final String TEXT_30 = ") selectedElement;" + NL + "\t\t\t\t\tif (";
- protected final String TEXT_31 = ".MODEL_ID.equals(";
- protected final String TEXT_32 = ".getModelID(diagram))) {" + NL + "\t\t\t\t\t\tmyDiagram = diagram;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetEnabled(myDiagram != null);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (myDiagram == null || myDiagram.eResource() == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t";
- protected final String TEXT_33 = " editorInput = getEditorInput();" + NL + "\t\t\t";
- protected final String TEXT_34 = " page = myViewerSite.getPage();" + NL + "\t\t \ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, ";
- protected final String TEXT_35 = ".ID);" + NL + "\t\t\t} catch (";
- protected final String TEXT_36 = " e) {" + NL + "\t\t\t\t";
- protected final String TEXT_37 = ".getInstance().logError(\"Exception while openning diagram\", e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_38 = " getEditorInput() {" + NL + "\t\t\t";
- protected final String TEXT_39 = " diagramResource = myDiagram.eResource();";
- protected final String TEXT_40 = NL + "\t\t\tfor (";
- protected final String TEXT_41 = " it = diagramResource.getContents().iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
- protected final String TEXT_42 = " nextEObject = (";
- protected final String TEXT_43 = ") it.next();" + NL + "\t\t\t\tif (nextEObject == myDiagram) {" + NL + "\t\t\t\t\treturn new ";
- protected final String TEXT_44 = "(";
- protected final String TEXT_45 = ".getFile(diagramResource));" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (nextEObject instanceof Diagram) {" + NL + "\t\t\t\t\tbreak;" + NL + "\t\t\t\t}" + NL + "\t\t\t}";
- protected final String TEXT_46 = NL + "\t\t\treturn new ";
- protected final String TEXT_47 = "(diagramResource.getURI().appendFragment(diagramResource.getURIFragment(myDiagram)));" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_48 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myContribute;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate OpenDiagramAction myOpenDiagramAction;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(";
+ protected final String TEXT_7 = " aSite) {" + NL + "\t\tsuper.init(aSite);" + NL + "\t\tif (aSite.getViewSite() instanceof ";
+ protected final String TEXT_8 = ") {" + NL + "\t\t\tmyContribute = true;" + NL + "\t\t\tmakeActions((";
+ protected final String TEXT_9 = ") aSite.getViewSite());" + NL + "\t\t} else {" + NL + "\t\t\tmyContribute = false;" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void makeActions(";
+ protected final String TEXT_10 = " viewerSite) {" + NL + "\t\tmyOpenDiagramAction = new OpenDiagramAction(viewerSite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillActionBars(";
+ protected final String TEXT_11 = " actionBars) {" + NL + "\t\tif (!myContribute) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_12 = " selection = (";
+ protected final String TEXT_13 = ") getContext().getSelection();" + NL + "\t\tmyOpenDiagramAction.selectionChanged(selection);" + NL + "\t\tif (myOpenDiagramAction.isEnabled()) {" + NL + "\t\t\tactionBars.setGlobalActionHandler(";
+ protected final String TEXT_14 = ".OPEN, myOpenDiagramAction);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fillContextMenu(";
+ protected final String TEXT_15 = " menu) {";
+ protected final String TEXT_16 = "\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class OpenDiagramAction extends ";
+ protected final String TEXT_17 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_18 = " myDiagram;" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_19 = " myViewerSite;" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic OpenDiagramAction(";
+ protected final String TEXT_20 = " viewerSite) {" + NL + "\t\t\tsuper(\"Open Diagram\");" + NL + "\t\t\tmyViewerSite = viewerSite;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic final void selectionChanged(";
+ protected final String TEXT_21 = " selection) {" + NL + "\t\t\tmyDiagram = null;" + NL + "\t\t\tif (selection.size() == 1) {" + NL + "\t\t\t\tObject selectedElement = selection.getFirstElement();" + NL + "\t\t\t\tif (selectedElement instanceof ";
+ protected final String TEXT_22 = ") {" + NL + "\t\t\t\t\tselectedElement = ((";
+ protected final String TEXT_23 = ") selectedElement).getView();" + NL + "\t\t\t\t} else if (selectedElement instanceof ";
+ protected final String TEXT_24 = ") {" + NL + "\t\t\t\t\tselectedElement = ((";
+ protected final String TEXT_25 = ") selectedElement).getAdapter(";
+ protected final String TEXT_26 = ".class);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (selectedElement instanceof ";
+ protected final String TEXT_27 = ") {" + NL + "\t\t\t\t\t";
+ protected final String TEXT_28 = " diagram = (";
+ protected final String TEXT_29 = ") selectedElement;" + NL + "\t\t\t\t\tif (";
+ protected final String TEXT_30 = ".MODEL_ID.equals(";
+ protected final String TEXT_31 = ".getModelID(diagram))) {" + NL + "\t\t\t\t\t\tmyDiagram = diagram;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tsetEnabled(myDiagram != null);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\tif (myDiagram == null || myDiagram.eResource() == null) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t";
+ protected final String TEXT_32 = " editorInput = getEditorInput();" + NL + "\t\t\t";
+ protected final String TEXT_33 = " page = myViewerSite.getPage();" + NL + "\t\t \ttry {" + NL + "\t\t\t\tpage.openEditor(editorInput, ";
+ protected final String TEXT_34 = ".ID);" + NL + "\t\t\t} catch (";
+ protected final String TEXT_35 = " e) {" + NL + "\t\t\t\t";
+ protected final String TEXT_36 = ".getInstance().logError(\"Exception while openning diagram\", e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_37 = " getEditorInput() {" + NL + "\t\t\t";
+ protected final String TEXT_38 = " diagramResource = myDiagram.eResource();";
+ protected final String TEXT_39 = NL + "\t\t\tfor (";
+ protected final String TEXT_40 = " it = diagramResource.getContents().iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
+ protected final String TEXT_41 = " nextEObject = (";
+ protected final String TEXT_42 = ") it.next();" + NL + "\t\t\t\tif (nextEObject == myDiagram) {" + NL + "\t\t\t\t\treturn new ";
+ protected final String TEXT_43 = "(";
+ protected final String TEXT_44 = ".getFile(diagramResource));" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (nextEObject instanceof Diagram) {" + NL + "\t\t\t\t\tbreak;" + NL + "\t\t\t\t}" + NL + "\t\t\t}";
+ protected final String TEXT_45 = NL + "\t\t\treturn new ";
+ protected final String TEXT_46 = "(diagramResource.getURI().appendFragment(diagramResource.getURIFragment(myDiagram)));" + NL + "\t\t}" + NL + "\t\t" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_47 = NL;
public String generate(Object argument)
{
@@ -73,41 +72,40 @@ GenDiagram genDiagram = genNavigator.getEditorGen().getDiagram();
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
importManager.registerInnerClass("OpenFileAction");
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genNavigator.getActionProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.CommonActionProvider"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonActionExtensionSite"));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
stringBuffer.append(TEXT_10);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
- stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IActionBars"));
+ stringBuffer.append(TEXT_11);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
- stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonActionConstants"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager"));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
/*
* Put following code into the template to generate popup menu
@@ -122,69 +120,69 @@ if (copyrightText != null && copyrightText.trim().length() > 0) {
if (myOpenDiagramAction.isEnabled()) {
menu.insertAfter(< %=importManager.getImportedName("org.eclipse.ui.navigator.ICommonMenuConstants")% >.GROUP_OPEN, myOpenDiagramAction);
}*/
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Action"));
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
+ stringBuffer.append(TEXT_18);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
stringBuffer.append(TEXT_20);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonViewerWorkbenchSite"));
- stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_23);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
stringBuffer.append(TEXT_25);
- stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
- stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
stringBuffer.append(TEXT_27);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
stringBuffer.append(TEXT_29);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
- stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPage"));
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getEditor().getQualifiedClassName()));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException"));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorInput"));
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
if (genDiagram.getEditorGen().getApplication() == null) {
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_40);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_41);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_42);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.FileEditorInput"));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.util.WorkspaceSynchronizer"));
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
}
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput"));
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorLabelProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorLabelProviderGenerator.java
index e5522fa13..54433572e 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorLabelProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorLabelProviderGenerator.java
@@ -18,121 +18,120 @@ public class NavigatorLabelProviderGenerator {
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " implements ";
- protected final String TEXT_8 = ", ";
- protected final String TEXT_9 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic {" + NL + "\t\t";
- protected final String TEXT_10 = ".getInstance().getImageRegistry().put(\"";
- protected final String TEXT_11 = "\", ";
- protected final String TEXT_12 = ".getMissingImageDescriptor());" + NL + "\t\t";
- protected final String TEXT_13 = ".getInstance().getImageRegistry().put(\"";
- protected final String TEXT_14 = "\", ";
- protected final String TEXT_15 = ".getMissingImageDescriptor());" + NL + "\t\t";
- protected final String TEXT_16 = ".getInstance().getImageRegistry().put(\"";
- protected final String TEXT_17 = "\", ";
- protected final String TEXT_18 = ".getMissingImageDescriptor());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void updateLabel(";
- protected final String TEXT_19 = " label, ";
- protected final String TEXT_20 = " elementPath) {" + NL + "\t\tObject element = elementPath.getLastSegment();" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_21 = " && !isOwnView(((";
- protected final String TEXT_22 = ") element).getView())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tlabel.setText(getText(element));" + NL + "\t\tlabel.setImage(getImage(element));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_23 = " getImage(Object element) {" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_24 = ") {" + NL + "\t\t\t";
- protected final String TEXT_25 = " group = (";
- protected final String TEXT_26 = ") element;" + NL + "\t\t\treturn ";
- protected final String TEXT_27 = ".getInstance().getBundledImage(group.getIcon());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_28 = ") {" + NL + "\t\t\t";
- protected final String TEXT_29 = " navigatorItem = (";
- protected final String TEXT_30 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn super.getImage(element);" + NL + " \t\t}" + NL + " \t\treturn getImage(navigatorItem.getView());" + NL + "\t\t}" + NL;
- protected final String TEXT_31 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_32 = ") {" + NL + "\t\t\t";
- protected final String TEXT_33 = " view = (";
- protected final String TEXT_34 = ") ((";
- protected final String TEXT_35 = ") element).getAdapter(";
- protected final String TEXT_36 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getImage(view);" + NL + "\t\t\t}" + NL + "\t\t}";
- protected final String TEXT_37 = NL + "\t\treturn super.getImage(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_38 = " getImage(";
- protected final String TEXT_39 = " view) {" + NL + "\t\tswitch (";
- protected final String TEXT_40 = ".getVisualID(view)) {";
- protected final String TEXT_41 = NL + "\t\tcase ";
- protected final String TEXT_42 = ".VISUAL_ID:" + NL + "\t\t\treturn getImage(\"";
- protected final String TEXT_43 = "\", ";
- protected final String TEXT_44 = ".";
- protected final String TEXT_45 = "null";
- protected final String TEXT_46 = ");";
- protected final String TEXT_47 = NL + "\t\tdefault:" + NL + "\t\t\treturn getImage(\"";
- protected final String TEXT_48 = "\", null);" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_49 = " getImage(String key, ";
- protected final String TEXT_50 = " elementType) {" + NL + "\t\t";
- protected final String TEXT_51 = " imageRegistry = ";
- protected final String TEXT_52 = ".getInstance().getImageRegistry();" + NL + "\t\t";
- protected final String TEXT_53 = " image = imageRegistry.get(key);" + NL + "\t\tif (image == null && elementType != null && ";
- protected final String TEXT_54 = ".isKnownElementType(elementType)) {" + NL + "\t\t\timage = ";
- protected final String TEXT_55 = ".getImage(elementType);" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\t\t" + NL + "\t\tif (image == null) {" + NL + "\t\t\timage = imageRegistry.get(\"";
- protected final String TEXT_56 = "\");" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(Object element) {" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_57 = ") {" + NL + "\t\t\t";
- protected final String TEXT_58 = " group = (";
- protected final String TEXT_59 = ") element;" + NL + "\t\t\treturn group.getGroupName();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_60 = ") {" + NL + "\t\t\t";
- protected final String TEXT_61 = " navigatorItem = (";
- protected final String TEXT_62 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn null;" + NL + " \t\t}" + NL + " \t\treturn getText(navigatorItem.getView());" + NL + "\t\t}" + NL + "\t";
- protected final String TEXT_63 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_64 = ") {" + NL + "\t\t\t";
- protected final String TEXT_65 = " view = (";
- protected final String TEXT_66 = ") ((";
- protected final String TEXT_67 = ") element).getAdapter(";
- protected final String TEXT_68 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getText(view);" + NL + "\t\t\t}" + NL + "\t\t}";
- protected final String TEXT_69 = NL + "\t\treturn super.getText(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(";
- protected final String TEXT_70 = " view) {" + NL + "\t\tif (view.getElement() != null && view.getElement().eIsProxy()) {" + NL + "\t\t\treturn getUnresolvedDomainElementProxyText(view);" + NL + "\t\t}" + NL + "\t\tswitch (";
- protected final String TEXT_71 = ".getVisualID(view)) {";
- protected final String TEXT_72 = NL + "\t\tcase ";
- protected final String TEXT_73 = ".VISUAL_ID:" + NL + "\t\t\treturn get";
- protected final String TEXT_74 = "Text(view);";
- protected final String TEXT_75 = NL + "\t\tdefault:" + NL + "\t\t\treturn getUnknownElementText(view);" + NL + "\t\t}" + NL + "\t}" + NL;
- protected final String TEXT_76 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String get";
- protected final String TEXT_77 = "Text(";
- protected final String TEXT_78 = " view) {";
- protected final String TEXT_79 = NL + "\t\t";
- protected final String TEXT_80 = " hintAdapter = new ";
- protected final String TEXT_81 = ".HintAdapter(" + NL + "\t\t\t\t";
- protected final String TEXT_82 = ".";
- protected final String TEXT_83 = "," + NL + "\t\t\t\t(view.getElement() != null ? view.getElement() : view),";
- protected final String TEXT_84 = NL + "\t\t\t\t";
- protected final String TEXT_85 = ".DESCRIPTION";
- protected final String TEXT_86 = NL + "\t\t\t\t";
- protected final String TEXT_87 = ".getType(";
- protected final String TEXT_88 = ".VISUAL_ID)";
- protected final String TEXT_89 = ");" + NL + "\t\t";
- protected final String TEXT_90 = " parser = ";
- protected final String TEXT_91 = ".getInstance().getParser(hintAdapter);" + NL + "\t\t" + NL + "\t\tif (parser != null) {" + NL + "\t\t\treturn parser.getPrintString(hintAdapter, ";
- protected final String TEXT_92 = ".NONE.intValue());" + NL + "\t\t} else {" + NL + "\t\t\t";
- protected final String TEXT_93 = ".getInstance().logError(\"Parser was not found for label \" + ";
- protected final String TEXT_94 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}";
- protected final String TEXT_95 = NL + "\t\treturn \"";
- protected final String TEXT_96 = "\";";
- protected final String TEXT_97 = NL + "\t\t";
- protected final String TEXT_98 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement != null) {" + NL + "\t\t\treturn ";
- protected final String TEXT_99 = "String.valueOf(";
- protected final String TEXT_100 = ")";
- protected final String TEXT_101 = ";" + NL + "\t\t} else {" + NL + "\t\t\t";
- protected final String TEXT_102 = ".getInstance().logError(\"No domain element for view with visualID = \" + ";
- protected final String TEXT_103 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}";
- protected final String TEXT_104 = NL + "\t\treturn \"\";";
- protected final String TEXT_105 = NL + "\t}";
- protected final String TEXT_106 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnknownElementText(";
- protected final String TEXT_107 = " view) {" + NL + "\t\treturn \"<UnknownElement Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnresolvedDomainElementProxyText(";
- protected final String TEXT_108 = " view) {" + NL + "\t\treturn \"<Unresolved domain element Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(";
- protected final String TEXT_109 = " aConfig) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void restoreState(";
- protected final String TEXT_110 = " aMemento) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void saveState(";
- protected final String TEXT_111 = " aMemento) {" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getDescription(Object anElement) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isOwnView(";
- protected final String TEXT_112 = " view) {" + NL + "\t\treturn ";
- protected final String TEXT_113 = ".MODEL_ID.equals(";
- protected final String TEXT_114 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_115 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " implements ";
+ protected final String TEXT_7 = ", ";
+ protected final String TEXT_8 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic {" + NL + "\t\t";
+ protected final String TEXT_9 = ".getInstance().getImageRegistry().put(\"";
+ protected final String TEXT_10 = "\", ";
+ protected final String TEXT_11 = ".getMissingImageDescriptor());" + NL + "\t\t";
+ protected final String TEXT_12 = ".getInstance().getImageRegistry().put(\"";
+ protected final String TEXT_13 = "\", ";
+ protected final String TEXT_14 = ".getMissingImageDescriptor());" + NL + "\t\t";
+ protected final String TEXT_15 = ".getInstance().getImageRegistry().put(\"";
+ protected final String TEXT_16 = "\", ";
+ protected final String TEXT_17 = ".getMissingImageDescriptor());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void updateLabel(";
+ protected final String TEXT_18 = " label, ";
+ protected final String TEXT_19 = " elementPath) {" + NL + "\t\tObject element = elementPath.getLastSegment();" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_20 = " && !isOwnView(((";
+ protected final String TEXT_21 = ") element).getView())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tlabel.setText(getText(element));" + NL + "\t\tlabel.setImage(getImage(element));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_22 = " getImage(Object element) {" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_23 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_24 = " group = (";
+ protected final String TEXT_25 = ") element;" + NL + "\t\t\treturn ";
+ protected final String TEXT_26 = ".getInstance().getBundledImage(group.getIcon());" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_27 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_28 = " navigatorItem = (";
+ protected final String TEXT_29 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn super.getImage(element);" + NL + " \t\t}" + NL + " \t\treturn getImage(navigatorItem.getView());" + NL + "\t\t}" + NL;
+ protected final String TEXT_30 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_31 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_32 = " view = (";
+ protected final String TEXT_33 = ") ((";
+ protected final String TEXT_34 = ") element).getAdapter(";
+ protected final String TEXT_35 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getImage(view);" + NL + "\t\t\t}" + NL + "\t\t}";
+ protected final String TEXT_36 = NL + "\t\treturn super.getImage(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_37 = " getImage(";
+ protected final String TEXT_38 = " view) {" + NL + "\t\tswitch (";
+ protected final String TEXT_39 = ".getVisualID(view)) {";
+ protected final String TEXT_40 = NL + "\t\tcase ";
+ protected final String TEXT_41 = ".VISUAL_ID:" + NL + "\t\t\treturn getImage(\"";
+ protected final String TEXT_42 = "\", ";
+ protected final String TEXT_43 = ".";
+ protected final String TEXT_44 = "null";
+ protected final String TEXT_45 = ");";
+ protected final String TEXT_46 = NL + "\t\tdefault:" + NL + "\t\t\treturn getImage(\"";
+ protected final String TEXT_47 = "\", null);" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_48 = " getImage(String key, ";
+ protected final String TEXT_49 = " elementType) {" + NL + "\t\t";
+ protected final String TEXT_50 = " imageRegistry = ";
+ protected final String TEXT_51 = ".getInstance().getImageRegistry();" + NL + "\t\t";
+ protected final String TEXT_52 = " image = imageRegistry.get(key);" + NL + "\t\tif (image == null && elementType != null && ";
+ protected final String TEXT_53 = ".isKnownElementType(elementType)) {" + NL + "\t\t\timage = ";
+ protected final String TEXT_54 = ".getImage(elementType);" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\t\t" + NL + "\t\tif (image == null) {" + NL + "\t\t\timage = imageRegistry.get(\"";
+ protected final String TEXT_55 = "\");" + NL + "\t\t\timageRegistry.put(key, image);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(Object element) {" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_56 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_57 = " group = (";
+ protected final String TEXT_58 = ") element;" + NL + "\t\t\treturn group.getGroupName();" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_59 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_60 = " navigatorItem = (";
+ protected final String TEXT_61 = ") element;" + NL + " \t\tif (!isOwnView(navigatorItem.getView())) {" + NL + " \t\t\treturn null;" + NL + " \t\t}" + NL + " \t\treturn getText(navigatorItem.getView());" + NL + "\t\t}" + NL + "\t";
+ protected final String TEXT_62 = NL + "\t\t// Due to plugin.xml content will be called only for \"own\" views" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_63 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_64 = " view = (";
+ protected final String TEXT_65 = ") ((";
+ protected final String TEXT_66 = ") element).getAdapter(";
+ protected final String TEXT_67 = ".class);" + NL + "\t\t\tif (view != null && isOwnView(view)) {" + NL + "\t\t\t\treturn getText(view);" + NL + "\t\t\t}" + NL + "\t\t}";
+ protected final String TEXT_68 = NL + "\t\treturn super.getText(element);" + NL + "\t}" + NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getText(";
+ protected final String TEXT_69 = " view) {" + NL + "\t\tif (view.getElement() != null && view.getElement().eIsProxy()) {" + NL + "\t\t\treturn getUnresolvedDomainElementProxyText(view);" + NL + "\t\t}" + NL + "\t\tswitch (";
+ protected final String TEXT_70 = ".getVisualID(view)) {";
+ protected final String TEXT_71 = NL + "\t\tcase ";
+ protected final String TEXT_72 = ".VISUAL_ID:" + NL + "\t\t\treturn get";
+ protected final String TEXT_73 = "Text(view);";
+ protected final String TEXT_74 = NL + "\t\tdefault:" + NL + "\t\t\treturn getUnknownElementText(view);" + NL + "\t\t}" + NL + "\t}" + NL;
+ protected final String TEXT_75 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String get";
+ protected final String TEXT_76 = "Text(";
+ protected final String TEXT_77 = " view) {";
+ protected final String TEXT_78 = NL + "\t\t";
+ protected final String TEXT_79 = " hintAdapter = new ";
+ protected final String TEXT_80 = ".HintAdapter(" + NL + "\t\t\t\t";
+ protected final String TEXT_81 = ".";
+ protected final String TEXT_82 = "," + NL + "\t\t\t\t(view.getElement() != null ? view.getElement() : view),";
+ protected final String TEXT_83 = NL + "\t\t\t\t";
+ protected final String TEXT_84 = ".DESCRIPTION";
+ protected final String TEXT_85 = NL + "\t\t\t\t";
+ protected final String TEXT_86 = ".getType(";
+ protected final String TEXT_87 = ".VISUAL_ID)";
+ protected final String TEXT_88 = ");" + NL + "\t\t";
+ protected final String TEXT_89 = " parser = ";
+ protected final String TEXT_90 = ".getInstance().getParser(hintAdapter);" + NL + "\t\t" + NL + "\t\tif (parser != null) {" + NL + "\t\t\treturn parser.getPrintString(hintAdapter, ";
+ protected final String TEXT_91 = ".NONE.intValue());" + NL + "\t\t} else {" + NL + "\t\t\t";
+ protected final String TEXT_92 = ".getInstance().logError(\"Parser was not found for label \" + ";
+ protected final String TEXT_93 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}";
+ protected final String TEXT_94 = NL + "\t\treturn \"";
+ protected final String TEXT_95 = "\";";
+ protected final String TEXT_96 = NL + "\t\t";
+ protected final String TEXT_97 = " domainModelElement = view.getElement();" + NL + "\t\tif (domainModelElement != null) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_98 = "String.valueOf(";
+ protected final String TEXT_99 = ")";
+ protected final String TEXT_100 = ";" + NL + "\t\t} else {" + NL + "\t\t\t";
+ protected final String TEXT_101 = ".getInstance().logError(\"No domain element for view with visualID = \" + ";
+ protected final String TEXT_102 = ");" + NL + "\t\t\treturn \"\";" + NL + "\t\t}";
+ protected final String TEXT_103 = NL + "\t\treturn \"\";";
+ protected final String TEXT_104 = NL + "\t}";
+ protected final String TEXT_105 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnknownElementText(";
+ protected final String TEXT_106 = " view) {" + NL + "\t\treturn \"<UnknownElement Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String getUnresolvedDomainElementProxyText(";
+ protected final String TEXT_107 = " view) {" + NL + "\t\treturn \"<Unresolved domain element Visual_ID = \" + view.getType() + \">\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(";
+ protected final String TEXT_108 = " aConfig) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void restoreState(";
+ protected final String TEXT_109 = " aMemento) {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void saveState(";
+ protected final String TEXT_110 = " aMemento) {" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getDescription(Object anElement) {" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isOwnView(";
+ protected final String TEXT_111 = " view) {" + NL + "\t\treturn ";
+ protected final String TEXT_112 = ".MODEL_ID.equals(";
+ protected final String TEXT_113 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_114 = NL;
protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
StringBuffer result = new StringBuffer();
@@ -360,178 +359,177 @@ final class RegistryKey {
}
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genNavigator.getLabelProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.LabelProvider"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonLabelProvider"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ITreePathLabelProvider"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(invalidElementKey);
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(unknownElementKey);
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(notFoundElementKey);
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageDescriptor"));
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ViewerLabel"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.TreePath"));
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_21);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
+ stringBuffer.append(TEXT_22);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_23);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_25);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
- stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_27);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_29);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_30);
if (genDiagram.generateShortcutIcon()) {
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
+ stringBuffer.append(TEXT_31);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_33);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
}
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
for (Iterator it = commonBaseElements.iterator(); it.hasNext();) {
GenCommonBase nextCommonBase = (GenCommonBase) it.next();
if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) {
RegistryKey registryKey = new RegistryKey(nextCommonBase);
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(importManager.getImportedName(nextCommonBase.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(registryKey.getKey());
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
if (nextCommonBase.getElementType() != null) {
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(nextCommonBase.getUniqueIdentifier());
} else {
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
}
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
}
}
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
stringBuffer.append(unknownElementKey);
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.ImageRegistry"));
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(importManager.getImportedName(genNavigator.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
+ stringBuffer.append(TEXT_52);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
stringBuffer.append(TEXT_54);
- stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_55);
stringBuffer.append(notFoundElementKey);
+ stringBuffer.append(TEXT_55);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_56);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_57);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
stringBuffer.append(TEXT_58);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorGroupQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_59);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_61);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_62);
if (genDiagram.generateShortcutIcon()) {
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
+ stringBuffer.append(TEXT_63);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_65);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
}
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_70);
for (Iterator it = commonBaseElements.iterator(); it.hasNext();) {
GenCommonBase nextCommonBase = (GenCommonBase) it.next();
if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) {
- stringBuffer.append(TEXT_72);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName(nextCommonBase.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_72);
stringBuffer.append(nextCommonBase.getUniqueIdentifier());
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_73);
}
}
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_74);
for (Iterator it = commonBaseElements.iterator(); it.hasNext();) {
GenCommonBase nextCommonBase = (GenCommonBase) it.next();
if (genNavigator.getChildReferencesTo(nextCommonBase).size() > 0) {
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_75);
stringBuffer.append(nextCommonBase.getUniqueIdentifier());
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_76);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_77);
LabelModelFacet labelModelFacet = null;
GenCommonBase hintHolder = null;
GenCommonBase elementTypeHolder = null;
@@ -563,42 +561,42 @@ if (copyrightText != null && copyrightText.trim().length() > 0) {
if (elementTypeHolder != null) {
/* 1. Label was detected. */
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable"));
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_79);
stringBuffer.append(importManager.getImportedName(genDiagram.getParserProviderQualifiedClassName()));
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_80);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_82);
+ stringBuffer.append(TEXT_81);
stringBuffer.append(elementTypeHolder.getUniqueIdentifier());
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_82);
if (labelModelFacet instanceof DesignLabelModelFacet) {
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint"));
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_84);
} else {
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(importManager.getImportedName(hintHolder.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_87);
}
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_88);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.parser.IParser"));
- stringBuffer.append(TEXT_90);
+ stringBuffer.append(TEXT_89);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.parser.ParserService"));
- stringBuffer.append(TEXT_91);
+ stringBuffer.append(TEXT_90);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions"));
- stringBuffer.append(TEXT_92);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_92);
stringBuffer.append(String.valueOf(hintHolder.getVisualID()));
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_93);
} else if (nextCommonBase instanceof GenCompartment) {
/* 2. Compartment was detected. */
- stringBuffer.append(TEXT_95);
+ stringBuffer.append(TEXT_94);
stringBuffer.append(((GenCompartment) nextCommonBase).getTitle());
- stringBuffer.append(TEXT_96);
+ stringBuffer.append(TEXT_95);
} else {
GenClass domainElement = null;
if (nextCommonBase instanceof GenDiagram) {
@@ -618,48 +616,48 @@ if (copyrightText != null && copyrightText.trim().length() > 0) {
/* 3. Underlying doman model element recognized. */
GenFeature labelFeature = domainElement.getLabelFeature();
boolean notString = EcorePackage.eINSTANCE.getEString() != labelFeature.getEcoreFeature().getEType();
- stringBuffer.append(TEXT_97);
+ stringBuffer.append(TEXT_96);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_97);
if (notString) {
- stringBuffer.append(TEXT_99);
+ stringBuffer.append(TEXT_98);
}
stringBuffer.append(getFeatureValueGetter("domainModelElement", domainElement.getLabelFeature(), true, importManager));
if (notString) {
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_99);
}
- stringBuffer.append(TEXT_101);
+ stringBuffer.append(TEXT_100);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_101);
stringBuffer.append(String.valueOf(nextCommonBase.getVisualID()));
- stringBuffer.append(TEXT_103);
+ stringBuffer.append(TEXT_102);
} else {
/* 4. None of above. */
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_103);
}
}
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_104);
}
}
+ stringBuffer.append(TEXT_105);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_106);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_107);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_108);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.navigator.ICommonContentExtensionSite"));
+ stringBuffer.append(TEXT_108);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IMemento"));
stringBuffer.append(TEXT_109);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IMemento"));
stringBuffer.append(TEXT_110);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IMemento"));
- stringBuffer.append(TEXT_111);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_112);
+ stringBuffer.append(TEXT_111);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_113);
+ stringBuffer.append(TEXT_112);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_114);
+ stringBuffer.append(TEXT_113);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_115);
+ stringBuffer.append(TEXT_114);
return stringBuffer.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorSorterGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorSorterGenerator.java
index e6c882944..ab168d941 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorSorterGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/navigator/NavigatorSorterGenerator.java
@@ -16,24 +16,23 @@ public class NavigatorSorterGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static final int GROUP_CATEGORY = ";
- protected final String TEXT_8 = ";";
- protected final String TEXT_9 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static final int SHORTCUTS_CATEGORY = ";
- protected final String TEXT_10 = ";";
- protected final String TEXT_11 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic int category(Object element) {" + NL + "\t\tif (element instanceof ";
- protected final String TEXT_12 = ") {" + NL + "\t\t\t";
- protected final String TEXT_13 = " item = (";
- protected final String TEXT_14 = ") element;";
- protected final String TEXT_15 = NL + "\t\t\tif (item.getView().getEAnnotation(\"Shortcut\") != null) { //$NON-NLS-1$" + NL + "\t\t\t\treturn SHORTCUTS_CATEGORY;" + NL + "\t\t\t}";
- protected final String TEXT_16 = NL + "\t\t\treturn ";
- protected final String TEXT_17 = ".getVisualID(item.getView());" + NL + "\t\t}" + NL + "\t\treturn GROUP_CATEGORY;" + NL + "\t}" + NL + "\t" + NL + "}";
- protected final String TEXT_18 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static final int GROUP_CATEGORY = ";
+ protected final String TEXT_7 = ";";
+ protected final String TEXT_8 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static final int SHORTCUTS_CATEGORY = ";
+ protected final String TEXT_9 = ";";
+ protected final String TEXT_10 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic int category(Object element) {" + NL + "\t\tif (element instanceof ";
+ protected final String TEXT_11 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_12 = " item = (";
+ protected final String TEXT_13 = ") element;";
+ protected final String TEXT_14 = NL + "\t\t\tif (item.getView().getEAnnotation(\"Shortcut\") != null) { //$NON-NLS-1$" + NL + "\t\t\t\treturn SHORTCUTS_CATEGORY;" + NL + "\t\t\t}";
+ protected final String TEXT_15 = NL + "\t\t\treturn ";
+ protected final String TEXT_16 = ".getVisualID(item.getView());" + NL + "\t\t}" + NL + "\t\treturn GROUP_CATEGORY;" + NL + "\t}" + NL + "\t" + NL + "}";
+ protected final String TEXT_17 = NL;
public String generate(Object argument)
{
@@ -55,45 +54,44 @@ for (Iterator it = commonBaseElements.iterator(); it.hasNext();) {
int shortcutsVisualID = groupVisualID++;
groupVisualID++;
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genNavigator.getSorterClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.ViewerSorter"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(groupVisualID);
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
if (genDiagram.generateCreateShortcutAction()) {
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(shortcutsVisualID);
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
}
+ stringBuffer.append(TEXT_10);
+ stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName(genNavigator.getNavigatorItemQualifiedClassName()));
- stringBuffer.append(TEXT_14);
if (genDiagram.generateCreateShortcutAction()) {
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
}
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
index 554c33c89..e36aab56c 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
@@ -17,31 +17,30 @@ public class CompartmentItemSemanticEditPolicyGenerator {
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {";
+ protected final String TEXT_7 = NL;
protected final String TEXT_8 = NL;
- protected final String TEXT_9 = NL;
- protected final String TEXT_10 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_11 = " getCreateCommand(";
- protected final String TEXT_12 = " req) {";
- protected final String TEXT_13 = NL + "\t\tif (";
- protected final String TEXT_14 = ".";
- protected final String TEXT_15 = " == req.getElementType()) {";
- protected final String TEXT_16 = "\t\t" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
- protected final String TEXT_17 = ".eINSTANCE.get";
- protected final String TEXT_18 = "()";
- protected final String TEXT_19 = "/* FIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually */";
- protected final String TEXT_20 = ");" + NL + "\t\t\t}";
- protected final String TEXT_21 = NL + "\t\t\treturn getGEFWrapper(new ";
- protected final String TEXT_22 = "(req));" + NL + "\t\t}";
- protected final String TEXT_23 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
- protected final String TEXT_24 = NL + "}";
- protected final String TEXT_25 = NL;
+ protected final String TEXT_9 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_10 = " getCreateCommand(";
+ protected final String TEXT_11 = " req) {";
+ protected final String TEXT_12 = NL + "\t\tif (";
+ protected final String TEXT_13 = ".";
+ protected final String TEXT_14 = " == req.getElementType()) {";
+ protected final String TEXT_15 = "\t\t" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_16 = ".eINSTANCE.get";
+ protected final String TEXT_17 = "()";
+ protected final String TEXT_18 = "/* FIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually */";
+ protected final String TEXT_19 = ");" + NL + "\t\t\t}";
+ protected final String TEXT_20 = NL + "\t\t\treturn getGEFWrapper(new ";
+ protected final String TEXT_21 = "(req));" + NL + "\t\t}";
+ protected final String TEXT_22 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
+ protected final String TEXT_23 = NL + "}";
+ protected final String TEXT_24 = NL;
protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
StringBuffer result = new StringBuffer();
@@ -160,67 +159,66 @@ final GenCompartment genCompartment = (GenCompartment) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
GenDiagram genDiagram = genCompartment.getDiagram();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genCompartment.getItemSemanticEditPolicyClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getBaseItemSemanticEditPolicyQualifiedClassName()));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
// TODO: do not generate this edit policy for empty compartments.
if (genCompartment.getChildNodes().size() > 0) {
Collection<GenChildNode> childNodes = genCompartment.getChildNodes();
+ stringBuffer.append(TEXT_7);
stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_9);
- stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
for (Iterator<? extends GenNode> nodes = childNodes.iterator(); nodes.hasNext(); ) {
GenNode genChildNode = nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
if (modelFacet == null) {
continue;
}
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(genChildNode.getUniqueIdentifier());
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
if (!modelFacet.isPhantomElement()) {
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
if (modelFacet.getContainmentMetaFeature() != null) {
stringBuffer.append(importManager.getImportedName(modelFacet.getContainmentMetaFeature().getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
} else {
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
}
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
}
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName(genChildNode.getCreateCommandQualifiedClassName()));
+ stringBuffer.append(TEXT_21);
+ }
stringBuffer.append(TEXT_22);
}
stringBuffer.append(TEXT_23);
- }
- stringBuffer.append(TEXT_24);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
return stringBuffer.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramItemSemanticEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramItemSemanticEditPolicyGenerator.java
index 251720e4a..d6997e9ce 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramItemSemanticEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/DiagramItemSemanticEditPolicyGenerator.java
@@ -17,30 +17,29 @@ public class DiagramItemSemanticEditPolicyGenerator {
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;" + NL + "import org.eclipse.gef.commands.Command;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.emf.transaction.TransactionalEditingDomain;" + NL + "import org.eclipse.gef.commands.Command;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {";
+ protected final String TEXT_7 = NL;
protected final String TEXT_8 = NL;
- protected final String TEXT_9 = NL;
- protected final String TEXT_10 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_11 = " getCreateCommand(";
- protected final String TEXT_12 = " req) {";
- protected final String TEXT_13 = NL + "\t\tif (";
- protected final String TEXT_14 = ".";
- protected final String TEXT_15 = " == req.getElementType()) {";
- protected final String TEXT_16 = "\t\t" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
- protected final String TEXT_17 = ".eINSTANCE.get";
- protected final String TEXT_18 = "()";
- protected final String TEXT_19 = "/* FIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually */";
- protected final String TEXT_20 = ");" + NL + "\t\t\t}";
- protected final String TEXT_21 = NL + "\t\t\treturn getGEFWrapper(new ";
- protected final String TEXT_22 = "(req));" + NL + "\t\t}";
- protected final String TEXT_23 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDuplicateCommand(DuplicateElementsRequest req) {" + NL + "\t\tTransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();" + NL + "\t\treturn getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {" + NL + "\t\t\tsuper(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());" + NL + "\t\t}" + NL + "\t}" + NL + "}";
- protected final String TEXT_24 = NL;
+ protected final String TEXT_9 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_10 = " getCreateCommand(";
+ protected final String TEXT_11 = " req) {";
+ protected final String TEXT_12 = NL + "\t\tif (";
+ protected final String TEXT_13 = ".";
+ protected final String TEXT_14 = " == req.getElementType()) {";
+ protected final String TEXT_15 = "\t\t" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_16 = ".eINSTANCE.get";
+ protected final String TEXT_17 = "()";
+ protected final String TEXT_18 = "/* FIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually */";
+ protected final String TEXT_19 = ");" + NL + "\t\t\t}";
+ protected final String TEXT_20 = NL + "\t\t\treturn getGEFWrapper(new ";
+ protected final String TEXT_21 = "(req));" + NL + "\t\t}";
+ protected final String TEXT_22 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDuplicateCommand(DuplicateElementsRequest req) {" + NL + "\t\tTransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();" + NL + "\t\treturn getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {" + NL + "\t\t\tsuper(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());" + NL + "\t\t}" + NL + "\t}" + NL + "}";
+ protected final String TEXT_23 = NL;
protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
StringBuffer result = new StringBuffer();
@@ -157,61 +156,60 @@ public class DiagramItemSemanticEditPolicyGenerator {
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getItemSemanticEditPolicyClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getBaseItemSemanticEditPolicyQualifiedClassName()));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
Collection<GenTopLevelNode> childNodes = genDiagram.getTopLevelNodes();
+ stringBuffer.append(TEXT_7);
stringBuffer.append(TEXT_8);
stringBuffer.append(TEXT_9);
- stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
for (Iterator<? extends GenNode> nodes = childNodes.iterator(); nodes.hasNext(); ) {
GenNode genChildNode = nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
if (modelFacet == null) {
continue;
}
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(genChildNode.getUniqueIdentifier());
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
if (!modelFacet.isPhantomElement()) {
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
if (modelFacet.getContainmentMetaFeature() != null) {
stringBuffer.append(importManager.getImportedName(modelFacet.getContainmentMetaFeature().getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
} else {
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
}
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
}
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName(genChildNode.getCreateCommandQualifiedClassName()));
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
}
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
return stringBuffer.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/GraphicalNodeEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/GraphicalNodeEditPolicyGenerator.java
index 8b578669a..f9790efb2 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/GraphicalNodeEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/GraphicalNodeEditPolicyGenerator.java
@@ -16,42 +16,41 @@ public class GraphicalNodeEditPolicyGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_8 = " getConnectionCompleteCommand(" + NL + "\t\t\t";
- protected final String TEXT_9 = " request) {" + NL + "\t\t";
- protected final String TEXT_10 = " elementType = getElementType(request);";
- protected final String TEXT_11 = NL + "\t\tif (";
- protected final String TEXT_12 = ".";
- protected final String TEXT_13 = " == elementType) {";
- protected final String TEXT_14 = NL + "\t\t\tif (request.getSourceEditPart() != getHost()) {";
- protected final String TEXT_15 = NL + "\t\t\treturn getConnectionWithReorientedViewCompleteCommand(request);";
- protected final String TEXT_16 = NL + "\t\t\t}";
- protected final String TEXT_17 = NL + "\t\t}";
- protected final String TEXT_18 = NL + "\t\treturn super.getConnectionCompleteCommand(request);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_19 = " getElementType(";
- protected final String TEXT_20 = " request) {" + NL + "\t\tif (request instanceof ";
- protected final String TEXT_21 = ") {" + NL + "\t\t\t";
- protected final String TEXT_22 = " requestAdapter = ((";
- protected final String TEXT_23 = ") request)" + NL + "\t\t\t\t\t.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();" + NL + "\t\t\treturn (";
- protected final String TEXT_24 = ") requestAdapter.getAdapter(";
- protected final String TEXT_25 = ".class);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_26 = " getConnectionWithReorientedViewCompleteCommand(";
- protected final String TEXT_27 = " request) {" + NL + "\t\t";
- protected final String TEXT_28 = " c = (";
- protected final String TEXT_29 = ") super.getConnectionCompleteCommand(request);" + NL + "\t\t";
- protected final String TEXT_30 = " cc = (";
- protected final String TEXT_31 = ") c.getICommand();" + NL + "\t\t";
- protected final String TEXT_32 = " editingDomain = ((";
- protected final String TEXT_33 = ") getHost()).getEditingDomain();" + NL + "\t\t";
- protected final String TEXT_34 = " rcvCommand =" + NL + "\t\t\tnew ";
- protected final String TEXT_35 = "(editingDomain, null);" + NL + "\t\trcvCommand.setEdgeAdaptor(getViewAdapter());" + NL + "\t\tcc.compose(rcvCommand);" + NL + "\t\treturn c;" + NL + "\t}" + NL + "}";
- protected final String TEXT_36 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_7 = " getConnectionCompleteCommand(" + NL + "\t\t\t";
+ protected final String TEXT_8 = " request) {" + NL + "\t\t";
+ protected final String TEXT_9 = " elementType = getElementType(request);";
+ protected final String TEXT_10 = NL + "\t\tif (";
+ protected final String TEXT_11 = ".";
+ protected final String TEXT_12 = " == elementType) {";
+ protected final String TEXT_13 = NL + "\t\t\tif (request.getSourceEditPart() != getHost()) {";
+ protected final String TEXT_14 = NL + "\t\t\treturn getConnectionWithReorientedViewCompleteCommand(request);";
+ protected final String TEXT_15 = NL + "\t\t\t}";
+ protected final String TEXT_16 = NL + "\t\t}";
+ protected final String TEXT_17 = NL + "\t\treturn super.getConnectionCompleteCommand(request);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_18 = " getElementType(";
+ protected final String TEXT_19 = " request) {" + NL + "\t\tif (request instanceof ";
+ protected final String TEXT_20 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_21 = " requestAdapter = ((";
+ protected final String TEXT_22 = ") request)" + NL + "\t\t\t\t\t.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();" + NL + "\t\t\treturn (";
+ protected final String TEXT_23 = ") requestAdapter.getAdapter(";
+ protected final String TEXT_24 = ".class);" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_25 = " getConnectionWithReorientedViewCompleteCommand(";
+ protected final String TEXT_26 = " request) {" + NL + "\t\t";
+ protected final String TEXT_27 = " c = (";
+ protected final String TEXT_28 = ") super.getConnectionCompleteCommand(request);" + NL + "\t\t";
+ protected final String TEXT_29 = " cc = (";
+ protected final String TEXT_30 = ") c.getICommand();" + NL + "\t\t";
+ protected final String TEXT_31 = " editingDomain = ((";
+ protected final String TEXT_32 = ") getHost()).getEditingDomain();" + NL + "\t\t";
+ protected final String TEXT_33 = " rcvCommand =" + NL + "\t\t\tnew ";
+ protected final String TEXT_34 = "(editingDomain, null);" + NL + "\t\trcvCommand.setEdgeAdaptor(getViewAdapter());" + NL + "\t\tcc.compose(rcvCommand);" + NL + "\t\treturn c;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_35 = NL;
public String generate(Object argument)
{
@@ -61,82 +60,81 @@ final GenNode genNode = (GenNode) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final GenDiagram genDiagram = genNode.getDiagram();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genNode.getGraphicalNodeEditPolicyClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateConnectionRequest"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
for (Iterator it = genNode.getReorientedIncomingLinks().iterator(); it.hasNext();) {
GenLink nextLink = (GenLink) it.next();
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(nextLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
if (nextLink.isOutgoingCreationAllowed()) {
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
}
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
if (nextLink.isOutgoingCreationAllowed()) {
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
}
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
}
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateConnectionRequest"));
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest"));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter"));
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest"));
+ stringBuffer.append(TEXT_22);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
stringBuffer.append(TEXT_23);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
stringBuffer.append(TEXT_24);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType"));
- stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command"));
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateConnectionRequest"));
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy"));
stringBuffer.append(TEXT_27);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy"));
stringBuffer.append(TEXT_28);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CompositeCommand"));
stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CompositeCommand"));
stringBuffer.append(TEXT_30);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.core.command.CompositeCommand"));
- stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart"));
+ stringBuffer.append(TEXT_32);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getReorientConnectionViewCommandQualifiedClassName()));
stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(genDiagram.getReorientConnectionViewCommandQualifiedClassName()));
stringBuffer.append(TEXT_34);
- stringBuffer.append(importManager.getImportedName(genDiagram.getReorientConnectionViewCommandQualifiedClassName()));
- stringBuffer.append(TEXT_35);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ContributionItemProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ContributionItemProviderGenerator.java
index a62f9ea59..c6fea6332 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ContributionItemProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ContributionItemProviderGenerator.java
@@ -15,19 +15,18 @@ public class ContributionItemProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_8 = " createAction(String actionId, ";
- protected final String TEXT_9 = " partDescriptor) {" + NL + "\t\tif (actionId.equals(";
- protected final String TEXT_10 = ".ID)) {" + NL + "\t\t\treturn new ";
- protected final String TEXT_11 = "(new ";
- protected final String TEXT_12 = "());" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_13 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_7 = " createAction(String actionId, ";
+ protected final String TEXT_8 = " partDescriptor) {" + NL + "\t\tif (actionId.equals(";
+ protected final String TEXT_9 = ".ID)) {" + NL + "\t\t\treturn new ";
+ protected final String TEXT_10 = "(new ";
+ protected final String TEXT_11 = "());" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_12 = NL;
public String generate(Object argument)
{
@@ -36,35 +35,34 @@ public class ContributionItemProviderGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getContributionItemProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.printing.actions.PrintPreviewAction"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.RenderedPrintPreviewAction"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.EnhancedPrintActionHelper"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java
index a0d390b6c..b10c2f9c6 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/EditPartProviderGenerator.java
@@ -15,18 +15,17 @@ public class EditPartProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.lang.ref.WeakReference;" + NL + "" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gef.EditPartFactory;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import ";
- protected final String TEXT_5 = ".";
- protected final String TEXT_6 = ";";
- protected final String TEXT_7 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_8 = " extends AbstractEditPartProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditPartFactory factory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean allowCaching;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_9 = "() {" + NL + "\t\tsetFactory(new ";
- protected final String TEXT_10 = "());" + NL + "\t\tsetAllowCaching(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final EditPartFactory getFactory() {" + NL + "\t\treturn factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFactory(EditPartFactory factory) {" + NL + "\t\tthis.factory = factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isAllowCaching() {" + NL + "\t\treturn allowCaching;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected synchronized void setAllowCaching(boolean allowCaching) {" + NL + "\t\tthis.allowCaching = allowCaching;" + NL + "\t\tif (!allowCaching) {" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart createEditPart(View view) {" + NL + "\t\tEditPart part = factory.createEditPart(null, view);" + NL + "\t\tif (part instanceof IGraphicalEditPart) {" + NL + "\t\t\treturn (IGraphicalEditPart) part;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart getCachedPart(View view) {" + NL + "\t\tif (cachedView != null && cachedView.get() == view) {" + NL + "\t\t\treturn (IGraphicalEditPart) cachedPart.get();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized IGraphicalEditPart createGraphicEditPart(View view) {" + NL + "\t\tif (isAllowCaching()) {" + NL + "\t\t\tIGraphicalEditPart part = getCachedPart(view);" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\treturn part;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createEditPart(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof CreateGraphicEditPartOperation) {" + NL + "\t\t\tView view = ((IEditPartOperation) operation).getView();" + NL + "\t\t\tif (!";
- protected final String TEXT_11 = ".MODEL_ID.equals(";
- protected final String TEXT_12 = ".getModelID(view))) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tif (isAllowCaching() && getCachedPart(view) != null) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tIGraphicalEditPart part = createEditPart(view);" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\tif (isAllowCaching()) {" + NL + "\t\t\t\t\tcachedPart = new WeakReference(part);" + NL + "\t\t\t\t\tcachedView = new WeakReference(view);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.lang.ref.WeakReference;" + NL + "" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gef.EditPartFactory;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import ";
+ protected final String TEXT_4 = ".";
+ protected final String TEXT_5 = ";";
+ protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_7 = " extends AbstractEditPartProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditPartFactory factory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean allowCaching;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedPart;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate WeakReference cachedView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_8 = "() {" + NL + "\t\tsetFactory(new ";
+ protected final String TEXT_9 = "());" + NL + "\t\tsetAllowCaching(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final EditPartFactory getFactory() {" + NL + "\t\treturn factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFactory(EditPartFactory factory) {" + NL + "\t\tthis.factory = factory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final boolean isAllowCaching() {" + NL + "\t\treturn allowCaching;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected synchronized void setAllowCaching(boolean allowCaching) {" + NL + "\t\tthis.allowCaching = allowCaching;" + NL + "\t\tif (!allowCaching) {" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart createEditPart(View view) {" + NL + "\t\tEditPart part = factory.createEditPart(null, view);" + NL + "\t\tif (part instanceof IGraphicalEditPart) {" + NL + "\t\t\treturn (IGraphicalEditPart) part;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IGraphicalEditPart getCachedPart(View view) {" + NL + "\t\tif (cachedView != null && cachedView.get() == view) {" + NL + "\t\t\treturn (IGraphicalEditPart) cachedPart.get();" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized IGraphicalEditPart createGraphicEditPart(View view) {" + NL + "\t\tif (isAllowCaching()) {" + NL + "\t\t\tIGraphicalEditPart part = getCachedPart(view);" + NL + "\t\t\tcachedPart = null;" + NL + "\t\t\tcachedView = null;" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\treturn part;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn createEditPart(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic synchronized boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof CreateGraphicEditPartOperation) {" + NL + "\t\t\tView view = ((IEditPartOperation) operation).getView();" + NL + "\t\t\tif (!";
+ protected final String TEXT_10 = ".MODEL_ID.equals(";
+ protected final String TEXT_11 = ".getModelID(view))) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t\tif (isAllowCaching() && getCachedPart(view) != null) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t\tIGraphicalEditPart part = createEditPart(view);" + NL + "\t\t\tif (part != null) {" + NL + "\t\t\t\tif (isAllowCaching()) {" + NL + "\t\t\t\t\tcachedPart = new WeakReference(part);" + NL + "\t\t\t\t\tcachedView = new WeakReference(view);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}";
public String generate(Object argument)
{
@@ -35,33 +34,32 @@ public class EditPartProviderGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
stringBuffer.append(genDiagram.getEditPartsPackageName());
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getEditPartFactoryClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
importManager.markImportLocation(stringBuffer);
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(genDiagram.getEditPartProviderClassName());
stringBuffer.append(TEXT_7);
stringBuffer.append(genDiagram.getEditPartProviderClassName());
stringBuffer.append(TEXT_8);
- stringBuffer.append(genDiagram.getEditPartProviderClassName());
- stringBuffer.append(TEXT_9);
stringBuffer.append(genDiagram.getEditPartFactoryClassName());
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
importManager.emitSortedImports();
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ElementInitializersGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ElementInitializersGenerator.java
index ef0b3ad69..7874fe429 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ElementInitializersGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ElementInitializersGenerator.java
@@ -17,91 +17,89 @@ public class ElementInitializersGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ElementInitializers {";
- protected final String TEXT_7 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class Initializers {";
- protected final String TEXT_8 = "\t\t";
- protected final String TEXT_9 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final IObjectInitializer ";
- protected final String TEXT_10 = " = new ObjectInitializer(";
- protected final String TEXT_11 = ") {";
- protected final String TEXT_12 = NL + "\t\tObjectInitializer ";
- protected final String TEXT_13 = "() {" + NL + "\t\t\treturn new ObjectInitializer(";
- protected final String TEXT_14 = ") {";
- protected final String TEXT_15 = NL + "\t\t \tprotected void init() {\t\t\t\t";
- protected final String TEXT_16 = "\t\t\t" + NL + "\t\t\t\tadd(createNewElementFeatureInitializer(";
- protected final String TEXT_17 = ", new ObjectInitializer[] {";
- protected final String TEXT_18 = NL + "\t\t\t\t\t";
- protected final String TEXT_19 = "(), ";
- protected final String TEXT_20 = NL + "\t\t\t\t}));";
- protected final String TEXT_21 = "\t\t\t" + NL + "\t\t\t\tadd(createExpressionFeatureInitializer(";
- protected final String TEXT_22 = ", ";
- protected final String TEXT_23 = "null";
- protected final String TEXT_24 = ".";
- protected final String TEXT_25 = "(";
- protected final String TEXT_26 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_27 = ", ";
- protected final String TEXT_28 = ")";
- protected final String TEXT_29 = ".";
- protected final String TEXT_30 = "(";
- protected final String TEXT_31 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_32 = ")";
- protected final String TEXT_33 = "new ";
- protected final String TEXT_34 = "(";
- protected final String TEXT_35 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
- protected final String TEXT_36 = " env) {\t" + NL + "\t\t";
- protected final String TEXT_37 = " self = (";
- protected final String TEXT_38 = ")context;";
- protected final String TEXT_39 = "\t" + NL + "\t\t";
- protected final String TEXT_40 = " ";
- protected final String TEXT_41 = " = (";
- protected final String TEXT_42 = ")env.get(\"";
- protected final String TEXT_43 = "\"); //$NON-NLS-1$";
- protected final String TEXT_44 = NL + "\t\treturn ";
- protected final String TEXT_45 = ".";
- protected final String TEXT_46 = "(self";
- protected final String TEXT_47 = ", ";
- protected final String TEXT_48 = ");" + NL + "\t}" + NL + "}";
- protected final String TEXT_49 = NL + "));";
- protected final String TEXT_50 = "\t\t\t}";
- protected final String TEXT_51 = NL + "\t\t\t\t}; // ";
- protected final String TEXT_52 = " ObjectInitializer" + NL + "\t\t\t}";
- protected final String TEXT_53 = NL + "\t\t}; // ";
- protected final String TEXT_54 = " ObjectInitializer";
- protected final String TEXT_55 = NL + "\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate Initializers() {" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic static interface IObjectInitializer {" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tpublic void init(";
- protected final String TEXT_56 = " instance);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tpublic static abstract class ObjectInitializer implements IObjectInitializer {" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tfinal ";
- protected final String TEXT_57 = " element;\t\t" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tprivate ";
- protected final String TEXT_58 = " featureInitializers = new ";
- protected final String TEXT_59 = "();" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tObjectInitializer(";
- protected final String TEXT_60 = " element) {" + NL + "\t\t\t\tthis.element = element;" + NL + "\t\t\t\tinit();" + NL + "\t\t\t}" + NL + "\t\t\t/**" + NL + "\t\t \t * @generated" + NL + "\t\t \t */" + NL + "\t\t \tprotected abstract void init();\t\t\t\t\t\t\t" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tprotected final IFeatureInitializer add(IFeatureInitializer initializer) {" + NL + "\t\t\t\tfeatureInitializers.add(initializer);" + NL + "\t\t\t\treturn initializer;" + NL + "\t\t\t}" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tpublic void init(";
- protected final String TEXT_61 = " instance) {" + NL + "\t\t\t\tfor (java.util.Iterator it = featureInitializers.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tIFeatureInitializer nextExpr = (IFeatureInitializer)it.next();" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t\t\t} catch(RuntimeException e) {" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_62 = ".getInstance().logError(\"Feature initialization failed\", e); //$NON-NLS-1$\t\t\t\t\t\t" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t} // end of ObjectInitializer" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tinterface IFeatureInitializer {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tvoid init(EObject contextInstance);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic IFeatureInitializer createNewElementFeatureInitializer(";
- protected final String TEXT_63 = " initFeature, ObjectInitializer[] newObjectInitializers) {" + NL + "\t\t\tfinal ";
- protected final String TEXT_64 = " feature = initFeature;" + NL + "\t\t\tfinal ObjectInitializer[] initializers = newObjectInitializers;" + NL + "\t\t\treturn new IFeatureInitializer() {" + NL + "\t\t\t\tpublic void init(EObject contextInstance) {" + NL + "\t\t\t\t\tfor (int i = 0; i < initializers.length; i++) {" + NL + "\t\t\t\t\t\tEObject newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);" + NL + "\t\t\t\t\t\tif(feature.isMany()) {" + NL + "\t\t\t\t\t\t\t((";
- protected final String TEXT_65 = ")contextInstance.eGet(feature)).add(newInstance);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tcontextInstance.eSet(feature, newInstance);" + NL + "\t\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tinitializers[i].init(newInstance);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic IFeatureInitializer createExpressionFeatureInitializer(";
- protected final String TEXT_66 = " initFeature, ";
- protected final String TEXT_67 = " valueExpression) {" + NL + "\t\t\tfinal ";
- protected final String TEXT_68 = " feature = initFeature;" + NL + "\t\t\tfinal ";
- protected final String TEXT_69 = " expression = valueExpression;" + NL + "\t\t\treturn new IFeatureInitializer() {\t\t\t\t" + NL + "\t\t\t\tpublic void init(EObject contextInstance) {" + NL + "\t\t\t\t\texpression.assignTo(feature, contextInstance);" + NL + "\t\t\t\t}" + NL + "\t\t\t};\t\t\t" + NL + "\t\t}\t\t";
- protected final String TEXT_70 = NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class ";
- protected final String TEXT_71 = " {";
- protected final String TEXT_72 = NL;
- protected final String TEXT_73 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
- protected final String TEXT_74 = " ";
- protected final String TEXT_75 = "(";
- protected final String TEXT_76 = " self";
- protected final String TEXT_77 = ", ";
- protected final String TEXT_78 = " ";
- protected final String TEXT_79 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
- protected final String TEXT_80 = ".NoImplException(\"No user java implementation provided in '";
- protected final String TEXT_81 = "' operation\"); //$NON-NLS-1$" + NL + "}";
- protected final String TEXT_82 = NL + "\t\t} //";
- protected final String TEXT_83 = NL + "\t} // end of Initializers";
- protected final String TEXT_84 = NL + "}";
- protected final String TEXT_85 = NL;
+ protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ElementInitializers {";
+ protected final String TEXT_6 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class Initializers {";
+ protected final String TEXT_7 = "\t\t";
+ protected final String TEXT_8 = NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final IObjectInitializer ";
+ protected final String TEXT_9 = " = new ObjectInitializer(";
+ protected final String TEXT_10 = ") {";
+ protected final String TEXT_11 = NL + "\t\tObjectInitializer ";
+ protected final String TEXT_12 = "() {" + NL + "\t\t\treturn new ObjectInitializer(";
+ protected final String TEXT_13 = ") {";
+ protected final String TEXT_14 = NL + "\t\t \tprotected void init() {\t\t\t\t";
+ protected final String TEXT_15 = "\t\t\t" + NL + "\t\t\t\tadd(createNewElementFeatureInitializer(";
+ protected final String TEXT_16 = ", new ObjectInitializer[] {";
+ protected final String TEXT_17 = NL + "\t\t\t\t\t";
+ protected final String TEXT_18 = "(), ";
+ protected final String TEXT_19 = NL + "\t\t\t\t}));";
+ protected final String TEXT_20 = "\t\t\t" + NL + "\t\t\t\tadd(createExpressionFeatureInitializer(";
+ protected final String TEXT_21 = ", ";
+ protected final String TEXT_22 = "null";
+ protected final String TEXT_23 = ".";
+ protected final String TEXT_24 = "(";
+ protected final String TEXT_25 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_26 = ", ";
+ protected final String TEXT_27 = ")";
+ protected final String TEXT_28 = ".";
+ protected final String TEXT_29 = "(";
+ protected final String TEXT_30 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_31 = ")";
+ protected final String TEXT_32 = "new ";
+ protected final String TEXT_33 = "(";
+ protected final String TEXT_34 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
+ protected final String TEXT_35 = " env) {\t" + NL + "\t\t";
+ protected final String TEXT_36 = " self = (";
+ protected final String TEXT_37 = ")context;";
+ protected final String TEXT_38 = "\t" + NL + "\t\t";
+ protected final String TEXT_39 = " ";
+ protected final String TEXT_40 = " = (";
+ protected final String TEXT_41 = ")env.get(\"";
+ protected final String TEXT_42 = "\"); //$NON-NLS-1$";
+ protected final String TEXT_43 = NL + "\t\treturn ";
+ protected final String TEXT_44 = ".";
+ protected final String TEXT_45 = "(self";
+ protected final String TEXT_46 = ", ";
+ protected final String TEXT_47 = ");" + NL + "\t}" + NL + "}";
+ protected final String TEXT_48 = NL + "));";
+ protected final String TEXT_49 = "\t\t\t}";
+ protected final String TEXT_50 = NL + "\t\t\t\t}; // ";
+ protected final String TEXT_51 = " ObjectInitializer" + NL + "\t\t\t}";
+ protected final String TEXT_52 = NL + "\t\t}; // ";
+ protected final String TEXT_53 = " ObjectInitializer";
+ protected final String TEXT_54 = NL + "\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate Initializers() {" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tpublic static interface IObjectInitializer {" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tpublic void init(";
+ protected final String TEXT_55 = " instance);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tpublic static abstract class ObjectInitializer implements IObjectInitializer {" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tfinal ";
+ protected final String TEXT_56 = " element;\t\t" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tprivate ";
+ protected final String TEXT_57 = " featureInitializers = new ";
+ protected final String TEXT_58 = "();" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tObjectInitializer(";
+ protected final String TEXT_59 = " element) {" + NL + "\t\t\t\tthis.element = element;" + NL + "\t\t\t\tinit();" + NL + "\t\t\t}" + NL + "\t\t\t/**" + NL + "\t\t \t * @generated" + NL + "\t\t \t */" + NL + "\t\t \tprotected abstract void init();\t\t\t\t\t\t\t" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tprotected final IFeatureInitializer add(IFeatureInitializer initializer) {" + NL + "\t\t\t\tfeatureInitializers.add(initializer);" + NL + "\t\t\t\treturn initializer;" + NL + "\t\t\t}" + NL + "\t\t\t/** " + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tpublic void init(";
+ protected final String TEXT_60 = " instance) {" + NL + "\t\t\t\tfor (java.util.Iterator it = featureInitializers.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tIFeatureInitializer nextExpr = (IFeatureInitializer)it.next();" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t\t\t} catch(RuntimeException e) {" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_61 = ".getInstance().logError(\"Feature initialization failed\", e); //$NON-NLS-1$\t\t\t\t\t\t" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t} // end of ObjectInitializer" + NL + "\t\t" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tinterface IFeatureInitializer {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */" + NL + "\t\t\tvoid init(EObject contextInstance);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic IFeatureInitializer createNewElementFeatureInitializer(";
+ protected final String TEXT_62 = " initFeature, ObjectInitializer[] newObjectInitializers) {" + NL + "\t\t\tfinal ";
+ protected final String TEXT_63 = " feature = initFeature;" + NL + "\t\t\tfinal ObjectInitializer[] initializers = newObjectInitializers;" + NL + "\t\t\treturn new IFeatureInitializer() {" + NL + "\t\t\t\tpublic void init(EObject contextInstance) {" + NL + "\t\t\t\t\tfor (int i = 0; i < initializers.length; i++) {" + NL + "\t\t\t\t\t\tEObject newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);" + NL + "\t\t\t\t\t\tif(feature.isMany()) {" + NL + "\t\t\t\t\t\t\t((";
+ protected final String TEXT_64 = ")contextInstance.eGet(feature)).add(newInstance);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tcontextInstance.eSet(feature, newInstance);" + NL + "\t\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tinitializers[i].init(newInstance);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic IFeatureInitializer createExpressionFeatureInitializer(";
+ protected final String TEXT_65 = " initFeature, ";
+ protected final String TEXT_66 = " valueExpression) {" + NL + "\t\t\tfinal ";
+ protected final String TEXT_67 = " feature = initFeature;" + NL + "\t\t\tfinal ";
+ protected final String TEXT_68 = " expression = valueExpression;" + NL + "\t\t\treturn new IFeatureInitializer() {\t\t\t\t" + NL + "\t\t\t\tpublic void init(EObject contextInstance) {" + NL + "\t\t\t\t\texpression.assignTo(feature, contextInstance);" + NL + "\t\t\t\t}" + NL + "\t\t\t};\t\t\t" + NL + "\t\t}\t\t";
+ protected final String TEXT_69 = NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class ";
+ protected final String TEXT_70 = " {";
+ protected final String TEXT_71 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
+ protected final String TEXT_72 = " ";
+ protected final String TEXT_73 = "(";
+ protected final String TEXT_74 = " self";
+ protected final String TEXT_75 = ", ";
+ protected final String TEXT_76 = " ";
+ protected final String TEXT_77 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
+ protected final String TEXT_78 = ".NoImplException(\"No user java implementation provided in '";
+ protected final String TEXT_79 = "' operation\"); //$NON-NLS-1$" + NL + "}";
+ protected final String TEXT_80 = NL + "\t\t} //";
+ protected final String TEXT_81 = NL + "\t} // end of Initializers";
+ protected final String TEXT_82 = NL + "}";
+ protected final String TEXT_83 = NL;
public String generate(Object argument)
{
@@ -110,17 +108,16 @@ public class ElementInitializersGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.registerInnerClass("Initializers");
importManager.registerInnerClass("IObjectInitializer");
@@ -129,10 +126,10 @@ importManager.registerInnerClass("IFeatureInitializer");
final String javaExprContainer = "Java";
importManager.registerInnerClass(javaExprContainer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
importManager.markImportLocation(stringBuffer);
String pluginClassName = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
int elementInitializerCount = 0;
List elements = new LinkedList();
@@ -168,7 +165,7 @@ if(elementInitializerCount > 0 && genDiagram.getEditorGen().getExpressionProvide
final String __javaOperationContainer = javaExprContainer; // place java expression methods here
final Map __exprEnvVariables = Collections.EMPTY_MAP;
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
for (Map.Entry<TypeModelFacet, GenCommonBase> next : genDiagram.getTypeModelFacet2GenBaseMap().entrySet()) {
TypeModelFacet modelFacet = next.getKey();
@@ -179,44 +176,44 @@ for (Map.Entry<TypeModelFacet, GenCommonBase> next : genDiagram.getTypeModelFace
for(GenFeatureSeqInitializer nextFtSeqInitializer : rootFtSeqInitializer.getAllFeatureSeqInitializers()) {
boolean isTopLevelObjInit = nextFtSeqInitializer == rootFtSeqInitializer;
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
if(isTopLevelObjInit){
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(nextFtSeqInitializer.getElementClassAccessor(importManager));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
} else {
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(nextFtSeqInitializer.getElementClassAccessor(importManager));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
}
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
for(GenFeatureInitializer nextFtInitializer : (List<GenFeatureInitializer>)nextFtSeqInitializer.getInitializers()) {
String metaFeatureAccessor = nextFtSeqInitializer.getFeatureAccessor(nextFtInitializer, importManager);
if(nextFtInitializer instanceof GenReferenceNewElementSpec) {
GenReferenceNewElementSpec newElementSpec = (GenReferenceNewElementSpec)nextFtInitializer;
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(metaFeatureAccessor);
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
for(GenFeatureSeqInitializer newElemInit : (List<GenFeatureSeqInitializer>)newElementSpec.getNewElementInitializers()) {
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(newElemInit.getInitializerFieldName(id));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
} // end of newElementInitializers
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
} // end of GenReferenceNewElementSpec
else if(nextFtInitializer instanceof GenFeatureValueSpec) {
String __outEnvVarName = ""; // no env to setup;
GenClassifier __genExprContext = nextFtSeqInitializer.getElementClass();
GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)nextFtInitializer;
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(metaFeatureAccessor);
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
{ /*begin the scope*/
/*
@@ -232,7 +229,7 @@ String __javaOperationContainer;
if(__genExprProvider == null || __importedAbstractClass == null) {
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
@@ -241,26 +238,26 @@ String __javaOperationContainer;
if(!__exprEnvVariables.isEmpty()) {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(__outEnvVarName);
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
} else {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
}
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
@@ -268,105 +265,105 @@ String __javaOperationContainer;
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(__importedAbstractClass);
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_35);
+ stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_37);
- stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_38);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String nextVariableName = (String)envVarIt.next();
org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
}
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) {
stringBuffer.append(__javaOperationContainer);
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
}
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
stringBuffer.append((String)envVarIt.next());
}
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
}
} /*end of scope*/
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
} // end of GenFeatureValueSpec
} // end of GenFeatureInitializer iteration
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
if(!isTopLevelObjInit) {
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(nextFtSeqInitializer.getInitializerFieldName(id));
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
} // GenFeatureInitializer iteration
} // All GenFeatureSeqInitializer iteration
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(rootFtSeqInitializer.getInitializerFieldName(id));
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
} // (modelFacet.getModelElementInitializer() instanceof GenFeatureSeqInitializer)
}
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(pluginClassName);
+ stringBuffer.append(TEXT_61);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
stringBuffer.append(TEXT_62);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
stringBuffer.append(TEXT_63);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_65);
stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
if(!javaInitializers.isEmpty()) {
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
stringBuffer.append(javaExprContainer);
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_70);
for(GenFeatureValueSpec __genValueExpression : javaInitializers) {
GenClassifier __genExprContext = __genValueExpression.getFeatureSeqInitializer().getElementClass();
@@ -374,7 +371,6 @@ String __javaOperationContainer;
if(!(provider instanceof GenJavaExpressionProvider)) continue;
String __genExprResultType = provider.getQualifiedTypeInstanceClassName(__genValueExpression.getFeature());
- stringBuffer.append(TEXT_72);
/*
ValueExpression __genValueExpression
@@ -395,13 +391,13 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_72);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_73);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_74);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String __nextVarName = (String)envVarIt.next();
@@ -409,31 +405,31 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_75);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_76);
stringBuffer.append(__nextVarName);
}
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(__importedAbstractExpr);
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_79);
} /* end of GenJavaExpressionProvider */
}
- stringBuffer.append(TEXT_82);
+ stringBuffer.append(TEXT_80);
stringBuffer.append(javaExprContainer);
} /* end of javaInitializers */
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_81);
}
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_82);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_83);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/IconProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/IconProviderGenerator.java
index 16b4571d4..b25e53000 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/IconProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/IconProviderGenerator.java
@@ -15,14 +15,13 @@ public class IconProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;" + NL + "import org.eclipse.swt.graphics.Image;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractProvider implements IIconProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Image getIcon(IAdaptable hint, int flags) {" + NL + "\t\treturn ";
- protected final String TEXT_7 = ".getImage(hint);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetIconOperation) {" + NL + "\t\t\treturn ((GetIconOperation) operation).execute(this) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}";
- protected final String TEXT_8 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;" + NL + "import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;" + NL + "import org.eclipse.swt.graphics.Image;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractProvider implements IIconProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Image getIcon(IAdaptable hint, int flags) {" + NL + "\t\treturn ";
+ protected final String TEXT_6 = ".getImage(hint);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (operation instanceof GetIconOperation) {" + NL + "\t\t\treturn ((GetIconOperation) operation).execute(this) != null;" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_7 = NL;
public String generate(Object argument)
{
@@ -31,25 +30,24 @@ public class IconProviderGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getIconProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
return stringBuffer.toString();
}
}
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 e44be5345..1429f68f6 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
@@ -16,24 +16,23 @@ public class LabelTextViewFactoryGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\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);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\t";
- protected final String TEXT_8 = " styles = new ";
- protected final String TEXT_9 = "();";
- protected final String TEXT_10 = NL + "\t\tstyles.add(";
- protected final String TEXT_11 = ".eINSTANCE.createDescriptionStyle());";
- protected final String TEXT_12 = NL + "\t\tstyles.add(";
- protected final String TEXT_13 = ".eINSTANCE.createFillStyle());" + NL + "\t\tstyles.add(";
- protected final String TEXT_14 = ".eINSTANCE.createLineStyle());";
- protected final String TEXT_15 = "\t\t" + NL + "\t\tstyles.add(";
- protected final String TEXT_16 = ".eINSTANCE.createFontStyle());";
- protected final String TEXT_17 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "}";
- protected final String TEXT_18 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + 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);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\t";
+ protected final String TEXT_7 = " styles = new ";
+ protected final String TEXT_8 = "();";
+ protected final String TEXT_9 = NL + "\t\tstyles.add(";
+ protected final String TEXT_10 = ".eINSTANCE.createDescriptionStyle());";
+ protected final String TEXT_11 = NL + "\t\tstyles.add(";
+ protected final String TEXT_12 = ".eINSTANCE.createFillStyle());" + NL + "\t\tstyles.add(";
+ protected final String TEXT_13 = ".eINSTANCE.createLineStyle());";
+ protected final String TEXT_14 = "\t\t" + NL + "\t\tstyles.add(";
+ protected final String TEXT_15 = ".eINSTANCE.createFontStyle());";
+ protected final String TEXT_16 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_17 = NL;
public String generate(Object argument)
{
@@ -51,57 +50,56 @@ Viewmap viewmap = genLabel.getViewmap();
StyleAttributes styleAttributes = (viewmap == null) ? null : (StyleAttributes)viewmap.find(StyleAttributes.class);
final boolean isFixedFont = styleAttributes != null && styleAttributes.isFixedFont();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genLabel.getNotationViewFactoryClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(layoutHelper.isStoringChildPositions(genLabel.getNode()) ?
importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory") :
importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
if (hasShapeStyles || isDesignLabel) {
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
}
if (hasShapeStyles) {
+ stringBuffer.append(TEXT_11);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_14);
if (!isFixedFont) {
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
}
}
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
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 e6ec63f6a..fec321bba 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
@@ -15,24 +15,23 @@ public class LabelViewFactoryGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;" + NL + "import org.eclipse.gmf.runtime.notation.Node;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractLabelViewFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {" + NL + "\t\tNode view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);";
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = " location = (";
- protected final String TEXT_9 = ") view.getLayoutConstraint();" + NL + "\t\t";
- protected final String TEXT_10 = " mapMode = ";
- protected final String TEXT_11 = ".getMapMode(containerView.getDiagram().getMeasurementUnit());" + NL + "\t\tlocation.setX(mapMode.DPtoLP(";
- protected final String TEXT_12 = "));" + NL + "\t\tlocation.setY(mapMode.DPtoLP(";
- protected final String TEXT_13 = "));";
- protected final String TEXT_14 = NL + "\t\treturn view;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\tList styles = new ArrayList();";
- protected final String TEXT_15 = NL + "\t\tstyles.add(";
- protected final String TEXT_16 = ".eINSTANCE.createDescriptionStyle());";
- protected final String TEXT_17 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "}";
- protected final String TEXT_18 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;" + NL + "import org.eclipse.gmf.runtime.notation.Node;" + NL + "import org.eclipse.gmf.runtime.notation.View;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractLabelViewFactory {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {" + NL + "\t\tNode view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);";
+ protected final String TEXT_6 = NL + "\t\t";
+ protected final String TEXT_7 = " location = (";
+ protected final String TEXT_8 = ") view.getLayoutConstraint();" + NL + "\t\t";
+ protected final String TEXT_9 = " mapMode = ";
+ protected final String TEXT_10 = ".getMapMode(containerView.getDiagram().getMeasurementUnit());" + NL + "\t\tlocation.setX(mapMode.DPtoLP(";
+ protected final String TEXT_11 = "));" + NL + "\t\tlocation.setY(mapMode.DPtoLP(";
+ protected final String TEXT_12 = "));";
+ protected final String TEXT_13 = NL + "\t\treturn view;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\tList styles = new ArrayList();";
+ protected final String TEXT_14 = NL + "\t\tstyles.add(";
+ protected final String TEXT_15 = ".eINSTANCE.createDescriptionStyle());";
+ protected final String TEXT_16 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_17 = NL;
public String generate(Object argument)
{
@@ -42,21 +41,20 @@ final GenLabel genLabel = (GenLabel) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
GenDiagram genDiagram = genLabel.getDiagram();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genLabel.getNotationViewFactoryClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
int x = 0;
int y = 0;
@@ -69,29 +67,29 @@ if (labelOffset != null) {
}
if ((x != 0 || y != 0) && (genLabel instanceof GenLinkLabel || genLabel instanceof GenExternalNodeLabel)) {
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Location"));
stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Location"));
stringBuffer.append(TEXT_8);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Location"));
- stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(x);
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(y);
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
}
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
if (genLabel.getModelFacet() instanceof DesignLabelModelFacet) {
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
}
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
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 9fdc2f5d6..25671bcbf 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
@@ -17,163 +17,161 @@ public class MetricProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_5 = " extends ";
- protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
- protected final String TEXT_7 = " context2MetricsMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
- protected final String TEXT_8 = " metricsRegistry;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static ";
- protected final String TEXT_9 = " key2MetricMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int MAX_VISIBLE_KEY_CHAR_COUNT = 8;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_10 = " createAction(String actionId," + NL + "\t\t\t";
- protected final String TEXT_11 = " partDescriptor) {" + NL + "\t\tif (MetricsAction.ACTION_KEY.equals(actionId)) {" + NL + "\t\t\treturn new MetricsAction(partDescriptor);" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricsAction extends ";
- protected final String TEXT_12 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String ACTION_KEY = \"metricsAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_13 = " workbenchPartDescriptor;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic MetricsAction(";
- protected final String TEXT_14 = " workbenchPartDescriptor) {" + NL + "\t\t\tsetId(ACTION_KEY);" + NL + "\t\t\tsetText(\"Metrics\");" + NL + "\t\t\tthis.workbenchPartDescriptor = workbenchPartDescriptor;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\t";
- protected final String TEXT_15 = " workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();" + NL + "\t\t\t";
- protected final String TEXT_16 = " metricsView = null;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmetricsView = ";
- protected final String TEXT_17 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ResultView.VIEW_ID);\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(metricsView == null) {" + NL + "\t\t\t\t\tmetricsView = ";
- protected final String TEXT_18 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ResultView.VIEW_ID);\t\t\t\t\t" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\tif (metricsView != null && workbenchPart instanceof IDiagramWorkbenchPart) {" + NL + "\t\t\t\t\t\tfinal IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;" + NL + "\t\t\t\t\t\t((ResultView)metricsView).setInput(part);" + NL + "\t\t\t\t\t}\t\t\t\t\t" + NL + "\t\t\t\t\tworkbenchPart.getSite().getPage().activate(metricsView);\t\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch (";
- protected final String TEXT_19 = " e) {" + NL + "\t\t\t\t";
- protected final String TEXT_20 = ".getInstance().logError(\"Diagram metric view failure\", e); //$NON-NLS-1$" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tstatic ";
- protected final String TEXT_21 = " calculateMetrics(IDiagramWorkbenchPart diagramPart) {" + NL + "\t\tfinal org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart = diagramPart.getDiagramEditPart();" + NL + "\t\ttry {" + NL + "\t\t\treturn (";
- protected final String TEXT_22 = ")diagramPart.getDiagramEditPart().getEditingDomain().runExclusive(\t\t\t\t" + NL + "\t\t\t\tnew org.eclipse.emf.transaction.RunnableWithResult.Impl() {" + NL + "\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\tDiagram diagram = diagramEditPart.getDiagramView();\t\t\t\t\t" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_23 = " metrics = " + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram, new ";
- protected final String TEXT_24 = "(50));" + NL + "\t\t\t\t\t\tif(diagram.getElement() != null) {\t\t\t\t\t\t" + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram.getElement(), metrics);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t// detach from EObject and bind to viewID" + NL + "\t\t\t\t\t\tjava.util.HashSet elements = new java.util.HashSet();" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\telements.add(elementMetrics.target);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_25 = ".LazyElement2ViewMap element2ViewMap = new ";
- protected final String TEXT_26 = ".LazyElement2ViewMap(diagram, elements);" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\tView targetView = ";
- protected final String TEXT_27 = ".findView(diagramEditPart, elementMetrics.target, element2ViewMap);" + NL + "\t\t\t\t\t\t\telementMetrics.target = null; // detach EObject" + NL + "\t\t\t\t\t\t\telementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tsetResult(metrics);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t});" + NL + "\t\t} catch(InterruptedException e) {" + NL + "\t\t\treturn ";
- protected final String TEXT_28 = ".EMPTY_LIST;\t\t" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic ";
- protected final String TEXT_29 = " calculateMetrics(EObject target, ";
- protected final String TEXT_30 = " metricsList) {" + NL + "\t\tfinal EObject root = target;" + NL + "\t\t";
- protected final String TEXT_31 = " it = new ";
- protected final String TEXT_32 = "() {\t\t\t" + NL + "\t\t\t";
- protected final String TEXT_33 = " contentsIt = root.eAllContents();" + NL + "\t\t\tboolean isInRoot = true;\t\t\t" + NL + "\t\t\t" + NL + "\t\t\tpublic boolean hasNext() {" + NL + "\t\t\t\treturn isInRoot || contentsIt.hasNext();" + NL + "\t\t\t}" + NL + "\t\t\tpublic Object next() {" + NL + "\t\t\t\tif(isInRoot) {" + NL + "\t\t\t\t\tisInRoot = false;" + NL + "\t\t\t\t\treturn root;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn contentsIt.next();" + NL + "\t\t\t}" + NL + "\t\t\tpublic void remove() {" + NL + "\t\t\t\tthrow new UnsupportedOperationException();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t" + NL + "\t\t";
- protected final String TEXT_34 = " metricsPerContext = new ";
- protected final String TEXT_35 = "();" + NL + "\t\twhile(it.hasNext()) {" + NL + "\t\t\tObject nextElement = it.next();" + NL + "\t\t\tif(nextElement instanceof EObject) {" + NL + "\t\t\t\tEObject nextEObj = (EObject)nextElement;" + NL + "\t\t\t\tEClass nextTarget = nextEObj.eClass();" + NL + "\t\t\t\t";
- protected final String TEXT_36 = " superTypeIt = nextTarget.getEAllSuperTypes().iterator();" + NL + "\t\t\t\twhile(nextTarget != null) {" + NL + "\t\t\t\t\t";
- protected final String TEXT_37 = " metricList = getMetricsForTarget(nextTarget);" + NL + "\t\t\t\t\tif(metricList != null) {" + NL + "\t\t\t\t\t\tfor (";
- protected final String TEXT_38 = " metricIt = metricList.iterator(); metricIt.hasNext();) {" + NL + "\t\t\t\t\t\t\tMetricDef nextMetric = (MetricDef) metricIt.next();" + NL + "\t\t\t\t\t\t\tif(nextMetric.appliesTo(nextEObj)) {" + NL + "\t\t\t\t\t\t\t\tMetric metric = new Metric(nextMetric, nextEObj);" + NL + "\t\t\t\t\t\t\t\tmetricsPerContext.add(metric);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tnextTarget = superTypeIt.hasNext() ? (EClass)superTypeIt.next() : null; " + NL + "\t\t\t\t}" + NL + "\t\t\t\t" + NL + "\t\t\t\tif(!metricsPerContext.isEmpty()) {" + NL + "\t\t\t\t\tmetricsList.add(new ElementMetrics(nextEObj, " + NL + "\t\t\t\t\t\t\t(Metric[])metricsPerContext.toArray(new Metric[metricsPerContext.size()])));" + NL + "\t\t\t\t\tmetricsPerContext.clear();\t\t\t\t" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\treturn metricsList;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class ResultView extends ";
- protected final String TEXT_39 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String VIEW_ID = \"";
- protected final String TEXT_40 = "\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate TableViewer viewer;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate ";
- protected final String TEXT_41 = " diagramResource;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t void setInput(IDiagramWorkbenchPart diagramPart) {" + NL + "\t\t\tdiagramResource = diagramPart.getDiagram().eResource();" + NL + "\t\t\tsetTitleToolTip(diagramResource.getURI().path());" + NL + "\t\t\t" + NL + "\t\t\t";
- protected final String TEXT_42 = " metrics = calculateMetrics(diagramPart);" + NL + "\t \tadjustLayout(metrics);" + NL + "\t \tviewer.setInput(metrics); " + NL + "\t }" + NL + "\t " + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t private void adjustLayout(";
- protected final String TEXT_43 = " metricResultList) {" + NL + "\t \t";
- protected final String TEXT_44 = " maxValStrMap = calcMetricMaxValueStrLenMap(metricResultList);" + NL + "\t\t\tTable table = viewer.getTable();" + NL + "\t\t\tTableLayout layout = new TableLayout();" + NL + "\t\t\t" + NL + "\t\t\t";
- protected final String TEXT_45 = " gc = new ";
- protected final String TEXT_46 = "(table);" + NL + "\t\t\tgc.setFont(";
- protected final String TEXT_47 = ".getDialogFont());" + NL + "\t\t\tint padding = gc.stringExtent(\"X\").x * 2; //$NON-NLS-1$" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = (MetricDef)getMetrics().get(i);" + NL + "\t\t\t\tString valueStr = (String)maxValStrMap.get(nextMetric.key);" + NL + "\t\t\t\tint minWidth = valueStr != null ? gc.stringExtent(valueStr).x + padding : 20;\t\t\t" + NL + "\t\t\t\tlayout.addColumnData(new ColumnPixelData(minWidth, true));" + NL + "\t\t\t}" + NL + "\t\t\tgc.dispose();" + NL + "\t\t\t" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(1, 50, true));" + NL + "\t\t\tviewer.getTable().setLayout(layout);" + NL + "\t\t\tviewer.getTable().layout(true, true);" + NL + "\t }" + NL + "\t " + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t\tpublic void createPartControl(Composite parent) {\t\t\t" + NL + "\t\t\tthis.viewer = new TableViewer(parent, SWT.FULL_SELECTION);" + NL + "\t\t\tfinal Table table = viewer.getTable();" + NL + "\t\t\ttable.setHeaderVisible(true);" + NL + "\t\t\ttable.setLinesVisible(true);\t" + NL + "\t\t\t" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = ((MetricDef)getMetrics().get(i));\t\t" + NL + "\t\t\t\tTableColumn column = new TableColumn(table, SWT.NONE);" + NL + "\t\t\t\tcolumn.setAlignment(SWT.RIGHT);" + NL + "\t\t\t\tcolumn.setMoveable(true);\t\t\t\t" + NL + "\t\t\t\tcolumn.setText(nextMetric.key);" + NL + "\t\t\t\tcolumn.setToolTipText(nextMetric.getToolTipText());" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tTableColumn objectColumn = new TableColumn(table, SWT.NONE);\t\t\t" + NL + "\t\t\tobjectColumn.setText(\"Element\");" + NL + "\t\t\tobjectColumn.setToolTipText(\"Measurement element\");" + NL + "\t\t\t" + NL + "\t\t\tviewer.setLabelProvider(new Labels());" + NL + "\t\t\tviewer.setContentProvider(new ArrayContentProvider());\t\t\t\t\t\t" + NL + "\t\t\tviewer.addOpenListener(new IOpenListener() {" + NL + "\t\t\t\tpublic void open(OpenEvent event) {" + NL + "\t\t\t\t\thandleOpen(event);" + NL + "\t\t\t\t}" + NL + "\t\t\t});" + NL + "" + NL + "\t\t\t";
- protected final String TEXT_48 = " headerSelListener = new ";
- protected final String TEXT_49 = "() {" + NL + "\t\t\t\tpublic void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {" + NL + "\t\t\t\t\ttable.setSortColumn((TableColumn)e.getSource()); " + NL + "\t\t\t\t\ttable.setSortDirection((table.getSortDirection() != SWT.DOWN) ? SWT.DOWN : SWT.UP);" + NL + "\t\t\t\t\tviewer.refresh();" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t\tpublic void widgetDefaultSelected(";
- protected final String TEXT_50 = " e) {\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t};\t\t\t" + NL + "\t\t\tTableColumn[] columns = viewer.getTable().getColumns();" + NL + "\t\t\tfor (int i = 0; i < columns.length; i++) {" + NL + "\t\t\t\tcolumns[i].addSelectionListener(headerSelListener);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tviewer.setSorter(" + NL + "\t\t\t\tnew ViewerSorter() {" + NL + "\t\t\t\t\tpublic int compare(Viewer viewer, Object e1, Object e2) {" + NL + "\t\t\t\t\t\tTableColumn c = table.getSortColumn();" + NL + "\t\t\t\t\t\tint result = 0;" + NL + "\t\t\t\t\t\tif(c != null) {" + NL + "\t\t\t\t\t\t\tMetric mc1 = ((ElementMetrics)e1).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tMetric mc2 = ((ElementMetrics)e2).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tresult = (mc1 != null && mc2 != null) ?" + NL + "\t\t\t\t\t\t\t\tmc1.compareTo(mc2) : (mc1 == null ? -1 : 1);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tresult = ((ElementMetrics)e1).targetElementQName.compareTo(((ElementMetrics)e2).targetElementQName);" + NL + "\t\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\t\treturn table.getSortDirection() == SWT.DOWN ? result : -result;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t);" + NL + "\t\t\t" + NL + "\t ";
- protected final String TEXT_51 = " editor = getSite().getPage().getActiveEditor();" + NL + "\t if(editor != null && editor.getClass().equals(";
- protected final String TEXT_52 = ".class)) {" + NL + "\t\t\t\tsetInput((";
- protected final String TEXT_53 = ")editor);" + NL + "\t }\t\t\t" + NL + "\t\t}" + NL + "\t\t\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t\t\t" + NL + "\t\tprivate void handleOpen(OpenEvent event) {" + NL + "\t\t\ttry {" + NL + "\t\t\t\t";
- protected final String TEXT_54 = " editorPart = getSite().getPage()" + NL + "\t\t\t\t\t.openEditor(new ";
- protected final String TEXT_55 = "(";
- protected final String TEXT_56 = ".getFile(diagramResource))," + NL + "\t\t\t\t\t\t\t";
- protected final String TEXT_57 = ".ID);" + NL + "\t\t\t\tif(editorPart == null) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t";
- protected final String TEXT_58 = " diagramPart = (";
- protected final String TEXT_59 = ")" + NL + "\t\t\t\t\teditorPart.getAdapter(";
- protected final String TEXT_60 = ".class);" + NL + "\t\t\t\t" + NL + "\t\t\t\tElementMetrics selection = (ElementMetrics)((";
- protected final String TEXT_61 = ")event.getSelection()).getFirstElement();" + NL + "\t\t\t\tString viewID = selection.diagramElementID;" + NL + "\t\t\t\tif(viewID != null) {" + NL + "\t\t\t\t\tView targetView = (View)diagramPart.getDiagram().eResource().getEObject(viewID);" + NL + "\t\t\t\t\tif(targetView != null) {" + NL + "\t\t\t\t\t\torg.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart)diagramPart.getDiagramGraphicalViewer().getEditPartRegistry().get(targetView);" + NL + "\t\t\t\t\t\tif(targetEditPart != null) {\t\t\t\t\t\t" + NL + "\t\t\t\t\t\t\t";
- protected final String TEXT_62 = ".selectElementsInDiagram(diagramPart, Collections.singletonList(targetEditPart));" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch (";
- protected final String TEXT_63 = " e) {" + NL + "\t\t\t\t";
- protected final String TEXT_64 = ".getInstance().logError(\"Can't open diagram editor\", e); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate static ";
- protected final String TEXT_65 = " calcMetricMaxValueStrLenMap(";
- protected final String TEXT_66 = " allMetrics) {" + NL + "\t\t\t";
- protected final String TEXT_67 = " metric2MaxStrLen = new ";
- protected final String TEXT_68 = "();\t\t\t \t" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tString nextKey = ((MetricDef)getMetrics().get(i)).key; " + NL + "\t\t\t\tint trimPos = Math.min(nextKey.length(), MAX_VISIBLE_KEY_CHAR_COUNT);" + NL + "\t\t\t\tmetric2MaxStrLen.put(nextKey, nextKey.substring(0, trimPos));\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tfor (";
- protected final String TEXT_69 = " it = allMetrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\tfor (int i = 0; i < elementMetrics.metrics.length; i++) {" + NL + "\t\t\t\t\tMetric metric = elementMetrics.metrics[i];" + NL + "\t\t\t\t\tString valueStr = (String)metric2MaxStrLen.get(metric.def.key);" + NL + "\t\t\t\t\tif(valueStr == null || metric.displayValue.length() > valueStr.length()) {" + NL + "\t\t\t\t\t\tmetric2MaxStrLen.put(metric.def.key, metric.displayValue);\t" + NL + "\t\t\t\t\t}\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn metric2MaxStrLen;\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setFocus() {" + NL + "\t\t}\t\t" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate class Labels extends LabelProvider implements ITableLabelProvider, ITableColorProvider {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tprivate boolean isElementColumn(int columnIndex) {" + NL + "\t\t\t\treturn columnIndex >= getMetrics().size();" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
- protected final String TEXT_70 = " getColumnImage(Object element, int columnIndex) {\t\t\t\t" + NL + "\t\t\t\treturn isElementColumn(columnIndex) ? ((ElementMetrics)element).elementImage : null;" + NL + "\t\t\t}\t\t" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic String getColumnText(Object element, int columnIndex) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics)element;" + NL + "\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(columnIndex == getMetrics().size()) {" + NL + "\t\t\t\t\treturn elementMetrics.targetElementQName;" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = elementMetrics.getMetricByKey(key);" + NL + "\t\t\t\treturn (metric != null) ? metric.displayValue : \"-\"; //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
- protected final String TEXT_71 = " getBackground(Object element, int columnIndex) {" + NL + "\t\t\t\treturn null; " + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
- protected final String TEXT_72 = " getForeground(Object element, int columnIndex) {" + NL + "\t\t\t\tif(isElementColumn(columnIndex)) return null;" + NL + "\t\t\t\tElementMetrics columnElement = (ElementMetrics)element;" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = columnElement.getMetricByKey(key);\t\t\t" + NL + "\t\t\t\tif(metric != null && metric.value != null) {" + NL + "\t\t\t\t\tif (metric.def.highLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.highLimit.longValue() < metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn ";
- protected final String TEXT_73 = ".red;" + NL + "\t\t\t\t\t} else if (metric.def.lowLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.lowLimit.longValue() > metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn ";
- protected final String TEXT_74 = ".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_75 = " elementImage;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString diagramElementID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tEObject target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tElementMetrics(EObject target, Metric[] metrics) {" + NL + "\t\t\tthis.metrics = metrics;\t" + NL + "\t\t\tassert metrics.length > 0;" + NL + "\t\t\tthis.target = target;" + NL + "\t\t\t" + NL + "\t\t\tEClass imageTarget = target.eClass();\t\t\t" + NL + "\t\t\tif (target instanceof View) {" + NL + "\t\t\t\tView viewTarget = (View) target;" + NL + "\t\t\t\tStringBuffer notationQNameBuf = new StringBuffer();" + NL + "\t\t\t\tnotationQNameBuf.append(";
- protected final String TEXT_76 = ".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_77 = ".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_78 = ".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_79 = ".getQualifiedName(target, true);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = ";
- protected final String TEXT_80 = ".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 ";
- protected final String TEXT_81 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal int[] semanticIDs;" + 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, ";
- protected final String TEXT_82 = " expression, int[] semanticIDs, " + NL + "\t\t\tDouble low, Double high, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.expression = expression;\t\t\t" + NL + "\t\t\tthis.semanticIDs = semanticIDs;\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 && semanticIDs != null) {" + NL + "\t\t\t\tint eObjectID = ";
- protected final String TEXT_83 = ".getVisualID((View)eObject); " + NL + "\t\t\t\tfor(int i = 0; i < semanticIDs.length; i++) {" + NL + "\t\t\t\t\tif(semanticIDs[i] == eObjectID) {" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn false;\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && (expression.context() instanceof EClass) && " + NL + "\t\t\t\t((EClass)expression.context()).isSuperTypeOf(eObject.eClass());" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString getToolTipText() {" + NL + "\t\t\tStringBuffer buf = new StringBuffer();" + NL + "\t\t\tif(name != null) buf.append(name);" + NL + "\t\t\tif(description != null) buf.append('\\n').append(description).append('\\n');" + NL + "\t\t\tif(lowLimit != null) buf.append(\"low:\").append(lowLimit);" + NL + "\t\t\tif(highLimit != null) buf.append(\" high:\").append(highLimit);" + NL + "\t\t\treturn buf.toString();" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static ";
- protected final String TEXT_84 = "/*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_85 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_86 = " 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 + "\tpublic static Number calculateMetric(String metricKey, Object contextInstance) {" + NL + "\t\tif (key2MetricMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\tMetricDef metric = (MetricDef)key2MetricMap.get(metricKey);" + NL + "\t\tNumber value = (metric != null) ? metric.calcMetric(contextInstance) : null;" + NL + "\t\treturn (value != null && !(value instanceof Double)) ? new Double(value.doubleValue()) : value;\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;";
- protected final String TEXT_87 = "\t\t" + NL + "\t\t";
- protected final String TEXT_88 = NL;
- protected final String TEXT_89 = " ";
- protected final String TEXT_90 = " = new ";
- protected final String TEXT_91 = "(3);";
- protected final String TEXT_92 = ".put(\"";
- protected final String TEXT_93 = "\", ";
- protected final String TEXT_94 = "); //$NON-NLS-1$";
- protected final String TEXT_95 = NL + "\t\tregister(new MetricDef(";
- protected final String TEXT_96 = "," + NL + "\t\t\t";
- protected final String TEXT_97 = "null";
- protected final String TEXT_98 = ".";
- protected final String TEXT_99 = "(";
- protected final String TEXT_100 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_101 = ", ";
- protected final String TEXT_102 = ")";
- protected final String TEXT_103 = ".";
- protected final String TEXT_104 = "(";
- protected final String TEXT_105 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_106 = ")";
- protected final String TEXT_107 = "new ";
- protected final String TEXT_108 = "(";
- protected final String TEXT_109 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
- protected final String TEXT_110 = " env) {\t" + NL + "\t\t";
- protected final String TEXT_111 = " self = (";
- protected final String TEXT_112 = ")context;";
- protected final String TEXT_113 = "\t" + NL + "\t\t";
- protected final String TEXT_114 = " ";
- protected final String TEXT_115 = " = (";
- protected final String TEXT_116 = ")env.get(\"";
- protected final String TEXT_117 = "\"); //$NON-NLS-1$";
- protected final String TEXT_118 = NL + "\t\treturn ";
- protected final String TEXT_119 = ".";
- protected final String TEXT_120 = "(self";
- protected final String TEXT_121 = ", ";
- protected final String TEXT_122 = ");" + NL + "\t}" + NL + "}";
- protected final String TEXT_123 = NL + ",";
- protected final String TEXT_124 = NL + "\t\t\t";
- protected final String TEXT_125 = "," + NL + "\t\t\t";
- protected final String TEXT_126 = "new Double(";
- protected final String TEXT_127 = ")";
- protected final String TEXT_128 = "null";
- protected final String TEXT_129 = ",\t\t\t\t\t" + NL + "\t\t\t";
- protected final String TEXT_130 = "new Double(";
- protected final String TEXT_131 = ")";
- protected final String TEXT_132 = "null";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_4 = " extends ";
+ protected final String TEXT_5 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
+ protected final String TEXT_6 = " context2MetricsMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
+ protected final String TEXT_7 = " metricsRegistry;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static ";
+ protected final String TEXT_8 = " key2MetricMap;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static int MAX_VISIBLE_KEY_CHAR_COUNT = 8;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_9 = " createAction(String actionId," + NL + "\t\t\t";
+ protected final String TEXT_10 = " partDescriptor) {" + NL + "\t\tif (MetricsAction.ACTION_KEY.equals(actionId)) {" + NL + "\t\t\treturn new MetricsAction(partDescriptor);" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MetricsAction extends ";
+ protected final String TEXT_11 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String ACTION_KEY = \"metricsAction\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_12 = " workbenchPartDescriptor;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic MetricsAction(";
+ protected final String TEXT_13 = " workbenchPartDescriptor) {" + NL + "\t\t\tsetId(ACTION_KEY);" + NL + "\t\t\tsetText(\"Metrics\");" + NL + "\t\t\tthis.workbenchPartDescriptor = workbenchPartDescriptor;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run() {" + NL + "\t\t\t";
+ protected final String TEXT_14 = " workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();" + NL + "\t\t\t";
+ protected final String TEXT_15 = " metricsView = null;" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmetricsView = ";
+ protected final String TEXT_16 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ResultView.VIEW_ID);\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(metricsView == null) {" + NL + "\t\t\t\t\tmetricsView = ";
+ protected final String TEXT_17 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ResultView.VIEW_ID);\t\t\t\t\t" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\tif (metricsView != null && workbenchPart instanceof IDiagramWorkbenchPart) {" + NL + "\t\t\t\t\t\tfinal IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;" + NL + "\t\t\t\t\t\t((ResultView)metricsView).setInput(part);" + NL + "\t\t\t\t\t}\t\t\t\t\t" + NL + "\t\t\t\t\tworkbenchPart.getSite().getPage().activate(metricsView);\t\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch (";
+ protected final String TEXT_18 = " e) {" + NL + "\t\t\t\t";
+ protected final String TEXT_19 = ".getInstance().logError(\"Diagram metric view failure\", e); //$NON-NLS-1$" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tstatic ";
+ protected final String TEXT_20 = " calculateMetrics(IDiagramWorkbenchPart diagramPart) {" + NL + "\t\tfinal org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart = diagramPart.getDiagramEditPart();" + NL + "\t\ttry {" + NL + "\t\t\treturn (";
+ protected final String TEXT_21 = ")diagramPart.getDiagramEditPart().getEditingDomain().runExclusive(\t\t\t\t" + NL + "\t\t\t\tnew org.eclipse.emf.transaction.RunnableWithResult.Impl() {" + NL + "\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\tDiagram diagram = diagramEditPart.getDiagramView();\t\t\t\t\t" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_22 = " metrics = " + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram, new ";
+ protected final String TEXT_23 = "(50));" + NL + "\t\t\t\t\t\tif(diagram.getElement() != null) {\t\t\t\t\t\t" + NL + "\t\t\t\t\t\t\tcalculateMetrics(diagram.getElement(), metrics);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t// detach from EObject and bind to viewID" + NL + "\t\t\t\t\t\tjava.util.HashSet elements = new java.util.HashSet();" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\telements.add(elementMetrics.target);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_24 = ".LazyElement2ViewMap element2ViewMap = new ";
+ protected final String TEXT_25 = ".LazyElement2ViewMap(diagram, elements);" + NL + "\t\t\t\t\t\tfor (java.util.Iterator it = metrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\t\t\t\tView targetView = ";
+ protected final String TEXT_26 = ".findView(diagramEditPart, elementMetrics.target, element2ViewMap);" + NL + "\t\t\t\t\t\t\telementMetrics.target = null; // detach EObject" + NL + "\t\t\t\t\t\t\telementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t" + NL + "\t\t\t\t\t\tsetResult(metrics);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t});" + NL + "\t\t} catch(InterruptedException e) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_27 = ".EMPTY_LIST;\t\t" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic ";
+ protected final String TEXT_28 = " calculateMetrics(EObject target, ";
+ protected final String TEXT_29 = " metricsList) {" + NL + "\t\tfinal EObject root = target;" + NL + "\t\t";
+ protected final String TEXT_30 = " it = new ";
+ protected final String TEXT_31 = "() {\t\t\t" + NL + "\t\t\t";
+ protected final String TEXT_32 = " contentsIt = root.eAllContents();" + NL + "\t\t\tboolean isInRoot = true;\t\t\t" + NL + "\t\t\t" + NL + "\t\t\tpublic boolean hasNext() {" + NL + "\t\t\t\treturn isInRoot || contentsIt.hasNext();" + NL + "\t\t\t}" + NL + "\t\t\tpublic Object next() {" + NL + "\t\t\t\tif(isInRoot) {" + NL + "\t\t\t\t\tisInRoot = false;" + NL + "\t\t\t\t\treturn root;" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn contentsIt.next();" + NL + "\t\t\t}" + NL + "\t\t\tpublic void remove() {" + NL + "\t\t\t\tthrow new UnsupportedOperationException();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t" + NL + "\t\t";
+ protected final String TEXT_33 = " metricsPerContext = new ";
+ protected final String TEXT_34 = "();" + NL + "\t\twhile(it.hasNext()) {" + NL + "\t\t\tObject nextElement = it.next();" + NL + "\t\t\tif(nextElement instanceof EObject) {" + NL + "\t\t\t\tEObject nextEObj = (EObject)nextElement;" + NL + "\t\t\t\tEClass nextTarget = nextEObj.eClass();" + NL + "\t\t\t\t";
+ protected final String TEXT_35 = " superTypeIt = nextTarget.getEAllSuperTypes().iterator();" + NL + "\t\t\t\twhile(nextTarget != null) {" + NL + "\t\t\t\t\t";
+ protected final String TEXT_36 = " metricList = getMetricsForTarget(nextTarget);" + NL + "\t\t\t\t\tif(metricList != null) {" + NL + "\t\t\t\t\t\tfor (";
+ protected final String TEXT_37 = " metricIt = metricList.iterator(); metricIt.hasNext();) {" + NL + "\t\t\t\t\t\t\tMetricDef nextMetric = (MetricDef) metricIt.next();" + NL + "\t\t\t\t\t\t\tif(nextMetric.appliesTo(nextEObj)) {" + NL + "\t\t\t\t\t\t\t\tMetric metric = new Metric(nextMetric, nextEObj);" + NL + "\t\t\t\t\t\t\t\tmetricsPerContext.add(metric);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tnextTarget = superTypeIt.hasNext() ? (EClass)superTypeIt.next() : null; " + NL + "\t\t\t\t}" + NL + "\t\t\t\t" + NL + "\t\t\t\tif(!metricsPerContext.isEmpty()) {" + NL + "\t\t\t\t\tmetricsList.add(new ElementMetrics(nextEObj, " + NL + "\t\t\t\t\t\t\t(Metric[])metricsPerContext.toArray(new Metric[metricsPerContext.size()])));" + NL + "\t\t\t\t\tmetricsPerContext.clear();\t\t\t\t" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\treturn metricsList;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static class ResultView extends ";
+ protected final String TEXT_38 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String VIEW_ID = \"";
+ protected final String TEXT_39 = "\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t" + NL + "\t\tprivate TableViewer viewer;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate ";
+ protected final String TEXT_40 = " diagramResource;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t void setInput(IDiagramWorkbenchPart diagramPart) {" + NL + "\t\t\tdiagramResource = diagramPart.getDiagram().eResource();" + NL + "\t\t\tsetTitleToolTip(diagramResource.getURI().path());" + NL + "\t\t\t" + NL + "\t\t\t";
+ protected final String TEXT_41 = " metrics = calculateMetrics(diagramPart);" + NL + "\t \tadjustLayout(metrics);" + NL + "\t \tviewer.setInput(metrics); " + NL + "\t }" + NL + "\t " + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t private void adjustLayout(";
+ protected final String TEXT_42 = " metricResultList) {" + NL + "\t \t";
+ protected final String TEXT_43 = " maxValStrMap = calcMetricMaxValueStrLenMap(metricResultList);" + NL + "\t\t\tTable table = viewer.getTable();" + NL + "\t\t\tTableLayout layout = new TableLayout();" + NL + "\t\t\t" + NL + "\t\t\t";
+ protected final String TEXT_44 = " gc = new ";
+ protected final String TEXT_45 = "(table);" + NL + "\t\t\tgc.setFont(";
+ protected final String TEXT_46 = ".getDialogFont());" + NL + "\t\t\tint padding = gc.stringExtent(\"X\").x * 2; //$NON-NLS-1$" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = (MetricDef)getMetrics().get(i);" + NL + "\t\t\t\tString valueStr = (String)maxValStrMap.get(nextMetric.key);" + NL + "\t\t\t\tint minWidth = valueStr != null ? gc.stringExtent(valueStr).x + padding : 20;\t\t\t" + NL + "\t\t\t\tlayout.addColumnData(new ColumnPixelData(minWidth, true));" + NL + "\t\t\t}" + NL + "\t\t\tgc.dispose();" + NL + "\t\t\t" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(1, 50, true));" + NL + "\t\t\tviewer.getTable().setLayout(layout);" + NL + "\t\t\tviewer.getTable().layout(true, true);" + NL + "\t }" + NL + "\t " + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t " + NL + "\t\tpublic void createPartControl(Composite parent) {\t\t\t" + NL + "\t\t\tthis.viewer = new TableViewer(parent, SWT.FULL_SELECTION);" + NL + "\t\t\tfinal Table table = viewer.getTable();" + NL + "\t\t\ttable.setHeaderVisible(true);" + NL + "\t\t\ttable.setLinesVisible(true);\t" + NL + "\t\t\t" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tMetricDef nextMetric = ((MetricDef)getMetrics().get(i));\t\t" + NL + "\t\t\t\tTableColumn column = new TableColumn(table, SWT.NONE);" + NL + "\t\t\t\tcolumn.setAlignment(SWT.RIGHT);" + NL + "\t\t\t\tcolumn.setMoveable(true);\t\t\t\t" + NL + "\t\t\t\tcolumn.setText(nextMetric.key);" + NL + "\t\t\t\tcolumn.setToolTipText(nextMetric.getToolTipText());" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tTableColumn objectColumn = new TableColumn(table, SWT.NONE);\t\t\t" + NL + "\t\t\tobjectColumn.setText(\"Element\");" + NL + "\t\t\tobjectColumn.setToolTipText(\"Measurement element\");" + NL + "\t\t\t" + NL + "\t\t\tviewer.setLabelProvider(new Labels());" + NL + "\t\t\tviewer.setContentProvider(new ArrayContentProvider());\t\t\t\t\t\t" + NL + "\t\t\tviewer.addOpenListener(new IOpenListener() {" + NL + "\t\t\t\tpublic void open(OpenEvent event) {" + NL + "\t\t\t\t\thandleOpen(event);" + NL + "\t\t\t\t}" + NL + "\t\t\t});" + NL + "" + NL + "\t\t\t";
+ protected final String TEXT_47 = " headerSelListener = new ";
+ protected final String TEXT_48 = "() {" + NL + "\t\t\t\tpublic void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {" + NL + "\t\t\t\t\ttable.setSortColumn((TableColumn)e.getSource()); " + NL + "\t\t\t\t\ttable.setSortDirection((table.getSortDirection() != SWT.DOWN) ? SWT.DOWN : SWT.UP);" + NL + "\t\t\t\t\tviewer.refresh();" + NL + "\t\t\t\t}\t\t\t\t" + NL + "\t\t\t\tpublic void widgetDefaultSelected(";
+ protected final String TEXT_49 = " e) {\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t};\t\t\t" + NL + "\t\t\tTableColumn[] columns = viewer.getTable().getColumns();" + NL + "\t\t\tfor (int i = 0; i < columns.length; i++) {" + NL + "\t\t\t\tcolumns[i].addSelectionListener(headerSelListener);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tviewer.setSorter(" + NL + "\t\t\t\tnew ViewerSorter() {" + NL + "\t\t\t\t\tpublic int compare(Viewer viewer, Object e1, Object e2) {" + NL + "\t\t\t\t\t\tTableColumn c = table.getSortColumn();" + NL + "\t\t\t\t\t\tint result = 0;" + NL + "\t\t\t\t\t\tif(c != null) {" + NL + "\t\t\t\t\t\t\tMetric mc1 = ((ElementMetrics)e1).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tMetric mc2 = ((ElementMetrics)e2).getMetricByKey(c.getText());" + NL + "\t\t\t\t\t\t\tresult = (mc1 != null && mc2 != null) ?" + NL + "\t\t\t\t\t\t\t\tmc1.compareTo(mc2) : (mc1 == null ? -1 : 1);" + NL + "\t\t\t\t\t\t} else {" + NL + "\t\t\t\t\t\t\tresult = ((ElementMetrics)e1).targetElementQName.compareTo(((ElementMetrics)e2).targetElementQName);" + NL + "\t\t\t\t\t\t}\t\t\t\t\t\t" + NL + "\t\t\t\t\t\treturn table.getSortDirection() == SWT.DOWN ? result : -result;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t);" + NL + "\t\t\t" + NL + "\t ";
+ protected final String TEXT_50 = " editor = getSite().getPage().getActiveEditor();" + NL + "\t if(editor != null && editor.getClass().equals(";
+ protected final String TEXT_51 = ".class)) {" + NL + "\t\t\t\tsetInput((";
+ protected final String TEXT_52 = ")editor);" + NL + "\t }\t\t\t" + NL + "\t\t}" + NL + "\t\t\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t\t\t" + NL + "\t\tprivate void handleOpen(OpenEvent event) {" + NL + "\t\t\ttry {" + NL + "\t\t\t\t";
+ protected final String TEXT_53 = " editorPart = getSite().getPage()" + NL + "\t\t\t\t\t.openEditor(new ";
+ protected final String TEXT_54 = "(";
+ protected final String TEXT_55 = ".getFile(diagramResource))," + NL + "\t\t\t\t\t\t\t";
+ protected final String TEXT_56 = ".ID);" + NL + "\t\t\t\tif(editorPart == null) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t\t";
+ protected final String TEXT_57 = " diagramPart = (";
+ protected final String TEXT_58 = ")" + NL + "\t\t\t\t\teditorPart.getAdapter(";
+ protected final String TEXT_59 = ".class);" + NL + "\t\t\t\t" + NL + "\t\t\t\tElementMetrics selection = (ElementMetrics)((";
+ protected final String TEXT_60 = ")event.getSelection()).getFirstElement();" + NL + "\t\t\t\tString viewID = selection.diagramElementID;" + NL + "\t\t\t\tif(viewID != null) {" + NL + "\t\t\t\t\tView targetView = (View)diagramPart.getDiagram().eResource().getEObject(viewID);" + NL + "\t\t\t\t\tif(targetView != null) {" + NL + "\t\t\t\t\t\torg.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart)diagramPart.getDiagramGraphicalViewer().getEditPartRegistry().get(targetView);" + NL + "\t\t\t\t\t\tif(targetEditPart != null) {\t\t\t\t\t\t" + NL + "\t\t\t\t\t\t\t";
+ protected final String TEXT_61 = ".selectElementsInDiagram(diagramPart, Collections.singletonList(targetEditPart));" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t} catch (";
+ protected final String TEXT_62 = " e) {" + NL + "\t\t\t\t";
+ protected final String TEXT_63 = ".getInstance().logError(\"Can't open diagram editor\", e); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate static ";
+ protected final String TEXT_64 = " calcMetricMaxValueStrLenMap(";
+ protected final String TEXT_65 = " allMetrics) {" + NL + "\t\t\t";
+ protected final String TEXT_66 = " metric2MaxStrLen = new ";
+ protected final String TEXT_67 = "();\t\t\t \t" + NL + "\t\t\tfor (int i = 0; i < getMetrics().size(); i++) {" + NL + "\t\t\t\tString nextKey = ((MetricDef)getMetrics().get(i)).key; " + NL + "\t\t\t\tint trimPos = Math.min(nextKey.length(), MAX_VISIBLE_KEY_CHAR_COUNT);" + NL + "\t\t\t\tmetric2MaxStrLen.put(nextKey, nextKey.substring(0, trimPos));\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tfor (";
+ protected final String TEXT_68 = " it = allMetrics.iterator(); it.hasNext();) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics) it.next();" + NL + "\t\t\t\tfor (int i = 0; i < elementMetrics.metrics.length; i++) {" + NL + "\t\t\t\t\tMetric metric = elementMetrics.metrics[i];" + NL + "\t\t\t\t\tString valueStr = (String)metric2MaxStrLen.get(metric.def.key);" + NL + "\t\t\t\t\tif(valueStr == null || metric.displayValue.length() > valueStr.length()) {" + NL + "\t\t\t\t\t\tmetric2MaxStrLen.put(metric.def.key, metric.displayValue);\t" + NL + "\t\t\t\t\t}\t\t\t\t" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn metric2MaxStrLen;\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setFocus() {" + NL + "\t\t}\t\t" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tprivate class Labels extends LabelProvider implements ITableLabelProvider, ITableColorProvider {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tprivate boolean isElementColumn(int columnIndex) {" + NL + "\t\t\t\treturn columnIndex >= getMetrics().size();" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
+ protected final String TEXT_69 = " getColumnImage(Object element, int columnIndex) {\t\t\t\t" + NL + "\t\t\t\treturn isElementColumn(columnIndex) ? ((ElementMetrics)element).elementImage : null;" + NL + "\t\t\t}\t\t" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic String getColumnText(Object element, int columnIndex) {" + NL + "\t\t\t\tElementMetrics elementMetrics = (ElementMetrics)element;" + NL + "\t\t\t\t\t\t\t" + NL + "\t\t\t\tif(columnIndex == getMetrics().size()) {" + NL + "\t\t\t\t\treturn elementMetrics.targetElementQName;" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = elementMetrics.getMetricByKey(key);" + NL + "\t\t\t\treturn (metric != null) ? metric.displayValue : \"-\"; //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
+ protected final String TEXT_70 = " getBackground(Object element, int columnIndex) {" + NL + "\t\t\t\treturn null; " + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t" + NL + "\t\t\tpublic ";
+ protected final String TEXT_71 = " getForeground(Object element, int columnIndex) {" + NL + "\t\t\t\tif(isElementColumn(columnIndex)) return null;" + NL + "\t\t\t\tElementMetrics columnElement = (ElementMetrics)element;" + NL + "\t\t\t\tString key = ((MetricDef)getMetrics().get(columnIndex)).key;" + NL + "\t\t\t\tMetric metric = columnElement.getMetricByKey(key);\t\t\t" + NL + "\t\t\t\tif(metric != null && metric.value != null) {" + NL + "\t\t\t\t\tif (metric.def.highLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.highLimit.longValue() < metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn ";
+ protected final String TEXT_72 = ".red;" + NL + "\t\t\t\t\t} else if (metric.def.lowLimit != null" + NL + "\t\t\t\t\t\t\t&& metric.def.lowLimit.longValue() > metric.value.longValue()) {" + NL + "\t\t\t\t\t\treturn ";
+ protected final String TEXT_73 = ".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_74 = " elementImage;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString diagramElementID;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tEObject target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tElementMetrics(EObject target, Metric[] metrics) {" + NL + "\t\t\tthis.metrics = metrics;\t" + NL + "\t\t\tassert metrics.length > 0;" + NL + "\t\t\tthis.target = target;" + NL + "\t\t\t" + NL + "\t\t\tEClass imageTarget = target.eClass();\t\t\t" + NL + "\t\t\tif (target instanceof View) {" + NL + "\t\t\t\tView viewTarget = (View) target;" + NL + "\t\t\t\tStringBuffer notationQNameBuf = new StringBuffer();" + NL + "\t\t\t\tnotationQNameBuf.append(";
+ protected final String TEXT_75 = ".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_76 = ".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_77 = ".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_78 = ".getQualifiedName(target, true);\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\tthis.elementImage = ";
+ protected final String TEXT_79 = ".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 ";
+ protected final String TEXT_80 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tfinal int[] semanticIDs;" + 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, ";
+ protected final String TEXT_81 = " expression, int[] semanticIDs, " + NL + "\t\t\tDouble low, Double high, String name, String description) {" + NL + "\t\t\tthis.key = key;" + NL + "\t\t\tthis.expression = expression;\t\t\t" + NL + "\t\t\tthis.semanticIDs = semanticIDs;\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 && semanticIDs != null) {" + NL + "\t\t\t\tint eObjectID = ";
+ protected final String TEXT_82 = ".getVisualID((View)eObject); " + NL + "\t\t\t\tfor(int i = 0; i < semanticIDs.length; i++) {" + NL + "\t\t\t\t\tif(semanticIDs[i] == eObjectID) {" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn false;\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\treturn eObject != null && (expression.context() instanceof EClass) && " + NL + "\t\t\t\t((EClass)expression.context()).isSuperTypeOf(eObject.eClass());" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tString getToolTipText() {" + NL + "\t\t\tStringBuffer buf = new StringBuffer();" + NL + "\t\t\tif(name != null) buf.append(name);" + NL + "\t\t\tif(description != null) buf.append('\\n').append(description).append('\\n');" + NL + "\t\t\tif(lowLimit != null) buf.append(\"low:\").append(lowLimit);" + NL + "\t\t\tif(highLimit != null) buf.append(\" high:\").append(highLimit);" + NL + "\t\t\treturn buf.toString();" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static ";
+ protected final String TEXT_83 = "/*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_84 = ")context2MetricsMap.get(target);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
+ protected final String TEXT_85 = " 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 + "\tpublic static Number calculateMetric(String metricKey, Object contextInstance) {" + NL + "\t\tif (key2MetricMap == null) {" + NL + "\t\t\tinitializeRegistry();" + NL + "\t\t}" + NL + "\t\tMetricDef metric = (MetricDef)key2MetricMap.get(metricKey);" + NL + "\t\tNumber value = (metric != null) ? metric.calcMetric(contextInstance) : null;" + NL + "\t\treturn (value != null && !(value instanceof Double)) ? new Double(value.doubleValue()) : value;\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate static void initializeRegistry() {" + NL + "\t\tif(context2MetricsMap != null) return;";
+ protected final String TEXT_86 = "\t\t" + NL + "\t\t";
+ protected final String TEXT_87 = NL;
+ protected final String TEXT_88 = " ";
+ protected final String TEXT_89 = " = new ";
+ protected final String TEXT_90 = "(3);";
+ protected final String TEXT_91 = ".put(\"";
+ protected final String TEXT_92 = "\", ";
+ protected final String TEXT_93 = "); //$NON-NLS-1$";
+ protected final String TEXT_94 = NL + "\t\tregister(new MetricDef(";
+ protected final String TEXT_95 = "," + NL + "\t\t\t";
+ protected final String TEXT_96 = "null";
+ protected final String TEXT_97 = ".";
+ protected final String TEXT_98 = "(";
+ protected final String TEXT_99 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_100 = ", ";
+ protected final String TEXT_101 = ")";
+ protected final String TEXT_102 = ".";
+ protected final String TEXT_103 = "(";
+ protected final String TEXT_104 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_105 = ")";
+ protected final String TEXT_106 = "new ";
+ protected final String TEXT_107 = "(";
+ protected final String TEXT_108 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
+ protected final String TEXT_109 = " env) {\t" + NL + "\t\t";
+ protected final String TEXT_110 = " self = (";
+ protected final String TEXT_111 = ")context;";
+ protected final String TEXT_112 = "\t" + NL + "\t\t";
+ protected final String TEXT_113 = " ";
+ protected final String TEXT_114 = " = (";
+ protected final String TEXT_115 = ")env.get(\"";
+ protected final String TEXT_116 = "\"); //$NON-NLS-1$";
+ protected final String TEXT_117 = NL + "\t\treturn ";
+ protected final String TEXT_118 = ".";
+ protected final String TEXT_119 = "(self";
+ protected final String TEXT_120 = ", ";
+ protected final String TEXT_121 = ");" + NL + "\t}" + NL + "}";
+ protected final String TEXT_122 = NL + ",";
+ protected final String TEXT_123 = NL + "\t\t\t";
+ protected final String TEXT_124 = "," + NL + "\t\t\t";
+ protected final String TEXT_125 = "new Double(";
+ protected final String TEXT_126 = ")";
+ protected final String TEXT_127 = "null";
+ protected final String TEXT_128 = ",\t\t\t\t\t" + NL + "\t\t\t";
+ protected final String TEXT_129 = "new Double(";
+ protected final String TEXT_130 = ")";
+ protected final String TEXT_131 = "null";
+ protected final String TEXT_132 = "," + NL + "\t\t\t";
protected final String TEXT_133 = "," + NL + "\t\t\t";
- protected final String TEXT_134 = "," + NL + "\t\t\t";
- protected final String TEXT_135 = "));";
- protected final String TEXT_136 = "\t\t" + NL + "\t}\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_137 = "();" + NL + "\t\t\tmetricsRegistry = new ";
- protected final String TEXT_138 = "();" + NL + "\t\t\tkey2MetricMap = new ";
- protected final String TEXT_139 = "();" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_140 = " metrics = (";
- protected final String TEXT_141 = ")context2MetricsMap.get(metric.expression.context());" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new ";
- protected final String TEXT_142 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.expression.context(), metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t\tkey2MetricMap.put(metric.key, metric);\t\t" + NL + "\t}\t" + NL;
- protected final String TEXT_143 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class JavaRules {";
- protected final String TEXT_144 = "\t\t";
- protected final String TEXT_145 = NL;
- protected final String TEXT_146 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
- protected final String TEXT_147 = " ";
- protected final String TEXT_148 = "(";
- protected final String TEXT_149 = " self";
- protected final String TEXT_150 = ", ";
- protected final String TEXT_151 = " ";
- protected final String TEXT_152 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
- protected final String TEXT_153 = ".NoImplException(\"No user java implementation provided in '";
- protected final String TEXT_154 = "' operation\"); //$NON-NLS-1$" + NL + "}";
- protected final String TEXT_155 = NL + "\t} //JavaRules";
- protected final String TEXT_156 = "\t\t" + NL + "" + NL + "}";
- protected final String TEXT_157 = NL;
+ protected final String TEXT_134 = "));";
+ protected final String TEXT_135 = "\t\t" + NL + "\t}\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_136 = "();" + NL + "\t\t\tmetricsRegistry = new ";
+ protected final String TEXT_137 = "();" + NL + "\t\t\tkey2MetricMap = new ";
+ protected final String TEXT_138 = "();" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_139 = " metrics = (";
+ protected final String TEXT_140 = ")context2MetricsMap.get(metric.expression.context());" + NL + "\t\tif(metrics == null) {" + NL + "\t\t\tmetrics = new ";
+ protected final String TEXT_141 = "();" + NL + "\t\t\tcontext2MetricsMap.put(metric.expression.context(), metrics);" + NL + "\t\t}" + NL + "\t\tmetricsRegistry.add(metric);" + NL + "\t\tmetrics.add(metric);" + NL + "\t\tkey2MetricMap.put(metric.key, metric);\t\t" + NL + "\t}\t" + NL;
+ protected final String TEXT_142 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class JavaRules {";
+ protected final String TEXT_143 = "\t\t";
+ protected final String TEXT_144 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
+ protected final String TEXT_145 = " ";
+ protected final String TEXT_146 = "(";
+ protected final String TEXT_147 = " self";
+ protected final String TEXT_148 = ", ";
+ protected final String TEXT_149 = " ";
+ protected final String TEXT_150 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
+ protected final String TEXT_151 = ".NoImplException(\"No user java implementation provided in '";
+ protected final String TEXT_152 = "' operation\"); //$NON-NLS-1$" + NL + "}";
+ protected final String TEXT_153 = NL + "\t} //JavaRules";
+ protected final String TEXT_154 = "\t\t" + NL + "" + NL + "}";
+ protected final String TEXT_155 = NL;
public String generate(Object argument)
{
@@ -183,14 +181,13 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
@@ -226,171 +223,171 @@ importManager.registerInnerClass("ResultView");
importManager.markImportLocation(stringBuffer);
final String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName());
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
stringBuffer.append(genDiagram.getMetricProviderClassName());
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider"));
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction"));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Action"));
+ stringBuffer.append(TEXT_11);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor"));
stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor"));
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor"));
- stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchPart"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IViewPart"));
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI"));
stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI"));
stringBuffer.append(TEXT_17);
- stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI"));
- stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(pluginActivatorClass);
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_22);
- stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_23);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName());
stringBuffer.append(TEXT_24);
stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName());
stringBuffer.append(TEXT_25);
stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName());
stringBuffer.append(TEXT_26);
- stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName());
- stringBuffer.append(TEXT_27);
stringBuffer.append(importManager.getImportedName("java.util.Collections"));
+ stringBuffer.append(TEXT_27);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_29);
- stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
stringBuffer.append(TEXT_32);
- stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
stringBuffer.append(TEXT_34);
- stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_35);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.ViewPart"));
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(genDiagram.getMetricViewID());
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
+ stringBuffer.append(TEXT_40);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_41);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_42);
- stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_43);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC"));
stringBuffer.append(TEXT_44);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC"));
stringBuffer.append(TEXT_45);
- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.GC"));
- stringBuffer.append(TEXT_46);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.resource.JFaceResources"));
+ stringBuffer.append(TEXT_46);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener"));
stringBuffer.append(TEXT_47);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener"));
stringBuffer.append(TEXT_48);
- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionListener"));
- stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionEvent"));
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart"));
+ stringBuffer.append(TEXT_50);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName()));
stringBuffer.append(TEXT_51);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName()));
stringBuffer.append(TEXT_52);
- stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName()));
- stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IEditorPart"));
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.FileEditorInput"));
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.util.WorkspaceSynchronizer"));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getEditor().getQualifiedClassName()));
+ stringBuffer.append(TEXT_56);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart"));
stringBuffer.append(TEXT_57);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart"));
stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart"));
stringBuffer.append(TEXT_59);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart"));
- stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName());
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException"));
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
stringBuffer.append(pluginActivatorClass);
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_63);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_65);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
+ stringBuffer.append(TEXT_69);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
stringBuffer.append(TEXT_70);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
stringBuffer.append(TEXT_71);
- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants"));
stringBuffer.append(TEXT_72);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants"));
stringBuffer.append(TEXT_73);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants"));
- stringBuffer.append(TEXT_74);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Image"));
+ stringBuffer.append(TEXT_74);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil"));
stringBuffer.append(TEXT_75);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil"));
stringBuffer.append(TEXT_76);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil"));
- stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil"));
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
+ stringBuffer.append(TEXT_79);
+ stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
stringBuffer.append(TEXT_80);
stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
stringBuffer.append(TEXT_81);
- stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
- stringBuffer.append(TEXT_82);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_82);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_84);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_85);
- stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_86);
List javaRules = new ArrayList();
for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator(); it.hasNext(); ) {
@@ -405,7 +402,7 @@ for(Iterator it = genDiagram.getEditorGen().getMetrics().getMetrics().iterator()
javaRules.add(nextMetric);
}
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_86);
{ /*begin the scope*/
/*
@@ -417,13 +414,13 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi
genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression)
instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_88);
stringBuffer.append(__outEnvVarName);
- stringBuffer.append(TEXT_90);
+ stringBuffer.append(TEXT_89);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_91);
+ stringBuffer.append(TEXT_90);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String nextVariableName = (String)envVarIt.next();
@@ -432,11 +429,11 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi
stringBuffer.append(__outEnvVarName);
- stringBuffer.append(TEXT_92);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_92);
stringBuffer.append(varTypeEClassifierAccess);
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_93);
}
}
@@ -444,9 +441,9 @@ if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProvi
} /*end the scope*/
- stringBuffer.append(TEXT_95);
+ stringBuffer.append(TEXT_94);
stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getKey()));
- stringBuffer.append(TEXT_96);
+ stringBuffer.append(TEXT_95);
{ /*begin the scope*/
/*
@@ -462,7 +459,7 @@ String __javaOperationContainer;
if(__genExprProvider == null || __importedAbstractClass == null) {
- stringBuffer.append(TEXT_97);
+ stringBuffer.append(TEXT_96);
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
@@ -471,26 +468,26 @@ String __javaOperationContainer;
if(!__exprEnvVariables.isEmpty()) {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_97);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_99);
+ stringBuffer.append(TEXT_98);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_99);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_101);
+ stringBuffer.append(TEXT_100);
stringBuffer.append(__outEnvVarName);
- stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_101);
} else {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_103);
+ stringBuffer.append(TEXT_102);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_103);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_104);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_106);
+ stringBuffer.append(TEXT_105);
}
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
@@ -498,51 +495,51 @@ String __javaOperationContainer;
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_107);
+ stringBuffer.append(TEXT_106);
stringBuffer.append(__importedAbstractClass);
- stringBuffer.append(TEXT_108);
+ stringBuffer.append(TEXT_107);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_109);
+ stringBuffer.append(TEXT_108);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_109);
+ stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_110);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_111);
- stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_112);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String nextVariableName = (String)envVarIt.next();
org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_113);
+ stringBuffer.append(TEXT_112);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_114);
+ stringBuffer.append(TEXT_113);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_115);
+ stringBuffer.append(TEXT_114);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_116);
+ stringBuffer.append(TEXT_115);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_117);
+ stringBuffer.append(TEXT_116);
}
- stringBuffer.append(TEXT_118);
+ stringBuffer.append(TEXT_117);
if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) {
stringBuffer.append(__javaOperationContainer);
- stringBuffer.append(TEXT_119);
+ stringBuffer.append(TEXT_118);
}
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_120);
+ stringBuffer.append(TEXT_119);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
- stringBuffer.append(TEXT_121);
+ stringBuffer.append(TEXT_120);
stringBuffer.append((String)envVarIt.next());
}
- stringBuffer.append(TEXT_122);
+ stringBuffer.append(TEXT_121);
}
} /*end of scope*/
- stringBuffer.append(TEXT_123);
+ stringBuffer.append(TEXT_122);
String IDs = "null";
if(nextMetric.getTarget() instanceof GenDiagramElementTarget) {
@@ -556,49 +553,49 @@ String __javaOperationContainer;
buf.append(" }");
IDs = buf.toString();
}
- stringBuffer.append(TEXT_124);
+ stringBuffer.append(TEXT_123);
stringBuffer.append(IDs);
- stringBuffer.append(TEXT_125);
+ stringBuffer.append(TEXT_124);
if(nextMetric.getLowLimit()!=null){
- stringBuffer.append(TEXT_126);
+ stringBuffer.append(TEXT_125);
stringBuffer.append(nextMetric.getLowLimit());
- stringBuffer.append(TEXT_127);
+ stringBuffer.append(TEXT_126);
}else{
- stringBuffer.append(TEXT_128);
+ stringBuffer.append(TEXT_127);
}
- stringBuffer.append(TEXT_129);
+ stringBuffer.append(TEXT_128);
if(nextMetric.getHighLimit()!=null){
- stringBuffer.append(TEXT_130);
+ stringBuffer.append(TEXT_129);
stringBuffer.append(nextMetric.getHighLimit());
- stringBuffer.append(TEXT_131);
+ stringBuffer.append(TEXT_130);
}else{
- stringBuffer.append(TEXT_132);
+ stringBuffer.append(TEXT_131);
}
- stringBuffer.append(TEXT_133);
+ stringBuffer.append(TEXT_132);
stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getName()));
- stringBuffer.append(TEXT_134);
+ stringBuffer.append(TEXT_133);
stringBuffer.append(org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(nextMetric.getDescription()));
- stringBuffer.append(TEXT_135);
+ stringBuffer.append(TEXT_134);
} /* metrics iteration */
- stringBuffer.append(TEXT_136);
+ stringBuffer.append(TEXT_135);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_137);
+ stringBuffer.append(TEXT_136);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_138);
+ stringBuffer.append(TEXT_137);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
+ stringBuffer.append(TEXT_138);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_139);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_140);
- stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_141);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_142);
+ stringBuffer.append(TEXT_141);
if(!javaRules.isEmpty()) {
- stringBuffer.append(TEXT_143);
+ stringBuffer.append(TEXT_142);
for(Iterator it = javaRules.iterator(); it.hasNext();) {
GenMetricRule nextMetric = (GenMetricRule)it.next();
@@ -607,8 +604,7 @@ if(!javaRules.isEmpty()) {
String __genExprResultType = "java.lang.Double";
Map __exprEnvVariables = Collections.EMPTY_MAP;
- stringBuffer.append(TEXT_144);
- stringBuffer.append(TEXT_145);
+ stringBuffer.append(TEXT_143);
/*
ValueExpression __genValueExpression
@@ -629,13 +625,13 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_146);
+ stringBuffer.append(TEXT_144);
stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
- stringBuffer.append(TEXT_147);
+ stringBuffer.append(TEXT_145);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_148);
+ stringBuffer.append(TEXT_146);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_149);
+ stringBuffer.append(TEXT_147);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String __nextVarName = (String)envVarIt.next();
@@ -643,30 +639,30 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_150);
+ stringBuffer.append(TEXT_148);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_151);
+ stringBuffer.append(TEXT_149);
stringBuffer.append(__nextVarName);
}
- stringBuffer.append(TEXT_152);
+ stringBuffer.append(TEXT_150);
stringBuffer.append(__importedAbstractExpr);
- stringBuffer.append(TEXT_153);
+ stringBuffer.append(TEXT_151);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_154);
+ stringBuffer.append(TEXT_152);
} /* end of GenJavaExpressionProvider */
}
- stringBuffer.append(TEXT_155);
+ stringBuffer.append(TEXT_153);
} /* end of JavaRules */
- stringBuffer.append(TEXT_156);
+ stringBuffer.append(TEXT_154);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_157);
+ stringBuffer.append(TEXT_155);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ModelingAssistantProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ModelingAssistantProviderGenerator.java
index ec994a10c..fc7004bbe 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ModelingAssistantProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ModelingAssistantProviderGenerator.java
@@ -16,67 +16,66 @@ public class ModelingAssistantProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.Collection;" + NL + "import java.util.Collections;" + NL + "import java.util.HashSet;" + NL + "import java.util.Iterator;" + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.IElementType;" + NL + "import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;" + NL + "import org.eclipse.gmf.runtime.notation.Diagram;" + NL + "import org.eclipse.jface.viewers.ILabelProvider;" + NL + "import org.eclipse.jface.window.Window;" + NL + "import org.eclipse.swt.widgets.Display;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.dialogs.ElementListSelectionDialog;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ModelingAssistantProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForPopupBar(IAdaptable host) {" + NL + "\t\tIGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_7 = NL + "\t\tif (editPart instanceof ";
- protected final String TEXT_8 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_9 = NL + "\t\t\ttypes.add(";
- protected final String TEXT_10 = ".";
- protected final String TEXT_11 = ");";
- protected final String TEXT_12 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_13 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}";
- protected final String TEXT_14 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnSource(IAdaptable source) {";
- protected final String TEXT_15 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_16 = NL + "\t\tif (sourceEditPart instanceof ";
- protected final String TEXT_17 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_18 = NL + "\t\t\ttypes.add(";
- protected final String TEXT_19 = ".";
- protected final String TEXT_20 = ");";
- protected final String TEXT_21 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_22 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnTarget(IAdaptable target) {";
- protected final String TEXT_23 = NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_24 = NL + "\t\tif (targetEditPart instanceof ";
- protected final String TEXT_25 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_26 = NL + "\t\t\ttypes.add(";
- protected final String TEXT_27 = ".";
- protected final String TEXT_28 = ");";
- protected final String TEXT_29 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_30 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {";
- protected final String TEXT_31 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);" + NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_32 = NL + "\t\tif (sourceEditPart instanceof ";
- protected final String TEXT_33 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_34 = NL + "\t\t\tif (targetEditPart instanceof ";
- protected final String TEXT_35 = ") {" + NL + "\t\t\t\ttypes.add(";
- protected final String TEXT_36 = ".";
- protected final String TEXT_37 = ");" + NL + "\t\t\t}";
- protected final String TEXT_38 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_39 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForSource(IAdaptable target, IElementType relationshipType) {";
- protected final String TEXT_40 = NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_41 = NL + "\t\tif (targetEditPart instanceof ";
- protected final String TEXT_42 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_43 = NL + "\t\t\tif (relationshipType == ";
- protected final String TEXT_44 = ".";
- protected final String TEXT_45 = ") {" + NL + "\t\t\t\ttypes.add(";
- protected final String TEXT_46 = ".";
- protected final String TEXT_47 = ");" + NL + "\t\t\t}";
- protected final String TEXT_48 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_49 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForTarget(IAdaptable source, IElementType relationshipType) {";
- protected final String TEXT_50 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);";
- protected final String TEXT_51 = NL + "\t\tif (sourceEditPart instanceof ";
- protected final String TEXT_52 = ") {" + NL + "\t\t\tList types = new ArrayList();";
- protected final String TEXT_53 = NL + "\t\t\tif (relationshipType == ";
- protected final String TEXT_54 = ".";
- protected final String TEXT_55 = ") {" + NL + "\t\t\t\ttypes.add(";
- protected final String TEXT_56 = ".";
- protected final String TEXT_57 = ");" + NL + "\t\t\t}";
- protected final String TEXT_58 = NL + "\t\t\treturn types;" + NL + "\t\t}";
- protected final String TEXT_59 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {" + NL + "\t\treturn selectExistingElement(target, getTypesForSource(target, relationshipType));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {" + NL + "\t\treturn selectExistingElement(source, getTypesForTarget(source, relationshipType));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject selectExistingElement(IAdaptable host, Collection types) {" + NL + "\t\tif (types.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tIGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);" + NL + "\t\tif (editPart == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tDiagram diagram = (Diagram) editPart.getRoot().getContents().getModel();" + NL + "\t\tCollection elements = new HashSet();" + NL + "\t\tfor (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {" + NL + "\t\t\tEObject element = (EObject) it.next();" + NL + "\t\t\tif (isApplicableElement(element, types)) {" + NL + "\t\t\t\telements.add(element);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (elements.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isApplicableElement(EObject element, Collection types) {" + NL + "\t\tIElementType type = ElementTypeRegistry.getInstance().getElementType(element);" + NL + "\t\treturn types.contains(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject selectElement(EObject[] elements) {" + NL + "\t\tShell shell = Display.getCurrent().getActiveShell();" + NL + "\t\tILabelProvider labelProvider = new AdapterFactoryLabelProvider(";
- protected final String TEXT_60 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\tElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);" + NL + "\t\tdialog.setMessage(\"Available domain model elements:\");" + NL + "\t\tdialog.setTitle(\"Select domain model element\");" + NL + "\t\tdialog.setMultipleSelection(false);" + NL + "\t\tdialog.setElements(elements);" + NL + "\t\tEObject selected = null;" + NL + "\t\tif (dialog.open() == Window.OK) {" + NL + "\t\t\tselected = (EObject) dialog.getFirstResult();" + NL + "\t\t}" + NL + "\t\treturn selected;" + NL + "\t}" + NL + "}";
- protected final String TEXT_61 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import java.util.ArrayList;" + NL + "import java.util.Collection;" + NL + "import java.util.Collections;" + NL + "import java.util.HashSet;" + NL + "import java.util.Iterator;" + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.IElementType;" + NL + "import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;" + NL + "import org.eclipse.gmf.runtime.notation.Diagram;" + NL + "import org.eclipse.jface.viewers.ILabelProvider;" + NL + "import org.eclipse.jface.window.Window;" + NL + "import org.eclipse.swt.widgets.Display;" + NL + "import org.eclipse.swt.widgets.Shell;" + NL + "import org.eclipse.ui.dialogs.ElementListSelectionDialog;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ModelingAssistantProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForPopupBar(IAdaptable host) {" + NL + "\t\tIGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_6 = NL + "\t\tif (editPart instanceof ";
+ protected final String TEXT_7 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_8 = NL + "\t\t\ttypes.add(";
+ protected final String TEXT_9 = ".";
+ protected final String TEXT_10 = ");";
+ protected final String TEXT_11 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_12 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}";
+ protected final String TEXT_13 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnSource(IAdaptable source) {";
+ protected final String TEXT_14 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_15 = NL + "\t\tif (sourceEditPart instanceof ";
+ protected final String TEXT_16 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_17 = NL + "\t\t\ttypes.add(";
+ protected final String TEXT_18 = ".";
+ protected final String TEXT_19 = ");";
+ protected final String TEXT_20 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_21 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnTarget(IAdaptable target) {";
+ protected final String TEXT_22 = NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_23 = NL + "\t\tif (targetEditPart instanceof ";
+ protected final String TEXT_24 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_25 = NL + "\t\t\ttypes.add(";
+ protected final String TEXT_26 = ".";
+ protected final String TEXT_27 = ");";
+ protected final String TEXT_28 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_29 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {";
+ protected final String TEXT_30 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);" + NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_31 = NL + "\t\tif (sourceEditPart instanceof ";
+ protected final String TEXT_32 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_33 = NL + "\t\t\tif (targetEditPart instanceof ";
+ protected final String TEXT_34 = ") {" + NL + "\t\t\t\ttypes.add(";
+ protected final String TEXT_35 = ".";
+ protected final String TEXT_36 = ");" + NL + "\t\t\t}";
+ protected final String TEXT_37 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_38 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForSource(IAdaptable target, IElementType relationshipType) {";
+ protected final String TEXT_39 = NL + "\t\tIGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_40 = NL + "\t\tif (targetEditPart instanceof ";
+ protected final String TEXT_41 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_42 = NL + "\t\t\tif (relationshipType == ";
+ protected final String TEXT_43 = ".";
+ protected final String TEXT_44 = ") {" + NL + "\t\t\t\ttypes.add(";
+ protected final String TEXT_45 = ".";
+ protected final String TEXT_46 = ");" + NL + "\t\t\t}";
+ protected final String TEXT_47 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_48 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic List getTypesForTarget(IAdaptable source, IElementType relationshipType) {";
+ protected final String TEXT_49 = NL + "\t\tIGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);";
+ protected final String TEXT_50 = NL + "\t\tif (sourceEditPart instanceof ";
+ protected final String TEXT_51 = ") {" + NL + "\t\t\tList types = new ArrayList();";
+ protected final String TEXT_52 = NL + "\t\t\tif (relationshipType == ";
+ protected final String TEXT_53 = ".";
+ protected final String TEXT_54 = ") {" + NL + "\t\t\t\ttypes.add(";
+ protected final String TEXT_55 = ".";
+ protected final String TEXT_56 = ");" + NL + "\t\t\t}";
+ protected final String TEXT_57 = NL + "\t\t\treturn types;" + NL + "\t\t}";
+ protected final String TEXT_58 = NL + "\t\treturn Collections.EMPTY_LIST;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {" + NL + "\t\treturn selectExistingElement(target, getTypesForSource(target, relationshipType));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {" + NL + "\t\treturn selectExistingElement(source, getTypesForTarget(source, relationshipType));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject selectExistingElement(IAdaptable host, Collection types) {" + NL + "\t\tif (types.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tIGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);" + NL + "\t\tif (editPart == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tDiagram diagram = (Diagram) editPart.getRoot().getContents().getModel();" + NL + "\t\tCollection elements = new HashSet();" + NL + "\t\tfor (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {" + NL + "\t\t\tEObject element = (EObject) it.next();" + NL + "\t\t\tif (isApplicableElement(element, types)) {" + NL + "\t\t\t\telements.add(element);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (elements.isEmpty()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isApplicableElement(EObject element, Collection types) {" + NL + "\t\tIElementType type = ElementTypeRegistry.getInstance().getElementType(element);" + NL + "\t\treturn types.contains(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject selectElement(EObject[] elements) {" + NL + "\t\tShell shell = Display.getCurrent().getActiveShell();" + NL + "\t\tILabelProvider labelProvider = new AdapterFactoryLabelProvider(";
+ protected final String TEXT_59 = ".getInstance().getItemProvidersAdapterFactory());" + NL + "\t\tElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);" + NL + "\t\tdialog.setMessage(\"Available domain model elements:\");" + NL + "\t\tdialog.setTitle(\"Select domain model element\");" + NL + "\t\tdialog.setMultipleSelection(false);" + NL + "\t\tdialog.setElements(elements);" + NL + "\t\tEObject selected = null;" + NL + "\t\tif (dialog.open() == Window.OK) {" + NL + "\t\t\tselected = (EObject) dialog.getFirstResult();" + NL + "\t\t}" + NL + "\t\treturn selected;" + NL + "\t}" + NL + "}";
+ protected final String TEXT_60 = NL;
public String generate(Object argument)
{
@@ -85,21 +84,20 @@ public class ModelingAssistantProviderGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getModelingAssistantProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
for (Iterator contents = genDiagram.getAllContainers().iterator(); contents.hasNext(); ) {
GenContainerBase genContainer = (GenContainerBase) contents.next();
@@ -117,25 +115,25 @@ for (Iterator contents = genDiagram.getAllContainers().iterator(); contents.hasN
}
if (!children.isEmpty()) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName(genContainer.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
for (int i = 0; i < children.size(); i++) {
String id = ((GenNode) children.get(i)).getUniqueIdentifier();
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(id);
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
}
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
}
}
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
Map outgoingLinks = new LinkedHashMap(); // source -> links going from the source
Map incomingLinks = new LinkedHashMap(); // target -> links coming to the target
@@ -161,161 +159,161 @@ for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
}
}
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
if (!outgoingLinks.isEmpty()) {
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
for (Iterator sources = outgoingLinks.keySet().iterator(); sources.hasNext(); ) {
GenCommonBase source = (GenCommonBase) sources.next();
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName(source.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
for (Iterator links = ((Collection) outgoingLinks.get(source)).iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
}
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
}
}
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
if (!incomingLinks.isEmpty()) {
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
for (Iterator targets = incomingLinks.keySet().iterator(); targets.hasNext(); ) {
GenCommonBase target = (GenCommonBase) targets.next();
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
stringBuffer.append(importManager.getImportedName(target.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
for (Iterator links = ((Collection) incomingLinks.get(target)).iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
}
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
}
}
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
if (!outgoingLinks.isEmpty()) {
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
for (Iterator sources = outgoingLinks.keySet().iterator(); sources.hasNext(); ) {
GenCommonBase source = (GenCommonBase) sources.next();
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName(source.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
for (Iterator links = ((Collection) outgoingLinks.get(source)).iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
for (Iterator targets = genLink.getAssistantTargets().iterator(); targets.hasNext(); ) {
GenCommonBase target = (GenCommonBase) targets.next();
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(target.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
}
}
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
}
}
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
if (!incomingLinks.isEmpty()) {
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
for (Iterator targets = incomingLinks.keySet().iterator(); targets.hasNext(); ) {
GenCommonBase target = (GenCommonBase) targets.next();
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(importManager.getImportedName(target.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
for (Iterator links = ((Collection) incomingLinks.get(target)).iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
for (Iterator sources = genLink.getAssistantSources().iterator(); sources.hasNext(); ) {
GenCommonBase source = (GenCommonBase) sources.next();
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(source.getUniqueIdentifier());
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
}
}
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
}
}
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
if (!outgoingLinks.isEmpty()) {
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
for (Iterator sources = outgoingLinks.keySet().iterator(); sources.hasNext(); ) {
GenCommonBase source = (GenCommonBase) sources.next();
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(importManager.getImportedName(source.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
for (Iterator links = ((Collection) outgoingLinks.get(source)).iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
for (Iterator targets = genLink.getAssistantTargets().iterator(); targets.hasNext(); ) {
GenCommonBase target = (GenCommonBase) targets.next();
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(target.getUniqueIdentifier());
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
}
}
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
}
}
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java
index 00d5f16a2..8aa469cd6 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsDecoratorProviderGenerator.java
@@ -15,16 +15,15 @@ public class ShortcutsDecoratorProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.swt.graphics.Image;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractProvider implements IDecoratorProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String SHORTCUTS_DECORATOR_ID = \"shortcuts\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (!(operation instanceof CreateDecoratorsOperation)) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tIDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\treturn view != null && ";
- protected final String TEXT_7 = ".MODEL_ID.equals(";
- protected final String TEXT_8 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createDecorators(IDecoratorTarget decoratorTarget) {" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\tdecoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected class ShortcutsDecorator extends AbstractDecorator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ShortcutsDecorator(IDecoratorTarget decoratorTarget) {" + NL + "\t\t\tsuper(decoratorTarget);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void activate() {" + NL + "\t\t\trefresh();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void refresh() {" + NL + "\t\t\tremoveDecoration();" + NL + "\t\t\tEditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);" + NL + "\t\t\tImage image = ";
- protected final String TEXT_9 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"); //$NON-NLS-1$" + NL + "\t\t\tif (editPart instanceof ShapeEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addShapeDecoration(image, IDecoratorTarget.Direction.SOUTH_WEST, 0, false));" + NL + "\t\t\t} else if (editPart instanceof ConnectionEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}";
- protected final String TEXT_10 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.emf.ecore.EAnnotation;" + NL + "import org.eclipse.gef.EditPart;" + NL + "import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;" + NL + "import org.eclipse.gmf.runtime.common.core.service.IOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;" + NL + "import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.swt.graphics.Image;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractProvider implements IDecoratorProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String SHORTCUTS_DECORATOR_ID = \"shortcuts\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean provides(IOperation operation) {" + NL + "\t\tif (!(operation instanceof CreateDecoratorsOperation)) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tIDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\treturn view != null && ";
+ protected final String TEXT_6 = ".MODEL_ID.equals(";
+ protected final String TEXT_7 = ".getModelID(view));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createDecorators(IDecoratorTarget decoratorTarget) {" + NL + "\t\tView view = (View) decoratorTarget.getAdapter(View.class);" + NL + "\t\tif (view != null) {" + NL + "\t\t\tEAnnotation annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\tdecoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected class ShortcutsDecorator extends AbstractDecorator {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ShortcutsDecorator(IDecoratorTarget decoratorTarget) {" + NL + "\t\t\tsuper(decoratorTarget);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void activate() {" + NL + "\t\t\trefresh();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void refresh() {" + NL + "\t\t\tremoveDecoration();" + NL + "\t\t\tEditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);" + NL + "\t\t\tImage image = ";
+ protected final String TEXT_8 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"); //$NON-NLS-1$" + NL + "\t\t\tif (editPart instanceof ShapeEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addShapeDecoration(image, IDecoratorTarget.Direction.SOUTH_WEST, 0, false));" + NL + "\t\t\t} else if (editPart instanceof ConnectionEditPart) {" + NL + "\t\t\t\tsetDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}";
+ protected final String TEXT_9 = NL;
public String generate(Object argument)
{
@@ -33,29 +32,28 @@ public class ShortcutsDecoratorProviderGenerator
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getShortcutsDecoratorProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsPropertyTester.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsPropertyTester.java
index 97443237e..3a9ec185c 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsPropertyTester.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/providers/ShortcutsPropertyTester.java
@@ -15,19 +15,18 @@ public class ShortcutsPropertyTester
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
- protected final String TEXT_7 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected static final String SHORTCUT_PROPERTY = \"isShortcut\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean test(Object receiver, String method, Object[] args, Object expectedValue) {" + NL + "\t\tif (false == receiver instanceof ";
- protected final String TEXT_8 = ") {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_9 = " view = (";
- protected final String TEXT_10 = ") receiver;" + NL + "\t\tif (SHORTCUT_PROPERTY.equals(method)) {" + NL + "\t\t\t";
- protected final String TEXT_11 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\treturn ";
- protected final String TEXT_12 = ".MODEL_ID.equals(annotation.getDetails().get(\"modelID\")); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "}";
- protected final String TEXT_13 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected static final String SHORTCUT_PROPERTY = \"isShortcut\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean test(Object receiver, String method, Object[] args, Object expectedValue) {" + NL + "\t\tif (false == receiver instanceof ";
+ protected final String TEXT_7 = ") {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_8 = " view = (";
+ protected final String TEXT_9 = ") receiver;" + NL + "\t\tif (SHORTCUT_PROPERTY.equals(method)) {" + NL + "\t\t\t";
+ protected final String TEXT_10 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tif (annotation != null) {" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_11 = ".MODEL_ID.equals(annotation.getDetails().get(\"modelID\")); //$NON-NLS-1$" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "}";
+ protected final String TEXT_12 = NL;
public String generate(Object argument)
{
@@ -36,35 +35,34 @@ public class ShortcutsPropertyTester
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getShortcutPropertyTesterClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.expressions.PropertyTester"));
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_9);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
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 09a48675f..dbb2107c4 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
@@ -17,100 +17,98 @@ public class ValidationProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractContributionItemProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean constraintsActive = false;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean shouldConstraintsBePrivate() {" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {" + NL + "\t\tif (";
- protected final String TEXT_7 = ".ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {" + NL + "\t\t\treturn new ";
- protected final String TEXT_8 = ".ValidateAction(partDescriptor);" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static void runWithConstraints(View view, Runnable op) {" + NL + "\t\t\tfinal Runnable fop = op;" + NL + "\t\t\tRunnable task = new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tconstraintsActive = true;" + NL + "\t\t\t\t\t\tfop.run();" + NL + "\t\t\t\t\t} finally {" + NL + "\t\t\t\t\t\tconstraintsActive = false;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);" + NL + "\t\t\tif (txDomain != null) {" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\ttxDomain.runExclusive(task);" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\t";
- protected final String TEXT_9 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttask.run();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic boolean isInDefaultEditorContext(Object object) {" + NL + "\t\tif(shouldConstraintsBePrivate() && !constraintsActive) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\treturn constraintsActive && ";
- protected final String TEXT_10 = ".MODEL_ID.equals(";
- protected final String TEXT_11 = ".getModelID((View)object));" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}\t";
- protected final String TEXT_12 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tpublic static class ";
- protected final String TEXT_13 = " implements ";
- protected final String TEXT_14 = " {";
- protected final String TEXT_15 = 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_16 = ".class;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_17 = 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_18 = NL + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final ";
- protected final String TEXT_19 = " semanticCtxIdMap = new ";
- protected final String TEXT_20 = "();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {";
- protected final String TEXT_21 = NL + "\t\tsemanticCtxIdMap.put(String.valueOf(";
- protected final String TEXT_22 = "), ";
- protected final String TEXT_23 = ".class); //$NON-NLS-1$";
- protected final String TEXT_24 = NL + "\t}";
- protected final String TEXT_25 = NL;
- protected final String TEXT_26 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_27 = " getNotationTraversalStrategy(IBatchValidator validator) {";
- protected final String TEXT_28 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);";
- protected final String TEXT_29 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();";
- protected final String TEXT_30 = NL + "\t}";
- protected final String TEXT_31 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements ";
- protected final String TEXT_32 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_33 = " 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_34 = " traversalRoots," + NL + "\t\t\t\t";
- protected final String TEXT_35 = " monitor) {" + NL + "\t\t\tdefaultStrategy.startTraversal(traversalRoots, monitor);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void prepareNextClientContext(EObject nextTarget) { " + NL + "\t\t\tif (nextTarget != null && currentTarget != null) {" + NL + "\t\t\t\tif (nextTarget instanceof View) {" + NL + "\t\t\t\t\tString id = ((View) nextTarget).getType();" + NL + "\t\t\t\t\tString nextSemanticId = id != null" + NL + "\t\t\t\t\t\t\t&& semanticCtxIdMap.containsKey(id) ? id : null;" + NL + "\t\t\t\t\tif ((currentSemanticCtxId != null && !currentSemanticCtxId" + NL + "\t\t\t\t\t\t\t.equals(nextSemanticId))" + NL + "\t\t\t\t\t\t\t|| (nextSemanticId != null && !nextSemanticId" + NL + "\t\t\t\t\t\t\t\t\t.equals(currentSemanticCtxId))) {" + NL + "\t\t\t\t\t\tthis.ctxChanged = true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcurrentSemanticCtxId = nextSemanticId;" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// context of domain model" + NL + "\t\t\t\t\tthis.ctxChanged = currentSemanticCtxId != null;" + NL + "\t\t\t\t\tcurrentSemanticCtxId = null;" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.ctxChanged = false;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}// CtxSwitchStrategy";
- protected final String TEXT_36 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class ";
- protected final String TEXT_37 = " extends ";
- protected final String TEXT_38 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_39 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
- protected final String TEXT_40 = "() {" + NL + "\t\t\texpression = ";
- protected final String TEXT_41 = "null";
- protected final String TEXT_42 = ".";
- protected final String TEXT_43 = "(";
- protected final String TEXT_44 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_45 = ", ";
- protected final String TEXT_46 = ")";
- protected final String TEXT_47 = ".";
- protected final String TEXT_48 = "(";
- protected final String TEXT_49 = ", //$NON-NLS-1$" + NL + "\t";
- protected final String TEXT_50 = ")";
- protected final String TEXT_51 = "new ";
- protected final String TEXT_52 = "(";
- protected final String TEXT_53 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
- protected final String TEXT_54 = " env) {\t" + NL + "\t\t";
- protected final String TEXT_55 = " self = (";
- protected final String TEXT_56 = ")context;";
- protected final String TEXT_57 = "\t" + NL + "\t\t";
- protected final String TEXT_58 = " ";
- protected final String TEXT_59 = " = (";
- protected final String TEXT_60 = ")env.get(\"";
- protected final String TEXT_61 = "\"); //$NON-NLS-1$";
- protected final String TEXT_62 = NL + "\t\treturn ";
- protected final String TEXT_63 = ".";
- protected final String TEXT_64 = "(self";
- protected final String TEXT_65 = ", ";
- protected final String TEXT_66 = ");" + NL + "\t}" + NL + "}";
- protected final String TEXT_67 = NL + ";\t\t" + NL + "\t\t}\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic IStatus validate(";
- protected final String TEXT_68 = " ctx) {" + NL + "\t\t\tObject evalCtx = ctx.getTarget();";
- protected final String TEXT_69 = NL + "\t\t\tif(evalCtx instanceof EObject) evalCtx = ((EObject)evalCtx).eGet(";
- protected final String TEXT_70 = "());" + NL + "\t\t\tif(evalCtx == null) {";
- protected final String TEXT_71 = NL + "\t\t\t\treturn ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) });";
- protected final String TEXT_72 = NL + "\t\t\t\treturn ";
- protected final String TEXT_73 = ".OK_STATUS;";
- protected final String TEXT_74 = NL + "\t\t\t}\t\t\t";
- protected final String TEXT_75 = "\t\t\t" + NL + "\t\t\tevalCtx = ";
- protected final String TEXT_76 = ".calculateMetric(";
- protected final String TEXT_77 = ", evalCtx);";
- protected final String TEXT_78 = "\t\t" + NL + "\t\t\tObject result = expression.evaluate(evalCtx);" + NL + "\t\t\tif(result instanceof Boolean && ((Boolean)result).booleanValue()) {" + NL + "\t\t\t\treturn ";
- protected final String TEXT_79 = ".OK_STATUS;" + NL + "\t\t\t}" + NL + "\t\t\treturn ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) }); " + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_80 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "static class ";
- protected final String TEXT_81 = " {";
- protected final String TEXT_82 = NL;
- protected final String TEXT_83 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
- protected final String TEXT_84 = " ";
- protected final String TEXT_85 = "(";
- protected final String TEXT_86 = " self";
- protected final String TEXT_87 = ", ";
- protected final String TEXT_88 = " ";
- protected final String TEXT_89 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
- protected final String TEXT_90 = ".NoImplException(\"No user java implementation provided in '";
- protected final String TEXT_91 = "' operation\"); //$NON-NLS-1$" + NL + "}";
- protected final String TEXT_92 = NL + "} //";
- protected final String TEXT_93 = NL + "} //";
- protected final String TEXT_94 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractContributionItemProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean constraintsActive = false;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean shouldConstraintsBePrivate() {" + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {" + NL + "\t\tif (";
+ protected final String TEXT_6 = ".ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {" + NL + "\t\t\treturn new ";
+ protected final String TEXT_7 = ".ValidateAction(partDescriptor);" + NL + "\t\t}" + NL + "\t\treturn super.createAction(actionId, partDescriptor);" + NL + "\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static void runWithConstraints(View view, Runnable op) {" + NL + "\t\t\tfinal Runnable fop = op;" + NL + "\t\t\tRunnable task = new Runnable() {" + NL + "" + NL + "\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tconstraintsActive = true;" + NL + "\t\t\t\t\t\tfop.run();" + NL + "\t\t\t\t\t} finally {" + NL + "\t\t\t\t\t\tconstraintsActive = false;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\tTransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);" + NL + "\t\t\tif (txDomain != null) {" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\ttxDomain.runExclusive(task);" + NL + "\t\t\t\t} catch (Exception e) {" + NL + "\t\t\t\t\t";
+ protected final String TEXT_8 = ".getInstance().logError(\"Validation action failed\", e); //$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttask.run();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic boolean isInDefaultEditorContext(Object object) {" + NL + "\t\tif(shouldConstraintsBePrivate() && !constraintsActive) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tif (object instanceof View) {" + NL + "\t\t\treturn constraintsActive && ";
+ protected final String TEXT_9 = ".MODEL_ID.equals(";
+ protected final String TEXT_10 = ".getModelID((View)object));" + NL + "\t\t}" + NL + "\t\treturn true;" + NL + "\t}\t";
+ protected final String TEXT_11 = NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tpublic static class ";
+ protected final String TEXT_12 = " implements ";
+ protected final String TEXT_13 = " {";
+ protected final String TEXT_14 = 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_15 = ".class;" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_16 = 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_17 = NL + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic final ";
+ protected final String TEXT_18 = " semanticCtxIdMap = new ";
+ protected final String TEXT_19 = "();" + NL + "\t/**" + NL + "\t* @generated" + NL + "\t*/" + NL + "\tstatic {";
+ protected final String TEXT_20 = NL + "\t\tsemanticCtxIdMap.put(String.valueOf(";
+ protected final String TEXT_21 = "), ";
+ protected final String TEXT_22 = ".class); //$NON-NLS-1$";
+ protected final String TEXT_23 = NL + "\t}";
+ protected final String TEXT_24 = NL;
+ protected final String TEXT_25 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
+ protected final String TEXT_26 = " getNotationTraversalStrategy(IBatchValidator validator) {";
+ protected final String TEXT_27 = "\t" + NL + "\t\treturn new CtxSwitchStrategy(validator);";
+ protected final String TEXT_28 = "\t\t\t" + NL + "\t\treturn validator.getDefaultTraversalStrategy();";
+ protected final String TEXT_29 = NL + "\t}";
+ protected final String TEXT_30 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class CtxSwitchStrategy implements ";
+ protected final String TEXT_31 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_32 = " 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_33 = " traversalRoots," + NL + "\t\t\t\t";
+ protected final String TEXT_34 = " monitor) {" + NL + "\t\t\tdefaultStrategy.startTraversal(traversalRoots, monitor);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void prepareNextClientContext(EObject nextTarget) { " + NL + "\t\t\tif (nextTarget != null && currentTarget != null) {" + NL + "\t\t\t\tif (nextTarget instanceof View) {" + NL + "\t\t\t\t\tString id = ((View) nextTarget).getType();" + NL + "\t\t\t\t\tString nextSemanticId = id != null" + NL + "\t\t\t\t\t\t\t&& semanticCtxIdMap.containsKey(id) ? id : null;" + NL + "\t\t\t\t\tif ((currentSemanticCtxId != null && !currentSemanticCtxId" + NL + "\t\t\t\t\t\t\t.equals(nextSemanticId))" + NL + "\t\t\t\t\t\t\t|| (nextSemanticId != null && !nextSemanticId" + NL + "\t\t\t\t\t\t\t\t\t.equals(currentSemanticCtxId))) {" + NL + "\t\t\t\t\t\tthis.ctxChanged = true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcurrentSemanticCtxId = nextSemanticId;" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// context of domain model" + NL + "\t\t\t\t\tthis.ctxChanged = currentSemanticCtxId != null;" + NL + "\t\t\t\t\tcurrentSemanticCtxId = null;" + NL + "\t\t\t\t}" + NL + "\t\t\t} else {" + NL + "\t\t\t\tthis.ctxChanged = false;" + NL + "\t\t\t}" + NL + "\t\t}\t\t" + NL + "\t}// CtxSwitchStrategy";
+ protected final String TEXT_35 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class ";
+ protected final String TEXT_36 = " extends ";
+ protected final String TEXT_37 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_38 = " expression;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_39 = "() {" + NL + "\t\t\texpression = ";
+ protected final String TEXT_40 = "null";
+ protected final String TEXT_41 = ".";
+ protected final String TEXT_42 = "(";
+ protected final String TEXT_43 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_44 = ", ";
+ protected final String TEXT_45 = ")";
+ protected final String TEXT_46 = ".";
+ protected final String TEXT_47 = "(";
+ protected final String TEXT_48 = ", //$NON-NLS-1$" + NL + "\t";
+ protected final String TEXT_49 = ")";
+ protected final String TEXT_50 = "new ";
+ protected final String TEXT_51 = "(";
+ protected final String TEXT_52 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
+ protected final String TEXT_53 = " env) {\t" + NL + "\t\t";
+ protected final String TEXT_54 = " self = (";
+ protected final String TEXT_55 = ")context;";
+ protected final String TEXT_56 = "\t" + NL + "\t\t";
+ protected final String TEXT_57 = " ";
+ protected final String TEXT_58 = " = (";
+ protected final String TEXT_59 = ")env.get(\"";
+ protected final String TEXT_60 = "\"); //$NON-NLS-1$";
+ protected final String TEXT_61 = NL + "\t\treturn ";
+ protected final String TEXT_62 = ".";
+ protected final String TEXT_63 = "(self";
+ protected final String TEXT_64 = ", ";
+ protected final String TEXT_65 = ");" + NL + "\t}" + NL + "}";
+ protected final String TEXT_66 = NL + ";\t\t" + NL + "\t\t}\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic IStatus validate(";
+ protected final String TEXT_67 = " ctx) {" + NL + "\t\t\tObject evalCtx = ctx.getTarget();";
+ protected final String TEXT_68 = NL + "\t\t\tif(evalCtx instanceof EObject) evalCtx = ((EObject)evalCtx).eGet(";
+ protected final String TEXT_69 = "());" + NL + "\t\t\tif(evalCtx == null) {";
+ protected final String TEXT_70 = NL + "\t\t\t\treturn ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) });";
+ protected final String TEXT_71 = NL + "\t\t\t\treturn ";
+ protected final String TEXT_72 = ".OK_STATUS;";
+ protected final String TEXT_73 = NL + "\t\t\t}\t\t\t";
+ protected final String TEXT_74 = "\t\t\t" + NL + "\t\t\tevalCtx = ";
+ protected final String TEXT_75 = ".calculateMetric(";
+ protected final String TEXT_76 = ", evalCtx);";
+ protected final String TEXT_77 = "\t\t" + NL + "\t\t\tObject result = expression.evaluate(evalCtx);" + NL + "\t\t\tif(result instanceof Boolean && ((Boolean)result).booleanValue()) {" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_78 = ".OK_STATUS;" + NL + "\t\t\t}" + NL + "\t\t\treturn ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) }); " + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_79 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "static class ";
+ protected final String TEXT_80 = " {";
+ protected final String TEXT_81 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
+ protected final String TEXT_82 = " ";
+ protected final String TEXT_83 = "(";
+ protected final String TEXT_84 = " self";
+ protected final String TEXT_85 = ", ";
+ protected final String TEXT_86 = " ";
+ protected final String TEXT_87 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new ";
+ protected final String TEXT_88 = ".NoImplException(\"No user java implementation provided in '";
+ protected final String TEXT_89 = "' operation\"); //$NON-NLS-1$" + NL + "}";
+ protected final String TEXT_90 = NL + "} //";
+ protected final String TEXT_91 = NL + "} //";
+ protected final String TEXT_92 = NL;
public String generate(Object argument)
{
@@ -136,17 +134,16 @@ final boolean hasNotationModelAudit;
}
final boolean rcp = genDiagram.getEditorGen().getApplication() != null;
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
final java.util.HashSet<String> innerClasses = new java.util.HashSet<String>();
final String __javaOperationContainer = "JavaAudits";
@@ -210,19 +207,19 @@ importManager.addImport("org.eclipse.ui.IWorkbenchPart");
importManager.addImport("org.eclipse.ui.IEditorPart");
importManager.addImport("org.eclipse.ui.PlatformUI");
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getValidationProviderClassName());
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(genDiagram.getEditorGen().getEditor().getPackageName());
stringBuffer.append(TEXT_6);
stringBuffer.append(genDiagram.getEditorGen().getEditor().getPackageName());
stringBuffer.append(TEXT_7);
- stringBuffer.append(genDiagram.getEditorGen().getEditor().getPackageName());
- stringBuffer.append(TEXT_8);
stringBuffer.append(pluginActivatorClass);
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
boolean usesNotationContextSwitch = false;
java.util.List allAudits = (audits != null) ? audits.getRules() : java.util.Collections.EMPTY_LIST;
@@ -238,11 +235,11 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) {
for (GenAuditRule audit : contextId2Audit.values()) {
String selectorClassName = audit.getContextSelectorLocalClassName();
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(selectorClassName);
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.model.IClientSelector"));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
if(audit.getTarget() instanceof GenDiagramElementTarget) {
usesNotationContextSwitch = true;
@@ -252,59 +249,59 @@ for (GenAuditRule audit : contextId2Audit.values()) {
view2SelectorMap.put(nextElement, selectorClassName);
}
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
stringBuffer.append(selectorClassName);
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
} else {
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
}
} // end of audits iteration
if(usesNotationContextSwitch) {
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
for(java.util.Iterator it = view2SelectorMap.keySet().iterator(); it.hasNext();) {
GenCommonBase nextView = (GenCommonBase)it.next();
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
stringBuffer.append(importManager.getImportedName(nextView.getEditPartQualifiedClassName()) + ".VISUAL_ID");
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(view2SelectorMap.get(nextView));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
} // end of view ID iteration
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
} // end of context map generation //usesNotationContextSwitch
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
if(hasNotationModelAudit) {
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy"));
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
if(usesNotationContextSwitch) {
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
} else {
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
} // end of usesNotationContextSwitch
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
} // end of hasNotationModelAudit
if(usesNotationContextSwitch) {
+ stringBuffer.append(TEXT_30);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy"));
stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy"));
stringBuffer.append(TEXT_32);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.service.ITraversalStrategy"));
- stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor"));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
} // end of usesNotationContextSwitch
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
@@ -317,15 +314,15 @@ for(java.util.Iterator it = allAudits.iterator(); it.hasNext();) {
ValueExpression __genValueExpression = nextAudit.getRule();
String importedExpressionBase = (expressionProviders != null) ? importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()) : "null"; //$NON-NLS-1$
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(nextAudit.getConstraintAdapterLocalClassName());
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.AbstractModelConstraint"));
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importedExpressionBase);
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(nextAudit.getConstraintAdapterLocalClassName());
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
{ /*begin the scope*/
/*
@@ -341,7 +338,7 @@ String __javaOperationContainer;
if(__genExprProvider == null || __importedAbstractClass == null) {
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
@@ -350,26 +347,26 @@ String __javaOperationContainer;
if(!__exprEnvVariables.isEmpty()) {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(__outEnvVarName);
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
} else {
stringBuffer.append(providerImportedClass);
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_46);
stringBuffer.append(__expressionAccessor);
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(__genValueExpression.getBodyString());
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
}
} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
@@ -377,85 +374,85 @@ String __javaOperationContainer;
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(__importedAbstractClass);
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
stringBuffer.append(__ctxEClassifierAccess);
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_53);
+ stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_54);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
stringBuffer.append(TEXT_55);
- stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_56);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String nextVariableName = (String)envVarIt.next();
org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(nextVariableName);
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
}
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) {
stringBuffer.append(__javaOperationContainer);
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
}
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_63);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_64);
stringBuffer.append((String)envVarIt.next());
}
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_65);
}
} /*end of scope*/
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.validation.IValidationContext"));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
if(nextAudit.getTarget() instanceof GenDomainAttributeTarget) {
GenDomainAttributeTarget attrTarget = (GenDomainAttributeTarget) nextAudit.getTarget();
if(attrTarget.getAttribute() != null) {
String fGetter = (attrTarget.getAttribute() != null) ? importManager.getImportedName(attrTarget.getAttribute().getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + attrTarget.getAttribute().getFeatureAccessorName() : ""; //$NON-NLS-1$ //$NON-NLS-2$
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(fGetter);
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
if(attrTarget.isNullAsError()) {
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_70);
} else {
- stringBuffer.append(TEXT_72);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status"));
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_72);
}
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_73);
}
} else if(nextAudit.getTarget() instanceof GenAuditedMetricTarget) {
GenAuditedMetricTarget metricTarget = (GenAuditedMetricTarget)nextAudit.getTarget();
String metricKey = (metricTarget.getMetric() != null) ? metricTarget.getMetric().getKey() : "";
String metricProviderClassName = importManager.getImportedName(genDiagram.getMetricProviderQualifiedClassName());
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_74);
stringBuffer.append(metricProviderClassName);
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_75);
stringBuffer.append(Conversions.toStringLiteral(metricKey));
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_76);
}
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status"));
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_78);
}
} /*end of Adapters iteration*/
@@ -473,16 +470,15 @@ if (audits != null && audits.getEditorGen().getExpressionProviders() != null) {
if(!javaExpressions.isEmpty()) {
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_79);
stringBuffer.append(__javaOperationContainer);
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_80);
for (GenAuditRule nextJavaRule : javaExpressions) {
GenClassifier __genExprContext = nextJavaRule.getTarget().getContext();
ValueExpression __genValueExpression = nextJavaRule.getRule();
String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$
- stringBuffer.append(TEXT_82);
/*
ValueExpression __genValueExpression
@@ -503,13 +499,13 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_81);
stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_82);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_84);
for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
String __nextVarName = (String)envVarIt.next();
@@ -517,32 +513,32 @@ if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpression
String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(__nextVarName);
}
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(__importedAbstractExpr);
- stringBuffer.append(TEXT_90);
+ stringBuffer.append(TEXT_88);
stringBuffer.append(__exprJavaOperName);
- stringBuffer.append(TEXT_91);
+ stringBuffer.append(TEXT_89);
} /* end of GenJavaExpressionProvider */
}
- stringBuffer.append(TEXT_92);
+ stringBuffer.append(TEXT_90);
stringBuffer.append(__javaOperationContainer);
} /* end of Java expression methods */
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(genDiagram.getValidationProviderClassName());
importManager.emitSortedImports();
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_92);
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 56e5717f8..2daede65b 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
@@ -17,103 +17,102 @@ public class ViewFactoryGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL;
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends ";
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends ";
+ protected final String TEXT_6 = NL + "\t";
protected final String TEXT_7 = NL + "\t";
- protected final String TEXT_8 = NL + "\t";
- protected final String TEXT_9 = NL + " ";
- protected final String TEXT_10 = NL + "\t";
- protected final String TEXT_11 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\t";
- protected final String TEXT_12 = " styles = new ";
- protected final String TEXT_13 = "();";
- protected final String TEXT_14 = NL + "\t\tstyles.add(";
- protected final String TEXT_15 = ".eINSTANCE.createConnectorStyle());";
- protected final String TEXT_16 = NL + "\t\tstyles.add(";
- protected final String TEXT_17 = ".eINSTANCE.createRoutingStyle());";
- protected final String TEXT_18 = NL + "\t\tstyles.add(";
- protected final String TEXT_19 = ".eINSTANCE.createFontStyle());";
- protected final String TEXT_20 = NL + "\t\tstyles.add(";
- protected final String TEXT_21 = ".eINSTANCE.createDrawerStyle());";
- protected final String TEXT_22 = NL + "\t\tstyles.add(";
- protected final String TEXT_23 = ".eINSTANCE.createTitleStyle());";
- protected final String TEXT_24 = "\t" + NL + "\t\tstyles.add(";
- protected final String TEXT_25 = ".eINSTANCE.createSortingStyle());" + NL + "\t\tstyles.add(";
- protected final String TEXT_26 = ".eINSTANCE.createFilteringStyle());";
- protected final String TEXT_27 = NL + "\t\tstyles.add(";
- protected final String TEXT_28 = ".eINSTANCE.createShapeStyle());";
- protected final String TEXT_29 = NL + "\t\tstyles.add(";
- protected final String TEXT_30 = ".eINSTANCE.createDescriptionStyle());" + NL + "\t\tstyles.add(";
- protected final String TEXT_31 = ".eINSTANCE.createFillStyle());" + NL + "\t\tstyles.add(";
- protected final String TEXT_32 = ".eINSTANCE.createLineStyle());";
- protected final String TEXT_33 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + 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_34 = NL + "\t\t\tsemanticHint = ";
- protected final String TEXT_35 = ".getType(";
- protected final String TEXT_36 = ".VISUAL_ID);" + NL + "\t\t\tview.setType(semanticHint);" + NL + "\t\t}";
- protected final String TEXT_37 = NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);";
- protected final String TEXT_38 = NL + "\t\tsetupCompartmentTitle(view);" + NL + "\t\tsetupCompartmentCollapsed(view);";
- protected final String TEXT_39 = "\t\t" + NL + "\t\tif (!";
- protected final String TEXT_40 = ".MODEL_ID.equals(";
- protected final String TEXT_41 = ".getModelID(containerView))) {";
- protected final String TEXT_42 = NL;
- protected final String TEXT_43 = "\t\t\t";
- protected final String TEXT_44 = " shortcutAnnotation = ";
- protected final String TEXT_45 = ".eINSTANCE.createEAnnotation();" + NL + "\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", ";
- protected final String TEXT_46 = ".MODEL_ID); //$NON-NLS-1$" + NL + "\t\t\tview.getEAnnotations().add(shortcutAnnotation);" + NL + "\t\t}";
- protected final String TEXT_47 = NL + "\t\t";
- protected final String TEXT_48 = ".setStructuralFeatureValue(view, ";
- protected final String TEXT_49 = ".eINSTANCE.getLineStyle_LineColor()," + NL + "\t\t\t";
- protected final String TEXT_50 = ".colorToInteger(";
- protected final String TEXT_51 = ".";
- protected final String TEXT_52 = "));";
- protected final String TEXT_53 = NL + "\t\t";
- protected final String TEXT_54 = " diagramFacet = ";
- protected final String TEXT_55 = ".eINSTANCE.createHintedDiagramLinkStyle();";
- protected final String TEXT_56 = NL + "\t\tdiagramFacet.setHint(\"";
- protected final String TEXT_57 = "\"); // $NON-NLS-1$";
- protected final String TEXT_58 = NL + "\t\tview.getStyles().add(diagramFacet);";
- protected final String TEXT_59 = NL + "\t\t";
- protected final String TEXT_60 = ".setStructuralFeatureValue(view, ";
- protected final String TEXT_61 = ".eINSTANCE.getFillStyle_FillColor()," + NL + "\t\t\t";
- protected final String TEXT_62 = ".colorToInteger(";
- protected final String TEXT_63 = ".";
- protected final String TEXT_64 = "));";
- protected final String TEXT_65 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
- protected final String TEXT_66 = ".getType(";
- protected final String TEXT_67 = ".VISUAL_ID)," + NL + "\t\t\t";
- protected final String TEXT_68 = ".APPEND, true, getPreferencesHint());";
- protected final String TEXT_69 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
- protected final String TEXT_70 = ".getType(";
- protected final String TEXT_71 = ".VISUAL_ID)," + NL + "\t\t\t";
- protected final String TEXT_72 = ".APPEND, true, getPreferencesHint());";
- protected final String TEXT_73 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
- protected final String TEXT_74 = ".getType(";
- protected final String TEXT_75 = ".VISUAL_ID)," + NL + "\t\t\t";
- protected final String TEXT_76 = ".APPEND, true, getPreferencesHint());";
- protected final String TEXT_77 = NL + "\t}";
- protected final String TEXT_78 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_79 = " createLayoutConstraint() {" + NL + "\t\treturn ";
- protected final String TEXT_80 = ".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_81 = " store = (";
- protected final String TEXT_82 = ") getPreferencesHint().getPreferenceStore();" + NL + "" + NL + "\t\t// fill color" + NL + "\t\t";
- protected final String TEXT_83 = " fillRGB = ";
- protected final String TEXT_84 = ".getColor(store, ";
- protected final String TEXT_85 = ".PREF_FILL_COLOR);" + NL + "\t\t";
- protected final String TEXT_86 = ".setStructuralFeatureValue(view, ";
- protected final String TEXT_87 = ".eINSTANCE.getFillStyle_FillColor(), ";
- protected final String TEXT_88 = ".RGBToInteger(fillRGB));" + NL + "\t}";
- protected final String TEXT_89 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setupCompartmentTitle(View view) {" + NL + "\t\t";
- protected final String TEXT_90 = " titleStyle = (";
- protected final String TEXT_91 = ")view.getStyle(";
- protected final String TEXT_92 = ".eINSTANCE.getTitleStyle());" + NL + "\t\tif (titleStyle != null){" + NL + "\t\t\ttitleStyle.setShowTitle(true);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setupCompartmentCollapsed(View view) {" + NL + "\t\t";
- protected final String TEXT_93 = " drawerStyle = (";
- protected final String TEXT_94 = ")view.getStyle(";
- protected final String TEXT_95 = ".eINSTANCE.getDrawerStyle());" + NL + "\t\tif (drawerStyle != null){" + NL + "\t\t\tdrawerStyle.setCollapsed(false);" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_96 = NL + "}";
- protected final String TEXT_97 = NL;
+ protected final String TEXT_8 = NL + " ";
+ protected final String TEXT_9 = NL + "\t";
+ protected final String TEXT_10 = NL + "{" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprotected List createStyles(View view) {" + NL + "\t\t";
+ protected final String TEXT_11 = " styles = new ";
+ protected final String TEXT_12 = "();";
+ protected final String TEXT_13 = NL + "\t\tstyles.add(";
+ protected final String TEXT_14 = ".eINSTANCE.createConnectorStyle());";
+ protected final String TEXT_15 = NL + "\t\tstyles.add(";
+ protected final String TEXT_16 = ".eINSTANCE.createRoutingStyle());";
+ protected final String TEXT_17 = NL + "\t\tstyles.add(";
+ protected final String TEXT_18 = ".eINSTANCE.createFontStyle());";
+ protected final String TEXT_19 = NL + "\t\tstyles.add(";
+ protected final String TEXT_20 = ".eINSTANCE.createDrawerStyle());";
+ protected final String TEXT_21 = NL + "\t\tstyles.add(";
+ protected final String TEXT_22 = ".eINSTANCE.createTitleStyle());";
+ protected final String TEXT_23 = "\t" + NL + "\t\tstyles.add(";
+ protected final String TEXT_24 = ".eINSTANCE.createSortingStyle());" + NL + "\t\tstyles.add(";
+ protected final String TEXT_25 = ".eINSTANCE.createFilteringStyle());";
+ protected final String TEXT_26 = NL + "\t\tstyles.add(";
+ protected final String TEXT_27 = ".eINSTANCE.createShapeStyle());";
+ protected final String TEXT_28 = NL + "\t\tstyles.add(";
+ protected final String TEXT_29 = ".eINSTANCE.createDescriptionStyle());" + NL + "\t\tstyles.add(";
+ protected final String TEXT_30 = ".eINSTANCE.createFillStyle());" + NL + "\t\tstyles.add(";
+ protected final String TEXT_31 = ".eINSTANCE.createLineStyle());";
+ protected final String TEXT_32 = NL + "\t\treturn styles;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + 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_33 = NL + "\t\t\tsemanticHint = ";
+ protected final String TEXT_34 = ".getType(";
+ protected final String TEXT_35 = ".VISUAL_ID);" + NL + "\t\t\tview.setType(semanticHint);" + NL + "\t\t}";
+ protected final String TEXT_36 = NL + "\t\tsuper.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);";
+ protected final String TEXT_37 = NL + "\t\tsetupCompartmentTitle(view);" + NL + "\t\tsetupCompartmentCollapsed(view);";
+ protected final String TEXT_38 = "\t\t" + NL + "\t\tif (!";
+ protected final String TEXT_39 = ".MODEL_ID.equals(";
+ protected final String TEXT_40 = ".getModelID(containerView))) {";
+ protected final String TEXT_41 = NL;
+ protected final String TEXT_42 = "\t\t\t";
+ protected final String TEXT_43 = " shortcutAnnotation = ";
+ protected final String TEXT_44 = ".eINSTANCE.createEAnnotation();" + NL + "\t\t\tshortcutAnnotation.setSource(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\t\tshortcutAnnotation.getDetails().put(\"modelID\", ";
+ protected final String TEXT_45 = ".MODEL_ID); //$NON-NLS-1$" + NL + "\t\t\tview.getEAnnotations().add(shortcutAnnotation);" + NL + "\t\t}";
+ protected final String TEXT_46 = NL + "\t\t";
+ protected final String TEXT_47 = ".setStructuralFeatureValue(view, ";
+ protected final String TEXT_48 = ".eINSTANCE.getLineStyle_LineColor()," + NL + "\t\t\t";
+ protected final String TEXT_49 = ".colorToInteger(";
+ protected final String TEXT_50 = ".";
+ protected final String TEXT_51 = "));";
+ protected final String TEXT_52 = NL + "\t\t";
+ protected final String TEXT_53 = " diagramFacet = ";
+ protected final String TEXT_54 = ".eINSTANCE.createHintedDiagramLinkStyle();";
+ protected final String TEXT_55 = NL + "\t\tdiagramFacet.setHint(\"";
+ protected final String TEXT_56 = "\"); // $NON-NLS-1$";
+ protected final String TEXT_57 = NL + "\t\tview.getStyles().add(diagramFacet);";
+ protected final String TEXT_58 = NL + "\t\t";
+ protected final String TEXT_59 = ".setStructuralFeatureValue(view, ";
+ protected final String TEXT_60 = ".eINSTANCE.getFillStyle_FillColor()," + NL + "\t\t\t";
+ protected final String TEXT_61 = ".colorToInteger(";
+ protected final String TEXT_62 = ".";
+ protected final String TEXT_63 = "));";
+ protected final String TEXT_64 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
+ protected final String TEXT_65 = ".getType(";
+ protected final String TEXT_66 = ".VISUAL_ID)," + NL + "\t\t\t";
+ protected final String TEXT_67 = ".APPEND, true, getPreferencesHint());";
+ protected final String TEXT_68 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
+ protected final String TEXT_69 = ".getType(";
+ protected final String TEXT_70 = ".VISUAL_ID)," + NL + "\t\t\t";
+ protected final String TEXT_71 = ".APPEND, true, getPreferencesHint());";
+ protected final String TEXT_72 = NL + "\t\tgetViewService().createNode(semanticAdapter, view, ";
+ protected final String TEXT_73 = ".getType(";
+ protected final String TEXT_74 = ".VISUAL_ID)," + NL + "\t\t\t";
+ protected final String TEXT_75 = ".APPEND, true, getPreferencesHint());";
+ protected final String TEXT_76 = NL + "\t}";
+ protected final String TEXT_77 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_78 = " createLayoutConstraint() {" + NL + "\t\treturn ";
+ protected final String TEXT_79 = ".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_80 = " store = (";
+ protected final String TEXT_81 = ") getPreferencesHint().getPreferenceStore();" + NL + "" + NL + "\t\t// fill color" + NL + "\t\t";
+ protected final String TEXT_82 = " fillRGB = ";
+ protected final String TEXT_83 = ".getColor(store, ";
+ protected final String TEXT_84 = ".PREF_FILL_COLOR);" + NL + "\t\t";
+ protected final String TEXT_85 = ".setStructuralFeatureValue(view, ";
+ protected final String TEXT_86 = ".eINSTANCE.getFillStyle_FillColor(), ";
+ protected final String TEXT_87 = ".RGBToInteger(fillRGB));" + NL + "\t}";
+ protected final String TEXT_88 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setupCompartmentTitle(View view) {" + NL + "\t\t";
+ protected final String TEXT_89 = " titleStyle = (";
+ protected final String TEXT_90 = ")view.getStyle(";
+ protected final String TEXT_91 = ".eINSTANCE.getTitleStyle());" + NL + "\t\tif (titleStyle != null){" + NL + "\t\t\ttitleStyle.setShowTitle(true);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setupCompartmentCollapsed(View view) {" + NL + "\t\t";
+ protected final String TEXT_92 = " drawerStyle = (";
+ protected final String TEXT_93 = ")view.getStyle(";
+ protected final String TEXT_94 = ".eINSTANCE.getDrawerStyle());" + NL + "\t\tif (drawerStyle != null){" + NL + "\t\t\tdrawerStyle.setCollapsed(false);" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_95 = NL + "}";
+ protected final String TEXT_96 = NL;
public String generate(Object argument)
{
@@ -123,17 +122,16 @@ final GenCommonBase genElement = (GenCommonBase) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
GenDiagram genDiagram = genElement.getDiagram();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.addImport("org.eclipse.core.runtime.IAdaptable");
importManager.addImport("org.eclipse.gmf.runtime.notation.View");
@@ -159,43 +157,43 @@ StyleAttributes styleAttributes = (viewmap == null) ? null : (StyleAttributes)vi
boolean fixedForeground = styleAttributes != null && styleAttributes.isFixedForeground();
boolean fixedFont = styleAttributes != null && styleAttributes.isFixedFont();
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genElement.getNotationViewFactoryClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
if (isLink) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory"));
} else if (isLabel) {
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory"));
} else if (isCompartment) {
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory"));
} else if (isShape) {
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory"));
} else {
throw new IllegalStateException("Unknown case for " + genElement);
}
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
stringBuffer.append(importManager.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName("java.util.ArrayList"));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
if (isLink) {
if (!fixedForeground) {
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
} else { /*only routing, no line style*/
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
}
if (!fixedFont) {
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
}
} /*isLink*/
@@ -207,134 +205,134 @@ if (isCompartment) {
GenCompartment genCompartment = (GenCompartment)genElement;
if (genCompartment.isCanCollapse()) {
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
}
if (genCompartment.isNeedsTitle()) {
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
}
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_25);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_26);
}
if (isShape || isCompartmentWithOwnBounds) {
if (!fixedFont) {
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
} else { /*all but font style*/
+ stringBuffer.append(TEXT_28);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_31);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_32);
}
} /*isShape || isCompartmentWithOwnBounds*/
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
/* [++] important for the create shortcut functionality*/
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(genElement.getEditPartQualifiedClassName());
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
/* [--] important for the create shortcut functionality*/
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
if (isCompartment){
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_37);
}
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_40);
stringBuffer.append(TEXT_41);
stringBuffer.append(TEXT_42);
- stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EcoreFactory"));
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
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_47);
+ stringBuffer.append(TEXT_46);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_47);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_48);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities"));
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_49);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants"));
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(colorAttrs.getForegroundColor());
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_51);
}
if (isNode) {
GenNode genNode = (GenNode) genElement;
if (genNode.getBehaviour(OpenDiagramBehaviour.class).size() == 1) /*XXX perhaps, add size() linkStyles with different hints and process them with single policy?*/ {
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle"));
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_54);
if (genNode.getBehaviour(OpenDiagramBehaviour.class).get(0).getDiagramKind() != null) {
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(genNode.getBehaviour(OpenDiagramBehaviour.class).get(0).getDiagramKind());
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_56);
}
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_57);
}
if (colorAttrs != null && colorAttrs.getBackgroundColor() != null && colorAttrs.getBackgroundColor().trim().length() > 0) {
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities"));
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants"));
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
stringBuffer.append(colorAttrs.getBackgroundColor());
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_63);
}
List labels = genNode.getLabels();
for (int j = 0; j < labels.size(); j++) {
GenNodeLabel label = (GenNodeLabel) labels.get(j);
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_65);
stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
}
List genChildContainers = genNode.getCompartments();
for (int j = 0; j < genChildContainers.size(); j++) {
GenCompartment genChildContainer = (GenCompartment) genChildContainers.get(j);
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
stringBuffer.append(importManager.getImportedName(genChildContainer.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_70);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_72);
+ stringBuffer.append(TEXT_71);
}
} else if (isLink) {
@@ -343,63 +341,63 @@ if (isNode) {
for (int j = 0; j < labels.size(); j++) {
GenLinkLabel label = (GenLinkLabel) labels.get(j);
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_72);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_73);
stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_74);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_75);
}
}
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_76);
if (isCompartmentWithOwnBounds) {
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LayoutConstraint"));
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
+ stringBuffer.append(TEXT_79);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.IPreferenceStore"));
stringBuffer.append(TEXT_80);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.IPreferenceStore"));
stringBuffer.append(TEXT_81);
- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.IPreferenceStore"));
- stringBuffer.append(TEXT_82);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.RGB"));
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_82);
stringBuffer.append(importManager.getImportedName("org.eclipse.jface.preference.PreferenceConverter"));
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants"));
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_84);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil"));
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities"));
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_87);
}
if (isCompartment) {
String titleStyleFQN = importManager.getImportedName("org.eclipse.gmf.runtime.notation.TitleStyle");
String drawerStyleFQN = importManager.getImportedName("org.eclipse.gmf.runtime.notation.DrawerStyle");
String notationPackageFQN = importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage");
+ stringBuffer.append(TEXT_88);
+ stringBuffer.append(titleStyleFQN);
stringBuffer.append(TEXT_89);
stringBuffer.append(titleStyleFQN);
stringBuffer.append(TEXT_90);
- stringBuffer.append(titleStyleFQN);
- stringBuffer.append(TEXT_91);
stringBuffer.append(notationPackageFQN);
+ stringBuffer.append(TEXT_91);
+ stringBuffer.append(drawerStyleFQN);
stringBuffer.append(TEXT_92);
stringBuffer.append(drawerStyleFQN);
stringBuffer.append(TEXT_93);
- stringBuffer.append(drawerStyleFQN);
- stringBuffer.append(TEXT_94);
stringBuffer.append(notationPackageFQN);
- stringBuffer.append(TEXT_95);
+ stringBuffer.append(TEXT_94);
}
- stringBuffer.append(TEXT_96);
+ stringBuffer.append(TEXT_95);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_97);
+ stringBuffer.append(TEXT_96);
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 e2dd50d84..dd2de1c39 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
@@ -16,43 +16,42 @@ public class ViewProviderGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "/*" + NL + " * ";
- protected final String TEXT_3 = NL + " */";
- protected final String TEXT_4 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EClass;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.IElementType;";
- protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_6 = " extends AbstractViewProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {";
- protected final String TEXT_7 = NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);";
- protected final String TEXT_8 = NL + "\t\tif (";
- protected final String TEXT_9 = ".MODEL_ID.equals(diagramKind)";
- protected final String TEXT_10 = NL + "\t\t\t\t&& ";
- protected final String TEXT_11 = ".getDiagramVisualID(semanticElement) != -1";
- protected final String TEXT_12 = NL + "\t\t\t\t) {" + NL + "\t\t\treturn ";
- protected final String TEXT_13 = ".class;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tif (containerView == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tIElementType elementType = getSemanticElementType(semanticAdapter);" + NL + "\t\tif (elementType != null && !";
- protected final String TEXT_14 = ".isKnownElementType(elementType)) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint nodeVID = ";
- protected final String TEXT_15 = ".getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);" + NL + "\t\tswitch (nodeVID) {";
- protected final String TEXT_16 = NL + "\t\tcase ";
- protected final String TEXT_17 = ".VISUAL_ID:" + NL + "\t\t\t return ";
- protected final String TEXT_18 = ".class;";
- protected final String TEXT_19 = NL + "\t\tcase ";
- protected final String TEXT_20 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
- protected final String TEXT_21 = ".class;";
- protected final String TEXT_22 = NL + "\t\tcase ";
- protected final String TEXT_23 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
- protected final String TEXT_24 = ".class;";
- protected final String TEXT_25 = NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tIElementType elementType = getSemanticElementType(semanticAdapter);" + NL + "\t\tif (elementType != null && !";
- protected final String TEXT_26 = ".isKnownElementType(elementType)) {" + NL + "\t\t\treturn null;" + NL + "\t\t}";
- protected final String TEXT_27 = NL + "\t\tif (";
- protected final String TEXT_28 = ".";
- protected final String TEXT_29 = ".equals(elementType)) {" + NL + "\t\t\treturn ";
- protected final String TEXT_30 = ".class;" + NL + "\t\t}";
- protected final String TEXT_31 = NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tif (semanticType == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint linkVID = ";
- protected final String TEXT_32 = ".getLinkWithClassVisualID(semanticElement, semanticType);" + NL + "\t\tswitch (linkVID) {";
- protected final String TEXT_33 = NL + "\t\tcase ";
- protected final String TEXT_34 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
- protected final String TEXT_35 = ".class;";
- protected final String TEXT_36 = NL + "\t\t}" + NL + "\t\treturn getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IElementType getSemanticElementType(IAdaptable semanticAdapter) {" + NL + "\t\tif (semanticAdapter == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn (IElementType) semanticAdapter.getAdapter(IElementType.class);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t \t// Handle unrecognized child node classes here" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "}";
- protected final String TEXT_37 = NL;
+ protected final String TEXT_1 = "/*" + NL + " * ";
+ protected final String TEXT_2 = NL + " */";
+ protected final String TEXT_3 = NL + NL + "import org.eclipse.core.runtime.IAdaptable;" + NL + "import org.eclipse.emf.ecore.EClass;" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;" + NL + "import org.eclipse.gmf.runtime.notation.View;" + NL + "import org.eclipse.gmf.runtime.emf.type.core.IElementType;";
+ protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
+ protected final String TEXT_5 = " extends AbstractViewProvider {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {";
+ protected final String TEXT_6 = NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);";
+ protected final String TEXT_7 = NL + "\t\tif (";
+ protected final String TEXT_8 = ".MODEL_ID.equals(diagramKind)";
+ protected final String TEXT_9 = NL + "\t\t\t\t&& ";
+ protected final String TEXT_10 = ".getDiagramVisualID(semanticElement) != -1";
+ protected final String TEXT_11 = NL + "\t\t\t\t) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_12 = ".class;" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tif (containerView == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tIElementType elementType = getSemanticElementType(semanticAdapter);" + NL + "\t\tif (elementType != null && !";
+ protected final String TEXT_13 = ".isKnownElementType(elementType)) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint nodeVID = ";
+ protected final String TEXT_14 = ".getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);" + NL + "\t\tswitch (nodeVID) {";
+ protected final String TEXT_15 = NL + "\t\tcase ";
+ protected final String TEXT_16 = ".VISUAL_ID:" + NL + "\t\t\t return ";
+ protected final String TEXT_17 = ".class;";
+ protected final String TEXT_18 = NL + "\t\tcase ";
+ protected final String TEXT_19 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
+ protected final String TEXT_20 = ".class;";
+ protected final String TEXT_21 = NL + "\t\tcase ";
+ protected final String TEXT_22 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
+ protected final String TEXT_23 = ".class;";
+ protected final String TEXT_24 = NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t\tIElementType elementType = getSemanticElementType(semanticAdapter);" + NL + "\t\tif (elementType != null && !";
+ protected final String TEXT_25 = ".isKnownElementType(elementType)) {" + NL + "\t\t\treturn null;" + NL + "\t\t}";
+ protected final String TEXT_26 = NL + "\t\tif (";
+ protected final String TEXT_27 = ".";
+ protected final String TEXT_28 = ".equals(elementType)) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_29 = ".class;" + NL + "\t\t}";
+ protected final String TEXT_30 = NL + "\t\tEClass semanticType = getSemanticEClass(semanticAdapter);" + NL + "\t\tif (semanticType == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\tEObject semanticElement = getSemanticElement(semanticAdapter);" + NL + "\t\tint linkVID = ";
+ protected final String TEXT_31 = ".getLinkWithClassVisualID(semanticElement, semanticType);" + NL + "\t\tswitch (linkVID) {";
+ protected final String TEXT_32 = NL + "\t\tcase ";
+ protected final String TEXT_33 = ".VISUAL_ID:" + NL + "\t\t\treturn ";
+ protected final String TEXT_34 = ".class;";
+ protected final String TEXT_35 = NL + "\t\t}" + NL + "\t\treturn getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IElementType getSemanticElementType(IAdaptable semanticAdapter) {" + NL + "\t\tif (semanticAdapter == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn (IElementType) semanticAdapter.getAdapter(IElementType.class);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {" + NL + "\t \t// Handle unrecognized child node classes here" + NL + "\t\treturn null;" + NL + "\t}" + NL + "\t" + NL + "}";
+ protected final String TEXT_36 = NL;
public String generate(Object argument)
{
@@ -62,59 +61,58 @@ final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
List genLinks = genDiagram.getLinks();
- stringBuffer.append(TEXT_1);
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
if (copyrightText != null && copyrightText.trim().length() > 0) {
- stringBuffer.append(TEXT_2);
+ stringBuffer.append(TEXT_1);
stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
- stringBuffer.append(TEXT_3);
+ stringBuffer.append(TEXT_2);
}
importManager.emitPackageStatement(stringBuffer);
- stringBuffer.append(TEXT_4);
+ stringBuffer.append(TEXT_3);
importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(genDiagram.getNotationViewProviderClassName());
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_5);
if (genDiagram.getDomainDiagramElement() != null) {
- stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_6);
}
- stringBuffer.append(TEXT_8);
+ stringBuffer.append(TEXT_7);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_9);
+ stringBuffer.append(TEXT_8);
if (genDiagram.getDomainDiagramElement() != null) {
- stringBuffer.append(TEXT_10);
+ stringBuffer.append(TEXT_9);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_10);
}
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_13);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_15);
+ stringBuffer.append(TEXT_14);
for (Iterator containers = genDiagram.getAllChildContainers().iterator(); containers.hasNext();) {
GenContainerBase container = (GenContainerBase) containers.next();
- stringBuffer.append(TEXT_16);
+ stringBuffer.append(TEXT_15);
stringBuffer.append(importManager.getImportedName(container.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_17);
+ stringBuffer.append(TEXT_16);
stringBuffer.append(importManager.getImportedName(container.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_17);
if (container instanceof GenNode) {
GenNode node = (GenNode) container;
for (Iterator labels = node.getLabels().iterator(); labels.hasNext();) {
GenNodeLabel label = (GenNodeLabel) labels.next();
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_18);
stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_19);
stringBuffer.append(importManager.getImportedName(label.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_20);
}
}
@@ -124,54 +122,54 @@ for (Iterator links = genLinks.iterator(); links.hasNext();) {
for (Iterator linkLabels = link.getLabels().iterator(); linkLabels.hasNext();) {
GenLinkLabel linkLabel = (GenLinkLabel) linkLabels.next();
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_21);
stringBuffer.append(importManager.getImportedName(linkLabel.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName(linkLabel.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_23);
}
}
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_25);
for (int i = 0; i < genLinks.size(); i++) {
GenLink genLink = (GenLink) genLinks.get(i);
if (genLink.getModelFacet() instanceof FeatureLinkModelFacet || genLink.getModelFacet() == null) {
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_27);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_29);
}
}
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_31);
for (int i = 0; i < genLinks.size(); i++) {
GenLink genLink = (GenLink) genLinks.get(i);
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName(genLink.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_34);
}
}
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_35);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_36);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/MigrationDelegate.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/MigrationDelegate.java
index 9078622b6..45c904ec5 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/MigrationDelegate.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/internal/codegen/util/MigrationDelegate.java
@@ -16,19 +16,23 @@ import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EAttributeImpl;
import org.eclipse.emf.ecore.impl.EReferenceImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory;
import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
import org.eclipse.gmf.codegen.gmfgen.GenAuditContainer;
import org.eclipse.gmf.codegen.gmfgen.GenAuditRoot;
import org.eclipse.gmf.codegen.gmfgen.GenAuditRule;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
import org.eclipse.gmf.internal.common.migrate.MigrationHelperDelegateImpl;
class MigrationDelegate extends MigrationHelperDelegateImpl {
- private EReference ourGenEditorGenerator_Audits;
private EReference ourGenAuditContainer_ChildContainers;
private EReference ourGenAuditContainer_Audits;
+ private EAttributeImpl myGenAuditRoot_Id;
+ private EAttributeImpl myGenAuditRoot_Name;
+ private EAttributeImpl myGenAuditRoot_Description;
+ private GenAuditContainer myRootContainer;
MigrationDelegate() {
}
@@ -60,12 +64,6 @@ class MigrationDelegate extends MigrationHelperDelegateImpl {
renamings.put("metaFeature", GMFGenPackage.eINSTANCE.getFeatureLabelModelFacet_MetaFeatures()); //$NON-NLS-1$
registerRenamedAttributes(GMFGenPackage.eINSTANCE.getFeatureLabelModelFacet(), renamings);
}
- ourGenEditorGenerator_Audits = new EReferenceImpl() {};
- ourGenEditorGenerator_Audits.setName("audits"); //$NON-NLS-1$
- ourGenEditorGenerator_Audits.setEType(GMFGenPackage.eINSTANCE.getGenAuditContainer());
- ourGenEditorGenerator_Audits.setContainment(true);
- ourGenEditorGenerator_Audits.setLowerBound(0);
- ourGenEditorGenerator_Audits.setUpperBound(1);
ourGenAuditContainer_ChildContainers = new EReferenceImpl() {};
ourGenAuditContainer_ChildContainers.setName("childContainers"); //$NON-NLS-1$
ourGenAuditContainer_ChildContainers.setEType(GMFGenPackage.eINSTANCE.getGenAuditContainer());
@@ -78,33 +76,66 @@ class MigrationDelegate extends MigrationHelperDelegateImpl {
ourGenAuditContainer_Audits.setContainment(true);
ourGenAuditContainer_Audits.setLowerBound(0);
ourGenAuditContainer_Audits.setUpperBound(-1);
+ myGenAuditRoot_Id = (EAttributeImpl) EcoreUtil.copy(GMFGenPackage.eINSTANCE.getGenAuditContainer_Id());
+ myGenAuditRoot_Name = (EAttributeImpl) EcoreUtil.copy(GMFGenPackage.eINSTANCE.getGenAuditContainer_Name());
+ myGenAuditRoot_Description = (EAttributeImpl) EcoreUtil.copy(GMFGenPackage.eINSTANCE.getGenAuditContainer_Description());
{
Map<String, EStructuralFeature> renamings = new HashMap<String, EStructuralFeature>();
- renamings.put(ourGenEditorGenerator_Audits.getName(), ourGenEditorGenerator_Audits);
- registerRenamedAttributes(GMFGenPackage.eINSTANCE.getGenEditorGenerator(), renamings);
+ renamings.put(ourGenAuditContainer_Audits.getName(), ourGenAuditContainer_Audits);
+ renamings.put(ourGenAuditContainer_ChildContainers.getName(), ourGenAuditContainer_ChildContainers);
+ registerRenamedAttributes(GMFGenPackage.eINSTANCE.getGenAuditContainer(), renamings);
}
{
Map<String, EStructuralFeature> renamings = new HashMap<String, EStructuralFeature>();
renamings.put(ourGenAuditContainer_Audits.getName(), ourGenAuditContainer_Audits);
renamings.put(ourGenAuditContainer_ChildContainers.getName(), ourGenAuditContainer_ChildContainers);
- registerRenamedAttributes(GMFGenPackage.eINSTANCE.getGenAuditContainer(), renamings);
+ renamings.put(myGenAuditRoot_Id.getName(), myGenAuditRoot_Id);
+ renamings.put(myGenAuditRoot_Name.getName(), myGenAuditRoot_Name);
+ renamings.put(myGenAuditRoot_Description.getName(), myGenAuditRoot_Description);
+ registerRenamedAttributes(GMFGenPackage.eINSTANCE.getGenAuditRoot(), renamings);
}
registerRenamedType("CompositeFeatureLabelModelFacet", GMFGenPackage.eINSTANCE.getFeatureLabelModelFacet()); //$NON-NLS-1$
+ myRootContainer = null;
}
@Override
public boolean setValue(EObject object, EStructuralFeature feature, Object value, int position) {
- if (ourGenEditorGenerator_Audits.equals(feature)) {
- GenEditorGenerator generator = (GenEditorGenerator) object;
- GenAuditContainer rootContainer = (GenAuditContainer) value;
- generator.setAudits(getOrCreateRoot(rootContainer));
- } else if (ourGenAuditContainer_ChildContainers.equals(feature)) {
+ if (myGenAuditRoot_Id.equals(feature)) {
+ GenAuditRoot root = (GenAuditRoot) object;
+ String id = (String) value;
+ GenAuditContainer rootContainer = getOrCreateRootContainerOnce(root);
+ rootContainer.setId(id);
+ } else if (myGenAuditRoot_Name.equals(feature)) {
+ GenAuditRoot root = (GenAuditRoot) object;
+ String name = (String) value;
+ GenAuditContainer rootContainer = getOrCreateRootContainerOnce(root);
+ rootContainer.setName(name);
+ } else if (myGenAuditRoot_Description.equals(feature)) {
+ GenAuditRoot root = (GenAuditRoot) object;
+ String description = (String) value;
+ GenAuditContainer rootContainer = getOrCreateRootContainerOnce(root);
+ rootContainer.setDescription(description);
+ } else if (ourGenAuditContainer_ChildContainers.equals(feature) && object instanceof GenAuditRoot) {
+ GenAuditRoot root = (GenAuditRoot)object;
+ GenAuditContainer container = (GenAuditContainer)value;
+ if (myRootContainer != null) {
+ container.getPath().add(myRootContainer);
+ }
+ root.getCategories().add(container);
+ } else if (ourGenAuditContainer_Audits.equals(feature) && object instanceof GenAuditRoot) {
+ GenAuditRoot root = (GenAuditRoot)object;
+ GenAuditRule rule = (GenAuditRule)value;
+ if (myRootContainer != null) {
+ rule.setCategory(myRootContainer);
+ }
+ root.getRules().add(rule);
+ } else if (ourGenAuditContainer_ChildContainers.equals(feature) && object instanceof GenAuditContainer) {
GenAuditContainer parent = (GenAuditContainer)object;
GenAuditContainer container = (GenAuditContainer)value;
container.getPath().addAll(parent.getPath());
container.getPath().add(parent);
getOrCreateRoot(parent).getCategories().add(container);
- } else if (ourGenAuditContainer_Audits.equals(feature)) {
+ } else if (ourGenAuditContainer_Audits.equals(feature) && object instanceof GenAuditContainer) {
GenAuditContainer container = (GenAuditContainer)object;
GenAuditRule rule = (GenAuditRule)value;
rule.setCategory(container);
@@ -116,6 +147,14 @@ class MigrationDelegate extends MigrationHelperDelegateImpl {
return true;
}
+ private GenAuditContainer getOrCreateRootContainerOnce(GenAuditRoot root) {
+ if (myRootContainer == null) {
+ myRootContainer = GMFGenFactory.eINSTANCE.createGenAuditContainer();
+ root.getCategories().add(myRootContainer);
+ }
+ return myRootContainer;
+ }
+
private GenAuditRoot getOrCreateRoot(GenAuditContainer auditContainer) {
GenAuditRoot result = auditContainer.getRoot();
if (result == null) {

Back to the top