use of org.jkiss.dbeaver.model.edit.DBEObjectEditor in project dbeaver by serge-rider.
the class NavigatorHandlerObjectOpen method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
if (!updateUI) {
return;
}
final ISelectionProvider selectionProvider = UIUtils.getSelectionProvider(element.getServiceLocator());
if (selectionProvider != null) {
ISelection selection = selectionProvider.getSelection();
DBNNode node = NavigatorUtils.getSelectedNode(selection);
if (node != null) {
String actionName = CoreMessages.actions_navigator_open;
if (node instanceof DBNDataSource) {
actionName = CoreMessages.actions_navigator_edit;
} else if (node instanceof DBNDatabaseNode) {
DBSObject object = ((DBNDatabaseNode) node).getObject();
if (object != null) {
DBEObjectEditor objectManager = EntityEditorsRegistry.getInstance().getObjectManager(object.getClass(), DBEObjectEditor.class);
actionName = objectManager == null || !objectManager.canEditObject(object) ? CoreMessages.actions_navigator_view : CoreMessages.actions_navigator_edit;
}
}
String label;
if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() > 1) {
label = actionName + CoreMessages.actions_navigator__objects;
} else {
//$NON-NLS-1$
label = actionName + " " + node.getNodeType();
}
element.setText(label);
}
}
}
Aggregations