diff options
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(); + } + } } } |