Associate newWizard with nature of selected project - eclipse

I am trying to add a contribution to the org.eclipse.ui.newWizards extension point so that the entry in the new-menu is only shown, when the selected project has a certain nature.
Is this possible only by declarative use of this extension point?
I already look for an attribute like <enabledwhen>of a menu's action but the wizard's extension point does not seem to offer this possibility.
Any ideas to achieve the said behaviour is welcome.

This is not supported. New wizards always appear everywhere.
The only thing that can be controlled is the 'shortcuts' which appear in the top level of the New menu which can be configured according to the perspective using the org.eclipse.ui.perspectiveExtensions extension point.

Related

Extend an existing Context Menu inside Eclipse Outline View for Xtext

We have an eclipse plugin which has been created using Xtext. And now I want to add a context menu to an Element inside the Outline View inside Eclipse. I understand that I need to have a menuContribution which will invoke a Command. But what I dont understand is, do I have to create (define) a command in some way or the other.
My plugin.xml contains an extension point for "org.eclipse.ui.menus".
Menu Contribution is something like this:
I find tutorials that talk about creating menu contributions, but there is nothing which will tie up my menuContribution to a command I want to define.
Typically you will need three extensions:
org.eclipse.ui.command
org.eclipse.ui.handlers
org.eclipse.ui.menu
It requires some fidling to get them right. I suggest you look at some open source code and starts from there.
Introduction article: http://www.vogella.com/tutorials/EclipseCommands/article.html
The locationUri of the context menu you like to contribute to should be popup:org.eclipse.xtext.ui.outline.OutlinePageContextMenu. Found here: https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/outline/impl/OutlinePage.java

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

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.

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.

ReSharper 8 Plugin Development Solution Explorer Panel Indicator

I want to write a ReSharper 8 plugin that will give a visual indication (icon maybe?) to the user in solution explorer panel if the number of projects in a solution exceeds a configurable amount.
Can a ReSharper plugin accomplish this or must I find another way? Must I create a SolutionComponent?
There's actually a set of things that you need to make this happen:
You need to add a visual element to be placed somewhere. I believe you can define an icon in Actions.xml, but as I understand, the solution explorer tool bar contains only buttons, though I could be wrong. An alternative approach would be to actually decorate the solution icon the way that source control plugins do. There are also other approaches, e.g. StatusBarIndicator.
A solution component is essentially some component that exists only while there's a solution loaded. What you need is different - a mechanism of monitoring solution changes and project model changes.

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.