use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class DBAuthComparator method registerContextMenu.
/**
* register context menu
*/
private void registerContextMenu() {
userTableViewer.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(userTableViewer.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(userTableViewer.getTable());
userTableViewer.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem editSerialItem = new MenuItem(menu, SWT.PUSH);
editSerialItem.setText(Messages.itemEditUser);
editSerialItem.setImage(CommonUIPlugin.getImage("icons/action/user_edit.png"));
editSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editUser();
}
});
final MenuItem dropSerialItem = new MenuItem(menu, SWT.PUSH);
dropSerialItem.setText(Messages.itemDropUser);
dropSerialItem.setImage(CommonUIPlugin.getImage("icons/action/user_delete.png"));
dropSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
dropUser();
}
});
new MenuItem(menu, SWT.SEPARATOR);
final MenuItem addSerialItem = new MenuItem(menu, SWT.PUSH);
addSerialItem.setText(Messages.itemAddUser);
addSerialItem.setImage(CommonUIPlugin.getImage("icons/action/user_add.png"));
addSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addUser();
}
});
userTableViewer.getTable().setMenu(menu);
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class EditVirtualTableDialog method createTableInformationGroup.
private void createTableInformationGroup(Composite compositeGenaral) {
final Group group = new Group(compositeGenaral, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
group.setLayout(gridLayout);
group.setText(Messages.lblTableInfo);
final Label tableNameLabel = new Label(group, SWT.NONE);
tableNameLabel.setData(Messages.dataNewKey, null);
tableNameLabel.setText(Messages.lblTableName);
final SchemaInfo newSchemaInfo = getNewSchemaInfo();
tableNameComp = new Composite(group, SWT.NONE);
{
GridLayout gl = new GridLayout();
gl.numColumns = 2;
gl.marginWidth = 0;
tableNameComp.setLayout(gl);
tableNameComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tableNameText = new Text(tableNameComp, SWT.BORDER);
{
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
tableNameText.setLayoutData(gd);
}
tableNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
if (tableNameText.getText().length() == 0) {
CommonUITool.hideErrorBaloon(errorBaloon);
} else if (verifyTableName()) {
String tableName = tableNameText.getText();
newSchemaInfo.setClassname(tableName);
}
}
});
tableNameText.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
CommonUITool.hideErrorBaloon(errorBaloon);
}
});
}
//char set
if (supportCharset) {
Composite collationComposite = new Composite(tableNameComp, SWT.NONE);
collationComposite.setLayout(new GridLayout(2, false));
final Label collationLabel = new Label(collationComposite, SWT.NONE);
collationLabel.setText(Messages.lblCollation);
collationCombo = new Combo(collationComposite, SWT.READ_ONLY);
collationCombo.setLayout(new FillLayout());
collationCombo.setVisibleItemCount(10);
fillCollationCombo();
String collation = collationCombo.getText();
newSchemaInfo.setCollation(collation);
collationCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
String collation = collationCombo.getText();
newSchemaInfo.setCollation(collation);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
if (!isNewTableFlag && newSchemaInfo.getCollation() != null) {
collationCombo.setText(newSchemaInfo.getCollation());
}
} else {
new Label(tableNameComp, SWT.NONE);
}
if (erSchema.isPhysicModel()) {
//desc info
final Label tableDescLabel = new Label(group, SWT.NONE);
tableDescLabel.setText(Messages.lblTableDesc);
tableDescText = new Text(group, SWT.BORDER);
tableDescText.setTextLimit(612);
tableDescText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// tableDescText.setLayoutData(new FillLayout());
if (newSchemaInfo != null && newSchemaInfo.getDescription() != null) {
tableDescText.setText(newSchemaInfo.getDescription());
}
tableDescText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
CommonUITool.hideErrorBaloon(errorBaloon);
}
});
tableDescText.setEditable(true);
}
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method registerContextMenu.
private void registerContextMenu() {
viewsDetailInfoTable.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(viewsDetailInfoTable.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(viewsDetailInfoTable.getTable());
viewsDetailInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem editViewItem = new MenuItem(menu, SWT.PUSH);
editViewItem.setText(Messages.viewDetailInfoPartTableEditViewBtn);
editViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_edit.png"));
editViewItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editView();
}
});
final MenuItem dropViewItem = new MenuItem(menu, SWT.PUSH);
dropViewItem.setText(Messages.viewDetailInfoPartTableDropViewBtn);
dropViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_delete.png"));
dropViewItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
dropView();
}
});
new MenuItem(menu, SWT.SEPARATOR);
final MenuItem addViewItem = new MenuItem(menu, SWT.PUSH);
addViewItem.setText(Messages.viewDetailInfoPartTableCreateViewBtn);
addViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_add.png"));
addViewItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addView();
}
});
viewsDetailInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class ConnectionComposite method createBrokerInfoGroup.
private void createBrokerInfoGroup(Composite composite) {
Group brokerInfoGroup = new Group(composite, SWT.NONE);
brokerInfoGroup.setText(Messages.grpBrokerInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
brokerInfoGroup.setLayoutData(gridData);
brokerInfoGroup.setLayout(createGridLayout(3));
Label brokerIpLabel = new Label(brokerInfoGroup, SWT.LEFT);
brokerIpLabel.setText(Messages.lblLoginServerName);
brokerIpLabel.setLayoutData(createGridData(1, 1, -1, -1));
brokerIpText = new Text(brokerInfoGroup, SWT.LEFT | SWT.BORDER);
brokerIpText.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 2, 1, 100, -1));
brokerIpText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
brokerIpText.selectAll();
}
});
Label brokerPortLabel = new Label(brokerInfoGroup, SWT.LEFT);
brokerPortLabel.setText(Messages.lblLoginBrokerPort);
brokerPortLabel.setLayoutData(createGridData(1, 1, -1, -1));
VerifyListener verifyListener = new VerifyListener() {
public void verifyText(VerifyEvent event) {
Pattern pattern = Pattern.compile("[0-9]*");
Matcher matcher = pattern.matcher(event.text);
if (matcher.matches()) {
event.doit = true;
} else if (event.text.length() > 0) {
event.doit = false;
} else {
event.doit = true;
}
}
};
Composite portAndShardComp = new Composite(brokerInfoGroup, SWT.NONE);
portAndShardComp.setLayout(createGridLayout(3, 0, 0));
portAndShardComp.setLayoutData(createGridData(FILL_HORIZONTAL, 2, 1, -1, -1));
if (isMultiBroker) {
brokerPortCombo = new Combo(portAndShardComp, SWT.LEFT | SWT.BORDER);
brokerPortCombo.setLayoutData(createGridData(GridData.BEGINNING, 1, 1, 100, -1));
brokerPortCombo.addVerifyListener(verifyListener);
} else {
brokerPortText = new Text(portAndShardComp, SWT.LEFT | SWT.BORDER);
brokerPortText.setLayoutData(createGridData(BEGINNING, 1, 1, 100, -1));
brokerPortText.addVerifyListener(verifyListener);
}
btnShard = new Button(portAndShardComp, SWT.CHECK);
btnShard.setLayoutData(createGridData(BEGINNING, 1, 1, -1, -1));
btnShard.setText(com.cubrid.common.ui.query.Messages.shardBrokerLabel);
btnShard.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (btnShard.getSelection()) {
openWarningBox(shardBrokerAlert);
}
btnShardId.setEnabled(btnShard.getSelection());
}
});
btnShardId = new Button(portAndShardComp, SWT.PUSH);
btnShardId.setLayoutData(createGridData(HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
btnShardId.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ShardIdSelectionDialog dialog = new ShardIdSelectionDialog(getShell());
dialog.setDatabaseInfo(dbInfo);
dialog.setShardId(curShardId);
dialog.setShardVal(curShardVal);
dialog.setShardQueryType(shardQueryType);
if (dialog.open() == OK_ID) {
curShardId = dialog.getShardId();
curShardVal = dialog.getShardVal();
shardQueryType = dialog.getShardQueryType();
if (dbInfo != null) {
dbInfo.setCurrentShardId(curShardId);
dbInfo.setCurrentShardVal(curShardVal);
dbInfo.setShardQueryType(shardQueryType);
}
updateShardIdButtonText();
}
}
});
updateShardIdButtonText();
Label charsetLabel = new Label(brokerInfoGroup, SWT.LEFT);
charsetLabel.setText(com.cubrid.common.ui.query.Messages.lblCharSet);
charsetLabel.setLayoutData(createGridData(1, 1, -1, -1));
charsetCombo = new Combo(brokerInfoGroup, SWT.LEFT | SWT.BORDER);
charsetCombo.setLayoutData(createGridData(FILL_HORIZONTAL, 2, 1, 100, -1));
Label jdbcLabel = new Label(brokerInfoGroup, SWT.LEFT);
jdbcLabel.setText(Messages.lblDbJdbcVersion);
jdbcLabel.setLayoutData(createGridData(1, 1, -1, -1));
jdbcCombo = new Combo(brokerInfoGroup, SWT.LEFT | SWT.READ_ONLY | SWT.BORDER);
jdbcCombo.setLayoutData(createGridData(FILL_HORIZONTAL, 1, 1, 100, -1));
Button btnOpen = new Button(brokerInfoGroup, SWT.NONE);
btnOpen.setText(Messages.btnBrowse);
btnOpen.setLayoutData(createGridData(1, 1, 80, -1));
btnOpen.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
JdbcManageDialog dialog = new JdbcManageDialog(getShell());
if (dialog.open() == OK_ID) {
String jdbcVersion = dialog.getSelectedJdbcVersion();
if (isBlank(jdbcVersion)) {
jdbcVersion = jdbcCombo.getText();
}
resetJdbcCombo(jdbcVersion);
}
}
});
// JDBC attributes
Label attrLabel = new Label(brokerInfoGroup, SWT.LEFT);
attrLabel.setText(Messages.lblJdbcAttr);
attrLabel.setLayoutData(createGridData(1, 1, -1, -1));
attrText = new Text(brokerInfoGroup, SWT.LEFT | SWT.BORDER);
attrText.setEditable(false);
attrText.setLayoutData(createGridData(FILL_HORIZONTAL, 1, 1, 100, -1));
Button btnAttr = new Button(brokerInfoGroup, SWT.NONE);
btnAttr.setText(Messages.btnJdbcAttr);
btnAttr.setLayoutData(createGridData(1, 1, 80, -1));
btnAttr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
JdbcOptionDialog dialog = new JdbcOptionDialog(getShell(), attrText.getText());
if (dialog.open() == OK_ID) {
attrText.setText(dialog.getJdbcOptions());
}
}
});
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class RunSQLFileDialog method registerContextMenu.
/**
* register context menu
*/
private void registerContextMenu() {
sqlFileTableViewer.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(sqlFileTableViewer.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(sqlFileTableViewer.getTable());
sqlFileTableViewer.getTable().setMenu(contextMenu);
Menu menu = new Menu(getShell(), SWT.POP_UP);
final MenuItem itemDelete = new MenuItem(menu, SWT.PUSH);
itemDelete.setText("delete");
itemDelete.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
List<String> deleteFiles = new ArrayList<String>();
for (int i = 0; i < sqlFileTableViewer.getTable().getSelectionIndices().length; i++) {
int index = sqlFileTableViewer.getTable().getSelectionIndices()[i];
deleteFiles.add(filesList.get(index));
}
filesList.removeAll(deleteFiles);
sqlFileTableViewer.setInput(filesList);
sqlFileTableViewer.refresh();
}
});
sqlFileTableViewer.getTable().setMenu(menu);
Menu dbTablecontextMenu = menuManager.createContextMenu(databaseTableViewer.getTable());
databaseTableViewer.getTable().setMenu(dbTablecontextMenu);
Menu dbTableMenu = new Menu(getShell(), SWT.POP_UP);
final MenuItem dbTableItemDelete = new MenuItem(dbTableMenu, SWT.PUSH);
dbTableItemDelete.setText("delete");
dbTableItemDelete.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
List<CubridDatabase> deleteCubridDatabase = new ArrayList<CubridDatabase>();
for (int i = 0; i < databaseTableViewer.getTable().getSelectionIndices().length; i++) {
int index = databaseTableViewer.getTable().getSelectionIndices()[i];
deleteCubridDatabase.add(cubridDatabases[index]);
}
List<CubridDatabase> dbList = Arrays.asList(cubridDatabases);
ArrayList<CubridDatabase> newDbList = new ArrayList<CubridDatabase>();
for (CubridDatabase cubridDatabase : dbList) {
if (deleteCubridDatabase.contains(cubridDatabase)) {
continue;
}
newDbList.add(cubridDatabase);
}
cubridDatabases = newDbList.toArray(new CubridDatabase[newDbList.size()]);
databaseTableViewer.setInput(cubridDatabases);
databaseTableViewer.refresh();
}
});
sqlFileTableViewer.getTable().setMenu(menu);
databaseTableViewer.getTable().setMenu(dbTableMenu);
runSQLFileDialogDNDController = new RunSQLFileDialogDNDController(this);
runSQLFileDialogDNDController.registerDropTarget();
}
Aggregations