Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.KeyAdapter


        _fromMsgText.setText(FROM_DEFAULT);
        gridData = new GridData(SWT.LEFT, SWT.FILL, false, false);
        gridData.widthHint = 75;
        _fromMsgText.setLayoutData(gridData);
        _fromMsgText.addVerifyListener(new NumberVerifyListener());
        _fromMsgText.addKeyListener(new KeyAdapter()
        {
            public void keyPressed(KeyEvent event)
            {
                if (event.character == SWT.CR)
                {
                    updateMessageInterval();
                }
            }
        });

        _toolkit.createLabel(viewMessageRangeComposite, "to");

        _toMsgText = new Text(viewMessageRangeComposite, SWT.BORDER);
        _toMsgText.setText(TO_DEFAULT);
        gridData = new GridData(SWT.LEFT, SWT.FILL, false, false);
        gridData.widthHint = 75;
        _toMsgText.setLayoutData(gridData);
        _toMsgText.addVerifyListener(new NumberVerifyListener());
        _toMsgText.addKeyListener(new KeyAdapter()
        {
            public void keyPressed(KeyEvent event)
            {
                if (event.character == SWT.CR)
                {
View Full Code Here


       
        //Get the text widgets
        Control[] widgets = composite.getChildren();
        for (int i=0; i < widgets.length; i++)
        {
            widgets[i].addKeyListener(new KeyAdapter()
            {
                public void keyPressed(KeyEvent event)
                {
                    if (event.character == SWT.ESC)
                    {
                      //Escape key acts as cancel on all widgets
                        shell.dispose();
                    }
                }
            });
        }
       
        Composite buttonsComposite  = new Composite(composite, SWT.NONE);
        buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        buttonsComposite.setLayout(new GridLayout(2, true));
       
        final Button connectButton = new Button(buttonsComposite, SWT.PUSH | SWT.CENTER);      
        connectButton.setText(Constants.BUTTON_CONNECT);
        GridData gridData = new GridData (SWT.TRAIL, SWT.BOTTOM, true, true);
        gridData.widthHint = 100;
        connectButton.setLayoutData(gridData);
        connectButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
        connectButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected(SelectionEvent event)
            {
                _user = textUser.getText();
                if ((_user == null) || (_user.trim().length() == 0))
                {
                    ViewUtility.popupInfoMessage(_title, INFO_USERNAME);
                    textUser.setText("");
                    textUser.setFocus();
                    return;
                }
               
                _password = textPwd.getText();
                if (_password == null)
                {
                    ViewUtility.popupInfoMessage(_title, INFO_PASSWORD);
                    textPwd.setText("");
                    textPwd.setFocus();
                    return;
                }
               
                _connect = true;
                shell.dispose();
            }
        });

        final Button cancelButton = new Button(buttonsComposite, SWT.PUSH);
        cancelButton.setText(Constants.BUTTON_CANCEL);
        gridData = new GridData (SWT.LEAD, SWT.BOTTOM, true, true);
        gridData.widthHint = 100;
        cancelButton.setLayoutData(gridData);
        cancelButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
        cancelButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected(SelectionEvent event)
            {
                shell.dispose();
            }
        });
       
        //Get the ok/cancel button widgets and add a new key listener
        widgets = buttonsComposite.getChildren();
        for (int i=0; i < widgets.length; i++)
        {
            widgets[i].addKeyListener(new KeyAdapter()
            {
                public void keyPressed(KeyEvent event)
                {
                    if (event.character == SWT.ESC)
                    {
View Full Code Here

       
        //Get the text widgets
        Control[] widgets = composite.getChildren();
        for (int i=0; i < widgets.length; i++)
        {
            widgets[i].addKeyListener(new KeyAdapter()
            {
                public void keyPressed(KeyEvent event)
                {
                    if (event.character == SWT.ESC)
                    {
                      //Escape key acts as cancel on all widgets
                        shell.dispose();
                    }
                }
            });
        }
       
        Composite buttonsComposite  = new Composite(composite, SWT.NONE);
        buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        buttonsComposite.setLayout(new GridLayout(2, true));
       
        final Button connectButton = new Button(buttonsComposite, SWT.PUSH | SWT.CENTER);      
        connectButton.setText(BUTTON_CONNECT);
        GridData gridData = new GridData (SWT.TRAIL, SWT.BOTTOM, true, true);
        gridData.widthHint = 100;
        connectButton.setLayoutData(gridData);
        connectButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
        connectButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected(SelectionEvent event)
            {               
                _host = textHost.getText();              
                if ((_host == null) || (_host.trim().length() == 0))
                {
                    ViewUtility.popupInfoMessage(ACTION_ADDSERVER, INFO_HOST_ADDRESS);
                    textHost.setText("");
                    textHost.setFocus();
                    return;
                }
               
                _port = textPort.getText();
                if ((_port == null) || (_port.trim().length() == 0))
                {
                    ViewUtility.popupInfoMessage(ACTION_ADDSERVER, INFO_HOST_PORT);
                    textPort.setText("");
                    textPort.setFocus();
                    return;
                }
               
                _user = textUser.getText();
                if ((_user == null) || (_user.trim().length() == 0))
                {
                    ViewUtility.popupInfoMessage(ACTION_ADDSERVER, INFO_USERNAME);
                    textUser.setText("");
                    textUser.setFocus();
                    return;
                }
               
                _password = textPwd.getText();
                if (_password == null)
                {
                    ViewUtility.popupInfoMessage(ACTION_ADDSERVER, INFO_PASSWORD);
                    textPwd.setText("");
                    textPwd.setFocus();
                    return;
                }
               
                _addServer = true;
                shell.dispose();                                    
            }
        });
       
        final Button cancelButton = new Button(buttonsComposite, SWT.PUSH);
        cancelButton.setText(BUTTON_CANCEL);
        gridData = new GridData (SWT.LEAD, SWT.BOTTOM, true, true);
        gridData.widthHint = 100;
        cancelButton.setLayoutData(gridData);
        cancelButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
        cancelButton.addSelectionListener(new SelectionAdapter()
        {
            public void widgetSelected(SelectionEvent event)
            {
                shell.dispose();
            }
        });
       
        //Get the ok/cancel button widgets and add a new key listener
        widgets = buttonsComposite.getChildren();
        for (int i=0; i < widgets.length; i++)
        {
            widgets[i].addKeyListener(new KeyAdapter()
            {
                public void keyPressed(KeyEvent event)
                {
                    if (event.character == SWT.ESC)
                    {
View Full Code Here

    listviewer = new TableViewer(sash, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    labelProvider = new ListLabelProvider();
    listviewer.setLabelProvider(labelProvider);
    ListContentProvider provider = new ListContentProvider();
    listviewer.setContentProvider(provider);
    listviewer.getControl().addKeyListener(new KeyAdapter() {

      @Override
      public void keyPressed(KeyEvent e) {
        int keyCode = e.keyCode;
        // backspace or delete
View Full Code Here

    treeView = new TreeViewer(comp, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);

    AnnotationCheckContentProvider provider = new AnnotationCheckContentProvider();
    treeView.setContentProvider(provider);

    treeView.getControl().addKeyListener(new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        char c = e.character;
        if (c == '1' || c == '2') {
          if (c == '1') {
View Full Code Here

      public void widgetSelected(SelectionEvent e) {
        execNext();
      }
    });

    inputCmd.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        switch (e.keyCode) {
        case SWT.F7:
          execCurrent();
          break;
View Full Code Here

            public boolean canModify(Object element, String property) {
                return true;
            }
        });
        tableViewer.getTable().addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent event) {
                if (event.keyCode == SWT.F2 && event.stateMask == 0) {
                    ISelection selection = tableViewer.getSelection();
                    if (!(selection instanceof IStructuredSelection))
View Full Code Here

            setErrorMessage("Error querying repository configuration.");
            logger.logError("Error querying repository configuration.", e);
        }

        // Listeners
        selectionSearchTxt.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.keyCode == SWT.ARROW_DOWN)
                    availableTree.setFocus();
            }
View Full Code Here

                    Object item = availableObjectClassesViewer.getElementAt( 0 );
                    availableObjectClassesViewer.setSelection( new StructuredSelection( item ) );
                }
            }
        } );
        availableObjectClassesInstantSearch.addKeyListener( new KeyAdapter()
        {
            public void keyPressed( KeyEvent e )
            {
                if ( e.keyCode == SWT.ARROW_DOWN )
                {
                    availableObjectClassesViewer.getTable().setFocus();
                }
                else if ( e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR )
                {
                    add( availableObjectClassesViewer.getSelection() );
                }
            }
        } );
        ControlDecoration availableObjectClassesInstantSearchDecoration = new ControlDecoration(
            availableObjectClassesInstantSearch, SWT.TOP | SWT.LEFT, composite );
        availableObjectClassesInstantSearchDecoration.setDescriptionText( Messages
            .getString( "NewEntryObjectclassWizardPage.FilterDescription" ) ); //$NON-NLS-1$
        availableObjectClassesInstantSearchDecoration.setImage( FieldDecorationRegistry.getDefault()
            .getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL ).getImage() );
        Button reloadButton = new Button( availableObjectClassesInstantSearchComposite, SWT.PUSH | SWT.FLAT );
        reloadButton.setToolTipText( Messages.getString( "NewEntryObjectclassWizardPage.ReloadSchema" ) ); //$NON-NLS-1$
        reloadButton.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_REFRESH ) );
        reloadButton.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {
                IBrowserConnection browserConnection = wizard.getSelectedConnection();
                ReloadSchemaRunnable runnable = new ReloadSchemaRunnable( browserConnection );
                RunnableContextRunner.execute( runnable, wizard.getContainer(), true );
                setVisible( true );
            }
        } );

        availableObjectClassesViewer = new TableViewer( availableObjectClassesComposite );
        GridData data = new GridData( GridData.FILL_BOTH );
        data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
        data.widthHint = ( int ) ( SIZING_SELECTION_WIDGET_WIDTH * 0.4 );
        availableObjectClassesViewer.getTable().setLayoutData( data );
        availableObjectClassesViewer.setContentProvider( new ArrayContentProvider() );
        availableObjectClassesViewer.setLabelProvider( labelProvider );
        availableObjectClassesViewer.setSorter( new ViewerSorter() );
        availableObjectClassesViewer.addFilter( new InstantSearchFilter( availableObjectClassesInstantSearch ) );
        availableObjectClassesViewer.setInput( availableObjectClasses );
        availableObjectClassesViewer.addDoubleClickListener( new IDoubleClickListener()
        {
            public void doubleClick( DoubleClickEvent event )
            {
                add( event.getSelection() );
            }
        } );
        availableObjectClassesViewer.getTable().addKeyListener( new KeyAdapter()
        {
            public void keyPressed( KeyEvent e )
            {
                if ( e.keyCode == SWT.ARROW_UP )
                {
View Full Code Here

            public void modifyText( ModifyEvent e )
            {
                setSearchInput( searchText.getText() );
            }
        } );
        searchText.addKeyListener( new KeyAdapter()
        {
            public void keyPressed( KeyEvent e )
            {
                if ( e.keyCode == SWT.ARROW_DOWN )
                {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.events.KeyAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.