Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » A simple view toolbar and normal toolbar questions
A simple view toolbar and normal toolbar questions [message #973439] Tue, 06 November 2012 05:32 Go to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Hello,

I am trying to add a simple toolbar to my view.
I used the following howto http://www.vogella.com/articles/EclipseCommands/article.html#toolbar__viewtoolbar

But it seems that there is something going wrong. I don't know what, but there aren't any commands.
If I am using the normal toolbar referenced with toolbar:org.eclipse.ui.main.toolbar it works, but not with toolbar:[view id].

I can't figoure out, what I have passed out.
Re: A simple view toolbar and normal toolbar questions [message #974166 is a reply to message #973439] Tue, 06 November 2012 17:45 Go to previous messageGo to next message
Simon Scholz is currently offline Simon Scholz
Messages: 73
Registered: April 2012
Location: Germany
Member
Hello John,

Which Version of Eclipse do you use? 4.x or 3.x?
And could you please share the xml definition of the menuContribution and Commands in your plugin.xml.

Or the whole content of the plugin.xml, if it is not that much.

With that information it is easier to analyse what goes wrong Wink

Best regards,

Simon
Re: A simple view toolbar and normal toolbar questions [message #974197 is a reply to message #974166] Tue, 06 November 2012 18:14 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
I am using Eclipse 3.4 and I attached my file:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="false"
            class="executor.ui.SequencesView"
            id="executor.ui.SequencesView"
            name="Sequences"
            restorable="true">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:executor.ui.SequencesView">
         <toolbar
               id="executor.toolbar5">
            <command
                  commandId="command.create"
                  icon="icons/resume_co.gif"
                  label="test"
                  style="push">
            </command>
         </toolbar>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            id="command.create"
            name="Execute Sequence">
      </command>
   </extension>
</plugin>

Re: A simple view toolbar and normal toolbar questions [message #974946 is a reply to message #973439] Wed, 07 November 2012 08:10 Go to previous messageGo to next message
Simon Scholz is currently offline Simon Scholz
Messages: 73
Registered: April 2012
Location: Germany
Member
Hello John,

You could try this:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="false"
            class="executor.ui.SequencesView"
            id="executor.ui.SequencesView"
            name="Sequences"
            restorable="true">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:executor.ui.SequencesView">
            <command
                  commandId="command.create"
                  icon="icons/resume_co.gif"
                  label="test"
                  style="push">
            </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            id="command.create"
            name="Execute Sequence">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.handlers">
      <handler
            commandId="command.create">
         <class
               class="executor.ui.SequencesView.CommandHandler.YOURCOMMANDHANDLER">
         </class>
      </handler>
   </extension>
</plugin>


You have to define a Handler for a Command, which should be executed when the command is run.

And you do not have to use the <toolbar id="executor.toolbar5"> </toolbar>, but you can directly assign the command to the view┬┤s toolbar.

Tell me if it works.

Best regards,

Simon
Re: A simple view toolbar and normal toolbar questions [message #975111 is a reply to message #973439] Wed, 07 November 2012 11:03 Go to previous message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Thanks for the advice with the toolbar.
That was the mistake, now it works.

I didn't create a handler yet, because the symbol doesn't appear in the view toolbar.
Previous Topic:Product Export "the value for property source"
Next Topic:e4 Branding in General
Goto Forum:
  


Current Time: Wed Aug 27 21:22:47 EDT 2014

Powered by FUDForum. Page generated in 0.02691 seconds