use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class TriggerDashboardEditorPart method registerContextMenu.
/**
* register context menu
*/
private void registerContextMenu() {
triggersDetailInfoTable.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(triggersDetailInfoTable.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(triggersDetailInfoTable.getTable());
triggersDetailInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem addSerialItem = new MenuItem(menu, SWT.PUSH);
addSerialItem.setText(Messages.triggersDetailInfoPartCreateTriggerBtn);
addSerialItem.setImage(CommonUIPlugin.getImage("icons/action/trigger_add.png"));
addSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addTrigger();
}
});
final MenuItem editSerialItem = new MenuItem(menu, SWT.PUSH);
editSerialItem.setText(Messages.triggersDetailInfoPartEditTriggerBtn);
editSerialItem.setImage(CommonUIPlugin.getImage("icons/action/trigger_edit.png"));
editSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editTrigger();
}
});
final MenuItem dropSerialItem = new MenuItem(menu, SWT.PUSH);
dropSerialItem.setText(Messages.triggersDetailInfoPartDropTriggerBtn);
dropSerialItem.setImage(CommonUIPlugin.getImage("icons/action/trigger_delete.png"));
dropSerialItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
dropTrigger();
}
});
triggersDetailInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.swt.events.FocusAdapter in project azure-tools-for-java by Microsoft.
the class SettingsStep method createControl.
@Override
public void createControl(Composite parent) {
GridLayout gridLayout = new GridLayout(1, false);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
Composite container = new Composite(parent, 0);
container.setLayout(gridLayout);
container.setLayoutData(gridData);
createSettingsPanel(container);
//
// imageDescription = wizard.createImageDescriptor(container);
resourceGrpField.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
wizard.setResourceGroupName(resourceGrpField.getText());
}
});
resourceGrpCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
wizard.setResourceGroupName(resourceGrpCombo.getText());
}
});
storageComboBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
validateNext();
}
});
subnetComboBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
wizard.setSubnet((String) subnetComboBox.getText());
validateNext();
}
});
this.setControl(container);
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class QueryExecuter method registerInputMethodContextMenu.
/**
*
* Register input method context menu for styled text
*
* @param text StyledText
* @param isEditable boolean
*/
public void registerInputMethodContextMenu(final StyledText text, final boolean isEditable, final String type, final TableItem item, final int column) {
text.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(text);
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
IAction copyAction = ActionManager.getInstance().getAction(CopyAction.ID);
if (copyAction instanceof CopyAction) {
manager.add(copyAction);
if (!copyAction.isEnabled()) {
FocusAction.changeActionStatus(copyAction, text);
}
}
if (!isEditable) {
return;
}
IAction pasteAction = ActionManager.getInstance().getAction(PasteAction.ID);
if (pasteAction instanceof PasteAction) {
manager.add(pasteAction);
if (!pasteAction.isEnabled()) {
FocusAction.changeActionStatus(pasteAction, text);
}
}
IAction inputAction = ActionManager.getInstance().getAction(InputMethodAction.ID);
if (inputAction instanceof InputMethodAction) {
manager.add(inputAction);
if (!inputAction.isEnabled()) {
FocusAction.changeActionStatus(inputAction, text);
} else {
((InputMethodAction) inputAction).setType(type);
((InputMethodAction) inputAction).setTableItem(item);
((InputMethodAction) inputAction).setColumn(column);
((InputMethodAction) inputAction).setQueryExecuter(executer);
}
if (isEditMode()) {
inputAction.setEnabled(true);
} else {
inputAction.setEnabled(false);
}
}
}
});
Menu contextMenu = menuManager.createContextMenu(text);
text.setMenu(contextMenu);
text.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IAction copyAction = ActionManager.getInstance().getAction(CopyAction.ID);
if (!copyAction.isEnabled()) {
FocusAction.changeActionStatus(copyAction, text);
}
IAction pasteAction = ActionManager.getInstance().getAction(PasteAction.ID);
if (pasteAction != null && !pasteAction.isEnabled()) {
FocusAction.changeActionStatus(pasteAction, text);
}
IAction inputAction = ActionManager.getInstance().getAction(InputMethodAction.ID);
if (inputAction != null) {
FocusAction.changeActionStatus(inputAction, text);
}
}
});
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createBackupPlanInfoTable.
public void createBackupPlanInfoTable(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
refreshBackupPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addBackupPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editBackupPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteBackupPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openBackupPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
backupPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
backupPlanInfoTable.getTable().setHeaderVisible(true);
backupPlanInfoTable.getTable().setLinesVisible(true);
backupPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editBackupPlan();
}
});
final TableViewerColumn idColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
idColumn.getColumn().setWidth(80);
idColumn.getColumn().setText(Messages.backupPlanInfoTableIDColumn);
final TableViewerColumn levelColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
levelColumn.getColumn().setWidth(80);
levelColumn.getColumn().setText(Messages.backupPlanInfoTableLevelColumn);
final TableViewerColumn pathColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
pathColumn.getColumn().setWidth(200);
pathColumn.getColumn().setText(Messages.backupPlanInfoTablePathColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTypeColumn);
final TableViewerColumn backupDetailColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupDetailColumn.getColumn().setWidth(150);
backupDetailColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodDetailColumn);
final TableViewerColumn backupTimeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupTimeColumn.getColumn().setWidth(90);
backupTimeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn backupIntervalColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupIntervalColumn.getColumn().setWidth(100);
backupIntervalColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn onOffLineColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
onOffLineColumn.getColumn().setWidth(100);
onOffLineColumn.getColumn().setText(Messages.backupPlanInfoTableOnlineOfflineColumn);
backupPlanInfoTable.setContentProvider(new BackupPlanTableViewerContentProvider());
backupPlanInfoTable.setLabelProvider(new BackupPlanTableViewerLabelProvider());
backupPlanInfoTable.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(backupPlanInfoTable.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(backupPlanInfoTable.getTable());
backupPlanInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addBackupPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editBackupPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteBackupPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openBackupPlanLog();
}
});
backupPlanInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.
the class SetHostInfoDialog method createDialogArea.
/**
* Create dialog area
*
* @param parent the parent composite
* @return the composite
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
Group cmServerInfoGroup = new Group(composite, SWT.NONE);
cmServerInfoGroup.setText(Messages.grpHostInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
cmServerInfoGroup.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
cmServerInfoGroup.setLayout(layout);
Label ipLabel = new Label(cmServerInfoGroup, SWT.LEFT);
ipLabel.setText(Messages.lblIpAddress);
ipLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ipText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
ipText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label portNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
portNameLabel.setText(Messages.lblPort);
portNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
portText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
portText.setText("8001");
portText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
portText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
portText.selectAll();
portText.setFocus();
}
});
Label userNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
userNameLabel.setText(Messages.lblUserName);
userNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
userNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
userNameText.setText("admin");
userNameText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
userNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label passwordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
passwordLabel.setText(Messages.lblPassword);
passwordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
passwordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.PASSWORD | SWT.BORDER);
passwordText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
passwordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
initialize();
setTitle(Messages.titleSetHostInfoDialog);
setMessage(Messages.msgSetHostInfoDialog);
return parentComp;
}
Aggregations