|
|
|
|
Re: API to find if progress dialog is displayed ? [message #1712328 is a reply to message #1712305] |
Fri, 23 October 2015 03:51 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Gidi,
Keep in mind that shells can form a hierarchy:
org.eclipse.swt.widgets.Shell.getShells(). So one question to consider:
which shell is the parent shell of your PMF dialog? If it's the
progress dialog's shell, it will be destroyed when the progress dialog
is destroyed. Whether a progress dialog ever shows is controlled by
Window -> Preferences -> General -> Always run in background so even if
you wait, it's possible a progress dialog will show up after your dialog
shows up (though in that case your dialog shell can't be a child
shell). Probably you should focus first on determining which shell is
the parent of your dialog, and if you need code like what you show
below, it should be recursive to visit all shells. Keep in mind too
that you can do Window -> New Window so there can be more than one
top-level shell, each containing a workbench window.
On 22/10/2015 8:17 PM, Gidi Gal wrote:
> Hi Brian,
>
> Thanks for your reply. I tried running this code while the progress
> dialog was running:
> boolean hasModal = false;
> IWorkbenchWindow window =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> Shell[] shells = window.getShell().getDisplay().getShells();
> for (Shell shell: shells) {
> out.println(shell.getText());
> final int style = shell.getStyle();
> final int applicationModal = (style & SWT.APPLICATION_MODAL);
> final int primaryModal = (style & SWT.PRIMARY_MODAL);
> final int systemModal = (style & SWT.SYSTEM_MODAL);
> if ( (applicationModal > 0) || (primaryModal > 0) || (systemModal
> > 0)) { hasModal = true;
> break;
> }
> }
> if (hasModal) {
> out.println("MODAL !!!");
> }
> else {
> out.println("NOT MODAL !!!");
> }
>
> The out variable was connected to a console view. I saw the title of
> the progress dialog, so I'm sure it was tested by this code. However,
> the result was not modal.
> Is this test incorrect ?
> I'll be grateful for any thoughts\ideas.
>
> Best regards,
> Gidi
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02924 seconds