Search in sources :

Example 51 with FocusAdapter

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);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MenuManager(org.eclipse.jface.action.MenuManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 52 with FocusAdapter

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);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 53 with FocusAdapter

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);
            }
        }
    });
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) IAction(org.eclipse.jface.action.IAction) CopyAction(com.cubrid.common.ui.query.action.CopyAction) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) FocusEvent(org.eclipse.swt.events.FocusEvent) IMenuListener(org.eclipse.jface.action.IMenuListener) PasteAction(com.cubrid.common.ui.query.action.PasteAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) InputMethodAction(com.cubrid.common.ui.query.action.InputMethodAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu)

Example 54 with FocusAdapter

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);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) ToolItem(org.eclipse.swt.widgets.ToolItem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 55 with FocusAdapter

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

FocusAdapter (org.eclipse.swt.events.FocusAdapter)68 FocusEvent (org.eclipse.swt.events.FocusEvent)64 SelectionEvent (org.eclipse.swt.events.SelectionEvent)42 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 Composite (org.eclipse.swt.widgets.Composite)29 GridData (org.eclipse.swt.layout.GridData)28 Text (org.eclipse.swt.widgets.Text)26 GridLayout (org.eclipse.swt.layout.GridLayout)25 Label (org.eclipse.swt.widgets.Label)20 Button (org.eclipse.swt.widgets.Button)17 Menu (org.eclipse.swt.widgets.Menu)17 Point (org.eclipse.swt.graphics.Point)16 MenuManager (org.eclipse.jface.action.MenuManager)15 MenuItem (org.eclipse.swt.widgets.MenuItem)15 ModifyEvent (org.eclipse.swt.events.ModifyEvent)14 ModifyListener (org.eclipse.swt.events.ModifyListener)14 KeyEvent (org.eclipse.swt.events.KeyEvent)12 Combo (org.eclipse.swt.widgets.Combo)12 KeyAdapter (org.eclipse.swt.events.KeyAdapter)11 Group (org.eclipse.swt.widgets.Group)11