Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » View toolbar problem(toolbars buttons disappear)
View toolbar problem [message #518597] Thu, 04 March 2010 10:15 Go to next message
Eclipse UserFriend
Hi,
I have a view that it can be instantiated several times. For this view I have added a toolbar with a button. I have the following problems:
1) when I detach the view the toolbar disappears.
2) when I have have more that one instance of the same view, only the first one get the toolbar.
This is my plugin.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="org.morcate.viewtoolbar.Application">
         </run>
      </application>
   </extension>
   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            name="RCP Perspective"
            class="org.morcate.viewtoolbar.Perspective"
            id="org.morcate.viewToolbar.perspective">
      </perspective>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="org.morcate.viewToolbar.commands.MyCommandHandler"
            id="org.morcate.viewToolbar.commands.myCommand"
            name="My Command">
      </command>
      <command
            defaultHandler="org.morcate.viewToolbar.commands.ShowViewHandler"
            id="org.morcate.viewToolbar.commands.showView"
            name="Show My View">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="true"
            class="org.morcate.viewToolbar.views.MyView"
            id="org.morcate.viewToolbar.views.myView"
            name="My View"
            restorable="false">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="org.morcate.viewToolbar.perspective">
         <view
               id="org.morcate.viewToolbar.views.myView"
               minimized="false"
               relationship="left"
               relative="org.eclipse.ui.editorss">
         </view>
      </perspectiveExtension>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:org.eclipse.ui.main.menu">
         <menu
               label="My Menu">
            <command
                  commandId="org.morcate.viewToolbar.commands.showView"
                  label="Show My View"
                  style="push">
            </command>
         </menu>
      </menuContribution>
      <menuContribution
            locationURI="toolbar:org.morcate.viewToolbar.views.myView">
         <command
               commandId="org.morcate.viewToolbar.commands.myCommand"
               icon="icons/alt_window_16.gif"
               label="My Command"
               style="push">
         </command>
      </menuContribution>
   </extension>

</plugin>

and I create the view using:
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
		IWorkbenchPage page =  window.getActivePage();
		try {
			page.showView(MyView.ID, Long.toString(System.currentTimeMillis()), IWorkbenchPage.VIEW_ACTIVATE);
		} catch (PartInitException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

Thank you
Re: View toolbar problem [message #519001 is a reply to message #518597] Fri, 05 March 2010 06:36 Go to previous message
Eclipse UserFriend
Joaquin Morcate wrote:
> Hi,
> I have a view that it can be instantiated several times. For this view I
> have added a toolbar with a button. I have the following problems:
> 1) when I detach the view the toolbar disappears.

If the toolbar was there in the view it should still be there when that
view gets detached :-) Could you please open a bug at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

> 2) when I have have more that one instance of the same view, only the
> first one get the toolbar.

I would hope we're applying menu contributions to all views with the
appropriate ID (ignoring secondary IDs). Could you open a different bug
for that at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

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
Previous Topic:Creating multiple Display objects
Next Topic:How to use RCP Problems view
Goto Forum:
  


Current Time: Fri Jun 13 09:30:03 EDT 2025

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

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

Back to the top