Search in sources :

Example 71 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.

the class TableDashboardComposite method registerContextMenu.

/**
	 * register context menu
	 */
private void registerContextMenu() {
    columnTableView.getTable().addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            ActionManager.getInstance().changeFocusProvider(columnTableView.getTable());
        }
    });
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    Menu contextMenu = menuManager.createContextMenu(columnTableView.getTable());
    columnTableView.getTable().setMenu(contextMenu);
    Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
    final MenuItem itemShowMuchValue = new MenuItem(menu, SWT.PUSH);
    itemShowMuchValue.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartMenuCopy);
    itemShowMuchValue.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            copyTablesDetailToClipboard();
        }
    });
    columnTableView.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 72 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.

the class FocusAction method setFocusProvider.

/**
	 * 
	 * Set focus provider
	 * 
	 * @param focusProvider the focus provider
	 */
public final void setFocusProvider(Control focusProvider) {
    if (focusProvider != null && !focusProvider.isDisposed()) {
        if (control != null && !control.isDisposed()) {
            control.removeFocusListener(this);
        }
        control = focusProvider;
        control.addFocusListener(this);
        if (control.isFocusControl()) {
            Event event = new Event();
            event.widget = control;
            focusGained(new FocusEvent(event));
        }
    }
}
Also used : FocusEvent(org.eclipse.swt.events.FocusEvent) Event(org.eclipse.swt.widgets.Event) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 73 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.

the class FocusAction method changeActionStatus.

/**
	 * 
	 * Change the focus provider and change action status
	 * 
	 * @param action FocusAction
	 * @param focusProvider Control
	 */
public static void changeActionStatus(IAction action, Control focusProvider) {
    if (action instanceof IFocusAction) {
        IFocusAction focusAction = (IFocusAction) action;
        focusAction.setFocusProvider(focusProvider);
        if (!focusProvider.isFocusControl()) {
            Event event = new Event();
            event.widget = focusProvider;
            focusAction.focusGained(new FocusEvent(event));
        }
    }
}
Also used : FocusEvent(org.eclipse.swt.events.FocusEvent) Event(org.eclipse.swt.widgets.Event) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 74 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.

the class QueryRecordListComparator method displayQuery.

/**
	 * Display the query data
	 *
	 * @param queryRecord
	 */
private void displayQuery(final QueryRecord queryRecord) {
    if (queryResultComposite != null && !queryResultComposite.isDisposed()) {
        queryResultComposite.dispose();
    }
    queryResultComposite = new Composite(queryResultContainer, SWT.None);
    queryResultComposite.setLayout(new FillLayout());
    ViewForm viewForm = new ViewForm(queryResultComposite, SWT.NONE);
    viewForm.setLayout(new FillLayout());
    final SashForm tableLogSash = new SashForm(viewForm, SWT.VERTICAL);
    tableLogSash.SASH_WIDTH = SASH_WIDTH;
    tableLogSash.setBackground(BACK_COLOR);
    /*Create table view*/
    final TableViewer resultTableViewer = new TableViewer(tableLogSash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
    TableCursor cursor = new TableCursor(resultTableViewer.getTable(), SWT.NONE);
    TableSelectSupport tableSelectSupport = new TableSelectSupport(resultTableViewer.getTable(), cursor);
    String fontString = QueryOptions.getFontString(database.getDatabaseInfo().getServerInfo());
    Font tmpFont = ResourceManager.getFont(fontString);
    if (tmpFont == null) {
        String[] fontData = QueryOptions.getDefaultFont();
        tmpFont = ResourceManager.getFont(fontData[0], Integer.valueOf(fontData[1]), Integer.valueOf(fontData[2]));
    }
    Font font = tmpFont;
    resultTableViewer.getTable().setFont(font);
    int[] fontColor = QueryOptions.getFontColor(database.getDatabaseInfo().getServerInfo());
    Color color = ResourceManager.getColor(fontColor[0], fontColor[1], fontColor[2]);
    resultTableViewer.getTable().setForeground(color);
    /*Set font and foreground*/
    tableSelectSupport.getTableCursor().setFont(font);
    tableSelectSupport.getTableCursor().setForeground(color);
    final SashForm logSash = new SashForm(tableLogSash, SWT.HORIZONTAL);
    logSash.SASH_WIDTH = SASH_WIDTH;
    logSash.setBackground(BACK_COLOR);
    logSash.setLayout(new FillLayout());
    StyledText messagesArea = new StyledText(logSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY | SWT.WRAP);
    messagesArea.setToolTipText(Messages.tooltipHowToExpandLogPane);
    messagesArea.addFocusListener(new FocusListener() {

        public void focusLost(FocusEvent e) {
            tableLogSash.setWeights(new int[] { 8, 2 });
        }

        public void focusGained(FocusEvent e) {
            tableLogSash.setWeights(new int[] { 2, 8 });
        }
    });
    tableLogSash.setWeights(new int[] { 8, 2 });
    viewForm.setContent(tableLogSash);
    resultTableViewer.getTable().setHeaderVisible(true);
    resultTableViewer.getTable().setLinesVisible(true);
    if (queryRecord != null) {
        QueryResultLabelProvider labelProvider = new QueryResultLabelProvider(queryRecord);
        QueryResultContentProvider contentProvider = new QueryResultContentProvider();
        resultTableViewer.setLabelProvider(labelProvider);
        resultTableViewer.setContentProvider(contentProvider);
        createResultColumn(resultTableViewer, queryRecord);
        resultTableViewer.setInput(queryRecord.getPageData());
        setQueryMessage(messagesArea, queryRecord);
    }
    CommonUITool.packTable(resultTableViewer.getTable(), 10, 150);
    queryResultContainer.layout();
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) QueryPlanComposite(com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite) TableCursor(org.eclipse.swt.custom.TableCursor) Color(org.eclipse.swt.graphics.Color) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) Font(org.eclipse.swt.graphics.Font) SashForm(org.eclipse.swt.custom.SashForm) TableSelectSupport(com.cubrid.common.ui.spi.table.TableSelectSupport) ViewForm(org.eclipse.swt.custom.ViewForm) TableViewer(org.eclipse.jface.viewers.TableViewer) FocusListener(org.eclipse.swt.events.FocusListener)

Example 75 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.

the class TableConfigCellEditor method registerContextMenu.

/**
	 * register context menu
	 */
private void registerContextMenu() {
    sqlFileTableViewer.getTable().addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            ActionManager.getInstance().changeFocusProvider(sqlFileTableViewer.getTable());
        }
    });
    Menu menu = new Menu(getShell(), SWT.POP_UP);
    final MenuItem addSchemaItem = new MenuItem(menu, SWT.PUSH);
    addSchemaItem.setText(Messages.btnAddSchemaFile);
    addSchemaItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addFile(TableConfig.TYPE_SCHEMA);
        }
    });
    final MenuItem addDataItem = new MenuItem(menu, SWT.PUSH);
    addDataItem.setText(Messages.btnAddDataFile);
    addDataItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addFile(TableConfig.TYPE_DATA);
        }
    });
    final MenuItem addIndexItem = new MenuItem(menu, SWT.PUSH);
    addIndexItem.setText(Messages.btnAddIndexFile);
    addIndexItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addFile(TableConfig.TYPE_INDEX);
        }
    });
    new MenuItem(menu, SWT.SEPARATOR);
    final MenuItem delItem = new MenuItem(menu, SWT.PUSH);
    delItem.setText(Messages.btnDelFiles);
    delItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            deleteSelectedFile();
        }
    });
    menu.addMenuListener(new MenuListener() {

        public void menuHidden(org.eclipse.swt.events.MenuEvent e) {
        }

        public void menuShown(org.eclipse.swt.events.MenuEvent e) {
            delItem.setEnabled(delCanEnable());
        }
    });
    sqlFileTableViewer.getTable().setMenu(menu);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) MenuListener(org.eclipse.swt.events.MenuListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

FocusEvent (org.eclipse.swt.events.FocusEvent)115 FocusAdapter (org.eclipse.swt.events.FocusAdapter)64 SelectionEvent (org.eclipse.swt.events.SelectionEvent)54 FocusListener (org.eclipse.swt.events.FocusListener)47 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)42 GridData (org.eclipse.swt.layout.GridData)38 Composite (org.eclipse.swt.widgets.Composite)34 Text (org.eclipse.swt.widgets.Text)33 GridLayout (org.eclipse.swt.layout.GridLayout)32 Label (org.eclipse.swt.widgets.Label)26 Menu (org.eclipse.swt.widgets.Menu)22 KeyEvent (org.eclipse.swt.events.KeyEvent)21 Button (org.eclipse.swt.widgets.Button)21 Point (org.eclipse.swt.graphics.Point)20 ModifyEvent (org.eclipse.swt.events.ModifyEvent)19 MenuManager (org.eclipse.jface.action.MenuManager)18 ModifyListener (org.eclipse.swt.events.ModifyListener)18 Combo (org.eclipse.swt.widgets.Combo)17 Group (org.eclipse.swt.widgets.Group)17 SelectionListener (org.eclipse.swt.events.SelectionListener)15