<div dir="ltr">Ian,<div><br></div><div>Bundle.start() is always none UI thread. If the tool is targeting Eclipse 4 and up, you can try to use injection see details here <a href="https://wiki.eclipse.org/Eclipse4/RCP/EAS/Workbench_Services">https://wiki.eclipse.org/Eclipse4/RCP/EAS/Workbench_Services</a>. I can be more specific if you could share your source code.</div><div><br></div><div>Denis</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 15, 2015 at 7:26 AM, Fred Bricon <span dir="ltr"><<a href="mailto:fbricon@redhat.com" target="_blank">fbricon@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">CC-ing to jbosstools-dev for more exposure<br><div><br><blockquote type="cite"><div>Début du message réexpédié :</div><br><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif;color:rgba(0,0,0,1.0)"><b>De: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif">Ian Stewart-Binks <<a href="mailto:istewart@redhat.com" target="_blank">istewart@redhat.com</a>><br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif;color:rgba(0,0,0,1.0)"><b>Objet: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif"><b>Quick SWT Question</b><br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif;color:rgba(0,0,0,1.0)"><b>Date: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif">15 juillet 2015 09:05:06 UTC−4<br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif;color:rgba(0,0,0,1.0)"><b>À: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif">Denis Golovin <<a href="mailto:degolovi@redhat.com" target="_blank">degolovi@redhat.com</a>><br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif;color:rgba(0,0,0,1.0)"><b>Cc: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif">Fred Bricon <<a href="mailto:fbricon@redhat.com" target="_blank">fbricon@redhat.com</a>><br></span></div><br><div>Hi Denis,<br><br>I'm the JBoss Tools intern here at Red Hat, working on an Eclipse plugin called Buildship[1].<br><br>I have an SWT related question, and my mentor, Fred Bricon, has suggested that I ask it to you.<br><br>The plugin I'm working with makes a call to getWorkbench().getActiveWorkbenchWindow() in the plugin's Activator's .start() method.<br>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>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><br>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><br>The offending line attempts to register a selection listener. Here it is:<br>((ISelectionService) getWorkbench().getActiveWorkbenchWindow().getService(ISelectionService.class)).addSelectionListener(this.contextActivatingSelectionListener);<br><br>Do you know of any other ways to register this listener?<br><br>Your help is greatly appreciated.<br><br>Thank you,<br>Ian<br><br>[1] - <a href="https://github.com/eclipse/buildship/" target="_blank">https://github.com/eclipse/buildship/</a><br>[2] - <a href="http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fplugin%2FAbstractUIPlugin.html" target="_blank">http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fplugin%2FAbstractUIPlugin.html</a><br></div></blockquote></div><br></div><br>_______________________________________________<br>
jbosstools-dev mailing list<br>
<a href="mailto:jbosstools-dev@lists.jboss.org">jbosstools-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a><br></blockquote></div><br></div>