Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2022-05-30 14:12:40 +0000
committerPatrick Tessier2022-06-16 14:31:21 +0000
commitba9c1695a0f4f72bc921204ecc398627ca75c79f (patch)
tree51eac2d78e179e4bcb2dc0fccecafaab3ac36908 /plugins/infra
parent1524f6fc1c517425dd33930a92ef067547600aa3 (diff)
downloadorg.eclipse.papyrus-ba9c1695a0f4f72bc921204ecc398627ca75c79f.tar.gz
org.eclipse.papyrus-ba9c1695a0f4f72bc921204ecc398627ca75c79f.tar.xz
org.eclipse.papyrus-ba9c1695a0f4f72bc921204ecc398627ca75c79f.zip
Bug 580042: [Editor][Xtext] When the user opens an Xtext Editor, the validation markers must be displayed just after the opening
Change-Id: Iabb3cd5135e48a3093f1592faf27c203dac29ab6 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra')
-rwxr-xr-xplugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/custom/PapyrusXTextMarker.java2
-rwxr-xr-xplugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/nested/editor/PapyrusXTextEditor.java20
2 files changed, 20 insertions, 2 deletions
diff --git a/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/custom/PapyrusXTextMarker.java b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/custom/PapyrusXTextMarker.java
index 7cdf4ae4fae..bb7e40a132d 100755
--- a/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/custom/PapyrusXTextMarker.java
+++ b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/custom/PapyrusXTextMarker.java
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.textedit.xtext.nested.editor.PapyrusXTextEditor
/**
* This class allows to get error markers in the {@link PapyrusXTextEditor}.
- * Strangely it seems work find doing nothing
+ * Strangely it seems work fine doing nothing
*/
public class PapyrusXTextMarker extends org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel {
diff --git a/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/nested/editor/PapyrusXTextEditor.java b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/nested/editor/PapyrusXTextEditor.java
index 6d6c13d441c..2775269b9b0 100755
--- a/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/nested/editor/PapyrusXTextEditor.java
+++ b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.xtext/api/org/eclipse/papyrus/infra/textedit/xtext/nested/editor/PapyrusXTextEditor.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
- * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Bug 578648, 579033, 580115
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Bug 578648, 579033, 580115, 580042
*****************************************************************************/
package org.eclipse.papyrus.infra.textedit.xtext.nested.editor;
@@ -30,6 +30,7 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
@@ -52,8 +53,12 @@ import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
+import org.eclipse.xtext.ui.editor.model.XtextDocumentProvider;
+
/**
* This Customization of the {@link XtextEditor} allows us to open an XtextEditor in the Papyrus sash editor
@@ -329,6 +334,19 @@ public class PapyrusXTextEditor extends XtextEditor {
if (this.historyListener != null) {
this.historyListener.updateXTextDocument(getDocumentProvider().getDocument(this.input));
}
+
+ final IDocumentProvider provider = getDocumentProvider();
+ if (provider instanceof XtextDocumentProvider) {
+ final XtextDocumentProvider xtextDocumentProvider = (XtextDocumentProvider) provider;
+ final IDocument tmp = xtextDocumentProvider.getDocument(this.input);
+
+ if (tmp instanceof XtextDocument) {
+ final XtextDocument xtextDoc = (XtextDocument) tmp;
+ // here to create and display validation marker just after the opening of the editor
+ // bug 580042
+ xtextDoc.checkAndUpdateAnnotations();
+ }
+ }
}
}

Back to the top