How to make eclipse (neon 2) work better with goovy/grails? - eclipse

Some time ago I edited a node project in grails. Now every project, even if it has nothing to do with node, shows 5 node files when I do "new" to create a new file. (type script, node project file etc).
I now only have a grails 3 projects in Eclipse, with the usual groovy eclipse plugins installed.
When I want to create a new groovy file (e.g. a domain object, controller etc), I go to file->new, and I only see the 5 node entries, plus a few generic ones.
Is there any way to make it show "groovy class" in the new list, and not show the node related ones?
I thought facets might be for this, but my project has no facets configured (and eclipse still thinks its node), and there are no grails/groovy type facets).
Any suggestions? Not a show stopper obviously.
E.g. can I create my own facet without coding, or can I influence which file types appear on create new by project?
I could open up a DOS command box and do the grails command to create the classes, but his is more work, especially as it creates broken tests which have to be manually deleted after (until such point as we need tests)
Intellij ultimate is unfeasibly expensive, so that is not an option.

You should be able to customize what appears in the New drop-down using Window > Perspective > Customize Perspective.... In the dialog that comes up, click the Shortcuts tab and you can check or uncheck items that will show in the New drop-down.
You can also edit what options will show for the Show View and Open Perspective sub-menus from here.

Related

How to view multiple projects in one window in IntelliJ IDEA IDE?

In Eclipse IDE you have the concept of "workspaces" allowing you to manage/view your projects in one side pane easily and allowing you to switch between projects easily.
As i gather IntelliJ doesn't have that feature because everytime when i open a new project it always asks to either open in a different window or same window? And in the latter option it overrides my existing open project.
You're right; IntelliJ simply doesn't have this functionality. Each project is opened in a single window, either overwriting your current window or spawning a new window.
If you feel that this sort of behavior is something you want, then feel encouraged to put in a feature request on their issue tracker.
You can create a new empty project and import into it the modules from the other projects.
This works for me, although is not exactly the same as what you're trying to achieve. Note that you will lose (e.g. have to specify manually) the specific projects' settings.

Is there a way to sort projects in Eclipse GGTS?

I am using the Groovy-Grails Tool Suite (GGTS) which is basically just Eclipse with some Groovy/Grails specific stuff on top of it.
I added a new source folder (Properties > Java Build Path) but it is appearing in a weird order. Is there any way I can manually order the source folders in Project Explorer?
You can see in this image that the "test/functional" source folder is not next to the other test folders. At a minimum I'd like to have them all together, and ideally I'd like to choose the order. There are some other folders I'd like to move around too if I could.
I also want to keep using this Project Explorer view since it puts a Grails specific spin on things, like the "domain," "controllers," "views," and others.
I am using GGTS 3.1.0.RELEASE which looks like it is built on Eclipse 4.2.1.
Not sure how I missed it, but under Preferences > Grails > Project Explorer you can order the default set of objects (domain, controllers, etc). That would help with part of my problem of wanting to order all the objects.
After I did that, I exported the preferences (File > Export > Preferences > All) to a file. In that file I found a String like this:
/instance/org.grails.ide.eclipse.explorer/org.grails.ide.eclipse.explorer.ordering
I updated that, adding "Stest/functional;" after "Stest/integration;", imported the preferences (File > Import > Preferences), and restarted the workspace.
I wish the plugin's preferences (where you can change the default ordering) allowed you to add new objects right in the preference editor, but at least there is some way to do it.

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.

Search in particular Eclipse project

Is there any way to specify a project, where you want to search?
It's been annoying me for a long time. Like when I hit Ctrl+H to search, the only scopes available are:
Workspace
Selected resources
Enclosing projects
Working set
So, the only 3 ways I see to perform a search in particular projects are:
Open a file from the required project, hit Ctrl+H and choose Enclosing projects scope
Add required project to Working set, and perform search on this set.
Select a project in Project Explorer and search in Selected resources
All of these methods are not always convenient.
Sometimes, I just want to manually specify projects, where the search is to be performed
Edit:
The last option is not good for 2 reasons:
1) I usually have "Link with editor" option on, which associates currently opened file with corresponding item in Project Explorer. Our project is quite large, so usually I would have to scroll all the way up to collapse the selected project to make others visible.
2) Also, Project Explorer is not reachable when I'm working in another perspective, such as Debug for example (I know I can add it through Window->Show View, but that just breaks the essence of perspectives).

Developing an Eclipse Plugin and adding a submenu item to navigator

This is my first attempt at an Eclipse plugin- the plugin architecture is vast and a little overwhelming, but I've found a number of tutorials and how-to's online which is helping, but trying to do the following is driving me nuts:
I want to add a submenu item that is available in the navigator context menu when you right click on an Eclipse project.
I can get a submenu to appear on a project file or folder, but absolutely no idea how to have it appear on a project.
Would someone be so kind as to provide me with step by step instructions, starting with creating a new plugin-project? This is probably a lot to ask, but I can't seem to find an online guide that has just the right amount of detail. I specifically want to use the plugin-project wizard rather than hand code a plugin.xml file as I am not very familiar with the Eclipse plugin architecture.
Ok- I got it- it was simple, but I got lost in the noise of the API-
Create a new Plug-in Project using the Plugin-Project Wizard and when the wizard has launched...
1.
On the Plug-in Project page, use anything as the project name and 3.5 as target platform eclipse version
2.
On the Content page, skip ahead and just press next
3.
On the Templates page, select "plug-in with a popup menu" and press next
4.
On the Sample Popup Menu page, you will see that eclipse has prefilled the field
"Target Object's Class" with a value of "org.eclipse.core.resources.IFile".
This means that when your popup menu will only appear when you right-click on a file in
a project. As we want the menu to appear when we right click on a Project when
we are using the Navigator view, simply use "org.eclipse.core.resources.IProject" instead
5.
Finish
You can validate that your pop-up will appear as expected by right-clicking the MF file
and "Run-as" > Eclipse Application
Now to refactor the resulting code to use menuContributions and commands rather than objectContributions and actions :)
I think you have a similar question (menu in the package explorer) here:
Renaming packages in Eclipse (thanks to Rich Seller)
This could be a good start, and is a complete plugin project.
You should look into the Eclipse Common Navigator Framework there are a few tutorials on this side that tell you what to do in detail The Project Explorer is an implementation of the CNF. You should also consider using the Platform Commands to add your commands (and popup menu item) to the popup menu associated with the project explorer. It's somewhat easier to use commands than actions. You should be able to do it with by adding a Command in your plugin extensions. Unfortunately off the top of my head I don't know the right incantation to have the command appear in the project explorer. But you will be able to find it in these resources.