Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » IllegalStateException: Transaction is already closed
IllegalStateException: Transaction is already closed [message #928957] Mon, 01 October 2012 05:19 Go to next message
Rami D. is currently offline Rami D.Friend
Messages: 14
Registered: August 2012
Junior Member
Hi,

i'm facing a strange problem. Scenario: I create a node A and connect it (via a polyline connection) with another node B.As soon as the connector is dropped onto B's anchor, I create additional elements in B (e.g.a compartments with labels). Now i want to remove this information from B when either A or the connector is deleted. I'm reacting on the overridden method 'handleNotificationEvent(Notification notification)'
and check the condition notification.getEventType() == Notification.REMOVE. In the code I use the EcoreUtil.delete(EObject) to remove the elements from the model.
This works fine when deleting the node, but deleting the connector it leads to the following exception:

org.eclipse.core.commands.ExecutionException: While executing the operation, an exception occurred
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:519)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:206)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:169)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:156)
	at org.eclipse.gef.ui.actions.WorkbenchPartAction.execute(WorkbenchPartAction.java:83)
	at org.eclipse.gmf.runtime.diagram.ui.internal.actions.PromptingDeleteAction.run(PromptingDeleteAction.java:174)
	at org.eclipse.gef.KeyHandler.performStroke(KeyHandler.java:83)
	at org.eclipse.gef.KeyHandler.keyPressed(KeyHandler.java:55)
	at org.eclipse.gef.KeyHandler.keyPressed(KeyHandler.java:59)
	at org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler.keyPressed(GraphicalViewerKeyHandler.java:338)
	at org.eclipse.gmf.runtime.diagram.ui.internal.parts.DiagramGraphicalViewerKeyHandler.keyPressed(DiagramGraphicalViewerKeyHandler.java:109)
	at org.eclipse.gef.KeyHandler.keyPressed(KeyHandler.java:59)
	at org.eclipse.gmf.runtime.diagram.ui.internal.parts.DirectEditKeyHandler.keyPressed(DirectEditKeyHandler.java:89)
	at org.eclipse.gef.tools.SelectionTool.handleKeyDown(SelectionTool.java:329)
	at org.eclipse.gef.tools.PanningSelectionTool.handleKeyDown(PanningSelectionTool.java:161)
	at org.eclipse.gmf.runtime.diagram.ui.services.palette.SelectionToolEx.handleKeyDown(SelectionToolEx.java:112)
	at org.eclipse.gef.tools.AbstractTool.keyDown(AbstractTool.java:1016)
	at org.eclipse.gef.tools.SelectionTool.keyDown(SelectionTool.java:489)
	at org.eclipse.gef.EditDomain.keyDown(EditDomain.java:169)
	at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchKeyPressed(DomainEventDispatcher.java:252)
	at org.eclipse.draw2d.LightweightSystem$EventHandler.keyPressed(LightweightSystem.java:497)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:161)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
	at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1808)
	at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:4496)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4191)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.IllegalStateException: Transaction is already closed
	at org.eclipse.emf.transaction.impl.TransactionImpl.rollback(TransactionImpl.java:533)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:223)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
	... 56 more



Does anybody know why this happens for the connector but not for the node? The information the handlenotification method gets is the same for both and the algorithm of the element deletion is also processed in the same way except that a connection removal throws this transaction error. Any help appreciated.

Regards,
Rami
Re: IllegalStateException: Transaction is already closed [message #934680 is a reply to message #928957] Sat, 06 October 2012 07:04 Go to previous message
Rami D. is currently offline Rami D.Friend
Messages: 14
Registered: August 2012
Junior Member
OK, got it. I actually don't know why, but for the connectors i have to call

domain.getCommandStack().execute(RemoveCommand.create(domain, connector));


instead of

EcoreUtil.delete(connector)


Regards,
Rami
Previous Topic:Changing the style of the elements before opening a Diagram
Next Topic:RCP Build Failed: /eclipse/features/org.eclipse.gmf.tooling.runtime.source
Goto Forum:
  


Current Time: Sat Oct 24 15:55:19 GMT 2020

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

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

Back to the top