Initialize plugin on activation [message #332107] |
Fri, 03 October 2008 13:36  |
Eclipse User |
|
|
|
Hi there,
as I read the activators start method should not used to execute some
long-running tasks. (I tried it, and get some ugly "State change in
progress for bundle" exceptions)
But where is the best place to put some plugin "initializing" jobs. Is
there any extension to do this. The startup extension, is it not!
THanks in advance!
regards
markus
|
|
|
|
Re: Initialize plugin on activation [message #332110 is a reply to message #332108] |
Fri, 03 October 2008 15:32   |
Eclipse User |
|
|
|
Thanks for your answer.
I have done following in Activator.start():
final IRunnableWithProgress statupOperation =
new IRunnableWithProgress()
public void run(final IProgressMonitor monitor) throws
InvocationTargetException, InterruptedException {
***
there I show a dialog and start some jobs like you wrote
}
};
final Shell activeShell = findStartedShell();
if (activeShell != null) {
final ProgressMonitorDialog progressMonitorDialog =
new ProgressMonitorDialog(activeShell);
progressMonitorDialog.run(false, false, statupOperation);
} else {
statupOperation.run(new NullProgressMonitor());
}
But this throws following exception:
While loading class "xxx", thread "Thread[Worker-0,5,main]" timed out
waiting (5000ms) for thread "Thread[main,6,main]" to finish starting
bundle "initial@reference:file:../../yyy/ [36]". To avoid deadlock, thread
"Thread[Worker-0,5,main]" is proceeding but "xxx" may not be fully
initialized.
a org.osgi.framework.BundleException: State change in progress for bundle
"yyy" by thread "main".
Any hints?
regards
Markus
|
|
|
Re: Initialize plugin on activation [message #332113 is a reply to message #332110] |
Fri, 03 October 2008 17:51   |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
This is still running the job in the main thread. Doing
progressMonitorDialog.run(false,...) doesn't put the job off to the
side. It runs it inline and stops the activation process.
You need to run it as a job, as mentioned in Paul's append:
Usually you kick off a long-running Job from your start. i.e.:
new Job("initializeMe") { ....}.schedule();
> Any hints?
>
> regards Markus
>
--
Thanks,
Rich Kulp
|
|
|
Re: Initialize plugin on activation [message #332116 is a reply to message #332113] |
Sat, 04 October 2008 15:15   |
Eclipse User |
|
|
|
Thanks for your reply.
If I would use a job, imho, the job would start, the activation process
ends, and in my case the perspective of my plugin is shown.
But what I want, is that the perspective is first shown after the job has
finished.
A possible solution could be, to move the job to the perspective, but this
isn't working, because other plugins uses this plugin, and if plugin 2 is
activated (by selecting the perspective 2) the "init code" in perspective
1 would not be executed.
Maybe you have a solution for this problem?
regards,
Markus
|
|
|
Re: Initialize plugin on activation [message #332127 is a reply to message #332116] |
Mon, 06 October 2008 13:01  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Markus Schindler wrote:
> Thanks for your reply. If I would use a job, imho, the job would start,
> the activation process ends, and in my case the perspective of my plugin
> is shown. But what I want, is that the perspective is first shown after
> the job has finished.
> A possible solution could be, to move the job to the perspective, but
> this isn't working, because other plugins uses this plugin, and if
> plugin 2 is activated (by selecting the perspective 2) the "init code"
> in perspective 1 would not be executed.
>
> Maybe you have a solution for this problem?
I would design the view(s) so that before the job has finished they show
nothing (or maybe a "Please wait..." label or something like that). Once
the job has finished, the View(s) can be notified so that the "real" UI
is displayed.
BTW, a StackLayout is good for that kind of thing.
Hope this helps,
Eric
|
|
|
Powered by
FUDForum. Page generated in 0.04403 seconds