Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Non-modal dialogs, API to determine if dialog is already open

Unfortunately this isn't an API promise (I don't think). If we're going to start relying on it, maybe we should make it one.


On Fri, Nov 11, 2016, 04:41 Lars Vogel <lars.vogel@xxxxxxxxxxx> wrote:
Thanks everyone for the fruitful discussion and especially to Brian
for pointing out the solution.

Checking for an open dialog is very easy with Brians tip:

Shell[] shells = Display.getCurrent().getShells();
for (Shell shell : shells) {
if (shell.getData() instanceof YourWizardClass) {
     // as an example give focus to it
     shell.forceActive();
    // do more stuff
}

Best regards, Lars


On Mon, Nov 7, 2016 at 7:03 PM, Brian de Alwis <briandealwis@xxxxxxxxx> wrote:
> On 7-Nov-2016, at 5:24 AM, Mickael Istria <mistria@xxxxxxxxxx> wrote:
>
> It might be interesting to attach the dialog as a "data" of the underlying
> shell by default. Something like, in the base Dialog class, at
> initialization getShell().setData(Dialog.KEY_DIALOG, this), so we could then
> ask for the dialog of each shell and see if it's a dialog of an expected
> class.
>
>
> Already done.  JFace Window, which includes Dialog, sets the Shell data to
> the Window object.
>
> So you should be able to iterate through the shells (Display#getShells())
> and look for instances whose data element is a dialog.
>
> Brian.
>
>
> _______________________________________________
> platform-ui-dev mailing list
> platform-ui-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



--
Eclipse Platform UI and e4 project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com
_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev

Back to the top