Search in sources :

Example 6 with DBSObjectFilter

use of org.jkiss.dbeaver.model.struct.DBSObjectFilter in project dbeaver by serge-rider.

the class NavigatorHandlerFilterToggle method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final ISelection selection = HandlerUtil.getCurrentSelection(event);
    DBNNode node = NavigatorUtils.getSelectedNode(selection);
    if (node instanceof DBNDatabaseItem) {
        node = node.getParentNode();
    }
    if (node instanceof DBNDatabaseFolder) {
        final DBNDatabaseFolder folder = (DBNDatabaseFolder) node;
        DBXTreeItem itemsMeta = folder.getItemsMeta();
        if (itemsMeta != null) {
            final DBSObjectFilter nodeFilter = folder.getNodeFilter(itemsMeta, true);
            if (nodeFilter != null) {
                nodeFilter.setEnabled(!nodeFilter.isEnabled());
                NavigatorHandlerRefresh.refreshNavigator(Collections.singleton(folder));
            }
        }
    }
    return null;
}
Also used : DBNDatabaseItem(org.jkiss.dbeaver.model.navigator.DBNDatabaseItem) DBSObjectFilter(org.jkiss.dbeaver.model.struct.DBSObjectFilter) DBXTreeItem(org.jkiss.dbeaver.model.navigator.meta.DBXTreeItem) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) ISelection(org.eclipse.jface.viewers.ISelection) DBNDatabaseFolder(org.jkiss.dbeaver.model.navigator.DBNDatabaseFolder)

Aggregations

DBSObjectFilter (org.jkiss.dbeaver.model.struct.DBSObjectFilter)6 DBNDatabaseFolder (org.jkiss.dbeaver.model.navigator.DBNDatabaseFolder)3 DBXTreeItem (org.jkiss.dbeaver.model.navigator.meta.DBXTreeItem)3 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)3 ISelection (org.eclipse.jface.viewers.ISelection)2 DBNDatabaseItem (org.jkiss.dbeaver.model.navigator.DBNDatabaseItem)2 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Display (org.eclipse.swt.widgets.Display)1 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)1 DBPOrderedObject (org.jkiss.dbeaver.model.DBPOrderedObject)1 DBPConnectionType (org.jkiss.dbeaver.model.connection.DBPConnectionType)1 DBEObjectMaker (org.jkiss.dbeaver.model.edit.DBEObjectMaker)1 DBEObjectRenamer (org.jkiss.dbeaver.model.edit.DBEObjectRenamer)1 DBEObjectReorderer (org.jkiss.dbeaver.model.edit.DBEObjectReorderer)1