提交 af4f26c5 编写于 作者: S serge-rider

#894 Filter save action/icon

上级 51bf2520
......@@ -100,6 +100,7 @@ public class UIIcon {
public static final DBIcon FILTER_CLIPBOARD = new DBIcon("filter_clipboard", "misc/filter_clipboard.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon FILTER_APPLY = new DBIcon("filter_apply", "misc/filter_apply.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon FILTER_RESET = new DBIcon("filter_reset", "misc/filter_reset.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon FILTER_SAVE = new DBIcon("filter_save", "misc/filter_save.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon EVENT = new DBIcon("event", "misc/event.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon HOME = new DBIcon("home", "misc/home.png"); //$NON-NLS-1$ //$NON-NLS-2$
......
......@@ -94,6 +94,7 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
private final ToolBar filterToolbar;
private final ToolItem filtersApplyButton;
private final ToolItem filtersClearButton;
private final ToolItem filtersSaveButton;
private final ToolItem autoRefreshButton;
private final ToolItem historyBackButton;
private final ToolItem historyForwardButton;
......@@ -226,7 +227,7 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
filtersClearButton = new ToolItem(filterToolbar, SWT.PUSH | SWT.NO_FOCUS);
filtersClearButton.setImage(DBeaverIcons.getImage(UIIcon.FILTER_RESET));
filtersClearButton.setToolTipText("Remove all filters");
filtersClearButton.setToolTipText("Remove all filters/orderings");
filtersClearButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......@@ -235,6 +236,18 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
});
filtersClearButton.setEnabled(false);
filtersSaveButton = new ToolItem(filterToolbar, SWT.PUSH | SWT.NO_FOCUS);
filtersSaveButton.setImage(DBeaverIcons.getImage(UIIcon.FILTER_SAVE));
filtersSaveButton.setToolTipText("Save filter settings for current object");
filtersSaveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
viewer.saveDataFilter();
}
});
filtersSaveButton.setEnabled(false);
ToolItem filtersCustomButton = new ToolItem(filterToolbar, SWT.PUSH | SWT.NO_FOCUS);
filtersCustomButton.setImage(DBeaverIcons.getImage(UIIcon.FILTER));
filtersCustomButton.setToolTipText("Custom Filters");
......@@ -319,7 +332,8 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
String filterText = filtersText.getText();
filtersText.setEnabled(supportsDataFilter);
filtersApplyButton.setEnabled(supportsDataFilter);
filtersClearButton.setEnabled(supportsDataFilter && !CommonUtils.isEmpty(filterText));
filtersClearButton.setEnabled(viewer.getModel().getDataFilter().hasFilters());
filtersSaveButton.setEnabled(true);
// Update history buttons
if (historyPosition > 0) {
historyBackButton.setEnabled(true);
......
......@@ -288,6 +288,11 @@ public class ResultSetViewer extends Viewer
setDataFilter(model.createDataFilter(), refresh);
}
public void saveDataFilter()
{
}
void switchFilterFocus() {
boolean filterFocused = filtersPanel.getEditControl().isFocusControl();
if (filterFocused) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册