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

The following examples show how to use org.eclipse.swt.widgets.Text#setTextLimit() . 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: TexlipseProjectPropertyPage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create a text field for language setting.
 * @param parent parent component
 */
private void addLangSection(Composite parent) {
    
    Label descr = new Label(parent, SWT.LEFT | SWT.WRAP);
    descr.setLayoutData(new GridData());
    descr.setText(TexlipsePlugin.getResourceString("propertiesLanguageDescription"));
    
    Composite composite = createDefaultComposite(parent, 2);
    
    Label label = new Label(composite, SWT.LEFT);
    label.setLayoutData(new GridData());
    label.setText(TexlipsePlugin.getResourceString("propertiesLanguage"));
    
    languageField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    languageField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    languageField.setTextLimit(2);
    new AutoCompleteField(languageField, new TextContentAdapter(), Locale.getISOLanguages());
}
 
Example 2
Source File: FiltersDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createMaxCallDepthArea(Composite parent) {
      Composite composite= new Composite(parent, SWT.NONE);
      composite.setFont(parent.getFont());
      GridLayout layout = new GridLayout();
      layout.numColumns = 2;
      composite.setLayout(layout);

      Label label= new Label(composite, SWT.NONE);
      label.setFont(composite.getFont());
label.setText(CallHierarchyMessages.FiltersDialog_maxCallDepth);

      fMaxCallDepth = new Text(composite, SWT.SINGLE | SWT.BORDER);
      fMaxCallDepth.setFont(composite.getFont());
      fMaxCallDepth.setTextLimit(6);
      fMaxCallDepth.addModifyListener(new ModifyListener() {
              public void modifyText(ModifyEvent e) {
                  validateInput();
              }
          });

      GridData gridData = new GridData();
      gridData.widthHint = convertWidthInCharsToPixels(10);
      fMaxCallDepth.setLayoutData(gridData);
  }
 
Example 3
Source File: RolesWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDescriptionField(final Group group) {
    final Label descriptionLabel = new Label(group, SWT.NONE);
    descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create());
    descriptionLabel.setText(Messages.description);

    final Text roleDescriptionText = new Text(group, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    roleDescriptionText
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 80).create());
    roleDescriptionText.setMessage(Messages.descriptionHint);
    roleDescriptionText.setTextLimit(255);

    final IObservableValue roleDescriptionValue = EMFObservables.observeDetailValue(Realm.getDefault(),
            roleSingleSelectionObservable, OrganizationPackage.Literals.ROLE__DESCRIPTION);
    context.bindValue(SWTObservables.observeText(roleDescriptionText, SWT.Modify), roleDescriptionValue);
    roleDescriptionValue.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(final ValueChangeEvent event) {
            handleRoleDescriptionChange(event);
        }
    });
}
 
Example 4
Source File: AddMultiplikatorDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout(2, false));
	Label l1 = new Label(ret, SWT.NONE);
	l1.setText(Messages.AccountView_date);
	dpc = new CDateTime(ret, CDT.HORIZONTAL | CDT.DATE_SHORT | CDT.DROP_DOWN | SWT.BORDER | CDT.TAB_FIELDS);
	String value = java.time.LocalDate.now().format(DateTimeFormatter.ofPattern("01.01.y"));
	dpc.setSelection(new TimeTool(value).getTime());
	dpc.setToolTipText(Messages.MultiplikatorEditor_PleaseEnterBeginDate);
	Label label = new Label(ret, SWT.NONE);
	label.setText(Messages.Leistungscodes_multiplierLabel);
	multi = new Text(ret, SWT.BORDER);
	multi.setTextLimit(6);
	multi.setToolTipText(Messages.MultiplikatorEditor_NewMultipilcator);
	multi.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return ret;
}
 
Example 5
Source File: BasePanel.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
protected Text createTextWidget(Composite composite, int value) {
	final Text txt = new Text(composite, SWT.BORDER);
	txt.setText(String.valueOf(value));
	txt.setTextLimit(4);
	final GridData gd = new GridData(GridData.FILL, GridData.CENTER, false, false);
	gd.minimumWidth = 40;
	txt.setLayoutData(gd);
	return txt;
}
 
Example 6
Source File: NebulaSliderSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static Text createTextWidget(Shell shell, int value) {
	final Text txt = new Text(shell, SWT.BORDER);
	txt.setText(String.valueOf(value));
	txt.setTextLimit(3);
	final GridData gd = new GridData(GridData.FILL, GridData.CENTER, false, false);
	gd.minimumWidth = 40;
	txt.setLayoutData(gd);
	return txt;
}
 
Example 7
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Text addLabelledTextField( Composite parent, String label,
		Key key, int textlimit, int indent, boolean dummy )
{
	PixelConverter pixelConverter = new PixelConverter( parent );

	Label labelControl = new Label( parent, SWT.WRAP );
	labelControl.setText( label );
	labelControl.setLayoutData( new GridData( ) );

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

	fLabels.put( textBox, labelControl );

	String currValue = getValue( key );
	if ( currValue != null )
	{
		textBox.setText( currValue );
	}
	textBox.addModifyListener( getTextModifyListener( ) );

	GridData data = new GridData( GridData.HORIZONTAL_ALIGN_FILL );
	if ( textlimit != 0 )
	{
		textBox.setTextLimit( textlimit );
		data.widthHint = pixelConverter.convertWidthInCharsToPixels( textlimit + 1 );
	}
	data.horizontalIndent = indent;
	data.horizontalSpan = 2;
	textBox.setLayoutData( data );

	fTextBoxes.add( textBox );
	return textBox;
}
 
Example 8
Source File: CustomUserInformationDefinitionNameEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
    final TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
    final Text textControl = (Text) textCellEditor.getControl();
    textControl.setTextLimit(CUSTOM_USER_DEFINITION_NAME_SIZE);
    return textCellEditor;
}
 
Example 9
Source File: CustomerUserInformationDefinitionDescriptionEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CellEditor getCellEditor(Object arg0) {
       TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
       Text textControl = (Text) textCellEditor.getControl();
       textControl.setTextLimit(255);
       return textCellEditor;
}
 
Example 10
Source File: ParametersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createDescription(final Composite parent) {
    final Label descriptionLabel = new Label(parent, SWT.NONE);
    descriptionLabel.setText(Messages.parameterDescription);
    descriptionLabel.setLayoutData(GridDataFactory.fillDefaults()
            .align(SWT.END, SWT.TOP).create());

    descriptionText = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP
            | SWT.V_SCROLL);
    descriptionText.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, false).hint(SWT.DEFAULT, 70).create());
    descriptionText.setTextLimit(255);
    dataBindingContext.bindValue(WidgetProperties.text(SWT.Modify).observe(descriptionText),
            EMFObservables.observeValue(parameterWorkingCopy, ParameterPackage.Literals.PARAMETER__DESCRIPTION));
}
 
Example 11
Source File: TextFieldExt.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Text createText(Composite parent) {
	Text text = super.createText(parent);
	text.setTextLimit(textLimit);
	return text;
}
 
Example 12
Source File: EigenleistungDetailDisplay.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public Composite createDisplay(Composite parent, IViewSite site){
	Composite ret = new Composite(parent, SWT.None);
	ret.setLayout(new GridLayout(2, false));
	
	Label lblCode = new Label(ret, SWT.NONE);
	lblCode.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblCode.setText("Kürzel (Code)");
	
	textCode = new Text(ret, SWT.BORDER);
	textCode.setData("TEST_COMP_NAME", "EigenleistungDetailCode_txt"); //$NON-NLS-1$
	textCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textCode.setTextLimit(20);
	textCode.setEditable(false);
	
	Label lblBezeichnung = new Label(ret, SWT.NONE);
	lblBezeichnung.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblBezeichnung.setText("Bezeichnung");
	
	textBezeichnung = new Text(ret, SWT.BORDER | SWT.MULTI);
	textBezeichnung.setData("TEST_COMP_NAME", "EigenleistungDetailName_txt"); //$NON-NLS-1$
	textBezeichnung.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textBezeichnung.setTextLimit(80);
	textBezeichnung.setEditable(false);
	
	Label lblEKP = new Label(ret, SWT.NONE);
	lblEKP.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblEKP.setText("Einkaufspreis (Rp.)");
	
	textEKP = new Text(ret, SWT.BORDER);
	textEKP.setData("TEST_COMP_NAME", "EigenleistungDetailEKP_txt"); //$NON-NLS-1$
	textEKP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textEKP.setTextLimit(6);
	textEKP.setEditable(false);
	
	Label lblVKP = new Label(ret, SWT.NONE);
	lblVKP.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblVKP.setText("Verkaufspreis (Rp.)");
	
	textVKP = new Text(ret, SWT.BORDER);
	textVKP.setData("TEST_COMP_NAME", "EigenleistungDetailVKP_txt"); //$NON-NLS-1$
	textVKP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textVKP.setTextLimit(6);
	textVKP.setEditable(false);
	
	Label lblZeit = new Label(ret, SWT.NONE);
	lblZeit.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblZeit.setText("Zeitbedarf");
	
	textZeit = new Text(ret, SWT.BORDER);
	textZeit.setData("TEST_COMP_NAME", "EigenleistungDetailZeit_txt"); //$NON-NLS-1$
	textZeit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textZeit.setTextLimit(4);
	textZeit.setEditable(false);
	return null;
}
 
Example 13
Source File: PatientAddressPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent){
	init();
	Composite comp = new Composite(parent, SWT.None);
	comp.setLayout(new GridLayout(2, false));
	
	Label lblNewLabel = new Label(comp, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblNewLabel.setText("Strasse");
	
	textStrasse = new Text(comp, SWT.BORDER);
	textStrasse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textStrasse.setTextLimit(80);
	
	Label lblPostleitzahl = new Label(comp, SWT.NONE);
	lblPostleitzahl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblPostleitzahl.setText("Postleitzahl");
	
	textPostleitzahl = new Text(comp, SWT.BORDER);
	textPostleitzahl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textPostleitzahl.setTextLimit(6);
	
	Label lblOrtschaft = new Label(comp, SWT.NONE);
	lblOrtschaft.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblOrtschaft.setText("Ortschaft");
	
	textOrtschaft = new Text(comp, SWT.BORDER);
	textOrtschaft.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textOrtschaft.setTextLimit(50);
	
	Label lblLand = new Label(comp, SWT.NONE);
	lblLand.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblLand.setText("Land");
	
	countryComboViewer = new TableComboViewer(comp);
	TableCombo tableCombo = countryComboViewer.getTableCombo();
	tableCombo.setTableWidthPercentage(90);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	countryComboViewer.setLabelProvider(new CountryComboLabelProvider());
	countryComboViewer.setContentProvider(new ArrayContentProvider());
	Country[] items = new Country[] {
		Country.CH, Country.LI, Country.AT, Country.DE, Country.FR, Country.IT
	};
	countryComboViewer.setInput(items);
	
	super.setTitle(pat.getLabel());
	textStrasse.setText(pat.getStreet());
	textPostleitzahl.setText(pat.getZip());
	textOrtschaft.setText(pat.getCity());
	countryComboViewer.setSelection(new StructuredSelection(pat.getCountry()));
	
	setUnlocked(LocalLockServiceHolder.get().isLocked(pat));
	
	return comp;
}
 
Example 14
Source File: PagesDialog.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param parent The paren composite
 */
public TextArea(Composite parent) {
    fText = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.RIGHT);
    fText.setTextLimit(10);
}