Highlighting of Anchors [message #1334680] |
Mon, 05 May 2014 18:01 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
I'm migrating/merging to the current Graphiti HEAD from an custom branch originally I forked about two years ago. Almost all is going quite smoothly, except for highlit of anchors during connection creation.
Some related issues
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363186
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329517
I'm still struggling to understand how it's supposed to (currently) work. I understand that
XToolBehaviorProvider.getSelectionInfoForAnchor() is supposed to be called when hovering... but it doesn't.
Specifically, I get the tutorial code and its TutorialToolBehaviorProvider
(overriding the getSelectionInfoFor* to log the callings) and I get that only
getSelectionInfoForShape() is called, not getSelectionInfoForAnchor or
getSelectionInfoForConnection
My questions then, for now, are:
- When are those functions supposed to be called? (their docs don't say more that then method names) - and their names suggest they are called when the shape is selected ("selection info"), but they are also called for hovering?
- It's ok that in the tutorial they don't get called?
- Is there some example that show how to highlit anchors on connection creation (source or target)?
If this helps: I see that in my old working code, the highlit-on-hovering was triggered by GFAbstractShape.adaptBackgroundToHover(), but now (in the tutorial) when I hover with the Connection (EReference) over the anchor (and the connection tool pointer changes to "enabled") the method is only called with the value getHoverFeedback() = IVisualState.HOVER_OFF - and hence nothing happens. I'm not sure if this is correct behaviour.
[Updated on: Mon, 05 May 2014 18:56] Report message to a moderator
|
|
|
|
Re: Highlighting of Anchors [message #1334836 is a reply to message #1334751] |
Mon, 05 May 2014 19:31 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
Another difference is that the old GFAbstractShape.adaptBackgroundToHover() considered anchors, while the current one doesn't:
Current
private boolean adaptBackgroundToHover(Graphics graphics) {
if (getVisualState().getHoverFeedback() == IVisualState.HOVER_ON) {
...
if (!(pe instanceof org.eclipse.graphiti.mm.pictograms.Shape))
return false;
org.eclipse.graphiti.mm.pictograms.Shape s = (org.eclipse.graphiti.mm.pictograms.Shape) pe;
ISelectionInfo selectionInfo = tbp.getSelectionInfoForShape(s);
IColorConstant hoverColor = null;
...
}
}
OLD
private boolean adaptBackgroundToHover(Graphics graphics) {
if (getVisualState().getHoverFeedback() == IVisualState.HOVER_ON) {
...
ISelectionInfo selectionInfo = null;
if (pe instanceof org.eclipse.graphiti.mm.pictograms.Shape)
selectionInfo = tbp.getSelectionInfoForShape((org.eclipse.graphiti.mm.pictograms.Shape) pe);
else if (pe instanceof org.eclipse.graphiti.mm.pictograms.Anchor)
selectionInfo = tbp.getSelectionInfoForAnchor((org.eclipse.graphiti.mm.pictograms.Anchor) pe);
else
return false;
IColorConstant hoverColor = null;
...
}
}
If I replace the current lines by the older ones (and add the changes of the previous post to AdvancedAnchorEditPart) I get my desired behaviour.
Again, I don't know if this is right.
[Updated on: Mon, 05 May 2014 19:41] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02059 seconds