[jbosstools-dev] Fwd: Quick SWT Question

George Gastaldi ggastald at redhat.com
Wed Jul 15 10:35:33 EDT 2015


Execute your code inside Display.asyncExecute? (Not sure about the method name, but it is something like this)<div>
</div><div>
</div><div>-------- Mensagem original --------</div><div>De: Fred Bricon <fbricon at redhat.com> </div><div>Data: 15/07/2015  11:26  (GMT-03:00) </div><div>Para: jbosstools-dev jbosstools-dev <jbosstools-dev at lists.jboss.org> </div><div>Assunto: [jbosstools-dev] Fwd: Quick SWT Question </div><div>
</div>CC-ing to jbosstools-dev for more exposure

> Début du message réexpédié :
> 
> De: Ian Stewart-Binks <istewart at redhat.com>
> Objet: Quick SWT Question
> Date: 15 juillet 2015 09:05:06 UTC−4
> À: Denis Golovin <degolovi at redhat.com>
> Cc: Fred Bricon <fbricon at redhat.com>
> 
> Hi Denis,
> 
> I'm the JBoss Tools intern here at Red Hat, working on an Eclipse plugin called Buildship[1].
> 
> I have an SWT related question, and my mentor, Fred Bricon, has suggested that I ask it to you.
> 
> The plugin I'm working with makes a call to getWorkbench().getActiveWorkbenchWindow() in the plugin's Activator's .start() method.
> This call returns null when it is not run on the UI thread, so the code is assuming that the .start() method will always
> be run on the UI thread. The AbstractUIPlugin[2] states that the deprecated method startup(), which start() is meant to replace cannot assume that it is run on the UI thread. This may be a bit pedantic: the specification for start() doesn't mention anything about the UI thread- is it still the case that we can't assume the start() method is run on the UI thread?
> 
> If it is the case that the start method can't assume that it's run on the UI thread, I will need to change some of the code to ensure that this assumption is not made.
> 
> The offending line attempts to register a selection listener. Here it is:
> ((ISelectionService) getWorkbench().getActiveWorkbenchWindow().getService(ISelectionService.class)).addSelectionListener(this.contextActivatingSelectionListener);
> 
> Do you know of any other ways to register this listener?
> 
> Your help is greatly appreciated.
> 
> Thank you,
> Ian
> 
> [1] - https://github.com/eclipse/buildship/
> [2] - http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fplugin%2FAbstractUIPlugin.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20150715/2e8e2fa5/attachment-0001.html 
-------------- next part --------------
_______________________________________________
jbosstools-dev mailing list
jbosstools-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosstools-dev


More information about the jbosstools-dev mailing list