Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 118394

Summary: Navigating to the parent EditPart after ALT+UP and back after ALT+DOWN
Product: [Tools] GEF Reporter: Sergey Vyunnikov <svyunnikov>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 3.1.1Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sergey Vyunnikov CLA 2005-11-29 04:42:52 EST
For example, I have three edit parts A, B and C. A is parent for B and B is parent for C. A and C are selectable but B is invisible and not selectable.

After ALT+UP pressing GraphicalViewerKeyHandler calls "navigateOut" method and then navigates to the parent of the currently focused EditPart. But in my case parent(B) of focusable editpart(C) is invisible and not selectable. GraphicalViewerKeyHandler notifies all listeners about edit part(B) is selected. Why this method does not check isSelectable() for parent edit part and find more suitable parent(A) for focusable edit part?

I can override method "navigateTo", find and select more suitable edit part(A) for focused edit part(C). But in other case when I press ALT+DOWN and if edit part(A) is focused, method navigateIntoContainer checks if children(edit part B) is selectable and does not select anything.
Comment 1 Pratik Shah CLA 2005-11-29 09:26:30 EST
Care to submit a patch?
Comment 2 Sergey Vyunnikov CLA 2005-12-05 05:40:03 EST
> Care to submit a patch?

I created new KeyHandler class (copy of GraphicalViewerKeyHandler except "navigateOut" method). See code below.

void navigateOut(KeyEvent event) {
        if (getFocusEditPart() == null || getFocusEditPart() == getViewer().getContents()
                || getFocusEditPart().getParent() == getViewer().getContents())
            return;

        //Find parent selectable edit part.
        EditPart parentEditPart = getFocusEditPart().getParent();
        while (parentEditPart != null && !parentEditPart.isSelectable()) {
            parentEditPart = parentEditPart.getParent();
        } // while
        //If not found nothing to select.
        if (parentEditPart != null) {
            navigateTo(parentEditPart, event);
        } // if
} //navigateOut

I am not sure about the last IF statement because navigateTo method checks if edit part is NULL. Who should care of it? navigateOut or navigateTo? If navigateTo then this IF is useless.
Comment 3 Alexander Nyßen CLA 2010-11-22 16:46:04 EST
I have created bug #330859, which addresses this problem as well as related problems/inconsistencies within SelectionTool and MarqueeSelectionTool.

*** This bug has been marked as a duplicate of bug 330859 ***