From 4f15749214b5708dfbdd808b260251950193927d Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Tue, 3 Dec 2024 10:36:58 +0000
Subject: [PATCH] Add "Show All Views" option to Models Tree Search Filter
- TODO: new screenshots and help in model_tree_search.html
---
.../editor/views/tree/search/Messages.java | 2 ++
.../editor/views/tree/search/SearchFilter.java | 17 +++++++++++++++++
.../editor/views/tree/search/SearchWidget.java | 11 +++++++++++
.../views/tree/search/messages.properties | 1 +
4 files changed, 31 insertions(+)
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/Messages.java b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/Messages.java
index dcd9ffb7a..10fdb39d3 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/Messages.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/Messages.java
@@ -29,6 +29,8 @@ public class Messages extends NLS {
public static String SearchWidget_16;
+ public static String SearchWidget_17;
+
public static String SearchWidget_2;
public static String SearchWidget_3;
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchFilter.java b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchFilter.java
index 3f5e75027..3fde9ba2b 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchFilter.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchFilter.java
@@ -15,6 +15,7 @@
import com.archimatetool.editor.utils.StringUtils;
import com.archimatetool.model.IArchimateConcept;
+import com.archimatetool.model.IDiagramModel;
import com.archimatetool.model.IDocumentable;
import com.archimatetool.model.IFolder;
import com.archimatetool.model.IFolderContainer;
@@ -42,6 +43,7 @@ public class SearchFilter extends ViewerFilter {
private Set fSpecializationsFilter = new HashSet<>();
private boolean fShowAllFolders = false;
+ private boolean fShowAllViews = false;
SearchFilter() {
}
@@ -94,6 +96,11 @@ private boolean isElementVisible(Object element) {
}
}
+ // Show all Views
+ if(element instanceof IDiagramModel && isShowAllViews()) {
+ return true;
+ }
+
return matchesFilter(element);
}
@@ -117,6 +124,7 @@ public boolean matchesFilter(Object element) {
|| (isFilteringPropertyKeys() && shouldShowProperty(element));
}
+
return show;
}
@@ -252,4 +260,13 @@ void setShowAllFolders(boolean set) {
boolean isShowAllFolders() {
return fShowAllFolders;
}
+
+ void setShowAllViews(boolean set) {
+ fShowAllViews = set;
+ }
+
+ boolean isShowAllViews() {
+ return fShowAllViews;
+ }
+
}
\ No newline at end of file
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java
index 836f6b053..c6c6109f0 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java
@@ -313,6 +313,17 @@ public void run() {
action.setChecked(fSearchFilter.isShowAllFolders());
dropDownAction.add(action);
+ // Show All Views
+ action = new Action(Messages.SearchWidget_17, IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ fSearchFilter.setShowAllViews(isChecked());
+ refreshTree();
+ }
+ };
+ action.setChecked(fSearchFilter.isShowAllViews());
+ dropDownAction.add(action);
+
dropDownAction.add(new Separator());
// Reset
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/messages.properties b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/messages.properties
index 32ae2688d..30fa1268c 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/messages.properties
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/messages.properties
@@ -7,6 +7,7 @@ SearchWidget_13=Reset Filters
SearchWidget_14=Other
SearchWidget_15=Strategy
SearchWidget_16=Specializations
+SearchWidget_17=Show All Views
SearchWidget_2=Documentation
SearchWidget_3=Search in Documentation
SearchWidget_4=Filter Options