Easy way to add a context action to Eclipse - eclipse

I'm trying to add a very simple action to the context menu of Eclipse: clicking with right button over a folder object, this action should call an external tool (configured in the "External Tools") using the path of the folder as the only parameter.
I've found a tutorial on how to add a context menu, but it's more complex than what I need -- I don't really want to create a plugin, I don't even want to create classes to do what I want. My only purpose is to call an external tool.
How can I do it?

If you want to extend Eclipse with functionality such as editing context menu's, the only way to go is by writing a plug-in. However, this can be very light-weight and targeted to your needs, so the tutorial you found might be a good way to do it.

Check out StartExplorer. It's very handy. It's the equivalent of the IntelliJ "Neighborhood" plugin.
It comes with the basics of explore, command shell, open, and copy path for Windows, Mac and Linux. It also supports custom commands. And can be installed through a normal Eclipse repository.

Related

Create plug-in that creates a snapshot of the source code currently opened on editor - Eclipse CDT

I need to create a plug-in for Eclipse CDT that sends a "snapshot" of the source code of the currently opened editor each time the code is "built".
I am already capable of doing it each time the user presses a custom button created by me, but it would be great if it could be done when the "standard" "build" action is performed.
Do i need no create a plug-in of the type "builder"?
I am using Eclipse 4.4.0...
Can someone help me?! (Sorry for some english mistakes... :( )
One solution would be to create your own custom "Builder". Instead of actually building the code, it would invoke the functionality you already have.
For information on how to use the eclipse build system, please have a look here: https://wiki.eclipse.org/Eclipse/FAQ/How_do_I_implement_an_Eclipse_builder%3F.
Also, this website goes into more details about building in eclipse: https://www.eclipse.org/articles/Article-Builders/builders.htm. However, I think that the first one should do.
As a side note, this works with any kind of eclipse project (JDT and CDT). The build described there is common to all flavours.
Hope it helps,
-Caius

How to create Eclipse RCP application that behaves like a wizard?

I want create a installer by using Eclipse RCP. I need to give the user a wizard-like installer. This means user can do some options then click next. Or they can go back to previous page by click previous. Or they can cancel the installation by clicking cancel.
Here is my problem:
I don't know how to switch between views when clicking "next","previous". I need to create something like WizardPages and i can change between these pages?
I can't use JFace wizard because I'm required not to pop up any dialog.
I'm totally new to Eclipse RCP so please help!
thanks.
Maybe "StackLayout" is what you need.
Consider whether you actually want/need Eclipse RCP in this context. Eclipse RCP shines in complex applications with an extensive business domain and complex user interface.
An installer wizard, however, is very straightforward and static. I cannot imagine you requiring more than two or three user inputs. Your question is a bit like "I want to hear beautiful music. How do I program a robot to play the piano?"
It is much easier to limit yourself to using SWT and JFace. Use the JFace WizardDialog to make a nice installation wizard. You will find you will have never needed the Eclipse RCP framework.
See http://www.vogella.com/tutorials/EclipseWizards/article.html for a nice tutorial.
If you do think you need the features of the Eclipse RCP runtime framework, I suggest you follow the path below instead:
Create an RCP application (e.g. the sample 'Mail' application). A class will be created that is the main entry point in your application. This class will launch the Eclipse Workbench. Delete this code, and instead launch the WizardDialog.
A lot of things will not be available, such as menu's, views with drag-and-drop functionality, keybindings, etc. I cannot imagine you will need those things. However, you will benefit from the following Eclipse RCP features:
Eclipse launch framework. Ability to create a self-contained product including the JRE.
OSGi framework. Ability to easily add new plugins. Ability to use services, blueprint, etc.
JFace framework.
EMF (if you have a very complicated installation wizard)
All other eclipse plugins, although a lot of them may not work outside of the context of the Eclipse Workbench.
If you are convinced you need the full Eclipse Workbench, you can always do the following:
Define a 'base' perspective that is 'locked down'.
Use a Command to move from one perspective to the other. This will allow you to keep the previous wizard views open in other (hidden) perspectives.
Use Eclipse Contexts to hide all the standard Eclipse Workbench functionality, menu's, etc.
Since you are new to Eclipse RCP, I do not recommend learning the framework in the particular usecase of an Installation Wizard. You already need good knowledge of Eclipse RCP to be able to hack it this way, and it will not be a clean or nice implementation :-)

Mapping between resource file and model object in Eclipse plugin app

Please anyone help me understand and use IDE.openEditor(IWorkbenchPage, IFile).
I have a resource file (xml format), it contains my model objects. I'm writing a wizard to create it, save it into workspace, view it inside a tree view (I use CommonNavigator) and open it in an editor. I need to know the control flow of this all. How to map between resource file and model objects, how the navigator can show that objects and how to open editor that associated with my resource file.
I'm sorry, I'm a newbie in Eclipse field. I know I need too much, but please give me at least an idea.
Thanks a lot.
A great character once said... "You have much to learn young padawan".
Here's a great place to start your journey though the basics of Eclipse plug-in / RCP development...
http://www.vogella.com/eclipse.html
If you really want to get down and dirty into the bowels of Eclipse, you can use Eclipse itself to teach you the dirty details about what's really going on.
Figure out how to view Eclipse source code inside of Eclipse.
Set break points at interesting points in Eclipse source code that you want to know more about.
Use the 'Eclipse Application' run configuration to run an instance of Eclipse from within your main Eclipse.
Use your newly launched Eclipse to preform the tasks you want to mimic and hopefully, you'll hit one of your break points and see how the Eclipse developers did what you want to do.

Assigning a perspective for each project on Eclipse

I'm using SVN (Subversive) for some projects and git (EGit) for others, so I've configured two different perspectives for each type of project. I'd like to know if there's a way to associate a perspective for each project, so that when I open them the perspective is changed automatically.
Is there a way, native or via a plugin, to accomplish this?
I believe, it is very hard, if not impossible to do this. At project creation sometimes a perspective change is triggered (e.g. the creation of a plug-in project opens the PDE view). Otherwise, no general perspective opening method is used.
If you write your own plug-in, it could provide the required switch: either by listening to the opening of the project, or by adding a different Open project command, it is possible to write code that changes the current perspective. On the other hand, I don't know any of those plug-ins available.

Eclipse Debugging: Stay within boundries of current project

When step-debugging in eclipse, is it possible to instruct the debugger to traverse only steps within my project's sources?
I am debugging a rails application and much of the calls are moving through rails' infrastructure (such as activerecord) which I am not interested in following. I would prefer the step-debugger to skip these files, instead hitting the next line within my own source files.
I don't think you can prevent Eclipse to "Step into" a code, even if it isn't directly part of your project.
The only filtering in place is provided with Mylyn, in order to help you to focus on "the current task" at hand, with a "context" you help define!
It is possible in Java. I don't know if Ruby debugger in Eclipse has so mature as the Java one or not. Read this.