mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Return the shell from any available workbench window if none are active. Noticed Debug Platform does this.
This commit is contained in:
parent
f20f970bc8
commit
05a796346b
1 changed files with 9 additions and 4 deletions
|
@ -223,13 +223,18 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the active workbench shell or <code>null</code> if none
|
* Returns the active workbench shell, or the shell from the first available
|
||||||
*
|
* workbench window, or <code>null</code> if neither is available.
|
||||||
* @return the active workbench shell or <code>null</code> if none
|
|
||||||
*/
|
*/
|
||||||
public static Shell getActiveWorkbenchShell() {
|
public static Shell getActiveWorkbenchShell() {
|
||||||
IWorkbenchWindow window = getActiveWorkbenchWindow();
|
IWorkbenchWindow window = getActiveWorkbenchWindow();
|
||||||
if ( window != null ) {
|
if (window == null) {
|
||||||
|
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||||
|
if (windows.length > 0) {
|
||||||
|
return windows[0].getShell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
return window.getShell();
|
return window.getShell();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue