Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] Validation Support (ModelExplorer, IGotoMarker)

Dear all,

I am currently working on a support for model validation, i.e. I want to
show errors/warnings in the "Problems" view and properly associate the
editor with these. I already implemented the invocation of the
validation via the EMF validation framework, including a small
manipulation that associates an entry -an error marker- with the .di
instead of the .uml resource (which is not really true, but enables that
the Papyrus editor is invoked instead of the UML tree viewer) and shows
the qualified name of the model element as its location.

When the user double-clicks on a problem, the payrus editor is now
activated. I want it to navigate to the appropriate place, i.e. select
the element related to the problem in the model explorer (ideally also
in a diagram, but the same element might be contained in multiple diagrams).
From an implementation viewpoint, the workbench checks whether the
editor supports the IGotoMarker interface and uses the contained
gotoMarker operation to navigates to the right place. I already added
the IGotoMarker to the CoreMultiDiagEditor. The first problem is to
locate the ModelExplorer for which I currently use the following code
which is probably not the best way to do that.

IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage();
for(IViewReference view : page.getViewReferences()) {
   
if(view.getId().equals("org.eclipse.papyrus.modelexplorer.modelexplorer")) {
       ...
    }
}

I also added support for the IGotoMarker interface the ModelExplorer,
more specifically the ModelExplorerPageBookView. The 2nd problem is
howto set the selection of the model explorer. A simple setSelection
does not work, since I need to pass the wrapping ModelElementItem
instead of the contained eObject (in my case, a UML element). It's
perhaps not required to add the functionality, since the Modisco
ECoreBrowser already supports the IGotoMarker  (see e.g.
http://dev.eclipse.org/viewsvn/index.cgi/plugins/trunk/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/editors/EcoreBrowser.java?view=markup&root=Modeling_MODISCO&pathrev=2951)
and contains a browseTo method taking an EObject as parameter (this
function is actually used by the gotoMarker operation).  But since we
only use the model explorer view - if I understood it right - Modisco's
ECoreBrowser may not be available. Does anyone know if it's functions
could be used? A not-very-nice solution could be to copy the required
functionality, mainly the browseTo operation and the
findTreePathForElement(final EObject eObject) that the first function uses.

Independ of the selection/browseTo, it would also be nice to add visual
error markers to the model elements, in the model explorer (as done for
a Java source tree) and on the diagrams, with tooltips showing the error
message.

Best regards

-- 
Ansgar Radermacher                CEA/DRT/DILS/LISE
http://www-list.cea.fr/index.htm
http://www2.cs.unibw.de/alumni/Ansgar/
phone: +33 16908 3812
mailto: ansgar.radermacher@xxxxxx



Back to the top