[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: How to get a window to front in SWT?

Yes, works,

My problem was that
display.getActiveShell() did not work, means returns null
because it did not have the focus at this moment.

So

final Shell[] shells = display.getShells();
shells[shells.length-1].forceActive();

sets the latest shell active and to front - this seems to be what I need.

Thank you,
Joerg



Stefan Pietsch wrote:

Sorry! I meant Shell.forceActive()

"Stefan Pietsch" <pietsch@xxxxxxxxxxxxx> schrieb im Newsbeitrag
news:csm0qh$9le$1@xxxxxxxxxxxxxxxxxx
Hi Joerg,

I think you have to call Shell.setActive()

Bye Stefan

"Joerg Baumgaertel" <jb2.403@xxxxxxxxxxxx> schrieb im Newsbeitrag
news:cslkru$jk0$1@xxxxxxxxxxxxxxxxxx
> Hi,
>
> does anybody know how to get a window in SWT to Front ?
> The equivalent AWT command is 'window.toFront()'.
>
> Currently in front is a foreign application window.
> I want Eclipse to open a requested source
> code and to get the Workbench with the editor to front
> on top of the foreign application window.
> The behaviour is like to reach a breakpoint.
>
> Source code looks like here yet
> ..
> final IType type = (IType) match.getElement();
> final Display display = Display.getDefault();
> display.syncExec(new Runnable() {
>   public void run() {
>     try {
>       IEditorPart part= EditorUtility.openInEditor(type, true);
>       EditorUtility.revealInEditor(part, type);
>       display.getActiveShell().setActive(); // !!! ...
>       // ... here i need a toFront() instead but how to do that?
>     } catch (Exception e){
>       e.printStackTrace();
>     };
>   }
> });
> ..
>
> Thanks in advance,
> Regards,
> Joerg
>
>