Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Customizing the Sirius tab bar for 3.x
Customizing the Sirius tab bar for 3.x [message #1772989] Tue, 19 September 2017 19:28 Go to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
I checked out the documentation for customizing the Sirius tab bar here:

https://www.eclipse.org/sirius/doc/developer/extensions-provide_tabbar_extensions.html

But this extension point does not look like it's available for Sirius 3.x. If this is true, is there another extension that I should be looking for?

On a secondary note, is there any documentation for modifying the right-click menu options?
Re: Customizing the Sirius tab bar for 3.x [message #1773037 is a reply to message #1772989] Wed, 20 September 2017 14:45 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

Regarding the tabbar, you have no way to customizing it in 3.x. There is no alternative.
Regarding right click menu modification, there is no Sirius documentation.
This kind of modification is done with the GMF extension point org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders so you have access to this extension point documentation.
You can see some example in Sirius and GMF in org.eclipse.sirius.diagram.ui and in GMF in org.eclipse.gmf.runtime.diagram.ui.providers plugin.xml file.
Check GMF documentation for eventual additional information about it.

Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Customizing the Sirius tab bar for 3.x [message #1773045 is a reply to message #1773037] Wed, 20 September 2017 18:33 Go to previous messageGo to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
Pierre,
Thanks for that input. Re: the right click menu, can we remove existing contribution items (e.g. items provided by the internal Sirius framework) using the GMF extension point? Our customer does not want some of the items to be available.

-Chris
Re: Customizing the Sirius tab bar for 3.x [message #1773081 is a reply to message #1773045] Thu, 21 September 2017 09:13 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

Yes you can.

A simple example removing the GMF cut action and the Sirius paste layout action:

index.php/fa/30783/0/

    <contributionItemProvider
            class="org.eclipse.sirius.diagram.ui.internal.providers.SiriusContributionItemProvider"
            checkPluginLoaded="false">
         <Priority name="Medium"/>
        <popupContribution class="org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider">
            <popupStructuredContributionCriteria  objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart"/>
             <popupPredefinedItem
                   id="cut"
                   path="/editMenu/copyGroup"
                   remove="true"/>
             <popupPredefinedItem
                   id="pasteLayoutAction"
                   path="/editMenu/copyFormatGroup"
                   remove="true"/>
          </popupContribution>            
       </contributionItemProvider>


What is important with this extension mechanism is the priority system.
You want to remove action declared by sirius <contributionItemProvider class="org.eclipse.sirius.diagram.ui.internal.providers.SiriusContributionItemProvider"> <Priority name="Low" /> in org.eclipse.sirius.diagram.ui

So your contribution must have a higher priority than the sirius one that is Low
A higher priority means your contribution will be handled after the contribution with a lower priority.

Regards,

Pierre






Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

[Updated on: Thu, 21 September 2017 16:13]

Report message to a moderator

Re: Customizing the Sirius tab bar for 3.x [message #1773361 is a reply to message #1773081] Tue, 26 September 2017 19:50 Go to previous messageGo to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
Pierre,

I don't see the referenced extension point being contributed by org.eclipse.sirius.diagram.ui. Is this available in Sirius 3.x?

Chris
Re: Customizing the Sirius tab bar for 3.x [message #1773386 is a reply to message #1773361] Wed, 27 September 2017 08:01 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi Chris,

I checked in the plugin.xml of plugin org.eclipse.sirius.diagram.ui for org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders in Sirius 3.1.9 and the contributions are available.

What exact version do you have?

Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Customizing the Sirius tab bar for 3.x [message #1773416 is a reply to message #1773386] Wed, 27 September 2017 16:15 Go to previous messageGo to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
Pierre,

Your follow-up helped me to make a correction to the extension point and I was able to remove some items via your example. While several popup actions are predefined in this manner, some (e.g. show/hide label) are wired through command ids and property testers. Not sure if there's any way to remove those from the menu.

Also, in addition to "popupContribution", I noticed there was a "partContribution" which provided access to a predefined toolbar item (e.g. 'makeSameSizeBothAction'), but I didn't see any others that were accessible in this format.

-Chris





Re: Customizing the Sirius tab bar for 3.x [message #1773475 is a reply to message #1773416] Thu, 28 September 2017 13:11 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
You can use activities to hide some actions: http://codeandme.blogspot.com/2011/09/hiding-ui-elements-in-rcp.html

For example to hide the hide/show action,
 <extension
         point="org.eclipse.ui.activities">
      <activity
            id="myActivity"
            name="%activityName">
      </activity>
      <activityPatternBinding
            activityId="myActivity"
            isEqualityPattern="false"
            pattern="org.eclipse.sirius.diagram.ui.selectHiddenElementsAction">
      </activityPatternBinding>
   </extension>


Part contributions are for top menu:
index.php/fa/30865/0/

What is not defined in Sirius plugin is defined in GMF plugins.

Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Customizing the Sirius tab bar for 3.x [message #1773590 is a reply to message #1773475] Fri, 29 September 2017 18:16 Go to previous messageGo to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
Interesting. I saw "selectHiddenElementsAction" defined in the org.eclipse.sirius.diagram.ui > plugin.xml but I'm not sure how you were able to infer the complete id path? I can't use Plugin Spy on our product because the build does not include the source files. The spy only works on the IDE.
Re: Customizing the Sirius tab bar for 3.x [message #1773643 is a reply to message #1773590] Mon, 02 October 2017 08:11 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
To be able to use Spy you can just download an ObeoDesigner Community package just to identify actions with an ecore Sirius diagram. Most of the actions if not all should have not change across versions.

To get the path I used spy but you can just read the plugin xml and try it with activities. At first it did not work with selectHiddenElementsAction so I tried prefixed by the plugin name and it worked. Whether you have the isEqualityPattern to true or false also change the way you must specify the pattern.

The general rules are unclear to me for the moment.


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Customizing the Sirius tab bar for 3.x [message #1773672 is a reply to message #1773643] Mon, 02 October 2017 16:34 Go to previous messageGo to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
Setting isEqualityPattern to false seems to be the way to go unless we know the exact path. Unfortunately, that pattern had no effect on removing the Show/Hide menu option in my case. As stated earlier "selectHiddenElementsAction" is clearly defined in the org.eclipse.sirius.diagram.ui dependency.
Re: Customizing the Sirius tab bar for 3.x [message #1773717 is a reply to message #1773672] Tue, 03 October 2017 13:16 Go to previous message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,
To hide the menu you just have to hide all its action.
By using spy like I describe above I ended with these extension:
    <extension
         point="org.eclipse.ui.activities">
      <activity
            id="myActivity"
            name="%activityName">
      </activity>
            <activityPatternBinding
            activityId="myActivity"
            isEqualityPattern="true"
            pattern="org.eclipse.sirius.diagram.ui/org.eclipse.sirius.diagram.ui.command.hideElement">
      </activityPatternBinding>
      <activityPatternBinding
            activityId="myActivity"
            isEqualityPattern="true"
            pattern="org.eclipse.sirius.diagram.ui/org.eclipse.sirius.diagram.ui.command.hideLabel">
      </activityPatternBinding>
   </extension>

and the same thing with equalitypattern to false:

<extension
         point="org.eclipse.ui.activities">
      <activity
            id="myActivity"
            name="%activityName">
      </activity>
            <activityPatternBinding
            activityId="myActivity"
            isEqualityPattern="false"
            pattern="org.eclipse.sirius.diagram.ui.org.eclipse.sirius.diagram.ui.command.hideElement">
      </activityPatternBinding>
      <activityPatternBinding
            activityId="myActivity"
            isEqualityPattern="false"
            pattern="org.eclipse.sirius.diagram.ui.org.eclipse.sirius.diagram.ui.command.hideLabel">
      </activityPatternBinding>
      

   </extension>


Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Move the node with the arrow key to jump to the position of the mouse
Next Topic:Overriding Sirius undo/redo
Goto Forum:
  


Current Time: Tue Dec 03 09:43:55 GMT 2024

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

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

Back to the top