Search in sources :

Example 56 with KeyAdapter

use of org.eclipse.swt.events.KeyAdapter in project otertool by wuntee.

the class FindDialog method createContents.

/**
	 * Create contents of the dialog.
	 */
private void createContents() {
    shlFind = new Shell(getParent(), SWT.DIALOG_TRIM);
    shlFind.setSize(450, 128);
    shlFind.setText("Find");
    GridLayout gl_shlFind = new GridLayout(1, false);
    gl_shlFind.verticalSpacing = 0;
    gl_shlFind.marginWidth = 0;
    gl_shlFind.marginBottom = 5;
    gl_shlFind.marginTop = 5;
    gl_shlFind.marginRight = 5;
    gl_shlFind.marginLeft = 5;
    gl_shlFind.marginHeight = 0;
    gl_shlFind.horizontalSpacing = 0;
    shlFind.setLayout(gl_shlFind);
    Label lblSearchString = new Label(shlFind, SWT.NONE);
    lblSearchString.setBounds(0, 0, 59, 14);
    lblSearchString.setText("Search String:");
    searchText = new Text(shlFind, SWT.BORDER);
    searchText.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.character == 13) {
                findNext();
            }
        }
    });
    searchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnIgnoreCase = new Button(shlFind, SWT.CHECK);
    btnIgnoreCase.setText("Ignore Case");
    Composite composite = new Composite(shlFind, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, false, true, 1, 1));
    GridLayout gl_composite = new GridLayout(3, false);
    gl_composite.horizontalSpacing = 0;
    gl_composite.marginWidth = 0;
    gl_composite.marginHeight = 0;
    gl_composite.verticalSpacing = 0;
    composite.setLayout(gl_composite);
    Button btnPrevious = new Button(composite, SWT.NONE);
    btnPrevious.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            findPrevious();
        }
    });
    btnPrevious.setText("Previous");
    Button btnNext = new Button(composite, SWT.NONE);
    btnNext.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            findNext();
        }
    });
    btnNext.setText("Next");
    Button btnCancel = new Button(composite, SWT.NONE);
    btnCancel.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            shlFind.close();
        }
    });
    btnCancel.setBounds(0, 0, 94, 30);
    btnCancel.setText("Cancel");
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) StyledText(org.eclipse.swt.custom.StyledText)

Example 57 with KeyAdapter

use of org.eclipse.swt.events.KeyAdapter in project otertool by wuntee.

the class CTabItemWithHexViewer method addListeners.

private void addListeners(final StyledText txt) {
    txt.addMouseWheelListener(new MouseWheelListener() {

        public void mouseScrolled(MouseEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }

        public void widgetSelected(SelectionEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addCaretListener(new CaretListener() {

        public void caretMoved(CaretEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addDragDetectListener(new DragDetectListener() {

        public void dragDetected(DragDetectEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    ScrollBar vbar = txt.getVerticalBar();
    if (vbar != null) {
        vbar.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event arg0) {
                binContent.setTopIndex(txt.getTopIndex());
                hexContent.setTopIndex(txt.getTopIndex());
                counter.setTopIndex(txt.getTopIndex());
            }
        });
    }
}
Also used : CaretEvent(org.eclipse.swt.custom.CaretEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) DragDetectListener(org.eclipse.swt.events.DragDetectListener) Listener(org.eclipse.swt.widgets.Listener) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) CaretListener(org.eclipse.swt.custom.CaretListener) SelectionListener(org.eclipse.swt.events.SelectionListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) DragDetectListener(org.eclipse.swt.events.DragDetectListener) KeyEvent(org.eclipse.swt.events.KeyEvent) CaretListener(org.eclipse.swt.custom.CaretListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DragDetectEvent(org.eclipse.swt.events.DragDetectEvent) DragDetectEvent(org.eclipse.swt.events.DragDetectEvent) Event(org.eclipse.swt.widgets.Event) KeyEvent(org.eclipse.swt.events.KeyEvent) CaretEvent(org.eclipse.swt.custom.CaretEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrollBar(org.eclipse.swt.widgets.ScrollBar) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 58 with KeyAdapter

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

the class EditUserDialog method createUserPwdGroup.

/**
	 * Create the user password group
	 * 
	 * @param composite the parent composite
	 */
private void createUserPwdGroup(Composite composite) {
    final Group userNameGroup = new Group(composite, SWT.NONE);
    final GridData gdUserPasswordGroup = new GridData(SWT.FILL, SWT.FILL, true, false);
    userNameGroup.setLayoutData(gdUserPasswordGroup);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    userNameGroup.setLayout(layout);
    final Label userNameLabel = new Label(userNameGroup, SWT.NONE);
    final GridData gdUserNameLabel = new GridData(SWT.FILL, SWT.FILL, false, false);
    userNameLabel.setLayoutData(gdUserNameLabel);
    userNameLabel.setText(Messages.lblUserName);
    userNameText = new Text(userNameGroup, SWT.BORDER);
    userNameText.setEnabled(false);
    final GridData gdUserNameText = new GridData(SWT.FILL, SWT.FILL, true, false);
    userNameText.setLayoutData(gdUserNameText);
    userNameText.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {
        }

        public void keyReleased(KeyEvent event) {
            String userName = userNameText.getText();
            if (null == userName || "".equals(userName) || userName.length() <= 0) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                return;
            }
            getButton(IDialogConstants.OK_ID).setEnabled(true);
        }
    });
    final Group userPasswordGroup = new Group(userNameGroup, SWT.NONE);
    final GridData gdPasswordGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
    gdPasswordGroup.horizontalSpan = 2;
    userPasswordGroup.setLayoutData(gdPasswordGroup);
    layout = new GridLayout();
    layout.numColumns = 2;
    userPasswordGroup.setLayout(layout);
    userPasswordGroup.setText(Messages.grpPasswordSetting);
    if (newFlag) {
        final Label passwordLabel = new Label(userPasswordGroup, SWT.NONE);
        passwordLabel.setText(Messages.lblPassword);
        pwdText = new Text(userPasswordGroup, SWT.BORDER | SWT.PASSWORD);
        final GridData gdPwdText = new GridData(SWT.FILL, SWT.CENTER, true, false);
        pwdText.setLayoutData(gdPwdText);
        final Label newPasswordConfirmLabel = new Label(userPasswordGroup, SWT.NONE);
        newPasswordConfirmLabel.setText(Messages.lblPasswordConf);
        pwdCfmText = new Text(userPasswordGroup, SWT.BORDER | SWT.PASSWORD);
        final GridData gdPwdCfmText = new GridData(SWT.FILL, SWT.CENTER, true, false);
        pwdCfmText.setLayoutData(gdPwdCfmText);
    } else {
        changePwdBtn = new Button(userPasswordGroup, SWT.CHECK);
        changePwdBtn.setText(Messages.btnPasswordChange);
        changePwdBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
        changePwdBtn.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(final SelectionEvent event) {
                if (changePwdBtn.getSelection()) {
                    if (!database.getDatabaseInfo().getAuthLoginedDbUserInfo().getName().equalsIgnoreCase(DB_DBA_USERNAME) || (database.getDatabaseInfo().getAuthLoginedDbUserInfo().getName().equalsIgnoreCase(DB_DBA_USERNAME) && DB_DBA_USERNAME.equalsIgnoreCase(userName))) {
                        oldPwdText.setEnabled(true);
                    }
                    pwdText.setEnabled(true);
                    pwdCfmText.setEnabled(true);
                } else {
                    oldPwdText.setEnabled(false);
                    pwdText.setEnabled(false);
                    pwdCfmText.setEnabled(false);
                }
            }
        });
        final Label oldPasswordLabel = new Label(userPasswordGroup, SWT.NONE);
        oldPasswordLabel.setText(Messages.lblOldPassword);
        oldPwdText = new Text(userPasswordGroup, SWT.BORDER | SWT.PASSWORD);
        final GridData gdOldPwdText = new GridData(SWT.FILL, SWT.CENTER, true, false);
        oldPwdText.setLayoutData(gdOldPwdText);
        oldPwdText.setTextLimit(ValidateUtil.MAX_PASSWORD_LENGTH);
        final Label passwordLabel = new Label(userPasswordGroup, SWT.NONE);
        passwordLabel.setText(Messages.lblNewPassword);
        pwdText = new Text(userPasswordGroup, SWT.BORDER | SWT.PASSWORD);
        pwdText.setTextLimit(ValidateUtil.MAX_PASSWORD_LENGTH);
        final GridData gdPwdText = new GridData(SWT.FILL, SWT.CENTER, true, false);
        pwdText.setLayoutData(gdPwdText);
        final Label newPasswordConfirmLabel = new Label(userPasswordGroup, SWT.NONE);
        newPasswordConfirmLabel.setText(Messages.lblNewPasswordConf);
        pwdCfmText = new Text(userPasswordGroup, SWT.BORDER | SWT.PASSWORD);
        final GridData gdPwdCfmText = new GridData(SWT.FILL, SWT.CENTER, true, false);
        pwdCfmText.setLayoutData(gdPwdCfmText);
        pwdCfmText.setTextLimit(ValidateUtil.MAX_PASSWORD_LENGTH);
        oldPwdText.setEnabled(false);
        pwdText.setEnabled(false);
        pwdCfmText.setEnabled(false);
    }
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Example 59 with KeyAdapter

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

the class ViewDashboardEditorPart method createViewsDetailInfoTable.

public void createViewsDetailInfoTable(Composite parent) {
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    {
        tableComposite.setLayout(new FillLayout());
        tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
    viewsDetailInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    viewsDetailInfoTable.getTable().setHeaderVisible(true);
    viewsDetailInfoTable.getTable().setLinesVisible(true);
    final TableViewerColumn columnViewName = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
    columnViewName.getColumn().setWidth(150);
    columnViewName.getColumn().setText(Messages.viewDetailInfoPartColViewName);
    final TableViewerColumn scriptDescColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
    scriptDescColumn.getColumn().setWidth(200);
    scriptDescColumn.getColumn().setText(Messages.viewDetailInfoPartTableDefColumn);
    final TableViewerColumn ownerColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
    ownerColumn.getColumn().setWidth(80);
    ownerColumn.getColumn().setText(Messages.viewDetailInfoPartTableOwnerColumn);
    viewsDetailInfoTable.setContentProvider(new ViewsDetailTableViewerContentProvider());
    viewsDetailInfoTable.setLabelProvider(new ViewsDetailTableViewerLabelProvider());
    viewsDetailInfoTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            ViewDetailInfo oneViewDetail = (ViewDetailInfo) selection.getFirstElement();
            //if had opend,set it selection
            for (CTabItem tabItem : tabFolder.getItems()) {
                if (tabItem.getText().equals(oneViewDetail.getViewName())) {
                    tabFolder.setSelection(tabItem);
                    return;
                }
            }
            //if a new view info,create a new tab
            ViewDashboardComposite viewComp = new ViewDashboardComposite(tabFolder, SWT.NONE);
            viewComp.initialize();
            SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(oneViewDetail.getViewName());
            viewComp.setInput(schemaInfo);
        }
    });
    viewsDetailInfoTable.getTable().addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {
            if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
            }
        }
    });
    registerContextMenu();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) KeyAdapter(org.eclipse.swt.events.KeyAdapter) ViewDetailInfo(com.cubrid.common.core.common.model.ViewDetailInfo) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ViewsDetailInfoCTabItem(com.cubrid.common.ui.cubrid.view.editor.ViewDashboardComposite.ViewsDetailInfoCTabItem) CTabItem(org.eclipse.swt.custom.CTabItem) KeyEvent(org.eclipse.swt.events.KeyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 60 with KeyAdapter

use of org.eclipse.swt.events.KeyAdapter in project MonjaDB by Kanatoko.

the class MDocumentList method init2.

//--------------------------------------------------------------------------------
public void init2() {
    parent.setLayout(new FormLayout());
    table = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            onMouseDown(e);
        }
    });
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    FormData d1 = new FormData();
    d1.top = new FormAttachment(0, 32);
    d1.left = new FormAttachment(0, 1);
    d1.right = new FormAttachment(100, -1);
    d1.bottom = new FormAttachment(100, -1);
    table.setLayoutData(d1);
    menuManager = new MenuManager();
    Menu contextMenu = menuManager.createContextMenu(table);
    table.setMenu(contextMenu);
    historyCombo = new Combo(parent, SWT.NONE);
    historyCombo.setToolTipText("Find Query. Hit Enter to apply.");
    historyCombo.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            //debug( e );
            if (e.keyCode == 13) {
                String text = historyCombo.getText();
                if (text != null && text.length() > 0) {
                    executeAction(text);
                }
            }
        }
    });
    FormData fd_combo = new FormData();
    fd_combo.bottom = new FormAttachment(table, -3);
    fd_combo.left = new FormAttachment(0, 4);
    fd_combo.right = new FormAttachment(30, 0);
    historyCombo.setLayoutData(fd_combo);
    //listeners
    table.addListener(SWT.MouseDoubleClick, this);
    table.addListener(SWT.Selection, this);
    table.addListener(SWT.KeyDown, this);
    image = MUtil.getImage(parent.getShell().getDisplay(), "table.png");
    final MDocumentList documentList = this;
    {
        //editDocumentAction
        editDocumentAction = new Action() {

            public void run() {
                //--------
                editDocument();
            }
        };
        //-----
        editDocumentAction.setText("Edit Document");
        setActionImage(editDocumentAction, "table_edit.png");
        menuManager.add(editDocumentAction);
    }
    {
        //editFieldAction
        editFieldAction = new Action() {

            public void run() {
                //--------
                editField();
            }
        };
        //-----
        editFieldAction.setText("Edit Field");
        setActionImage(editFieldAction, "page_edit.png");
        menuManager.add(editFieldAction);
    }
    menuManager.add(new Separator());
    {
        //copyAction
        copyAction = new Action() {

            public void run() {
                //--------
                copy();
            }
        };
        //-----
        copyAction.setText("Copy\tCtrl+C");
        setActionImage(copyAction, "page_copy.png");
        menuManager.add(copyAction);
    }
    {
        //pasteAction
        pasteAction = new Action() {

            public void run() {
                //--------
                paste();
            }
        };
        //-----
        pasteAction.setText("Paste\tCtrl+V");
        setActionImage(pasteAction, "page_white_paste_table.png");
        menuManager.add(pasteAction);
    }
    {
        //insertBlankAction
        insertBlankAction = new Action() {

            public void run() {
                //--------
                insertBlankDocument();
            }
        };
        //-----
        insertBlankAction.setText("Insert Blank Document");
        setActionImage(insertBlankAction, "table_add.png");
        menuManager.add(insertBlankAction);
    }
    {
        //insertJsonAction
        insertJsonAction = new Action() {

            public void run() {
                //--------
                insertJsonDocument();
            }
        };
        //-----
        insertJsonAction.setText("Insert JSON");
        setActionImage(insertJsonAction, "table_add.png");
        menuManager.add(insertJsonAction);
    }
    menuManager.add(new Separator());
    {
        copyFieldAction = new Action() {

            public void run() {
                //--------
                copyField();
            }
        };
        //-----
        copyFieldAction.setText("Copy Field(s)");
        menuManager.add(copyFieldAction);
    }
    {
        copyAsJsonAction = new Action() {

            public void run() {
                //--------
                copyAsJson();
            }
        };
        //-----
        copyAsJsonAction.setText("Copy Documents As JSON");
        menuManager.add(copyAsJsonAction);
    }
    {
        copyAsStringAction = new Action() {

            public void run() {
                //--------
                copyAsString();
            }
        };
        //-----
        copyAsStringAction.setText("Copy Documents As String");
        menuManager.add(copyAsStringAction);
    }
    menuManager.add(new Separator());
    {
        //removeAction
        removeAction = new Action() {

            public void run() {
                //--------
                remove();
            }
        };
        //-----
        removeAction.setText("Remove\tDEL");
        setActionImage(removeAction, "table_delete.png");
        menuManager.add(removeAction);
    }
    menuManager.add(new Separator());
    {
        //reloadAction
        reloadAction = new Action() {

            public void run() {
                //--------
                reload();
            }
        };
        //-----
        reloadAction.setText("Reload\tF5/Ctrl+R");
        reloadAction.setToolTipText("Reload Documents");
        initAction(reloadAction, "table_refresh.png", menuManager);
    }
    menuManager.add(new Separator());
    {
        //backAction
        backAction = new Action() {

            public void run() {
                //--------
                MHistory findHistory = dataManager.getFindHistory();
                if (!findHistory.atBegin()) {
                    findHistory.back();
                    documentList.executeAction(findHistory.current() + "");
                }
            }
        };
        //-----
        backAction.setText("Back");
        backAction.setToolTipText("Previous Find Query");
        initAction(backAction, "bullet_left.png", menuManager);
    }
    {
        //forwardAction
        forwardAction = new Action() {

            public void run() {
                //--------
                MHistory findHistory = dataManager.getFindHistory();
                if (!findHistory.atEnd()) {
                    findHistory.forward();
                    documentList.executeAction(findHistory.current() + "");
                }
            }
        };
        //-----
        forwardAction.setText("Forward");
        forwardAction.setToolTipText("Next Find Query");
        initAction(forwardAction, "bullet_right.png", menuManager);
    }
    menuManager.add(new Separator());
    {
        //prevItemsAction
        prevItemsAction = new Action() {

            public void run() {
                //--------
                showPrevItems();
            }
        };
        //-----
        prevItemsAction.setText("Previous Items");
        prevItemsAction.setToolTipText("Show Previous Results");
        setActionImage(prevItemsAction, "page_back.png");
        addActionToDropDownMenu(prevItemsAction);
        menuManager.add(prevItemsAction);
    }
    {
        //prevItemsButton
        prevItemsButton = new Button(parent, SWT.FLAT);
        prevItemsButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                showPrevItems();
            }
        });
        FormData fd_btnNewButton = new FormData();
        fd_btnNewButton.right = new FormAttachment(table, -40, SWT.RIGHT);
        prevItemsButton.setLayoutData(fd_btnNewButton);
        Image image = MUtil.getImage(parent.getShell().getDisplay(), "page_back.png");
        prevItemsButton.setImage(image);
    }
    {
        //nextItemsAction
        nextItemsAction = new Action() {

            public void run() {
                //--------
                showNextItems();
            }
        };
        //-----
        nextItemsAction.setText("Next Items");
        nextItemsAction.setToolTipText("Show Next Results");
        setActionImage(nextItemsAction, "page_forward.png");
        addActionToDropDownMenu(nextItemsAction);
        menuManager.add(nextItemsAction);
    }
    {
        //nextItemsButton
        nextItemsButton = new Button(parent, SWT.FLAT);
        nextItemsButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                showNextItems();
            }
        });
        FormData fd_btnNewButton = new FormData();
        fd_btnNewButton.right = new FormAttachment(table, -10, SWT.RIGHT);
        nextItemsButton.setLayoutData(fd_btnNewButton);
        Image image = MUtil.getImage(parent.getShell().getDisplay(), "page_forward.png");
        nextItemsButton.setImage(image);
    }
    naviLabel = new Label(parent, SWT.NONE);
    FormData fd_naviLabel = new FormData();
    fd_naviLabel.top = new FormAttachment(historyCombo, 6, SWT.TOP);
    //fd_naviLabel.left = new FormAttachment(prevItemsButton, -66, SWT.LEFT);
    fd_naviLabel.right = new FormAttachment(prevItemsButton, -6, SWT.LEFT);
    naviLabel.setLayoutData(fd_naviLabel);
    naviLabel.setText("");
    grepCombo = new Combo(parent, SWT.NONE);
    grepCombo.setToolTipText("Grep(RegEx). Hit Enter to apply");
    FormData fd_grepCombo = new FormData();
    fd_grepCombo.right = new FormAttachment(50);
    fd_grepCombo.bottom = new FormAttachment(table, -3);
    fd_grepCombo.left = new FormAttachment(30, 6);
    grepCombo.setLayoutData(fd_grepCombo);
    grepCombo.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            if (e.keyCode == 13) {
                grep();
            }
        }
    });
    initActionsAndButtons();
}
Also used : MEditAction(net.jumperz.app.MMonjaDBCore.action.mj.MEditAction) MShowAllDbStatsAction(net.jumperz.app.MMonjaDBCore.action.mj.MShowAllDbStatsAction) MouseEvent(org.eclipse.swt.events.MouseEvent) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Image(org.eclipse.swt.graphics.Image) KeyEvent(org.eclipse.swt.events.KeyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

KeyAdapter (org.eclipse.swt.events.KeyAdapter)80 KeyEvent (org.eclipse.swt.events.KeyEvent)80 GridData (org.eclipse.swt.layout.GridData)50 GridLayout (org.eclipse.swt.layout.GridLayout)40 Composite (org.eclipse.swt.widgets.Composite)39 SelectionEvent (org.eclipse.swt.events.SelectionEvent)33 Text (org.eclipse.swt.widgets.Text)30 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)28 Label (org.eclipse.swt.widgets.Label)24 Button (org.eclipse.swt.widgets.Button)20 TableViewer (org.eclipse.jface.viewers.TableViewer)18 ModifyEvent (org.eclipse.swt.events.ModifyEvent)17 ModifyListener (org.eclipse.swt.events.ModifyListener)16 FocusEvent (org.eclipse.swt.events.FocusEvent)15 Point (org.eclipse.swt.graphics.Point)15 Table (org.eclipse.swt.widgets.Table)14 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)12 FocusAdapter (org.eclipse.swt.events.FocusAdapter)11