Skip to content

Commit

Permalink
Add Views filter option to Models Tree Search filter
Browse files Browse the repository at this point in the history
- And move the Specializations sub-menu into the concepts group so it is not associated with Name/Documentation/Properties
  • Loading branch information
Phillipus committed Dec 4, 2024
1 parent 5526a98 commit 6d3abee
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +41,7 @@ public class SearchFilter extends ViewerFilter {
private Set<EClass> fConceptsFilter = new HashSet<>();
private Set<String> fPropertiesFilter = new HashSet<>();
private Set<IProfile> fSpecializationsFilter = new HashSet<>();
private boolean fFilterViews = false;

private boolean fShowAllFolders = false;

Expand All @@ -57,6 +59,7 @@ void reset() {
resetConceptsFilter();
resetPropertiesFilter();
resetSpecializationsFilter();
setFilterViews(false);
}

@Override
Expand Down Expand Up @@ -105,12 +108,14 @@ private boolean isElementVisible(Object element) {
public boolean matchesFilter(Object element) {
boolean show = true;

// Concept or Specialization
if(isFilteringConcepts() || isFilteringSpecializations()) {
show &= shouldShowConcept(element) || shouldShowSpecialization(element);
// Concepts, Specializations or View
if(isFilteringConcepts() || isFilteringSpecializations() || isFilteringViews()) {
show = (isFilteringConcepts() && shouldShowConcept(element))
|| (isFilteringSpecializations() && shouldShowSpecialization(element))
|| (isFilteringViews() && element instanceof IDiagramModel);
}

// Name or Documentation or Property
// Name, Documentation or Property
if(isFilteringName() || isFilteringDocumentation() || isFilteringPropertyKeys()) {
show &= (isFilteringName() && shouldShowObjectWithName(element))
|| (isFilteringDocumentation() && shouldShowObjectWithDocumentation(element))
Expand Down Expand Up @@ -174,7 +179,7 @@ private boolean shouldShowProperty(Object element) {
}

public boolean isFiltering() {
return isFilteringName() || isFilteringDocumentation() || isFilteringConcepts() || isFilteringPropertyKeys() || isFilteringSpecializations();
return isFilteringName() || isFilteringDocumentation() || isFilteringConcepts() || isFilteringPropertyKeys() || isFilteringSpecializations() || isFilteringViews();
}

private boolean isFilteringName() {
Expand Down Expand Up @@ -252,4 +257,13 @@ void setShowAllFolders(boolean set) {
boolean isShowAllFolders() {
return fShowAllFolders;
}

void setFilterViews(boolean set) {
fFilterViews = set;
}

boolean isFilteringViews() {
return fFilterViews;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class SearchWidget extends Composite {

private IAction fActionFilterName;
private IAction fActionFilterDocumentation;
private IAction fActionFilterViews;

private List<IAction> fConceptActions = new ArrayList<>();

Expand Down Expand Up @@ -236,13 +237,13 @@ public void run() {
dropDownAction.add(fPropertiesMenu);
populatePropertiesMenu();

dropDownAction.add(new Separator());

// Specializations
fSpecializationsMenu = new MenuManager(Messages.SearchWidget_16);
dropDownAction.add(fSpecializationsMenu);
populateSpecializationsMenu();

dropDownAction.add(new Separator());

// Concept sub-menus
MenuManager strategyMenu = new MenuManager(Messages.SearchWidget_15);
dropDownAction.add(strategyMenu);
Expand Down Expand Up @@ -300,6 +301,17 @@ public void run() {
relationsMenu.add(createConceptAction(eClass));
}

// Views
fActionFilterViews = new Action(Messages.SearchWidget_17, IAction.AS_CHECK_BOX) {
@Override
public void run() {
fSearchFilter.setFilterViews(isChecked());
refreshTree();
}
};
fActionFilterViews.setChecked(fSearchFilter.isFilteringViews());
dropDownAction.add(fActionFilterViews);

dropDownAction.add(new Separator());

// Show All Folders
Expand Down Expand Up @@ -348,6 +360,9 @@ private void reset() {
for(IAction action : fConceptActions) {
action.setChecked(false);
}

// Views
fActionFilterViews.setChecked(false);

// This will set name filter true, documentation filter false, and clear concepts, properties, and specializations filters
fSearchFilter.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SearchWidget_13=Reset Filters
SearchWidget_14=Other
SearchWidget_15=Strategy
SearchWidget_16=Specializations
SearchWidget_17=Views
SearchWidget_2=Documentation
SearchWidget_3=Search in Documentation
SearchWidget_4=Filter Options
Expand Down
Binary file modified com.archimatetool.help/help/Images/model-tree-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified com.archimatetool.help/help/Images/model-tree-filter2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified com.archimatetool.help/help/Images/model-tree-searchbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified com.archimatetool.help/help/Images/model-tree-searchbar2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions com.archimatetool.help/help/Text/model_tree_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ <h2>Searching and Filtering in the Model Tree</h2>
<p>In order to search the Model Tree a Search Bar is included in Archi. This is accessed by clicking on the "Search" button on the toolbar of the Model Tree window. Clicking this button reveals the Search Bar:</p>

<img src="../Images/model-tree-searchbar.png"/>
<p class="caption">The Search Bar revealed</p>
<p class="caption">Click here to open the Search Bar</p>

<p>As you type into the text field of the Search Bar the Model Tree updates to show only those objects that match the search criteria in the Search Bar. By default only the names of the objects are matched to the search string. You can also search on the "Documentation" field of the objects by ticking this in the "Filter Options" drop-down menu in the Search Bar:</p>

<img src="../Images/model-tree-searchbar2.png"/>
<p class="caption">Searching on both "Name" and "Documentation"</p>

<p>To clear the search text selection click on the icon to the right of the text. To clear the filters, deselect "Name" and/or "Documentation".</p>
<p>To clear the search text click on the icon to the right of the text. To clear the filters, deselect "Name" and/or "Documentation".</p>

<br/>

<h3>Filtering Object Types</h3>

<p>To filter certain types of ArchiMate concept you can select the types to include in the filter/search in the drop-down menu:</p>
<p>To filter certain types of ArchiMate concept you can select the types to include in the filter/search in the drop-down menu. You can select Specializations, Elements, Relations, and Views:</p>

<img src="../Images/model-tree-filter.png"/>
<p class="caption">Filtering certain object types</p>
Expand All @@ -54,11 +54,15 @@ <h3>Filtering Specializations</h3>

<br/>

<h3>Showing All Folders</h3>
<h3>Show All Folders</h3>

<p>As you refine your search the Model Tree will only show those objects that match your search/filter criteria (or none at all if no objects match). Thus, folders with no matching child objects are not shown. If however you wish to show these empty folders as you search for objects (you may wish to drag and drop objects to other folders, for example) then you can set this as an option in the filter menu by selecting "Show All Folders".</p>

<br/>

<h3>Reset Filters</h3>

<p>To close the Search Bar and reset the search filter click the "Search" button one more time.</p>
<p>Selecting this menu item will clear all selections for Documentation, Properties, Specializations, Elements, Relations, and Views.</p>

<br/>

Expand Down

0 comments on commit 6d3abee

Please sign in to comment.