use of org.eclipse.swt.events.FocusEvent 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.FocusEvent 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.FocusEvent in project mechanoid by robotoworks.
the class NewMechanoidNetServiceClientPage method onAfterAddNameField.
@Override
protected void onAfterAddNameField(Composite parent, Font font) {
mBaseUrlField = new TextField(parent, Messages.NewMechanoidNetServiceClientPage_Widget_Label_Url);
mBaseUrlField.getTextField().addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
}
@Override
public void focusGained(FocusEvent e) {
getFieldInfoLabel().setText(Messages.NewMechanoidNetServiceClientPage_Widget_Label_Message_Url);
}
});
}
use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class SetAutoAddVolumeDialog method init.
/**
* Initials some values
*
*/
private void init() {
int itemsSize = RATEMAX - RATEMIN + 1;
String[] itemsOfOutRate;
itemsOfOutRate = new String[itemsSize];
for (int i = 0; i < itemsSize; i++) {
itemsOfOutRate[i] = Integer.toString(RATEMIN + i);
}
// Sets the initial value
if (getAutoAddVolumeInfo.getData().equals(OnOffType.ON.getText())) {
dataUsingAutoVolButton.setSelection(true);
dataOutRateCombo.setEnabled(true);
dataVolumeText.setEnabled(true);
dataExtPageText.setEnabled(true);
} else {
dataUsingAutoVolButton.setSelection(false);
dataOutRateCombo.setEnabled(false);
dataVolumeText.setEnabled(false);
dataExtPageText.setEnabled(false);
}
if (getAutoAddVolumeInfo.getIndex().equals(OnOffType.ON.getText())) {
indexUsingAutoVolButton.setSelection(true);
indexOutRateCombo.setEnabled(true);
indexVolumeText.setEnabled(true);
indexExtPageText.setEnabled(true);
} else {
indexUsingAutoVolButton.setSelection(false);
indexOutRateCombo.setEnabled(false);
indexVolumeText.setEnabled(false);
indexExtPageText.setEnabled(false);
}
int dataWarnOutofSpace = (int) ((Double.parseDouble(getAutoAddVolumeInfo.getData_warn_outofspace()) * 100) + 0.5);
int indexWarnOutofSpace = (int) ((Double.parseDouble(getAutoAddVolumeInfo.getIndex_warn_outofspace()) * 100) + 0.5);
if (dataWarnOutofSpace < RATEMIN) {
dataWarnOutofSpace = DEFAULT_RATE;
} else if (dataWarnOutofSpace > RATEMAX) {
dataWarnOutofSpace = RATEMAX;
}
if (indexWarnOutofSpace < RATEMIN) {
indexWarnOutofSpace = DEFAULT_RATE;
} else if (dataWarnOutofSpace > RATEMAX) {
indexWarnOutofSpace = RATEMAX;
}
dataOutRateCombo.setItems(itemsOfOutRate);
dataOutRateCombo.setText(Integer.toString(dataWarnOutofSpace));
indexOutRateCombo.setItems(itemsOfOutRate);
indexOutRateCombo.setText(Integer.toString(indexWarnOutofSpace));
BigDecimal dataExtPage = new BigDecimal(getAutoAddVolumeInfo.getData_ext_page());
BigDecimal indexExtPage = new BigDecimal(getAutoAddVolumeInfo.getIndex_ext_page());
if (dataExtPage.compareTo(BigDecimal.ZERO) <= 0) {
initDataVol = new BigDecimal(INIT_VOLUME);
dataExtPage = initDataVol.multiply(MEGABYTES).divide(pageSize, 0, BigDecimal.ROUND_HALF_UP);
} else {
initDataVol = dataExtPage.multiply(pageSize).divide(MEGABYTES, 3, BigDecimal.ROUND_HALF_UP);
}
if (indexExtPage.compareTo(BigDecimal.ZERO) <= 0) {
initIndexVol = new BigDecimal(INIT_VOLUME);
indexExtPage = initIndexVol.multiply(MEGABYTES).divide(pageSize, 0, BigDecimal.ROUND_HALF_UP);
} else {
initIndexVol = indexExtPage.multiply(pageSize).divide(MEGABYTES, 3, BigDecimal.ROUND_HALF_UP);
}
initDataExt = dataExtPage.toString();
initIndexExt = indexExtPage.toString();
dataExtPageText.setText(initDataExt);
dataVolumeText.setText(initDataVol.setScale(3).toString());
indexExtPageText.setText(initIndexExt);
indexVolumeText.setText(initIndexVol.setScale(3).toString());
dataOutRateCombo.addVerifyListener(new NumberVerifyListener());
dataOutRateCombo.addModifyListener(new DataRateModifyListener());
dataVolumeModifyListener = new VolumeModifyListener();
dataPageModifyListener = new PageModifyListener();
dataVolumeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
dataVolumeText.addModifyListener(dataVolumeModifyListener);
}
public void focusLost(FocusEvent event) {
dataVolumeText.removeModifyListener(dataVolumeModifyListener);
}
});
dataExtPageText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
dataExtPageText.addModifyListener(dataPageModifyListener);
}
public void focusLost(FocusEvent event) {
dataExtPageText.removeModifyListener(dataPageModifyListener);
}
});
indexOutRateCombo.addVerifyListener(new NumberVerifyListener());
indexOutRateCombo.addModifyListener(new IndexRateModifyListener());
indexVolumeModifyListener = new VolumeModifyListener();
indexPageModifyListener = new PageModifyListener();
indexVolumeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
indexVolumeText.addModifyListener(indexVolumeModifyListener);
}
public void focusLost(FocusEvent event) {
indexVolumeText.removeModifyListener(indexVolumeModifyListener);
}
});
indexExtPageText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
indexExtPageText.addModifyListener(indexPageModifyListener);
}
public void focusLost(FocusEvent event) {
indexExtPageText.removeModifyListener(indexPageModifyListener);
}
});
dataUsingAutoVolButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (dataUsingAutoVolButton.getSelection()) {
dataOutRateCombo.setEnabled(true);
dataVolumeText.setEnabled(true);
dataExtPageText.setEnabled(true);
} else {
dataOutRateCombo.setEnabled(false);
dataOutRateCombo.setText(Integer.toString(DEFAULT_RATE));
dataVolumeText.setText(initDataVol.toString());
dataExtPageText.setText(initDataExt);
enableOk();
dataVolumeText.setEnabled(false);
dataExtPageText.setEnabled(false);
}
}
});
indexUsingAutoVolButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (indexUsingAutoVolButton.getSelection()) {
indexOutRateCombo.setEnabled(true);
indexVolumeText.setEnabled(true);
indexExtPageText.setEnabled(true);
} else {
indexOutRateCombo.setEnabled(false);
indexOutRateCombo.setText(Integer.toString(DEFAULT_RATE));
indexVolumeText.setText(initIndexVol.toString());
indexExtPageText.setText(initIndexExt);
enableOk();
indexVolumeText.setEnabled(false);
indexExtPageText.setEnabled(false);
}
}
});
}
use of org.eclipse.swt.events.FocusEvent 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);
}
Aggregations