Fixed #16 - Setting and deleting filter removes properties

This commit is contained in:
Brita Keller 2020-02-17 19:43:27 +01:00
parent a0a4ea1f53
commit 8b55548cca
1 changed files with 12 additions and 6 deletions

View File

@ -119,8 +119,10 @@ public class TransactionDetails {
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
attributeFilter.setSearchText(((Text) e.widget).getText()); attributeFilter.setSearchText(((Text) e.widget).getText());
treeViewer.refresh(); treeViewer.refresh();
treeViewer.expandAll(true);
} }
}); });
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
attributeFilter = new TxAttributeFilter(); attributeFilter = new TxAttributeFilter();
@ -461,16 +463,20 @@ public class TransactionDetails {
*/ */
@Override @Override
public boolean select(Viewer viewer, Object parentElement, Object element) { public boolean select(Viewer viewer, Object parentElement, Object element) {
if (searchString == null || searchString.length() == 0) { if (searchString == null || searchString.length() == 0) {
return true; return true;
} }
if(element instanceof ITxAttribute){ if(element instanceof TreeNode) {
ITxAttribute p = (ITxAttribute) element;
if (p.getName().matches(searchString)) {
return true; return true;
} }
} else if(element instanceof TreeNode) if(element instanceof ITxAttribute){
return true; return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
}
if(element instanceof Object[]) {
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
}
return false; return false;
} }
} }