register a listener at workbench/plugin start [message #332105] |
Fri, 03 October 2008 08:20  |
Eclipse User |
|
|
|
Hi!
What is the best to way to make a plugin that registers a selection
listener in a view from another plugin just as it starts?
Note that I want this plugin to start imediatly afert the workbench
starts, but i cannot register the selection listener in the start() or
earlyStart() methods since there is no SelectionService yet.
Cheers,
André
|
|
|
Re: register a listener at workbench/plugin start [message #332114 is a reply to message #332105] |
Sat, 04 October 2008 05:37   |
Eclipse User |
|
|
|
Workbench provide a listener which provide event when workbench window
opening. Using this, you can make delayed activator.
André Ribeiro wrote:
> Hi!
>
> What is the best to way to make a plugin that registers a selection
> listener in a view from another plugin just as it starts?
>
> Note that I want this plugin to start imediatly afert the workbench
> starts, but i cannot register the selection listener in the start() or
> earlyStart() methods since there is no SelectionService yet.
>
> Cheers,
> André
|
|
|
|
Re: register a listener at workbench/plugin start [message #332144 is a reply to message #332123] |
Tue, 07 October 2008 02:22  |
Eclipse User |
|
|
|
These are codes of mine. So remember, It is not given from eclipse, so
you may can't trust this method.
Plugin Activator codes:
public void start(BundleContext context) throws Exception {
super.start(context);
this.dynamicStateInitializer =
new DynamicCommandStateManager(getWorkbench());
dynamicStateInitializer.activate();
plugin = this;
}
DynamicCommandStateManager.activate():
public final void activate() {
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
// What if workbench is ready, just activating now.
if (window != null) {
this.window = window;
_activate();
}
// If there is no Workbench window,
// register listener which will acitvate later.
else {
workbench.addWindowListener(delayedActivator);
}
}
André Ribeiro wrote:
> could you point me where is it?
>
> i just could find this one
> http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/reference/api/org/eclipse/ui/IWorkbenchListener.html
>
>
> wich only has methods for shutdown events ...
>
> Jiyul wrote:
>> Workbench provide a listener which provide event when workbench window
>> opening. Using this, you can make delayed activator.
>>
>> André Ribeiro wrote:
>>> Hi!
>>>
>>> What is the best to way to make a plugin that registers a selection
>>> listener in a view from another plugin just as it starts?
>>>
>>> Note that I want this plugin to start imediatly afert the workbench
>>> starts, but i cannot register the selection listener in the start()
>>> or earlyStart() methods since there is no SelectionService yet.
>>>
>>> Cheers,
>>> André
|
|
|
Powered by
FUDForum. Page generated in 0.04235 seconds