Adding custom right click menu into Eclipse's project explorer view in RCP application - eclipse

Currently I'm using Eclipse's Project Explorer view into my RCP Application by writing the following line of command into my "Perspective.java" file...
layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.30f, editorArea);
It is currently giving me all the default right click options that eclipse's project explorer view gives..
i.e. cut, copy, paste, delete, refresh, etc.
I want to add my own custom right click options into these default options. Does anyone know how to do it? Or will have to build my own project explorer view??
Is there anyway from where i can get the code that eclipse used for building the project explorer view?
would like to know what can be done in this situation or any other solution for this??
Thankyou !!

While my comment covers your question, the follow up questions need some more space:
a) how to look at eclipse sources:
*File -> Import ... ->Plug-in Development -> Plug-ins and Fragments -> Next*
Chose *Import as -> Binary Projects* (you can read the source code but not change it. This saces time, because the code doesn't get compiled) ->Next
Chose plugins to import -> Finish
You can find the sources in the projects in "referenced libraries"
b) you need the path to the menu entry and the plugin you want to add to. This can be done with the Plugin spy (Alt+Shift+F1 -> click on the view of which you want to get the id) or or Menu-Spy (Alt+Shift+F2 -> click on the menu entry that you want to add to)in Eclipse.
c) To add a menu entry to the popup, see the How to add items in popup menu? (the one I mentioned in my comment).

Related

Eclipse plugin development implementation

I work with Eclipse and PyDev plugin.
I want to develop a plugin which adds to the main menu (where File is located), an item "my own custom menu" which contains in it another menu items.
According to some examples, I eventually implemented it by using the extension point of org.eclipse.ui.actionSets.
My goal is when item of "my custom menu" is clicked, it should invoke Eclipse functionality.
for example:
"my custom menu" has menu item called "open new pyDev project".
When "open new pyDev project" is clicked, I want to open the pyDev project creation window that manually is opened by clicking the following Eclipse menu items: File->new->other->PyDev->PyDev Project.
I searched quite a lot and couldn't find the way to do it.
Does someone know how to achieve my goal?
What you want to do is implement a workbench wizard that will add them to the set of workbench wizards; then you can add a perspective extension to add it the the corresponding menu generically.
You have to look up the perspective ID you are using with PyDev, but this is the recommended way to add new wizard items to the corresponding menu.

Can Java Scene Builder integrate into Eclipse like it does in NetBeans?

I was just wondering since I am used to programming in My/Eclipse...
Is it possible for javafx scene builder to intergrade into eclipse like it does in netbeans: in netbeans you can double click on a "Front end" file/component and java fx scene builder opens up.
I am not used to Net Beans and I know it will not make a huge difference if I have to use Netbeans. Only wondered if that is possible. I googled this and dont seem to find the correct information.... Or I might be searching for the wrong thing.
thanks
If you use the efxclipse plugin as stated by #user714965 when you right click a FXML file, the second option from the context menu is "Open with Scene Builder". But, if you want to make it the standard procedure on double click, you can simply go to:
Preferences -> Editors -> File association -> look for .fxml and select it -> Click the second add button on "Associated Editors" -> Open with external program -> Select scene builder.
This should make the double-click action to open scene builder with your file loaded.
I hope it helped. Cheers
I think efxclipse is what you are looking for. But I haven't used it yet.

Eclipse Shortcut for Team - Synchronize with Repository

What are the shortcuts for the context menu actions "Team -> Synchronize with Repository" and "Team -> Update" on the whole project?
I have already found shortcuts, but these are executed only on the file i have currently opened. But I want to execute it on the whole project without having to scroll the project explorer to the top and right-clicking on the project.
If there are no such shortcuts, how can I create them?
As john.k.doe indicates, that's the right solution, but you also need to do something else in order to make the shortcut actually work, which is go to Window > Customize Perspective > Command Groups Availability and there just check the SVN box ;)
you can almost always get the key shortcuts you want by
go to preferences type "keys" or go to General -> Keys
in the field presented when you click on "Keys"
in the left pane, type the command you are interested in setting up a shortcut for:
the image below is from my mac, but it works the same way on windows/linux, you just might choose something besides Cmd-Y as your shortcut modifier. the U under User indicates that i was the one to add that modification.
I have written a small Eclipse plug-in which selects the active project in the Package Explorer so you can execute other actions (like 'Sync with repo' and 'Update') on it. I think this approach is more flexible compared to writing a plug-in that selects the project and executes a predefined action.
You can get the plug-in at http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/downloads/list, it is named "com.xakcop.select". Download it and put it in the dropins/ folder of your Eclipse installation. Then when you restart Eclipse, you will find a new command Select project in Windows->Preferences->Keys. The default key binding is Ctrl+Shift+Backspace but you can change it to whatever you want.
When you are in the Java editor just press Ctrl+Shift+Backspace, this will select the project that the current file belongs to in Package Explorer. Then press the shortcut for "Synchronize with repository" and you are done.
The source code of the plug-in is also available as part of my eclipse-tweaks project: http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/source/browse/com.xakcop.select
I think the answer to this question adresses the issue.
The quickest way I've found to update/synchronize, after having set the shortcut keys, is to click on the minimize button in the Project/Package Explorer and then press the keys. After the update, simply clicking on the last used file in the editor returns to the previous workspace state (provided the "Link with Editor" button in Project Explorer is selected).
I should clarify: I use a working set for each project. The working sets are displayed as default Top Level Elements in the Package Explorer so, by clicking on the minimize button the desired Project' working set, they collapse and are easy to select. Then, I apply the shortcut on the selected working set.
From my point of view, the problem is the focus of the commands you execute.
The Team commands Snychronize and Update are executed on the current object (In my case). As you noticed, when you execute the command on the project, the project is synchonized - when you do it on a file, only the file is synchronized.
What I did as workaround is the following:
I created Key-Bindings for the commands Show in (Navigator) (Alt-N), Go to (Alt-G), and Show View (Naviator) (CTRL+SHIFT+Q, N).
With Alt-N I show the current File in the Navigator. I can then use the keys to navigate to the root that I want to synchronize (it's not always the whole project for me). If the root is to far away I use Alt-G and type the Project or Folder where I want to go to and execute afterwards the Synchronize commands.
(Go to works only in the current view)
If you have selected the Project once you just have to switch to the navigator (Show View command) and execute your synchronize commands.
You could also use rgerganov's plugin then you would not have to execute as many commands.
The procedure works also with other views (package explorer, project explorer)
What about this approach? It should also work for other SCM's or commands you want to execute on any object in the explorer views.

Mylyn Task Focus UI

If you use the Mylyn task focus UI, the package explorer shows
sourceFolder/package/fileName/classTypeName/methodName
for any class in the context of an active task. Is it possible to remove classTypeName and methodName and show only all entities up to their fileName?
I don't generally need the structure inside the Java file, so I just disable that in the Package Explorer completely. To do that:
go to the View menu (the little triangle)
choose "Filters"
check "Java Members"
Unfortunately, this doesn't work in Project Explorer.
You can uncheck "Window -> Preferences -> Mylyn -> Context -> Auto expand tree views when focused", this may help to some extend.
On Eclipse PDT I used Navigator View instead of PHP Explorer View:
Window -> Show View -> Navigator
That way only the filenames are displayed.
After that i added filters to exclude files from view, e.g. .* resources.

How can I get Eclipse to show .* files?

By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.
In the package explorer, in the upper right corner of the view, there is a little down arrow. Tool tip will say view menu. From that menu, select filters
From there, uncheck .* resources.
So Package Explorer -> View Menu -> Filters -> uncheck .* resources.
With Eclipse Kepler and OS X this is a bit different:
Package Explorer -> Customize View -> Filters -> uncheck .* resources
For Project Explorer View:
1. Click on arrow(View Menu) in right corner
2. Select Customize View... item from menu
3. Uncheck *.resources checkbox under Filters tab
4. Click OK
--
Eclipse Juno
Cory is correct
# If you're using Eclipse PDT, this is done by opening up the PHP explorer view
I just spent about half an hour looking for the little arrow, until I actually looked up what the 'PHP Explorer' view is. Here is a screenshot:
I'm using 64 bit Eclipse for PHP Devleopers
Version: Helios Service Release 2
It cam with RSE..
None of the above solutions worked for me... What I did was similar to scubabble's answer, but after clicking the down arrow (view menu) in the top of the RSE package explorer I had to mouseover "Preferences" and click on "Remote Systems"
I then opened the "Remote Systems" nav tree in the left of the preferences window that came u and went to "Files"
Underneath a list of File types is a checkbox that was unchecked: "Show hidden files"
CHECK IT!
1. From Package Explorer open the Filters... dialog:
2. Then uncheck .* resources option:
On Mac:
Eclipse -> Preferences -> Remote Systems -> Files -> click Show Hidden Files.
In your package explorer, pull down the menu and select "Filters ...". You can adjust what types of files are shown/hidden there.
Looking at my Red Hat Developer Studio (approximately Eclipse 3.2), I see that the top item in the list is ".* resources" and it is excluded by default.
Spring Tool Suite 4
Version: 4.9.0.RELEASE
Build Id: 202012132054
For Mac:
In my case, I wanted to see .htaccess files, but not all the other .* resources.
In Zend Studio for Eclipse, in PHP Explorer (not Remote System Explorer), click the downward facing arrow (next to the left/right arrows).
Choose Filters.
Uncheck .* resources
In the "Name filter patterns" area, type the filenames you want to ignore.
I used:
.svn, .cvs, .DS_Store, .buildpath, .project
If using Zend Studio, same arrow, go to RSE view, click on the downward facing arrow, hit preferences, and then check show hidden files.
That did the trick for me.
If you're using Eclipse PDT, this is done by opening up the PHP explorer view, then clicking the upside-down triangle in the top-right of that window. A context window appears, and the filters option is available there. Clicking the Filters menu option opens a new window, where .* files can be unchecked, thus allowing the editing of .htaccess files.
I searched forever for this, so I'm sorta answering my own question here. I'm sure someone else will have the same problem too, so I hope this helps someone else as well.
Eclipse shows hidden files in the "Navigator" view. You can add that via Window->Show View->Navigator.
Preferences -> Remote Systems -> Files -> Show hidden files
(make sure this is checked)
Follow steps 1, 2, and 3 in the figure below: