public void addAdjustedSelection( final Object element, Condition isExpired, @Nullable Object adjustmentCause) { myAdjustedSelection.put(element, isExpired); if (adjustmentCause != null) { myAdjustmentCause2Adjustment.put(adjustmentCause, element); } }
public void addAll(@NotNull UpdaterTreeState state) { myToExpand.putAll(state.myToExpand); Object[] toSelect = state.getToSelect(); for (Object each : toSelect) { if (!myAdjustedSelection.containsKey(each)) { myToSelect.put(each, each); } } myCanRunRestore = state.myCanRunRestore; }
private void invalidateToSelectWithRefsToParent(DefaultMutableTreeNode actionNode) { if (actionNode != null) { Object readyElement = myUi.getElementFor(actionNode); if (readyElement != null) { Iterator<Object> toSelect = myToSelect.keySet().iterator(); while (toSelect.hasNext()) { Object eachToSelect = toSelect.next(); if (readyElement.equals(myUi.getTreeStructure().getParentElement(eachToSelect))) { List<Object> children = myUi.getLoadedChildrenFor(readyElement); if (!children.contains(eachToSelect)) { toSelect.remove(); if (!myToSelect.containsKey(readyElement) && !myUi.getSelectedElements().contains(eachToSelect)) { addAdjustedSelection(eachToSelect, Conditions.alwaysFalse(), null); } } } } } } }
private ActionCallback processHangByParent(Set<Object> elements) { if (elements.isEmpty()) return new ActionCallback.Done(); ActionCallback result = new ActionCallback(elements.size()); for (Object hangElement : elements) { if (!myAdjustmentCause2Adjustment.containsKey(hangElement)) { processHangByParent(hangElement).notify(result); } else { result.setDone(); } } return result; }
private ActionCallback processHangByParent(Set<Object> elements) { if (elements.size() == 0) return new ActionCallback.Done(); ActionCallback result = new ActionCallback(elements.size()); for (Iterator<Object> iterator = elements.iterator(); iterator.hasNext(); ) { Object hangElement = iterator.next(); if (!myAdjustmentCause2Adjustment.containsKey(hangElement)) { processHangByParent(hangElement).notify(result); } else { result.setDone(); } } return result; }
public boolean isQueuedForSelection(Object element) { return myToSelect.containsKey(element); }
public void removeFromSelection(Object element) { myToSelect.remove(element); myAdjustedSelection.remove(element); }
public void addSelection(final Object element) { myToSelect.put(element, element); }
public void clearSelection() { myToSelect.clear(); myAdjustedSelection = new WeakHashMap<Object, Condition>(); }
public void clearExpansion() { myToExpand.clear(); }
public boolean isEmpty() { return myToExpand.isEmpty() && myToSelect.isEmpty() && myAdjustedSelection.isEmpty(); }
@NotNull public Object[] getToExpand() { return myToExpand.keySet().toArray(new Object[myToExpand.size()]); }
@NotNull public Object[] getToSelect() { return myToSelect.keySet().toArray(new Object[myToSelect.size()]); }