Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Problem when manually activating bundles
Problem when manually activating bundles [message #501979] Fri, 04 December 2009 15:47
Michael Matzen is currently offline Michael MatzenFriend
Messages: 13
Registered: July 2009
Junior Member
Hi all,

i have some jface problems when loading a custom bundle with commands,
handler, menus and bindings.

I am using the following lines of code to install a bundle:

Bundle b = bundle.getBundleContext().installBundle(editorDiagramName, in);

Where 'bundle' is the bundle that contains a custom extension point, it
is resolved by using the ContributorFactoryOSGI.resolve method and 'in'
is the input stream to the bundle.

There is no problem loading the bundle, but when its content is
activated, jface does not seem to like my stuff :)


1. When the bundle contains binding extensions, the BindingManager
throws a lot of undefined context exceptions. This exception is thrown
because the BindingManager tries to reload all the Bindings, even if the
Contexts not have been initialized yet.
(The error log can be found at :
https://bugs.eclipse.org/bugs/attachment.cgi?id=151053)

Well that may be solved by adding a check if the context has been
activated before getting the id, but i wonder why this exception is
thrown anyway.
When the platform loads a bundle by using lazy-loading, there are no
exceptions, so why is it thrown here?


2. Same situation: Loading a bundle during runtime.
If the bundle contains a menu contribution with a sub menu (at least
i've never got an exception when only adding simple menu commands),
the ContributionManager throws an index out of bounds exception when
inserting the item.
Same question: Why does that never happen when the platform is loading
bundles but when i am manually loading them ?

Is it a timing problem ? Do i need to have special settings when
lazy-loading stuff that interacts with jface?





Exception trace for second error:

java.lang.IndexOutOfBoundsException: Index: 4, Size: 1
at java.util.ArrayList.add(ArrayList.java:367)
at
org.eclipse.jface.action.ContributionManager.insert(Contribu tionManager.java:322)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService$5.run(Wor kbenchMenuService.java:599)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.processAd ditions(WorkbenchMenuService.java:609)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.addContri butionsToManager(WorkbenchMenuService.java:670)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.populateC ontributionManager(WorkbenchMenuService.java:656)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.addContri butionsToManager(WorkbenchMenuService.java:708)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.addContri butionFactory(WorkbenchMenuService.java:464)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.handleDyn amicAdditions(WorkbenchMenuService.java:908)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.handleMen uChanges(WorkbenchMenuService.java:974)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService.handleReg istryChanges(WorkbenchMenuService.java:1021)
at
org.eclipse.ui.internal.menus.WorkbenchMenuService$2.run(Wor kbenchMenuService.java:262)
at
org.eclipse.ui.internal.UILockListener.doPendingWork(UILockL istener.java:155)
at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer. java:158)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3115)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Previous Topic:JFace ViewerFilter -- HowTo hide parent when all children are filtered?
Next Topic:TreeViewer expansion
Goto Forum:
  


Current Time: Fri Apr 19 11:09:15 GMT 2024

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

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

Back to the top