Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratischenko2014-12-08 12:11:37 +0000
committeratischenko2014-12-08 12:14:08 +0000
commitf872162d442e00f800f02903c9119767006bc426 (patch)
treedb78b9b9c2c9eb36c5b82d3c4750023d96f6d2db /plugins/developer/org.eclipse.papyrus.def
parent8679e385e5a97e076743121050f17fd01de548a5 (diff)
downloadorg.eclipse.papyrus-f872162d442e00f800f02903c9119767006bc426.tar.gz
org.eclipse.papyrus-f872162d442e00f800f02903c9119767006bc426.tar.xz
org.eclipse.papyrus-f872162d442e00f800f02903c9119767006bc426.zip
Bug 449934 - [Diagram Regeneration] Xtend Templates: correctly generate
@Override. Signed-off-by: atischenko <montages.t7@gmail.com>
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend64
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend10
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend12
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend42
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend174
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend6
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend87
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend90
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend38
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend167
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend60
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend71
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend8
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend5
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend16
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend7
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend32
17 files changed, 873 insertions, 16 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend
index fdcba4dc643..8c84ea36d0d 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend
@@ -33,17 +33,20 @@ import utils.EditPartsUtils_qvto
import xpt.Common
import xpt.diagram.editparts.EditPartFactory
import xpt.diagram.editparts.Utils_qvto
+import xpt.diagram.editpolicies.TextSelectionEditPolicy
+import xpt.CodeStyle
@Singleton class NodeEditPart extends impl.diagram.editparts.NodeEditPart {
@Inject extension Common;
+ @Inject extension CodeStyle
@Inject extension EditPartsUtils_qvto;
@Inject extension VisualIDRegistry;
@Inject extension Utils_qvto;
- @Inject extension xpt.diagram.Utils_qvto;
+
@Inject EditPartFactory xptEditPartFactory;
- @Inject impl.diagram.editparts.TextAware xptTextAware;
+ @Inject impl.diagram.editparts.TextAware xptTextAware;
//---------
// GMF
@@ -196,7 +199,62 @@ override borderItemSelectionEditPolicy(GenNode it)'''
}
«ENDIF»
'''
+
+ override createLayoutEditPolicyBody_FLOW_LAYOUT(GenNode it) '''
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy() {
+ «IF hasBorderItems(it)»
+ «extraLineBreak»
+ «overrideC»
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «borderItemSelectionEditPolicy()»
+ return super.createChildEditPolicy(child);
+ }
+ «ENDIF»
+
+ «overrideC»
+ protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ «overrideC»
+ protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ «overrideC»
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ '''
+ override createLayoutEditPolicyBody_DEFAULT(GenNode it) '''
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
+
+ «overrideC»
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «borderItemSelectionEditPolicy(it)»
+ org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ «overrideC»
+ protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+
+ «overrideC»
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ '''
+
//---------
// PAPYRUS
//---------
@@ -226,6 +284,7 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)'''
override def borderItemSelectionEP(GenNode it) '''
new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
+ «overrideC»
protected java.util.List<?> createSelectionHandles() {
org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
mh.setBorder(null);
@@ -367,4 +426,5 @@ def setupNodePlate (GenChildSideAffixedNode it)'''
result.getBounds().setSize(result.getPreferredSize());
'''
+
}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend
index b522c53a9ad..c49287fa1be 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend
@@ -26,6 +26,7 @@ import xpt.Common
import xpt.diagram.ViewmapAttributesUtils_qvto
import xpt.Common_qvto
import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel
+import xpt.CodeStyle
//DOCUMENTATION: PapyrusGencode
//This template has been modified to take in account the possibility to have extended direct editors
@@ -33,13 +34,14 @@ import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel
@Singleton class TextAware extends impl.diagram.editparts.TextAware {
@Inject extension Common
+ @Inject extension CodeStyle
+
@Inject extension ViewmapAttributesUtils_qvto
@Inject extension ParserProvider
@Inject extension Common_qvto
- @Inject TextAware testVar
override fields(GenCommonBase it)'''
«generatedMemberComment»
private org.eclipse.gef.tools.DirectEditManager manager;
@@ -356,6 +358,7 @@ override getEditTextValidator (GenCommonBase it)'''
public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
return new org.eclipse.jface.viewers.ICellEditorValidator() {
+ «overrideI»
public String isValid(final Object value) {
if (value instanceof String) {
final org.eclipse.emf.ecore.EObject element = getParserElement();
@@ -365,6 +368,7 @@ override getEditTextValidator (GenCommonBase it)'''
(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
new org.eclipse.emf.transaction.RunnableWithResult.Impl<java.lang.Object>() {
+ «overrideI»
public void run() {
setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
}
@@ -433,6 +437,7 @@ override performDirectEdit (GenCommonBase it)'''
protected void performDirectEdit() {
org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display.getDefault(), new java.lang.Runnable() {
+ «overrideI»
public void run() {
getManager().show();
}
@@ -531,6 +536,7 @@ def initializeDirectEditManager (GenCommonBase it)'''
// initialize the direct edit manager
try {
getEditingDomain().runExclusive(new Runnable() {
+ «overrideI»
public void run() {
if (isActive() && isEditable()) {
if (request.getExtendedData().get(
@@ -686,6 +692,7 @@ override getAccessibleEditPart (GenCommonBase it)'''
if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
+ «overrideC»
public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
e.result = getLabelTextHelper(getFigure());
}
@@ -808,6 +815,7 @@ def performDefaultDirectEditorEdit (GenCommonBase it)'''
try {
getEditingDomain().runExclusive(new Runnable() {
+ «overrideI»
public void run() {
if (isActive() && isEditable()) {
if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend
new file mode 100644
index 00000000000..ec09d45079a
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend
@@ -0,0 +1,12 @@
+package aspects.xpt
+
+import org.eclipse.gmf.codegen.gmfgen.GenCommonBase
+import com.google.inject.Singleton
+
+@Singleton class CodeStyle extends xpt.CodeStyle {
+
+ override overrideI(GenCommonBase xptSelf) '''
+ @Override
+ '''
+
+} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
new file mode 100644
index 00000000000..a392aee2527
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
@@ -0,0 +1,42 @@
+package aspects.xpt.diagram.editpolicies
+
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram
+import com.google.inject.Inject
+import xpt.Common
+import com.google.inject.Singleton
+import xpt.CodeStyle
+
+@Singleton class TextSelectionEditPolicy extends xpt.diagram.editpolicies.TextSelectionEditPolicy {
+
+ @Inject extension Common
+ @Inject extension CodeStyle
+
+ override textFeedback_createFocusFeedbackFigure(GenDiagram it) '''
+ «generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() {
+ return new org.eclipse.draw2d.Figure() {
+
+ «overrideC»
+ protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+ '''
+
+ override textFeedback_getHostPositionListener(GenDiagram it) '''
+ «generatedMemberComment»
+ private org.eclipse.draw2d.FigureListener getHostPositionListener() {
+ if (hostPositionListener == null) {
+ hostPositionListener = new org.eclipse.draw2d.FigureListener() {
+ «overrideI»
+ public void figureMoved(org.eclipse.draw2d.IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+ '''
+
+} \ No newline at end of file
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
new file mode 100644
index 00000000000..b5c3548f670
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
@@ -0,0 +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)»
+ }
+ '''
+
+} \ 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 e2026f1c946..80bb6f5de02 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
@@ -17,12 +17,13 @@ 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.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
//in org.eclipse.papyrus.uml.diagram.common
@Singleton class DiagramEditorContextMenuProvider extends xpt.editor.DiagramEditorContextMenuProvider {
@Inject extension Common;
+ @Inject extension CodeStyle
@Inject Activator xptActivator;
@@ -64,6 +65,7 @@ import xpt.Common
org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(
(org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+ «overrideI(it.editorGen.diagram)»
public void run() {
org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu(
DiagramEditorContextMenuProvider.this, part);
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
new file mode 100644
index 00000000000..4fbb93af0cc
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
@@ -0,0 +1,87 @@
+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 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.gmf.runtime.emf.core.GMFEditingDomainFactory.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/DocumentProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend
index 160bfebf636..1abc876db22 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend
@@ -18,12 +18,16 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram
import plugin.Activator
import xpt.Common
import xpt.Externalizer
+import xpt.CodeStyle
+import xpt.editor.DiagramEditorUtil
@Singleton class DocumentProvider extends xpt.editor.DocumentProvider {
@Inject extension Common;
+ @Inject extension CodeStyle
@Inject Activator xptActivator;
@Inject Externalizer xptExternalizer;
+ @Inject DiagramEditorUtil xptDiagramEditorUtil
@@ -99,14 +103,17 @@ import xpt.Externalizer
private org.eclipse.emf.common.notify.Notifier myTarger;
+ «overrideI»
public org.eclipse.emf.common.notify.Notifier getTarget() {
return myTarger;
}
+ «overrideI»
public boolean isAdapterForType(Object type) {
return false;
}
+ «overrideI»
public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
if (diagramResourceModifiedFilter.matches(notification)) {
Object value = notification.getNewValue();
@@ -116,6 +123,7 @@ import xpt.Externalizer
}
}
+ «overrideI»
public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
myTarger = newTarget;
}
@@ -126,6 +134,88 @@ import xpt.Externalizer
}
'''
+ override doSaveDocument(GenDiagram it) '''
+ «generatedMemberComment»
+ protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (!overwrite && !info.isSynchronized()) {
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID,
+ «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF»,
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentUnsynchronizedFileSaveError(it))»,
+ null));
+ }
+ «IF null == editorGen.application»
+ info.stopResourceListening();
+ «ENDIF»
+ fireElementStateChanging(element);
+ try {
+ monitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveDiagramTask(it))», info.getResourceSet().getResources().size() + 1); //"Saving diagram"
+ for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
+ monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveNextResourceTask(it))»,
+ nextResource.getURI()));
+ if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
+ try {
+ nextResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
+ } catch (java.io.IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ info.setModificationStamp(computeModificationStamp(info));
+ } catch (RuntimeException x) {
+ fireElementStateChangeFailed(element);
+ throw x;
+ } «IF null == editorGen.application» finally {
+ info.startResourceListening();
+ } «ENDIF»
+ } else {
+ org.eclipse.emf.common.util.URI newResoruceURI;
+ java.util.List<org.eclipse.core.resources.IFile> affectedFiles = null;
+ «IF null == editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») {
+ org.eclipse.core.resources.IFile newFile = ((«fileEditorInputClassFQName(it)») element).getFile();
+ affectedFiles = java.util.Collections.singletonList(newFile);
+ newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») {
+ newResoruceURI = ((«uriEditorInputClassFQName(it)») element).getURI();
+ } else {
+ fireElementStateChangeFailed(element);
+ «throwIncorrectInputException(it)»
+ }
+ if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0,
+ "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «nonNLS(1)» «nonNLS(2)»
+ }
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
+ final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
+ final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = (org.eclipse.gmf.runtime.notation.Diagram) org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) {
+ «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 {
+ newResource.getContents().add(diagramCopy);
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ }.execute(monitor, null);
+ newResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null));
+ } catch (java.io.IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null));
+ }
+ newResource.unload();
+ }
+ }
+ '''
+
override computeSchedulingRule(GenDiagram it) '''
«generatedMemberComment»
private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) {
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
index 30ceac2cf6d..760b8b2e38c 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
@@ -23,11 +23,13 @@ import org.eclipse.gmf.codegen.gmfgen.GenNavigator
import org.eclipse.gmf.codegen.gmfgen.Palette
import xpt.Common
import xpt.navigator.Utils_qvto
+import xpt.CodeStyle
@Singleton class Editor extends xpt.editor.Editor {
@Inject extension Common;
@Inject NavigatorLinkHelper xptNavigatorLinkHelper;
- @Inject extension Utils_qvto;
+ @Inject extension Utils_qvto;
+ @Inject extension CodeStyle
override extendsList(GenEditorView it) '''extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor'''
@@ -212,6 +214,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr
* with a defaultTool that is the SelectToolEx that undestands how to handle the enter
* key which will result in the creation of the shape also.
*/
+ «overrideC(it.editorGen.diagram)»
protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) {
super.configurePaletteViewer(viewer);
@@ -229,6 +232,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr
viewer.setCustomizer(createPaletteCustomizer());
}
+ «overrideC(it.editorGen.diagram)»
public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) {
org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer();
pViewer.createControl(parent);
@@ -256,6 +260,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr
* the KeyEvent
* @return <code>true</code> if KeyEvent was handled in some way
*/
+ «overrideC(it.editorGen.diagram)»
public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) {
if (event.keyCode == org.eclipse.swt.SWT.Selection) {
@@ -303,6 +308,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr
*
* @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
*/
+ «overrideI(it.editorGen.diagram)»
public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) {
org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
@@ -320,10 +326,12 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr
}
}
+ «overrideI(it.editorGen.diagram)»
public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
// do nothing
}
+ «overrideI(it.editorGen.diagram)»
public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
// Deactivate current active tool here if a
// double-click was handled.
@@ -374,6 +382,7 @@ def configureDiagramEditDomain (GenEditorView it)'''
super.configureDiagramEditDomain();
getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() {
+ «overrideI(it.editorGen.diagram)»
public void commandStackChanged(java.util.EventObject event) {
firePropertyChange( org.eclipse.ui.IEditorPart.PROP_DIRTY);
}
@@ -500,4 +509,31 @@ protected String getContextID() {
}
'''
+ override getAdapter(GenEditorView it) '''
+ «IF !hasPropertySheet(it) || hasNavigator(it)»
+
+ «generatedMemberComment»
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class type) {
+ «IF !hasPropertySheet(it)»
+ if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
+ return null;
+ }
+ «ENDIF»
+ «IF hasNavigator(it)»
+ if (type == org.eclipse.ui.part.IShowInTargetList.class) {
+ return new org.eclipse.ui.part.IShowInTargetList() {
+
+ «overrideI(it.editorGen.diagram)»
+ public String[] getShowInTargetIds() {
+ return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ «ENDIF»
+ return super.getAdapter(type);
+ }
+ «ENDIF»
+ '''
+
}
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
index 8d765a46cee..c6ba5db9b2e 100644
--- 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
@@ -17,10 +17,24 @@ import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenDiagram
import xpt.Externalizer
import xpt.ExternalizerUtils_qvto
+import xpt.Common
+import xpt.editor.ModelElementSelectionPage
+import plugin.Activator
+import xpt.editor.DiagramContentInitializer
+import xpt.CodeStyle
@Singleton class NewDiagramFileWizard extends xpt.editor.NewDiagramFileWizard {
+
+ @Inject extension Common
+ @Inject extension CodeStyle
@Inject extension ExternalizerUtils_qvto;
+
+ @Inject Activator xptActivator
+ @Inject DiagramEditorUtil xptDiagramEditorUtil
@Inject Externalizer xptExternalizer;
+ @Inject DiagramContentInitializer xptDiagramContentInitializer
+ @Inject ModelElementSelectionPage xptModelElementSelectionPage
+ @Inject xpt.editor.VisualIDRegistry xptVisualIDRegistry
override i18nValues(GenDiagram it) '''
«xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')»
@@ -43,5 +57,156 @@ import xpt.ExternalizerUtils_qvto
'Incorrect model object stored as a root resource object')»
'''
-
+ override NewDiagramFileWizard(GenDiagram it) '''
+ «copyright(editorGen)»
+ package «packageName(it)»;
+
+ «generatedClassComment»
+ public class «className(it)» extends org.eclipse.jface.wizard.Wizard {
+
+ «generatedMemberComment»
+ private «creationPage(it)» myFileCreationPage;
+
+ «generatedMemberComment»
+ private «xptModelElementSelectionPage.qualifiedClassName(it)» diagramRootElementSelectionPage;
+
+ «generatedMemberComment»
+ private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
+
+ «generatedMemberComment»
+ public «className(it)»(org.eclipse.emf.common.util.URI domainModelURI,
+ org.eclipse.emf.ecore.EObject diagramRoot,
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ «_assert('domainModelURI != null : \"Domain model uri must be specified\"')»
+ «_assert('diagramRoot != null : \"Doagram root element must be specified\"')»
+ «_assert('editingDomain != null : \"Editing domain must be specified\"')»
+
+ myFileCreationPage = new «creationPage(it)»(«xptExternalizer.accessorCall(editorGen,
+ nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ myFileCreationPage.setTitle(«xptExternalizer.accessorCall(editorGen,
+ titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»);
+ myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind(
+ «xptExternalizer.accessorCall(editorGen, descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»,
+ «VisualIDRegistry::modelID(it)»));
+ org.eclipse.core.runtime.IPath filePath;
+ String fileName = org.eclipse.emf.common.util.URI.decode(domainModelURI.trimFileExtension().lastSegment());
+ if (domainModelURI.isPlatformResource()) {
+ filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toPlatformString(true));
+ } else if (domainModelURI.isFile()) {
+ filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString());
+ } else {
+ // TODO : use some default path
+ throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «nonNLS(1)»
+ }
+ myFileCreationPage.setContainerFullPath(filePath);
+ myFileCreationPage.setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName(
+ filePath, fileName, "«editorGen.diagramFileExtension»")); «nonNLS(1)»
+
+ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«xptExternalizer.accessorCall(editorGen,
+ nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
+ diagramRootElementSelectionPage.setTitle(«xptExternalizer.accessorCall(editorGen,
+ titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
+ diagramRootElementSelectionPage.setDescription(«xptExternalizer.accessorCall(editorGen,
+ descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
+ diagramRootElementSelectionPage.setModelElement(diagramRoot);
+
+ myEditingDomain = editingDomain;
+ }
+
+ «generatedMemberComment»
+ public void addPages() {
+ addPage(myFileCreationPage);
+ addPage(diagramRootElementSelectionPage);
+ }
+
+ «generatedMemberComment»
+ public boolean performFinish() {
+ java.util.LinkedList<org.eclipse.core.resources.IFile> affectedFiles = new java.util.LinkedList<org.eclipse.core.resources.IFile>();
+ «IF null == editorGen.application»
+ org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile();
+ «xptDiagramEditorUtil.callSetCharset(it, 'diagramFile')»
+ affectedFiles.add(diagramFile);
+ org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+ «ELSE»
+ org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName());
+ org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString());
+ «ENDIF»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI);
+ org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command =
+ new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(
+ myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) {
+
+ «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 {
+ int diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != «VisualIDRegistry::visualID(it)») {
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult(
+ «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»);
+ }
+ org.eclipse.gmf.runtime.notation.Diagram diagram =
+ org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
+ diagramRootElementSelectionPage.getModelElement(), «VisualIDRegistry::modelID(it)»,
+ «xptActivator.preferenceHintAccess(editorGen)»);
+ diagramResource.getContents().add(diagram);
+ «IF editorGen.sameFileForDiagramAndModel»
+ diagramResource.getContents().add(diagram.getElement());
+ «ENDIF»
+ «IF !it.synchronized»
+ new «xptDiagramContentInitializer.qualifiedClassName(it)»().initDiagramContent(diagram);
+ «ENDIF»
+ 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.NullProgressMonitor(), null);
+ diagramResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
+ «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagramResource);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
+ "Unable to create model and diagram", e); «nonNLS(1)»
+ } catch (java.io.IOException ex) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
+ "Save operation failed for: " + diagramModelURI, ex); «nonNLS(1)»
+ } catch (org.eclipse.ui.PartInitException ex) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
+ "Unable to open editor", ex); «nonNLS(1)»
+ }
+ return true;
+ }
+
+ «generatedClassComment»
+ private static class DiagramRootElementSelectionPage extends «xptModelElementSelectionPage.qualifiedClassName(it)» {
+
+ «generatedMemberComment»
+ protected DiagramRootElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ «generatedMemberComment»
+ protected String getSelectionTitle() {
+ return «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it))»;
+ }
+
+ «generatedMemberComment»
+ protected boolean validatePage() {
+ if (getModelElement() == null) {
+ setErrorMessage(«xptExternalizer.accessorCall(editorGen,
+ i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it))»);
+ return false;
+ }
+ boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
+ new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getModelElement()),
+ «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»));
+ setErrorMessage(result ? null : «xptExternalizer.accessorCall(editorGen,
+ i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it))»);
+ return result;
+ }
+ }
+ }
+ '''
}
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
new file mode 100644
index 00000000000..7c552041346
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
@@ -0,0 +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;
+ }
+ '''
+
+} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend
index 05286f07b54..ac86d659310 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend
@@ -17,10 +17,17 @@ import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenDiagram
import xpt.Common
import xpt.editor.DiagramEditorUtil
+import xpt.CodeStyle
+import plugin.Activator
+import xpt.providers.ValidationProvider
@Singleton class ValidateAction extends xpt.editor.ValidateAction {
@Inject extension Common;
+ @Inject extension CodeStyle
+
@Inject DiagramEditorUtil xptDiagramEditorUtil;
+ @Inject Activator xptActivator
+ @Inject ValidationProvider xptValidationProvider
override runNonUIValidation(GenDiagram it) '''
@@ -140,4 +147,68 @@ import xpt.editor.DiagramEditorUtil
}
'''
+ override run(GenDiagram it) '''
+
+ «generatedMemberComment»
+ public void run() {
+ org.eclipse.ui.IWorkbenchPart workbenchPart = page.getActivePart();
+ if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart;
+ try {
+ «IF editorGen.application == null»
+ new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation(
+ «ENDIF»
+ new org.eclipse.jface.operation.IRunnableWithProgress() {
+
+ «overrideI»
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws InterruptedException, java.lang.reflect.InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }
+ «IF editorGen.application == null»
+ )
+ «ENDIF»
+ .run(new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch (Exception e) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation action failed", e); «nonNLS(1)»
+ }
+ }
+ }
+ '''
+
+ override runValidationWithEP(GenDiagram it) '''
+
+ «generatedMemberComment»
+ public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) {
+ final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart;
+ final org.eclipse.gmf.runtime.notation.View fview = view;
+ org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view);
+ «xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() {
+
+ «overrideI»
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+ '''
+
+ override runEMFValidator(GenDiagram it) '''
+
+ «generatedMemberComment»
+ private static org.eclipse.emf.common.util.Diagnostic runEMFValidator(
+ org.eclipse.gmf.runtime.notation.View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new org.eclipse.emf.ecore.util.Diagnostician() {
+
+ «overrideC»
+ public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) {
+ return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE;
+ }
+ '''
}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend
index e091a31e6cc..7f1888e89f8 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend
@@ -15,10 +15,11 @@ package aspects.xpt.navigator
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-
+import xpt.Common import xpt.CodeStyle
+
@Singleton class AbstractNavigatorItem extends xpt.navigator.AbstractNavigatorItem {
@Inject extension Common;
+ @Inject extension CodeStyle
override def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
@@ -26,12 +27,14 @@ import xpt.Common
@SuppressWarnings("rawtypes")
final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
+ «overrideI(it.editorGen.diagram)»
public String getContributorId() {
return "«editorGen.plugin.ID»"; «nonNLS(1)»
}
};
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
@@ -40,6 +43,7 @@ import xpt.Common
return null;
}
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend
index 26f5a8579bb..26322174d6a 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend
@@ -15,10 +15,11 @@ package aspects.xpt.navigator
import com.google.inject.Inject
import org.eclipse.gmf.codegen.gmfgen.GenNavigator
import xpt.Common
+import xpt.CodeStyle
@com.google.inject.Singleton class DomainNavigatorItem extends xpt.navigator.DomainNavigatorItem {
@Inject extension Common;
-
+ @Inject extension CodeStyle
override def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
@@ -27,6 +28,7 @@ import xpt.Common
final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class };
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)») {
@@ -43,6 +45,7 @@ import xpt.Common
return null;
}
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend
index 8c8bf3ffd39..265abcda900 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend
@@ -22,13 +22,14 @@ import org.eclipse.gmf.codegen.gmfgen.GenNavigatorReferenceType
import xpt.Common
import xpt.Common_qvto
import xpt.editor.VisualIDRegistry
-import xpt.navigator.Utils_qvto
-
+import xpt.navigator.Utils_qvto import xpt.CodeStyle
+
@Singleton class NavigatorContentProvider extends xpt.navigator.NavigatorContentProvider {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
-
+ @Inject extension CodeStyle
+
@Inject VisualIDRegistry xptVisualIDRegistry;
@@ -77,6 +78,8 @@ import xpt.navigator.Utils_qvto
myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
@SuppressWarnings("serial")
java.util.Map<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean> map = new java.util.HashMap<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean>() {
+
+ «overrideI(it.editorGen.diagram)»
public java.lang.Boolean get(java.lang.Object key) {
if (!containsKey(key)) {
if (key instanceof org.eclipse.emf.ecore.resource.Resource) {
@@ -88,6 +91,8 @@ import xpt.navigator.Utils_qvto
};
myEditingDomain.setResourceToReadOnlyMap(map);
myViewerRefreshRunnable = new Runnable() {
+
+ «overrideI(it.editorGen.diagram)»
public void run() {
if (myViewer != null) {
myViewer.refresh();
@@ -95,17 +100,22 @@ import xpt.navigator.Utils_qvto
}
};
myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
+
+ «overrideC(it.editorGen.diagram)»
public void dispose() {
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
«processChanges(it)»
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
«processChanges(it)»
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
«processChanges(it)»
}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend
index d75a69b321d..2580c603b74 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend
@@ -15,10 +15,11 @@ package aspects.xpt.navigator
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-
+import xpt.Common import xpt.CodeStyle
+
@Singleton class NavigatorItem extends xpt.navigator.NavigatorItem {
@Inject extension Common;
+ @Inject extension CodeStyle
override def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
@@ -27,6 +28,7 @@ import xpt.Common
final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
@@ -35,6 +37,7 @@ import xpt.Common
return null;
}
+ «overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend
index d48d7a42987..d731bc26480 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend
@@ -23,14 +23,17 @@ import xpt.Common
import xpt.Common_qvto
import xpt.GenAuditRoot_qvto
import xpt.editor.VisualIDRegistry
+import plugin.Activator
+import xpt.CodeStyle
@Singleton class ValidationProvider extends xpt.providers.ValidationProvider {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension GenAuditRoot_qvto;
+ @Inject extension CodeStyle
@Inject VisualIDRegistry xptVisualIDRegistry;
-
+ @Inject Activator xptActivator
override selectors(GenAuditRoot it) '''
@@ -75,4 +78,31 @@ import xpt.editor.VisualIDRegistry
«ENDIF»
«ENDIF»
'''
+
+ override runWithActiveConstraints(GenDiagram it) '''
+ «generatedMemberComment»
+ public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
+ Runnable task = new Runnable() {
+ «overrideI»
+ public void run() {
+ try {
+ constraintsActive = true;
+ op.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ if(editingDomain != null) {
+ try {
+ editingDomain.runExclusive(task);
+ } catch (Exception e) {
+ «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation failed", e); «nonNLS(1)»
+ }
+ } else {
+ task.run();
+ }
+ }
+ '''
}

Back to the top