Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Exception Workbench has not been created yet(With Eclipse 4 Application)
Exception Workbench has not been created yet [message #1067414] Mon, 08 July 2013 14:43 Go to next message
AIT YAHIA Idir is currently offline AIT YAHIA IdirFriend
Messages: 39
Registered: April 2013
Member
Hello,

I have created an RCP application with E4 Application model, it's work fine but when a i try to get some Workbench ressources i get a java.lang.IllegalStateException: Workbench has not been created yet.

For example when calling

PlatformUI.getWorkbench().getDisplay();


from what I read this is due to the lazy instantiation, Can someone tell me how to instantiate the workbench, I need to impélmentation some selection Dialog

Trace
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
	at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.createViewMenu(FilteredItemsSelectionDialog.java:549)
	at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.createHeader(FilteredItemsSelectionDialog.java:478)
	at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.createDialogArea(FilteredItemsSelectionDialog.java:655)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:775)
	at org.eclipse.jface.window.Window.create(Window.java:432)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1104)
	at org.eclipse.ui.dialogs.SelectionStatusDialog.create(SelectionStatusDialog.java:153)
	at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.create(FilteredItemsSelectionDialog.java:355)
	at org.eclipse.jface.window.Window.open(Window.java:791)
	at dz.iaityahia.cieptalcars.matresorerie.handlers.ExportToExcelAction.execute(ExportToExcelAction.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 33 more
  


Re: Exception Workbench has not been created yet [message #1463466 is a reply to message #1067414] Thu, 06 November 2014 15:40 Go to previous messageGo to next message
Patty Eilers is currently offline Patty EilersFriend
Messages: 10
Registered: October 2014
Junior Member
Did you ever get an answer to this or figure out how to resolve it? I am having the same issue and would like to know how you worked around it. Much appreciated....
Re: Exception Workbench has not been created yet [message #1470331 is a reply to message #1463466] Wed, 12 November 2014 08:55 Go to previous messageGo to next message
Olivier Prouvost is currently offline Olivier ProuvostFriend
Messages: 16
Registered: August 2011
Location: TOULOUSE
Junior Member

Hi,

The PlatformUI.getWorkbench() is a Eclipse 3.x method. If you are in a pure E4 application, you must not depend on org.eclipse.ui and you will not be able to call this method.

If you need to get the Display or current IWorkbench (which would be an E4 workbench), you must inject it where you need it, or you can get the Display using Display.getCurrent().
icon5.gif  Re: Exception Workbench has not been created yet [message #1695929 is a reply to message #1470331] Wed, 20 May 2015 11:21 Go to previous messageGo to next message
Crenguta Manea is currently offline Crenguta ManeaFriend
Messages: 2
Registered: May 2015
Junior Member
I am injecting the E4 Workbench (org.eclipse.e4.ui.workbench), but I still get a "Workbench has not been created yet". Is there anything else you have to do other than injecting it?
Thanks.
Re: Exception Workbench has not been created yet [message #1696001 is a reply to message #1695929] Thu, 21 May 2015 05:57 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
The question is, when are you trying to inject? Looks like you are trying to early in the startup process.
Previous Topic:"No repository found containing" error while generating P2
Next Topic:containerData effectively deprecated?
Goto Forum:
  


Current Time: Sun Dec 08 05:44:07 GMT 2024

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

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

Back to the top