Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-05-21 12:17:00 +0000
committerptessier2014-05-21 12:17:00 +0000
commitb46c4ffc9d54d2290636f0488d2a3875e3367490 (patch)
tree970baf75f045354908b3bfdd2d708b021eaa6cb9 /plugins/developer/org.eclipse.papyrus.def/xtend-gen
parent58a55cd55d54bf024c9f89b64b23d644a28a4269 (diff)
downloadorg.eclipse.papyrus-b46c4ffc9d54d2290636f0488d2a3875e3367490.tar.gz
org.eclipse.papyrus-b46c4ffc9d54d2290636f0488d2a3875e3367490.tar.xz
org.eclipse.papyrus-b46c4ffc9d54d2290636f0488d2a3875e3367490.zip
Bug 431443 [All Diagrams] The maskManagedEditPolicy should be moved to
the Primary EditPart Change-Id: I72102c5466bbb5cb2333531ae22064726a0d7c0f
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/xtend-gen')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/.gitignore1
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/Common.java88
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/.gitignore3
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/DocumentProvider.java518
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ResourceSetModificationListener.java306
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ValidateAction.java758
6 files changed, 839 insertions, 835 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/.gitignore b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/.gitignore
new file mode 100644
index 00000000000..773023571e1
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/.gitignore
@@ -0,0 +1 @@
+/Common.java
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/Common.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/Common.java
index 6c04f45024a..994402ea8b4 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/Common.java
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/Common.java
@@ -1,44 +1,44 @@
-/**
- * Copyright (c) 2006-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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
-package aspects.xpt;
-
-import com.google.common.base.Objects;
-import com.google.inject.Singleton;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.xtend2.lib.StringConcatenation;
-
-@Singleton
-@SuppressWarnings("all")
-public class Common extends xpt.Common {
- public CharSequence copyright(final GenEditorGenerator it) {
- StringConcatenation _builder = new StringConcatenation();
- {
- String _copyrightText = it.getCopyrightText();
- boolean _notEquals = (!Objects.equal(_copyrightText, null));
- if (_notEquals) {
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* ");
- String _copyrightText_1 = it.getCopyrightText();
- String _replaceAll = _copyrightText_1.replaceAll("\n", "\n * ");
- _builder.append(_replaceAll, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- }
- }
- return _builder;
- }
-}
+/**
+ * Copyright (c) 2006-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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ */
+package aspects.xpt;
+
+import com.google.common.base.Objects;
+import com.google.inject.Singleton;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.xtend2.lib.StringConcatenation;
+
+@Singleton
+@SuppressWarnings("all")
+public class Common extends xpt.Common {
+ public CharSequence copyright(final GenEditorGenerator it) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ String _copyrightText = it.getCopyrightText();
+ boolean _notEquals = (!Objects.equal(_copyrightText, null));
+ if (_notEquals) {
+ _builder.append("/**");
+ _builder.newLine();
+ _builder.append(" ");
+ _builder.append("* ");
+ String _copyrightText_1 = it.getCopyrightText();
+ String _replaceAll = _copyrightText_1.replaceAll("\n", "\n * ");
+ _builder.append(_replaceAll, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append(" ");
+ _builder.append("*/");
+ _builder.newLine();
+ }
+ }
+ return _builder;
+ }
+}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/.gitignore b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/.gitignore
index 2448c5be523..34e4cdc198a 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/.gitignore
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/.gitignore
@@ -5,3 +5,6 @@
/extensions.java
/ActionBarContributor.java
/NewDiagramFileWizard.java
+/DocumentProvider.java
+/ResourceSetModificationListener.java
+/ValidateAction.java
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/DocumentProvider.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/DocumentProvider.java
index 91b06acc73a..a170bb0db43 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/DocumentProvider.java
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/DocumentProvider.java
@@ -1,259 +1,259 @@
-/**
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
-package aspects.xpt.editor;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.eclipse.gmf.codegen.gmfgen.GenApplication;
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.gmf.codegen.gmfgen.GenPlugin;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.xbase.lib.Extension;
-import plugin.Activator;
-import xpt.Common;
-import xpt.Externalizer;
-
-@Singleton
-@SuppressWarnings("all")
-public class DocumentProvider extends xpt.editor.DocumentProvider {
- @Inject
- @Extension
- private Common _common;
-
- @Inject
- private Activator xptActivator;
-
- @Inject
- private Externalizer xptExternalizer;
-
- public CharSequence setDocumentContent(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain();");
- _builder.newLine();
- _builder.append("\t");
- {
- GenEditorGenerator _editorGen = it.getEditorGen();
- GenApplication _application = _editorGen.getApplication();
- boolean _equals = Objects.equal(null, _application);
- if (_equals) {
- _builder.append("if (element instanceof ");
- CharSequence _fileEditorInputClassFQName = this.fileEditorInputClassFQName(it);
- _builder.append(_fileEditorInputClassFQName, "\t");
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("org.eclipse.core.resources.IStorage storage = ((");
- CharSequence _fileEditorInputClassFQName_1 = this.fileEditorInputClassFQName(it);
- _builder.append(_fileEditorInputClassFQName_1, "\t\t");
- _builder.append(") element).getStorage();");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor());");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("document.setContent(diagram);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("} else ");
- }
- }
- _builder.append("if(element instanceof ");
- CharSequence _uriEditorInputClassFQName = this.uriEditorInputClassFQName(it);
- _builder.append(_uriEditorInputClassFQName, "\t");
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("org.eclipse.emf.common.util.URI uri = ((");
- CharSequence _uriEditorInputClassFQName_1 = this.uriEditorInputClassFQName(it);
- _builder.append(_uriEditorInputClassFQName_1, "\t\t");
- _builder.append(") element).getURI();");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("org.eclipse.emf.ecore.resource.Resource resource = null;");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("try {");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("resource = domain.getResourceSet().getResource(uri.trimFragment(), false);");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("if (resource == null) {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("resource = domain.getResourceSet().createResource(uri.trimFragment());");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("if (!resource.isLoaded()) {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("try {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("@SuppressWarnings({ \"rawtypes\", \"unchecked\" })");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("java.util.Map<?,?> options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("// @see 171060 ");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("// options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("resource.load(options);");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("} catch (java.io.IOException e) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("resource.unload();");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("throw e;");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("if (uri.fragment() != null) {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("return;");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("} else {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = resource.getContents().iterator(); it.hasNext();) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("Object rootElement = it.next();");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("return;");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("throw new RuntimeException(");
- GenEditorGenerator _editorGen_1 = it.getEditorGen();
- String _i18nKeyForDocumentProviderNoDiagramInResourceError = this.i18nKeyForDocumentProviderNoDiagramInResourceError(it);
- CharSequence _accessorCall = this.xptExternalizer.accessorCall(_editorGen_1, _i18nKeyForDocumentProviderNoDiagramInResourceError);
- _builder.append(_accessorCall, "\t\t\t");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("} catch (Exception e) {");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("org.eclipse.core.runtime.CoreException thrownExcp = null;");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("if (e instanceof org.eclipse.core.runtime.CoreException) {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("thrownExcp = (org.eclipse.core.runtime.CoreException) e;");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("} else {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("String msg = e.getLocalizedMessage();");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, ");
- GenEditorGenerator _editorGen_2 = it.getEditorGen();
- GenPlugin _plugin = _editorGen_2.getPlugin();
- CharSequence _qualifiedClassName = this.xptActivator.qualifiedClassName(_plugin);
- _builder.append(_qualifiedClassName, "\t\t\t\t");
- _builder.append(".ID, 0, ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t\t");
- _builder.append("msg != null ? msg : ");
- GenEditorGenerator _editorGen_3 = it.getEditorGen();
- String _i18nKeyForDocumentProviderDiagramLoadingError = this.i18nKeyForDocumentProviderDiagramLoadingError(it);
- CharSequence _accessorCall_1 = this.xptExternalizer.accessorCall(_editorGen_3, _i18nKeyForDocumentProviderDiagramLoadingError);
- _builder.append(_accessorCall_1, "\t\t\t\t");
- _builder.append(", e));");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("throw thrownExcp;");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("} else {");
- _builder.newLine();
- _builder.append("\t");
- CharSequence _throwIncorrectInputException = this.throwIncorrectInputException(it);
- _builder.append(_throwIncorrectInputException, "\t");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("}\t");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-}
+/**
+ * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ */
+package aspects.xpt.editor;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.eclipse.gmf.codegen.gmfgen.GenApplication;
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.gmf.codegen.gmfgen.GenPlugin;
+import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.xbase.lib.Extension;
+import plugin.Activator;
+import xpt.Common;
+import xpt.Externalizer;
+
+@Singleton
+@SuppressWarnings("all")
+public class DocumentProvider extends xpt.editor.DocumentProvider {
+ @Inject
+ @Extension
+ private Common _common;
+
+ @Inject
+ private Activator xptActivator;
+
+ @Inject
+ private Externalizer xptExternalizer;
+
+ public CharSequence setDocumentContent(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain();");
+ _builder.newLine();
+ _builder.append("\t");
+ {
+ GenEditorGenerator _editorGen = it.getEditorGen();
+ GenApplication _application = _editorGen.getApplication();
+ boolean _equals = Objects.equal(null, _application);
+ if (_equals) {
+ _builder.append("if (element instanceof ");
+ CharSequence _fileEditorInputClassFQName = this.fileEditorInputClassFQName(it);
+ _builder.append(_fileEditorInputClassFQName, "\t");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("\t");
+ _builder.append("org.eclipse.core.resources.IStorage storage = ((");
+ CharSequence _fileEditorInputClassFQName_1 = this.fileEditorInputClassFQName(it);
+ _builder.append(_fileEditorInputClassFQName_1, "\t\t");
+ _builder.append(") element).getStorage();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("\t");
+ _builder.append("document.setContent(diagram);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("} else ");
+ }
+ }
+ _builder.append("if(element instanceof ");
+ CharSequence _uriEditorInputClassFQName = this.uriEditorInputClassFQName(it);
+ _builder.append(_uriEditorInputClassFQName, "\t");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.emf.common.util.URI uri = ((");
+ CharSequence _uriEditorInputClassFQName_1 = this.uriEditorInputClassFQName(it);
+ _builder.append(_uriEditorInputClassFQName_1, "\t\t");
+ _builder.append(") element).getURI();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.emf.ecore.resource.Resource resource = null;");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("try {");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("resource = domain.getResourceSet().getResource(uri.trimFragment(), false);");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("if (resource == null) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("resource = domain.getResourceSet().createResource(uri.trimFragment());");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("if (!resource.isLoaded()) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("try {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("@SuppressWarnings({ \"rawtypes\", \"unchecked\" })");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("java.util.Map<?,?> options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("// @see 171060 ");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("// options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("resource.load(options);");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("} catch (java.io.IOException e) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("resource.unload();");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("throw e;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("if (uri.fragment() != null) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("return;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("} else {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = resource.getContents().iterator(); it.hasNext();) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("Object rootElement = it.next();");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("return;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("throw new RuntimeException(");
+ GenEditorGenerator _editorGen_1 = it.getEditorGen();
+ String _i18nKeyForDocumentProviderNoDiagramInResourceError = this.i18nKeyForDocumentProviderNoDiagramInResourceError(it);
+ CharSequence _accessorCall = this.xptExternalizer.accessorCall(_editorGen_1, _i18nKeyForDocumentProviderNoDiagramInResourceError);
+ _builder.append(_accessorCall, "\t\t\t");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("} catch (Exception e) {");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("org.eclipse.core.runtime.CoreException thrownExcp = null;");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("if (e instanceof org.eclipse.core.runtime.CoreException) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("thrownExcp = (org.eclipse.core.runtime.CoreException) e;");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("} else {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("String msg = e.getLocalizedMessage();");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, ");
+ GenEditorGenerator _editorGen_2 = it.getEditorGen();
+ GenPlugin _plugin = _editorGen_2.getPlugin();
+ CharSequence _qualifiedClassName = this.xptActivator.qualifiedClassName(_plugin);
+ _builder.append(_qualifiedClassName, "\t\t\t\t");
+ _builder.append(".ID, 0, ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t\t\t");
+ _builder.append("msg != null ? msg : ");
+ GenEditorGenerator _editorGen_3 = it.getEditorGen();
+ String _i18nKeyForDocumentProviderDiagramLoadingError = this.i18nKeyForDocumentProviderDiagramLoadingError(it);
+ CharSequence _accessorCall_1 = this.xptExternalizer.accessorCall(_editorGen_3, _i18nKeyForDocumentProviderDiagramLoadingError);
+ _builder.append(_accessorCall_1, "\t\t\t\t");
+ _builder.append(", e));");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("throw thrownExcp;");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("} else {");
+ _builder.newLine();
+ _builder.append("\t");
+ CharSequence _throwIncorrectInputException = this.throwIncorrectInputException(it);
+ _builder.append(_throwIncorrectInputException, "\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("}\t");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ResourceSetModificationListener.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ResourceSetModificationListener.java
index c640687a3f7..c966464b9ae 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ResourceSetModificationListener.java
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ResourceSetModificationListener.java
@@ -1,153 +1,153 @@
-/**
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
-package aspects.xpt.editor;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.eclipse.gmf.codegen.gmfgen.GenApplication;
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.xbase.lib.Extension;
-import xpt.Common;
-
-@Singleton
-@SuppressWarnings("all")
-public class ResourceSetModificationListener extends xpt.editor.ResourceSetModificationListener {
- @Inject
- @Extension
- private Common _common;
-
- public CharSequence notifyChanged(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.append("\t");
- _builder.newLineIfNotEmpty();
- _builder.append("public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) {");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("super.notifyChanged(notification);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (!notification.isTouch() && myModifiedFilter.matches(notification)) {");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) {");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("if (resource.isLoaded()) {");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("boolean modified = false;");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("if (nextResource.isLoaded()) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("modified = nextResource.isModified();");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("boolean dirtyStateChanged = false;");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("synchronized (myInfo) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("if (modified != myInfo.fCanBeSaved) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("myInfo.fCanBeSaved = modified;");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("dirtyStateChanged = true;");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- {
- GenEditorGenerator _editorGen = it.getEditorGen();
- GenApplication _application = _editorGen.getApplication();
- boolean _equals = Objects.equal(null, _application);
- if (_equals) {
- _builder.append("\t\t\t\t\t");
- _builder.append("if (!resource.isModified()) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("\t");
- _builder.append("myInfo.setSynchronized(resource);");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("if (dirtyStateChanged) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("if (!modified) {");
- _builder.newLine();
- _builder.append("\t\t\t\t\t\t");
- _builder.append("myInfo.setModificationStamp(computeModificationStamp(myInfo));");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-}
+/**
+ * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ */
+package aspects.xpt.editor;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.eclipse.gmf.codegen.gmfgen.GenApplication;
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.xbase.lib.Extension;
+import xpt.Common;
+
+@Singleton
+@SuppressWarnings("all")
+public class ResourceSetModificationListener extends xpt.editor.ResourceSetModificationListener {
+ @Inject
+ @Extension
+ private Common _common;
+
+ public CharSequence notifyChanged(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.append("\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("super.notifyChanged(notification);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (!notification.isTouch() && myModifiedFilter.matches(notification)) {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) {");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("if (resource.isLoaded()) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("boolean modified = false;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("if (nextResource.isLoaded()) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("modified = nextResource.isModified();");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("boolean dirtyStateChanged = false;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("synchronized (myInfo) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("if (modified != myInfo.fCanBeSaved) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("myInfo.fCanBeSaved = modified;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("dirtyStateChanged = true;");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ {
+ GenEditorGenerator _editorGen = it.getEditorGen();
+ GenApplication _application = _editorGen.getApplication();
+ boolean _equals = Objects.equal(null, _application);
+ if (_equals) {
+ _builder.append("\t\t\t\t\t");
+ _builder.append("if (!resource.isModified()) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("\t");
+ _builder.append("myInfo.setSynchronized(resource);");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("if (dirtyStateChanged) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("if (!modified) {");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t\t");
+ _builder.append("myInfo.setModificationStamp(computeModificationStamp(myInfo));");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+}
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ValidateAction.java b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ValidateAction.java
index cfef866f802..238d5acfbb8 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ValidateAction.java
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/aspects/xpt/editor/ValidateAction.java
@@ -1,379 +1,379 @@
-/**
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
-package aspects.xpt.editor;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.eclipse.gmf.codegen.gmfgen.GenApplication;
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.xbase.lib.Extension;
-import xpt.Common;
-import xpt.editor.DiagramEditorUtil;
-
-@Singleton
-@SuppressWarnings("all")
-public class ValidateAction extends xpt.editor.ValidateAction {
- @Inject
- @Extension
- private Common _common;
-
- @Inject
- private DiagramEditorUtil xptDiagramEditorUtil;
-
- public CharSequence runNonUIValidation(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (shell == null) {");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("shell = new org.eclipse.swt.widgets.Shell();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(");
- _builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("view.getDiagram(),shell);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("runValidation(diagramEditPart, view);");
- _builder.newLine();
- _builder.append("}\t\t");
- _builder.newLine();
- return _builder;
- }
-
- public CharSequence createMarkersForStatus(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("private static void createMarkers(");
- _builder.newLine();
- _builder.append("\t\t");
- {
- GenEditorGenerator _editorGen = it.getEditorGen();
- GenApplication _application = _editorGen.getApplication();
- boolean _equals = Objects.equal(_application, null);
- if (_equals) {
- _builder.append("org.eclipse.core.resources.IFile");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- } else {
- _builder.append("org.eclipse.gmf.runtime.notation.View");
- }
- }
- _builder.append(" target,");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("org.eclipse.core.runtime.IStatus validationStatus,");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (validationStatus.isOK()) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("return;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("java.util.List allStatuses = new java.util.ArrayList();");
- _builder.newLine();
- _builder.append("\t");
- CharSequence _qualifiedClassName = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName, "\t");
- _builder.append(".LazyElement2ViewMap element2ViewMap = new ");
- CharSequence _qualifiedClassName_1 = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName_1, "\t");
- _builder.append(".LazyElement2ViewMap(");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("diagramEditPart.getDiagramView(),");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses));");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.emf.validation.model.IConstraintStatus nextStatus =");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("(org.eclipse.emf.validation.model.IConstraintStatus) it.next();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.notation.View view = ");
- CharSequence _qualifiedClassName_2 = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName_2, "\t");
- _builder.append(".findView(");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("diagramEditPart, nextStatus.getTarget(), element2ViewMap);\t\t\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), ");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), ");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("nextStatus.getMessage(), nextStatus.getSeverity());");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-
- public CharSequence createMarkersForDiagnostic(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("private static void createMarkers(");
- _builder.newLine();
- _builder.append("\t\t");
- {
- GenEditorGenerator _editorGen = it.getEditorGen();
- GenApplication _application = _editorGen.getApplication();
- boolean _equals = Objects.equal(_application, null);
- if (_equals) {
- _builder.append("org.eclipse.core.resources.IFile");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- } else {
- _builder.append("org.eclipse.gmf.runtime.notation.View");
- }
- }
- _builder.append(" target,");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("org.eclipse.emf.common.util.Diagnostic emfValidationStatus,");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("return;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>();");
- _builder.newLine();
- _builder.append("\t");
- CharSequence _qualifiedClassName = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName, "\t");
- _builder.append(".LazyElement2ViewMap element2ViewMap =");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("new ");
- CharSequence _qualifiedClassName_1 = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName_1, "\t");
- _builder.append(".LazyElement2ViewMap(");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("diagramEditPart.getDiagramView(),");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics));");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("java.util.List<?> data = nextDiagnostic.getData();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.gmf.runtime.notation.View view = ");
- CharSequence _qualifiedClassName_2 = this.xptDiagramEditorUtil.qualifiedClassName(it);
- _builder.append(_qualifiedClassName_2, "\t");
- _builder.append(".findView(");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("diagramEditPart, element, element2ViewMap);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true),");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-
- public CharSequence collectTargetElementsFromStatus(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status,");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("allConstraintStatuses.add((org.eclipse.emf.validation.model.IConstraintStatus)status);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (status.isMultiStatus()) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.core.runtime.IStatus[] children = status.getChildren();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (int i = 0; i < children.length; i++) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);\t\t\t\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("return targetElementCollector;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-
- public CharSequence collectTargetElementsFromDiagnostic(final GenDiagram it) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- CharSequence _generatedMemberComment = this._common.generatedMemberComment();
- _builder.append(_generatedMemberComment, "");
- _builder.newLineIfNotEmpty();
- _builder.append("private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("java.util.List<?> data = diagnostic.getData();");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("org.eclipse.emf.ecore.EObject target = null;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("target = (org.eclipse.emf.ecore.EObject) data.get(0);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("targetElementCollector.add(target);\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("allDiagnostics.add(diagnostic);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(),");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("targetElementCollector, allDiagnostics);");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("return targetElementCollector;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-}
+/**
+ * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ */
+package aspects.xpt.editor;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.eclipse.gmf.codegen.gmfgen.GenApplication;
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.xbase.lib.Extension;
+import xpt.Common;
+import xpt.editor.DiagramEditorUtil;
+
+@Singleton
+@SuppressWarnings("all")
+public class ValidateAction extends xpt.editor.ValidateAction {
+ @Inject
+ @Extension
+ private Common _common;
+
+ @Inject
+ private DiagramEditorUtil xptDiagramEditorUtil;
+
+ public CharSequence runNonUIValidation(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.newLine();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (shell == null) {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("shell = new org.eclipse.swt.widgets.Shell();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(");
+ _builder.newLine();
+ _builder.append("\t\t\t\t\t");
+ _builder.append("view.getDiagram(),shell);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("runValidation(diagramEditPart, view);");
+ _builder.newLine();
+ _builder.append("}\t\t");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public CharSequence createMarkersForStatus(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.newLine();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("private static void createMarkers(");
+ _builder.newLine();
+ _builder.append("\t\t");
+ {
+ GenEditorGenerator _editorGen = it.getEditorGen();
+ GenApplication _application = _editorGen.getApplication();
+ boolean _equals = Objects.equal(_application, null);
+ if (_equals) {
+ _builder.append("org.eclipse.core.resources.IFile");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ } else {
+ _builder.append("org.eclipse.gmf.runtime.notation.View");
+ }
+ }
+ _builder.append(" target,");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.core.runtime.IStatus validationStatus,");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (validationStatus.isOK()) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("return;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("java.util.List allStatuses = new java.util.ArrayList();");
+ _builder.newLine();
+ _builder.append("\t");
+ CharSequence _qualifiedClassName = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName, "\t");
+ _builder.append(".LazyElement2ViewMap element2ViewMap = new ");
+ CharSequence _qualifiedClassName_1 = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName_1, "\t");
+ _builder.append(".LazyElement2ViewMap(");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("diagramEditPart.getDiagramView(),");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses));");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.emf.validation.model.IConstraintStatus nextStatus =");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("(org.eclipse.emf.validation.model.IConstraintStatus) it.next();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.notation.View view = ");
+ CharSequence _qualifiedClassName_2 = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName_2, "\t");
+ _builder.append(".findView(");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("diagramEditPart, nextStatus.getTarget(), element2ViewMap);\t\t\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), ");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), ");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("nextStatus.getMessage(), nextStatus.getSeverity());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public CharSequence createMarkersForDiagnostic(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.newLine();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("private static void createMarkers(");
+ _builder.newLine();
+ _builder.append("\t\t");
+ {
+ GenEditorGenerator _editorGen = it.getEditorGen();
+ GenApplication _application = _editorGen.getApplication();
+ boolean _equals = Objects.equal(_application, null);
+ if (_equals) {
+ _builder.append("org.eclipse.core.resources.IFile");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ } else {
+ _builder.append("org.eclipse.gmf.runtime.notation.View");
+ }
+ }
+ _builder.append(" target,");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.emf.common.util.Diagnostic emfValidationStatus,");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("return;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>();");
+ _builder.newLine();
+ _builder.append("\t");
+ CharSequence _qualifiedClassName = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName, "\t");
+ _builder.append(".LazyElement2ViewMap element2ViewMap =");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("new ");
+ CharSequence _qualifiedClassName_1 = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName_1, "\t");
+ _builder.append(".LazyElement2ViewMap(");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("diagramEditPart.getDiagramView(),");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics));");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("java.util.List<?> data = nextDiagnostic.getData();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.gmf.runtime.notation.View view = ");
+ CharSequence _qualifiedClassName_2 = this.xptDiagramEditorUtil.qualifiedClassName(it);
+ _builder.append(_qualifiedClassName_2, "\t");
+ _builder.append(".findView(");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("diagramEditPart, element, element2ViewMap);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true),");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public CharSequence collectTargetElementsFromStatus(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.newLine();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status,");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("allConstraintStatuses.add((org.eclipse.emf.validation.model.IConstraintStatus)status);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (status.isMultiStatus()) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.core.runtime.IStatus[] children = status.getChildren();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("for (int i = 0; i < children.length; i++) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);\t\t\t\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("return targetElementCollector;");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public CharSequence collectTargetElementsFromDiagnostic(final GenDiagram it) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.newLine();
+ CharSequence _generatedMemberComment = this._common.generatedMemberComment();
+ _builder.append(_generatedMemberComment, "");
+ _builder.newLineIfNotEmpty();
+ _builder.append("private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("java.util.List<?> data = diagnostic.getData();");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("org.eclipse.emf.ecore.EObject target = null;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("target = (org.eclipse.emf.ecore.EObject) data.get(0);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("targetElementCollector.add(target);\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("allDiagnostics.add(diagnostic);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(),");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("targetElementCollector, allDiagnostics);");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("return targetElementCollector;");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+}

Back to the top