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

The following examples show how to use org.eclipse.swt.widgets.Text#getData() . 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 File: HadoopLocationWizard.java    From RDFS with 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
Source File: HadoopLocationWizard.java    From hadoop-gpu with 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 3
Source File: ResourceConfigurationBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 5
Source File: HadoopLocationWizard.java    From hadoop-gpu with 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 6
Source File: ScriptView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@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 7
Source File: HadoopLocationWizard.java    From RDFS with 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 8
Source File: BindingDialogHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 9
Source File: ResourceConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 10
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 11
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void textChanged( Text textControl )
{
	Key key = (Key) textControl.getData( );
	String number = textControl.getText( );
	String oldValue = setValue( key, number );
	validateSettings( key, oldValue, number );
}
 
Example 12
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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 13
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void updateText(Text curr) {
	Key key= (Key) curr.getData();

	String currValue= getValue(key);
	if (currValue != null) {
		curr.setText(currValue);
	}
}
 
Example 14
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 5 votes vote down vote up
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 15
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 5 votes vote down vote up
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 16
Source File: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void updateText(Text curr) {
	String key = (String) curr.getData();
	String currValue = getValue(key);
	if (currValue != null) {
		curr.setText(currValue);
	}
}
 
Example 17
Source File: PropertyBindingPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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 18
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
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
Source File: AutoCompleteTextUtil.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public static Object getData(Text text){
	return text.getData(PROPOSAL_RET_OBJ);
}
 
Example 20
Source File: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void textChanged(Text textControl) {
	String key = (String) textControl.getData();
	String number = textControl.getText();
	String oldValue = setValue(key, number);
	validateSettings(key, oldValue, number);
}