Thanks to Paul and Souhad we now have a Configurable menubar, toolbar system for menus and toolbars. This means that plugins can add their own menu items and toolbar buttons to the gui.

Current activation logic

The plugin remains responsible to add its own toolwindows to the view. For example the Projectexplorer plugin adds the project treeview in the ProjectExplorerPluginGui.Activate method:

        public void Activate()
        {
                 ..            
            //add project treeview as a toolwindowview.
            gui.ToolWindowViews.Add(projectTreeView, ViewLocation.Left, "Project Explorer", null);
                 ..
        }

Currently menus and toolbars from the plugin are added using the following method:

     IMainWindow.AddPluginGuiCommands(IPlugin plugin, IPluginGui pluginGui)

Currently this implies that menu's and toolbars will only be added to the MainWindow of your application. This method may have to be moved later on when we want to enable more flexibility to adding context menus to other parts of the gui.
The AddPluginGuiCommands method reads an xml config file belonging to the plugin. This solution seems to work although it looks a bit ugly. I guess this kind of functionality does not belong in a view.

Suggestions for Activation and Deactivation of Plugin

Plugin and PluginGui both implement activate and deactivate methods. Deactivation of plugin functionality is not implemented. A plugin should be responsible for cleaning up memory by disposing of objects created in the Activate method of either the pluginGUI or plugin.

I looked at the activation deactivation in Visual Studio. Visual studio expects the plugin to clean up its mess. This does not work satisfactory: a plugin like MZTools removes its menu (as you would expect) but plugins like AnkSVN and Resharper do not. The VS program needs to be restarted in order for the changes to menus and toolbars to take place. Therefore allowing for plugins to manage this does not seem a good solution.

Therefore I would like to suggest the following Activate/Deactivate scenario: Rebuild menus and toolbars by querying all plugins for menuitems and toolbar items for plugins with PluginGui.IsActive == true. (currently implemented in DelftShell.InitializeMenusAndToolbars)

In addition the logic for querying Viewproviders and modelproviders should be extended with knowledge about active status of plugins.

  • No labels

1 Comment

  1. Unknown User (alwan)

    Eclipse works as follows: a list of all plug-ins (features) is used and Disable/Enable options are provided.

    If the state of a plug-in would be changed, then the user can agree to restart the application in order that the change would take effect.