<html><body><div><div>Execute your code inside Display.asyncExecute? (Not sure about the method name, but it is something like this)</div><div><br></div><div><br></div><div>-------- Mensagem original --------</div><div>De: Fred Bricon &lt;fbricon@redhat.com&gt; </div><div>Data: 15/07/2015  11:26  (GMT-03:00) </div><div>Para: jbosstools-dev jbosstools-dev &lt;jbosstools-dev@lists.jboss.org&gt; </div><div>Assunto: [jbosstools-dev] Fwd: Quick SWT Question </div><div><br></div></div><br><div><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">CC-ing to jbosstools-dev for more exposure<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Début du message réexpédié :</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">De: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Ian Stewart-Binks &lt;<a href="mailto:istewart@redhat.com" class="">istewart@redhat.com</a>&gt;<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Objet: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Quick SWT Question</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Date: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">15 juillet 2015 09:05:06 UTC−4<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">À: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Denis Golovin &lt;<a href="mailto:degolovi@redhat.com" class="">degolovi@redhat.com</a>&gt;<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Cc: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Fred Bricon &lt;<a href="mailto:fbricon@redhat.com" class="">fbricon@redhat.com</a>&gt;<br class=""></span></div><br class=""><div class="">Hi Denis,<br class=""><br class="">I'm the JBoss Tools intern here at Red Hat, working on an Eclipse plugin called Buildship[1].<br class=""><br class="">I have an SWT related question, and my mentor, Fred Bricon, has suggested that I ask it to you.<br class=""><br class="">The plugin I'm working with makes a call to getWorkbench().getActiveWorkbenchWindow() in the plugin's Activator's .start() method.<br class="">This call returns null when it is not run on the UI thread, so the code is assuming that the .start() method will always<br class="">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?<br class=""><br class="">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.<br class=""><br class="">The offending line attempts to register a selection listener. Here it is:<br class="">((ISelectionService) getWorkbench().getActiveWorkbenchWindow().getService(ISelectionService.class)).addSelectionListener(this.contextActivatingSelectionListener);<br class=""><br class="">Do you know of any other ways to register this listener?<br class=""><br class="">Your help is greatly appreciated.<br class=""><br class="">Thank you,<br class="">Ian<br class=""><br class="">[1] - <a href="https://github.com/eclipse/buildship/" class="">https://github.com/eclipse/buildship/</a><br class="">[2] - <a href="http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fplugin%2FAbstractUIPlugin.html" class="">http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fplugin%2FAbstractUIPlugin.html</a><br class=""></div></blockquote></div><br class=""></div></body></html>