Java 类org.eclipse.swt.events.TraverseEvent 实例源码

项目:convertigo-eclipse    文件:KTableCellEditorMultilineWrapText.java   
protected Control createControl() {
  m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:convertigo-eclipse    文件:KTableCellEditorText.java   
protected Control createControl() {
  // System.out.println("Created a new one.");
  m_Text = new Text(m_Table, SWT.NONE);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:convertigo-eclipse    文件:KTableCellEditorMultilineText.java   
protected Control createControl() {
  m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:Hydrograph    文件:ParameterGridDialog.java   
/**
 * Create the dialog.
 * @param parentShell
 */
public ParameterGridDialog(Shell parentShell) {
    super(parentShell);
    setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL);
    runGraph=false;


    lastRowLastColumnTraverseListener=new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if(e.detail == SWT.TRAVERSE_TAB_NEXT)
                addRowToTextGrid();
        }
    };

}
项目:team-explorer-everywhere    文件:ToolStripTabs.java   
public ToolStripTabs(final Composite parent, final ToolStripTabPage[] tabs, final int style) {
    super(parent, style);
    this.tabs = tabs;
    imageHelper = new ImageHelper(TFSTeamBuildPlugin.PLUGIN_ID);
    createControls(this);
    setSelectedPage(0);
    addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(final TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_PAGE_NEXT) {
                traverseToNextPage(true);
                return;
            }
            if (e.detail == SWT.TRAVERSE_PAGE_PREVIOUS) {
                traverseToNextPage(false);
                return;
            }
        }
    });
}
项目:mytourbook    文件:GalleryMT20.java   
private void addTraverseListener() {
    addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(final TraverseEvent event) {

            /*
             * traverse with the tab key to the next/previous control
             */
            switch (event.detail) {
            case SWT.TRAVERSE_TAB_NEXT:
            case SWT.TRAVERSE_TAB_PREVIOUS:
                event.doit = true;
                break;
            }
        }
    });
}
项目:Eclipse-Postfix-Code-Completion    文件:TypeSelectionComponent.java   
private Control createHeader(Composite parent, Font font, String message) {
    Composite header= new Composite(parent, SWT.NONE);
    GridLayout layout= new GridLayout();
    layout.numColumns= 2;
    layout.marginWidth= 0; layout.marginHeight= 0;
    header.setLayout(layout);
    header.setFont(font);
    Label label= new Label(header, SWT.NONE);
    label.setText(message);
    label.setFont(font);
    label.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
                e.detail= SWT.TRAVERSE_NONE;
                fFilter.setFocus();
            }
        }
    });
    GridData gd= new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gd);

    createViewMenu(header);
    return header;
}
项目:Eclipse-Postfix-Code-Completion    文件:TextBoxDialogField.java   
@Override
protected Text createTextControl(Composite parent) {
    Text text= new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    text.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent event) {
            switch (event.detail) {
                case SWT.TRAVERSE_ESCAPE:
                case SWT.TRAVERSE_PAGE_NEXT:
                case SWT.TRAVERSE_PAGE_PREVIOUS:
                    event.doit= true;
                    break;
                case SWT.TRAVERSE_RETURN:
                case SWT.TRAVERSE_TAB_NEXT:
                case SWT.TRAVERSE_TAB_PREVIOUS:
                    if ((event.stateMask & SWT.MODIFIER_MASK) != 0) {
                        event.doit= true;
                    }
                    break;
            }

        }
    });
    return text;
}
项目:gef-gwt    文件:SWTEventDispatcher.java   
/**
 * @see EventDispatcher#dispatchKeyTraversed(TraverseEvent)
 */
public void dispatchKeyTraversed(TraverseEvent e) {
    if (!figureTraverse)
        return;
    IFigure nextFigure = null;

    if (e.detail == SWT.TRAVERSE_TAB_NEXT)
        nextFigure = getFocusTraverseManager().getNextFocusableFigure(root,
                focusOwner);
    else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)
        nextFigure = getFocusTraverseManager().getPreviousFocusableFigure(
                root, focusOwner);

    if (nextFigure != null) {
        e.doit = false;
        setFocus(nextFigure);
    }
}
项目:gef-gwt    文件:CLabel.java   
void onMnemonic(TraverseEvent event) {
    char mnemonic = _findMnemonic(text);
    if (mnemonic == '\0')
        return;
    if (Character.toLowerCase(event.character) != mnemonic)
        return;
    Composite control = this.getParent();
    while (control != null) {
        Control[] children = control.getChildren();
        int index = 0;
        while (index < children.length) {
            if (children[index] == this)
                break;
            index++;
        }
        index++;
        if (index < children.length) {
            if (children[index].setFocus()) {
                event.doit = true;
                event.detail = SWT.TRAVERSE_NONE;
            }
        }
        control = control.getParent();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TypeSelectionComponent.java   
private Control createHeader(Composite parent, Font font, String message) {
    Composite header= new Composite(parent, SWT.NONE);
    GridLayout layout= new GridLayout();
    layout.numColumns= 2;
    layout.marginWidth= 0; layout.marginHeight= 0;
    header.setLayout(layout);
    header.setFont(font);
    Label label= new Label(header, SWT.NONE);
    label.setText(message);
    label.setFont(font);
    label.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
                e.detail= SWT.TRAVERSE_NONE;
                fFilter.setFocus();
            }
        }
    });
    GridData gd= new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gd);

    createViewMenu(header);
    return header;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TextBoxDialogField.java   
@Override
protected Text createTextControl(Composite parent) {
    Text text= new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    text.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent event) {
            switch (event.detail) {
                case SWT.TRAVERSE_ESCAPE:
                case SWT.TRAVERSE_PAGE_NEXT:
                case SWT.TRAVERSE_PAGE_PREVIOUS:
                    event.doit= true;
                    break;
                case SWT.TRAVERSE_RETURN:
                case SWT.TRAVERSE_TAB_NEXT:
                case SWT.TRAVERSE_TAB_PREVIOUS:
                    if ((event.stateMask & SWT.MODIFIER_MASK) != 0) {
                        event.doit= true;
                    }
                    break;
            }

        }
    });
    return text;
}
项目:data-mapper    文件:MappingsViewer.java   
@Override
public void keyTraversed(final TraverseEvent event) {
    if (event.detail == SWT.TRAVERSE_TAB_NEXT) {
        if (nextText != null) {
            event.detail = SWT.TRAVERSE_NONE;
            event.doit = false;
            nextText.setFocus();
        }
    } else if (event.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
        if (prevText != null) {
            event.detail = SWT.TRAVERSE_NONE;
            event.doit = false;
            prevText.setFocus();
        }
    }
}
项目:birt    文件:ExpressionSyntaxColoringPage.java   
private TraverseListener getTraverseListener( )
{
    return new TraverseListener( ) {

        /**
         * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent)
         */
        public void keyTraversed( TraverseEvent e )
        {
            if ( e.widget instanceof StyledText )
            {
                if ( ( e.detail == SWT.TRAVERSE_TAB_NEXT )
                        || ( e.detail == SWT.TRAVERSE_TAB_PREVIOUS ) )
                    e.doit = true;
            }
        }
    };
}
项目:e4macs    文件:HistoryMinibuffer.java   
public void keyTraversed(TraverseEvent e) {
    switch (e.detail) {
        case SWT.TRAVERSE_MNEMONIC:
            if ((e.stateMask & SWT.MOD3) != 0) {
                switch (e.character) {
                    case PREV:
                    case NEXT:
                        // if no key binding (which would take precedence) 
                        // then pass to our handlers it directly
                        if (!hasBinding(e)){
                            handleTraverseEvent(e);
                        }
                }
            }
            break;
        default:
    }
}
项目:e4macs    文件:HistoryMinibuffer.java   
/**
 * Disable eclipse traversal event, and dispatch into our Alt/Ctrl
 * handlers in place of it
 * 
 * @param e the trapped TraverseEvent
 */
protected void handleTraverseEvent(TraverseEvent e) {
    // setting detail to NONE but doit=true disables further processing
    e.detail = SWT.TRAVERSE_NONE;
    e.doit = true;

    Event ee = new Event();
    ee.character = e.character;
    ee.doit = true;
    ee.stateMask = (e.stateMask & SWT.MODIFIER_MASK);
    ee.keyCode = e.keyCode;

    ee.display = e.display;
    ee.widget = e.widget;   // will throw an exception if not valid
    ee.time = e.time;
    ee.data = e.data;

    switch (ee.stateMask) {
        case SWT.CONTROL:   // Emacs+ key binding forces CTRL 
            dispatchCtrl(new VerifyEvent(ee));
            break;
        case SWT.ALT:   // AFAIK MOD3 is always ALT
            dispatchAlt(new VerifyEvent(ee));
            break;
    }
}
项目:TeamSubb    文件:TextFields.java   
@Override
public void createListeners() {
    write.addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_RETURN) {
                if (write.getText().replaceAll(" ", "").isEmpty())
                    return;

                Messaging.getInstance().sendChatMessage(staff, write.getText());

                write.setText("");
            }
        }
    });
}
项目:arx    文件:ComponentStatusLabel.java   
/**
 * 
 *
 * @param event
 */
void onMnemonic(TraverseEvent event) {
    char mnemonic = _findMnemonic(text);
    if (mnemonic == '\0') return;
    if (Character.toLowerCase(event.character) != mnemonic) return;
    Composite control = this.getParent();
    while (control != null) {
        Control[] children = control.getChildren();
        int index = 0;
        while (index < children.length) {
            if (children[index] == this) break;
            index++;
        }
        index++;
        if (index < children.length) {
            if (children[index].setFocus()) {
                event.doit = true;
                event.detail = SWT.TRAVERSE_NONE;
            }
        }
        control = control.getParent();
    }
}
项目:RxSWT    文件:TraverseObservable.java   
@Override
protected void subscribeActual(Observer<? super TraverseEvent> observer) {
    if (!Preconditions.checkWidget(observer, control)) {
        return;
    }
    RxTraverseListener listener = new RxTraverseListener(control, observer);
    observer.onSubscribe(listener);
    control.addDisposeListener(e -> listener.dispose());
    control.addTraverseListener(listener);
}
项目:Hydrograph    文件:ELTSWTWidgets.java   
public TableViewer createTableViewer(Composite composite, String[] prop,
        int[] bounds, int columnWidth,
        IStructuredContentProvider iStructuredContentProvider,
        ITableLabelProvider iTableLabelProvider) {
    final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER
            | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);

    Table table = tableViewer.getTable();
    table.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
    tableViewer.setContentProvider(iStructuredContentProvider);
    tableViewer.setLabelProvider(iTableLabelProvider);
    tableViewer.setColumnProperties(prop);
    tableViewer.getTable().addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.keyCode == SWT.ARROW_UP) {
                e.doit = false;
            } else if (e.keyCode == SWT.ARROW_DOWN) {
                e.doit = false;
            } else if (e.keyCode == SWT.TRAVERSE_ARROW_NEXT) {
                e.doit = false;
            } else if (e.keyCode == SWT.TRAVERSE_ARROW_PREVIOUS) {
                e.doit = false;
            }

        }
    });

    table.setVisible(true);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    /*
     * createTableColumns(table,prop, columnWidth); CellEditor[] editors
     * =createCellEditorList(table,1); tableViewer.setCellEditors(editors);
     */

    return tableViewer;
}
项目:termsuite-ui    文件:ProgressMonitorFocusJobDialog.java   
@Override
protected void configureShell(Shell shell) {
    super.configureShell(shell);
    shell.setText(job.getName());
    shell.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_ESCAPE) {
                cancelPressed();
                e.detail = SWT.TRAVERSE_NONE;
                e.doit = true;
            }
        }
    });
}
项目:team-explorer-everywhere    文件:WorkspacesDialog.java   
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout();
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);

    SWTUtil.createLabel(dialogArea, Messages.getString("WorkspacesDialog.WorkspacesLabelText")); //$NON-NLS-1$

    control = new WorkspacesControl(dialogArea, SWT.NONE);
    GridDataBuilder.newInstance().grab().fill().applyTo(control);
    control.getWorkspacesTable().addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            WorkspacesDialog.this.onWorkspacesTableDoubleClick(event);
        }
    });
    control.getWorkspacesTable().addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(final TraverseEvent e) {
            WorkspacesDialog.this.onWorkspacesTableKeyTraversed(e);
        }
    });

    control.refresh(connection, createWorkspaceIfNone, true);
}
项目:team-explorer-everywhere    文件:GenericMenuButton.java   
@Override
public void keyTraversed(final TraverseEvent e) {
    if (e.widget == button && (e.detail == SWT.TRAVERSE_RETURN || e.keyCode == ' ')) {
        final Event selectionEvent = new Event();
        selectionEvent.data = new Integer(SWT.Selection);
        notifyListeners(SWT.Selection, selectionEvent);

        e.doit = false;
    } else if (e.widget == button && e.keyCode == SWT.ARROW_DOWN) {
        openMenu();
    }
}
项目:team-explorer-everywhere    文件:WorkingFolderDataTable.java   
private void keyTraversed(final TraverseEvent e) {
    if (SWT.TRAVERSE_RETURN == e.detail) {
        if (editLastSelectedWorkingFolder()) {
            e.doit = false;
        }
    }
}
项目:team-explorer-everywhere    文件:GeneralTabPage.java   
private void createControls(final Composite composite) {
    final GridLayout layout = SWTUtil.gridLayout(composite, 1);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();

    SWTUtil.createLabel(composite, Messages.getString("GeneralTabPage.BuildNameLabelText")); //$NON-NLS-1$

    nameText = new Text(composite, SWT.BORDER);
    GridDataBuilder.newInstance().fill().applyTo(nameText);

    SWTUtil.createLabel(composite, Messages.getString("GeneralTabPage.DescriptionLabelText")); //$NON-NLS-1$

    descText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    descText.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(final TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = true;
            }
        }
    });
    GridDataBuilder.newInstance().fill().grab().applyTo(descText);

    disableButton =
        SWTUtil.createButton(composite, SWT.CHECK, Messages.getString("GeneralTabPage.DisableButtonText")); //$NON-NLS-1$

}
项目:subclipse    文件:CommitCommentArea.java   
public void keyTraversed(TraverseEvent e) {
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.SHIFT) != 0) {
        e.doit = false;
        return;
    }
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
        e.doit = false;
        firePropertyChangeChange(OK_REQUESTED, null, null);
    }
}
项目:http4e    文件:ImportDialog.java   
protected void createButtonsForButtonBar( Composite parent){
   Button ok = createButton(parent, IDialogConstants.OK_ID, "Import Packet", true);
   createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
   ok.addMouseListener(okListener);
   ok.addTraverseListener(new TraverseListener() {

      public void keyTraversed( TraverseEvent e){
         if (SWT.TRAVERSE_RETURN == e.detail) {
         }
      }
   });
}
项目:http4e    文件:ParameterizeDialog.java   
protected void createButtonsForButtonBar( Composite parent){
   Button ok = createButton(parent, IDialogConstants.OK_ID, "Close", true);
   // createButton(parent, IDialogConstants.CANCEL_ID,
   // IDialogConstants.CANCEL_LABEL, false);
   ok.addMouseListener(okListener);
   ok.addTraverseListener(new TraverseListener() {

      public void keyTraversed( TraverseEvent e){
         if (SWT.TRAVERSE_RETURN == e.detail) {
         }
      }
   });
}
项目:angular-eclipse    文件:HTMLAngularEditorSyntaxColoringPreferencePage.java   
private TraverseListener getTraverseListener() {
    return new TraverseListener() {
        /**
         * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent)
         */
        public void keyTraversed(TraverseEvent e) {
            if (e.widget instanceof StyledText) {
                if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS))
                    e.doit = true;
            }
        }
    };
}
项目:ermasterr    文件:ListenerAppender.java   
public static void addTraverseListener(final Text textArea) {
    textArea.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(final TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = true;
            }
        }
    });
}
项目:TranskribusSwtGui    文件:PagingToolBarNavigationRenderer.java   
@Override public void keyTraversed(TraverseEvent e) {
    if (e.getSource() == tb.getCurrentPageText() && e.detail == SWT.TRAVERSE_RETURN) {
        PageableController c = getController();
        String pageTxt = tb.getCurrentPageValue();
        try {
            int page = Integer.parseInt(pageTxt) - 1;
            if (page >= 0 && page<c.getTotalPages())
                c.setCurrentPage(page);
            else
                updateUI();
        } catch (NumberFormatException ex) {
            updateUI();
        }
    }
}
项目:ermaster-k    文件:ListenerAppender.java   
public static void addTraverseListener(final Text textArea) {
    textArea.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT
                    || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = true;
            }
        }
    });
}
项目:tlaplus    文件:FilteredItemsSelectionDialog.java   
/**
 * Create a new header which is labelled by headerLabel.
 *
 * @param parent
 * @return Label the label of the header
 */
private Label createHeader(Composite parent) {
    Composite header = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    header.setLayout(layout);

    Label headerLabel = new Label(header, SWT.NONE);
    headerLabel.setText((getMessage() != null && getMessage().trim()
            .length() > 0) ? getMessage()
            : WorkbenchMessages.FilteredItemsSelectionDialog_patternLabel);
    headerLabel.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
                e.detail = SWT.TRAVERSE_NONE;
                pattern.setFocus();
            }
        }
    });

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    headerLabel.setLayoutData(gd);

    createViewMenu(header);
    header.setLayoutData(gd);
    return headerLabel;
}
项目:tlaplus    文件:FilteredItemsSelectionDialog.java   
/**
 * Create the labels for the list and the progress. Return the list label.
 *
 * @param parent
 * @return Label
 */
private Label createLabels(Composite parent) {
    Composite labels = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    labels.setLayout(layout);

    Label listLabel = new Label(labels, SWT.NONE);
    listLabel
            .setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel);

    listLabel.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
                e.detail = SWT.TRAVERSE_NONE;
                list.getTable().setFocus();
            }
        }
    });

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    listLabel.setLayoutData(gd);

    progressLabel = new Label(labels, SWT.RIGHT);
    progressLabel.setLayoutData(gd);

    labels.setLayoutData(gd);
    return listLabel;
}
项目:EarthquakeBulletin    文件:FormFieldTraverseListener.java   
@Override
public void keyTraversed(final TraverseEvent te) {
    if (te.detail == SWT.TRAVERSE_RETURN) {
        if (form.getSearchButton().isEnabled()) {
            form.getSearchButton().notifyListeners(SWT.Selection, null);
        }
        else if (form.isValid() && form.getSearchJob() != null && form.getSearchJob().getState() != Job.NONE) {
            final MessageBox dialog = new MessageBox(form.getFormComposite().getShell(), SWT.ICON_WARNING);
            dialog.setText(Messages.get("lbl.window.title"));
            dialog.setMessage(Messages.get("msg.form.search.ongoing.message"));
            dialog.open();
        }
    }
}
项目:rxswt    文件:SwtObservers.java   
public static Observable<TraverseEvent> fromTraverseListener(Control control) {
    Observable<TraverseEvent> observable = Observable.create(subscriber -> {
        TraverseListener traverseListener = traverseEvent -> {
            // TODO: doit ?
            subscriber.onNext(traverseEvent);
        };
        control.addTraverseListener(traverseListener);
        subscriber.setDisposable(Disposables.fromAction(() -> control.removeTraverseListener(traverseListener)));
    });
    return wrap(control, observable);
}
项目:gwt-eclipse-plugin    文件:SWTUtilities.java   
/**
 * Creates a multi-line textbox.
 * 
 * @param parent a composite control which will be the parent of the new
 *          instance (cannot be null)
 * @param style the style of control to construct
 * @param allowTabs set to <code>true</code> to allow \t characters to be
 *          inserted.
 * @return the new textbox
 */
public static Text createMultilineTextbox(Composite parent, int style, final boolean allowTabs) {
  Text text = new Text(parent, style | SWT.MULTI);
  text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent e) {
      switch (e.detail) {
        case SWT.TRAVERSE_TAB_NEXT:
          e.doit = !allowTabs;
      }
    }
  });
  return text;
}
项目:eclipse-wtp-json    文件:JSONSyntaxColoringPage.java   
private TraverseListener getTraverseListener() {
    return new TraverseListener() {
        /**
         * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent)
         */
        public void keyTraversed(TraverseEvent e) {
            if (e.widget instanceof StyledText) {
                if ((e.detail == SWT.TRAVERSE_TAB_NEXT)
                        || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS))
                    e.doit = true;
            }
        }
    };
}
项目:APICloud-Studio    文件:CommitCommentArea.java   
public void keyTraversed(TraverseEvent e) {
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.SHIFT) != 0) {
        e.doit = false;
        return;
    }
    if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
        e.doit = false;
        firePropertyChangeChange(OK_REQUESTED, null, null);
    }
}
项目:erflute    文件:ListenerAppender.java   
public static void addTraverseListener(final Text textArea) {
    textArea.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = true;
            }
        }
    });
}