Java Code Examples for org.eclipse.swt.widgets.Text.addKeyListener()

The following are Jave code examples for showing how to use addKeyListener() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: eclipse-batch-editor   File: AbstractFilterableTreeQuickDialog.java   Source Code and License Vote up 6 votes
@Override
protected Control createTitleControl(Composite parent) {
	text = new Text(parent, SWT.NONE);

	GridData textLayoutData = new GridData();
	textLayoutData.horizontalAlignment = GridData.FILL;
	textLayoutData.verticalAlignment = GridData.FILL;
	textLayoutData.grabExcessHorizontalSpace = true;
	textLayoutData.grabExcessVerticalSpace = false;
	textLayoutData.horizontalSpan = 2;

	text.setLayoutData(textLayoutData);

	text.addKeyListener(new FilterKeyListener());

	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(DO_SHOW_DIALOG ? 1 : 2, 1)
			.applyTo(text);

	return text;
}
 
Example 2
Project: neoscada   File: FilterFreeFormComposite.java   Source Code and License Vote up 6 votes
private void createComponents ()
{
    final FillLayout layout = new FillLayout ( SWT.VERTICAL );
    layout.marginHeight = 12;
    layout.marginWidth = 12;
    setLayout ( layout );

    final Text filterTextField = new Text ( this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL );
    filterTextField.setText ( this.filter );
    filterTextField.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            verifyFilter ( filterTextField.getText () );
        }
    } );
}
 
Example 3
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License Vote up 6 votes
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 4
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License Vote up 6 votes
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 5
Project: convertigo-eclipse   File: KTableCellEditorMultilineWrapText.java   Source Code and License Vote up 6 votes
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;
}
 
Example 6
Project: convertigo-eclipse   File: KTableCellEditorText.java   Source Code and License Vote up 6 votes
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;
}
 
Example 7
Project: convertigo-eclipse   File: KTableCellEditorMultilineText.java   Source Code and License Vote up 6 votes
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;
}
 
Example 8
Project: eclipse-bash-editor   File: AbstractFilterableTreeQuickDialog.java   Source Code and License Vote up 6 votes
@Override
protected Control createTitleControl(Composite parent) {
	text = new Text(parent, SWT.NONE);

	GridData textLayoutData = new GridData();
	textLayoutData.horizontalAlignment = GridData.FILL;
	textLayoutData.verticalAlignment = GridData.FILL;
	textLayoutData.grabExcessHorizontalSpace = true;
	textLayoutData.grabExcessVerticalSpace = false;
	textLayoutData.horizontalSpan = 2;

	text.setLayoutData(textLayoutData);

	text.addKeyListener(new FilterKeyListener());

	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(DO_SHOW_DIALOG ? 1 : 2, 1)
			.applyTo(text);

	return text;
}
 
Example 9
Project: avro-schema-editor   File: TextValidator.java   Source Code and License Vote up 5 votes
public TextValidator(Text control, int position, IInputValidator validator, IValueChangeListener valueChangeListener) {
    this.validator = validator;
    this.valueChangeListener = valueChangeListener;
    this.deco = new ControlDecoration(control, position, control.getParent());
    this.deco.setMarginWidth(2);
    this.errorImg = AvroSchemaEditorActivator.getImage(AvroSchemaEditorImages.ERROR_OVERLAY);
    control.addModifyListener(this);
    control.addFocusListener(this);
    control.addKeyListener(this);
}