private List<MPart> getCloseableSiblingParts(MPart part) { MElementContainer<MUIElement> container = getParent(part); if (container == null) { return new ArrayList<>(); } List<MUIElement> children = container.getChildren(); return getCloseableSiblingParts(part, children, 0, children.size()); }
private List<MPart> getCloseableSideParts(MPart part, boolean left) { MElementContainer<MUIElement> container = getParent(part); if (container == null) { return new ArrayList<>(); } int thisPartIdx = getPartIndex(part, container); if (thisPartIdx == -1) { return new ArrayList<>(); } List<MUIElement> children = container.getChildren(); final int start = left ? 0 : thisPartIdx + 1; final int end = left ? thisPartIdx : children.size(); return getCloseableSiblingParts(part, children, start, end); }
private void closeSideParts(Menu menu, boolean left) { MPart selectedPart = (MPart) menu.getData(STACK_SELECTED_PART); MElementContainer<MUIElement> container = getParent(selectedPart); if (container == null) { return; } List<MPart> others = getCloseableSideParts(selectedPart, left); closeSiblingParts(selectedPart, others, true); }
private void closeSiblingParts(Menu menu, boolean skipThisPart) { MPart part = (MPart) menu.getData(STACK_SELECTED_PART); MElementContainer<MUIElement> container = getParent(part); if (container == null) { return; } List<MPart> others = getCloseableSiblingParts(part); closeSiblingParts(part, others, skipThisPart); }
private List<MPart> getCloseableSiblingParts(MPart part) { // broken out from closeSiblingParts so it can be used to determine how // many closeable siblings are available MElementContainer<MUIElement> container = getParent(part); List<MPart> closeableSiblings = new ArrayList<MPart>(); if (container == null) return closeableSiblings; List<MUIElement> children = container.getChildren(); for (MUIElement child : children) { // If the element isn't showing skip it if (!child.isToBeRendered()) continue; MPart otherPart = null; if (child instanceof MPart) otherPart = (MPart) child; else if (child instanceof MPlaceholder) { MUIElement otherItem = ((MPlaceholder) child).getRef(); if (otherItem instanceof MPart) otherPart = (MPart) otherItem; } if (otherPart == null) continue; if (part.equals(otherPart)) continue; // skip selected item if (otherPart.isToBeRendered() && isClosable(otherPart)) closeableSiblings.add(otherPart); } return closeableSiblings; }
private void closeSiblingParts(MPart part, boolean skipThisPart) { MElementContainer<MUIElement> container = getParent(part); if (container == null) return; List<MPart> others = getCloseableSiblingParts(part); // add the current part last so that we unrender obscured items first if (!skipThisPart && part.isToBeRendered() && isClosable(part)) { others.add(part); } // add the selected element of the stack at the end, else we may end up // selecting another part when we hide it since it is the selected // element MUIElement selectedElement = container.getSelectedElement(); if (others.remove(selectedElement)) { others.add((MPart) selectedElement); } else if (selectedElement instanceof MPlaceholder) { selectedElement = ((MPlaceholder) selectedElement).getRef(); if (others.remove(selectedElement)) { others.add((MPart) selectedElement); } } EPartService partService = getContextForParent(part).get( EPartService.class); for (MPart otherPart : others) { if (partService.savePart(otherPart, true)) partService.hidePart(otherPart); } }
private void closeSiblingParts(MPart part, List<MPart> others, boolean skipThisPart) { MElementContainer<MUIElement> container = getParent(part);
MElementContainer<MUIElement> parent = getParent(part); if (parent != null) { closeableElements += getCloseableSiblingParts(part).size();
MElementContainer<MUIElement> parent = getParent(part); if (parent != null) { closeableElements += getCloseableSiblingParts(part).size();