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

The following are Jave code examples for showing how to use setMessage() 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.
+ Save this method
Example 1
Project: com.onpositive.prefeditor   File: ViewerPage.java   View Source Code Vote up 7 votes
protected void createFilterControls(Composite con) {
	Label filterLabel = new Label(con,SWT.NONE);
	filterLabel.setText("Filter:");
	GridDataFactory.swtDefaults().applyTo(filterLabel);
	Text filterText = new Text(con, SWT.BORDER);
	filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
	filterText.addModifyListener(event -> {
		filterChanged(filterText.getText());
	});
	GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
	Button clearBtn = new Button(con, SWT.PUSH);
	clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
	GridDataFactory.swtDefaults().applyTo(clearBtn);
	clearBtn.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e) {
			filterText.setText("");
			filterChanged("");
		}
		
	});
}
 
Example 2
Project: neoscada   File: ConfigurationFormToolkit.java   View Source Code Vote up 6 votes
public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType )
{
    this.toolkit.createLabel ( parent, label + ":" );

    final Text text = this.toolkit.createText ( parent, "" );
    text.setMessage ( textMessage );
    text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) );
    text.setToolTipText ( textMessage );

    final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType );
    this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );

    final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE );
    link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) );

    link.addHyperlinkListener ( new HyperlinkAdapter () {

        @Override
        public void linkActivated ( final HyperlinkEvent e )
        {
            EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () );
        }
    } );
}
 
Example 3
Project: neoscada   File: FilterAdvancedComposite.java   View Source Code Vote up 6 votes
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 4
Project: neoscada   File: FilterAdvancedComposite.java   View Source Code Vote up 6 votes
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 5
Project: visuflow-plugin   File: LaunchConfigurationTab.java   View Source Code Vote up 6 votes
@Override
public void createControl(Composite parent) {

    Composite comp = new Group(parent, SWT.BORDER);
    setControl(comp);

    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp);

    Label label = new Label(comp, SWT.NONE);
    label.setText("Console Text:");
    GridDataFactory.swtDefaults().applyTo(label);

    text = new Text(comp, SWT.BORDER);
    text.setMessage("Console Text");
    GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
}
 
Example 6
Project: neoscada   File: ConfigurationFormToolkit.java   View Source Code Vote up 5 votes
public void createStandardText ( final Composite parent, final String attributeName, final int style, final String label, final String textMessage, final IObservableMap data, final Object valueType )
{
    final Label labelControl = this.toolkit.createLabel ( parent, label + ":" );

    final boolean multi = ( style & SWT.MULTI ) > 0;

    if ( multi )
    {
        labelControl.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, false, false ) );
    }

    final Text text = this.toolkit.createText ( parent, "", style );
    text.setMessage ( textMessage );
    final GridData gd = new GridData ( GridData.FILL, multi ? GridData.FILL : GridData.BEGINNING, true, true );
    gd.horizontalSpan = 2;
    text.setLayoutData ( gd );
    text.setToolTipText ( textMessage );

    final IObservableValue value = Observables.observeMapEntry ( data, attributeName, String.class );

    if ( valueType != null && valueType != String.class )
    {
        final WritableValue conversionValue = new WritableValue ( null, valueType );
        this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), conversionValue );
        this.dbc.bindValue ( conversionValue, value );
    }
    else
    {
        this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );
    }
}
 
Example 7
Project: Hydrograph   File: ELTVerifyComponentNameListener.java   View Source Code Vote up 4 votes
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,  Widget... widgets) {
	Widget[] widgetList = widgets;
	final Text text = (Text) widgetList[0];
	
	if(helpers != null){
		if (helpers != null) {
			currentComponent=(Component) helpers.get(HelperType.CURRENT_COMPONENT);
			txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
			txtDecorator.hide();
		}
	}
	

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event e) {
			if (e.type == SWT.Verify) {
				logger.debug("<<<<<<<<<<"+e.text.toString()+">>>>>>>>>>>");
				String currentText = ((Text) e.widget).getText();
				String newName = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end)).trim();
				Matcher matchName = Pattern.compile("[\\w+]*").matcher(newName.replaceAll("[\\W&&[\\ \\.\\-]]*", ""));
				logger.debug("new text: {}", newName);
				if (newName == null || newName.equals("")) {
					// e.doit=false;
					text.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					text.setToolTipText(Messages.FIELD_LABEL_ERROR);
					propertyDialogButtonBar.enableOKButton(false);
					propertyDialogButtonBar.enableApplyButton(false);
					txtDecorator.setDescriptionText(Messages.FIELD_LABEL_ERROR);
					txtDecorator.show();
				}else if(!matchName.matches()){
					text.setToolTipText(Messages.INVALID_CHARACTERS);
					txtDecorator.setDescriptionText(Messages.INVALID_CHARACTERS);
					txtDecorator.show();
					e.doit=false;
				} else if(!newName.equalsIgnoreCase(oldName) && !isUniqueCompName(newName)) {
					text.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255,255,204));
					text.setToolTipText(Messages.FIELD_LABEL_ERROR);
					propertyDialogButtonBar.enableOKButton(false);
					propertyDialogButtonBar.enableApplyButton(false);
					txtDecorator.setDescriptionText(Messages.FIELD_LABEL_ERROR);
					txtDecorator.show();
				}
				else{
					text.setBackground(null);
					text.setToolTipText("");
					text.setMessage("");
					propertyDialogButtonBar.enableOKButton(true);
					propertyDialogButtonBar.enableApplyButton(true);
					txtDecorator.hide();
				}
			}
		}
	};
	return listener;
}
 
Example 8
Project: Hydrograph   File: CustomPaletteViewer.java   View Source Code Vote up 4 votes
private Text createSearchTextBox(Composite container,int border) {
	Text text = new Text(container, border);
	text.setToolTipText("Enter component name");
	text.setMessage("Search component");
	return text;
}