This is a feature request following a discussion on the mailinglist (https://sourceforge.net/p/mitk/mailman/message/34984754/). The summary is my personal point of view, everybody is invited to add theirs.
Thanks to anybody working on this!
Feature
Provide a way to add actions to Data Manager's context menu. The current implementation has limitations that make it hard to use.
Current situation
QmitkNodeDescriptorManager: singleton in Module QtWidgets that holds (and allows addition of) icons and QAction lists for specific types (identified by a string).
org.mitk.gui.qt.datamanager: describes and uses a BlueBerry extension point "contextMenuActions" (class IContextMenuAction). QmitkDataManagerView does not use the full interface of IContextMenuAction but only serves a small number of hard-coded actions with specific calls to interface methods.
Limitations / Problems:
- IContextMenuAction requires implementation of methods SetSmoothed, SetDecimated, SetFunctionality which are overly-specific and not useful to most context menu actions
- IContextMenuAction provides a data storage only to hard-coded actions
- workaround: obtain a plugin context (difficult when you are not implementing a view), use IDataStorageService to find a data storage
- while some actions (all(?) actions that do not require UI input) could be implemented in a module, the current structure enforces a BlueBerry plugin. Otherwise one would neither get input data(!!) nor a data storage.
Desired features
- implementation of actions should be possible from modules, not only from plugins.
- micro services seem appropriate
- the context menu action interface should be generic, should not enforce implementation of methods that only some/few implementations can use
- data storage should be at least an optional parameter in the interface (allow nullptr). A data storage is useful to all actions that do not want to overwrite their input data.
- error handling should be specified. What shall failing actions do?
- throw an exception (my favorite)
- display a message dialog
- silently do nothing