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

The following examples show how to use org.eclipse.swt.widgets.Text#setToolTipText() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: hop   File: TextVar.java    License: Apache License 2.0 6 votes vote down vote up
protected ModifyListener getModifyListenerTooltipText( final Text textField ) {
  return new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      if ( textField.getEchoChar() == '\0' ) { // Can't show passwords ;-)

        String tip = textField.getText();
        if ( !Utils.isEmpty( tip ) && !Utils.isEmpty( toolTipText ) ) {
          tip += Const.CR + Const.CR + toolTipText;
        }

        if ( Utils.isEmpty( tip ) ) {
          tip = toolTipText;
        }
        textField.setToolTipText( variables.environmentSubstitute( tip ) );
      }
    }
  };
}
 
Example 2
/**
   * 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 3
protected void createTextEdit( )
{
	txtValue = new Text( this, iStyle );
	GridData gd = new GridData( GridData.FILL_BOTH );
	txtValue.setLayoutData( gd );
	if ( valueType == TYPE_NUMBERIC )
	{
		txtValue.setToolTipText( Messages.getString( "TextEditorComposite.Tooltip.EnterDecimalOrFractionValue" ) ); //$NON-NLS-1$
	}
	else if ( valueType == TYPE_DATETIME )
	{
		txtValue.setToolTipText( "MM-dd-yyyy HH:mm:ss" ); //$NON-NLS-1$
	}
	txtValue.addModifyListener( this );
	txtValue.addFocusListener( this );
	txtValue.addKeyListener( this );
}
 
Example 4
private Composite createBucketSection(Composite parent) {
  Composite bucketComposite = new Composite(parent, SWT.NONE);

  Label bucketLabel = new Label(bucketComposite, SWT.LEAD);
  bucketLabel.setText(Messages.getString("custom.bucket"));
  bucketLabel.setToolTipText(Messages.getString("tooltip.staging.bucket"));

  bucket = new Text(bucketComposite, SWT.LEAD | SWT.SINGLE | SWT.BORDER);
  bucket.setMessage(Messages.getString("custom.bucket.hint"));
  GridData bucketData = new GridData(SWT.FILL, SWT.CENTER, true, false);
  bucket.setLayoutData(bucketData);

  bucket.setToolTipText(Messages.getString("tooltip.staging.bucket"));

  GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(bucketComposite);
  return bucketComposite;
}
 
Example 5
public MavenCoordinatesUi(Composite container, int style) {
  super(container, style);

  groupIdLabel = new Label(this, SWT.LEAD);
  groupIdLabel.setText(Messages.getString("GROUP_ID")); //$NON-NLS-1$
  groupIdField = new Text(this, SWT.BORDER);
  groupIdField.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$

  artifactIdLabel = new Label(this, SWT.LEAD);
  artifactIdLabel.setText(Messages.getString("ARTIFACT_ID")); //$NON-NLS-1$
  artifactIdField = new Text(this, SWT.BORDER);
  artifactIdField.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$

  versionLabel = new Label(this, SWT.LEAD);
  versionLabel.setText(Messages.getString("ARTIFACT_VERSION")); //$NON-NLS-1$
  versionField = new Text(this, SWT.BORDER);
  versionField.setText(DEFAULT_VERSION);

  GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(this);
}
 
Example 6
protected Composite buildIncrementPolicyPanel( Composite aParent )
{
	Group tempIncrementPolicyGroup = new Group( aParent, SWT.NONE );
	tempIncrementPolicyGroup.setText( "Increment Policy" );
	GridLayout tempIncrementPolicyGroupLayout = new GridLayout( 2, false );
	tempIncrementPolicyGroup.setLayout(tempIncrementPolicyGroupLayout);
	tempIncrementPolicyGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false ));
	
	Label tempLabelIncrementPolicyLotSize = new Label( tempIncrementPolicyGroup, SWT.NONE );
	tempLabelIncrementPolicyLotSize.setText( "Lot Size:" );
	textIncrementPolicyLotSize = new Text( tempIncrementPolicyGroup, SWT.NONE );
	textIncrementPolicyLotSize.setToolTipText( "May be used in conjunction with Control/@incrementPolicy on spinner controls" );
	textIncrementPolicyLotSize.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false ));
	setTextValue( textIncrementPolicyLotSize, getAtdl4jOptions().getInputAndFilterData().getInputIncrementPolicy_LotSize() );
		  
	Label tempLabelIncrementPolicyTick = new Label( tempIncrementPolicyGroup, SWT.NONE );
	tempLabelIncrementPolicyTick.setText( "Tick Size:" );
	textIncrementPolicyTick = new Text( tempIncrementPolicyGroup, SWT.NONE );
	textIncrementPolicyTick.setToolTipText( "May be used in conjunction with Control/@incrementPolicy on spinner controls" );
	textIncrementPolicyTick.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false ));
	setTextValue( textIncrementPolicyTick, getAtdl4jOptions().getInputAndFilterData().getInputIncrementPolicy_Tick() );
		  
	return tempIncrementPolicyGroup;
}
 
Example 7
Source 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 8
Source Project: hop   File: LabelText.java    License: Apache License 2.0 5 votes vote down vote up
public LabelText( Composite composite, int textStyle, String labelText, String toolTipText, int middle,
                  int margin ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  this.setLayout( formLayout );

  wText = new Text( this, textStyle );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wText.setLayoutData( fdText );
  wText.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 );
}
 
Example 9
Source Project: ice   File: ExtraInfoDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

	// Local Declarations
	Composite swtComposite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) swtComposite.getLayout();
	Color backgroundColor = getParentShell().getDisplay()
			.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);

	// Set the column layout to one so that everything will stack
	layout.numColumns = 1;

	// Add the description as text
	Text text = new Text(swtComposite, SWT.FLAT);
	text.setToolTipText(dataComp.getDescription());
	text.setText(dataComp.getDescription());
	text.setLayoutData(new GridData(255, SWT.DEFAULT));
	text.setEditable(false);
	text.setBackground(backgroundColor);

	// Create the DataComponentComposite that will render the Entries
	dataComposite = new DataComponentComposite(dataComp, swtComposite,
			SWT.FLAT);

	// Set the data composite's layout. This arranges the composite to be a
	// tight column.
	GridLayout dataLayout = new GridLayout(1, true);
	GridData dataGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
	dataComposite.setLayout(dataLayout);
	dataComposite.setLayoutData(dataGridData);

	return swtComposite;
}
 
Example 10
protected Composite buildSelectStrategyPanel( Composite aParent )
{
	Group tempSelectStrategyGroup = new Group( aParent, SWT.NONE );
	tempSelectStrategyGroup.setText( "Select Strategy" );
	GridLayout tempSelectStrategyGroupLayout = new GridLayout( 1, true );
	tempSelectStrategyGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	tempSelectStrategyGroup.setLayout(tempSelectStrategyGroupLayout);

	Composite tempSelectStrategyNameComposite = new Composite( tempSelectStrategyGroup, SWT.NONE );
	tempSelectStrategyNameComposite.setLayout( new RowLayout( SWT.HORIZONTAL ) );
	Label tempLabelSelectStrategyName = new Label( tempSelectStrategyNameComposite, SWT.NONE );
	tempLabelSelectStrategyName.setText( "Pre-select Strategy:" );
	textSelectStrategyName = new Text( tempSelectStrategyNameComposite, SWT.BORDER );
	
	Group tempStrategyNameFilterGroup = new Group( tempSelectStrategyGroup, SWT.NONE );
	tempStrategyNameFilterGroup.setText( "Strategy Name Sequence (Filter)" );
	tempStrategyNameFilterGroup.setToolTipText( "When specified, controls the order of Strategy Name list presented to the user." );
	GridLayout tempStrategyNameFilterGroupLayout = new GridLayout( 1, true );
	tempStrategyNameFilterGroup.setLayout( tempStrategyNameFilterGroupLayout );
	tempStrategyNameFilterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	
	textAreaStrategyNameFilterList = new Text( tempStrategyNameFilterGroup, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL );
	textAreaStrategyNameFilterList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	textAreaStrategyNameFilterList.setToolTipText( "When specified, controls the order of Strategy Name list presented to the user." );
	checkboxInputStrategyListAsFilter = new Button( tempStrategyNameFilterGroup, SWT.CHECK );
	checkboxInputStrategyListAsFilter.setText( "Apply List as Filter" );
	checkboxInputStrategyListAsFilter.setToolTipText( "When checked only the strategy names specified will be shown (any others will be excluded.)" );

	return tempSelectStrategyGroup;
}
 
Example 11
Source Project: CogniCrypt   File: LocatorPage.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public void containerSelectionChanged(final Object object, final Text containerNameField) {
	String text = "";
	if (object instanceof IContainer) {
		text = TextProcessor.process(((IContainer) object).getFullPath().makeRelative().toString());
	} else if (object instanceof IFile) {
		text = ((IFile) object).getFullPath().makeRelative().toString();
	}
	containerNameField.setText(text);
	containerNameField.setToolTipText(text);
}
 
Example 12
protected void placeComponents( )
{
	GridLayout gl = new GridLayout( 1, false );
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginLeft = 0;
	gl.marginRight = 0;
	gl.marginTop = 0;
	gl.marginWidth = 0;
	this.setLayout( gl );
	if ( sUnit != null )
	{
		gl.numColumns = 2;
	}
	txtValue = new Text( this, iStyle );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	txtValue.setLayoutData( gd );
	txtValue.setToolTipText( Messages.getString( "TextEditorComposite.Tooltip.EnterDecimalOrFractionValue" ) ); //$NON-NLS-1$
	txtValue.addModifyListener( this );
	txtValue.addFocusListener( this );
	txtValue.addKeyListener( this );

	if ( sUnit != null )
	{
		this.lblUnit = new Label( this, SWT.NONE );
		if ( lblUnit != null )
		{
			lblUnit.setText( sUnit );
		}
	}
}
 
Example 13
/**
 * Create main file settings box.
 * @param composite the parent container
 */
private void createMainFileControl(Composite composite) {
    
    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardMainFileLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip"));
    mainLabel.setLayoutData(new GridData());
    
    // add text field
    sourceFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    sourceFileNameField.setText(attributes.getSourceFile());
    sourceFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip"));
    sourceFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sourceFileNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            dirTree.setSelection(new TreeItem[] { sourceFileItem });
        }});
    sourceFileNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!sourceFileNameField.isDisposed()) {
                String t = sourceFileNameField.getText();
                sourceFileItem.setText(t);
                tempFileItem.setText(t.substring(0, t.lastIndexOf('.')+1) + "aux");
                validateMainFileName(t);
            }
        }});
}
 
Example 14
Source Project: uima-uimaj   File: AbstractDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * New description.
 *
 * @param twoCol the two col
 * @param tip the tip
 * @return the text
 */
protected Text newDescription(Composite twoCol, String tip) {
  setTextAndTip(new Label(twoCol, SWT.NONE), S_DESCRIPTION, tip);
  Text t = new Text(twoCol, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
  t.setLayoutData(new GridData(GridData.FILL_BOTH));
  ((GridData) t.getLayoutData()).heightHint = 100;
  t.setToolTipText(tip);
  return t;
}
 
Example 15
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createOutputDirControl(Composite composite) {
    
    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputDirLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip"));
    mainLabel.setLayoutData(new GridData());
    
    // add text field
    outputDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    outputDirNameField.setText(attributes.getOutputDir());
    outputDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip"));
    outputDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    outputDirNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            if (outputDirItem != null) {
                dirTree.setSelection(new TreeItem[] { outputDirItem });
            }
        }});
    outputDirNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!outputDirNameField.isDisposed()) {
                String t = outputDirNameField.getText();
                attributes.setOutputDir(t);
                validateDirName(outputDirNameField, t);
                if (t == null || t.length() == 0) {
                    recreateSubTree();
                } else if (outputDirItem == null) {
                    recreateSubTree();
                }
                if (outputDirItem != null) {
                    outputDirItem.setText(t);
                }
            }
        }});
}
 
Example 16
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createOutputFileControl(Composite composite) {
    
    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputFileLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip"));
    mainLabel.setLayoutData(new GridData());
    
    // add text field
    outputFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    outputFileNameField.setText(attributes.getOutputFile());
    outputFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip"));
    outputFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    outputFileNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            dirTree.setSelection(new TreeItem[] { outputFileItem });
        }});
    outputFileNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!outputFileNameField.isDisposed()) {
                String t = outputFileNameField.getText();
                outputFileItem.setText(t);
                validateOutputFileName(t);
            }
        }});
}
 
Example 17
Source Project: uima-uimaj   File: AbstractDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
   * New type input.
   *
   * @param aSection the a section
   * @param twoCol the two col
   * @return the text
   */
  protected Text newTypeInput(AbstractSection aSection, Composite twoCol) {
    Composite tc = new2ColumnComposite(twoCol);
    final TypesWithNameSpaces candidatesToPickFrom = getTypeSystemInfoList(); // provide an ArrayList of

    final Text text;
    if (contentAssistAvailable) {
      ContentAssistField32 caf = new ContentAssistField32(tc, candidatesToPickFrom);
      text = caf.getControl();
    } else {
      text = newText(tc, SWT.BORDER, "");
    }
      
    text.setToolTipText("Enter a Type name." + (contentAssistAvailable ? 
            "Content Assist is available (press Ctrl + Space)" : ""));
    text.getParent().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text.addListener(SWT.KeyUp, this);
    text.addListener(SWT.MouseUp, this); // for paste operation
    text.addListener(SWT.Modify, this);  // for content assist
    
//    newText(tc, SWT.NONE,
//    "Enter a Type name. Content Assist is available on Eclipse 3.2 and beyond (press Ctrl + Space)");

//    ContentProposalAdapter adapter = new ContentProposalAdapter(
//            text, new TextContentAdapter(),
//            candidatesToPickFrom,
//            contentAssistActivationKey, 
//            contentAssistActivationChars);
//    adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    
    Button browseButton = newPushButton(tc, "Browse", "Click here to browse possible types");
    browseButton.removeListener(SWT.Selection, this);
    final AbstractSection finalSection = aSection;
    browseButton.addListener(SWT.Selection, new Listener() {
      @Override
      public void handleEvent(Event event) {
        errorMessageUI.setText("");
        SelectTypeDialog dialog = new SelectTypeDialog(finalSection, candidatesToPickFrom); 
//          OpenTypeSystemSelectionDialog dialog = 
//              new OpenTypeSystemSelectionDialog(getShell(), typeList);
        if (dialog.open() != IDialogConstants.OK_ID)
          return;
        
        text.setText((null == dialog.nameSpaceName || 
                "".equals(dialog.nameSpaceName)) ? 
                dialog.typeName :
                dialog.nameSpaceName + "." + dialog.typeName);
        if (okButton != null)
          enableOK();
    /*
        Object[] types = dialog.getResult();
        if (types != null && types.length > 0) {
          ITypeSystemInfo selectedType = (ITypeSystemInfo) types[0];
          text.setText(selectedType.getFullName());
          enableOK();
        }
    */
      }
    });
    /*
    TypeSystemCompletionProcessor processor = new TypeSystemCompletionProcessor(
            candidatesToPickFrom);
    ControlContentAssistHelper.createTextContentAssistant(text, processor);
    text.addListener(SWT.KeyDown, new Listener() {
      public void handleEvent(Event e) {
        errorMessageUI.setText("");
      }
    });
    text.addListener(SWT.Modify, new Listener() {
      public void handleEvent(Event e) {
        textModifyCallback(e);
      }
    });
    */
    return text;
  }
 
Example 18
public DDEGroup(Composite parent, String name, String toolTip) {
	super(parent, SWT.NONE);
	
	setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ((GridData)getLayoutData()).horizontalSpan = 2;
    setLayout( new GridLayout());
    	    
 		    Group group = new Group(this, SWT.SHADOW_IN);
       group.setText(name);
       group.setToolTipText(toolTip);
 		    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       group.setLayout(new GridLayout(4, false));

	Label ddeCommandLabel = new Label(group, SWT.LEFT);
	ddeCommandLabel.setText(TexlipsePlugin.getResourceString("preferenceViewerDDECommandLabel"));
	ddeCommandLabel.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDECommandTooltip"));
	ddeCommandLabel.setLayoutData(new GridData());

	command = new Text(group, SWT.SINGLE | SWT.BORDER);
	command.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDECommandTooltip"));
	command.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	((GridData) command.getLayoutData()).horizontalSpan = 3;

	Label ddeServerLabel = new Label(group, SWT.LEFT);
	ddeServerLabel.setText(TexlipsePlugin.getResourceString("preferenceViewerDDEServerLabel"));
	ddeServerLabel.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDEServerTooltip"));
	ddeServerLabel.setLayoutData(new GridData());

	server = new Text(group, SWT.SINGLE | SWT.BORDER);
	server.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDEServerTooltip"));
	server.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	Label ddeTopicLabel = new Label(group, SWT.LEFT);
	ddeTopicLabel.setText(TexlipsePlugin.getResourceString("preferenceViewerDDETopicLabel"));
	ddeTopicLabel.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDETopicTooltip"));
	ddeTopicLabel.setLayoutData(new GridData());

	topic = new Text(group, SWT.SINGLE | SWT.BORDER);
	topic.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerDDETopicTooltip"));
	topic.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	setVisible(false);
}
 
Example 19
Source Project: birt   File: JointDataSetPage.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * create bottom composite for page
 * 
 * @param parent
 */
private void createBottomComposite( Composite parent )
{
	// initialize the dialog layout
	parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 2;
	parent.setLayout( layout );

	nameLabel = new Label( parent, SWT.RIGHT );
	nameLabel.setText( Messages.getString( "dataset.wizard.label.datasetName" ) );//$NON-NLS-1$
	nameEditor = new Text( parent, SWT.BORDER );
	String name = ReportPlugin.getDefault( )
			.getCustomName( ReportDesignConstants.DATA_SET_ELEMENT );
	if ( name != null )
	{
		nameEditor.setText( Utility.getUniqueDataSetName( name ) );
	}
	else
	// can't get defaut name
	{
		nameEditor.setText( Utility.getUniqueDataSetName( Messages.getString( "dataset.new.defaultName" ) ) );//$NON-NLS-1$			
	}

	nameEditor.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	nameEditor.setToolTipText( Messages.getString( "DataSetBasePage.tooltip" ) ); //$NON-NLS-1$
	nameEditor.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			if ( StringUtil.isBlank( nameEditor.getText( ).trim( ) ) )
			{
				setPageMessage( EMPTY_NAME, ERROR );
				setPageComplete( false );
			}
			else if ( isDuplicateName( ) )
			{// name is duplicated
				setPageMessage( DUPLICATE_NAME, ERROR );
				setPageComplete( false );
			}
			else if ( containInvalidCharactor( nameEditor.getText( ) ) )
			{// name contains invalid ".", "/", "\", "!", ";", "," charactor
				String msg = Messages.getFormattedString( "error.invalidName", //$NON-NLS-1$
						new Object[]{
							nameEditor.getText( )
						} );
				setMessage( msg, ERROR );
				setPageComplete( false );
			}
			else
			{// everything is OK
				setPageComplete( canPageComplete( ) );
				setPageMessage( CREATE_PROMPT, NONE );
			}
		}
	} );

}
 
Example 20
Source Project: arx   File: EditorCriterion.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Updates the label and tool tip text.
 *
 * @param label
 * @param value
 */
protected void updateLabel(Text label, double value) {
    String text = SWTUtil.getPrettyString(value);
    label.setText(" " + text);
    label.setToolTipText(String.valueOf(value));
}