Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » getX and getY in CreateReferenceFeature
getX and getY in CreateReferenceFeature [message #651953] Wed, 02 February 2011 08:55 Go to next message
hdw  is currently offline hdw Friend
Messages: 4
Registered: February 2011
Junior Member
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 #652001 is a reply to message #651953] Wed, 02 February 2011 11:57 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
I'm not sure if I fully understood your problem, nevertheless here's the try
for an answer.

Usually, the ports would be represented as children of your pictogram
element. In order to make the ports visible you will need some graphics
algorithm to represent them (e.g. a circle). This graphics algorith has
coordinates (x and y) you can use for this purpose. In order to find the
port you can go through the containment hierarchie (getChildren) and the
graphics algorithm references of your pictogram element.

As I said, not sure if that solves it...

Michael

"hdw" wrote in message news:iib5rm$dc8$1@news.eclipse.org...

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 16:39 Go to previous messageGo to next message
hdw  is currently offline hdw Friend
Messages: 4
Registered: February 2011
Junior Member
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
Re: getX and getY in CreateReferenceFeature [message #652836 is a reply to message #652095] Mon, 07 February 2011 09:26 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
This seems to be a bug. Could you please open a bugzilla against Graphiti to
track this?

Thanks,
Michael
Re: getX and getY in CreateReferenceFeature [message #652854 is a reply to message #652836] Mon, 07 February 2011 11:48 Go to previous messageGo to next message
hdw  is currently offline hdw Friend
Messages: 4
Registered: February 2011
Junior Member
What means that exactly ?
[quote title=Could you please open a bugzilla against Graphiti to track this?l[/quote]

I should send a mail to the "mailing list" isn't it ?
Re: getX and getY in CreateReferenceFeature [message #652892 is a reply to message #652854] Mon, 07 February 2011 13:23 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Not quite. You should point your browser to https://bugs.eclipse.org/bugs/ ,
get a login for that page and file a new bug. The area to choose is
"Modeling", The Product "GMP", then choose component "Graphiti" from the
list.

For more details, there is a FAQ on bug reporting in Eclipse:
http://wiki.eclipse.org/Bug_Reporting_FAQ

Michael
Re: getX and getY in CreateReferenceFeature [message #652916 is a reply to message #652892] Mon, 07 February 2011 15:17 Go to previous message
hdw  is currently offline hdw Friend
Messages: 4
Registered: February 2011
Junior Member
OK.

Michael Wenz wrote on Mon, 07 February 2011 08:23
Not quite. You should point your browser to https://bugs.eclipse.org/bugs/ ,
get a login for that page and file a new bug. The area to choose is
"Modeling", The Product "GMP", then choose component "Graphiti" from the
list.

For more details, there is a FAQ on bug reporting in Eclipse:
http://wiki.eclipse.org/Bug_Reporting_FAQ

Michael

Previous Topic:Permanently Selected Graphics Algorithms
Next Topic:Generative Graphiti
Goto Forum:
  


Current Time: Sat Apr 20 04:16:32 GMT 2024

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

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

Back to the top