Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 53515 - [RCP] [Wizards] Can't add to File > New submenu
Summary: [RCP] [Wizards] Can't add to File > New submenu
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 29709
Blocks:
  Show dependency tree
 
Reported: 2004-03-02 14:02 EST by Paul Lever CLA
Modified: 2006-02-10 15:01 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Lever CLA 2004-03-02 14:02:31 EST
There seems to be no way to add menu items to the File!New menu unless you are 
adding a NewWizard based on the platforms wizard. You can add using the 
menupath new_ext but not new. I would like to be able to place menu items into 
the File!New menu without having them be a platform  new wizard.

The need for this is because we are integrating into Eclipse our own wizard 
technology. I have tried adding a new wizad based on INewWizard, that launches 
our internal wizards. This works OK, but I couldn't come up with anyway to 
send the user's Finish button in our wizard to the WizardDialog, so when the 
user finishes our wizard he sees the Finish button from the Eclipse New 
wizard. 
The simple fix for this would be to allow an extension point that I can add my 
own action to that will end up in File!New where our users would expect it.  
When I use file/new_ext the menu ends up under File, not under File!New
Comment 1 Tod Creasey CLA 2004-03-03 16:45:35 EST
You can already do this when you define your perspectives by invoking 
IPageLayout.addNewWizardShortcut when createInitialLayout is called on your 
IPerspectiveFactory.

The org.eclipse.jdt.internal.ui.JavaPerspectiveFactory is a good example.
Comment 2 Paul Lever CLA 2004-03-03 20:44:37 EST
Maybe I don't understand this, but it seems that this just adds a standard new 
Wizard to the menu programatically, just as you would by using the extension 
point org.eclipse.ui.newWizards in the plugin.xml. I don't see how this solves 
the problem of getting an action into File!New that is not based on the 
platforms Wizard.
Comment 3 Tod Creasey CLA 2004-03-04 08:58:53 EST
No - this is how you add it to the initial menu programmatically. Additions to 
the wizard are done via the xml.

The only case this doesn't work for is if you don't own the perspective you 
are trying to modify. - i.e. if you want to add to the Resource or Java 
Perspective you are out of luck.
Comment 4 Paul Lever CLA 2004-03-04 11:21:18 EST
Thanks for the quick response. 
I can use this approach for my initial work - I was just using plugins to 
package our stuff, but I can make a perspective out of them. Longer term, I 
would like to be able to add the wizards into other perspectives that I don't 
own. For example, adding a feature vie File!New to generate a complex piece of 
Java or C code while in their respective perspectives is a typical use case 
for us. From the simplistic view of point it seems that exposing a menupath 
for file!new (like there is one for file!new_ext) would be straightforward and 
handle all situations. I suspect there is some internal reason that this 
doesn't exist or is difficult to implement. To sum up, I'd still like to 
request a more straightforward/flexible way of adding to the file!new menu.
Comment 5 Tod Creasey CLA 2004-03-04 11:26:42 EST
Right - so entries other than the Other, Project and perspective views entries 
right?

Sounds like another RCP request. Moving this to them  and renaming as they may 
have some ideas.
Comment 6 Nick Edgar CLA 2004-03-05 01:21:51 EST
It's unclear to me from the above whether you want to 
(a) add a new wizard shortcut to a perspective (whether yours or someone 
elses), or
(b) add some other action to the File > New submenu

Also, does your plugin extend the Eclipse SDK, or are you writing a separate 
non-IDE application based on the Eclipse RCP?

For (a) you can either use IPageLayout.addNewWizardShortcut(String) in the 
perspective factory if you define it, or you can add it to other perspectives 
using a <newWizardShortcut id="xyz"/> element in a perspectiveExtensions 
extension.

For (b) this is not currently possible because no id has been assigned for the 
New submenu, so it's not accessible via the menubarpath of an action set.  This 
is a bug that should be fixed.


Comment 7 Nick Edgar CLA 2004-03-05 01:58:13 EST
The File > New submenu now has the id "new".  Also added a group at top also 
with id "new", and one at the bottom "additions".

Note that all menu items shown here by the Workbench are populated by a single 
dynamic contribution item, so it is not currently possible to add separate 
actions between Project... and Other...  It would probably be better to have 
separate actions for Project..., Other..., and Examples... (hidden unless you 
have some examples installed), and a dynamic contribution item that just 
provides the new wizard shortcuts in the current perspective in between (not 
the fixed actions).  

The Examples action may need to be dynamically visible since its visibility 
depends on whether examples are installed, which can change due to activities 
or dynamic plugins.  It would be simplest to calculate this visibility on 
demand, but we don't have good support for this right now.  But I digress...

It sounds like the deeper problem here is the inability to integrate with 
Eclipse's wizards mechanism.  Is your solution a replacement for it, or are you 
just encountering difficulties integrating?  This should probably be filed as a 
separate problem report.




Comment 8 Paul Lever CLA 2004-03-05 14:48:49 EST
You are right on about this being really two issues. One was adding our own 
action to File!New, looks like you took care of this, thanks. Second one is 
extending/replacing the SDK wizards. Our wizard technology runs as a separate 
stand-alone SWT app and integrated into the Eclipse IDE. (Probably will be an 
RCP type app in the future). Our wizards add significant capabilities for 
wizard page forms generation as well as advanced code generation via XML 
templates and scripting. I initially tried to integrate our wizards with the 
Eclipse wizards. Seeing the IWizard and IWizardPage interfaces available and 
the notes indicating that these area available for use and extension, I 
figured we would extent the Eclipse wizards. In practice, this isn't easy to 
do. For example, if you install your New wizard based on INewWizardPage there 
doesn't seem to be anyway to display your own navigation buttons and then 
indicate back to the WizardDialog that Finish has been pressed. 
The fix for menupath to new will get us going for now. Thanks  again.
Comment 9 Sean Kirby CLA 2004-10-27 15:34:54 EDT
I'm building an RCP app and i wanted to re-use the File->New... submenu present
in the Eclipse SDK to show wizards contributed by my app.  However, it appears
as if this submenu is created by the org.eclipse.ui.ide plugin and contains
certain hard-coded entries (Project and Example).  I would like this submenu and
it's associated classes to be generalized and pushed down into the workbench
plugin so that anyone can have a dynamic menu just like the SDK does without
needing to add the ide plugin to my list of dependencies.
Comment 10 Sean Kirby CLA 2004-10-27 15:38:17 EDT
Sorry for the above post, I should have been commenting on Bug 73736 instead.
Comment 11 Nick Edgar CLA 2006-02-10 15:01:00 EST
I believe that the main issues here were addressed for 3.1.