org.eclipse.swt.widgets.Text#addModifyListener ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Text#addModifyListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: texlipse   文件: TexlipseProjectPropertyPage.java
/**
 * Create project main file section of the page.
 * @param parent parent component
 */
private void addOutSection(Composite parent) {
    Composite composite = createDefaultComposite(parent, 2);

    //Label for path field
    Label pathLabel = new Label(composite, SWT.NONE);
    pathLabel.setText(TexlipsePlugin.getResourceString("propertiesOutFileLabel"));
    pathLabel.setLayoutData(new GridData());
    pathLabel.setToolTipText(TexlipsePlugin.getResourceString("propertiesOutFileTooltip"));
    
    // Path text field
    outFileField = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.BORDER);
    outFileField.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    outFileField.setToolTipText(TexlipsePlugin.getResourceString("propertiesOutFileTooltip"));
    outFileField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateOutputFileField();
        }});
}
 
源代码2 项目: codeexamples-eclipse   文件: SamplePart.java
@PostConstruct
public void createComposite(Composite parent) {
	parent.setLayout(new GridLayout(1, false));

	txtInput = new Text(parent, SWT.BORDER);
	txtInput.setMessage("Enter text to mark part as dirty");
	txtInput.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			dirty.setDirty(true);
		}
	});
	txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	tableViewer = new TableViewer(parent);

	tableViewer.add("Sample item 1");
	tableViewer.add("Sample item 2");
	tableViewer.add("Sample item 3");
	tableViewer.add("Sample item 4");
	tableViewer.add("Sample item 5");
	tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
}
 
源代码3 项目: birt   文件: CrosstabBindingDialogHelper.java
private void createCommonSection( Composite composite )
{
	new Label( composite, SWT.NONE ).setText( EXPRESSION );
	txtExpression = new Text( composite, SWT.BORDER | SWT.MULTI );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	gd.horizontalSpan = 2;
	gd.heightHint = txtExpression.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y
			- txtExpression.getBorderWidth( )
			* 2;
	txtExpression.setLayoutData( gd );
	createExpressionButton( composite, txtExpression );
	txtExpression.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			modifyDialogContent( );
			validate( );
		}

	} );
}
 
源代码4 项目: offspring   文件: IssueAssetWizard.java
@Override
public Control createControl(Composite parent) {
  Composite comp = new Composite(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp);

  textDescr = new Text(comp, SWT.BORDER | SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .hint(SWT.DEFAULT, 100).applyTo(textDescr);

  textDescr.setText("");
  textDescr.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return comp;
}
 
源代码5 项目: offspring   文件: CancelBuyOrderWizard.java
@Override
public Control createControl(Composite parent) {
  Composite comp = new Composite(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp);

  textDescr = new Text(comp, SWT.BORDER | SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .hint(SWT.DEFAULT, 100).applyTo(textDescr);

  textDescr.setText("");
  textDescr.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return comp;
}
 
源代码6 项目: olca-app   文件: Dialog.java
private void activityRow(Composite body, FormToolkit tk) {
	String label = M.ActivityVariable;
	if (aspect.indicator.activityVariable != null)
		label += " (" + aspect.indicator.activityVariable + ")";
	Text t = UI.formText(body, tk, label);
	t.setText(Double.toString(aspect.activityValue));
	t.addModifyListener(e -> {
		try {
			double d = Double.parseDouble(t.getText());
			aspect.activityValue = d;
		} catch (Exception ex) {
		}
	});
	String unit = "";
	if (aspect.indicator.activityUnit != null)
		unit = aspect.indicator.activityUnit.name;
	UI.formLabel(body, tk, unit);
}
 
源代码7 项目: Rel   文件: Expression.java
@Override
protected void buildControlPanel(Composite container) {
	container.setLayout(new GridLayout(2, false));

	Label label = new Label(container, SWT.None);
	label.setText("Expression:");

	Text expression = new Text(container, SWT.None);
	expression.setText(operatorLabel.getText());
	expression.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	expression.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			operatorLabel.setText(expression.getText());
			Expression.this.pack();
		}
	});
}
 
源代码8 项目: bonita-studio   文件: FileStoreSelectDialog.java
private void createFilter(final Composite listComposite) {
    final Text fileStoreListFilter = new Text(listComposite,
            SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    fileStoreListFilter.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    fileStoreListFilter.setMessage(WorkbenchMessages.FilteredTree_FilterMessage);
    fileStoreListFilter.addModifyListener(new ModifyListener() {

        private ViewerFilter filter;

        @Override
        public void modifyText(final ModifyEvent e) {
            final String textForFiltering = fileStoreListFilter.getText();
            if (filter != null) {
                fileStoreListViewer.removeFilter(filter);
            }
            if (textForFiltering != null
                    && !textForFiltering.isEmpty()) {
                filter = new ViewerFilterOnFileStoreName(textForFiltering);
                fileStoreListViewer.addFilter(filter);
            }

        }
    });
}
 
源代码9 项目: offspring   文件: SendMessageWizard.java
@Override
public Control createControl(Composite parent) {
  textRecipient = new Text(parent, SWT.BORDER);
  textRecipient.setMessage("account number");
  if (accountId != null)
    textRecipient.setText(Convert.toUnsignedLong(accountId));
  else
    textRecipient.setText("");
  textRecipient.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return textRecipient;
}
 
源代码10 项目: hadoop-gpu   文件: HadoopLocationWizard.java
/**
 * Create a SWT Text component for the given {@link ConfProp} text
 * configuration property.
 * 
 * @param listener
 * @param parent
 * @param prop
 * @return
 */
private Text createConfText(ModifyListener listener, Composite parent,
    ConfProp prop) {

  Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  text.setLayoutData(data);
  text.setData("hProp", prop);
  text.setText(location.getConfProp(prop));
  text.addModifyListener(listener);

  return text;
}
 
@Override
protected void createOptions(IFormatterControlManager manager, Composite parent)
{
	Group group = SWTFactory.createGroup(parent,
			Messages.HTMLFormatterIndentationTabPage_indentationGeneralGroupLabel, 2, 1, GridData.FILL_HORIZONTAL);
	final Combo tabOptions = manager.createCombo(group, HTMLFormatterConstants.FORMATTER_TAB_CHAR,
			FormatterMessages.IndentationTabPage_general_group_option_tab_policy, tabOptionItems, tabOptionNames);
	final Text indentationSize = manager.createNumber(group, HTMLFormatterConstants.FORMATTER_INDENTATION_SIZE,
			FormatterMessages.IndentationTabPage_general_group_option_indent_size, 1);
	final Text tabSize = manager.createNumber(group, HTMLFormatterConstants.FORMATTER_TAB_SIZE,
			FormatterMessages.IndentationTabPage_general_group_option_tab_size, 1);
	tabSize.addModifyListener(new ModifyListener()
	{
		public void modifyText(ModifyEvent e)
		{
			int index = tabOptions.getSelectionIndex();
			if (index >= 0)
			{
				final boolean tabMode = CodeFormatterConstants.TAB.equals(tabOptionItems[index]);
				if (tabMode)
				{
					indentationSize.setText(tabSize.getText());
				}
			}
		}
	});
	new TabOptionHandler(manager, tabOptions, indentationSize, tabSize);

	group = SWTFactory.createGroup(parent, Messages.HTMLFormatterTabPage_exclusionsGroupLabel, 1, 1,
			GridData.FILL_BOTH);
	Label exclutionLabel = new Label(group, SWT.WRAP);
	exclutionLabel.setText(Messages.HTMLFormatterIndentationTabPage_exclusionsMessage);
	manager.createManagedList(group, HTMLFormatterConstants.INDENT_EXCLUDED_TAGS);
}
 
源代码12 项目: xtext-eclipse   文件: ExtractVariableWizard.java
@Override
public void createControl(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.verticalSpacing = 16;
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	composite.setFont(parent.getFont());

	Label label= new Label(composite, SWT.NONE);
	label.setText("Variable name:");
	label.setFont(composite.getFont());
	label.setLayoutData(new GridData());

	nameField= new Text(composite, SWT.BORDER);
	nameField.setText(refactoring.getVariableName());
	nameField.setFont(composite.getFont());
	nameField.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
	nameField.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			validatePage();
		}
	});
	nameField.selectAll();
	
	finalButton = new Button(composite, SWT.CHECK);
	finalButton.setText("Declare as final 'val'");
	finalButton.setFont(composite.getFont());
	finalButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
	finalButton.setSelection(refactoring.isFinal());
	setControl(composite);
	validatePage();
}
 
源代码13 项目: offspring   文件: CancelBuyOrderWizard.java
@Override
public Control createControl(Composite parent) {
  textName = new Text(parent, SWT.BORDER);
  textName.setText("");
  textName.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return textName;
}
 
源代码14 项目: Pydev   文件: TextInputWizardPage.java
protected Text createTextInputField(Composite parent, int style) {
    fTextField = new Text(parent, style);
    fTextField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            textModified(getText());
        }
    });
    fTextField.setText(fInitialValue);
    return fTextField;
}
 
/**
 * Add a modify listener that triggers whenever a text within this component is modified.
 */
public void addModifyListener(ModifyListener listener) {
  textModifyListeners.add(listener);
  for (Text text : texts.values()) {
    text.addModifyListener(listener);
  }
}
 
源代码16 项目: google-cloud-eclipse   文件: AppEngineWizardPage.java
private void createServiceField(Composite parent) {
  Label serviceNameLabel = new Label(parent, SWT.LEAD);
  serviceNameLabel.setText(Messages.getString("app.engine.service")); //$NON-NLS-1$
  serviceNameField = new Text(parent, SWT.BORDER);
  serviceNameField.setMessage("default"); //$NON-NLS-1$
  serviceNameField.addModifyListener(event -> revalidate());
}
 
源代码17 项目: Rel   文件: Summarize.java
private void addRow(Composite parent, Aggregate r) {
	Text as = new Text(parent, SWT.NONE);
	as.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	as.setText(r.getAs());
	as.addModifyListener(e -> r.setAs(as.getText()));

	new Label(parent, SWT.None);

	Combo aggOps = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);

	Text expression1 = new Text(parent, SWT.NONE);
	expression1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	expression1.setText(r.getExpression1());
	expression1.addModifyListener(e -> r.setExpression1(expression1.getText()));

	Text expression2 = new Text(parent, SWT.NONE);
	expression2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	expression2.setText(r.getExpression2());
	expression2.addModifyListener(e -> r.setExpression2(expression2.getText()));

	int index = 0;
	for (AggOp op : aggregateOperators) {
		aggOps.add(op.getName());
		if (op.getName().equals(r.getAggOpName())) {
			aggOps.select(index);
			setRowVisibility(index, expression1, expression2);
		}
		index++;
	}
	aggOps.addModifyListener(e -> {
		int selected = aggOps.getSelectionIndex();
		r.setAggOpName(aggOps.getText());
		setRowVisibility(selected, expression1, expression2);
	});
}
 
protected Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) {
	Label labelControl= new Label(parent, SWT.WRAP);
	labelControl.setText(label);
	labelControl.setFont(JFaceResources.getDialogFont());
	GridData gd= new GridData();
	gd.horizontalIndent= indent;
	labelControl.setLayoutData(gd);

	Text textBox= new Text(parent, SWT.BORDER | SWT.SINGLE);
	textBox.setData(key);

	makeScrollableCompositeAware(textBox);

	fLabels.put(textBox, labelControl);

	updateText(textBox);
	
	textBox.addModifyListener(getTextModifyListener());

	GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	if (widthHint != 0) {
		data.widthHint= widthHint;
	}
	data.horizontalSpan= 2;
	textBox.setLayoutData(data);

	fTextBoxes.add(textBox);
	return textBox;
}
 
源代码19 项目: pentaho-kettle   文件: LabelTimeComposite.java
public LabelTimeComposite( Composite composite, String labelText, String toolTipText ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  int middle = props.getMiddlePct();
  int threeQuarters = ( middle + 100 ) / 2;
  int margin = Const.MARGIN;

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  formLayout.marginTop = 0;
  formLayout.marginBottom = 0;

  this.setLayout( formLayout );

  wText = new Text( this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( threeQuarters, 0 );
  wText.setLayoutData( fdText );
  wText.setToolTipText( toolTipText );

  wTimeUnit = new CCombo( this, SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER | SWT.LEFT );
  FormData fdCombo = new FormData();
  fdCombo.left = new FormAttachment( threeQuarters, margin );
  fdCombo.right = new FormAttachment( 100, 0 );
  wTimeUnit.setEditable( false );
  wTimeUnit.setLayoutData( fdCombo );
  wTimeUnit.setItems( getTimeUnits() );
  wTimeUnit.setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );

  wText.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      if ( !StringUtils.isNumeric( wText.getText() ) ) {
        wText.setText( lastValidValue );
      } else {
        lastValidValue = wText.getText();
      }
    }
  } );
}
 
源代码20 项目: gwt-eclipse-plugin   文件: GWTJUnitSettingsTab.java
protected void createGWTJUnitSettingsComponent(Composite parent) {
  Group group = SWTFactory.createGroup(parent, "GWT JUnit Settings", 2, 1,
      GridData.FILL_HORIZONTAL);

  SWTFactory.createLabel(group, "Log level:", 1);
  logLevelComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  logLevelComboViewer.setContentProvider(new ArrayContentProvider());
  logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS);
  // logLevelComboViewer.setSelection(new StructuredSelection("DEBUG"));
  logLevelComboViewer.addSelectionChangedListener(settingChangedListener);

  SWTFactory.createLabel(group, "Output style:", 1);
  outputStyleComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  outputStyleComboViewer.setContentProvider(new ArrayContentProvider());
  outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  outputStyleComboViewer.setInput(GWTLaunchConstants.OUTPUT_STYLES);
  // outputStyleComboViewer.setSelection(new StructuredSelection("PRETTY"));
  outputStyleComboViewer.addSelectionChangedListener(settingChangedListener);

  notHeadlessButton = SWTFactory.createCheckButton(group,
      "Display the log window and browser windows (useful for debugging)",
      null, true, 2);
  notHeadlessButton.addSelectionListener(settingChangedListener);

  webModeButton = SWTFactory.createCheckButton(group,
      "Run tests in production mode", null, false, 2);
  webModeButton.addSelectionListener(settingChangedListener);

  standardsModeButton = SWTFactory.createCheckButton(group,
      "Use standards mode", null, false, 2);
  standardsModeButton.addSelectionListener(settingChangedListener);
  GridData standardsModeButtonData = new GridData(SWT.BEGINNING,
      SWT.BEGINNING, false, false, 2, 1);
  standardsModeButton.setLayoutData(standardsModeButtonData);

  SWTFactory.createLabel(group, "Output directory:", 1);
  outputDirectoryField = new Text(group, SWT.BORDER);
  outputDirectoryField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  outputDirectoryField.addModifyListener(settingChangedListener);
}