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

The following are Jave code examples for showing how to use addListener() 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: Hydrograph   File: FilterConditionsDialog.java   Source Code and License Vote up 6 votes
private Text addTextBoxInTable(TableViewer tableViewer, TableItem tableItem, String textBoxName, 
		String valueTextPane, String editorName, int columnIndex, Listener listener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Text text = new Text(buttonPane, SWT.NONE);
	text.addListener(SWT.Modify, listener);
	text.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(textBoxName, text);
	tableItem.setData(valueTextPane, buttonPane);
	//text.addModifyListener(FilterHelper.INSTANCE.getTextModifyListener());
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	text.setData(editorName, editor);
	return text;
}
 
Example 2
Project: gemoc-studio-modeldebugging   File: AskLanguageNameWizardPage.java   Source Code and License Vote up 5 votes
@Override
public void createControl(Composite parent) {
       // project specification group
       Composite composite = new Composite(parent, SWT.NONE);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

       // new project label
       Label label = new Label(composite, SWT.NONE);
       label.setText("Language name");
       label.setFont(parent.getFont());

       // new project name entry field
       _nameField = new Text(composite, SWT.BORDER);
       GridData data = new GridData(GridData.FILL_HORIZONTAL);
       data.widthHint = SIZING_TEXT_FIELD_WIDTH;
       _nameField.setLayoutData(data);
       _nameField.setFont(parent.getFont());

       // Set the initial value first before listener
       // to avoid handling an event during the creation.
       if (_initialLanguageName != null) {
		_nameField.setText(_initialLanguageName);
	}
       _nameField.addListener(SWT.Modify, nameModifyListener);
       BidiUtils.applyBidiProcessing(_nameField, BidiUtils.BTD_DEFAULT);	
       setControl(composite);
}
 
Example 3
Project: Hydrograph   File: FTPWidgetUtility.java   Source Code and License Vote up 5 votes
/**
 * Validate text
 * @param text
 */
public void validateWidgetText(Text text, PropertyDialogButtonBar propertyDialogButtonBar, Cursor cursor,
		ControlDecoration controlDecoration) {
	controlDecoration.setMarginWidth(2);
	ModifyAlphaNumbericTextListener alphaNumbericTextListener = new ModifyAlphaNumbericTextListener();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, controlDecoration);
	text.addListener(SWT.Modify, alphaNumbericTextListener.getListener(propertyDialogButtonBar, helper, text));
}
 
Example 4
Project: Hydrograph   File: FTPWidgetUtility.java   Source Code and License Vote up 5 votes
/**
 * @param text
 * @param propertyDialogButtonBar
 * @param cursor
 */
public void validateEmptyWidgetText(Text text, PropertyDialogButtonBar propertyDialogButtonBar, Cursor cursor, 
		ControlDecoration controlDecoration){
	controlDecoration.setMarginWidth(2);
	ELTModifyListener eltModifyListener = new ELTModifyListener();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, controlDecoration);
	text.addListener(SWT.Modify, eltModifyListener.getListener(propertyDialogButtonBar, helper, text));
}
 
Example 5
Project: Hydrograph   File: OutputAdditionalParametersDialog.java   Source Code and License Vote up 5 votes
private void addListenerToAdditionalParameter(Text additionalParameterTextBox) {
	ExtraURLParameterValidationForDBComponents extraURLParameterValidation = new ExtraURLParameterValidationForDBComponents();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, additionalParameterControlDecoration);
	additionalParameterTextBox.addListener(SWT.Modify,extraURLParameterValidation.getListener(propertyDialogButtonBar, helper, additionalParameterTextBox));
	
}
 
Example 6
Project: Hydrograph   File: InputAdditionalParametersDialog.java   Source Code and License Vote up 5 votes
private void addValidationToAdditionalParameterWidget(Text additionalParameterTextBox,
		ControlDecoration additionalParameterControlDecoration) {

	ExtraURLParameterValidationForDBComponents extraURLParameterValidation = new ExtraURLParameterValidationForDBComponents();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, additionalParameterControlDecoration);
	additionalParameterTextBox.addListener(SWT.Modify,
			extraURLParameterValidation.getListener(propertyDialogButtonBar, helper, additionalParameterTextBox));
}
 
Example 7
Project: Hydrograph   File: InputAdditionalParametersDialog.java   Source Code and License Vote up 5 votes
private void addValidationToWidgets(Text textBox, ControlDecoration txtDecorator) {
	VerifyNumericAndParameterForDBComponents numericValidationForDBComponents = new VerifyNumericAndParameterForDBComponents();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, txtDecorator);

	textBox.addListener(SWT.Modify,
			numericValidationForDBComponents.getListener(propertyDialogButtonBar, helper, textBox));
}
 
Example 8
Project: Hydrograph   File: WorksheetWidget.java   Source Code and License Vote up 5 votes
private void attachListeners(Text textBox) {

		ListenerHelper helper = new ListenerHelper();
		helper.put(HelperType.CONTROL_DECORATION, txtDecorator);
		textBox.addListener(SWT.CHANGED,
				new ELTEventChangeListener().getListener(propertyDialogButtonBar, helper, textBox));
		textBox.addListener(SWT.Modify, new ELTModifyListener().getListener(propertyDialogButtonBar, helper, textBox));
		textBox.addListener(SWT.FocusIn, new FocusInListener().getListener(propDialogButtonBar, helper, textBox));
		textBox.addListener(SWT.FocusOut,
				new ELTNormalFocusOutListener().getListener(propDialogButtonBar, helper, textBox));
	}
 
Example 9
Project: Hydrograph   File: OutputAdditionalParametersDialog.java   Source Code and License Vote up 4 votes
private void addListenerToChunkSize(Text chunkSizeTextBox) {
	VerifyNumericAndParameterForDBComponents numericValidationForDBComponents = new VerifyNumericAndParameterForDBComponents();
	ListenerHelper helper = new ListenerHelper();
	helper.put(HelperType.CONTROL_DECORATION, controlDecoration);
	chunkSizeTextBox.addListener(SWT.Modify,numericValidationForDBComponents.getListener(propertyDialogButtonBar, helper, chunkSizeTextBox));
}
 
Example 10
Project: BiglyBT   File: PasswordParameter.java   Source Code and License Vote up 4 votes
public
 PasswordParameter(
 	Composite 		composite,
final String 	name,
final int		encoding )
 {
 	super(name);
   this.name = name;
   inputField = new Text(composite, SWT.BORDER);
   inputField.setEchoChar('*');
   byte[] value = COConfigurationManager.getByteParameter(name, "".getBytes());
   if(value.length > 0)
     inputField.setText("***");
   inputField.addListener(SWT.Modify, new Listener() {
     @Override
     public void handleEvent(Event event) {
       try{
         String	password_string = inputField.getText();

         byte[] password = password_string.getBytes();
         byte[] encoded;
         if(password.length > 0 ){
       	  if ( encoding == com.biglybt.pif.ui.config.PasswordParameter.ET_PLAIN ){

       		 encoded = password;

       	  }else if ( encoding == com.biglybt.pif.ui.config.PasswordParameter.ET_SHA1 ){

      	         SHA1Hasher hasher = new SHA1Hasher();

      	         encoded = hasher.calculateHash(password);

       	  }else{

       		  	// newly added, might as well go for UTF-8

       		 encoded = MessageDigest.getInstance( "md5").digest( password_string.getBytes( "UTF-8" ));
       	  }
         }else{
           encoded = password;
         }

         COConfigurationManager.setParameter(name, encoded);
       } catch(Exception e) {
       	Debug.printStackTrace( e );
       }
     }
   });
 }