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

The following are Jave code examples for showing how to use setToolTipText() 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: 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 2
Project: Hydrograph   File: Utils.java   View Source Code Vote up 6 votes
/**
 * 
 * get the file Path according to the Parameter value
 * @param extSchemaPath
 * @param paramValue
 * @param extSchemaPathText
 * @return the file Path according to the Parameter value
 */
public String getParamFilePath(String extSchemaPath, String paramValue, Text extSchemaPathText){
	String remainingString = "";
    if( checkParameterValue(extSchemaPath)){
    	if(StringUtils.isNotEmpty(paramValue)){
    		extSchemaPathText.setToolTipText(paramValue+remainingString);
    	}else{
    		extSchemaPathText.setToolTipText(PARAMETER_NOT_FOUND);
    	}
    }else if(StringUtils.contains(paramValue, PARAMETER_NOT_FOUND)){
    	extSchemaPathText.setToolTipText(remainingString);
    }else{
    	remainingString = extSchemaPath.substring(extSchemaPath.indexOf("}")+1, extSchemaPath.length());
    	extSchemaPathText.setToolTipText(paramValue+remainingString);
   		}
    	
	return paramValue+remainingString;
}
 
Example 3
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 4
Project: Hydrograph   File: WorksheetWidget.java   View Source Code Vote up 5 votes
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) {
	eltSubgroupComposite = new ELTDefaultSubgroupComposite(subGroup.getContainerControl());
	eltSubgroupComposite.createContainerWidget();
	Utils.INSTANCE.loadProperties();
	this.cursor = subGroup.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);

	AbstractELTWidget label = new ELTDefaultLable(Messages.LABEL_WORKSHEET_NAME + " ");
	eltSubgroupComposite.attachWidget(label);
	setPropertyHelpWidget((Control) label.getSWTWidgetControl());

	AbstractELTWidget textBoxWidget = new ELTDefaultTextBox();
	eltSubgroupComposite.attachWidget(textBoxWidget);

	textBox = (Text) textBoxWidget.getSWTWidgetControl();
	txtDecorator = WidgetUtility.addDecorator(textBox, Messages.bind(Messages.EMPTY_FIELD, ((Label) label.getSWTWidgetControl()).getText()));
	txtDecorator.setMarginWidth(3);
	txtDecorator.show();
	textBox.setToolTipText("Worksheet Name can be static or FieldName or a Parameter");
	GridData gridData = (GridData) textBox.getLayoutData();
	if (OSValidator.isMac()) {
		gridData.widthHint = 106;
	} else {
		gridData.widthHint = 80;
	}
	attachListeners(textBox);

	isFieldCheckBox = new Button(eltSubgroupComposite.getContainerControl(), SWT.CHECK);
	isFieldCheckBox.setEnabled(false);
	isFieldCheckBox.setText(Constants.IS_FIELD);
	attachSelectionListener(isFieldCheckBox);
	populateWidget();
}
 
Example 5
Project: Hydrograph   File: FilterHelper.java   View Source Code Vote up 5 votes
private void showToolTip(Text text1, String selectedValue) {
	if (StringUtils.equalsIgnoreCase(selectedValue, FilterConstants.IN)
			|| StringUtils.equalsIgnoreCase(selectedValue, FilterConstants.NOT_IN)) {
		text1.setToolTipText(Messages.COMMA_SEPERATED_VALUE);
	} else {
		text1.setToolTipText("");
	}
}
 
Example 6
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   View Source Code Vote up 4 votes
/***
 * Create the Fields where user enters model to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createModelLayout(Composite parent, Font font) {
	createTextLabelLayout(parent, "Model to execute");
	// Model location text
	_modelLocationText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelLocationText.setLayoutData(createStandardLayout());
	_modelLocationText.setFont(font);
	_modelLocationText.addModifyListener(fBasicModifyListener);
	Button modelLocationButton = createPushButton(parent, "Browse", null);
	modelLocationButton.addSelectionListener(new SelectionAdapter() {

		public void widgetSelected(SelectionEvent evt) {
			// handleModelLocationButtonSelected();
			// TODO launch the appropriate selector

			SelectAnyIFileDialog dialog = new SelectAnyIFileDialog();
			if (dialog.open() == Dialog.OK) {
				String modelPath = ((IResource) dialog.getResult()[0])
						.getFullPath().toPortableString();
				_modelLocationText.setText(modelPath);
				updateLaunchConfigurationDialog();
				_modelProject = ((IResource) dialog.getResult()[0]).getProject();
			}
		}
	});
	createTextLabelLayout(parent, "Model initialization method");
	_modelInitializationMethodText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelInitializationMethodText.setLayoutData(createStandardLayout());
	_modelInitializationMethodText.setFont(font);
	_modelInitializationMethodText.setEditable(false);
	createTextLabelLayout(parent, "");
	createTextLabelLayout(parent, "Model initialization arguments");
	_modelInitializationArgumentsText = new Text(parent, SWT.MULTI | SWT.BORDER |  SWT.WRAP | SWT.V_SCROLL);
	_modelInitializationArgumentsText.setToolTipText("one argument per line");
	GridData gridData = new GridData(GridData.FILL_BOTH);
	gridData.heightHint = 40;
	_modelInitializationArgumentsText.setLayoutData(gridData);
	//_modelInitializationArgumentsText.setLayoutData(createStandardLayout());
	_modelInitializationArgumentsText.setFont(font);
	_modelInitializationArgumentsText.setEditable(true);
	_modelInitializationArgumentsText.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
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;
}