Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Initialize plugin on activation
Initialize plugin on activation [message #332107] Fri, 03 October 2008 13:36 Go to next message
Markus Schindler is currently offline Markus SchindlerFriend
Messages: 30
Registered: July 2009
Member
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 #332108 is a reply to message #332107] Fri, 03 October 2008 13:49 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Usually you kick off a long-running Job from your start. i.e.:

new Job("initializeMe") { ....}.schedule();

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Initialize plugin on activation [message #332110 is a reply to message #332108] Fri, 03 October 2008 15:32 Go to previous messageGo to next message
Markus Schindler is currently offline Markus SchindlerFriend
Messages: 30
Registered: July 2009
Member
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Markus Schindler is currently offline Markus SchindlerFriend
Messages: 30
Registered: July 2009
Member
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:show information in problems view
Next Topic:Adding an XML Editor to a product
Goto Forum:
  


Current Time: Sat Jul 13 02:42:35 GMT 2024

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

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

Back to the top