Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Modality of JavaFX dialogs within Eclipse application
Modality of JavaFX dialogs within Eclipse application [message #1740769] Thu, 18 August 2016 12:34 Go to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 57
Registered: January 2013
Member
Hy guys,

I hope this is the right place for this topic.... =)

We are using JavaFX in our Eclipse RCP application. We have an EditorPart were we are creating a JavaFX-Scene and so on.

Now we want to show a modal dialog in the JavaFX-Part and we want it to be application modal.

So the Dialog contains the following code:

    initModality(Modality.APPLICATION_MODAL);
    initOwner(selectionModel.getTreeTableView().getScene().getWindow());

    //We have a treeTableView in our part, therefore we are getting the scene and the window via the selectionModel.



Furthermore we are opening the Dialog with the showAndWait() method.

Unfortunately, the setting to APPLICATION_MODAL, the setting of the owner and the call of showAndWait() has no effect.

The dialog is still not modal... Sad

Could it be a problem that only a part of our application is JavaFX and not all of it?

Is there any way to achieve what we want?

Thanks for any help + kind regards =)



Re: Modality of JavaFX dialogs within Eclipse application [message #1740818 is a reply to message #1740769] Thu, 18 August 2016 17:11 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6398
Registered: July 2009
Senior Member
First of all showAndWait() is no effect on modality. If I'd had to guess
I'd say the problem is because of (a bug?) in FXCanvas but I could be
wrong of course.

Tom

On 18.08.16 14:34, Alexander Fichtinger wrote:
> Hy guys,
>
> I hope this is the right place for this topic.... =)
>
> We are using JavaFX in our Eclipse RCP application. We have an
> EditorPart were we are creating a JavaFX-Scene and so on.
>
> Now we want to show a modal dialog in the JavaFX-Part and we want it to
> be application modal.
>
> So the Dialog contains the following code:
>
>
> initModality(Modality.APPLICATION_MODAL);
> initOwner(selectionModel.getTreeTableView().getScene().getWindow());
>
> //We have a treeTableView in our part, therefore we are getting the
> scene and the window via the selectionModel.
>
>
>
> Furthermore we are opening the Dialog with the showAndWait() method.
>
> Unfortunately, the setting to APPLICATION_MODAL, the setting of the
> owner and the call of showAndWait() has no effect.
>
> The dialog is still not modal... :(
>
> Could it be a problem that only a part of our application is JavaFX and
> not all of it?
>
> Is there any way to achieve what we want?
>
> Thanks for any help + kind regards =)
>
>
>
>
Re: Modality of JavaFX dialogs within Eclipse application [message #1740852 is a reply to message #1740818] Fri, 19 August 2016 05:53 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 57
Registered: January 2013
Member
Hy Tom,

thanks for your fast reply. =)
OK, that was not clear to me.. (the Javadoc says showAndWait() shows a blocking dialog... =) ).

Well, if that's a bug, it seems to clear to me that this is not working.

Now we have the approach, that we use an SWT dialog... here the modality works perfectly. Unfortunately, the API of SWT dialogs is not as cool as the JavaFX API...... =(
Re: Modality of JavaFX dialogs within Eclipse application [message #1740854 is a reply to message #1740852] Fri, 19 August 2016 06:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6398
Registered: July 2009
Senior Member
There 2 different things:
* modality: which is an UI-State which blocks input to other
windows in the same application

* blocking: which means your program flow is blocked/halted until the
dialog is closed (in SWT you of hear "spinning the the event loop")

There are UI-Technologies who eg don't have the concept of
blocking/eventloop spinning (eg. WebUIs).

A short google query shows a JavaFX Bug is already filed for that
problem https://bugs.openjdk.java.net/browse/JDK-8155896

Tom

On 19.08.16 07:53, Alexander Fichtinger wrote:
> Hy Tom,
>
> thanks for your fast reply. =)
> OK, that was not clear to me.. (the Javadoc says showAndWait() shows a
> blocking dialog... =) ).
>
> Well, if that's a bug, it seems to clear to me that this is not working.
>
> Now we have the approach, that we use an SWT dialog... here the modality
> works perfectly. Unfortunately, the API of SWT dialogs is not as cool as
> the JavaFX API...... =(
>
Re: Modality of JavaFX dialogs within Eclipse application [message #1747583 is a reply to message #1740769] Wed, 16 November 2016 09:00 Go to previous message
Markus Stier is currently offline Markus StierFriend
Messages: 12
Registered: July 2009
Junior Member
Hi!
I've had the same problem and found the bug mentioned by Tom too. Until it eventually gets fixed, I've implemented a workaround (see attached file).

I create an invisible SWT-dialog and use its ShellActivate/ShellDeactivate events to bring the JavaFx Dialog to front. There is a timing issue when the JavaFx Dialog is closed. This is circumvented by a nasty Thread.sleep(). Maybe someone has a better suggestion...

The attached file is a modified SamplePart from the e4 new-project wizard. It creates a WebView, adds a context menu and opens a web site.

Regards,
Markus
Previous Topic:Workbench window opens in primary monitor only when trying to open from second monitor
Next Topic:"Go to" feature
Goto Forum:
  


Current Time: Sat Jun 23 12:31:19 GMT 2018

Powered by FUDForum. Page generated in 0.01666 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top