Home » Eclipse Projects » Sirius » No dialects avaliable when creating representation programmatically
No dialects avaliable when creating representation programmatically [message #1700511] |
Fri, 03 July 2015 07:22 |
Axel Niklasson Messages: 11 Registered: June 2015 |
Junior Member |
|
|
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 #1700523 is a reply to message #1700511] |
Fri, 03 July 2015 08:39 |
|
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
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Goto Forum:
Current Time: Thu Apr 18 22:55:11 GMT 2024
Powered by FUDForum. Page generated in 0.02577 seconds
|