org.eclipse.swt.events.TraverseListener Java Examples
The following examples show how to use
org.eclipse.swt.events.TraverseListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExpressionSyntaxColoringPage.java From birt with Eclipse Public License 1.0 | 6 votes |
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; } } }; }
Example #2
Source File: TextBoxDialogField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #3
Source File: TypeSelectionComponent.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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; }
Example #4
Source File: ListenerAppender.java From erflute with Apache License 2.0 | 5 votes |
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; } } }); }
Example #5
Source File: ListenerAppender.java From ermaster-b with Apache License 2.0 | 5 votes |
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; } } }); }
Example #6
Source File: DQSystemInfoPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private Text createTextCell(Composite composite, int heightFactor, int widthFactor) { Text text = toolkit.createText(composite, null, SWT.BORDER | SWT.MULTI | SWT.WRAP); text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); setGridData(text, heightFactor, widthFactor); return text; }
Example #7
Source File: SARLArgumentsTab.java From sarl with Apache License 2.0 | 5 votes |
private void createSREArgsText(Group group, Font font) { this.sreArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); this.sreArgumentsText.addTraverseListener(new TraverseListener() { @Override 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 ((SARLArgumentsTab.this.sreArgumentsText.getStyle() & SWT.SINGLE) != 0) { event.doit = true; } else { if (!SARLArgumentsTab.this.sreArgumentsText.isEnabled() || (event.stateMask & SWT.MODIFIER_MASK) != 0) { event.doit = true; } } break; default: } } }); final GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = HEIGHT_HINT; gd.widthHint = WIDTH_HINT; this.sreArgumentsText.setLayoutData(gd); this.sreArgumentsText.setFont(font); this.sreArgumentsText.addModifyListener(new ModifyListener() { @SuppressWarnings("synthetic-access") @Override public void modifyText(ModifyEvent evt) { scheduleUpdateJob(); } }); ControlAccessibleListener.addListener(this.sreArgumentsText, group.getText()); }
Example #8
Source File: SWTUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example #9
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 5 votes |
/** * 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; }
Example #10
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 5 votes |
/** * 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; }
Example #11
Source File: ListenerAppender.java From ermasterr with Apache License 2.0 | 5 votes |
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; } } }); }
Example #12
Source File: SwtUtils.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void disableTabTraversal(Control c) { c.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { switch (e.detail) { case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: { e.doit = false; } } } }); }
Example #13
Source File: UiUtils.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void disableTabTraversal(Control c){ c.addTraverseListener(new TraverseListener () { public void keyTraversed(TraverseEvent e) { switch (e.detail) { case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: { e.doit = false; } } } }); }
Example #14
Source File: ParameterizeDialog.java From http4e with Apache License 2.0 | 5 votes |
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) { } } }); }
Example #15
Source File: ImportDialog.java From http4e with Apache License 2.0 | 5 votes |
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) { } } }); }
Example #16
Source File: TextVarWarning.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #17
Source File: HsAbstractProgressDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 运行任务的准备工作 * @return UI状态 */ @SuppressWarnings("rawtypes") private Object aboutToStart(boolean enableCancelButton) { Map savedState = null; if (getShell() != null) { // Save focus control Control focusControl = getShell().getDisplay().getFocusControl(); if (focusControl != null && focusControl.getShell() != getShell()) { focusControl = null; } boolean needsProgressMonitor = needsProgressMonitor(); // 设置Shell的鼠标状态 Display d = getShell().getDisplay(); waitCursor = new Cursor(d, SWT.CURSOR_WAIT); setDisplayCursor(waitCursor); if (useCustomProgressMonitorPart) { cancelButton.removeSelectionListener(cancelListener); // 设置取消按钮的鼠标状态 arrowCursor = new Cursor(d, SWT.CURSOR_ARROW); cancelButton.setCursor(arrowCursor); } // Deactivate shell savedState = saveUIState(useCustomProgressMonitorPart && needsProgressMonitor && enableCancelButton); if (focusControl != null) { savedState.put(FOCUS_CONTROL, focusControl); } // Activate cancel behavior. if (needsProgressMonitor) { if (enableCancelButton || useCustomProgressMonitorPart) { progressMonitorPart.attachToCancelComponent(cancelButton); } progressMonitorPart.setVisible(true); } if (timeWhenLastJobFinished == -1) { timeWhenLastJobFinished = 0; // 忽略键盘事件( enter space)在最后一个任务完成之前 getShell().addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN || (e.detail == SWT.TRAVERSE_MNEMONIC && e.keyCode == 32)) { if (timeWhenLastJobFinished != 0 && System.currentTimeMillis() - timeWhenLastJobFinished < RESTORE_ENTER_DELAY) { e.doit = false; return; } timeWhenLastJobFinished = 0; } } }); } } return savedState; }
Example #18
Source File: TSWizardDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * About to start a long running operation triggered through the wizard. * Shows the progress monitor and disables the wizard's buttons and * controls. * * @param enableCancelButton * <code>true</code> if the Cancel button should be enabled, * and <code>false</code> if it should be disabled * @return the saved UI state */ private Object aboutToStart(boolean enableCancelButton) { Map savedState = null; if (getShell() != null) { // Save focus control Control focusControl = getShell().getDisplay().getFocusControl(); if (focusControl != null && focusControl.getShell() != getShell()) { focusControl = null; } boolean needsProgressMonitor = wizard.needsProgressMonitor(); // Set the busy cursor to all shells. Display d = getShell().getDisplay(); waitCursor = new Cursor(d, SWT.CURSOR_WAIT); setDisplayCursor(waitCursor); if (useCustomProgressMonitorPart) { cancelButton.removeSelectionListener(cancelListener); // Set the arrow cursor to the cancel component. arrowCursor = new Cursor(d, SWT.CURSOR_ARROW); cancelButton.setCursor(arrowCursor); } // Deactivate shell savedState = saveUIState(useCustomProgressMonitorPart && needsProgressMonitor && enableCancelButton); if (focusControl != null) { savedState.put(FOCUS_CONTROL, focusControl); } // Activate cancel behavior. if (needsProgressMonitor) { if (enableCancelButton || useCustomProgressMonitorPart) { progressMonitorPart.attachToCancelComponent(cancelButton); } progressMonitorPart.setVisible(true); } // Install traverse listener once in order to implement 'Enter' and 'Space' key blocking if (timeWhenLastJobFinished == -1) { timeWhenLastJobFinished= 0; getShell().addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN || (e.detail == SWT.TRAVERSE_MNEMONIC && e.keyCode == 32)) { // We want to ignore the keystroke when we detect that it has been received within the // delay period after the last operation has finished. This prevents the user from accidentally // hitting "Enter" or "Space", intending to cancel an operation, but having it processed exactly // when the operation finished, thus traversing the wizard. If there is another operation still // running, the UI is locked anyway so we are not in this code. This listener should fire only // after the UI state is restored (which by definition means all jobs are done. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=287887 if (timeWhenLastJobFinished != 0 && System.currentTimeMillis() - timeWhenLastJobFinished < RESTORE_ENTER_DELAY) { e.doit= false; return; } timeWhenLastJobFinished= 0; }} }); } } return savedState; }
Example #19
Source File: NatCombo.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override public void addTraverseListener(TraverseListener listener) { text.addTraverseListener(listener); dropdownList.addTraverseListener(listener); }
Example #20
Source File: TextVarWarning.java From hop with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #21
Source File: ChartComposite.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); // } // else if (listener instanceof DragDetectListener) { // this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); // } // else if (listener instanceof MenuDetectListener) { // this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); // } else if (listener instanceof MouseWheelListener) { // this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
Example #22
Source File: TextVar.java From hop with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #23
Source File: CheckBoxVar.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wBox.addTraverseListener( tl ); }
Example #24
Source File: TextVar.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #25
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(SWTEventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); } else if (listener instanceof DragDetectListener) { this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); } else if (listener instanceof MenuDetectListener) { this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); } else if (listener instanceof MouseWheelListener) { this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
Example #26
Source File: WarningText.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #27
Source File: LabelTextVar.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wText.addTraverseListener( tl ); }
Example #28
Source File: ComboVar.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wCombo.addTraverseListener( tl ); }
Example #29
Source File: TableView.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void editButton( TableItem row, int rownr, int colnr ) { beforeEdit = getItemText( row ); fieldChanged = false; ColumnInfo colinfo = columns[colnr - 1]; if ( colinfo.isReadOnly() ) { return; } if ( colinfo.getDisabledListener() != null ) { boolean disabled = colinfo.getDisabledListener().isFieldDisabled( rownr ); if ( disabled ) { return; } } button = new Button( table, SWT.PUSH ); props.setLook( button, Props.WIDGET_STYLE_TABLE ); String buttonText = columns[colnr - 1].getButtonText(); if ( buttonText != null ) { button.setText( buttonText ); } button.setImage( GUIResource.getInstance().getImage( "ui/images/edittext.svg" ) ); SelectionListener selAdpt = colinfo.getSelectionAdapter(); if ( selAdpt != null ) { button.addSelectionListener( selAdpt ); } buttonRownr = rownr; buttonColnr = colnr; // button.addTraverseListener(lsTraverse); buttonContent = row.getText( colnr ); String tooltip = columns[colnr - 1].getToolTip(); if ( tooltip != null ) { button.setToolTipText( tooltip ); } else { button.setToolTipText( "" ); } button.addTraverseListener( lsTraverse ); // hop to next field button.addTraverseListener( new TraverseListener() { @Override public void keyTraversed( TraverseEvent arg0 ) { closeActiveButton(); } } ); editor.horizontalAlignment = SWT.LEFT; editor.verticalAlignment = SWT.TOP; editor.grabHorizontal = false; editor.grabVertical = false; Point size = button.computeSize( SWT.DEFAULT, SWT.DEFAULT ); editor.minimumWidth = size.x; editor.minimumHeight = size.y - 2; // setRowNums(); editor.layout(); // Open the text editor in the correct column of the selected row. editor.setEditor( button ); button.setFocus(); // if the button loses focus, destroy it... /* * button.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { button.dispose(); } } ); */ }
Example #30
Source File: LabelCombo.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addTraverseListener( TraverseListener tl ) { wCombo.addTraverseListener( tl ); }