API to find if progress dialog is displayed ? [message #1712218] |
Thu, 22 October 2015 03:51  |
Eclipse User |
|
|
|
Hello to the forum members,
I'm looking for an API that will return true\false whether Eclipse is displaying progress dialog. I'll explain why I'm looking for such API:
My plugins are embedding ActiveX code that runs MFC code. The MFC code launches a modal dialog box when progress dialog is displayed in Eclipse. Once the progress dialog box is closed the MFC dialog box is destroyed and Eclipse UI is disabled - any click on Eclipse window will only yield beep sound. After trying unsuccessfully to hack into the Window messages being sent to the MFC dialog and disable the ones that destroy the dialog box, I'm trying a different angle. I have interface from the MFC code to Eclipse. I'm thinking of postponing the launch of the modal MFC dialog to after the progress dialog is closed. Obviously, this is not a perfect solution - another progress dialog may pop-up later, but currently I don't have other solution for this issue. For that behavior I need to know if the progress dialog is displayed.
Many thanks for your help,
Gidi
|
|
|
|
|
|
Re: API to find if progress dialog is displayed ? [message #1712328 is a reply to message #1712305] |
Thu, 22 October 2015 23:51   |
Eclipse User |
|
|
|
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
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02580 seconds