Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » move a visulpart in a Tab must double click,not single click as normal(if put GEF canvas in a Tab(like gef editors in gef3) ,move a visulpart must double click)
move a visulpart in a Tab must double click,not single click as normal [message #1776491] Fri, 17 November 2017 01:57 Go to next message
lian hongwu is currently offline lian hongwuFriend
Messages: 5
Registered: November 2017
Junior Member
if I try to put the GEF canvas in a Tab of a TabPanel .It as:
Before:
BorderPane pane = new BorderPane();
pane.setTop(createButtonBar());
pane.setCenter(getContentViewer().getCanvas());
pane.setRight(createToolPalette());
After:
BorderPane pane = new BorderPane();
pane.setTop(createButtonBar());

//****************************************
TabPane tabPane=new TabPane();
Tab aTab = new Tab("tab1");
tabPane.getTabs().add(aTab);
aTab.setContent(getContentViewer().getCanvas());
//*********************************************

pane.setCenter(tabPane);
pane.setRight(createToolPalette());

it throw exception as follow,why?what is the reason?how to do it right?

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Viewer controls have to be hooked (to scene) before activation.
at org.eclipse.gef.mvc.fx.viewer.InfiniteCanvasViewer.doActivate(InfiniteCanvasViewer.java:284)
at org.eclipse.gef.common.activate.ActivatableSupport.activate(ActivatableSupport.java:70)
at org.eclipse.gef.mvc.fx.viewer.InfiniteCanvasViewer.activate(InfiniteCanvasViewer.java:170)
at org.eclipse.gef.mvc.fx.domain.HistoricizingDomain.lambda$0(HistoricizingDomain.java:126)
at java.lang.Iterable.forEach(Unknown Source)
at org.eclipse.gef.mvc.fx.domain.HistoricizingDomain.activateAdapters(HistoricizingDomain.java:124)
at org.eclipse.gef.mvc.fx.domain.HistoricizingDomain.doActivate(HistoricizingDomain.java:257)
at org.eclipse.gef.common.activate.ActivatableSupport.activate(ActivatableSupport.java:70)
at org.eclipse.gef.mvc.fx.domain.HistoricizingDomain.activate(HistoricizingDomain.java:115)
at mindmap.MindMapVisualApplication.start(MindMapVisualApplication.java:147)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
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)
... 1 more
Exception running application mindmap.MindMapVisualApplication

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

later I find a way to put CANVAS into a Tab.But I find a question: when I want to move a visual ,it must double click on this visual,not single click as normal in "GEF logo example " and "mindmap exmple".What is the reason? A Tab is a control,not a layout pane.when double click inside the tab, the CANVAS can only capture a single mouse click?The first mouse click captured by the Tab,the second mouse click captured by CANVAS?
Re: move a visulpart in a Tab must double click,not single click as normal [message #1785401 is a reply to message #1776491] Fri, 13 April 2018 13:30 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Lian,

the exception that you get is issued, because the viewer is activated before its canvas' scene property is initialised. You need to make sure that the activation is deferred until that scene property is set. You can do this, for example, by registering a listener on the scene property of the canvas, and only perform domain activation once the new value differs from null.

h2h
Matthias
Previous Topic:[GEF5] IVisualPart for javafx.scene.control.Tab
Next Topic:GEF 5 examples freeze Eclipse on Fedora 27
Goto Forum:
  


Current Time: Fri Apr 26 10:15:01 GMT 2024

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

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

Back to the top