enhance search

This commit is contained in:
bancika
2020-04-14 10:49:20 +02:00
parent af2f55905e
commit b416d4c8d4
2 changed files with 44 additions and 5 deletions
@@ -1004,12 +1004,15 @@ public class Presenter implements IPlugInPort {
drawingManager.clearContinuityArea();
}
@SuppressWarnings("unchecked")
@Override
public void selectMatching(String criteria) {
Set<IDIYComponent<?>> matching = new HashSet<IDIYComponent<?>>();
for (IDIYComponent<?> c : currentProject.getComponents()) {
ComponentType type = ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
if ((c.getName() != null && c.getName().toLowerCase().matches(criteria.toLowerCase())) ||
(c.getValueForDisplay() != null && c.getValueForDisplay().toLowerCase().matches(criteria.toLowerCase())))
(c.getValueForDisplay() != null && c.getValueForDisplay().toLowerCase().matches(criteria.toLowerCase())) ||
type.getName().toLowerCase().matches(criteria.toLowerCase()))
matching.add(c);
}
updateSelection(matching);