|
|
Re: How to open the editor on given element in given diagram ? [message #1724371 is a reply to message #1724306] |
Tue, 23 February 2016 11:50 |
|
Hi, András,
A bit of care is needed, here. The notation resource can also have as roots:
* tables, instances of the NattablePackage.Literals.TABLE class
* embedded stylesheets, instances of the
StylesheetsPackage.Literals.STYLESHEET class
and possibly other things (I think I've seen other objects, but I
forget what). In any case, some judicious filtering of the resource's
contents is recommended.
Coming in the M6 milestone of the Neon release will be a new API of the
IEMFModel interface (which the NotationModel implements): the
getRootElements() operation provides an iteration of all the logical
roots of the model, which in this case is notations. That includes
both diagrams and tables, but not other things like stylesheets. So,
some filtering still needed, but perhaps your use case does actually
need to account for tables, too (I don't know).
Cheers,
Christian
On 2016-02-22 23:47:57 +0000, András Dobreff said:
> Hi!
>
> I can list the existing diagrams with the following function
>
>
> public List<Diagram> getDiagrams(){
> try{
> Resource notationResource;
> notationResource =
> NotationUtils.getNotationModel(this.editor.getServicesRegistry().getService(ModelSet.class)).getResource();
>
> @SuppressWarnings("unchecked")
> List<Diagram> list = (List<Diagram>)(List<?>)
> notationResource.getContents();
> return list;
> }catch(ServiceException e){
> throw new RuntimeException(e);
> }
> }
>
>
> Here the editor is your IMultiDiagramEditor instance.
>
> András
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03769 seconds