Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » rotate a Wrappinglabel icon
rotate a Wrappinglabel icon [message #527199] Wed, 14 April 2010 13:02
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
Hi all,

I have a connection EditPart that extends ConnectionNodeEditPart,
this connection have a WrappingLabel, and the edit part of the Wrappinglabel extends LabelEditPart.

The WrappingLabel contains an icon, which I want to rotate to be parallal with the connection.

What I have done is: I put a Listener on the sourceconnectionanchor:
sourceConnectionAnchor.addAnchorListener(this);
and a listener on the targetConnectionAnchor:
targetConnectionAnchor.addAnchorListener(this);

Then I put a code in the anchorMoved method to rotate the icon of the WrappingLabel, when the connection anchors move:

Image iconImage = ((WrappingLabel) figure).getIcon(0);
ImageData data = iconImage.getImageData();
Image image = new Image(PlatformUI.getWorkbench().getDisplay(),
rotate(data, SWT.LEFT));

((WrappingLabel) figure).setIcon(image);

The problem is: When I launch my application, and When I try to move the connection, I have this error:
java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:3865)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.SWT.error(SWT.java:3770)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:440)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:284)
at org.eclipse.papyrus.diagram.communication.custom.edit.polici es.MessageNameEditPolicy.rotate(MessageNameEditPolicy.java:3 87)
at org.eclipse.papyrus.diagram.communication.custom.edit.polici es.MessageNameEditPolicy.refreshEditPartDisplay(MessageNameE ditPolicy.java:319)
at org.eclipse.papyrus.diagram.communication.custom.edit.polici es.MessageNameEditPolicy.anchorMoved(MessageNameEditPolicy.j ava:406)
at org.eclipse.draw2d.ConnectionAnchorBase.fireAnchorMoved(Conn ectionAnchorBase.java:53)
at org.eclipse.draw2d.AbstractConnectionAnchor.ancestorMoved(Ab stractConnectionAnchor.java:66)
at org.eclipse.draw2d.AncestorHelper.fireAncestorMoved(Ancestor Helper.java:98)
at org.eclipse.draw2d.AncestorHelper.figureMoved(AncestorHelper .java:87)
at org.eclipse.draw2d.Figure.fireFigureMoved(Figure.java:461)
at org.eclipse.draw2d.PolylineConnection.layout(PolylineConnect ion.java:181)
at org.eclipse.draw2d.Figure.validate(Figure.java:1739)
at org.eclipse.draw2d.Figure.validate(Figure.java:1741)
at org.eclipse.draw2d.Figure.validate(Figure.java:1741)
at org.eclipse.draw2d.Figure.validate(Figure.java:1741)
at org.eclipse.draw2d.Figure.validate(Figure.java:1741)
at org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferredSize(FreeformViewport.java:28)
at org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:93)
at org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.java:85)
at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:735)
at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:75)
at org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:315)
at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:3 13)
at org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:278)
at org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:123)
at org.eclipse.draw2d.DeferredUpdateManager.performValidation(D eferredUpdateManager.java:203)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalVie wer$ToggleUpdateManager.performValidation(DiagramGraphicalVi ewer.java:124)
at org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager.java:179)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalVie wer$ToggleUpdateManager.performUpdate(DiagramGraphicalViewer .java:114)
at org.eclipse.gef.editparts.ViewportExposeHelper.exposeDescend ant(ViewportExposeHelper.java:109)
at org.eclipse.gef.ui.parts.GraphicalViewerImpl.reveal(Graphica lViewerImpl.java:292)
at org.eclipse.gef.ui.parts.ScrollingGraphicalViewer.reveal(Scr ollingGraphicalViewer.java:83)
at org.eclipse.gef.tools.SelectEditPartTracker.handleButtonUp(S electEditPartTracker.java:115)
at org.eclipse.gef.tools.DragEditPartsTracker.handleButtonUp(Dr agEditPartsTracker.java:336)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1064)
at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.ja va:544)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:263)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainEventDispatcher.java:374)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.java:538)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:207)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)



Have someone an idea about this error?
Thanks

Previous Topic:How to center EditParts in DiagramEditor ?
Next Topic:extending ContentViewer OR GraphicalEditorWithFlyoutPalette?
Goto Forum:
  


Current Time: Sat Apr 20 00:18:11 GMT 2024

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

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

Back to the top