|
|
| Re: Create ICreateContext [message #649041 is a reply to message #648719] |
Mon, 17 January 2011 06:58   |
Hauke Messages: 3 Registered: January 2011 |
Junior Member |
|
|
Hello
I have a problem with this one
addBookContext.setTargetContainer(<the container shape in which to add
the object representation>);
How do I get
<the container shape in which to add the object representation>
The only thing I have is:
PictogramElement v = addGraphicalRepresentation(context, vertex);
And I don't know how I get the right container shape.
This one I tried causes a NullPointerExceptions:
IPeCreateService peCreateService = Graphiti.getPeCreateService();
ContainerShape contShape = peCreateService.createContainerShape(context.getTargetContainer(),false);
addBookContext.setTargetContainer(contShape);
[Updated on: Mon, 17 January 2011 08:28] Report message to a moderator
|
|
|
|
| Re: Create ICreateContext [message #649421 is a reply to message #649261] |
Wed, 19 January 2011 03:20  |
Michael Wenz Messages: 1267 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
Hauke,
I hope that I understood the issue behind now: it seems that you exspect the
method call to addGraphicalRepresentation to do the adding of the visual
representation to the diagram? But this is not what the method does, it
simply delegates to the feature provider to find a suitable feature that is
capable of adding the stuff to the diagram.
What you would need to in your add feature do instead is create the
graphical representation by yourself (e.g. using the create methods from
PEService and GAService). The method addGraphicalRepresentation is only
meant fo adding sub objects that are handled by their own add feature...
For an example have a look into the TutorialAddEClassFeature.
Michael
"Hauke" wrote in message news:ih43es$2be$1@news.eclipse.org...
I add somthing
PictogramElement vertexPE = addGraphicalRepresentation(context, vertex);
...
//I add this
contShape.setGraphicsAlgorithm(vertexPE.getGraphicsAlgorithm ());
however the NullPointerException happens now after the return.
I write the exception too(I don't thing it is helpful)
java.lang.NullPointerException
at org.eclipse.draw2d.Figure.add(Figure.java:148)
at org.eclipse.draw2d.FreeformLayer.add(FreeformLayer.java:28)
at org.eclipse.draw2d.Figure.add(Figure.java:184)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addChild Visual(AbstractGraphicalEditPart.java:209)
at
org.eclipse.graphiti.ui.internal.parts.ContainerShapeEditPar t.addChildVisual(ContainerShapeEditPart.java:161)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:210)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:771)
at
org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refresh Children(ShapeEditPart.java:626)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:718)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:633)
at
org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refresh (ShapeEditPart.java:546)
at
org.eclipse.graphiti.ui.internal.parts.DiagramEditPart.refre sh(DiagramEditPart.java:181)
at
org.eclipse.graphiti.ui.internal.editor.DiagramEditorInterna l.internalRefreshEditPart(DiagramEditorInternal.java:1203)
at
org.eclipse.graphiti.ui.internal.editor.DiagramEditorInterna l.refresh(DiagramEditorInternal.java:1287)
at
org.eclipse.graphiti.ui.internal.editor.DiagramRefreshJob.ru nInUIThread(DiagramRefreshJob.java:99)
at
org.eclipse.graphiti.ui.internal.editor.DiagramChangeListene r.resourceSetChanged(DiagramChangeListener.java:140)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl$1.run(TransactionalEditingDomainImpl.java:781)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.runExclusive(TransactionalEditingDomainImpl.java:328)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.postcommit(TransactionalEditingDomainImpl.java:771)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.deactivate(TransactionalEditingDomainImpl.java:543)
at
org.eclipse.emf.transaction.impl.TransactionImpl.close(Trans actionImpl.java:712)
at
org.eclipse.emf.transaction.impl.TransactionImpl.commit(Tran sactionImpl.java:474)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:155)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
at
org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doE xecute(WorkspaceCommandStackImpl.java:208)
at
org.eclipse.emf.transaction.impl.AbstractTransactionalComman dStack.execute(AbstractTransactionalCommandStack.java:165)
at
org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandSt ackImpl.execute(GFWorkspaceCommandStackImpl.java:47)
at
org.eclipse.emf.transaction.impl.AbstractTransactionalComman dStack.execute(AbstractTransactionalCommandStack.java:219)
at
org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandSt ackImpl.execute(GFWorkspaceCommandStackImpl.java:39)
at
org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execu te(GFCommandStack.java:108)
at
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.handl eDrop(AbstractTransferDropTargetListener.java:339)
at
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTransferDropTargetListener.java:112)
at
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransferDropTargetListener.java:183)
at
org.eclipse.jface.util.DelegatingDropAdapter$3.run(Delegatin gDropAdapter.java:211)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
at
org.eclipse.jface.util.DelegatingDropAdapter.drop(Delegating DropAdapter.java:209)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1 061)
at org.eclipse.swt.dnd.DropTarget.drag_data_received(DropTarget .java:371)
at org.eclipse.swt.dnd.DropTarget.Drag_Data_Received(DropTarget .java:251)
at org.eclipse.swt.internal.gtk.OS._gtk_drag_get_data(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_drag_get_data(OS.java:64 48)
at org.eclipse.swt.dnd.DropTarget.drag_drop(DropTarget.java:416 )
at org.eclipse.swt.dnd.DropTarget.Drag_Drop(DropTarget.java:258 )
at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:81 68)
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1238)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS. java:2229)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3159)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
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(Work bench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.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(EclipseS tarter.java:369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
|
|
|
Powered by
FUDForum. Page generated in 0.01679 seconds