Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Error in editor - how to fix?(An EditPart has to be selectable (isSelectable() == true) in order to obtain focus.))
Error in editor - how to fix? [message #1017437] Mon, 11 March 2013 20:36 Go to next message
Miguel Pessoa is currently offline Miguel Pessoa
Messages: 22
Registered: May 2012
Location: Brazil
Junior Member
Hello all.
I have a problem when running swtbot using eclipse juno 4.2
When I run tests using the Eclipse editor swtbot in the following problem has occurred several times:
This error is caused by GEF? how fix this?
Does anyone know how to solve this problem?

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: An EditPart has to be selectable (isSelectable() == true) in order to obtain focus.)
	at org.eclipse.swt.SWT.error(SWT.java:4361)
	at org.eclipse.swt.SWT.error(SWT.java:4276)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.IllegalArgumentException: An EditPart has to be selectable (isSelectable() == true) in order to obtain focus.
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.gef.editparts.AbstractEditPart.setFocus(AbstractEditPart.java:1005)
	at org.eclipse.gef.SelectionManager.setFocus(SelectionManager.java:241)
	at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setFocus(AbstractEditPartViewer.java:695)
	at org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefViewer$5.run(SWTBotGefViewer.java:336)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$4.doRun(UIThreadRunnable.java:196)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)


What seems to be is a problem in trying to gef click and rename elements in the editor.


best regards
Re: Error in editor - how to fix? [message #1018676 is a reply to message #1017437] Thu, 14 March 2013 09:46 Go to previous message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
It seems to me that the SWTBot is trying to set focus on an edit part, that is not selectable. That is not allowed.

Since the AbstractEditPart is selectable by default, you have to return false from isSelectable method in the edit part.
Don't return false from that method or don't try to click on that edit part in your tests.
Previous Topic:Reliably remove Connection figures with orphan EditParts on deletion of model?
Next Topic:GEF editor without making use of NodeEditPart for node model elements?
Goto Forum:
  


Current Time: Sun Sep 21 14:21:39 GMT 2014

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

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