Search in sources :

Example 1 with GroupEditPart

use of org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart in project archi by archimatetool.

the class PaletteViewerKeyHandler method navigateToNextContainer.

private boolean navigateToNextContainer(KeyEvent event) {
    EditPart current = getFocusEditPart();
    while (current != null) {
        if (current instanceof DrawerEditPart || current instanceof GroupEditPart) {
            List siblings = current.getParent().getChildren();
            int index = siblings.indexOf(current);
            if (index != -1 && siblings.size() > index + 1) {
                EditPart part = (EditPart) siblings.get(index + 1);
                if (part instanceof GroupEditPart && part.getChildren().size() > 0) {
                    EditPart child = (EditPart) part.getChildren().get(0);
                    navigateTo(child, event);
                } else
                    navigateTo(part, event);
                return true;
            }
            return false;
        }
        current = current.getParent();
    }
    return false;
}
Also used : DrawerEditPart(org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart) IPaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart) PaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.PaletteStackEditPart) PinnablePaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.PinnablePaletteStackEditPart) GroupEditPart(org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart) ToolEntryEditPart(org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart) EditPart(org.eclipse.gef.EditPart) DrawerEditPart(org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart) TemplateEditPart(org.eclipse.gef.internal.ui.palette.editparts.TemplateEditPart) ArrayList(java.util.ArrayList) List(java.util.List) GroupEditPart(org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart) Point(org.eclipse.draw2d.geometry.Point)

Example 2 with GroupEditPart

use of org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart in project archi by archimatetool.

the class PaletteViewerKeyHandler method getNavigationSiblings.

/**
 * @return a list of {@link org.eclipse.gef.EditPart EditParts} that can be
 *         traversed to from the current
 *         {@link GraphicalViewerKeyHandler#getFocusEditPart() focus part}
 */
@Override
protected List getNavigationSiblings() {
    ArrayList siblingsList = new ArrayList();
    EditPart focusPart = getFocusEditPart();
    EditPart parent = focusPart.getParent();
    if (parent == null) {
        siblingsList.add(focusPart);
        return siblingsList;
    }
    if (parent instanceof GroupEditPart || parent instanceof IPaletteStackEditPart) {
        EditPart grandParent = parent.getParent();
        buildNavigationList(grandParent, grandParent, siblingsList, grandParent);
    } else
        buildNavigationList(parent, parent, siblingsList, parent);
    return siblingsList;
}
Also used : ArrayList(java.util.ArrayList) IPaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart) PaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.PaletteStackEditPart) PinnablePaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.PinnablePaletteStackEditPart) GroupEditPart(org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart) ToolEntryEditPart(org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart) EditPart(org.eclipse.gef.EditPart) DrawerEditPart(org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart) TemplateEditPart(org.eclipse.gef.internal.ui.palette.editparts.TemplateEditPart) GroupEditPart(org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart) IPaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart)

Aggregations

ArrayList (java.util.ArrayList)2 EditPart (org.eclipse.gef.EditPart)2 DrawerEditPart (org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart)2 GroupEditPart (org.eclipse.gef.internal.ui.palette.editparts.GroupEditPart)2 IPaletteStackEditPart (org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart)2 PaletteStackEditPart (org.eclipse.gef.internal.ui.palette.editparts.PaletteStackEditPart)2 PinnablePaletteStackEditPart (org.eclipse.gef.internal.ui.palette.editparts.PinnablePaletteStackEditPart)2 TemplateEditPart (org.eclipse.gef.internal.ui.palette.editparts.TemplateEditPart)2 ToolEntryEditPart (org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart)2 List (java.util.List)1 Point (org.eclipse.draw2d.geometry.Point)1