Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Add button to Console toolbar(How to add a button to the Console toolbar.)
Add button to Console toolbar [message #1279202] Fri, 28 March 2014 11:37 Go to next message
Peter Robertson is currently offline Peter RobertsonFriend
Messages: 14
Registered: April 2012
Location: Scotland
Junior Member
I wish to add a button to an application's Console toolbar.

Putting the following in the relevant plugin.xml successfully puts a working button on the Console toolbar:

<extension point="org.eclipse.ui.viewActions">
   <viewContribution
      id="com.xxx.yyy.launch.viewContribution1"
      targetID="org.eclipse.ui.console.ConsoleView">
      <action label="Expand"
              class="com.xxx.yyy.launch.actions.ExpandAction"
              icon="icons/expand.gif"
              id="com.xxx.yyy.launch.action.expand"
              style="push"
              toolbarPath="toolbar"
              tooltip="Expand"/>
   </viewContribution>
</extension>

However, the extension point, viewContribution, and action are marked as deprecated.

I have tried to get the same effect using the extension point org.eclipse.ui.commands (as indicated in the deprecated message) like this,
where expand.button has been defined as a command:

<extension point="org.eclipse.ui.menus">
   <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
      <toolbar id="toolbar1">
         <command commandId="expand.button"/>
      </toolbar>
   </menuContribution>
   <menuContribution locationURI="toolbar:org.eclipse.ui.console.ConsoleView">
      <toolbar id="toolbar2">
         <command commandId="expand.button"/> 
      </toolbar>
   </menuContribution>
</extension>

This correctly puts a working 'expand' button on the main toolbar, but one does not appear on the Console toolbar.

Can anyone suggest what is wrong with this?
Re: Add button to Console toolbar [message #1313376 is a reply to message #1279202] Thu, 24 April 2014 21:27 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 298
Registered: July 2009
Senior Member

Hi Peter,

You cannot put a toolbar in the toolbar of a view. Put a command directly on the view toolbar like so:

<menuContribution locationURI="toolbar:org.eclipse.ui.console.ConsoleView">
<command commandId="expand.button"/>
</menuContribution>

Cheers,

Wim
Previous Topic:Eclipse 4 contributions to the IDE
Next Topic:Persist selection on tree viewer on restart of application using memento
Goto Forum:
  


Current Time: Fri Dec 19 08:10:36 GMT 2014

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

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