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

The following examples show how to use org.eclipse.swt.widgets.Text#getData() . 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: hadoop-gpu   File: HadoopLocationWizard.java    License: Apache License 2.0 6 votes vote down vote up
public void modifyText(ModifyEvent e) {
  final Text text = (Text) e.widget;
  Object hProp = text.getData("hProp");
  final ConfProp prop = (hProp != null) ? (ConfProp) hProp : null;
  Object hPropName = text.getData("hPropName");
  final String propName =
      (hPropName != null) ? (String) hPropName : null;

  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      if (prop != null)
        mediator.notifyChange(TabAdvanced.this, prop, text.getText());
      else
        mediator
            .notifyChange(TabAdvanced.this, propName, text.getText());
    }
  });
}
 
Example 2
protected void updateText( Text curr )
{
	Key key = (Key) curr.getData( );

	String currValue = getValue( key );
	if ( currValue != null )
	{
		curr.setText( currValue );
	}

	if ( fProject != null )
	{
		if ( ignoreKeys != null
				&& Arrays.asList( ignoreKeys ).contains( key ) )
		{
			ControlEnableState.disable( curr );
			Control label = (Control) fLabels.get( curr );
			if ( label != null )
				ControlEnableState.disable( label );
		}
	}
}
 
Example 3
protected void textChanged( Text textControl )
{
	Key key = (Key) textControl.getData( );
	String path = textControl.getText( );

	if ( path != null && textControl == resourceText )
	{
		if ( path.startsWith( DEFAULT_RESOURCE_FOLDER_DISPLAY ) )
		{
			path = path.replaceFirst( DEFAULT_RESOURCE_FOLDER_DISPLAY,
					PREF_RESOURCE.getDefaultValue( fPref ) );
		}
	}

	String oldValue = setValue( key, path );

	validateSettings( key, oldValue, path );
}
 
Example 4
Source Project: RDFS   File: HadoopLocationWizard.java    License: Apache License 2.0 6 votes vote down vote up
public void modifyText(ModifyEvent e) {
  final Text text = (Text) e.widget;
  Object hProp = text.getData("hProp");
  final ConfProp prop = (hProp != null) ? (ConfProp) hProp : null;
  Object hPropName = text.getData("hPropName");
  final String propName =
      (hPropName != null) ? (String) hPropName : null;

  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      if (prop != null)
        mediator.notifyChange(TabAdvanced.this, prop, text.getText());
      else
        mediator
            .notifyChange(TabAdvanced.this, propName, text.getText());
    }
  });
}
 
Example 5
protected void updateText(Text curr) {
	String key = (String) curr.getData();
	String currValue = getValue(key);
	if (currValue != null) {
		curr.setText(currValue);
	}
}
 
Example 6
protected void textChanged(Text textControl) {
	Key key = (Key) textControl.getData();
	String number = textControl.getText();
	String oldValue = setValue(key, number);
	reconcileControls();
	validateSettings(key, oldValue, number);
}
 
Example 7
protected Text getTextControl(Key key) {
	for (int i = fTextBoxes.size() - 1; i >= 0; i--) {
		Text curr = (Text) fTextBoxes.get(i);
		ControlData data = (ControlData) curr.getData();
		if (key.equals(data.getKey())) {
			return curr;
		}
	}
	return null;
}
 
Example 8
protected void updateText(Text curr) {
	Key key= (Key) curr.getData();

	String currValue= getValue(key);
	if (currValue != null) {
		curr.setText(currValue);
	}
}
 
Example 9
protected Text getTextControl(Key key) {
	for (int i= fTextBoxes.size() - 1; i >= 0; i--) {
		Text curr= fTextBoxes.get(i);
		Key data= (Key)curr.getData();
		if (key.equals(data)) {
			return curr;
		}
	}
	return null;
}
 
Example 10
protected void textChanged( Text textControl )
{
	Key key = (Key) textControl.getData( );
	String number = textControl.getText( );
	String oldValue = setValue( key, number );
	validateSettings( key, oldValue, number );
}
 
Example 11
protected Text getTextControl( Key key )
{
	for ( int i = fTextBoxes.size( ) - 1; i >= 0; i-- )
	{
		Text curr = (Text) fTextBoxes.get( i );
		ControlData data = (ControlData) curr.getData( );
		if ( key.equals( data.getKey( ) ) )
		{
			return curr;
		}
	}
	return null;
}
 
Example 12
protected void updateText( Text curr )
{
	Key key = (Key) curr.getData( );

	String currValue = getValue( key );
	curr.setText( currValue );
	if ( currValue != null )
	{
		if ( curr == resourceText )
		{
			String text = curr.getText( ).trim( );
			if ( text.equals( ReportPlugin.getDefault( )
					.getDefaultResourcePreference( ) ) )
			{
				curr.setText( DEFAULT_RESOURCE_FOLDER_DISPLAY );
			}
			else
			{
				File file = new File( text );
				if ( !file.isAbsolute( ) )
				{
					curr.setText( processString( text ) );
				}
			}
		}

	}
}
 
Example 13
protected void initTextField( Text txtParam, IParameterDefn param )
{
	if ( paramsValueMap.containsKey( param.getName( ) ) )
	{
		txtParam.setText( paramsValueMap.get( param.getName( ) )[0] );
		txtParam.setData( ExpressionButtonUtil.EXPR_TYPE,
				paramsValueMap.get( param.getName( ) )[1] );
		ExpressionButton button = (ExpressionButton) txtParam.getData( ExpressionButtonUtil.EXPR_BUTTON );
		if ( button != null )
			button.refresh( );
		return;
	}
	if ( binding != null )
	{
		for ( Iterator iterator = binding.argumentsIterator( ); iterator.hasNext( ); )
		{
			AggregationArgumentHandle arg = (AggregationArgumentHandle) iterator.next( );
			if ( arg.getName( ).equals( param.getName( ) ) )
			{
				ExpressionButtonUtil.initExpressionButtonControl( txtParam,
						arg,
						AggregationArgument.VALUE_MEMBER );
				return;
			}
		}
	}
}
 
Example 14
Source Project: RDFS   File: HadoopLocationWizard.java    License: Apache License 2.0 5 votes vote down vote up
public void modifyText(ModifyEvent e) {
  final Text text = (Text) e.widget;
  final ConfProp prop = (ConfProp) text.getData("hProp");
  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      mediator.notifyChange(TabMain.this, prop, text.getText());
    }
  });
}
 
Example 15
@Override
protected void okPressed(){
	StringBuilder sb = new StringBuilder();
	for (Text text : inputs) {
		String varname = (String) text.getData("varname");
		String varcontents = text.getText();
		sb.append(varname).append("=").append(varcontents).append(",");
	}
	sb.deleteCharAt(sb.length() - 1);
	result = sb.toString();
	super.okPressed();
}
 
Example 16
Source Project: hadoop-gpu   File: HadoopLocationWizard.java    License: Apache License 2.0 5 votes vote down vote up
public void modifyText(ModifyEvent e) {
  final Text text = (Text) e.widget;
  final ConfProp prop = (ConfProp) text.getData("hProp");
  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      mediator.notifyChange(TabMain.this, prop, text.getText());
    }
  });
}
 
Example 17
protected void textChanged(Text textControl) {
	String key = (String) textControl.getData();
	String number = textControl.getText();
	String oldValue = setValue(key, number);
	validateSettings(key, oldValue, number);
}
 
Example 18
protected void textChanged(Text textControl) {
	Key key= (Key) textControl.getData();
	String number= textControl.getText();
	String oldValue= setValue(key, number);
	validateSettings(key, oldValue, number);
}
 
Example 19
public boolean performOk( )
{
	for ( int i = 0; i < propList.size( ); i++ )
	{
		try
		{
			String value = null;
			Text propertyText = (Text) propertyTextList.get( i );
			
			if ( !propertyText.isDisposed( )
					&& propertyText.getText( ) != null
					&& propertyText.getText( ).trim( ).length( ) > 0 )
			{
				value = propertyText.getText( ).trim( );
			}
			Expression expr = new Expression( value,
					(String) propertyText.getData( DataUIConstants.EXPR_TYPE ) );
			
			if ( ds instanceof DesignElementHandle )
			{
				if ( propList.get( i ) instanceof String[] )
				{
					( (DesignElementHandle) ds ).setPropertyBinding( ( (String[]) propList.get( i ) )[0],
							expr );
				}
				else if ( propList.get( i ) instanceof Property )
				{
					( (DesignElementHandle) ds ).setPropertyBinding( ( (Property) propList.get( i ) ).getName( ),
							expr );
				}
			}
		}
		catch ( Exception e )
		{
			logger.log( Level.FINE, e.getMessage( ), e );
			ExceptionHandler.handle( e );
			return true;
		}
	}
	return super.performOk( );
}
 
Example 20
public static Object getData(Text text){
	return text.getData(PROPOSAL_RET_OBJ);
}