diff options
author | Florian Noyrit | 2014-04-07 18:13:29 +0000 |
---|---|---|
committer | Florian Noyrit | 2014-04-07 18:43:36 +0000 |
commit | 8180e2696df6b0702ae516060667e692c1cd2015 (patch) | |
tree | 272257459c131ac3d15680eb18f5051d00513584 /plugins/developer/org.eclipse.papyrus.def | |
parent | 8cd208b6f08d93ab54320ce25a500fe519d4fdf1 (diff) | |
download | org.eclipse.papyrus-8180e2696df6b0702ae516060667e692c1cd2015.tar.gz org.eclipse.papyrus-8180e2696df6b0702ae516060667e692c1cd2015.tar.xz org.eclipse.papyrus-8180e2696df6b0702ae516060667e692c1cd2015.zip |
Regenerated StateMachine Diagram with latest code generator
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def')
7 files changed, 575 insertions, 141 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/diagram/editpolicies/OpenDiagram.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/diagram/editpolicies/OpenDiagram.java new file mode 100644 index 00000000000..0965d5e7d4f --- /dev/null +++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/diagram/editpolicies/OpenDiagram.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + */ +package aspects.xpt.diagram.editpolicies; + +import com.google.common.base.Objects; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import org.eclipse.gmf.codegen.gmfgen.GenApplication; +import org.eclipse.gmf.codegen.gmfgen.GenCommonBase; +import org.eclipse.gmf.codegen.gmfgen.GenDiagram; +import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator; +import org.eclipse.gmf.codegen.gmfgen.OpenDiagramBehaviour; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.xbase.lib.Extension; +import xpt.Common; +import xpt.editor.DiagramEditorUtil; + +@Singleton +@SuppressWarnings("all") +public class OpenDiagram extends xpt.diagram.editpolicies.OpenDiagram { + @Inject + @Extension + private Common _common; + + @Inject + private DiagramEditorUtil xptDiagramEditorUtil; + + public CharSequence openCommandClass_intializeNewDiagram(final OpenDiagramBehaviour it) { + StringConcatenation _builder = new StringConcatenation(); + CharSequence _generatedMemberComment = this._common.generatedMemberComment(); + _builder.append(_generatedMemberComment, ""); + _builder.newLineIfNotEmpty(); + _builder.append("protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("if (d == null) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("throw new org.eclipse.core.commands.ExecutionException(\"Can\'t create diagram of \'\" + getDiagramKind() + \"\' kind\");"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("diagramFacet.setDiagramLink(d);"); + _builder.newLine(); + _builder.append("\t"); + CharSequence __assert = this._common._assert("diagramFacet.eResource() != null"); + _builder.append(__assert, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("diagramFacet.eResource().getContents().add(d);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer();"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("while (container instanceof org.eclipse.gmf.runtime.notation.View) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("((org.eclipse.gmf.runtime.notation.View) container).persist();"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("container = container.eContainer();"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("try {"); + _builder.newLine(); + { + GenCommonBase _subject = it.getSubject(); + GenDiagram _diagram = _subject.getDiagram(); + GenEditorGenerator _editorGen = _diagram.getEditorGen(); + GenApplication _application = _editorGen.getApplication(); + boolean _equals = Objects.equal(null, _application); + if (_equals) { + _builder.append("\t"); + _builder.append("new org.eclipse.ui.actions.WorkspaceModifyOperation() {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t\t"); + _builder.append("try {"); + _builder.newLine(); + } + } + _builder.append("\t"); + _builder.append("for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("nextResource.save("); + GenCommonBase _subject_1 = it.getSubject(); + GenDiagram _diagram_1 = _subject_1.getDiagram(); + CharSequence _qualifiedClassName = this.xptDiagramEditorUtil.qualifiedClassName(_diagram_1); + _builder.append(_qualifiedClassName, "\t\t\t"); + _builder.append(".getSaveOptions());"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + { + GenCommonBase _subject_2 = it.getSubject(); + GenDiagram _diagram_2 = _subject_2.getDiagram(); + GenEditorGenerator _editorGen_1 = _diagram_2.getEditorGen(); + GenApplication _application_1 = _editorGen_1.getApplication(); + boolean _equals_1 = Objects.equal(null, _application_1); + if (_equals_1) { + _builder.append("\t"); + _builder.append("} catch (java.io.IOException ex) {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("throw new java.lang.reflect.InvocationTargetException(ex, \"Save operation failed\");"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}\t\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}.run(null);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("} catch (java.lang.reflect.InvocationTargetException e) {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("throw new org.eclipse.core.commands.ExecutionException(\"Can\'t create diagram of \'\" + getDiagramKind() + \"\' kind\", e);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("} catch (InterruptedException e) {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("throw new org.eclipse.core.commands.ExecutionException(\"Can\'t create diagram of \'\" + getDiagramKind() + \"\' kind\", e);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } else { + _builder.append("\t"); + _builder.append("} catch (java.io.IOException ex) {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("throw new org.eclipse.core.commands.ExecutionException(\"Can\'t create diagram of \'\" + getDiagramKind() + \"\' kind\", ex);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } + } + _builder.append("\t"); + _builder.append("return d;"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + return _builder; + } +} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/NewDiagramFileWizard.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/NewDiagramFileWizard.java new file mode 100644 index 00000000000..fe89454a3e6 --- /dev/null +++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/NewDiagramFileWizard.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexander Shatalin (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + */ +package aspects.xpt.editor; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import org.eclipse.gmf.codegen.gmfgen.GenDiagram; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.xbase.lib.Extension; +import xpt.Externalizer; +import xpt.ExternalizerUtils_qvto; + +@Singleton +@SuppressWarnings("all") +public class NewDiagramFileWizard extends xpt.editor.NewDiagramFileWizard { + @Inject + @Extension + private ExternalizerUtils_qvto _externalizerUtils_qvto; + + @Inject + private Externalizer xptExternalizer; + + public CharSequence i18nValues(final GenDiagram it) { + StringConcatenation _builder = new StringConcatenation(); + String _i18nKeyForNewDiagramFileWizardCreationPage = this.i18nKeyForNewDiagramFileWizardCreationPage(it); + String _nameKey = this._externalizerUtils_qvto.nameKey(_i18nKeyForNewDiagramFileWizardCreationPage); + CharSequence _messageEntry = this.xptExternalizer.messageEntry(_nameKey, "Initialize new diagram file"); + _builder.append(_messageEntry, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardCreationPage_1 = this.i18nKeyForNewDiagramFileWizardCreationPage(it); + String _titleKey = this._externalizerUtils_qvto.titleKey(_i18nKeyForNewDiagramFileWizardCreationPage_1); + CharSequence _messageEntry_1 = this.xptExternalizer.messageEntry(_titleKey, "Diagram file"); + _builder.append(_messageEntry_1, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardCreationPage_2 = this.i18nKeyForNewDiagramFileWizardCreationPage(it); + String _descriptionKey = this._externalizerUtils_qvto.descriptionKey(_i18nKeyForNewDiagramFileWizardCreationPage_2); + CharSequence _messageEntry_2 = this.xptExternalizer.messageEntry(_descriptionKey, + "Create new diagram based on {0} model content"); + _builder.append(_messageEntry_2, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPage = this.i18nKeyForNewDiagramFileWizardRootSelectionPage(it); + String _nameKey_1 = this._externalizerUtils_qvto.nameKey(_i18nKeyForNewDiagramFileWizardRootSelectionPage); + CharSequence _messageEntry_3 = this.xptExternalizer.messageEntry(_nameKey_1, + "Select diagram root element"); + _builder.append(_messageEntry_3, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPage_1 = this.i18nKeyForNewDiagramFileWizardRootSelectionPage(it); + String _titleKey_1 = this._externalizerUtils_qvto.titleKey(_i18nKeyForNewDiagramFileWizardRootSelectionPage_1); + CharSequence _messageEntry_4 = this.xptExternalizer.messageEntry(_titleKey_1, "Diagram root element"); + _builder.append(_messageEntry_4, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPage_2 = this.i18nKeyForNewDiagramFileWizardRootSelectionPage(it); + String _descriptionKey_1 = this._externalizerUtils_qvto.descriptionKey(_i18nKeyForNewDiagramFileWizardRootSelectionPage_2); + CharSequence _messageEntry_5 = this.xptExternalizer.messageEntry(_descriptionKey_1, + "Select semantic model element to be depicted on diagram"); + _builder.append(_messageEntry_5, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle = this.i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it); + CharSequence _messageEntry_6 = this.xptExternalizer.messageEntry(_i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle, + "Select diagram root element:"); + _builder.append(_messageEntry_6, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage = this.i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it); + CharSequence _messageEntry_7 = this.xptExternalizer.messageEntry(_i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage, + "Diagram root element is not selected"); + _builder.append(_messageEntry_7, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage = this.i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it); + CharSequence _messageEntry_8 = this.xptExternalizer.messageEntry(_i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage, + "Invalid diagram root element is selected"); + _builder.append(_messageEntry_8, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardInitDiagramCommand = this.i18nKeyForNewDiagramFileWizardInitDiagramCommand(it); + CharSequence _messageEntry_9 = this.xptExternalizer.messageEntry(_i18nKeyForNewDiagramFileWizardInitDiagramCommand, "Initializing diagram contents"); + _builder.append(_messageEntry_9, ""); + _builder.newLineIfNotEmpty(); + String _i18nKeyForNewDiagramFileWizardIncorrectRootError = this.i18nKeyForNewDiagramFileWizardIncorrectRootError(it); + CharSequence _messageEntry_10 = this.xptExternalizer.messageEntry(_i18nKeyForNewDiagramFileWizardIncorrectRootError, + "Incorrect model object stored as a root resource object"); + _builder.append(_messageEntry_10, ""); + _builder.newLineIfNotEmpty(); + return _builder; + } +} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend new file mode 100644 index 00000000000..a0fa5e6fdf1 --- /dev/null +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + */ +package aspects.xpt.diagram.editpolicies + +import com.google.inject.Inject +import com.google.inject.Singleton +import org.eclipse.gmf.codegen.gmfgen.OpenDiagramBehaviour +import xpt.Common +import xpt.editor.DiagramEditorUtil + +@Singleton class OpenDiagram extends xpt.diagram.editpolicies.OpenDiagram { + @Inject extension Common; + + + @Inject DiagramEditorUtil xptDiagramEditorUtil; + + + + override openCommandClass_intializeNewDiagram(OpenDiagramBehaviour it) ''' + «generatedMemberComment» + protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException { + org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint()); + if (d == null) { + throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind"); + } + diagramFacet.setDiagramLink(d); + «_assert('diagramFacet.eResource() != null')» + diagramFacet.eResource().getContents().add(d); + org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer(); + while (container instanceof org.eclipse.gmf.runtime.notation.View) { + ((org.eclipse.gmf.runtime.notation.View) container).persist(); + container = container.eContainer(); + } + try { + «IF null == subject.diagram.editorGen.application» + new org.eclipse.ui.actions.WorkspaceModifyOperation() { + protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException { + try { + «ENDIF» + for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) { + org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next(); + if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) { + nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions()); + } + } + «IF null == subject.diagram.editorGen.application» + } catch (java.io.IOException ex) { + throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed"); + } + } + }.run(null); + } catch (java.lang.reflect.InvocationTargetException e) { + throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e); + } catch (InterruptedException e) { + throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e); + } + «ELSE» + } catch (java.io.IOException ex) { + throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex); + } + «ENDIF» + return d; + } + ''' + + +} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend index eba214f3c55..e4939f25ee2 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend @@ -29,6 +29,7 @@ import xpt.Common import xpt.Common_qvto import xpt.GenModelUtils_qvto import xpt.diagram.updater.LinkDescriptor +import xpt.diagram.updater.NodeDescriptor import xpt.diagram.updater.UpdaterLinkType import xpt.diagram.updater.Utils_qvto @@ -39,6 +40,7 @@ import xpt.diagram.updater.Utils_qvto @Inject extension GenModelUtils_qvto; @Inject LinkDescriptor linkDescriptor; @Inject VisualIDRegistry xptVisualIDRegistry; + @Inject NodeDescriptor nodeDescriptor; @Inject MetaModel xptMetaModel; @@ -93,6 +95,8 @@ import xpt.diagram.updater.Utils_qvto } ''' + def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor.qualifiedClassName(it.diagramUpdater)»>''' + override getSemanticChildrenOfView(GenContainerBase it) ''' «IF it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v|v.genNode == it && v.classpath != null]. size != 0» @@ -100,7 +104,7 @@ import xpt.diagram.updater.Utils_qvto «FOR updater : it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v| v.genNode == it && v.classpath != null].toIterable» public static «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater customUpdater = new «updater.classpath»(); + «getICustomDiagramUpdater(it)» customUpdater = new «updater.classpath»(); return customUpdater.getSemanticChildren(view); } «ENDFOR» diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend new file mode 100644 index 00000000000..8d765a46cee --- /dev/null +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexander Shatalin (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + */ +package aspects.xpt.editor + +import com.google.inject.Inject +import com.google.inject.Singleton +import org.eclipse.gmf.codegen.gmfgen.GenDiagram +import xpt.Externalizer +import xpt.ExternalizerUtils_qvto + +@Singleton class NewDiagramFileWizard extends xpt.editor.NewDiagramFileWizard { + @Inject extension ExternalizerUtils_qvto; + @Inject Externalizer xptExternalizer; + + override i18nValues(GenDiagram it) ''' + «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')» + «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Diagram file')» + «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), + 'Create new diagram based on {0} model content')» + «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), + 'Select diagram root element')» + «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')» + «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), + 'Select semantic model element to be depicted on diagram')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it), + 'Select diagram root element:')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it), + 'Diagram root element is not selected')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it), + 'Invalid diagram root element is selected')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(it), 'Initializing diagram contents')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(it), + 'Incorrect model object stored as a root resource object')» + ''' + + +} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend index 2c4490d44c1..88d3ec9c055 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend @@ -9,30 +9,34 @@ * Contributors: * Alexander Shatalin (Borland) - initial API and implementation * Michael Golubev (Montages) - #372479, #386838 - */
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider
-import org.eclipse.gmf.codegen.gmfgen.GenLink
-import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet
-import org.eclipse.gmf.codegen.gmfgen.ValueExpression
-import xpt.CodeStyle
-import xpt.Common
-
+ */ +package aspects.xpt.editor + +import com.google.inject.Inject +import com.google.inject.Singleton +import metamodel.MetaModel +import org.eclipse.emf.codegen.ecore.genmodel.GenClass +import org.eclipse.gmf.codegen.gmfgen.GenCommonBase +import org.eclipse.gmf.codegen.gmfgen.GenDiagram +import org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter +import org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider +import org.eclipse.gmf.codegen.gmfgen.GenLink +import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet +import org.eclipse.gmf.codegen.gmfgen.ValueExpression +import xpt.CodeStyle +import xpt.Common +import xpt.expressions.getExpression +import org.eclipse.gmf.codegen.gmfgen.GenConstraint + //XXX: [MG] decide what to do with @MetaDef methods -@Singleton class VisualIDRegistry extends xpt.editor.VisualIDRegistry {
-
- @Inject extension MetaModel
- @Inject extension Common
- @Inject CodeStyle xptCodeStyle;
-
- override getDiagramVisualID(GenDiagram it) '''
+@Singleton class VisualIDRegistry extends xpt.editor.VisualIDRegistry { + + @Inject extension MetaModel + @Inject extension Common + @Inject CodeStyle xptCodeStyle; + @Inject getExpression xptGetExpression; + + override getDiagramVisualID(GenDiagram it) ''' «generatedMemberComment()» public static int «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { if (domainElement == null) { @@ -40,8 +44,8 @@ import xpt.Common } return «visualID»; } - '''
-
+ ''' + /** * Support for extra contstraints to check about model element. * Includes expression fields for interpreted constrains (like ocl or regexp). @@ -49,59 +53,76 @@ import xpt.Common * that performs extra specification as defined by value expression * * FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator) - */
- override constraintMethods(GenDiagram it) '''
- «IF null != editorGen.expressionProviders»
- «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
- topNode)»«ENDFOR» - «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
- childNode)»«ENDFOR» - «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR» - «ENDIF»
- '''
-
+ */ + // override constraintMethods(GenDiagram it) ''' + // «IF null != editorGen.expressionProviders» + // «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod( + // topNode)»«ENDFOR» + // «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod( + // childNode)»«ENDFOR» + // «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR» + // «ENDIF» + // ''' //[ExtendedConstraint] Model selector constraint - override checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase) '''
- ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «IF commonBase instanceof GenLink»
+ override checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase) ''' +««« «IF null != modelElementSelector» +««« //«it.eContainer» +««« //->«modelElementSelector» +««« «ENDIF» + ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) + «IF null != modelElementSelector» + «IF commonBase instanceof GenLink || !(modelElementSelector.provider instanceof GenJavaExpressionProvider)» + ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) + && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,'domainElement')») + ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) + «ELSE» + && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(metaClass, 'domainElement')») + «ENDIF» + «ENDIF» ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - «IF null != modelElementSelector» && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,
- 'domainElement')»)«ENDIF» - ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «ELSE»
- «IF null != modelElementSelector» && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(
- metaClass, 'domainElement')»)«ENDIF» - «ENDIF»
- ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - '''
-
+ ''' + +// override dispatch domainElementConstraintMethod(GenExpressionInterpreter it, GenCommonBase diagramElement, +// ValueExpression expression, GenClass context) ''' +// «generatedMemberComment()» +// «IF diagramElement instanceof GenLink» +// +// «ELSE» +// private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { +// Object result = «xptGetExpression.getExpression(it, expression, context)».evaluate(domainElement); +// return result instanceof Boolean && ((Boolean)result).booleanValue(); +// } +// «ENDIF» +// +// ''' + // [ExtendedConstraint] Model selector constraint - override _domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement,
- ValueExpression expression, GenClass context) '''
+ override dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement, + ValueExpression expression, GenClass context) ''' «generatedMemberComment» ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «IF diagramElement instanceof GenLink»
+ «IF diagramElement instanceof GenLink» ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { + private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «ELSE»
- private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName(
- context)» domainElement) { - «ENDIF»
+ «ELSE» + private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName( + context)» domainElement) { + «ENDIF» ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - «IF injectExpressionBody && (expression.body != null && expression.body.length() != 0)»
+ «IF injectExpressionBody && (expression.body != null && expression.body.length() != 0)» «expression.body» - «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))»
+ «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))» // FIXME: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS» - «ELSE»
+ «ELSE» return false; - «ENDIF»
- } - '''
-
- override runtimeTypedInstance(GenDiagram it) '''
+ «ENDIF» + } + ''' + + override runtimeTypedInstance(GenDiagram it) ''' «generatedClassComment()» public static final org.eclipse.gmf.tooling.runtime.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.gmf.tooling.runtime.structure.DiagramStructure() { «generatedMemberComment()» @@ -140,6 +161,6 @@ import xpt.Common return «isSemanticLeafVisualIDMethodCall(it)»(visualID); } }; - '''
-
-}
+ ''' + +} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend index ca569e43ebd..203ef61fcaf 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend @@ -1,73 +1,76 @@ -
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
-
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram*
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit
- */
-package aspects.xpt.plugin
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.gmf.codegen.gmfgen.GenPlugin
-import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingDeleteService
-import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingReorientService
-import xpt.Common
-
-@Singleton class manifest extends xpt.plugin.manifest{
-
-@Inject extension Common
-
-override requireBundle(GenPlugin it)'''
-Require-Bundle: org.eclipse.core.runtime,
-«IF editorGen.application == null» org.eclipse.core.resources,
-«ENDIF»
-«IF editorGen.diagram.generateShortcutIcon() || (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)» org.eclipse.core.expressions,
-«ENDIF» org.eclipse.jface,
-«IF editorGen.application == null» org.eclipse.ui.ide,
-«ENDIF» org.eclipse.ui.views,
-«IF editorGen.navigator != null» org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
-«ENDIF» org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.uml.service.types,
- org.eclipse.papyrus.infra.widgets,
-«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing,
- org.eclipse.gmf.runtime.diagram.ui.printing.render,
-«ENDIF»
-«IF editorGen.propertySheet != null» org.eclipse.gmf.runtime.diagram.ui.properties,
-«ENDIF» org.eclipse.gmf.runtime.diagram.ui.providers,
-«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.providers.ide,
-«ENDIF» org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
-«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
-«ENDIF»
-«var reqPlugins = getAllRequiredPlugins()»
-«IF !reqPlugins.contains('org.eclipse.gmf.tooling.runtime')»
-«var notUsetBooleanVar = reqPlugins.add('org.eclipse.gmf.tooling.runtime')»
-«ENDIF»
-«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak»
-«ENDFOR» org.eclipse.gef,
- org.eclipse.papyrus.infra.gmfdiag.preferences,
- org.eclipse.papyrus.extensionpoints.editors«IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).size != 0 || it.eResource.allContents.filter(typeof (EditPartUsingReorientService)).size != 0»,
- org.eclipse.papyrus.infra.services.edit
-«ENDIF»
-Eclipse-LazyStart: true
-'''
-
+ +/* + * Copyright (c) 2007, 2009 Borland Software Corporation + + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dmitry Stadnik (Borland) - initial API and implementation + * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram* + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit + */ +package aspects.xpt.plugin + +import com.google.inject.Inject +import com.google.inject.Singleton +import org.eclipse.gmf.codegen.gmfgen.GenPlugin +import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingDeleteService +import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingReorientService +import xpt.Common + +@Singleton class manifest extends xpt.plugin.manifest{ + +@Inject extension Common + +override requireBundle(GenPlugin it)''' +Require-Bundle: org.eclipse.core.runtime, +«IF editorGen.application == null» org.eclipse.core.resources, +«ENDIF» +«IF editorGen.diagram.generateShortcutIcon() || (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)» org.eclipse.core.expressions, +«ENDIF» org.eclipse.jface, +«IF editorGen.application == null» org.eclipse.ui.ide, +«ENDIF» org.eclipse.ui.views, +«IF editorGen.navigator != null» org.eclipse.ui.navigator, + org.eclipse.ui.navigator.resources, +«ENDIF» org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.emf.edit.ui, + org.eclipse.gmf.runtime.emf.core, + org.eclipse.gmf.runtime.emf.commands.core, + org.eclipse.gmf.runtime.emf.ui.properties, + org.eclipse.gmf.runtime.diagram.ui, + org.eclipse.papyrus.uml.diagram.common, + org.eclipse.papyrus.infra.gmfdiag.common, + org.eclipse.papyrus.uml.service.types, + org.eclipse.papyrus.infra.widgets, +«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing, + org.eclipse.gmf.runtime.diagram.ui.printing.render, +«ENDIF» +«IF editorGen.propertySheet != null» org.eclipse.gmf.runtime.diagram.ui.properties, +«ENDIF» org.eclipse.gmf.runtime.diagram.ui.providers, +«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.providers.ide, +«ENDIF» org.eclipse.gmf.runtime.diagram.ui.render, + org.eclipse.gmf.runtime.diagram.ui.resources.editor, +«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide, +«ENDIF» +«var reqPlugins = getAllRequiredPlugins()» +«IF !reqPlugins.contains('org.eclipse.gmf.tooling.runtime')» +«var notUsetBooleanVar = reqPlugins.add('org.eclipse.gmf.tooling.runtime')» +«ENDIF» +«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak» +«ENDFOR» org.eclipse.gef, + org.eclipse.papyrus.infra.gmfdiag.preferences, + «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).size != 0 || it.eResource.allContents.filter(typeof (EditPartUsingReorientService)).size != 0», + org.eclipse.papyrus.extensionpoints.editors, + org.eclipse.papyrus.infra.services.edit + «ELSE» + org.eclipse.papyrus.extensionpoints.editors +«ENDIF» + +''' + }
\ No newline at end of file |