Eclipse Menu Item to Exec Shell Command to Console - eclipse

Is is possible to create a custom menu item within eclipse that will perform a given shell command? I'm not looking to do a "run/debug" type thing, I want to simple shell out and run a given command. I am NOT looking to create a plugin either.

Right past Run/Debug, there is something called External Tools. It looks like a green play icon with a toolbox. You can set these up to run anything you like, and anything you add to favorites will appear in a drop down menu for easy execution in two clicks. This can be used to run batch scripts, so that may do the trick for you.
Here's a link to the Eclipse Helios page on external tools that may be useful.

There are already plugins for this, such as Wicked Shell

Or you should read this: http://douglasfils.blogspot.com/2007/07/terminal-shell-in-eclipse.html

Related

Eclipse keybindings. Setting up a shortcut for executing a specific run configuration

I'm trying to setup a key binding in Eclipse to directly execute a background Java file. My file is called CodeChecker.java and it's sufficient for my purposes to run the main method without any arguments. I need to run it repeatedly and so I'm trying to setup a shortcut key to run it directly without having to bring up the Run... menu or having to bring up the file itself.
As far as I'm aware Eclipse is not able to offer this functionality directly. I've tried using a plugin called Practically Macro according to this answer Assigning a keyboard shortcut for a specific Eclipse build configuration. But this answer is horribly out of date and doesn't work any longer.
So I'm wondering if Practically Macro can still be used to achieve this? Any other solution, plugin, script or otherwise would be equally welcome.

Shortcut for selecting run configuration in Eclipse IDE

I have an Eclipse workspace with a bunch of projects. I manually created some run configurations for each project (it's necessary to pass some arguments to VM, so I can't just run it directly, e.g. using shortcut ALT+SHIFT+X, T in the specific file).
Most of the time, I just use one run configuration (whereas for the first time I manually launch it using Run -> Run configurations -> (name) -> Run). Since I configured Eclipse to always run the last run configuration (on F11 or CTRL+F11), it's usually enough.
However, sometimes I need to switch to a different run configuration and then back to previous one and then to a different one etc. Is there a quick way to do it? I'd like to see a shortcut, which would display pop-up window with all existing run configurations. By typing first few letters, I'd find an appropriate one and would be able to immediately run it by pressing ENTER. I mean something similar to what CTRL+SHIFT+T or CTRL+SHIFT+R looks like.
I'm afraid there's not something like that. Nonetheless, any advice on how to get more effective would be greatly appreciated, because I'm bored of switching run configurations via menu (as I described above). I can press ALT+R, N and then select a run configuration using arrow keys, but it's not really that comfortable.
You already gave most of the answer yourself. Start by pressing ALT+R, N and then simply start typing the name of the configuration you want. The cursor should be positioned in the filter field and thus incrementally reduce the list of launch configurations as you type. When you've narrowed it down to 1, complete the selection by ALT+R.
BTW: thanks for the reminder, I, too, was using the mouse way too much in this particular use case. I will stop doing so, now that I gave the answer :)
Since Eclipse 4.12 (June 2019, 4 years later) you can also launch any of the Run or Debug configurations available in your workspace from... the Quick Access menu (Ctrl+3 shortcut)
Note: For performance reasons, the extra Quick Access entries are only visible if the org.eclipse.debug.ui bundle was already activated by some previous action in the workbench such as editing a launch configuration, or expanding the Run As... menus.

How I can organize run configuration in Eclipse?

In Eclipse, I have organize my favorite "run configurations" but I have a lot of favorite.
So I would like to know if a plugin exists that permit to create folders or sub-lists to have a better view and organization of my run configurations.
I would like this because when I click on the "arrow" near "Run" button on the top of the Eclipse toolbar I have a very long list and it's diffuclt to find quickly the "run configuration" that I want.
I hope somebody have an idea and can help me.
Thanks.
Sincerely,
Arnaud
There are some ways to help a little bit:
If you are more interested in the last started run configurations, these get a number. Number 1 is the last, number 2 the previous before and so on.
Press ALT-SHIFT-X followed by the type of run configuration (j for Java), and you get a list of run configurations. Type in the filter box, and select by cursor keys.
Under Run > Organize Favorites ... you have the option to mark some of them as the ones you want to use often. These will listed at the top of the selection list then.
Run configurations... > Filtering Preferences... will open the preferences where you are able to define which filter should be used for the run configurations. If you use Working Sets in your programming, this could be helpful, so by switching Working Set, the run configurations come with it.
I think the keyboard shortcut is the fastest one if you want to use the run configurations all. If there is a special order, the first tip by be sufficient. If your context changes, and the run configurations should change as well, use the working sets.
I'm a bit late, however it might help future readers.
Well, if you want to manage your Run Configurations I would recommend you Eclipse Runner plugin.
I hope that helps.
I don't know of any plugin that does that, but in Eclipse the chosen run configuration if you hit the run button is the last one ran. Which is what you'll need most of the time, typically. Otherwise you can just go inside the menu, where all configurations are grouped by type and choose from there, that might take a couple more seconds but maybe is not so confusing.
One way to do it is to save the run configurations as "Stored Files" in various project directories. This doesn't require saving or loading manually, you just select "Shared file" in the "Common" tab and set it to a project directory.
When you open or close one of these "Projects" (even if that project contains nothing but run configurations) it will show/hide those configurations.
I'm currently considering creating some "Fake" projects just to hold launcher groups.

How to apply an external formatting script to files in eclipse?

I'd like to run an external beautifier over my code that's open and replace the contents of the document with the output. Is there a plugin or something I can exploit to do this? I thought it would be a no-brainer under the formatter preferences, but it looks like you can only use internal templates.
One solution is the following:
Create an ant builder on your project. See this article about how to do that. The important things you should know after you read the article:
Add a new ant builder by right click on project and properties. See the implicit variables your ant script will have. The variables will contain one or more resource name and path. So be prepared for collections.
Filter the resouces in the "Build
options" tab. This is important,
since launching a JVM (or a new task
inside IDE JVM) for the change of
every file (filetype) is not so
fast. So filter resources to be
processed like this:
The third thing is to ask eclipse to refresh the resource after the script is run. Like this:
Set the target of the ant script to be run as automatic build (third option). You can set all the four anyway it will be ok:
Write your script. You will find the log of the ant script in console, and you may redirect the log into a file as well. You can see the option on the second picture. Start your script with an echoproperties tag to see what your script gets from eclipse.
I used such builders a lot, it works like it should. I like them. Good luck. Consider accepting your answers, 42 % is not too much :D

Can I script FlexBuilder without writing an extension?

I'd like to script FlexBuilder so that I can run debug or profile without having to switch to FlexBuilder and manually clicking the button (or using the key combo). Is this possible without writing an extension?
To be more specific, this is exactly what I want to do: I want to create a TextMate command that talks to FlexBuilder and makes it run the debug target for the currently selected project. TextMate already has support for interacting with Xcode in this way, and it would be great to be able to do the same with FlexBuilder.
When compiling I use Ant and have full control over that from TextMate, what I want is to be able to launch the debugger and the profiler. The command line debugger is unusable and there is no other profiler available than the one in FlexBuilder.
Since FlexBuilder essentially is an extended version of Eclipse, any tools/scripts for doing the same in Eclipse should work for FlexBuilder aswell. I couldn't find any tools like this googling it, have you considered doing away with FlexBuilder completely, there are plenty of guides for using the mxmlc (or fcsh) compilers directly from your editor.
I do not know if there is a plugin like this for Eclipse however if not you can write one as it should be easy.
If the specific command that you want to call shows up in Windows/Preferences - General/Keys, you can create a plugin that takes commands from TextMate (I do not know what protocol TextMate uses, socket or something else) and executed the specific action that is associated with the command that also appears in preferences.