2

I implemented adding ports as children to a rectangle Figure/EditPart/Model using the Logic example as a reference. The port Figures display as expected, and debugging shows that the EditParts and Models are created and added to the parent, but the children are not selectable.

In the EditPart for the children, I override isSelectable() to return true.

In the parent I tried overriding createChildEditPolicy() to return NonResizableEditPolicy, by reversing the recommendation for making children not selectable here, but it appears to do nothing. If I install NonResizableEditPolicy as a SELECTION_FEEDBACK_ROLE in the child's EditPart, it is initially selected upon creation, but then cannot be selected later.

Also, when the child's Figure is clicked, the parent is not selected either - it is a dead spot where clicking does not change selection.

Am I missing something to make it selectable, or is it likely something else is interfering?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Chris
  • 23
  • 3

2 Answers2

2

You can try with debugger to set breakpoint to viewers getEditPartAt(Point) and stepping from there where it goes. This should be triggered when you click on the child.

It might be that there just isn't any selection feedbacks created, so you can also try outputting the viewer.getSelectedEditParts() to check that is the selection actually there, but the feedback missing.

Tuukka Lindroos
  • 1,270
  • 10
  • 14
  • I assume you mean getObjectAt(Point) - which returns an EditPart. It is not triggered, and neither is getSelectedEditParts(). The selection tool is set to only select one object, and when I click on the child, whatever was the prior selection remains selected, with nothing else added to selections. – Chris Jan 16 '11 at 22:12
  • 1
    Ok, Do you have getDragTracker() function overridden in that child EditPart class? If not, check that super class is doing it, or over ride it to provide basic DragTracker. If that is returning null it might be reason. If DragTracker is there, you could check from DragTrackers mouseDown-function what is going on. – Tuukka Lindroos Jan 16 '11 at 23:36
  • Eclipse made several boilerplate methods (//TODO Auto-generated method stub), including getDragTracker(). Once I removed those, it is now working. Thanks for the solution Hotzilla. Unfortunately, I didn't create an account so I can't login to accept your answer. – Chris Jan 17 '11 at 22:11
  • @Chris, I merged your accounts so you should now be able to accept this answer. – Bill the Lizard Jan 17 '11 at 22:12
0

I meet the same issue , and fix it in the way : try to install a suitable policy in the editpart.

   @Override
   protected void createEditPolicies() {
       installEditPolicy(EditPolicy.LAYOUT_ROLE, yourEditPolicy());
   }
Sam Su
  • 6,532
  • 8
  • 39
  • 80