Community
Participate
Working Groups
There is a problem while adding a command to a view's tool bar. Same command works fine when it's added to the main tool bar and menu. Stack trace and relevant part of the plugin.xml are below: ==================plugin.xml================================ <extension point="org.eclipse.ui.views"> <view name="Example List" icon="icons/sample3.gif" class="com.viithiisys.example.views.ExampleListView" id="com.viithiisys.example.views.exampleListView"> </view> </extension> <extension point="org.eclipse.ui.commands"> <category name="Example" id="com.viithiisys.example.category"> </category> <command name="Edit Example" description="Opens Example editor" categoryId="com.viithiisys.example.category" id="com.viithiisys.example.commands.openExampleEditor" defaultHandler="com.viithiisys.example.actions.OpenEditorHandler"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:com.viithiisys.example.views.exampleListView"> <toolbar id="menu-contribution.toolbars.sampleToolbar"> <command commandId="com.viithiisys.example.commands.openExampleEditor" icon="icons/sample.gif" tooltip="Say hello world" id="menu-contribution.toolbars.sampleCommand"> </command> </toolbar> </menuContribution> </extension> =======================stack trace========================== !STACK 0 java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:3084) at org.eclipse.swt.SWT.error(SWT.java:3018) at org.eclipse.swt.SWT.error(SWT.java:2989) at org.eclipse.swt.internal.widgets.ItemHolder.getItem(ItemHolder.java:102) at org.eclipse.swt.widgets.ToolBar.getItem(ToolBar.java:132) at org.eclipse.rap.internal.design.example.managers.ViewToolBarManager.update(ViewToolBarManager.java:161) at org.eclipse.ui.internal.ViewPane.updateActionBars(ViewPane.java:462) at org.eclipse.ui.internal.ViewActionBars.updateActionBars(ViewActionBars.java:59) at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:419) at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:230) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:312) at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:544) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:185) at org.eclipse.rap.internal.design.example.stacks.ViewStackPresentation.selectPart(ViewStackPresentation.java:957) at org.eclipse.rap.ui.interactiondesign.internal.ConfigurableStackProxy.selectPart(ConfigurableStackProxy.java:425) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1267) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1220) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1619) at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:659) at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:585) at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:569) at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:267) at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:930) at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2494) at org.eclipse.ui.internal.WorkbenchWindow$22.run(WorkbenchWindow.java:2926) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66) at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2907) at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:720) at org.eclipse.ui.internal.Workbench$18.runWithException(Workbench.java:976) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) at org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync(UICallBackManager.java:115) at org.eclipse.swt.widgets.Display$2.run(Display.java:931) at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.runNonUIThreadWithFakeContext(UICallBackServiceHandler.java:460) at org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeContext(UICallBack.java:44) at org.eclipse.swt.widgets.Display.syncExec(Display.java:929) at org.eclipse.ui.internal.StartupThreading.runWithWorkbenchExceptions(StartupThreading.java:55) at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:972) at org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:1799) at org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1735) at org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:188) at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:790) at org.eclipse.ui.internal.Workbench$25.runWithException(Workbench.java:1341) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) at org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync(UICallBackManager.java:115) at org.eclipse.swt.widgets.Display$2.run(Display.java:931) at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.runNonUIThreadWithFakeContext(UICallBackServiceHandler.java:460) at org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeContext(UICallBack.java:44) at org.eclipse.swt.widgets.Display.syncExec(Display.java:929) at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:110) at org.eclipse.ui.internal.Workbench.init(Workbench.java:1336) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2317) at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2206) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:424) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.jface.internal.databinding.realmadapter.RealmAdapter.run(RealmAdapter.java:44) at org.eclipse.rap.ui.internal.RealmAdapterHook.runWithDefault(RealmAdapterHook.java:48) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:427) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157) at com.viithiisys.example.Application.start(Application.java:20) at org.eclipse.rap.ui.internal.application.EntrypointApplicationWrapper.createUI(EntrypointApplicationWrapper.java:27) at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92) at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:253) at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:117) at java.lang.Thread.run(Thread.java:619) at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:80)
There are also problem with the viewmenu. If I add a command, it works fine for the first time. However, when I close the server and restart, following exception is thrown. java.lang.IllegalArgumentException: The control was not added to this control holder. at org.eclipse.swt.widgets.ControlHolder.remove(ControlHolder.java:62) at org.eclipse.swt.widgets.ControlHolder.removeControl(ControlHolder.java:116) at org.eclipse.swt.widgets.Control.moveAbove(Control.java:1401) at org.eclipse.rap.internal.design.example.stacks.ViewStackPresentation.layoutToolBar(ViewStackPresentation.java:320) at org.eclipse.rap.internal.design.example.stacks.ViewStackPresentation.setBounds(ViewStackPresentation.java:1199) at org.eclipse.rap.internal.design.example.stacks.ViewStackPresentation.selectPart(ViewStackPresentation.java:971) at org.eclipse.rap.ui.interactiondesign.internal.ConfigurableStackProxy.selectPart(ConfigurableStackProxy.java:425) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1267) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1220) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1619) at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:659) at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:585) at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:569) at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:267) at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:930) at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2494) at org.eclipse.ui.internal.WorkbenchWindow$22.run(WorkbenchWindow.java:2926) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66) at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2907) at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:720) at org.eclipse.ui.internal.Workbench$18.runWithException(Workbench.java:976) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) at org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync(UICallBackManager.java:115) at org.eclipse.swt.widgets.Display$2.run(Display.java:931) at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.runNonUIThreadWithFakeContext(UICallBackServiceHandler.java:460) at org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeContext(UICallBack.java:44) at org.eclipse.swt.widgets.Display.syncExec(Display.java:929) at org.eclipse.ui.internal.StartupThreading.runWithWorkbenchExceptions(StartupThreading.java:55) at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:972) at org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:1799) at org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1735) at org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:188) at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:790) at org.eclipse.ui.internal.Workbench$25.runWithException(Workbench.java:1341) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) at org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync(UICallBackManager.java:115) at org.eclipse.swt.widgets.Display$2.run(Display.java:931) at org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler.runNonUIThreadWithFakeContext(UICallBackServiceHandler.java:460) at org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeContext(UICallBack.java:44) at org.eclipse.swt.widgets.Display.syncExec(Display.java:929) at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:110) at org.eclipse.ui.internal.Workbench.init(Workbench.java:1336) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2317) at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2206) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:424) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.jface.internal.databinding.realmadapter.RealmAdapter.run(RealmAdapter.java:44) at org.eclipse.rap.ui.internal.RealmAdapterHook.runWithDefault(RealmAdapterHook.java:48) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:427) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157) at com.viithiisys.example.Application.start(Application.java:20) at org.eclipse.rap.ui.internal.application.EntrypointApplicationWrapper.createUI(EntrypointApplicationWrapper.java:27) at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92) at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:253) at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:117) at java.lang.Thread.run(Thread.java:619) at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:80) !SESSION 2010-04-15 00:52:22.992 ---------------------------------
This is the relevant part of plugin.xml <menuContribution locationURI="menu:com.viithiisys.example.views.exampleListView?after=additions"> <menu label="Sample Menu" mnemonic="M" id="menu-contribution.menus.sampleMenu"> <command commandId="com.viithiisys.example.commands.createExampleCommand" mnemonic="S" id="com.viithiisys.example.views.menu.createExampleCommand"> </command> </menu> </menuContribution>
viewmenu problem is tricky one and I will explain a bit about it. Adding command to view menu does not show even I have the "viewActionVisibility" attribute of presentationFactory is set to true. If I configure the viewmenu through configuration icon on view, it would show the action on view. Now, if I stop the server and restart it, IllegalArgumentException is thrown mentioned in the previous comment. If I delete the stuff from workspace/.metadata/, view will show again but without the viewmenu visible. Below is the relevant part plugin.xml branding and menu contribution <extension point="org.eclipse.rap.ui.branding"> <branding servletName="example" themeId="org.eclipse.rap.design.example.business.theme" defaultEntrypointId="com.viithiisys.example.Application" title="Example demo" id="com.viithiisys.mail.branding"> <presentationFactory defaultLayoutId="org.eclipse.rap.design.example.business.layout" name="Business PresentationFactory" id="org.eclipse.rap.design.example.business.factory" viewActionVisibility="true"> <defaultStackPresentation id="org.eclipse.rap.design.example.stack.view"> </defaultStackPresentation> </presentationFactory> </branding> </extension> <menuContribution locationURI="menu:com.viithiisys.example.views.exampleListView?after=additions"> <menu label="Sample Menu" mnemonic="M" id="menu-contribution.menus.sampleMenu"> <command commandId="com.viithiisys.example.commands.createExampleCommand" mnemonic="S" id="com.viithiisys.example.views.menu.createExampleCommand"> </command> </menu> </menuContribution>
Raj, I can't reproduce the error. Can you provide a sample bundle which provokes the error please? Regards Holger
Created attachment 165253 [details] Example application to reproduce the error Holger, I have attached the sample application. I have commented the server side calling code and you should be able to run it as plain RAP application. My RAP target platform is RAP 1.3M6 and development environment is Eclipse 3.6M6 Steps to re-produce for view tool bar 1. Unzip the application in your workspace and import as "Existing project" 2. Run the application is RAP application. 3. While application loads in the browser you should see the java.lang.IllegalArgumentException: Index out of bounds and browser page remains blank. 4. Change the menu contribution back to Eclipse main menu and command will appear in the Coolbar. Steps to re-produce for view menu: (Even though viewActionVisibility attribute is set to true, view menu is not visible by default.) 1. Enable the view menu by enabling it in the configuration setting of the view. 2. View menu will be visible. 3. Stop the application. 4. Restart the application and exception will be thrown as mentioned comment #1 5. Remove the workspace and application will be back but without the view menu.
Created attachment 165255 [details] example application to re-produce the bug Holger, I have attached the sample application. I have commented the server side calling code and you should be able to run it as plain RAP application. My RAP target platform is RAP 1.3M6 and development environment is Eclipse 3.6M6 Steps to re-produce for view tool bar 1. Unzip the application in your workspace and import as "Existing project" 2. Run the application is RAP application. 3. While application loads in the browser you should see the java.lang.IllegalArgumentException: Index out of bounds and browser page remains blank. 4. Change the menu contribution back to Eclipse main menu and command will appear in the Coolbar. Steps to re-produce for view menu: (Even though viewActionVisibility attribute is set to true, view menu is not visible by default.) 1. Enable the view menu by enabling it in the configuration setting of the view. 2. View menu will be visible. 3. Stop the application. 4. Restart the application and exception will be thrown as mentioned comment #1 5. Remove the workspace and application will be back but without the view menu. To me it looks the problem is with Business theme. Anyway, you will need the business theme to make the example work as example application is using the business theme.
Sorry Raj but when I start your application I got no Exceptions. Do I have to add something?
Hi Holger, It is strange. I tried it more than 10 times and I get the exactly same problem. If it is working for you, do you see the command icon on view tool bar and in view menu? Also did you try deleting your workspace/.metadata? I tested it with M6 and with the business theme. Are you sure you are using M6 with business theme from M6? Also let me know your target platform and I will try to re-produce on that. One more thing though I am not sure it is going to make difference. My dev environment is Ubuntu 10.04 running 64 bit Eclipse. Regards, Raj
Hey Raj, I tried it again with M6 and HEAD. I got no errors. I used your command tom make a menuContribution (see bellow) and everything works fine. So, can you provide a bundle which provides the menuContributions as well as the commands? Thanks in advance. Regards Holger created menuContribution: <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:com.viithiisys.example.view?after=additions"> <command commandId="com.viithiisys.example.open" icon="icons/sample3.gif" id="aId" label="command" style="push"> </command> </menuContribution> </extension>
Hi Holger, The example code attached to this application has every thing needed. It has view, commands and command contribution. You should be able to run this as RAP application.
> to this application Read "to this bug"
Raj, there is no menuContribution in the attached project. With the menuContribution from comment#9 everything is working as expected.
Hey Raj, seems that Ivan can't reproduce the bug too. So, I will close the bug now. If you run into the problem again, please feel free to reopen the bug with further information. Thanks.