Skip to content

Commit

Permalink
4
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Jan 18, 2025
1 parent 21fde92 commit e065649
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ public boolean matchesFilter(Object element) {
if(isFilteringName() || isFilteringDocumentation() || isFilteringPropertyKeys() || isFilteringPropertyValues()) {
show &= (isFilteringName() && shouldShowObjectWithName(element))
|| (isFilteringDocumentation() && shouldShowObjectWithDocumentation(element))
|| (isFilteringPropertyValues() && shouldShowPropertyValue(element))
|| (isFilteringPropertyKeys() && shouldShowPropertyKey(element));
|| ((isFilteringPropertyKeys() || isFilteringPropertyValues()) && shouldShowObjectWithProperty(element));
}

return show;
Expand All @@ -140,6 +139,21 @@ private boolean shouldShowConcept(Object element) {
return fConceptsFilter.contains(((EObject)element).eClass());
}

private boolean shouldShowSpecialization(Object element) {
if(element instanceof IArchimateConcept concept) {
for(IProfile profile : concept.getProfiles()) {
for(IProfile p : fSpecializationsFilter) {
// Could be matching Profile name/class in different models
if(ArchimateModelUtils.isMatchingProfile(p, profile)) {
return true;
}
}
}
}

return false;
}

private boolean shouldShowObjectWithName(Object element) {
if(element instanceof INameable nameable) {
String name = StringUtils.safeString(nameable.getName());
Expand All @@ -164,43 +178,19 @@ private boolean shouldShowObjectWithDocumentation(Object element) {
return false;
}

private boolean shouldShowSpecialization(Object element) {
if(element instanceof IArchimateConcept concept) {
for(IProfile profile : concept.getProfiles()) {
for(IProfile p : fSpecializationsFilter) {
// Could be matching Profile name/class in different models
if(ArchimateModelUtils.isMatchingProfile(p, profile)) {
return true;
}
}
}
}

return false;
}

private boolean shouldShowPropertyKey(Object element) {
if(element instanceof IProperties properties) {
for(IProperty property : properties.getProperties()) {
if(fPropertyKeyFilter.contains(property.getKey())) {
// If there is search text filter on that, otherwise show the element if the property key is selected
return hasSearchText() && isFilteringPropertyValues() ? matchesString(property.getValue()) : true;
}
}
}

return false;
}

private boolean shouldShowPropertyValue(Object element) {
private boolean shouldShowObjectWithProperty(Object element) {
if(element instanceof IProperties properties) {
for(IProperty property : properties.getProperties()) {
// If we are filtering on property keys match on property key and value
// If filtering on property keys
if(isFilteringPropertyKeys()) {
return fPropertyKeyFilter.contains(property.getKey()) && matchesString(property.getValue());
// And this property has that filtered key
if(fPropertyKeyFilter.contains(property.getKey())) {
// If filtering on property value match on that else show the element
return isFilteringPropertyValues() ? matchesString(property.getValue()) : true;
}
}
// If we are not filtering on property keys match on value (equivalent to all property kesy selected)
if(matchesString(property.getValue())) {
// Else match on property value
else if(matchesString(property.getValue())) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void run() {
refreshTree();
};
};
fActionFilterPropertyValues.setToolTipText("Search in Property Values");
fActionFilterPropertyValues.setToolTipText("Filter on Property Values");
dropDownAction.add(fActionFilterPropertyValues);

// Property Keys
Expand All @@ -277,7 +277,7 @@ public void run() {
}
}
};
actionProperties.setToolTipText("Search in Property Keys");
actionProperties.setToolTipText("Select Properties to filter");
dropDownAction.add(actionProperties);

dropDownAction.add(new Separator());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SearchWidget_0=Name
SearchWidget_1=Search in Name
SearchWidget_1=Filter on Name
SearchWidget_10=Implementation && Migration
SearchWidget_11=Relations
SearchWidget_12=Show All Folders
Expand All @@ -12,7 +12,7 @@ SearchWidget_18=Match Case
SearchWidget_19=Match Regular Expression
SearchWidget_2=Documentation
SearchWidget_20=Invalid Regular Expression
SearchWidget_3=Search in Documentation
SearchWidget_3=Filter on Documentation
SearchWidget_4=Filter Options
SearchWidget_5=Properties...
SearchWidget_6=Business
Expand Down

0 comments on commit e065649

Please sign in to comment.