PrestigeDev
PrestigeDev

Reputation: 627

Add additional behaviour to existing Eclipse button?

I would like to add additional behaviour to an existing button in the Eclipse ide with a plugin. To have an example, I would like to print to standard out each time the "Remove Launch" button in the console view gets pressed (see image).enter image description here

Should I find and override/extend the corresponding, existing Handler with my logic?

Should I work with the these extensions?

ConsoleView extension locationURI="toolbar:org.eclipse.ui.console.ConsoleView"

Commands extension: "org.eclipse.ui.commands"

Upvotes: 0

Views: 44

Answers (1)

greg-449
greg-449

Reputation: 111142

There isn't a general way to hook in to existing actions.

For Remove Launch you can set up a listener to be notified of removed launches by using the ILaunchManager:

ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();

launchManager.addLaunchListener(listener);

The listener is an ILaunchesListener which has a launchesRemoved method that will be called when a launch is removed.

Upvotes: 2

Related Questions