use of org.jkiss.dbeaver.ext.mysql.ui.config.MySQLCommandGrantPrivilege in project dbeaver by serge-rider.
the class MySQLUserEditorGeneral method createPartControl.
@Override
public void createPartControl(Composite parent) {
pageControl = new PageControl(parent);
Composite container = UIUtils.createPlaceholder(pageControl, 2, 5);
GridData gd = new GridData(GridData.FILL_VERTICAL);
container.setLayoutData(gd);
newUser = !getDatabaseObject().isPersisted();
{
Composite loginGroup = UIUtils.createControlGroup(container, MySQLUIMessages.editors_user_editor_general_group_login, 2, GridData.HORIZONTAL_ALIGN_BEGINNING, 200);
userNameText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_user_name, getDatabaseObject().getUserName());
userNameText.setEditable(newUser);
if (newUser) {
ControlPropertyCommandListener.create(this, userNameText, UserPropertyHandler.NAME);
}
hostText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_host, getDatabaseObject().getHost());
hostText.setEditable(newUser);
if (newUser) {
ControlPropertyCommandListener.create(this, hostText, UserPropertyHandler.HOST);
}
// $NON-NLS-1$
String password = newUser ? "" : DEF_PASSWORD_VALUE;
Text passwordText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_password, password, SWT.BORDER | SWT.PASSWORD);
ControlPropertyCommandListener.create(this, passwordText, UserPropertyHandler.PASSWORD);
Text confirmText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_confirm, password, SWT.BORDER | SWT.PASSWORD);
ControlPropertyCommandListener.create(this, confirmText, UserPropertyHandler.PASSWORD_CONFIRM);
}
{
Composite limitsGroup = UIUtils.createControlGroup(container, MySQLUIMessages.editors_user_editor_general_group_limits, 2, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
Spinner maxQueriesText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_queries, getDatabaseObject().getMaxQuestions(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxQueriesText, UserPropertyHandler.MAX_QUERIES);
Spinner maxUpdatesText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_updates, getDatabaseObject().getMaxUpdates(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxUpdatesText, UserPropertyHandler.MAX_UPDATES);
Spinner maxConnectionsText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_connections, getDatabaseObject().getMaxConnections(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxConnectionsText, UserPropertyHandler.MAX_CONNECTIONS);
Spinner maxUserConnectionsText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_user_connections, getDatabaseObject().getMaxUserConnections(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxUserConnectionsText, UserPropertyHandler.MAX_USER_CONNECTIONS);
}
{
privTable = new PrivilegeTableControl(container, MySQLUIMessages.editors_user_editor_general_control_dba_privileges, true);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
privTable.setLayoutData(gd);
privTable.addListener(SWT.Modify, event -> {
final MySQLPrivilege privilege = (MySQLPrivilege) event.data;
final boolean grant = event.detail == 1;
addChangeCommand(new MySQLCommandGrantPrivilege(getDatabaseObject(), grant, null, null, privilege), new DBECommandReflector<MySQLUser, MySQLCommandGrantPrivilege>() {
@Override
public void redoCommand(MySQLCommandGrantPrivilege mySQLCommandGrantPrivilege) {
if (!privTable.isDisposed()) {
privTable.checkPrivilege(privilege, grant);
}
}
@Override
public void undoCommand(MySQLCommandGrantPrivilege mySQLCommandGrantPrivilege) {
if (!privTable.isDisposed()) {
privTable.checkPrivilege(privilege, !grant);
}
}
});
});
}
pageControl.createProgressPanel();
commandlistener = new CommandListener();
getEditorInput().getCommandContext().addCommandListener(commandlistener);
}
use of org.jkiss.dbeaver.ext.mysql.ui.config.MySQLCommandGrantPrivilege in project dbeaver by dbeaver.
the class MySQLUserEditorGeneral method createPartControl.
@Override
public void createPartControl(Composite parent) {
pageControl = new PageControl(parent);
Composite container = UIUtils.createPlaceholder(pageControl, 2, 5);
GridData gd = new GridData(GridData.FILL_VERTICAL);
container.setLayoutData(gd);
newUser = !getDatabaseObject().isPersisted();
{
Composite loginGroup = UIUtils.createControlGroup(container, MySQLUIMessages.editors_user_editor_general_group_login, 2, GridData.HORIZONTAL_ALIGN_BEGINNING, 200);
userNameText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_user_name, getDatabaseObject().getUserName());
userNameText.setEditable(newUser);
if (newUser) {
ControlPropertyCommandListener.create(this, userNameText, UserPropertyHandler.NAME);
}
hostText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_host, getDatabaseObject().getHost());
hostText.setEditable(newUser);
if (newUser) {
ControlPropertyCommandListener.create(this, hostText, UserPropertyHandler.HOST);
}
// $NON-NLS-1$
String password = newUser ? "" : DEF_PASSWORD_VALUE;
Text passwordText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_password, password, SWT.BORDER | SWT.PASSWORD);
ControlPropertyCommandListener.create(this, passwordText, UserPropertyHandler.PASSWORD);
Text confirmText = UIUtils.createLabelText(loginGroup, MySQLUIMessages.editors_user_editor_general_label_confirm, password, SWT.BORDER | SWT.PASSWORD);
ControlPropertyCommandListener.create(this, confirmText, UserPropertyHandler.PASSWORD_CONFIRM);
}
{
Composite limitsGroup = UIUtils.createControlGroup(container, MySQLUIMessages.editors_user_editor_general_group_limits, 2, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
Spinner maxQueriesText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_queries, getDatabaseObject().getMaxQuestions(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxQueriesText, UserPropertyHandler.MAX_QUERIES);
Spinner maxUpdatesText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_updates, getDatabaseObject().getMaxUpdates(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxUpdatesText, UserPropertyHandler.MAX_UPDATES);
Spinner maxConnectionsText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_connections, getDatabaseObject().getMaxConnections(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxConnectionsText, UserPropertyHandler.MAX_CONNECTIONS);
Spinner maxUserConnectionsText = UIUtils.createLabelSpinner(limitsGroup, MySQLUIMessages.editors_user_editor_general_spinner_max_user_connections, getDatabaseObject().getMaxUserConnections(), 0, Integer.MAX_VALUE);
ControlPropertyCommandListener.create(this, maxUserConnectionsText, UserPropertyHandler.MAX_USER_CONNECTIONS);
}
{
privTable = new PrivilegeTableControl(container, MySQLUIMessages.editors_user_editor_general_control_dba_privileges, true);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
privTable.setLayoutData(gd);
privTable.addListener(SWT.Modify, event -> {
final MySQLPrivilege privilege = (MySQLPrivilege) event.data;
final boolean grant = event.detail == 1;
addChangeCommand(new MySQLCommandGrantPrivilege(getDatabaseObject(), grant, null, null, privilege), new DBECommandReflector<MySQLUser, MySQLCommandGrantPrivilege>() {
@Override
public void redoCommand(MySQLCommandGrantPrivilege mySQLCommandGrantPrivilege) {
if (!privTable.isDisposed()) {
privTable.checkPrivilege(privilege, grant);
}
}
@Override
public void undoCommand(MySQLCommandGrantPrivilege mySQLCommandGrantPrivilege) {
if (!privTable.isDisposed()) {
privTable.checkPrivilege(privilege, !grant);
}
}
});
});
}
pageControl.createProgressPanel();
commandlistener = new CommandListener();
getEditorInput().getCommandContext().addCommandListener(commandlistener);
}
Aggregations