Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend14
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend346
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend8
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend58
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend12
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend210
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend160
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend118
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend14
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend2
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend238
11 files changed, 590 insertions, 590 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend
index cdf087b52f0..a9b3fa8ab2d 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend
@@ -10,13 +10,13 @@
* Dmitry Stadnik (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.GenEditorView
-import xpt.Common
-
+package aspects.xpt.editor
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.codegen.gmfgen.GenEditorView
+import xpt.Common
+
@Singleton class ActionBarContributor extends xpt.editor.ActionBarContributor {
@Inject extension Common;
@Inject Editor xptEditor;
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
index b5c3548f670..29754ba7811 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
@@ -1,174 +1,174 @@
-package aspects.xpt.editor
-
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-import com.google.inject.Inject
-import xpt.CodeStyle
-import xpt.editor.GenDiagram_qvto
-import xpt.editor.CreationWizardPage
-import xpt.Externalizer
-import plugin.Activator
-import xpt.editor.DiagramEditorUtil
-import xpt.ExternalizerUtils_qvto
-import com.google.inject.Singleton
-
-@Singleton class CreationWizard extends xpt.editor.CreationWizard {
-
- @Inject extension Common
- @Inject extension CodeStyle
- @Inject extension ExternalizerUtils_qvto
- @Inject extension GenDiagram_qvto
-
- @Inject Activator xptActivator
- @Inject CreationWizardPage xptCreationWizardPage
- @Inject DiagramEditorUtil xptDiagramEditorUtil
- @Inject Externalizer xptExternalizer
-
- override CreationWizard(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)»
- «extendsList(it)» «implementsList(it)» {
-
- «generatedMemberComment»
- private org.eclipse.ui.IWorkbench workbench;
-
- «generatedMemberComment»
- protected org.eclipse.jface.viewers.IStructuredSelection selection;
-
- «generatedMemberComment»
- protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage;
-
- «IF standaloneDomainModel(it)»
- «generatedMemberComment»
- protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage;
- «ENDIF»
-
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.resource.Resource diagram;
-
- «generatedMemberComment»
- private boolean openNewlyCreatedDiagramEditor = true;
-
- «generatedMemberComment»
- public org.eclipse.ui.IWorkbench getWorkbench() {
- return workbench;
- }
-
- «generatedMemberComment»
- public org.eclipse.jface.viewers.IStructuredSelection getSelection() {
- return selection;
- }
-
- «generatedMemberComment»
- public final org.eclipse.emf.ecore.resource.Resource getDiagram() {
- return diagram;
- }
-
- «generatedMemberComment»
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- «generatedMemberComment»
- public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-
- «generatedMemberComment»
- public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»);
- setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor(
- "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- «generatedMemberComment»
- public void addPages() {
- diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
- "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForCreationWizardDiagramPage(it)))»);
- diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
- descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»);
- addPage(diagramModelFilePage);
- «IF standaloneDomainModel(it)»
-
- domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
- "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
-
- «overrideC»
- public void setVisible(boolean visible) {
- if (visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$
- setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName(
- getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForCreationWizardDomainPage(it)))»);
- domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
- descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»);
- addPage(domainModelFilePage);
- «ENDIF»
- }
-
- «generatedMemberComment»
- public boolean performFinish() {
- org.eclipse.jface.operation.IRunnableWithProgress op =
- «IF editorGen.application == null»
- new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
-
- «overrideC»
- protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws org.eclipse.core.runtime.CoreException, InterruptedException {
- «ELSE»
- new org.eclipse.jface.operation.IRunnableWithProgress() {
-
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- «ENDIF»
- diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(),
- «IF standaloneDomainModel(it)»
- domainModelFilePage.getURI(),
- «ENDIF»
- monitor);
- if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram);
- } catch (org.eclipse.ui.PartInitException e) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus());
- }
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (java.lang.reflect.InvocationTargetException e) {
- if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null,
- ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
- } else {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
- }
- return false;
- }
- return diagram != null;
- }
- «additions(it)»
- }
- '''
-
+package aspects.xpt.editor
+
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import xpt.Common
+import com.google.inject.Inject
+import xpt.CodeStyle
+import xpt.editor.GenDiagram_qvto
+import xpt.editor.CreationWizardPage
+import xpt.Externalizer
+import plugin.Activator
+import xpt.editor.DiagramEditorUtil
+import xpt.ExternalizerUtils_qvto
+import com.google.inject.Singleton
+
+@Singleton class CreationWizard extends xpt.editor.CreationWizard {
+
+ @Inject extension Common
+ @Inject extension CodeStyle
+ @Inject extension ExternalizerUtils_qvto
+ @Inject extension GenDiagram_qvto
+
+ @Inject Activator xptActivator
+ @Inject CreationWizardPage xptCreationWizardPage
+ @Inject DiagramEditorUtil xptDiagramEditorUtil
+ @Inject Externalizer xptExternalizer
+
+ override CreationWizard(GenDiagram it) '''
+ «copyright(editorGen)»
+ package «packageName(it)»;
+
+ «generatedClassComment»
+ public class «className(it)»
+ «extendsList(it)» «implementsList(it)» {
+
+ «generatedMemberComment»
+ private org.eclipse.ui.IWorkbench workbench;
+
+ «generatedMemberComment»
+ protected org.eclipse.jface.viewers.IStructuredSelection selection;
+
+ «generatedMemberComment»
+ protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage;
+
+ «IF standaloneDomainModel(it)»
+ «generatedMemberComment»
+ protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage;
+ «ENDIF»
+
+ «generatedMemberComment»
+ protected org.eclipse.emf.ecore.resource.Resource diagram;
+
+ «generatedMemberComment»
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ «generatedMemberComment»
+ public org.eclipse.ui.IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ «generatedMemberComment»
+ public org.eclipse.jface.viewers.IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ «generatedMemberComment»
+ public final org.eclipse.emf.ecore.resource.Resource getDiagram() {
+ return diagram;
+ }
+
+ «generatedMemberComment»
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ «generatedMemberComment»
+ public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ «generatedMemberComment»
+ public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»);
+ setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor(
+ "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ «generatedMemberComment»
+ public void addPages() {
+ diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
+ "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
+ titleKey(i18nKeyForCreationWizardDiagramPage(it)))»);
+ diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
+ descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»);
+ addPage(diagramModelFilePage);
+ «IF standaloneDomainModel(it)»
+
+ domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
+ "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ «overrideC»
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$
+ setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName(
+ getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
+ titleKey(i18nKeyForCreationWizardDomainPage(it)))»);
+ domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
+ descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»);
+ addPage(domainModelFilePage);
+ «ENDIF»
+ }
+
+ «generatedMemberComment»
+ public boolean performFinish() {
+ org.eclipse.jface.operation.IRunnableWithProgress op =
+ «IF editorGen.application == null»
+ new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
+
+ «overrideC»
+ protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws org.eclipse.core.runtime.CoreException, InterruptedException {
+ «ELSE»
+ new org.eclipse.jface.operation.IRunnableWithProgress() {
+
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ «ENDIF»
+ diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(),
+ «IF standaloneDomainModel(it)»
+ domainModelFilePage.getURI(),
+ «ENDIF»
+ monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
+ try {
+ «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram);
+ } catch (org.eclipse.ui.PartInitException e) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null,
+ ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
+ } else {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
+ "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+ «additions(it)»
+ }
+ '''
+
} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend
index e1cf1a326c3..dff428d05d8 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend
@@ -12,10 +12,10 @@
* Vincent Lorenzo (CEA LIST)
*
*/
-package aspects.xpt.editor
-
-import com.google.inject.Singleton
-
+package aspects.xpt.editor
+
+import com.google.inject.Singleton
+
//This class is not used, now we use org.eclipse.papyrus.common.actions.DeleteFromModelAction
@Singleton class DeleteElementAction extends xpt.editor.DeleteElementAction {
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend
index 2f72a067024..02b9853d772 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend
@@ -1,30 +1,30 @@
-package aspects.xpt.editor
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.gmf.codegen.gmfgen.GenContainerBase
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class DiagramContentInitializer extends xpt.editor.DiagramContentInitializer {
- @Inject extension Common;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
- override def getCompartment(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) {
- String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»;
- for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) {
- return (org.eclipse.gmf.runtime.notation.Node) nextView;
- }
- }
- return null;
- }
- '''
-
- override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children'''
-
+package aspects.xpt.editor
+
+import aspects.xpt.Common
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.codegen.gmfgen.GenContainerBase
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+
+@Singleton class DiagramContentInitializer extends xpt.editor.DiagramContentInitializer {
+ @Inject extension Common;
+
+ @Inject VisualIDRegistry xptVisualIDRegistry;
+
+ override def getCompartment(GenDiagram it) '''
+ «generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) {
+ String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»;
+ for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) {
+ return (org.eclipse.gmf.runtime.notation.Node) nextView;
+ }
+ }
+ return null;
+ }
+ '''
+
+ override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children'''
+
} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend
index 80bb6f5de02..07c5e97ef5f 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend
@@ -11,12 +11,12 @@
* Michael Golubev (Montages) - #386838 - migrate to Xtend2
* Vincent Lorenzo (CEA LIST)
*/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import plugin.Activator
+package aspects.xpt.editor
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import plugin.Activator
import xpt.Common import xpt.CodeStyle
//We remove the dependance with DeleteElementAction. Now this action is added to the popup menu with the extension point org.eclipse.ui.popup
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
index 5a4879ae1f5..0fa3f092235 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
@@ -1,106 +1,106 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and other.
- *
- * 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:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import xpt.Common
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import xpt.Externalizer
-import xpt.CodeStyle
-import metamodel.MetaModel
-import plugin.Activator
-import xpt.editor.GenDiagram_qvto
-import com.google.inject.Singleton
-
-@Singleton class DiagramEditorUtil extends xpt.editor.DiagramEditorUtil {
-
- @Inject extension Common
- @Inject extension CodeStyle
- @Inject extension GenDiagram_qvto
-
- @Inject Activator xptActivator
- @Inject Externalizer xptExternalizer
- @Inject MetaModel xptMetaModel
-
- override def getUniqueFileNameMethod(GenDiagram it) '''
- «generatedMemberComment»
- public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
- return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «»
- org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»);
- }
- '''
-
- override createDiagramMethod(GenDiagram it) '''
- «generatedMemberComment(
- (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))»
- public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(
- it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3);
- final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
- «IF standaloneDomainModel(it)»
- final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
- «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/»
- ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- «ENDIF»
- final String diagramName = diagramURI.lastSegment();
- org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer.
- accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) {
- «overrideC»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- «IF domainDiagramElement != null»
- «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel();
- attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource);
- «ENDIF»
- «extraLineBreak»
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
- «IF domainDiagramElement != null»
- «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»,
- «ENDIF»
- «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»);
- if (diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
- «IF domainDiagramElement != null»
- diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»);
- «ENDIF»
- }
-
- try {
- «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF»
- diagramResource.save(«callGetSaveOptions(it)»);
- } catch (java.io.IOException e) {
- «/*
- * TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?
- * */
- extraLineBreak»
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)»
- }
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- };
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS(
- 1)»
- }
- «IF editorGen.application == null»
- «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF»
- setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
- «ENDIF»
- return diagramResource;
- }
- '''
-
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and other.
+ *
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
+ *****************************************************************************/
+package aspects.xpt.editor
+
+import com.google.inject.Inject
+import xpt.Common
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import xpt.Externalizer
+import xpt.CodeStyle
+import metamodel.MetaModel
+import plugin.Activator
+import xpt.editor.GenDiagram_qvto
+import com.google.inject.Singleton
+
+@Singleton class DiagramEditorUtil extends xpt.editor.DiagramEditorUtil {
+
+ @Inject extension Common
+ @Inject extension CodeStyle
+ @Inject extension GenDiagram_qvto
+
+ @Inject Activator xptActivator
+ @Inject Externalizer xptExternalizer
+ @Inject MetaModel xptMetaModel
+
+ override def getUniqueFileNameMethod(GenDiagram it) '''
+ «generatedMemberComment»
+ public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
+ return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «»
+ org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»);
+ }
+ '''
+
+ override createDiagramMethod(GenDiagram it) '''
+ «generatedMemberComment(
+ (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))»
+ public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(
+ it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3);
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ «IF standaloneDomainModel(it)»
+ final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+ «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/»
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ «ENDIF»
+ final String diagramName = diagramURI.lastSegment();
+ org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer.
+ accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) {
+ «overrideC»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ «IF domainDiagramElement != null»
+ «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel();
+ attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource);
+ «ENDIF»
+ «extraLineBreak»
+ org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
+ «IF domainDiagramElement != null»
+ «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»,
+ «ENDIF»
+ «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ «IF domainDiagramElement != null»
+ diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»);
+ «ENDIF»
+ }
+
+ try {
+ «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF»
+ diagramResource.save(«callGetSaveOptions(it)»);
+ } catch (java.io.IOException e) {
+ «/*
+ * TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?
+ * */
+ extraLineBreak»
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)»
+ }
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS(
+ 1)»
+ }
+ «IF editorGen.application == null»
+ «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF»
+ setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
+ «ENDIF»
+ return diagramResource;
+ }
+ '''
+
} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend
index c5f3afdc95e..af515676fe1 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend
@@ -1,81 +1,81 @@
-package aspects.xpt.editor
-
-import xpt.Common
-import com.google.inject.Inject
-import plugin.Activator
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import xpt.Externalizer
-import xpt.ExternalizerUtils_qvto
-import com.google.inject.Singleton
-
-@Singleton class InitDiagramFileAction extends xpt.editor.InitDiagramFileAction {
-
- @Inject extension Common
- @Inject extension ExternalizerUtils_qvto
-
- @Inject Activator xptActivator
- @Inject xpt.editor.DiagramEditorUtil xptDiagramEditorUtil
- @Inject Externalizer xptExternalizer
-
- override classBody_PDE(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart targetPart;
-
- «generatedMemberComment»
- private org.eclipse.emf.common.util.URI domainModelURI;
-
- «generatedMemberComment»
- public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-
- «generatedMemberComment»
- public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- domainModelURI = null;
- action.setEnabled(false);
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
- return;
- }
- org.eclipse.core.resources.IFile file =
- (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
- domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- action.setEnabled(true);
- }
-
- «generatedMemberComment»
- private org.eclipse.swt.widgets.Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- «generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- «IF editorGen.sameFileForDiagramAndModel»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
- «ELSE»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
- «ENDIF»
- org.eclipse.emf.ecore.EObject diagramRoot = null;
- try {
- org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = resource.getContents().get(0);
- } catch (org.eclipse.emf.common.util.WrappedException ex) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)»
- }
- if (diagramRoot == null) {
- org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
- «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»,
- «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»);
- return;
- }
- org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
- «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())»,
- «VisualIDRegistry::modelID(editorGen.diagram)»));
- «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS(
- 1)»
- }
- '''
+package aspects.xpt.editor
+
+import xpt.Common
+import com.google.inject.Inject
+import plugin.Activator
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import xpt.Externalizer
+import xpt.ExternalizerUtils_qvto
+import com.google.inject.Singleton
+
+@Singleton class InitDiagramFileAction extends xpt.editor.InitDiagramFileAction {
+
+ @Inject extension Common
+ @Inject extension ExternalizerUtils_qvto
+
+ @Inject Activator xptActivator
+ @Inject xpt.editor.DiagramEditorUtil xptDiagramEditorUtil
+ @Inject Externalizer xptExternalizer
+
+ override classBody_PDE(GenDiagram it) '''
+ «generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchPart targetPart;
+
+ «generatedMemberComment»
+ private org.eclipse.emf.common.util.URI domainModelURI;
+
+ «generatedMemberComment»
+ public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ «generatedMemberComment»
+ public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ domainModelURI = null;
+ action.setEnabled(false);
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ org.eclipse.core.resources.IFile file =
+ (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
+ domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ action.setEnabled(true);
+ }
+
+ «generatedMemberComment»
+ private org.eclipse.swt.widgets.Shell getShell() {
+ return targetPart.getSite().getShell();
+ }
+
+ «generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ «IF editorGen.sameFileForDiagramAndModel»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
+ «ELSE»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+ «ENDIF»
+ org.eclipse.emf.ecore.EObject diagramRoot = null;
+ try {
+ org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
+ diagramRoot = resource.getContents().get(0);
+ } catch (org.eclipse.emf.common.util.WrappedException ex) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
+ "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)»
+ }
+ if (diagramRoot == null) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
+ «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»,
+ «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»);
+ return;
+ }
+ org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
+ wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())»,
+ «VisualIDRegistry::modelID(editorGen.diagram)»));
+ «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS(
+ 1)»
+ }
+ '''
} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
index 7c552041346..bd5de605a1b 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
@@ -1,60 +1,60 @@
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import xpt.Common
-import xpt.CodeStyle
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram
-import com.google.inject.Singleton
-
-@Singleton class ResourceSetInfo extends xpt.editor.ResourceSetInfo {
-
- @Inject extension Common
- @Inject extension CodeStyle
-
- override handleResourceChangedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «updateSynchStateSD(it)»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- handleElementChanged(ResourceSetInfo.this, resource, null);
- }
- });
- return true;
- }
- '''
-
- override handleResourceDeletedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «updateSynchStateSD(it)»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- fireElementDeleted(ResourceSetInfo.this.getEditorInput());
- }
- });
- return true;
- }
- '''
-
- override handleResourceMovedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «updateSynchStateSD(it)»
- if (myDocument.getDiagram().eResource() == resource) {
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
- }
- });
- } else {
- handleResourceDeleted(resource);
- }
- return true;
- }
- '''
-
+package aspects.xpt.editor
+
+import com.google.inject.Inject
+import xpt.Common
+import xpt.CodeStyle
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import com.google.inject.Singleton
+
+@Singleton class ResourceSetInfo extends xpt.editor.ResourceSetInfo {
+
+ @Inject extension Common
+ @Inject extension CodeStyle
+
+ override handleResourceChangedSD(GenDiagram it) '''
+ «generatedMemberComment»
+ public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
+ «updateSynchStateSD(it)»
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+ }
+ '''
+
+ override handleResourceDeletedSD(GenDiagram it) '''
+ «generatedMemberComment»
+ public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
+ «updateSynchStateSD(it)»
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
+ public void run() {
+ fireElementDeleted(ResourceSetInfo.this.getEditorInput());
+ }
+ });
+ return true;
+ }
+ '''
+
+ override handleResourceMovedSD(GenDiagram it) '''
+ «generatedMemberComment»
+ public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
+ «updateSynchStateSD(it)»
+ if (myDocument.getDiagram().eResource() == resource) {
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
+ public void run() {
+ handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+ }
+ '''
+
} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend
index 69462e9b562..5ed49a3255a 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend
@@ -10,13 +10,13 @@
* Dmitry Stadnik (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.GenEditorGenerator
-import xpt.Common
-
+package aspects.xpt.editor
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator
+import xpt.Common
+
@Singleton class extensions extends xpt.editor.extensions {
@Inject extension Common;
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend
index 5af93bde682..db9c8b642ca 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend
@@ -110,4 +110,4 @@ import xpt.Common_qvto
«ENDFOR»
</ownedConfigurations>
'''
-}
+}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend
index 3c8fc7d8701..73366e5576e 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend
@@ -1,119 +1,119 @@
-/**
- * Copyright (c) 2006, 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.editor.palette
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.gmf.codegen.gmfgen.Palette
-import org.eclipse.gmf.codegen.gmfgen.ToolEntry
-import xpt.Common
-import xpt.Common_qvto
-import xpt.providers.ElementTypes
-
-@Singleton class PaletteFactory extends xpt.editor.palette.PaletteFactory {
- @Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension Utils_qvto;
-
- @Inject ElementTypes xptElementTypes;
-
-
- override PaletteFactory(Palette it) '''
- «copyright(diagram.editorGen)»
- package «packageName»;
-
- «generatedClassComment»
- public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
- //RS: New Palette generation
-
- //Generates the ID for the tool elements
- //Generate the tool factory (if(ID) createtool...)
- «FOR tool : collectTools(it)»
- «generateIDAttribute(tool)»
- «ENDFOR»
-
- «««Generates the default constructor
- «generatedMemberComment»
- public «factoryClassName»() {
-
- }
-
- «««Generates the main method to create tool
- «generateCreateTool(it)»
-
- «««Generates the main method to create template
- «generateGetTemplate(it)»
-
- «««Generates each method for tool creation
-
- «FOR tool : collectTools(it)»
- «createTool(tool)»
- «ENDFOR»
-
- }
- '''
-
- def generateCreateTool(Palette it) '''
- «generatedMemberComment»
- public org.eclipse.gef.Tool createTool(String toolId) {
- «FOR tool : collectTools(it)»
- «checkToolID(tool)»
- «ENDFOR»
- // default return: null
- return null;
- }
- '''
-
- def checkToolID(AbstractToolEntry it) '''
- if (toolId.equals(«getConstantIDName(id)»)) {
- return «createMethodName»();
- }
- '''
-
- def generateGetTemplate(Palette it) '''
- «generatedMemberComment»
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
- '''
-
- def generateIDAttribute(AbstractToolEntry it) '''
- «generatedMemberComment»
- private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF»
- '''
-
- def createTool(AbstractToolEntry it) '''
- «generatedMemberComment»
- private org.eclipse.gef.Tool «createMethodName»() {
- «newTool(it as ToolEntry, 'entry')»
- }
- '''
-
- def newTool(ToolEntry it, String toolVarName) '''
- «IF elements.isEmpty()»
- «ERROR('no elements for tool generation (Palette)')»
- «ELSE»
- java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»);
- «FOR e : elements»
- types.add(«xptElementTypes.accessElementType(e)»);
- «ENDFOR»
- ««« RS: modified tool creation to have stereotypes-aware tools
- org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
- return tool;
- «ENDIF»
- '''
-
-}
+/**
+ * Copyright (c) 2006, 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.editor.palette
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry
+import org.eclipse.gmf.codegen.gmfgen.Palette
+import org.eclipse.gmf.codegen.gmfgen.ToolEntry
+import xpt.Common
+import xpt.Common_qvto
+import xpt.providers.ElementTypes
+
+@Singleton class PaletteFactory extends xpt.editor.palette.PaletteFactory {
+ @Inject extension Common;
+ @Inject extension Common_qvto;
+ @Inject extension Utils_qvto;
+
+ @Inject ElementTypes xptElementTypes;
+
+
+ override PaletteFactory(Palette it) '''
+ «copyright(diagram.editorGen)»
+ package «packageName»;
+
+ «generatedClassComment»
+ public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
+ //RS: New Palette generation
+
+ //Generates the ID for the tool elements
+ //Generate the tool factory (if(ID) createtool...)
+ «FOR tool : collectTools(it)»
+ «generateIDAttribute(tool)»
+ «ENDFOR»
+
+ «««Generates the default constructor
+ «generatedMemberComment»
+ public «factoryClassName»() {
+
+ }
+
+ «««Generates the main method to create tool
+ «generateCreateTool(it)»
+
+ «««Generates the main method to create template
+ «generateGetTemplate(it)»
+
+ «««Generates each method for tool creation
+
+ «FOR tool : collectTools(it)»
+ «createTool(tool)»
+ «ENDFOR»
+
+ }
+ '''
+
+ def generateCreateTool(Palette it) '''
+ «generatedMemberComment»
+ public org.eclipse.gef.Tool createTool(String toolId) {
+ «FOR tool : collectTools(it)»
+ «checkToolID(tool)»
+ «ENDFOR»
+ // default return: null
+ return null;
+ }
+ '''
+
+ def checkToolID(AbstractToolEntry it) '''
+ if (toolId.equals(«getConstantIDName(id)»)) {
+ return «createMethodName»();
+ }
+ '''
+
+ def generateGetTemplate(Palette it) '''
+ «generatedMemberComment»
+ public Object getTemplate(String templateId) {
+
+ // default return: null
+ return null;
+ }
+ '''
+
+ def generateIDAttribute(AbstractToolEntry it) '''
+ «generatedMemberComment»
+ private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF»
+ '''
+
+ def createTool(AbstractToolEntry it) '''
+ «generatedMemberComment»
+ private org.eclipse.gef.Tool «createMethodName»() {
+ «newTool(it as ToolEntry, 'entry')»
+ }
+ '''
+
+ def newTool(ToolEntry it, String toolVarName) '''
+ «IF elements.isEmpty()»
+ «ERROR('no elements for tool generation (Palette)')»
+ «ELSE»
+ java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»);
+ «FOR e : elements»
+ types.add(«xptElementTypes.accessElementType(e)»);
+ «ENDFOR»
+ ««« RS: modified tool creation to have stereotypes-aware tools
+ org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
+ return tool;
+ «ENDIF»
+ '''
+
+}

Back to the top