use of org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView in project dbeaver by serge-rider.
the class NavigatorHandlerFilterObjectType method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof DatabaseNavigatorView) {
DatabaseNavigatorTree navigatorTree = ((DatabaseNavigatorView) activePart).getNavigatorTree();
DatabaseNavigatorTreeFilterObjectType objectType = CommonUtils.valueOf(DatabaseNavigatorTreeFilterObjectType.class, event.getParameter("type"), DatabaseNavigatorTreeFilterObjectType.table);
if (objectType == navigatorTree.getFilterObjectType()) {
return null;
}
navigatorTree.setFilterObjectType(objectType);
navigatorTree.getViewer().getControl().setRedraw(false);
try {
navigatorTree.getViewer().refresh();
} finally {
navigatorTree.getViewer().getControl().setRedraw(true);
}
}
ActionUtils.fireCommandRefresh(NavigatorCommands.CMD_FILTER_CONNECTIONS);
return null;
}
use of org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView in project dbeaver by serge-rider.
the class NavigatorHandlerConnectionFilter method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(element.getServiceLocator());
if (partSite != null && partSite.getPart() instanceof DatabaseNavigatorView) {
DatabaseNavigatorTree navigatorTree = ((DatabaseNavigatorView) partSite.getPart()).getNavigatorTree();
element.setIcon(DBeaverIcons.getImageDescriptor(navigatorTree.isFilterShowConnected() ? UIIcon.FILTER_RESET : UIIcon.FILTER_APPLY));
String actionName = navigatorTree.isFilterShowConnected() ? "Show all" : "Show connected only";
element.setText(actionName);
element.setTooltip(actionName);
}
}
use of org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView in project dbeaver by dbeaver.
the class NavigatorHandlerFilterObjectType method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof DatabaseNavigatorView) {
DatabaseNavigatorTree navigatorTree = ((DatabaseNavigatorView) activePart).getNavigatorTree();
DatabaseNavigatorTreeFilterObjectType objectType = CommonUtils.valueOf(DatabaseNavigatorTreeFilterObjectType.class, event.getParameter("type"), DatabaseNavigatorTreeFilterObjectType.table);
if (objectType == navigatorTree.getFilterObjectType()) {
return null;
}
navigatorTree.setFilterObjectType(objectType);
navigatorTree.getViewer().getControl().setRedraw(false);
try {
navigatorTree.getViewer().refresh();
} finally {
navigatorTree.getViewer().getControl().setRedraw(true);
}
}
ActionUtils.fireCommandRefresh(NavigatorCommands.CMD_FILTER_CONNECTIONS);
return null;
}
use of org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView in project dbeaver by dbeaver.
the class NavigatorHandlerFilterObjectType method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
DatabaseNavigatorTreeFilterObjectType objectType = CommonUtils.valueOf(DatabaseNavigatorTreeFilterObjectType.class, CommonUtils.toString(parameters.get("type")), DatabaseNavigatorTreeFilterObjectType.table);
DatabaseNavigatorTreeFilterObjectType curObjectType = DatabaseNavigatorTreeFilterObjectType.table;
IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(element.getServiceLocator());
if (partSite != null && partSite.getPart() instanceof DatabaseNavigatorView) {
curObjectType = ((DatabaseNavigatorView) partSite.getPart()).getNavigatorTree().getFilterObjectType();
}
String text, toolTip;
switch(objectType) {
case connection:
text = "Filter connections";
toolTip = "Filter connections by name";
break;
case container:
text = "Filter databases or schemas";
toolTip = "Filter containers (databases or schemas) by name";
break;
case table:
text = "Filter tables, procedures";
toolTip = "Filter objects (tables, procedures, users, etc) by name";
break;
default:
return;
}
element.setText(text);
element.setTooltip(toolTip);
element.setChecked(objectType == curObjectType);
}
use of org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView in project dbeaver by dbeaver.
the class NavigatorHandlerConnectionFilter method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof DatabaseNavigatorView) {
DatabaseNavigatorTree navigatorTree = ((DatabaseNavigatorView) activePart).getNavigatorTree();
navigatorTree.setFilterShowConnected(!navigatorTree.isFilterShowConnected());
navigatorTree.getViewer().getControl().setRedraw(false);
try {
navigatorTree.getViewer().refresh();
} finally {
navigatorTree.getViewer().getControl().setRedraw(true);
}
}
ActionUtils.fireCommandRefresh(NavigatorCommands.CMD_FILTER_CONNECTIONS);
return null;
}
Aggregations