-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for selection changes in views #84
Comments
The current design allows diagramTextProviders to say they support a specific editor and optionally its selection. It sounds easy to extend this to also cover views (IWorkbenchPart in general), but I haven't looked at the details. The relevant code is in net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView, where an IPartListener triggers updating the diagram text. There's several place where the code checks that the workbench part is an editor, it may just work removing the checks and changing some types from IEditorPart to IWorkbenchPart. I'm not sure if parts contribute selection providers to the site, so the selection listener logic may need to be extended. |
Thanks for the quick answer! I suspected as much. This would be a pretty deep change and will probably require extensive testing. I'll see what I can do and send a pull request if I come up with something. |
https://www.eclipse.org/articles/Article-WorkbenchSelections/article.html suggests views also contribute selections through the site's selection service, so that part of the current design should just work. |
I have made some progress on this and you can see my WIP here. When I activate a view (such as the Project Explorer or the Package Explorer), the generation of diagrams is now triggered. I have not yet managed to get changes in the selections to work. The listener is triggered, but the change is not reflected in the diagram. However, if I leave the view and return, the update happens. I suspect that this has to do with At this point, I'd be happy if you could have a look at the changes, maybe test them with your test rig, and let me know what you think. |
We have also PlantUML output generated in views e.g. in console view from some tool. How can we help with testing? Do you have a plugin build for install and test? Thanks! |
text consoles. Preference page for diagram text provider enablement.
Close, should be fixed in release 1.1.23 |
I have a use case in which I want to regenerate the diagram when the selection in the project explorer changes. Since the project explorer is not an editor, changes in this view are not captured by
PlantUmlView
out of the box.I have managed to implement a very hacky way of achieving what I want by extending
PlantUmlView
and overwritingupdateDiagramText(boolean, IWorkbenchPart, ISelection)
and exposing the list ofDiagramTextProvider
s viaPlantUmlUtil
. However, this hardly feels like the best way to do it and I wonder if there is a more elegant solution.I imagine other use cases such as creating a class diagram on selecting a package in the package explorer.
Any ideas for how to achieve this?
The text was updated successfully, but these errors were encountered: