@Override public void activate() { super.activate(); // register for change notifications regarding hidden nodes HidingModel hidingModel = getHidingModel(); hidingModel.addPropertyChangeListener(hidingModelListener); }
@Override public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { // save the graph nodes that are removed from the hiding model shownNeighbors.clear(); Set<NodeContentPart> hiddenNeighbors = hidingModel.getHiddenNeighborParts(nodePart); if (hiddenNeighbors != null && !hiddenNeighbors.isEmpty()) { for (NodeContentPart neighborPart : hiddenNeighbors) { neighborPart.activate(); hidingModel.show(neighborPart); shownNeighbors.add(neighborPart); } } return Status.OK_STATUS; }
@Override public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { for (NodeContentPart neighborPart : shownNeighbors) { hidingModel.hide(neighborPart); neighborPart.deactivate(); } return Status.OK_STATUS; }
@Override public void deactivate() { HidingModel hidingModel = getHidingModel(); hidingModel.removePropertyChangeListener(hidingModelListener); super.deactivate(); }
@Override public boolean isNoOp() { Set<NodeContentPart> hiddenNeighbors = hidingModel.getHiddenNeighborParts(nodePart); return hiddenNeighbors != null && !hiddenNeighbors.isEmpty(); }