Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » running "external tools" from context menu
running "external tools" from context menu [message #670185] Fri, 13 May 2011 00:44 Go to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
Hi,

I created "external tools" program that uses any selected resource (${resource_loc}).
Currently in order to invoke it the following should be done:
* Select a resource (file / directory ...)
* Using "external tools" drop menu / run -> external tools -> ... / ALT R+E

I would like to have a context menu that will invoke this "external tools" program. It should work on any resource inside a project.

I would appreciate any suggestion / comments.

Thanks a lot,
Yevgeny
Re: running "external tools" from context menu [message #670294 is a reply to message #670185] Fri, 13 May 2011 12:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you bind a key to Run Last Launched External Tool then you can use that to run your external program. Because it runs the last launched, it would be less effective if you have a lot of external tools that you use.

You can set the key binding at Preferences>General>Keys

PW


Re: running "external tools" from context menu [message #670495 is a reply to message #670294] Sat, 14 May 2011 13:12 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
Hi PW,

Thank you for your reply, but this is not what I am looking for Sad

I would like to be able to run external tool using context menu (right click) on any resource (file or directory) in my C/C++ project.

Thanks,
Yevgeny
Re: running "external tools" from context menu [message #670989 is a reply to message #670495] Mon, 16 May 2011 13:09 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

With the correct external tool launch config (containing ${selected_resource_loc}), then selecting a resource and then a keybinding and your external tool will be run on your current selection.

Which part are you not looking for, exactly? The fact that the keybinding only launches the last one, because you have more than one external tool? As you launch more than one external tool, that information becomes available in the external tool dropdown (which would allow you to drop down the menu and select from more than one).

Or the part where you mention a context menu? That's just not available, and is only an aid to executing a command in the first place.

PW


Re: running "external tools" from context menu [message #671486 is a reply to message #670989] Wed, 18 May 2011 05:33 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
Paul Webster wrote on Mon, 16 May 2011 09:09
With the correct external tool launch config (containing ${selected_resource_loc}), then selecting a resource and then a keybinding and your external tool will be run on your current selection.

Which part are you not looking for, exactly? The fact that the keybinding only launches the last one, because you have more than one external tool? As you launch more than one external tool, that information becomes available in the external tool dropdown (which would allow you to drop down the menu and select from more than one).

Or the part where you mention a context menu? That's just not available, and is only an aid to executing a command in the first place.

PW


Hi PW,

I am interested in the "context menu" part. The rest I was able to do. Because my external tool configuration uses ${selected_resource_loc}, it is much more intuitive to use context menu on a resource. I can implementing context menu myself, but how do I connect it to existing external tool configuration?

Thanks a lot,
Yevgeny
Re: running "external tools" from context menu [message #671631 is a reply to message #671486] Wed, 18 May 2011 14:22 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you are implementing it yourself, you can look at some of the debug APIs. You might be able to find your launch config from there.

Here's a starting place (finds one launch config and runs it):

final ILaunchManager launchManager = DebugPlugin.getDefault()
		.getLaunchManager();
ILaunchConfiguration toLaunch = null;
for (ILaunchConfiguration config : launchManager
		.getLaunchConfigurations()) {
	System.out.println(config.getName());
	if (config.getName().equals("RunAway")) {
		toLaunch = config;
	}
}
if (toLaunch!=null) {
	DebugUITools.launch(toLaunch, ILaunchManager.RUN_MODE);
}


If you were writing a command that takes a parameter, you would be able to add different launch configs to the context menu. If it provides an org.eclipse.core.commands.IParameterValues, you would be able to bind keys to more than one launch config using Preferences>General>Keys as well.

PW


[Updated on: Wed, 18 May 2011 14:23]

Report message to a moderator

Re: running "external tools" from context menu [message #671836 is a reply to message #671631] Thu, 19 May 2011 06:45 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
Thank you for the help, I will give it a try.

Yevgeny
Re: running "external tools" from context menu [message #1834430 is a reply to message #671836] Tue, 10 November 2020 09:05 Go to previous message
mirza zubair baig is currently offline mirza zubair baigFriend
Messages: 1
Registered: August 2019
Junior Member
are you successfully built the context menu button for external tools? i have the same requirement,
Previous Topic:hideView() no longer working after 64-bit migration
Next Topic:Force editor to (re)validate/refresh
Goto Forum:
  


Current Time: Mon Dec 09 06:50:46 GMT 2024

Powered by FUDForum. Page generated in 0.04472 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top