org.eclipse.swt.events.VerifyListener Java Examples
The following examples show how to use
org.eclipse.swt.events.VerifyListener.
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: ScriptConsoleViewer.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Constructor. * * @param parent parent for the styled text * @param style style to be used */ public ScriptConsoleStyledText(Composite parent, int style) { super(parent, style); /** * The StyledText will change the caretOffset that we've updated during the modifications, * so, the verify and the extended modify listener will keep track if it actually does * that and will reset the caret to the position we actually added it. * * Feels like a hack but I couldn't find a better way to do it. */ addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent e) { internalCaretSet = -1; } }); /** * Set it to the location we've set it to be. */ addExtendedModifyListener(new ExtendedModifyListener() { @Override public void modifyText(ExtendedModifyEvent event) { if (internalCaretSet != -1) { if (internalCaretSet != getCaretOffset()) { setCaretOffset(internalCaretSet); } internalCaretSet = -1; } } }); initDragDrop(); handleDeletePreviousWord = new HandleDeletePreviousWord(); handleLineStartAction = new HandleLineStartAction(); }
Example #2
Source File: DimensionBuilderDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @param composite */ private void createMeasureField(Composite composite) { new Label(composite, SWT.NONE).setText(LABEL_MEASURE); measure = new Text(composite, SWT.SINGLE | SWT.BORDER); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.horizontalSpan = 2; measure.setLayoutData(gridData); measure.setFont(composite.getFont()); if ( measureData != null && !measureData.equals( "" ) ) //$NON-NLS-1$ { measure.setText( NumberUtil.double2LocaleNum( ( (Double) measureData ).doubleValue( ) ) ); } measure.addVerifyListener(new VerifyListener(){ public void verifyText(VerifyEvent e) { // TODO Auto-generated method stub boolean doit = false; char eChar = e.character;System.out.print(eChar + 0); String validChars = "0123456789,.\b"; //$NON-NLS-1$ if(e.keyCode == SWT.DEL || validChars.indexOf(eChar) >= 0) { doit = true; } e.doit = doit; }}); }
Example #3
Source File: ElementNamesConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * create a tableview for the existed table * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( elementNames ); // Create the cell editors CellEditor[] editors = new CellEditor[elementNames.length]; for ( int i = 0; i < elementNames.length; i++ ) { TextCellEditor textEditor = new TextCellEditor( table ); ( (Text) textEditor.getControl( ) ).setTextLimit( 60 ); if ( i == 1 ) { // assure that the CUSTOM NAME column doesn't contain // ReportPlugin.PREFERENCE_DELIMITER ( (Text) textEditor.getControl( ) ).addVerifyListener( new VerifyListener( ) { public void verifyText( VerifyEvent e ) { e.doit = e.text.indexOf( ReportPlugin.PREFERENCE_DELIMITER ) < 0; } } ); } editors[i] = textEditor; } // Assign the cell editors to the viewer tableViewer.setCellEditors( editors ); // Set the cell modifier for the viewer tableViewer.setCellModifier( new ElementNamesCellModifier( this ) ); }
Example #4
Source File: NewTypeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates the controls for the type name field. Expects a <code>GridLayout</code> with at * least 2 columns. * * @param composite the parent composite * @param nColumns number of columns to span */ protected void createTypeNameControls(Composite composite, int nColumns) { fTypeNameDialogField.doFillIntoGrid(composite, nColumns - 1); DialogField.createEmptySpace(composite); Text text= fTypeNameDialogField.getTextControl(null); LayoutUtil.setWidthHint(text, getMaxFieldWidth()); TextFieldNavigationHandler.install(text); text.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (fCanModifyPackage && ! fEnclosingTypeSelection.isSelected() && e.start == 0 && e.end == ((Text) e.widget).getCharCount()) { String typeNameWithoutParameters= getTypeNameWithoutParameters(e.text); int lastDot= typeNameWithoutParameters.lastIndexOf('.'); if (lastDot == -1 || lastDot == typeNameWithoutParameters.length() - 1) return; String pack= typeNameWithoutParameters.substring(0, lastDot); if (validatePackageName(pack, null).getSeverity() == IStatus.ERROR) return; fPackageDialogField.setText(pack); e.text= e.text.substring(lastDot + 1); } } }); }
Example #5
Source File: XtextEditor.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.7 */ @Override public void removeVerifyListener(VerifyListener listener) { StyledText textWidget = getSourceViewer().getTextWidget(); if(textWidget != null) textWidget.removeVerifyListener(listener); }
Example #6
Source File: XtextEditor.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.7 */ @Override public void addVerifyListener(VerifyListener listener) { StyledText textWidget = getSourceViewer().getTextWidget(); if(textWidget != null) textWidget.addVerifyListener(listener); }
Example #7
Source File: AbstractDirtyStateAwareEditorCallback.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void removeVerifyListener(VerifyListener listener) { ISourceViewer sourceViewer = currentEditor.getInternalSourceViewer(); StyledText widget = sourceViewer.getTextWidget(); if (widget != null) widget.removeVerifyListener(listener); }
Example #8
Source File: ElexisText.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public void removeVerifyListener(VerifyListener listener){ text.removeVerifyListener(listener); }
Example #9
Source File: ElexisText.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public void addVerifyListener(VerifyListener listener){ text.addVerifyListener(listener); }
Example #10
Source File: FolderSelectionGroup.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Create group * * @param parent */ public void create( Composite parent ) { // get font Font font = parent.getFont( ); // label control Label label = new Label( parent, SWT.LEFT ); label.setFont( font ); label.setText( this.labelText ); Composite composite = new Composite( parent, SWT.NULL ); GridLayout layout = new GridLayout( ); layout.marginWidth = 0; layout.marginHeight = 0; layout.numColumns = 2; composite.setLayout( layout ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); composite.setLayoutData( data ); // text control text = new Text( composite, SWT.BORDER ); text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); text.setFont( font ); text.setText( this.textValue ); text.addVerifyListener( new VerifyListener( ) { public void verifyText( VerifyEvent e ) { e.doit = e.text.indexOf( DELIMITER ) < 0; } } ); // directory selection button button = new Button( composite, SWT.PUSH ); button.setFont( font ); button.setText( this.buttonText ); button.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent event ) { dialog = new DirectoryDialog( PlatformUI.getWorkbench( ) .getDisplay( ).getActiveShell( ) ); dialog.setText( dialogTitle ); dialog.setMessage( dialogMessage ); dialog.setFilterPath( dialogFilterPath ); String folderName = dialog.open( ); if ( folderName == null ) { return; } text.setText( folderName ); } } ); }
Example #11
Source File: FolderSelectionGroup.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Create group * * @param parent */ public void create( Composite parent ) { // get font Font font = parent.getFont( ); // label control Label label = new Label( parent, SWT.LEFT ); label.setFont( font ); label.setText( this.labelText ); Composite composite = new Composite( parent, SWT.NULL ); GridLayout layout = new GridLayout( ); layout.marginWidth = 0; layout.marginHeight = 0; layout.numColumns = 2; composite.setLayout( layout ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); composite.setLayoutData( data ); // text control text = new Text( composite, SWT.BORDER ); text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); text.setFont( font ); text.setText( this.textValue ); text.addVerifyListener( new VerifyListener( ) { public void verifyText( VerifyEvent e ) { e.doit = e.text.indexOf( DELIMITER ) < 0; } } ); // directory selection button button = new Button( composite, SWT.PUSH ); button.setFont( font ); button.setText( this.buttonText ); button.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent event ) { dialog = new DirectoryDialog( PlatformUI.getWorkbench( ) .getDisplay( ).getActiveShell( ) ); dialog.setText( dialogTitle ); dialog.setMessage( dialogMessage ); dialog.setFilterPath( dialogFilterPath ); String folderName = dialog.open( ); if ( folderName == null ) { return; } text.setText( folderName ); } } ); }
Example #12
Source File: AbstractDirtyStateAwareEditorCallback.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void addVerifyListener(VerifyListener listener) { ISourceViewer sourceViewer = currentEditor.getInternalSourceViewer(); StyledText widget = sourceViewer.getTextWidget(); widget.addVerifyListener(listener); }
Example #13
Source File: DirtyStateEditorSupportTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void removeVerifyListener(VerifyListener listener) { assertSame(this.verifyListener, listener); this.verifyListener = null; }
Example #14
Source File: SimpleTextEntryWindow.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
public void addVerifyListener( VerifyListener l ) { verify_listeners.add( l ); }
Example #15
Source File: DirtyStateEditorSupportTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void addVerifyListener(VerifyListener listener) { assertNull(this.verifyListener); this.verifyListener = listener; }
Example #16
Source File: TextAssist.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * @see org.eclipse.swt.widgets.Text#removeVerifyListener(org.eclipse.swt.events.VerifyListener) */ public void removeVerifyListener(final VerifyListener listener) { checkWidget(); text.removeVerifyListener(listener); }
Example #17
Source File: TextAssist.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * @see org.eclipse.swt.widgets.Text#addVerifyListener(org.eclipse.swt.events.VerifyListener) */ public void addVerifyListener(final VerifyListener listener) { checkWidget(); text.addVerifyListener(listener); }
Example #18
Source File: BidiLayout.java From nebula with Eclipse Public License 2.0 | 4 votes |
public void addVerifyListener(VerifyListener listener){ styledText.addVerifyListener(listener); }
Example #19
Source File: BidiLayout.java From nebula with Eclipse Public License 2.0 | 4 votes |
public void removeVerifyListener(VerifyListener listener){ styledText.removeVerifyListener(listener); }
Example #20
Source File: CustomCombo.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will be notified * when the receiver's text is verified, by sending it one of the messages * defined in the <code>VerifyListener</code> interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #removeVerifyListener * * @since 3.3 */ public void addVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.Verify, typedListener); }
Example #21
Source File: CustomCombo.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Removes the listener from the collection of listeners who will be * notified when the control is verified. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not * called from the thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #addVerifyListener * * @since 3.3 */ public void removeVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Verify, listener); }
Example #22
Source File: AbstractCombo.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will * be notified when the receiver's text is verified, by sending * it one of the messages defined in the <code>VerifyListener</code> * interface. * * @param listener the listener which should be notified * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @see VerifyListener * @see #removeVerifyListener */ public void addVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.Verify, typedListener); }
Example #23
Source File: TableCombo.java From Pydev with Eclipse Public License 1.0 | 3 votes |
/** * Removes the listener from the collection of listeners who will * be notified when the control is verified. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #addVerifyListener * * @since 3.3 */ public void removeVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Verify, listener); }
Example #24
Source File: TableCombo.java From Pydev with Eclipse Public License 1.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will * be notified when the receiver's text is verified, by sending * it one of the messages defined in the <code>VerifyListener</code> * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #removeVerifyListener * * @since 3.3 */ public void addVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.Verify, typedListener); }
Example #25
Source File: AbstractCombo.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Removes the listener from the collection of listeners who will * be notified when the control is verified. * * @param listener the listener which should no longer be notified * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @see VerifyListener * @see #addVerifyListener */ public void removeVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Verify, listener); }
Example #26
Source File: TableCombo.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will be notified when * the receiver's text is verified, by sending it one of the messages defined in * the <code>VerifyListener</code> interface. * * @param listener * the listener which should be notified * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #removeVerifyListener * * @since 3.3 */ public void addVerifyListener(final VerifyListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } final TypedListener typedListener = new TypedListener(listener); addListener(SWT.Verify, typedListener); }
Example #27
Source File: DataItemCombo.java From birt with Eclipse Public License 1.0 | 3 votes |
/** * Removes the listener from the collection of listeners who will be * notified when the control is verified. * * @param listener * the listener which should no longer be notified * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #addVerifyListener * * @since 3.3 */ public void removeVerifyListener( VerifyListener listener ) { checkWidget( ); if ( listener == null ) SWT.error( SWT.ERROR_NULL_ARGUMENT ); removeListener( SWT.Verify, listener ); }
Example #28
Source File: DataItemCombo.java From birt with Eclipse Public License 1.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will be notified * when the receiver's text is verified, by sending it one of the messages * defined in the <code>VerifyListener</code> interface. * * @param listener * the listener which should be notified * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see VerifyListener * @see #removeVerifyListener * * @since 3.3 */ public void addVerifyListener( VerifyListener listener ) { checkWidget( ); if ( listener == null ) SWT.error( SWT.ERROR_NULL_ARGUMENT ); TypedListener typedListener = new TypedListener( listener ); addListener( SWT.Verify, typedListener ); }
Example #29
Source File: TableCombo.java From tmxeditor8 with GNU General Public License v2.0 | 3 votes |
/** * Removes the listener from the collection of listeners who will be notified when the control is verified. * @param listener * the listener which should no longer be notified * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @see VerifyListener * @see #addVerifyListener * @since 3.3 */ public void removeVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Verify, listener); }
Example #30
Source File: TableCombo.java From tmxeditor8 with GNU General Public License v2.0 | 3 votes |
/** * Adds the listener to the collection of listeners who will be notified when the receiver's text is verified, by * sending it one of the messages defined in the <code>VerifyListener</code> interface. * @param listener * the listener which should be notified * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @see VerifyListener * @see #removeVerifyListener * @since 3.3 */ public void addVerifyListener(VerifyListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.Verify, typedListener); }