Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding Menu in Eclipse MenuBar
Adding Menu in Eclipse MenuBar [message #540190] Tue, 15 June 2010 10:39 Go to next message
Jack Clouseau is currently offline Jack ClouseauFriend
Messages: 22
Registered: June 2010
Junior Member
Hi All,

I have a task and i need some guidelines to acheive it....

here is the task...

I need to create a plugin which adds a Menu (let's say "MyMenu") in the MenuBar of the Eclipse when it is launched. And on selection of a MenuItem (let's say "Launch My App") under MyMenu, i should be able to launch my application which is again a plugin. This MyMenu should appear in whichever Eclipse version i install my plugin (Meaning, if i copy my plugin to any of the Eclipse plugins folder and on lauching of that particular version of Eclipse, the user should be able to see MyMenu in the MenuBar).

Please let me know how to start with this...

Thanks...
Re: Adding Menu in Eclipse MenuBar [message #540217 is a reply to message #540190] Tue, 15 June 2010 12:27 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Create a plugin using CTRL+N>Plugin Project. Keep going through the
Next> buttons until you can pick a template. Pick the Hello World
Command template.

That will generate a command and handler, and place it in the main
toolbar and main menu

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding Menu in Eclipse MenuBar [message #540409 is a reply to message #540217] Wed, 16 June 2010 04:59 Go to previous messageGo to next message
Jack Clouseau is currently offline Jack ClouseauFriend
Messages: 22
Registered: June 2010
Junior Member
Paul,

Thanks for your inputs..let me tell you how i acheived this initial step.

I created a new plugin and selected the Hello World commad template and added my menu. Then i exported this plugin as a jar file and placed in the plugins folder of my eclipse. When i relaunced my eclipse i was able to view the menu that i created and it just worked well.

Now the second step. when i select an menu item (which is present under MyMenu) how do i load a plugin? This plugin is actually my application which has the UI and all the business logic in it.

So do i need to export this (my app plugin ) also as a jar file and keep it in the plugin's folder of my eclipse? On doing this when i select my MenuItem will the eclipse automatically load that plugin?

OR

is there a way that i save my app plugin (as a jar file) in a separate folder where my app is installed and will i able to inform the eclipse that while its being lanched also pick the plugins from my folder? I mean to say, i will create a .link file in the Links folder of eclipse and in the .link file i will point to the location where my plugin is present. In this way when i lauch my eclipse will it pick my plugin and starts it on selection of my menuitem?


Please share your thoughts on this....

Thanks
Re: Adding Menu in Eclipse MenuBar [message #540504 is a reply to message #540409] Wed, 16 June 2010 12:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jack clouseau wrote:
> Paul,
>
> Thanks for your inputs..let me tell you how i acheived this initial step.
>
> I created a new plugin and selected the Hello World commad template and
> added my menu. Then i exported this plugin as a jar file and placed in
> the plugins folder of my eclipse. When i relaunced my eclipse i was able
> to view the menu that i created and it just worked well.

What version of eclipse are you on? When you Export a deployable
plugin, you would drop it in the dropins folder (eclipse/dropins) to
have it picked up by eclipse. Sometimes you need to restart with -clean
to refresh the extension registry cache.

>
> Now the second step. when i select an menu item (which is present under
> MyMenu) how do i load a plugin? This plugin is actually my application
> which has the UI and all the business logic in it.

Load a plugin? Is it already an OSGi bundle? Or is it just a java jar?
Do you expect to launch a UI somehow, or simply provide
views/editors/wizards/menus to eclipse itself?

Normally if you have some application functionality, you would use the
extension points to contribute views/editors/commands to eclipse. Then
simply including your application bundles will make those actions
available. Is this not what you want?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding Menu in Eclipse MenuBar [message #540772 is a reply to message #540504] Thu, 17 June 2010 10:47 Go to previous messageGo to next message
Jack Clouseau is currently offline Jack ClouseauFriend
Messages: 22
Registered: June 2010
Junior Member
Paul,

Am using Eclipse 3.5..if we keep it in dropins folder or plugins folder it's the same...that is what i understand...please let me know if am wrong here.

Yes, it's an OSGi bundle. No i don't want to contribute view/ediotrs/wizards to eclipse. Basically i need to start my own application, a new workbench of my own (which is not tied to eclipse workbench) and in that i have a perspective and a view.

I suppose you are able to get my point...please let me know if you need more info...

Thanks


Re: Adding Menu in Eclipse MenuBar [message #540797 is a reply to message #540772] Thu, 17 June 2010 12:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jack clouseau wrote:
> Paul,
>
> Am using Eclipse 3.5..if we keep it in dropins folder or plugins folder
> it's the same...that is what i understand...please let me know if am
> wrong here.

In eclipse 3.5 you can either use p2 to install your feature
(Help>Install New Software) and it will show up in eclipse/plugins, or
simply put it in the eclipse/dropins folder to get automatically added.
Dropping things in eclipse/plugins is 3.5 shouldn't work and will
likely cause problems in the long run.

>
> Yes, it's an OSGi bundle. No i don't want to contribute
> view/ediotrs/wizards to eclipse. Basically i need to start my own
> application, a new workbench of my own (which is not tied to eclipse
> workbench) and in that i have a perspective and a view.


So you want to launch a second workbench, basically your own RCP app?
Why not simply install it beside the eclipse install, and then use
System.exec(*) to launch your RCP app executable?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding Menu in Eclipse MenuBar [message #541115 is a reply to message #540797] Fri, 18 June 2010 12:11 Go to previous messageGo to next message
Jack Clouseau is currently offline Jack ClouseauFriend
Messages: 22
Registered: June 2010
Junior Member
Thanks for the info paul...

Ok will use the Install New Software feature to install my feature.

And btw just out of curiosity, what kind of problem i may encounter if i manually drop it in the plugins folder?

OK, will this System.exec(*) will be trigged even in Linux platform? Or do i need to use a different command for Linux platform?

Thanks
Re: Adding Menu in Eclipse MenuBar [message #541121 is a reply to message #541115] Fri, 18 June 2010 12:27 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jack clouseau wrote:
> Thanks for the info paul...
>
> Ok will use the Install New Software feature to install my feature.
> And btw just out of curiosity, what kind of problem i may encounter if i
> manually drop it in the plugins folder?

Eclipse will ignore a plugin simply placed in the eclipse/plugins
folder. Eclipse will try to install a plugin placed in the
eclipse/dropins folder.

>
> OK, will this System.exec(*) will be trigged even in Linux platform? Or
> do i need to use a different command for Linux platform?

Yes, but ... depending on what you are trying to launch, you will have
to do some things differently.

eclipse.exe vs eclipse, for example, or call different scripts:
cmd.exe /C rcp.bat
/bin/bash -l rcp.sh

If you can launch another JVM with your equinox launcher and some
arguments, you can avoid most of the guessing about what scripts to launch.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding Menu in Eclipse MenuBar [message #541902 is a reply to message #541121] Wed, 23 June 2010 05:51 Go to previous message
Jack Clouseau is currently offline Jack ClouseauFriend
Messages: 22
Registered: June 2010
Junior Member
Thanks Paul...

will get back to you if i face anyother issues....thanks a lot for your help/info/guidance...


cheers,
Jack
Previous Topic:making runnable jar with folder structure
Next Topic:Hidden editor markers
Goto Forum:
  


Current Time: Thu Apr 25 10:28:44 GMT 2024

Powered by FUDForum. Page generated in 0.05517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top