| register a listener at workbench/plugin start [message #332105] | 
Fri, 03 October 2008 04: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 #332144 is a reply to message #332123] | 
Mon, 06 October 2008 22: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.05812 seconds