how to know workbench is ready to use [message #332333] |
Mon, 20 October 2008 04:34  |
Eclipse User |
|
|
|
I tried to call org.eclipse.ui.PlatformUI.getWorkbench() but got the
following error:
java.lang.IllegalStateException: Workbench has not been created yet.
Highly appreciate if some one tells me how I can know the workbench is
ready to use.
thanks!
|
|
|
Re: how to know workbench is ready to use [message #332353 is a reply to message #332333] |
Mon, 20 October 2008 10:35   |
Eclipse User |
|
|
|
Hao,
I've never seen such a thing before. At what point are you calling this?
Hao wrote:
> I tried to call org.eclipse.ui.PlatformUI.getWorkbench() but got the
> following error:
> java.lang.IllegalStateException: Workbench has not been created yet.
>
> Highly appreciate if some one tells me how I can know the workbench is
> ready to use.
>
> thanks!
|
|
|
Re: how to know workbench is ready to use [message #332363 is a reply to message #332353] |
Mon, 20 October 2008 14:05   |
Eclipse User |
|
|
|
<
I've never seen such a thing before. At what point are you calling this?
Hao wrote:
I tried to call org.eclipse.ui.PlatformUI.getWorkbench() but got the
following error:
java.lang.IllegalStateException: Workbench has not been created yet.
>
I am calling this in plugin activator's start() method.
thanks
|
|
|
Re: how to know workbench is ready to use [message #332369 is a reply to message #332363] |
Mon, 20 October 2008 15:46   |
Eclipse User |
|
|
|
Would it work to use Display.asyncExec to delay running the code that needs
to access the Workbench?
Boris
"Hao " <d95776@yahoo.com> wrote in message
news:aa091c8b136931aaff0ea0e0fb5a24e8$1@www.eclipse.org...
> <
> I've never seen such a thing before. At what point are you calling this?
>
>
> Hao wrote:
>
> I tried to call org.eclipse.ui.PlatformUI.getWorkbench() but got the
> following error:
> java.lang.IllegalStateException: Workbench has not been created yet.
>
>>
>
> I am calling this in plugin activator's start() method.
>
> thanks
>
|
|
|
Re: how to know workbench is ready to use [message #332373 is a reply to message #332363] |
Mon, 20 October 2008 16:14   |
Eclipse User |
|
|
|
Hao,
That's a bad idea. What goal are you trying to achieve?
Hao wrote:
> <
> I've never seen such a thing before. At what point are you calling this?
>
>
> Hao wrote:
>
> I tried to call org.eclipse.ui.PlatformUI.getWorkbench() but got the
> following error:
> java.lang.IllegalStateException: Workbench has not been created yet.
>
>>
>
> I am calling this in plugin activator's start() method.
>
> thanks
>
|
|
|
Re: how to know workbench is ready to use [message #332401 is a reply to message #332373] |
Tue, 21 October 2008 02:42   |
Eclipse User |
|
|
|
<
That's a bad idea. What goal are you trying to achieve?
>
I tried to load the plug-in configuration information when the plug-in
starts. The configuration information is in a file which locates at the
root of the plug-in. I try to do the following
DDPlatformActivator.getDefault().getBundle().getEntry(ENV_CO NFIG_FILE) in
start.
|
|
|
|
Re: how to know workbench is ready to use [message #332414 is a reply to message #332404] |
Tue, 21 October 2008 08:43   |
Eclipse User |
|
|
|
Hao,
As Boris suggests, the only way is to delay what you're doing and the
way to achieve that is to post an event to the event queue. Hopefully
calling Display.getDefault wouldn't cause any problems and then you can
use that to follow Boris' advice. I'm still not sure why your plugin is
starting so early. It's usually a bad design idea to start plugins
early. If everyone did that, it could take minutes for the IDE to start...
Hao wrote:
> <
> That's a bad idea. What goal are you trying to achieve?
>>
>
> I also tried to enable/disable activities by calling
> PlatformUI.getWorkbench().getActivitySupport();
>
|
|
|
Re: how to know workbench is ready to use [message #332418 is a reply to message #332414] |
Tue, 21 October 2008 09:05   |
Eclipse User |
|
|
|
Ed Merks wrote:
> As Boris suggests, the only way is to delay what you're doing and the
> way to achieve that is to post an event to the event queue. Hopefully
> calling Display.getDefault wouldn't cause any problems and then you can
> use that to follow Boris' advice.
Calling Display.getDefault() in a BundleActivator implementation may
cause problems. Bug 250048 will provide some additional context
regarding this problem.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=250048
> Hao wrote:
>> I also tried to enable/disable activities by calling
>> PlatformUI.getWorkbench().getActivitySupport();
This is certainly odd. I would expect the workbench to be up when your
plug-in has started. Your plug-in depends on org.eclipse.ui after all,
right? Is this consistently reproducible? This getActivitySupport()
invocation is in your AbstractUIPlugin subclass's start(BundleContext)
method, correct?
Remy
|
|
|
Re: how to know workbench is ready to use [message #332421 is a reply to message #332418] |
Tue, 21 October 2008 11:02   |
Eclipse User |
|
|
|
[
This is certainly odd. I would expect the workbench to be up when your
plug-in has started. Your plug-in depends on org.eclipse.ui after all,
right? Is this consistently reproducible? This getActivitySupport()
invocation is in your AbstractUIPlugin subclass's start(BundleContext)
method, correct?
]
Yes. That's exactly what I am doing for both activities hiding/showing and
loading configuration file.
|
|
|
Re: how to know workbench is ready to use [message #332429 is a reply to message #332414] |
Tue, 21 October 2008 16:12   |
Eclipse User |
|
|
|
[
As Boris suggests, the only way is to delay what you're doing and the way
to achieve that is to post an event to the event queue. Hopefully calling
Display.getDefault wouldn't cause any problems and then you can use that
to follow Boris' advice. I'm still not sure why your plugin is starting
so early. It's usually a bad design idea to start plugins early. If
everyone did that, it could take minutes for the IDE to start...
]
I tried
Display.getDefault().syncExec(new Runnable(){
public void run() {
getConfigManager();
}
});
in activator and got the following error.
Caused by: java.lang.IllegalStateException: Workbench has not been created
yet.
and
org.eclipse.swt.SWTException: Invalid thread access
Is there any way to be notified when Workbench is ready?
|
|
|
|
Re: how to know workbench is ready to use [message #332503 is a reply to message #332433] |
Thu, 23 October 2008 18:45   |
Eclipse User |
|
|
|
[
Create a new UIJob, that ensures that your job won't be run until the
workbench is up and ready
]
Hi,
do you mind tell how the UIJob will ensure my job won't be run until the
workbench is ready? From UIJob itself, I could not find the fact.
thanks
|
|
|
Re: how to know workbench is ready to use [message #332504 is a reply to message #332503] |
Thu, 23 October 2008 18:54   |
Eclipse User |
|
|
|
Originally posted by: zx.code9.com
Hao wrote:
> [
> Create a new UIJob, that ensures that your job won't be run until the
> workbench is up and ready
> ]
>
> Hi,
> do you mind tell how the UIJob will ensure my job won't be run until the
> workbench is ready? From UIJob itself, I could not find the fact.
It happens for free :)
UIJob's won't run until the workbench is ready.
Cheers,
~ Chris
|
|
|
|
Re: how to know workbench is ready to use [message #332628 is a reply to message #332523] |
Mon, 03 November 2008 09:24  |
Eclipse User |
|
|
|
Hao wrote:
> [UIJob's won't run until the workbench is ready.]
>
> Hi,
>
> UIJob does make it work. Thanks a lot. I am curious a little bit. Can
> you briefly explain how the UIJob knows the workbench is ready?
Checking the (public) query function
PlatformUI.isWorkbenchRunning()
HTH & Greetings from Bremen,
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.04506 seconds