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