Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » opening a ui modeled dialogue from main thread leads to exception
opening a ui modeled dialogue from main thread leads to exception [message #1724060] Sat, 20 February 2016 11:58 Go to next message
Milankumar Ardeshana is currently offline Milankumar ArdeshanaFriend
Messages: 27
Registered: August 2015
Junior Member
hi
I am trying to open a dialogue which is defined in application.e4xmi and it is not rendered and not visible (see attachment).

i am trying to open it as below
Platform.runLater(new Runnable() {
	
	@Override
	public void run() {
		MUIElement find = modelService.find("com.mil.debra.app.dialog.editdialogue", application);
		System.out.println(find);
		MDialog mydialogue = (MDialog) modelService.cloneElement(find, application);
		mydialogue.setVisible(true);
		mydialogue.setOnTop(true);
		mydialogue.setToBeRendered(true);
//		modelService.bringToTop(mydialogue);
	}
});


which is leading to NPE.
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:702)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:639)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.activate(BaseRenderer.java:695)
	at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer$3.call(BasePartRenderer.java:153)
	at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer$3.call(BasePartRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.fx.widget.WWidgetImpl.activate(WWidgetImpl.java:79)
	at org.eclipse.fx.ui.workbench.renderers.fx.DefWindowRenderer$WWindowImpl$3.run(DefWindowRenderer.java:701)
	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
	at java.lang.Thread.run(Thread.java:745)





i want to open this dialogue like APPLICATION_MODAL in swt.
Any idea how to achieve this ?

Note:
I know i can create a new stage and use Stage#showAndWait();
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724062 is a reply to message #1724060] Sat, 20 February 2016 13:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6313
Registered: July 2009
Senior Member
MDialog is a concept added by someone in e4 (and is IMHO completely
broken!) and not even SWT-Renderer really support it fully but it works
more by chance! I made a proposal in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=460826 how they should
work, I had a sponsor for that at that time.

What I can guarantee is that MDialog as it is today will never be
supported by e(fx)clipse
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=460826#c18) and I really
hope e4 will clean up its model and not ship this broken thing.

If you want really useable dialogs/wizards:
a) you need to implement them your own but remember that I warned you
that those are completely broken

b) as the sponsor by that time has gone your company could sponsor me
to push this forward, most likely this time I would push that
forward in e(fx)clipse instead of e4

Tom

On 20.02.16 12:58, Milankumar Ardeshana wrote:
> hi
> I am trying to open a dialogue which is defined in application.e4xmi and it is not rendered and not visible (see attachment).
>
> i am trying to open it as below
>
> Platform.runLater(new Runnable() {
>
> @Override
> public void run() {
> MUIElement find = modelService.find("com.mil.debra.app.dialog.editdialogue", application);
> System.out.println(find);
> MDialog mydialogue = (MDialog) modelService.cloneElement(find, application);
> mydialogue.setVisible(true);
> mydialogue.setOnTop(true);
> mydialogue.setToBeRendered(true);
> // modelService.bringToTop(mydialogue);
> }
> });
>
>
> which is leading to NPE.
>
> Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:702)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:639)
> at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.activate(BaseRenderer.java:695)
> at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer$3.call(BasePartRenderer.java:153)
> at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer$3.call(BasePartRenderer.java:1)
> at org.eclipse.fx.ui.workbench.renderers.fx.widget.WWidgetImpl.activate(WWidgetImpl.java:79)
> at org.eclipse.fx.ui.workbench.renderers.fx.DefWindowRenderer$WWindowImpl$3.run(DefWindowRenderer.java:701)
> at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
> at java.security.AccessController.doPrivileged(Native Method)
> at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
> at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
> at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
> at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
> at java.lang.Thread.run(Thread.java:745)
>
>
>
>
>
> i want to open this dialogue like APPLICATION_MODAL in swt.
> Any idea how to achieve this ?
>
> Note:
> I know i can create a new stage and use Stage#showAndWait();
>
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724063 is a reply to message #1724062] Sat, 20 February 2016 13:43 Go to previous messageGo to next message
Milankumar Ardeshana is currently offline Milankumar ArdeshanaFriend
Messages: 27
Registered: August 2015
Junior Member
Hi tom,
Thanks for your reply.

Bdw,
Dialogue was coming up but it was non modal.
Moving to javafx way to create custom dialogue as described here.

and bdw i am not making it for any company. I am just making example open for all, link is here. If you have any examples which i can refer as a case study in my research and which are open, please let me know. Smile

Regards,
-Milan
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724066 is a reply to message #1724063] Sat, 20 February 2016 14:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6313
Registered: July 2009
Senior Member
You know we have swt like dialogs and lightweight ones
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724068 is a reply to message #1724066] Sat, 20 February 2016 15:30 Go to previous messageGo to next message
Milankumar Ardeshana is currently offline Milankumar ArdeshanaFriend
Messages: 27
Registered: August 2015
Junior Member
yes i will use LightWeightDialogService in my application.
Thanks for your brilliant hint.

your fan
-Milan
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724826 is a reply to message #1724068] Fri, 26 February 2016 12:01 Go to previous messageGo to next message
Milankumar Ardeshana is currently offline Milankumar ArdeshanaFriend
Messages: 27
Registered: August 2015
Junior Member
Hi tom ,

Is it possible to drag out the dialog from application? ModalityScope.Application?
I am describing my dialogue as below
	static class AboutDialogue extends TitleAreaDialog {
		private Parent root;

		@Inject
		public AboutDialogue(){
			super("About", "About",null);
			addDefaultButtons();
			try {
				root = FXMLLoader.load(AboutDialogue.class.getResource("PersonEditDialog.fxml"));
				setClientArea(root);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			setClientArea(root);
		}

	}


and opening using below call in handler class
	@Execute
	public void execute(LightWeightDialogService dialogService) {
		dialogService.openDialog(AboutDialogue.class, ModalityScope.WINDOW);
		System.out.println(dialogService);
	
	}


This is not allowing me to drag dialog outside of the application. Sad
can you give me hint how to achieve this?
Please check attachment for how i am getting dialogue.

Thanks
Milan
  • Attachment: 2.PNG
    (Size: 26.14KB, Downloaded 87 times)
  • Attachment: old.PNG
    (Size: 382.99KB, Downloaded 77 times)
Re: opening a ui modeled dialogue from main thread leads to exception [message #1724828 is a reply to message #1724826] Fri, 26 February 2016 12:12 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6313
Registered: July 2009
Senior Member
No lightweight dialogs can never leave the container they are created
on. This is a "drawback" of them compared to heavy weight dialogs.

Tom

On 26.02.16 13:01, Milankumar Ardeshana wrote:
> Hi tom ,
>
> Is it possible to drag out the dialog from application? ModalityScope.Application?
> I am describing my dialogue as below
> static class AboutDialogue extends TitleAreaDialog {
> private Parent root;
>
> @Inject
> public AboutDialogue(){
> super("About", "About",null);
> addDefaultButtons();
> try {
> root = FXMLLoader.load(AboutDialogue.class.getResource("PersonEditDialog.fxml"));
> setClientArea(root);
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> setClientArea(root);
> }
>
> }
>
>
> and opening using below call in handler class
>
> @Execute
> public void execute(LightWeightDialogService dialogService) {
> dialogService.openDialog(AboutDialogue.class, ModalityScope.WINDOW);
> System.out.println(dialogService);
>
> }
>
>
> This is not allowing me to drag dialog outside of the application. :(
> can you give me hint how to achieve this?
> Please check attachment for how i am getting dialogue.
>
> Thanks
> Milan
>
Previous Topic:Buckminster can't resolve org.eclipse.fx.javafx
Next Topic:is it possible to use eclipse service in controller of fxml?
Goto Forum:
  


Current Time: Thu May 25 05:10:30 GMT 2017

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

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