Search in sources :

Example 71 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class LogEditorPart method createPartControl.

/**
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 * @param parent the parent control
	 * @see IWorkbenchPart
	 */
public void createPartControl(Composite parent) {
    final Composite compositeLog = new Composite(parent, SWT.NONE);
    {
        GridLayout gridLayoutLog = new GridLayout();
        gridLayoutLog.verticalSpacing = 0;
        gridLayoutLog.marginWidth = 0;
        gridLayoutLog.marginHeight = 0;
        gridLayoutLog.horizontalSpacing = 5;
        gridLayoutLog.numColumns = 8;
        compositeLog.setLayout(gridLayoutLog);
    }
    final String type = this.cubridNode.getType();
    table = new Table(compositeLog, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
    {
        table.setHeaderVisible(true);
        GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
        gridData.horizontalSpan = 8;
        gridData.verticalSpan = 10;
        gridData.heightHint = 600;
        table.setLayoutData(gridData);
        table.setLinesVisible(true);
    }
    // fill in context menu
    if (CubridNodeType.BROKER_SQL_LOG.equals(type) || CubridNodeType.LOGS_BROKER_ERROR_LOG.equals(type) || CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type) || CubridNodeType.LOGS_SERVER_DATABASE_LOG.equals(type) || CubridNodeType.LOGS_APPLY_DATABASE_LOG.equals(type) || CubridNodeType.LOGS_COPY_DATABASE_LOG.equals(type)) {
        //Create the context menu
        MenuManager contextMenuManager = new MenuManager();
        contextMenuManager.setRemoveAllWhenShown(true);
        contextMenuManager.addMenuListener(new IMenuListener() {

            public void menuAboutToShow(IMenuManager manager) {
                buildPopupMenu(manager, type);
            }
        });
        Menu contextMenu = contextMenuManager.createContextMenu(table);
        table.setMenu(contextMenu);
        //Add listener
        table.addKeyListener(new KeyAdapter() {

            public void keyPressed(KeyEvent event) {
                if ((event.stateMask & SWT.CTRL) != 0 && (event.stateMask & SWT.SHIFT) == 0 && event.keyCode == 'c') {
                    copyDataToClipboard(type);
                }
            }
        });
    }
    table.addListener(SWT.MouseDoubleClick, new Listener() {

        public void handleEvent(Event event) {
            if (CubridNodeType.BROKER_SQL_LOG.equals(cubridNode.getType())) {
                TableItem[] items = table.getSelection();
                if (items != null && items.length == 1) {
                    final String content = items[0].getText(1);
                    new LogContentDetailDialog(getSite().getShell(), content).open();
                }
            } else if (CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(cubridNode.getType())) {
                TableItem[] items = table.getSelection();
                if (items != null && items.length == 1) {
                    final String content = items[0].getText(4);
                    new LogContentDetailDialog(getSite().getShell(), content).open();
                }
            } else if (CubridNodeType.LOGS_BROKER_ERROR_LOG.equals(cubridNode.getType())) {
                TableItem[] items = table.getSelection();
                if (items != null && items.length == 1) {
                    final String content = items[0].getText(6);
                    new LogContentDetailDialog(getSite().getShell(), content).open();
                }
            }
        }
    });
    // add bottom composite for page
    Label labelCharset = new Label(compositeLog, SWT.NONE);
    {
        labelCharset.setText(Messages.labelCharset);
        charsetCombo = new Combo(compositeLog, SWT.BORDER);
        final GridData gdCharsetText = CommonUITool.createGridData(1, 1, -1, -1);
        charsetCombo.setLayoutData(gdCharsetText);
        charsetCombo.setItems(QueryOptions.getAllCharset(null));
        charsetCombo.setText(charsetName);
    }
    Button viewLogBtn = new Button(compositeLog, SWT.NONE);
    {
        viewLogBtn.setText(Messages.viewLogJobName);
        viewLogBtn.setLayoutData(CommonUITool.createGridData(1, 1, 100, -1));
        viewLogBtn.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                String charsetName = charsetCombo.getText();
                try {
                    "".getBytes(charsetName);
                } catch (UnsupportedEncodingException e) {
                    CommonUITool.openErrorBox(Messages.errCharset);
                    charsetCombo.setFocus();
                    return;
                }
                setCharsetName(charsetName);
                if (!CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type) && !CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type)) {
                    connect(false);
                }
                if (CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type) || CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type)) {
                    managerConnect();
                    updateManagerLogTable();
                }
            }
        });
    }
    // page button
    if (!CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type) && !CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type)) {
        pageText = new Text(compositeLog, SWT.BORDER);
        {
            pageText.setVisible(true);
            pageText.setEditable(false);
            GridData gridData = createPageBtnGridData(150);
            gridData.grabExcessHorizontalSpace = true;
            pageText.setLayoutData(gridData);
        }
        buttonFirst = new Button(compositeLog, SWT.NONE);
        {
            buttonFirst.setVisible(true);
            buttonFirst.setText("|<");
            buttonFirst.setLayoutData(createPageBtnGridData(60));
            buttonFirst.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    lineStart = 1;
                    lineEnd = 100;
                    connect(false);
                }
            });
        }
        buttonPrev = new Button(compositeLog, SWT.NONE);
        {
            buttonPrev.setVisible(true);
            buttonPrev.setText("<");
            buttonPrev.setLayoutData(createPageBtnGridData(60));
            buttonPrev.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    lineStart -= 100;
                    if (lineStart < 1) {
                        lineStart = 1;
                    }
                    lineEnd = lineStart + 99;
                    connect(false);
                }
            });
        }
        buttonNext = new Button(compositeLog, SWT.NONE);
        {
            buttonNext.setVisible(true);
            buttonNext.setText(">");
            buttonNext.setLayoutData(createPageBtnGridData(60));
            buttonNext.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    lineStart += 100;
                    if (lineStart > lineTot) {
                        lineStart = lineTot;
                    }
                    lineEnd = lineStart + 99;
                    if (lineEnd > lineTot) {
                        lineEnd = lineTot;
                    }
                    connect(false);
                }
            });
        }
        buttonEnd = new Button(compositeLog, SWT.NONE);
        {
            buttonEnd.setVisible(true);
            buttonEnd.setText(">|");
            buttonEnd.setLayoutData(createPageBtnGridData(60));
            buttonEnd.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    lineEnd = lineTot;
                    lineStart = lineEnd - lineTot % 100 + 1;
                    connect(false);
                }
            });
        }
    }
    // manager log page button
    if (CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type) || CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type)) {
        pageText = new Text(compositeLog, SWT.BORDER);
        {
            pageText.setVisible(true);
            pageText.setEditable(false);
            GridData gridData = createPageBtnGridData(150);
            gridData.grabExcessHorizontalSpace = true;
            pageText.setLayoutData(gridData);
        }
        buttonFirst = new Button(compositeLog, SWT.NONE);
        buttonFirst.setVisible(true);
        buttonFirst.setText("|<");
        buttonFirst.setLayoutData(createPageBtnGridData(60));
        buttonFirst.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                pageInfo.setCurrentPage(1);
                updateManagerLogTable();
            }
        });
        buttonPrev = new Button(compositeLog, SWT.NONE);
        buttonPrev.setVisible(true);
        buttonPrev.setText("<");
        buttonPrev.setLayoutData(createPageBtnGridData(60));
        buttonPrev.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                pageInfo.setCurrentPage(pageInfo.getCurrentPage() - 1);
                updateManagerLogTable();
            }
        });
        buttonNext = new Button(compositeLog, SWT.NONE);
        buttonNext.setVisible(true);
        buttonNext.setText(">");
        buttonNext.setLayoutData(createPageBtnGridData(60));
        buttonNext.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                pageInfo.setCurrentPage(pageInfo.getCurrentPage() + 1);
                updateManagerLogTable();
            }
        });
        buttonEnd = new Button(compositeLog, SWT.NONE);
        buttonEnd.setVisible(true);
        buttonEnd.setText(">|");
        buttonEnd.setLayoutData(createPageBtnGridData(60));
        buttonEnd.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                pageInfo.setCurrentPage(pageInfo.getPages());
                updateManagerLogTable();
            }
        });
    }
    compositeLog.pack();
}
Also used : Table(org.eclipse.swt.widgets.Table) IMenuListener(org.eclipse.jface.action.IMenuListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) KeyAdapter(org.eclipse.swt.events.KeyAdapter) LogContentDetailDialog(com.cubrid.cubridmanager.ui.logs.dialog.LogContentDetailDialog) TableItem(org.eclipse.swt.widgets.TableItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) IMenuListener(org.eclipse.jface.action.IMenuListener) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu)

Example 72 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class ERSchemaToolBar method createDropDownComp.

/**
	 * create drop down composite
	 *
	 * @return comp composite
	 */
private Composite createDropDownComp() {
    Composite comp = new Composite(this, SWT.LEFT_TO_RIGHT);
    final GridLayout gdLayout = new GridLayout(2, false);
    gdLayout.marginHeight = 0;
    gdLayout.marginWidth = 0;
    gdLayout.horizontalSpacing = -1;
    gdLayout.verticalSpacing = 0;
    comp.setLayout(gdLayout);
    comp.setLayoutData(new GridData(SWT.END, SWT.FILL, true, false));
    selectModelLabel = new CLabel(comp, SWT.CENTER | SWT.SHADOW_OUT);
    selectModelLabel.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
    dropDownButton = new Button(comp, SWT.FLAT | SWT.ARROW | SWT.DOWN);
    dropDownButton.setLayoutData(CommonUITool.createGridData(1, 1, 20, -1));
    dropDownButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            handleSelectionEvent();
        }
    });
    return comp;
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) GridLayout(org.eclipse.swt.layout.GridLayout) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) KeyEvent(org.eclipse.swt.events.KeyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 73 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class QueryExecuter method createContextMenuItems.

private void createContextMenuItems() {
    Menu menu = new Menu(queryEditor.getEditorSite().getShell(), SWT.POP_UP);
    final MenuItem itemInsert = new MenuItem(menu, SWT.PUSH);
    itemInsert.setText(Messages.insertRecord);
    itemInsert.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (!getEditable()) {
                CommonUITool.openErrorBox(Display.getDefault().getActiveShell(), Messages.errNotEditable);
                return;
            }
            insertSaveItem.setEnabled(getEditable());
            rollbackModifiedItem.setEnabled(getEditable());
            addNewItem();
        }
    });
    final MenuItem itemCopy = new MenuItem(menu, SWT.PUSH);
    itemCopy.setText(Messages.copyClipBoard);
    final MenuItem itemDelete = new MenuItem(menu, SWT.PUSH);
    itemDelete.setText(Messages.delete);
    new MenuItem(menu, SWT.SEPARATOR);
    final MenuItem itemDetail = new MenuItem(menu, SWT.PUSH);
    itemDetail.setText(Messages.detailView);
    itemDetail.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            List<Point> selectedList = selectableSupport.getSelectedLocations();
            Point location = selectedList.get(0);
            if (location == null) {
                CommonUITool.openErrorBox(Messages.errShowDetailFailed);
                return;
            }
            //Bug fixed by Kevin.Qian. FYI. allDataList is a global query result to the current query.
            int pageBeginIndex = (queryInfo.getCurrentPage() - 1) * queryInfo.getPageSize();
            Map<String, CellValue> map = allDataList.get(pageBeginIndex + location.y);
            TableItem item = tblResult.getItem(location.y);
            ColumnInfo colInfo = allColumnList.get(location.x - 1);
            RowDetailDialog dialog = new RowDetailDialog(tblResult.getShell(), allColumnList, map, item, colInfo.getName(), executer);
            dialog.open();
        }
    });
    tblResult.setMenu(menu);
    tblResult.addListener(SWT.MouseUp, new Listener() {

        public void handleEvent(Event event) {
            //				Point pt = new Point(event.x, event.y);
            //				itemOid.setEnabled(false);
            int index = tblResult.getSelectionIndex();
            int count = tblResult.getItemCount();
            if (index < 0 || index >= count) {
                return;
            }
        //				final TableItem item = tblResult.getItem(index);
        //				for (int i = 0; i < tblResult.getColumnCount(); i++) {
        //					Rectangle rect = item.getBounds(i);
        //					if (rect.contains(pt)) {
        //						selColumnName = tblResult.getColumn(i).getText();
        ////						Object value = item.getData(i + "");
        ////						String text = item.getText(i);
        ////						if (!DataType.VALUE_NULL.equals(value) && containsOIDs(tblResult.getColumn(i).getText())
        ////							&& !DataType.VALUE_NONE.equals(text)) {
        ////							itemOid.setEnabled(true);
        ////						} else {
        ////							itemOid.setEnabled(false);
        ////						}
        //
        //					}
        //				}
        }
    });
    final MenuItem itemExportAll = new MenuItem(menu, SWT.PUSH);
    itemExportAll.setText(Messages.allExport);
    final MenuItem itemExportSelection = new MenuItem(menu, SWT.PUSH);
    itemExportSelection.setText(Messages.selectExport);
    new MenuItem(menu, SWT.SEPARATOR);
    final MenuItem itemMakeInsertQuery = new MenuItem(menu, SWT.PUSH);
    itemMakeInsertQuery.setText(Messages.makeInsertFromSelectedRecord);
    itemMakeInsertQuery.setImage(CommonUIPlugin.getImage("icons/queryeditor/record_to_insert.png"));
    final MenuItem itemMakeUpdateQuery = new MenuItem(menu, SWT.PUSH);
    itemMakeUpdateQuery.setText(Messages.makeUpdateFromSelectedRecord);
    itemMakeUpdateQuery.setImage(CommonUIPlugin.getImage("icons/queryeditor/record_to_update.png"));
    if (isEmpty()) {
        itemExportAll.setEnabled(false);
        itemExportSelection.setEnabled(false);
        itemDetail.setEnabled(false);
    }
    menu.addMenuListener(new MenuAdapter() {

        public void menuShown(MenuEvent event) {
            List<Point> selectedList = selectableSupport.getSelectedLocations();
            TableItem[] tblItems = selectableSupport.getSelectedTableItems();
            boolean selectedCol = selectableSupport.hasSelected();
            boolean enableItemDetail = (selectedList != null && selectedList.size() == 1);
            itemExportSelection.setEnabled(selectedCol);
            itemCopy.setEnabled(selectedCol);
            if (allDataList.size() > 0) {
                itemExportAll.setEnabled(true);
            } else {
                itemExportAll.setEnabled(false);
            }
            if (executer.getQueryEditor() != null && executer.getQueryEditor().getDatabaseInfo() != null && executer.getQueryEditor().getDatabaseInfo().equals(executer.getDatabaseInfo())) {
                itemInsert.setEnabled(isEditMode());
                itemDetail.setEnabled(enableItemDetail);
                itemDelete.setEnabled(getEditable() && isEditMode());
            } else {
                itemInsert.setEnabled(false);
                itemDetail.setEnabled(false);
                itemDelete.setEnabled(false);
            }
            for (int i = 0; i < tblItems.length; i++) {
                if (isEditMode() && getEditable() && tblItems[i].getText(1).equals(DataType.VALUE_NONE)) {
                    itemDelete.setEnabled(false);
                }
            }
        }
    });
    itemCopy.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            copySelectedItems();
        }
    });
    itemCopy.setAccelerator(SWT.CTRL + 'c');
    itemDelete.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (isEditMode()) {
                deleteRecord(tblResult, null);
            }
        }
    });
    itemExportAll.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            ExportResultDialog dialog = new ExportResultDialog(tblResult.getShell(), database, Messages.msgExportAllResults);
            if (IDialogConstants.OK_ID == dialog.open()) {
                ExportQueryResultTaskExecutor task = new ExportQueryResultTaskExecutor(dialog.getFile(), dialog.getFileCharset(), allColumnList, allDataList, false);
                new ExecTaskWithProgress(task).exec();
            }
        }
    });
    //		itemOid.addSelectionListener(new SelectionAdapter() {
    //			/**
    //			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
    //			 * @param event an event containing information about the
    //			 *        selection
    //			 */
    //			public void widgetSelected(SelectionEvent event) {
    //				openOidNavigator(button2Position);
    //			}
    //
    //		});
    itemExportSelection.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            ExportResultDialog dialog = new ExportResultDialog(tblResult.getShell(), database, Messages.msgExportSelectedResults);
            if (IDialogConstants.OK_ID == dialog.open()) {
                ExportQueryResultTaskExecutor task = new ExportQueryResultTaskExecutor(dialog.getFile(), dialog.getFileCharset(), tblResult, selectableSupport.getSelectedTableItems(), false);
                new ExecTaskWithProgress(task).exec();
            }
        }
    });
    itemMakeInsertQuery.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            String text = makeInsertQueryWithSelectedRecords();
            CommonUITool.copyContentToClipboard(text);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    itemMakeUpdateQuery.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            String text = makeUpdateQueryWithSelectedRecords();
            CommonUITool.copyContentToClipboard(text);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : SelectionListener(org.eclipse.swt.events.SelectionListener) PaintListener(org.eclipse.swt.events.PaintListener) Listener(org.eclipse.swt.widgets.Listener) MouseListener(org.eclipse.swt.events.MouseListener) IMenuListener(org.eclipse.jface.action.IMenuListener) KeyListener(org.eclipse.swt.events.KeyListener) RowDetailDialog(com.cubrid.common.ui.query.dialog.RowDetailDialog) ExportResultDialog(com.cubrid.common.ui.query.dialog.ExportResultDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) MenuAdapter(org.eclipse.swt.events.MenuAdapter) MenuItem(org.eclipse.swt.widgets.MenuItem) Point(org.eclipse.swt.graphics.Point) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) List(java.util.List) Menu(org.eclipse.swt.widgets.Menu) Map(java.util.Map) HashMap(java.util.HashMap) MenuEvent(org.eclipse.swt.events.MenuEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 74 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class AddQueryRecordProjectDialog method createDialogArea.

/**
	 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
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.numColumns = 3;
    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);
    Label label1 = new Label(composite, SWT.LEFT);
    label1.setText(Messages.lblQueryName);
    label1.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    newText = new Text(composite, SWT.BORDER);
    newText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    newText.setText(queryRecordProect.getName());
    newText.selectAll();
    newText.setFocus();
    newText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            validate();
        }
    });
    newText.addListener(SWT.KeyDown, new Listener() {

        public void handleEvent(Event e) {
            if (e.type == SWT.KeyDown && e.character == SWT.CR) {
                buttonPressed(IDialogConstants.OK_ID);
            }
        }
    });
    if (newFlag) {
        setTitle(Messages.titleAddQueryTunerList);
        setMessage(Messages.titleAddQueryTunerList);
    } else {
        setTitle(Messages.bind(Messages.titleRenameQueryTunerList, queryRecordProect.getName()));
        setMessage(Messages.bind(Messages.titleRenameQueryTunerList, queryRecordProect.getName()));
    }
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) Text(org.eclipse.swt.widgets.Text)

Example 75 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class MonitorStatisticEditor method createPartControl.

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    createToolBar(parent);
    scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComp.setLayout(new FillLayout());
    scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    scrolledComp.getVerticalBar().setIncrement(10);
    scrolledComp.addListener(SWT.Activate, new Listener() {

        @Override
        public void handleEvent(Event event) {
            scrolledComp.setFocus();
        }
    });
    chartAreaRootComp = new Composite(scrolledComp, SWT.NONE);
    {
        final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        chartAreaRootComp.setLayoutData(gd);
        GridLayout layout = new GridLayout(3, false);
        chartAreaRootComp.setLayout(layout);
        chartAreaRootComp.setBackground(COLOR_CHART_AREA_BACKGROUND);
    }
    statisticDataMap = refreshData(statisticItemList);
    createDataChart(chartAreaRootComp);
    createAddChart(chartAreaRootComp);
    createHiddenItems();
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setContent(chartAreaRootComp);
    scrolledComp.setMinWidth(CHART_AREA_WIDTH);
    updateScrolledCompositeHeight();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

Listener (org.eclipse.swt.widgets.Listener)214 Event (org.eclipse.swt.widgets.Event)199 SelectionEvent (org.eclipse.swt.events.SelectionEvent)101 GridData (org.eclipse.swt.layout.GridData)95 Composite (org.eclipse.swt.widgets.Composite)82 GridLayout (org.eclipse.swt.layout.GridLayout)78 Point (org.eclipse.swt.graphics.Point)60 SelectionListener (org.eclipse.swt.events.SelectionListener)58 Button (org.eclipse.swt.widgets.Button)58 Label (org.eclipse.swt.widgets.Label)53 Text (org.eclipse.swt.widgets.Text)49 Table (org.eclipse.swt.widgets.Table)46 DisposeListener (org.eclipse.swt.events.DisposeListener)37 DisposeEvent (org.eclipse.swt.events.DisposeEvent)36 Rectangle (org.eclipse.swt.graphics.Rectangle)35 FocusEvent (org.eclipse.swt.events.FocusEvent)34 TableColumn (org.eclipse.swt.widgets.TableColumn)34 Shell (org.eclipse.swt.widgets.Shell)31 KeyEvent (org.eclipse.swt.events.KeyEvent)30 Group (org.eclipse.swt.widgets.Group)30