Search in sources :

Example 1 with IPaletteStackEditPart

use of org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart 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)

Example 2 with IPaletteStackEditPart

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

the class PaletteViewerKeyHandler method navigateTo.

/**
 * @see GraphicalViewerKeyHandler#navigateTo(EditPart, KeyEvent)
 */
@Override
protected void navigateTo(EditPart part, KeyEvent event) {
    if (part == null)
        return;
    if (part instanceof IPaletteStackEditPart) {
        PaletteEntry activeEntry = ((PaletteStack) part.getModel()).getActiveEntry();
        part = (EditPart) getViewer().getEditPartRegistry().get(activeEntry);
    }
    getViewer().select(part);
    getViewer().reveal(part);
}
Also used : PaletteEntry(org.eclipse.gef.palette.PaletteEntry) IPaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart) PaletteStack(org.eclipse.gef.palette.PaletteStack)

Example 3 with IPaletteStackEditPart

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

the class PaletteViewerKeyHandler method buildNavigationList.

private void buildNavigationList(EditPart palettePart, EditPart exclusion, ArrayList navList, EditPart stackPart) {
    if (palettePart != exclusion) {
        if (isCollapsedDrawer(palettePart)) {
            navList.add(palettePart);
            return;
        } else if (stackPart instanceof PaletteStackEditPart && stackPart.getChildren().contains(palettePart)) {
            // we only want to add the top level item to the navlist
            if (((PaletteStack) stackPart.getModel()).getActiveEntry().equals(palettePart.getModel()))
                navList.add(palettePart);
        } else if (stackPart instanceof PinnablePaletteStackEditPart && stackPart.getChildren().contains(palettePart)) {
            // the palette stack is expanded
            if (((PinnablePaletteStackEditPart) stackPart).isExpanded() || ((PaletteStack) stackPart.getModel()).getActiveEntry().equals(palettePart.getModel())) {
                navList.add(palettePart);
            }
        } else if ((palettePart instanceof ToolEntryEditPart || palettePart instanceof DrawerEditPart || palettePart instanceof TemplateEditPart)) {
            navList.add(palettePart);
        }
    }
    List children = palettePart.getChildren();
    for (int k = 0; k < children.size(); k++) {
        EditPart ep = (EditPart) children.get(k);
        if (ep instanceof IPaletteStackEditPart)
            stackPart = ep;
        buildNavigationList(ep, exclusion, navList, stackPart);
    }
}
Also used : PinnablePaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.PinnablePaletteStackEditPart) TemplateEditPart(org.eclipse.gef.internal.ui.palette.editparts.TemplateEditPart) 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) 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) PaletteStack(org.eclipse.gef.palette.PaletteStack) ToolEntryEditPart(org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart) Point(org.eclipse.draw2d.geometry.Point) IPaletteStackEditPart(org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart)

Aggregations

IPaletteStackEditPart (org.eclipse.gef.internal.ui.palette.editparts.IPaletteStackEditPart)3 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 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 PaletteStack (org.eclipse.gef.palette.PaletteStack)2 List (java.util.List)1 Point (org.eclipse.draw2d.geometry.Point)1 PaletteEntry (org.eclipse.gef.palette.PaletteEntry)1