use of org.freeplane.features.filter.condition.ASelectableCondition in project freeplane by freeplane.
the class QuickFindAllAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final ASelectableCondition condition = filterEditor.getCondition();
if (condition == null) {
return;
}
final IMapSelection selection = Controller.getCurrentController().getSelection();
final MapController mapController = Controller.getCurrentModeController().getMapController();
final NodeModel selected = selection.getSelected();
final NodeModel rootNode = selected.getMap().getRootNode();
boolean nodeFound = condition.checkNode(rootNode);
if (nodeFound) {
selection.selectAsTheOnlyOneSelected(rootNode);
}
NodeModel next = rootNode;
for (; ; ) {
next = filterController.findNext(next, rootNode, Direction.FORWARD, condition);
if (next == null) {
break;
}
mapController.displayNode(next);
if (nodeFound) {
selection.toggleSelected(next);
} else {
selection.selectAsTheOnlyOneSelected(next);
nodeFound = true;
}
}
if (condition.checkNode(selected))
selection.makeTheSelected(selected);
}
Aggregations