下面列出了org.eclipse.swt.widgets.Text#getData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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());
}
});
}
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 );
}
}
}
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 );
}
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());
}
});
}
protected void updateText(Text curr) {
String key = (String) curr.getData();
String currValue = getValue(key);
if (currValue != null) {
curr.setText(currValue);
}
}
protected void textChanged(Text textControl) {
Key key = (Key) textControl.getData();
String number = textControl.getText();
String oldValue = setValue(key, number);
reconcileControls();
validateSettings(key, oldValue, number);
}
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;
}
protected void updateText(Text curr) {
Key key= (Key) curr.getData();
String currValue= getValue(key);
if (currValue != null) {
curr.setText(currValue);
}
}
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;
}
protected void textChanged( Text textControl )
{
Key key = (Key) textControl.getData( );
String number = textControl.getText( );
String oldValue = setValue( key, number );
validateSettings( key, oldValue, number );
}
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;
}
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 ) );
}
}
}
}
}
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;
}
}
}
}
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());
}
});
}
@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();
}
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());
}
});
}
protected void textChanged(Text textControl) {
String key = (String) textControl.getData();
String number = textControl.getText();
String oldValue = setValue(key, number);
validateSettings(key, oldValue, number);
}
protected void textChanged(Text textControl) {
Key key= (Key) textControl.getData();
String number= textControl.getText();
String oldValue= setValue(key, number);
validateSettings(key, oldValue, number);
}
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( );
}
public static Object getData(Text text){
return text.getData(PROPOSAL_RET_OBJ);
}