Skip to main content



      Home
Home » Eclipse Projects » Sirius » No dialects avaliable when creating representation programmatically
No dialects avaliable when creating representation programmatically [message #1700511] Fri, 03 July 2015 03:22 Go to next message
Eclipse UserFriend
Hi all,

I'm trying to create a representation programatically, but when debugging I find that no dialects are avaliable to create the representation from and hence, no representation is created.

I can activate my viewpoint just fine, so that is not the problem.

How can I create the representation in code? What I try to do now is:

session.getTransactionalEditingDomain().getCommandStack().execute(
						new RecordingCommand(session.getTransactionalEditingDomain()) {
					
					@Override
					protected void doExecute() {					
						VisualizationRepresentationDescription description = new VisualizationRepresentationDescription(semanticRoot);
						DRepresentation representation = DialectManager.INSTANCE.createRepresentation("test", semanticRoot, description, session, new NullProgressMonitor());
						DialectUIManager.INSTANCE.openEditor(session, representation, nprMonitor);
					}
					
				});


where VisualizationRepresentationDescription is a class that I have written which implements the interface RepresentationDescription. semanticRoot is the root EObject.

What might be wrong?

Regards,
Axel Niklasson
Re: No dialects avaliable when creating representation programmatically [message #1700512 is a reply to message #1700511] Fri, 03 July 2015 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Debugged some more, found that in the method EclipseUtil.getExtensionPlugins(), nothing is returned. Is that where the Dialects are supposed to be loaded from?

[Updated on: Fri, 03 July 2015 03:38] by Moderator

Re: No dialects avaliable when creating representation programmatically [message #1700516 is a reply to message #1700511] Fri, 03 July 2015 03:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Did you notify the session manager listeners of a representation creation?

SessionManager.INSTANCE.notifyRepresentationCreated(createdSession);

and after that save the session,

createdSession.save(monitor);

and I suppose that after this code you could open the diagram. I'm not an expert, hope that this helps.

Cheers,
Anthony


Re: No dialects avaliable when creating representation programmatically [message #1700523 is a reply to message #1700511] Fri, 03 July 2015 04:39 Go to previous messageGo to next message
Eclipse UserFriend
Hi Axel,

Le 03/07/2015 09:22, Axel Niklasson a écrit :
> Hi all,
>
> I'm trying to create a representation programatically, but when
> debugging I find that no dialects are avaliable to create the
> representation from and hence, no representation is created.
>
> I can activate my viewpoint just fine, so that is not the problem.
>
> How can I create the representation in code? What I try to do now is:
>
> session.getTransactionalEditingDomain().getCommandStack().execute(
> new
> RecordingCommand(session.getTransactionalEditingDomain()) {
>
> @Override
> protected void doExecute() {
> VisualizationRepresentationDescription
> description = new VisualizationRepresentationDescription(semanticRoot);
> DRepresentation representation =
> DialectManager.INSTANCE.createRepresentation("test", semanticRoot,
> description, session, new NullProgressMonitor());
> DialectUIManager.INSTANCE.openEditor(session,
> representation, nprMonitor);
> }
>
> });
>
> where VisualizationRepresentationDescription is a class that I have
> written which implements the interface RepresentationDescription.
> semanticRoot is the root EObject.

It seems you have defined a ne representation description kind but
without the creation of your own ecore model to define it like it is
done for the Diagram, Table, Tree dialects and Sequence diagram type.


>
> What might be wrong?

Sirius does not know your representation description:
. how to compute the concrete representation from your description and
semantic model ?
. how to open it in an editor ? which editor ?
. how to define it in the VSM (Viewpoint Specification Model, .odesign
file) editor ?

If you want to provide this new representation kind, you also have to
provide a dialect / dialect ui able to handle it:
. see DialectServices (and the existing implementations:
DiagramDialectServices, TableDialectServices, TreeDialectServices) which
provides services to create/store/refresh the representation model
computed from the representation description on the semantic model.
. see DialectUIServices (and the existing implementations:
DiagramDialectUIServices, TableDialectUIServices, TreeDialectUIServices)
which provides services to complete the VSM editor, open/close the
dialect specific editor, ..
.see also the IDiagramDescriptionProvider which allows to provide new
diagram types without redefining a new diagram dialect. It can be used
(as in Sequence, see SequenceDiagramTypeProvider) to configure the
DDiagramEditor for specific needs (specific DiagramDescription,
additional tools and mappings, diagram header, pin/unpin and other
action support enablement, ..). It allows to let the DiagramDialect to
manage the computation of the Sirius internal diagram model and its GMF
model but extends its capabilities.

Then you have the corresponding extension points:
. org.eclipse.sirius.dialect
. org.eclipse.sirius.ui.dialectui
. org.eclipse.sirius.diagram.diagramTypeProvider



> Regards,
> Axel Niklasson

Regards

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: No dialects avaliable when creating representation programmatically [message #1700840 is a reply to message #1700523] Tue, 07 July 2015 10:14 Go to previous message
Eclipse UserFriend
This was 100% my mistake, the problem ocurred due to the package where the dialects resided wasn't being loaded correctly. Thanks anyway guys!
Previous Topic:Using types from additional MetaModels
Next Topic:Attach EObject to Sirius Session
Goto Forum:
  


Current Time: Tue May 20 11:56:53 EDT 2025

Powered by FUDForum. Page generated in 0.04648 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top