getX and getY in CreateReferenceFeature [message #651953] |
Wed, 02 February 2011 03:55  |
Eclipse User |
|
|
|
Hello
I have got a problem.
I have a pictogramelement (witch is linked with a businessobject).
And another pictogramelement (witch is linked with a businessobject and
from the same type).
The pictogramelement has got fixed ports witch should not be seen or
almost. (the ports are only important for the meta-model)
However the ports should possible to connect
if the user clicks on the pictogramelement.
so the connection shall start from the closest port.
The problem is to get this port.
If I get the X and Y that would to it.
Maybe there is a good solution for this problem.
|
|
|
|
Re: getX and getY in CreateReferenceFeature [message #652095 is a reply to message #651953] |
Wed, 02 February 2011 11:39   |
Eclipse User |
|
|
|
I want to use an other solution.
In this solution I got a new problem.
I wan to make a port. This port shall be only a straight line (polyline)
wen I want to make a connection a exceptions happens.
public PictogramElement add(final IAddContext context) {
//...
final BoxRelativeAnchor boxAnchor =
peCreateService.createBoxRelativeAnchor(containerShape);
...
createGraphicalPort(boxAnchor);
//...
}
private void createGraphicalPort(BoxRelativeAnchor boxAnchor) {
IGaService gaService = Graphiti.getGaService();
//Rectangle rec = gaService.createRectangle(boxAnchor);
Polyline poly = gaService.createPolyline(boxAnchor ,new int[]{0,PORT_SIZE/2,PORT_SIZE,PORT_SIZE/2});
//rec.setStyle(styleProvider.getStyle(StyleProvider.PORT));
poly.setStyle(styleProvider.getStyle(StyleProvider.PORT));
//gaService.setLocationAndSize(rec, 0, 0, PORT_SIZE, PORT_SIZE);
gaService.setLocationAndSize(poly, 0, 0, PORT_SIZE, PORT_SIZE);
}
If there is only the rectangle and not the polyline, it works.
Because of the exceptions:
new vertexes and connection can't be added.
contex menues and context buttons aren't be shown.
and other exceptions.
Here the exceptions (when the connection will be create):
!ENTRY org.eclipse.ui 4 0 2011-02-02 17:23:39.158
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3164)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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)
Caused by: java.lang.NullPointerException
at org.eclipse.graphiti.ui.internal.util.draw2d.LineSeg.getLineIntersectionsWithLineSegs(LineSeg.java:465)
at org.eclipse.graphiti.ui.internal.util.draw2d.GFChopboxAnchor.getIntersectionPoints(GFChopboxAnchor.java:175)
at org.eclipse.graphiti.ui.internal.util.draw2d.GFChopboxAnchor.getLocation(GFChopboxAnchor.java:126)
at org.eclipse.graphiti.ui.internal.util.draw2d.GFChopboxAnchor.getLocation(GFChopboxAnchor.java:99)
at org.eclipse.draw2d.AbstractRouter.getStartPoint(AbstractRouter.java:69)
at org.eclipse.draw2d.ConnectionRouter$NullConnectionRouter.route(ConnectionRouter.java:92)
at org.eclipse.draw2d.PolylineConnection.layout(PolylineConnection.java:176)
at org.eclipse.draw2d.Figure.validate(Figure.java:1894)
at org.eclipse.draw2d.Figure.validate(Figure.java:1896)
at org.eclipse.draw2d.Figure.validate(Figure.java:1896)
at org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.calculatePreferredSize(FreeformViewport.java:25)
at org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractLayout.java:110)
at org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(AbstractHintLayout.java:90)
at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:807)
at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.java:82)
at org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas.java:325)
at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:323)
at org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCanvas.java:292)
at org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManager.java:143)
at org.eclipse.draw2d.DeferredUpdateManager.performValidation(DeferredUpdateManager.java:214)
at org.eclipse.draw2d.DeferredUpdateManager.performUpdate(DeferredUpdateManager.java:190)
at org.eclipse.draw2d.DeferredUpdateManager$UpdateRequest.run(DeferredUpdateManager.java:44)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 23 more
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03830 seconds