Eclipse "top level elements" changes to "Working sets" on change of perspective - eclipse

When I close my perspective B, and open it again, even if the B perspective "top level elements" property was "Projects", it gets changed to "top level elements".
However please note that when I open up the perspective the very first time, the property was "Projects".
I am sorry if this question is very elementary but I am quite new to Eclipse development.
Does anyone know which class this property belongs to, so I can override it when the Perspective is opened?
I suspect it should belong Common Navigator Framework and specifically the CommonNavigator class?
P.S. What would be the correct way to know such things, i.e. where is such an action defined and what function is it bind to? Is there any direct way or does it need a person with full knowledge of the eclipse framework?

Well just closing and opening a normal Project Explorer view always seems to revert to Working Sets so it looks like the view does not persist this setting.
You can find out some things about what classes are used by using Eclipse plug-in spy. You can also look at the plugin definitions and the source code. Project Explorer is in the org.eclipse.ui.navigator.resources plugin.
It looks like org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider deals with this setting but I don't see an obvious way to change it.

Related

Build a Perspective from Fragment with Eclipse e4

Is it possible to define a perspective stack and perspective in the fragment.e4xmi?
The Eclipse 4 model editor doesn't seem to allow it. Why?
I add a new Model Fragment and for Feature Name I click Find ....
When I want to add a Perspective or a Perspective Stack, the dialog greys out the OK-Button.
Also, I have a lack of understanding what this Dialog is showing in general. It lists certain UI Elements and a lot of items below them, like
children
handlers
menus
and so on.
But those are listed multiple times. For example children is listed under CompositePart and under Dialog. But it doesn't make any difference which one I chose.
I know I can define the Perspective in the plugin.xml using the extension point and implementing IPerspectiveFactory. Is there no way to do it with the fragment.e4xmi?
Not sure about that dialog as I don't usually use it.
What you want to add is a Model Fragment with the 'Extended Element-ID' set to the id of the TrimmedWindow you want to put the perspective in. The 'Feature Name' would be children.
The model editor should then let you add a "Perspective Stack" as a child.
You can add the Perspective to the stack.
Note: Using the plugin.xml and IPerspectiveFactory is for Eclipse 3.x compatability mode, not pure e4. If you are using compatability mode I'm not sure how defining a perspective in the model editor fits.

What is the use of # Javadoc view in eclipse

I noticed #javadoc view in my eclipse. Could you please tell me what is the use of this and how to use it.
Eclipse actually does provide decent tools for creating your own JavaDoc, which is a good idea, as then others who have to use your code will have the ability to see what it does.
There is a keyboard shortcut for adding a block for a class or method (on Mac it's Command-Shift-J I think, but search Javadoc in the key mappings.
You can define templates for adding things like links, which are pretty important, that make creation of JavaDoc go very quickly
When you document in Eclipse, it is intelligent enough to point to existing docs, so say you make an interface, you document the methods in the interface, then inside each implementer, if you created them after the interface, you will get a block that points you back to the interface
When you have added your own, or other people on your team have, this view let's you see what that will look like, so it's got a dual purpose: for making it easier to read the markup of others' JavaDoc, and for previewing your own.
The view you are showing is the Eclipse # Javadoc view. The Javadoc view shows the Javadoc of the element selected in the Java editor or in a Java view.
To use it, simply open a Java file that contains Javadoc in the Java view (or use the Java perspective). Once you do so the Javadoc view will automatically populate.

Smalltalk-style method browsing for eclipse Java?

I am using Eclipse (Indigo) for Java development. My personal, idiosyncratic style prefers to see Java methods one-at-a-time, instead and not as a region of a longer .java file.
I am looking for a preference, view, or plug-in that shows me a java method, and only that method, when I select the method name from a explorer or browser. For reference, here is a screen-shot of a typical Smalltalk browser (Cincom's VisualWorks). The "Method Code Area" shows on only one methods as opposed scrolling through all methods in the class.
The Java Browsing Perspective comes close to a Smalltalk browser. I customized it a little bit and found it very useful.
Enable 'Show Source of Selected Element Only' and you will see only the selected method.
On today's widescreens, you won't need the whole width for the method source, and projects and methods take some vertical space. So I decided to vary the original Smalltalk layout.
Make sure that Eclipse closes open files automatically, as you want to browse, not to open and close files.
One thing that is missing is the 'Protocol' view. Maybe the developers had something like that in mind while introducing the #category Javadoc tag, but the only thing you can do is to filter by category. I hope that some lucky day someone will develop a protocol view.

How to add views to Show In menu for particular file types

I use an older plugin called Veloeclipse for editing Velocity templates in Eclipse. There's been no development on this since 2009, which isn't a problem because it's mainly just for syntax highlighting and format validation. The really annoying thing about it, however, is that when I try to do Show In to view the current Velocity template within my Package Explorer or Project Explorer, the only available option is Properties. That's not really useful. I really need to be able to get to the file in one of the regular explorer views.
So I have sort of two questions:
Is there a way to configure this without having to monkey with any code? A configuration file or something? I've grepped through my Eclipse installation and haven't seen anything, but I'm hoping that there's something I'm missing.
So assuming that the answer to my first question is no, how do I go about modifying the plugin code so that it will show more than the Properties view in the Show In menu? Most of what I found on the plugin development wiki comes from the other direction: how to make your view or perspective appear in the Show In menu.
Any help with this would be hugely appreciated!
Try to check the plugin source code. it might do something different than other editors. What I mean is that the show in menu item that you have there is not the usual extension point but a hard coded context menu option.

Open Implementation (type hierarchy) functionality in NetBeans?

When I have Java code like this:
someInterface.someMethod();
how do I get Netbeans to show me which classes have implementations of someMethod() (not the interface).
In Eclipse this is done with Ctrl+T, but pressing Ctrl+T on the method did nothing in Netbeans 6.5 and I can't where the type hierarchy functionality is in Netbeans 6.5.
Thanks.
I find that Ctrl+Alt+B works perfectly. :)
This functionality already exists in Netbeans: Alt+F7, check 'Find All Subtypes', and click OK. Thanks to tkellerer for pointing this out on the Netbeans forums
http://forums.netbeans.org/viewtopic.php?p=49638#49638
This is widely overlooked functionality in Netbeans, perhaps because there is no key binding for it, so I've changed my enhancement request to add a key binding for the sequence "Alt+F7, check 'Find All Subtypes', and click OK"?
To get a hierarchy similar to the type hierarchy in Eclipse, right click on the class name, select Navigate, and then Inspect Hierarchy. The keyboard shortcut for this is ALT+SHIFT+F12. By default, it shows you parents of the selected class or interface. However, you can view descendants by using the Filters at the bottom left side. I believe the Show Subtype Hierarchy filter (also toggled by using CTRL+B) is what you want.
This is accurate in NetBeans 6.7.1. I'm going to assume it is similar in 6.5.
It turns out that there is no comparable functionality in Netbeans. You can read about it here:
http://forums.netbeans.org/viewtopic.php?p=49355#49355
I've also filed an enhancement request here, which you can vote for:
http://www.netbeans.org/issues/show_bug.cgi?id=172830
If you want to see this added to Netbeans please vote for it.
Hey, someone has implemented a module to do this, and it works in Netbeans 6.5.1 - perfect for you. I'm hanging out to see an equivalent for 6.7.1. Maybe they should add it to 6.8!
http://wiki.netbeans.org/JavaGoToImplementation
Go To Implementation is built in for recent versions of NetBeans. Look in the Navigate context menu.