Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Registering New Diagram Extensions
Registering New Diagram Extensions [message #1723454] Mon, 15 February 2016 18:43 Go to next message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Hello,
Is it possible to register new diagram extensions programmatically in an already created diagram file without having to delete the diagram and create a new one.

We want to deploy new functionality (new palette tools) into the users diagram with out them having to recreate the diagram to pull in the new diagram extensions.

Thank you,
Bailey


Re: Registering New Diagram Extensions [message #1723716 is a reply to message #1723454] Wed, 17 February 2016 10:56 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello Bailey,

If you add the diagram extensions in a new odesign file (and therefore a
new Viewpoint), once deployed, the user should only have to activate the
new viewpoint to have access to your new palette tools.

How do you deploy new functionalities? If you build an update site with
a feature containing your odesign and identified with a newer version
number, you should be able to install it and avoid having diagram
extensions.

Regards,
Steve

Le 15/02/2016 19:43, Bailey Trenton a écrit :
> Hello,
> Is it possible to register new diagram extensions programmatically in
> an already created diagram file without having to delete the diagram and
> create a new one.
>
> We want to deploy new functionality (new palette tools) into the users
> diagram with out them having to recreate the diagram to pull in the new
> diagram extensions.
>
> Thank you,
> Bailey
>
>
>


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Registering New Diagram Extensions [message #1723724 is a reply to message #1723716] Wed, 17 February 2016 11:18 Go to previous messageGo to next message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Steve,
I was wondering how you select new viewpoints programmatically. Currently, after they install the new plugin with the new viewpoint specification and restart, I use a recording command and a ViewpointSelector to select the new viewpoint. This gets called from a SessionManagerListener during the notifyAdd method. This works the first time through and I am able to drag the new tools onto the diagram. However, if I restart my RCP application the tool remains on the palette but doesn't function any more, meaning that when I drag from the palette onto the diagram nothing gets drawn.

Do I have to do something different if I select new ViewPoints programmatically?

Thanks for you response.
Bailey



Re: Registering New Diagram Extensions [message #1723734 is a reply to message #1723724] Wed, 17 February 2016 13:04 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Bailey,

You can use
org.eclipse.sirius.business.api.session.ViewpointSelector.selectViewpoint(Viewpoint
viewpoint, boolean createNewRepresentations, IProgressMonitor monitor).
To find your Viewpoint model element, you can access the registry
ViewpointRegistry.getInstance().getViewpoints().

There is also a Recording available named ChangeViewpointSelectionCommand.

Regards,
Steve

Le 17/02/2016 12:18, Bailey Trenton a écrit :
> Steve,
> I was wondering how you select new viewpoints programmatically.
> Currently, after they install the new plugin with the new viewpoint
> specification and restart, I use a recording command and a
> ViewpointSelector to select the new viewpoint. This gets called from a
> SessionManagerListener during the notifyAdd method. This works the
> first time through and I am able to drag the new tools onto the
> diagram. However, if I restart my RCP application the tool remains on
> the palette but doesn't function any more, meaning that when I drag from
> the palette onto the diagram nothing gets drawn.
>
> Do I have to do something different if I select new ViewPoints
> programmatically?
> Thanks for you response.
> Bailey
>
>
>
>


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Registering New Diagram Extensions [message #1723747 is a reply to message #1723734] Wed, 17 February 2016 15:16 Go to previous messageGo to next message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Steve,
I do use the ViewpointSelector as the way to choose my new viewpoints that I get from the ViewpointRegistry. I am trying to stay away from non-API/internal code so I don't want to use the ChangeViewpointSelectionCommand. I noticed in that command that it sorts the viewpoints, does the order of the viewpoints in the diagram file matter? I noticed that after I save the diagram with the new viewpoints activated, it saves them at the bottom of the diagram file under all the other viewpoints specified, but if I delete my old diagram and create a new one, the new viewpoints appear at the top. My new viewpoints are all diagram extensions if that makes a difference.

Also is my updating the selected viewpoints in the SessionManagerListener notifyAdd() method the best place or is there some other place that would be better?

Thanks,
Brian
Re: Registering New Diagram Extensions [message #1723755 is a reply to message #1723747] Wed, 17 February 2016 16:14 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hi Bailey,

Ok I probably read your other message to fast, you can stay on your
solution with ViewpointSelector and ViewpointRegistry then.

If I understood correctly your use case,
SessionManagerListener.notifyAdd() is the proper way to trigger the
Viewpoint selection programatically.

I am not sure why the serialization works this way with diagram
extensions, but I can look into it. Did you experience any issue with that?

Regards,
Steve

Le 17/02/2016 16:16, Bailey Trenton a écrit :
> Steve,
> I do use the ViewpointSelector as the way to choose my new viewpoints
> that I get from the ViewpointRegistry. I am trying to stay away from
> non-API/internal code so I don't want to use the
> ChangeViewpointSelectionCommand. I noticed in that command that it
> sorts the viewpoints, does the order of the viewpoints in the diagram
> file matter? I noticed that after I save the diagram with the new
> viewpoints activated, it saves them at the bottom of the diagram file
> under all the other viewpoints specified, but if I delete my old diagram
> and create a new one, the new viewpoints appear at the top. My new
> viewpoints are all diagram extensions if that makes a difference.
> Also is my updating the selected viewpoints in the
> SessionManagerListener notifyAdd() method the best place or is there
> some other place that would be better?
>
> Thanks,
> Brian


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Registering New Diagram Extensions [message #1723760 is a reply to message #1723755] Wed, 17 February 2016 16:58 Go to previous messageGo to next message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Steve,
It works the first time the diagram comes up after activating my new viewpoint. I am able to drag the new tool and it draws on the diagram. The problem is that if I shutdown my RCP application and start it back up again, the tool no longer works. It shows up on the palette but doesn't work. I have checked that the new plugin is activated and it appears to be. Any thought?

Thanks,
Brian
Re: Registering New Diagram Extensions [message #1723763 is a reply to message #1723760] Wed, 17 February 2016 17:27 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
I do not really see what could cause this kind of behaviour. Do you have
an exception when you try to use the tool?

Sorry to ask again, but as the user need to deploy the new diagram
extensions, why don't you deploy a new version of the odesign with the
additional tools?

Regards,
Steve

Le 17/02/2016 17:58, Bailey Trenton a écrit :
> Steve,
> It works the first time the diagram comes up after activating my new
> viewpoint. I am able to drag the new tool and it draws on the
> diagram. The problem is that if I shutdown my RCP application and
> start it back up again, the tool no longer works. It shows up on the
> palette but doesn't work. I have checked that the new plugin is
> activated and it appears to be. Any thought?
>
> Thanks,
> Brian


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Registering New Diagram Extensions [message #1723764 is a reply to message #1723763] Wed, 17 February 2016 18:04 Go to previous messageGo to next message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Steve,
No exceptions get thrown that I can see. They may be being caught somewhere where I can't see them. Since I can only test this functionality in a exported RCP and not in the debugger, I am out of luck in seeing exceptions that are not thrown to the console.

The only thing I can see that is different between me adding the new viewpoint to an existing diagram and creating a new diagram with the new viewpoints in the order they are listed in the diagram file. I think you said you can check on whether or not the order matters in the diagram? And if it does, is there a way I can control the order?

The reason is that we want the user to be able to customize their diagram with only the tools they need and since every user may need a different set we can't generate different odesigns for each potential user. Additionally we want them to be able to install new tool to use in their existing diagram from other plugins.

Thanks,
Bailey
Re: Registering New Diagram Extensions [message #1723804 is a reply to message #1723764] Thu, 18 February 2016 07:58 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Bailey,

I do not think that the issue is caused by the serialization, as far as
I know the DiagramContainers are created in the order of the viewpoint
activation. What I mean by that is that the order in which the viewpoint
and diagram are serialized should not really matter for Sirius.

It is unfortunate that you can reproduce the issue only with the
exported RCP, not in debug. The new viewpoint is accessible in the
ViewpointRegistry, but how is deployed the new odesign in the RCP? Is it
every tool that are unusable after restart or maybe only creation tools?
Are the tools using external java services or something that could be
not properly loaded when you restart?

Regards,
Steve

Le 17/02/2016 19:04, Bailey Trenton a écrit :
> Steve,
> No exceptions get thrown that I can see. They may be being caught
> somewhere where I can't see them. Since I can only test this
> functionality in a exported RCP and not in the debugger, I am out of
> luck in seeing exceptions that are not thrown to the console.
> The only thing I can see that is different between me adding the new
> viewpoint to an existing diagram and creating a new diagram with the new
> viewpoints in the order they are listed in the diagram file. I think
> you said you can check on whether or not the order matters in the
> diagram? And if it does, is there a way I can control the order?
>
> The reason is that we want the user to be able to customize their
> diagram with only the tools they need and since every user may need a
> different set we can't generate different odesigns for each potential
> user. Additionally we want them to be able to install new tool to use
> in their existing diagram from other plugins.
>
> Thanks,
> Bailey


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Registering New Diagram Extensions [message #1724537 is a reply to message #1723804] Wed, 24 February 2016 13:19 Go to previous message
Bailey Trenton is currently offline Bailey TrentonFriend
Messages: 31
Registered: May 2015
Member
Steve,
The viewpoint is deployed as a diagram extension in a different Eclipse PDE plugin(jar) . I have checked dependencies and those seem to be fine. I would figure they would blow up the first time if they were wrong anyway. I checked the order thing and you are correct, it doesn't matter. I thought it was behaving different depending on order but I was mistaken.

They are only creation tools that are being added and that don't work. The creation tools that come with the base diagram still work it is just the new ones supplied by the extension plugins that are not working.

They are using an external java action call referencing a class that is provided by the base diagrams plugin. That could be the issue if that is not loaded but I figured that would be loaded by the diagram when it is started but maybe not. I will look into that more.

Thanks,
Bailey
Previous Topic:Layout nodes in container in tree programmatically
Next Topic:Edge Customization Smoothness
Goto Forum:
  


Current Time: Thu Mar 28 12:37:47 GMT 2024

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

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

Back to the top