Skip to content
Permalink
Browse files

6659: Remove 'Showing X of Y events...' table message when not applic…

…able

Reviewed-by: hirt
  • Loading branch information
jessyec-s authored and thegreystone committed Jan 14, 2020
1 parent bfb23cd commit 055db4fca9bc8089e763bf14c648419ba535eea2
@@ -60,6 +60,10 @@ public void setExtraMessage(String message) {
this.message = message;
}

public long getNumRowsDisplayed() {
return getFilteredChildren(getInput()).length;
}

@Override
public void refresh(Object element) {
if (message == null) {
@@ -39,6 +39,8 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
@@ -88,8 +90,10 @@
public static FilterComponent createFilterComponent(
ItemList list, IItemFilter filter, IItemCollection items, Supplier<Stream<SelectionStoreEntry>> selections,
Consumer<IItemFilter> onSelect) {
return createFilterComponent(list.getManager().getViewer().getControl(), list.getManager(), filter, items,
selections, onSelect);
FilterComponent fc = createFilterComponent(list.getManager().getViewer().getControl(), list.getManager(),
filter, items, selections, onSelect);
fc.addItemListSearchListener(list);
return fc;
}

public static FilterComponent createFilterComponent(
@@ -180,6 +184,15 @@ public SashForm getComponent() {
return mainSash;
}

private void addItemListSearchListener(ItemList itemList) {
searchText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
itemList.onSearchFilterChange();
}
});
}

private IAction createShowSearchAction() {
IAction checkAction = ActionToolkit.checkAction(max -> {
// it would be better to use setVisible here instead of heightHint, but that doesn't work properly
@@ -207,6 +207,16 @@ private void clearEllipsisMessage() {
tableViewer.setExtraMessage(null);
}

public void onSearchFilterChange() {
long numRows = tableViewer.getNumRowsDisplayed();
if (numRows < maxSize) {
clearEllipsisMessage();
} else {
setEllipsisMessage();
}
tableViewer.refresh();
}

/**
* Construct an identifier that can be used when persisting column state.
*

0 comments on commit 055db4f

Please sign in to comment.
You can’t perform that action at this time.