How to get a window to front in SWT? [message #449204] |
Wed, 19 January 2005 12:46 |
Eclipse User |
|
|
|
Originally posted by: jb2.403.jb2works.com
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
|
|
|
|
|
Re: How to get a window to front in SWT? [message #449220 is a reply to message #449216] |
Wed, 19 January 2005 17:50 |
Eclipse User |
|
|
|
Originally posted by: jb2.403.jb2works.com
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@multichart.de> schrieb im Newsbeitrag
> news:csm0qh$9le$1@www.eclipse.org...
>> Hi Joerg,
>>
>> I think you have to call Shell.setActive()
>>
>> Bye Stefan
>>
>> "Joerg Baumgaertel" <jb2.403@jb2works.com> schrieb im Newsbeitrag
>> news:cslkru$jk0$1@www.eclipse.org...
>> > 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
>> >
>> >
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03158 seconds