Skip to main content



      Home
Home » Modeling » Graphiti » Custom DiagramEditor
Custom DiagramEditor [message #1734345] Tue, 07 June 2016 06:30 Go to next message
Eclipse UserFriend
I have created a new Custom Editor extending the Diagram Editor

When I open the workspace and create diagram /open existing diagram.
Everything works , but when I close and reopen the same diagram , and try to create new elements I get this error.

When I debugged I found out that the DefaultEditDomain is somehow not getting the latest one, and using the first opened diagram's DefaultEditDomain.

DefaultEditDomain domain = getDiagramContainer().getEditDomain();





!ENTRY org.eclipse.graphiti.ui 4 0 2016-06-07 12:24:27.589
!MESSAGE GFCommandStack.execute(Command) java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
at org.eclipse.graphiti.ui.editor.DiagramBehavior.executeFeature(DiagramBehavior.java:1127)
at org.eclipse.graphiti.features.impl.AbstractFeatureProvider.addIfPossible(AbstractFeatureProvider.java:310)
at org.eclipse.graphiti.pattern.AbstractPattern.addGraphicalRepresentation(AbstractPattern.java:546)
at com.silexica.customoperation.editor.pattern.OperandPattern.create(OperandPattern.java:99)
at org.eclipse.graphiti.pattern.CreateFeatureForPattern.create(CreateFeatureForPattern.java:60)
at org.eclipse.graphiti.features.impl.AbstractCreateFeature.execute(AbstractCreateFeature.java:100)
at org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext.execute(GenericFeatureCommandWithContext.java:64)
at org.eclipse.graphiti.internal.command.GFPreparableCommand.doExecute(GFPreparableCommand.java:37)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:128)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.graphiti.internal.command.CommandExec.executeCommand(CommandExec.java:85)
at org.eclipse.graphiti.ui.internal.command.CreateModelObjectCommand.execute(CreateModelObjectCommand.java:49)
at org.eclipse.graphiti.ui.internal.editor.EmfOnGefCommand.execute(EmfOnGefCommand.java:54)
at org.eclipse.graphiti.internal.command.GFPreparableCommand2.doExecute(GFPreparableCommand2.java:43)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:97)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:138)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:425)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:438)
at org.eclipse.gef.tools.CreationTool.performCreation(CreationTool.java:269)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:189)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1200)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:301)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:380)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:548)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:221)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5208)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4542)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4132)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1119)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1020)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Re: Custom DiagramEditor [message #1734352 is a reply to message #1734345] Tue, 07 June 2016 07:14 Go to previous messageGo to next message
Eclipse UserFriend
Abhishek,

that sounds strange, the editor should in fact share nothing with its predecessor.

Please make sure that a new editor instance is created and that during its initialization DiagramBehavior.initConfigurationProvider() is called. Also make sure that your editor implements IEditorPart, because only in that case the edit domain will be initialized.

Michael
Re: Custom DiagramEditor [message #1734353 is a reply to message #1734352] Tue, 07 June 2016 07:40 Go to previous message
Eclipse UserFriend
I found the mistake in my code , I was using

private static IToolBehaviorProvider[] toolBehaviorProviders;

instead of
private IToolBehaviorProvider[] toolBehaviorProviders;


in CustomDiagramTypeProvider extends AbstractDiagramTypeProvider implements IDiagramTypeProvider {}

.
Resolved.
Previous Topic:Eclispse Neon Graphiti v0.13 Line Width
Next Topic:Different behavior between undo and redo
Goto Forum:
  


Current Time: Sun Mar 16 23:05:18 EDT 2025

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

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

Back to the top