Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342666 - "hasFocus()" from class ShapeEditPart returns wrong result
Summary: "hasFocus()" from class ShapeEditPart returns wrong result
Status: CLOSED WORKSFORME
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-13 03:15 EDT by Juergen Pasch CLA
Modified: 2011-06-24 08:54 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Pasch CLA 2011-04-13 03:15:07 EDT
This result appeared when extending method "isSelectable()" with "hasFocus()" for testing purposes. The method delivered always false, even when the diagram editor has had focus. Note: ShapeEditPart extends gef.editparts.AbstractEditPart.
Comment 1 Matthias Gorning CLA 2011-05-13 04:59:49 EDT
For me this method works correct.

For testing the correct behaviour you can override the method "hasFocus()" in ShapeEditPart with:

	@Override
	public boolean hasFocus() {
		boolean ret = super.hasFocus();
		if (ret) {
			if (getPictogramElement().getGraphicsAlgorithm() instanceof org.eclipse.graphiti.mm.algorithms.Rectangle) {
				EList<GraphicsAlgorithm> gaChildren = getPictogramElement().getGraphicsAlgorithm().getGraphicsAlgorithmChildren();
				if (gaChildren.size() > 0 && gaChildren.get(0) instanceof Text) {
					Text t = (Text) gaChildren.get(0);
					System.out.println("ShapeEditPart.hasFocus() " + t.getValue());
				}
			}
		}
		return ret;
	}
Comment 2 Matthias Gorning CLA 2011-05-13 05:16:02 EDT
You must test this with the sketch editor. Create some objects of type "Rectangle Single Text". Then change simply the focus between these edit parts and you will see the output in the console.
Comment 3 Michael Wenz CLA 2011-06-24 08:54:31 EDT
No bug