Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu contributions to PlantUML view no longer possible #87

Closed
steghoja opened this issue Mar 7, 2019 · 6 comments
Closed

Menu contributions to PlantUML view no longer possible #87

steghoja opened this issue Mar 7, 2019 · 6 comments

Comments

@steghoja
Copy link

steghoja commented Mar 7, 2019

In previous versions of PlantUML, it was possible to extend the menu in the action bar like this:

<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:net.sourceforge.plantuml.eclipse.views.PlantUmlView?after=additions">
...

The changes introduced in 94a1291 prevent this since menu.setRemoveAllWhenShown(true); is set in PlantUmlView.java, line 265. This means that the menu contributions disappear.

Suggested solution:
An alternative solution is to define the action bar menu contributions of the PlantUmlView in the plugin.xml. This way, additions by others are maintained.

@hallvard
Copy link
Owner

hallvard commented Mar 7, 2019

I didn't consider that possibility, I'm sorry! It may be possible to add such contributions programmatically, below the diagram items, e.g. using techniques exemplified here: https://wiki.eclipse.org/Menu_Contributions/Problems_View_Example. Alternatively, I could move the diagram items to a toolbar dropdown.

@hallvard
Copy link
Owner

hallvard commented Mar 7, 2019

@steghoja
Copy link
Author

steghoja commented Mar 7, 2019

I experimented with this a bit and in particular with the solution provided at: https://www.vogella.com/tutorials/EclipseCommandsAdvanced/article.html#defining-commands-at-runtime

Unfortunately, this did not work. It seems like the menu ID I am using is incorrect. I used to be able to add contributions for menu:net.sourceforge.plantuml.eclipse.views.PlantUmlView but that locationURI is no longer working. If I look at the MenuManager that is returned by getViewSite().getActionBars().getMenuManager(), it's ID is null.

By the way, while I see the little triangle that indicates that there should be an action bar menu, clicking on this does not show a menu, even in the vanilla PlantUML view.

@hallvard
Copy link
Owner

hallvard commented Mar 7, 2019

The menu is (supposed to be) cleared and (re)populated with the diagrams found in the current editor when you click it (given that the editor supports iterating over alle diagrams). If no diagrams are provided, the menu is empty.

@steghoja
Copy link
Author

steghoja commented Mar 7, 2019

Right, I figured that out now after stepping through the execution. The problem remains that adding new menu contributions, regardless of how is being undone due to menu.setRemoveAllWhenShown(true);. I have found a workaround for this and will send a pull request shortly.

steghoja pushed a commit to steghoja/plantuml that referenced this issue Mar 7, 2019
Starting with PlantUml 1.1.22, the PlantUmlView removed all menu items
after the menu was shown. This commit changes this behaviour: only those
menu items added programmatically are removed. This allows other plugins
to make menu contributions to the PlantUmlView.
hallvard added a commit that referenced this issue Mar 31, 2019
Avoid clearing menu items (fixes issue #87)
hallvard added a commit that referenced this issue Apr 3, 2019
text consoles. Preference page for diagram text provider enablement.
@hallvard
Copy link
Owner

hallvard commented Apr 4, 2019

Close, should be fixed in release 1.1.23

@hallvard hallvard closed this as completed Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants