org.eclipse.swt.widgets.Text Java Examples

The following examples show how to use org.eclipse.swt.widgets.Text. 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 Project: erflute   Author: dbflute-session   File: ModelPropertiesDialog.java    License: Apache License 2.0 7 votes vote down vote up
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }
    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
 
Example #2
private Text addFieldNameField(Composite result) {
	Label nameLabel= new Label(result, SWT.NONE);
	nameLabel.setText(RefactoringMessages.ConvertAnonymousToNestedInputPage_class_name);
	nameLabel.setLayoutData(new GridData());

	final Text classNameField= new Text(result, SWT.BORDER | SWT.SINGLE);
	classNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	classNameField.addModifyListener(new ModifyListener(){
		public void modifyText(ModifyEvent e) {
			ConvertAnonymousToNestedInputPage.this.getConvertRefactoring().setClassName(classNameField.getText());
			ConvertAnonymousToNestedInputPage.this.updateStatus();
		}
	});
	TextFieldNavigationHandler.install(classNameField);
	return classNameField;
}
 
Example #3
Source Project: nebula   Author: eclipse   File: LoginDialog.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build the password part of the box
 */
private void buildPassword() {
	final Label label = new Label(shell, SWT.NONE);
	final GridData gridData = new GridData(GridData.END, GridData.CENTER, false, false, 1, 1);
	gridData.horizontalIndent = 35;
	label.setLayoutData(gridData);
	label.setText(ResourceManager.getLabel(ResourceManager.PASSWORD));

	final Text text = new Text(shell, SWT.PASSWORD | SWT.BORDER);
	text.setText(password == null ? "" : password);
	text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
	text.addListener(SWT.Modify, e -> {
		password = text.getText();
		changeButtonOkState();
	});
}
 
Example #4
Source Project: n4js   Author: eclipse   File: DashboardComposite.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** {@code key} defines which data source will be used for display. */
public DashboardComposite(String key, Composite parent, int style) {
	super(parent, style);
	this.key = key;

	this.setLayout(new FillLayout());

	final SashForm sf = new SashForm(this, SWT.HORIZONTAL);
	sf.setLayout(new FillLayout());

	this.canvas = new VisualisationCanvas(sf, SWT.NONE);

	this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
	text.setText("");

	createVisualisationControls(sf);
	sf.setWeights(new int[] { 45, 45, 10 });
}
 
Example #5
Source Project: tm4e   Author: eclipse   File: GrammarInfoWidget.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void createUI(Composite ancestor) {
	Composite parent = new Composite(ancestor, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.marginLeft = 0;
	layout.marginRight = 0;
	parent.setLayout(layout);
	parent.setLayoutData(new GridData(GridData.FILL_BOTH));

	Label grammarNameLabel = new Label(parent, SWT.NONE);
	grammarNameLabel.setText(TMUIMessages.GrammarInfoWidget_name_text);
	nameText = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
	nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	Label grammarScopeNameLabel = new Label(parent, SWT.NONE);
	grammarScopeNameLabel.setText(TMUIMessages.GrammarInfoWidget_scopeName_text);
	scopeNameText = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
	scopeNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	Label grammarFileTypesLabel = new Label(parent, SWT.NONE);
	grammarFileTypesLabel.setText(TMUIMessages.GrammarInfoWidget_fileTypes_text);
	fileTypesText = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
	fileTypesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
 
Example #6
Source Project: Eclipse-Postfix-Code-Completion   Author: trylimits   File: TypeFilterInputDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);

	Composite inner= new Composite(composite, SWT.NONE);
	LayoutUtil.doDefaultLayout(inner, new DialogField[] { fNameDialogField }, true, 0, 0);

	int fieldWidthHint= convertWidthInCharsToPixels(60);
	Text text= fNameDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, fieldWidthHint);
	LayoutUtil.setHorizontalGrabbing(text);
	BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA);
	TextFieldNavigationHandler.install(text);

	fNameDialogField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);
	return composite;
}
 
Example #7
Source Project: texlipse   Author: eclipse   File: TexlipseProjectCreationWizardPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
   * Creates a list element containing available templates (system and user)
   * and a text area next to it for showing description about the selected template
   * 
   * @param composite the parent container
   */
  private void createTemplateControl(Composite composite) {
      // add list for templates
      templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadTemplateNames());
      templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
      templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip"));
      templateList.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
          	attributes.setTemplate(templateList.getSelection()[0]);
          	updateEntries();
          }});
      
      templateList.setSelection(0);
      // this has to be done, because setSelection() doesn't generate an event
      attributes.setTemplate(templateList.getItem(0));

      
      // add TextField for the selected template's description
      descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER);
      descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip"));
      descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH));
      descriptionField.setEditable(false);
  }
 
Example #8
Source Project: pentaho-kettle   Author: pentaho   File: JobHasDescriptionImportRuleComposite.java    License: Apache License 2.0 6 votes vote down vote up
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
  PropsUI props = PropsUI.getInstance();

  composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );
  composite.setLayout( new FillLayout() );

  Label label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( label );
  label.setText( "Minimum length: " );

  text = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( text );

  return composite;
}
 
Example #9
Source Project: offspring   Author: incentivetoken   File: CancelBuyOrderWizard.java    License: MIT License 6 votes vote down vote up
@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;
}
 
Example #10
Source Project: codewind-eclipse   Author: eclipse   File: CodewindPrefsParentPage.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private Text createCWTimeoutEntry(Composite comp, String label, String prefKey) {
    Label timeoutLabel = new Label(comp, SWT.NONE);
    timeoutLabel.setText(label);
    timeoutLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, false, false));
    
    Text text = new Text(comp, SWT.BORDER);
    text.setText(Integer.toString(prefs.getInt(prefKey)));
    GridData data = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
	data.widthHint = 50;
	text.setLayoutData(data);
	
	text.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent arg0) {
			validate();
		}
	});
	
    return text;
}
 
Example #11
Source Project: n4js   Author: eclipse   File: N4JSNewProjectWizardCreationPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void createVendorIdControls(DataBindingContext dbc, Composite parent) {
	final Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	final Label vendorIdLabel = new Label(composite, SWT.NONE);
	vendorIdLabel.setText("Vendor id:");

	Text vendorIdText = new Text(composite, SWT.BORDER);
	vendorIdText.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());

	projectInfo.addPropertyChangeListener(event -> {
		if (event.getPropertyName().equals(N4JSProjectInfo.VENDOR_ID_PROP_NAME)) {
			setPageComplete(validatePage());
		}
	});

	dbc.bindValue(WidgetProperties.text(Modify).observe(vendorIdText),
			BeanProperties.value(N4JSProjectInfo.class, N4JSProjectInfo.VENDOR_ID_PROP_NAME).observe(projectInfo));

}
 
Example #12
Source Project: scava   Author: crossminer   File: ApiDocumentationResultView.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ApiDocumentationResultView() {
	super(SWT.BORDER);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);

	lblLabel = new CLabel(this, SWT.NONE);
	lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
	lblLabel.setText("<Title of the API documentation>");
	new Label(this, SWT.NONE);

	textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP);
	textUrl.setEditable(false);
	textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
	textUrl.setText("<url>");
	textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}
 
Example #13
Source Project: bonita-studio   Author: bonitasoft   File: ContractInputExpressionEditor.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, false).create());
    final GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    typeComposite.setLayout(gl);

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults()
            .align(SWT.FILL, SWT.CENTER).create());

    typeText = new Text(typeComposite, SWT.BORDER | SWT.READ_ONLY);
    typeText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
            .align(SWT.FILL, SWT.CENTER).indent(10, 0).create());
}
 
Example #14
Source Project: gama   Author: gama-platform   File: ExceptionDetailsDialog.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create the details field based upon the details object. Do nothing if the details object is not specified.
 * 
 * @param parent
 *            the details area in which the fields are created
 * 
 * @return the details field
 */
private Control createDetailsViewer(final Composite parent) {
	if (details == null) { return null; }

	final Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	text.setLayoutData(new GridData(GridData.FILL_BOTH));

	// Create the content.
	final StringWriter writer = new StringWriter(1000);
	if (details instanceof Throwable) {
		appendException(new PrintWriter(writer), (Throwable) details);
	} else if (details instanceof IStatus) {
		appendCommandStatus(new PrintWriter(writer), (IStatus) details, 0);
	}
	text.setText(writer.toString());

	return text;
}
 
Example #15
Source Project: tmxeditor8   Author: heartsome   File: EquivalentPage.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 验证用户输入的加权系数的正确性
 * @param equiTxt
 */
private void validEquiTxt(final Text equiTxt){
	final String defaultStr = "0.50";
	equiTxt.setText(defaultStr);
	equiTxt.addFocusListener(new FocusAdapter() {
		@Override
		public void focusLost(FocusEvent e) {
			String textStr = equiTxt.getText().trim();
			if (textStr == null || textStr.trim().length() == 0) {
				equiTxt.setText(defaultStr);
			}else {
				String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
				if (!textStr.matches(regular)) {
					MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), 
						Messages.getString("preference.EquivalentPage.msg5"));
					equiTxt.setText(defaultStr);
				}
			}
		}
	});
}
 
Example #16
Source Project: ermaster-b   Author: naoki-iwami   File: FileText.java    License: Apache License 2.0 6 votes vote down vote up
public FileText(Composite parent, int style, String[] filterExtensions) {
		this.text = new Text(parent, style);

		this.filterExtensions = filterExtensions;

		this.openBrowseButton = new Button(parent, SWT.NONE);
		this.openBrowseButton.setText(JFaceResources.getString("openBrowse"));

		this.openBrowseButton.addSelectionListener(new SelectionAdapter() {

			/**
			 * {@inheritDoc}
			 */
			@Override
			public void widgetSelected(SelectionEvent e) {
//				String saveFilePath = Activator.showSaveDialog(text.getText(),
//						FileText.this.filterExtensions);
				String saveFilePath = Activator.showSaveDialogInternal(text.getText(),
						FileText.this.filterExtensions);
				text.setText(saveFilePath);
			}
		});
	}
 
Example #17
Source Project: MergeProcessor   Author: aposin   File: WorkspaceMergeDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the text field showing the established commands.
 * 
 * @param parent the parent composite of the text field
 * @return the text field
 */
private static Text createEstablishedCommandsText(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridDataFactory.fillDefaults().span(2, 1).exclude(true).applyTo(composite);
	final Text text = new Text(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
	GridDataFactory.fillDefaults().grab(true, true).hint(0 /* Do not layout dependent to the content */, 100)
			.span(2, 1).applyTo(text);
	text.setEditable(false);
	text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	text.setForeground(text.getDisplay().getSystemColor(SWT.COLOR_GRAY));
	text.setFont(JFaceResources.getFont(CONSOLE_FONT));
	return text;
}
 
Example #18
Source Project: APICloud-Studio   Author: apicloudcom   File: HTMLFormatterIndentationTabPage.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param controlManager
 * @param tabSize
 */
public TabOptionHandler(IFormatterControlManager controlManager, Combo tabOptions, Text indentationSize,
		Text tabSize)
{
	this.manager = controlManager;
	this.tabOptions = tabOptions;
	this.indentationSize = indentationSize;
	this.tabSize = tabSize;
	tabOptions.addSelectionListener(this);
	manager.addInitializeListener(this);
}
 
Example #19
private void installFilter() {
	fFilterText.setText(""); //$NON-NLS-1$

	fFilterText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			String text= ((Text) e.widget).getText();
			setMatcherString(text, true);
		}
	});
}
 
Example #20
Source Project: birt   Author: eclipse   File: ExpressionEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );

	Composite container = new Composite( composite, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	layout.verticalSpacing = 10;
	container.setLayout( layout );

	new Label( container, SWT.NONE ).setText( Messages.getString( "ExpressionEditor.Label.Expression" ) ); //$NON-NLS-1$
	exprText = new Text( container, SWT.BORDER | SWT.MULTI );
	GridData gd = new GridData( );
	gd.widthHint = 200;
	gd.heightHint = exprText.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y
			- exprText.getBorderWidth( )
			* 2;
	exprText.setLayoutData( gd );
	exprText.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			checkStatus( );
		}

	} );

	ExpressionButtonUtil.createExpressionButton( container,
			exprText,
			provider,
			contextObject,
			allowConstant,
			SWT.PUSH );

	ExpressionButtonUtil.initExpressionButtonControl( exprText, expression );

	UIUtil.bindHelp( parent, IHelpContextIds.EXPRESSION_EDITOR_ID );

	return composite;
}
 
Example #21
Source Project: sarl   Author: sarl   File: SARLArgumentsTab.java    License: Apache License 2.0 5 votes vote down vote up
private void createSREArgsText(Group group, Font font) {
	this.sreArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
	this.sreArgumentsText.addTraverseListener(new TraverseListener() {
		@Override
		public void keyTraversed(TraverseEvent event) {
			switch (event.detail) {
			case SWT.TRAVERSE_ESCAPE:
			case SWT.TRAVERSE_PAGE_NEXT:
			case SWT.TRAVERSE_PAGE_PREVIOUS:
				event.doit = true;
				break;
			case SWT.TRAVERSE_RETURN:
			case SWT.TRAVERSE_TAB_NEXT:
			case SWT.TRAVERSE_TAB_PREVIOUS:
				if ((SARLArgumentsTab.this.sreArgumentsText.getStyle() & SWT.SINGLE) != 0) {
					event.doit = true;
				} else {
					if (!SARLArgumentsTab.this.sreArgumentsText.isEnabled() || (event.stateMask & SWT.MODIFIER_MASK) != 0) {
						event.doit = true;
					}
				}
				break;
			default:
			}
		}
	});
	final GridData gd = new GridData(GridData.FILL_BOTH);
	gd.heightHint = HEIGHT_HINT;
	gd.widthHint = WIDTH_HINT;
	this.sreArgumentsText.setLayoutData(gd);
	this.sreArgumentsText.setFont(font);
	this.sreArgumentsText.addModifyListener(new ModifyListener() {
		@SuppressWarnings("synthetic-access")
		@Override
		public void modifyText(ModifyEvent evt) {
			scheduleUpdateJob();
		}
	});
	ControlAccessibleListener.addListener(this.sreArgumentsText, group.getText());
}
 
Example #22
Source Project: bonita-studio   Author: bonitasoft   File: JavaExpressionEditor.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    typeComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());

    typeText = new Text(typeComposite, SWT.BORDER | SWT.READ_ONLY);
    typeText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create());

}
 
Example #23
Source Project: hop   Author: project-hop   File: PasswordTextVar.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ModifyListener getModifyListenerTooltipText( final Text textField ) {
  return new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      textField.setToolTipText( toolTipText );
    }
  };
}
 
Example #24
Source Project: erflute   Author: dbflute-session   File: FileText.java    License: Apache License 2.0 5 votes vote down vote up
public FileText(Composite parent, int style, String[] filterExtensions) {
    this.text = new Text(parent, style);
    this.filterExtensions = filterExtensions;
    this.openBrowseButton = new Button(parent, SWT.NONE);
    openBrowseButton.setText(JFaceResources.getString("openBrowse"));
    openBrowseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            final String saveFilePath = Activator.showSaveDialogInternal(text.getText(), FileText.this.filterExtensions);
            text.setText(saveFilePath);
        }
    });
}
 
Example #25
Source Project: depan   Author: google   File: NewJavaBytecodeOptionPart.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Open a File and write the name in the given {@link Text} object.
 */
private void handleFileBrowse(Text cell) {
  FileDialog dialog = new FileDialog(containingPage.getShell());
  dialog.setFilterExtensions(new String[] {"*.jar", "*.zip", "*.*"});
  String filename = dialog.open();
  if (!Strings.isNullOrEmpty(filename)) {
    cell.setText(filename);
    dialogChanged();
  }
}
 
Example #26
Source Project: e4macs   Author: MulgaSoft   File: MarkUtils.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the selection point from the text widget
 * 
 * @param editor
 * 
 * @return the selection point iff it is a (Styled)Text widget
 * x is the offset of the first	selected character, 
 * y is the offset after the last selected character.
 */
public static Point getWidgetSelection(ITextEditor editor) {
	Point result = null;
	Control text = (Control) editor.getAdapter(Control.class);
	if (text instanceof StyledText) {
		result = ((StyledText) text).getSelection();
	} else if (text instanceof Text) {
		result = ((Text) text).getSelection();
	}
	return result;
}
 
Example #27
Source Project: birt   Author: eclipse   File: ChartCubeBindingDialogHelper.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void createExpressionButton( final Composite parent, final Text text )
{
	if ( expressionProvider == null )
	{
		expressionProvider = new BindingExpressionProvider( bindingHolder,
				binding );
	}

	ExpressionButtonUtil.createExpressionButton( parent,
			text,
			expressionProvider,
			bindingHolder );
}
 
Example #28
Source Project: bonita-studio   Author: bonitasoft   File: UsersWizardPage.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void createEmailField(final Composite detailsInfoComposite, final EReference reference) {
    final Label emailLabel = new Label(detailsInfoComposite, SWT.NONE);
    emailLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
    emailLabel.setText(Messages.emailLabel);

    final Text emailText = new Text(detailsInfoComposite, SWT.BORDER);
    emailText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    emailText.setMessage(Messages.emailHint);

    bindTextToUserAttribute(emailText, reference, OrganizationPackage.Literals.CONTACT_DATA__EMAIL,
            updateValueStrategy()
                    .withValidator(maxLengthValidator(Messages.countryLabel, LONG_FIELD_MAX_LENGTH)).create());

}
 
Example #29
Source Project: gwt-eclipse-plugin   Author: gwt-plugins   File: ClientBundleResourceDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void createFileControls(Composite parent, int nColumns) {
  fileField = new StringButtonDialogField(fieldAdapter);
  fileField.setLabelText("File:");
  fileField.setButtonLabel("Browse...");
  fileField.doFillIntoGrid(parent, nColumns);
  Text text = fileField.getTextControl(null);
  LayoutUtil.setWidthHint(text, getMaxFieldWidth());
  LayoutUtil.setHorizontalGrabbing(fileField.getTextControl(null));
  fileField.postSetFocusOnDialogField(parent.getDisplay());
}
 
Example #30
Source Project: translationstudio8   Author: heartsome   File: WorkspaceDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);

	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	composite.setLayout(layout);
	final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
	composite.setLayoutData(data);

	getShell().setText(Messages.getString("dialog.WorkspaceDialog.shell"));

	wsTreeViewer = new TreeViewer(composite, SWT.BORDER);
	final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	gd.widthHint = 550;
	gd.heightHint = 250;
	wsTreeViewer.getTree().setLayoutData(gd);

	wsTreeViewer.setContentProvider(new LocationPageContentProvider());
	wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
	wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());

	final Composite group = new Composite(composite, SWT.NONE);
	layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	group.setLayout(layout);
	group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	final Label label = new Label(group, SWT.NONE);
	label.setLayoutData(new GridData());
	label.setText(Messages.getString("dialog.WorkspaceDialog.label"));

	wsFilenameText = new Text(group, SWT.BORDER);
	wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

	setupListeners();

	return parent;
}