Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Getting default value for StringAttribute

I'm using attributes sent from the proxy to set up the label associated 
with a widget in my launch configuration tab pane and to set up the 
tooltip text. I wanted to get the default value from the attribute sent by 
the proxy so that I can put default values in each widget.

I only have one line of code in my pane where I'm trying to get the 
default value, so what you suggested below works fine for me.
Dave



Greg Watson <g.watson@xxxxxxxxxxxx> 
Sent by: ptp-dev-bounces@xxxxxxxxxxx
06/07/2007 11:37 AM
Please respond to
Parallel Tools Platform general developers <ptp-dev@xxxxxxxxxxx>


To
Parallel Tools Platform general developers <ptp-dev@xxxxxxxxxxx>
cc

Subject
Re: [ptp-dev] Getting default value for StringAttribute






Dave,

What do you want the default value for? You can get the default value 
by creating a string attribute with no initial value, then getting 
the value of the attribute. We could provide a getDefaultValue() 
convenience method if you're going to be doing this a lot.

Given an attribute definition, you'd do something like this:

StringAttribute attr = JobAttributes.getQueueIdAttributeDefinition 
().create();
String defValue = attr.getValue();

If you already have an attribute, the you'd do something like:

String defValue = attr.getDefinition().create().getValue();

Let me know if you'd us to add getDefaultValue() and will put it in.

Greg

On Jun 7, 2007, at 9:12 AM, Dave Wootton wrote:

> Randy
> I may not be understanding what we talked about at the workshop 
> regarding
> StringAttribute default values, but I don't see any way to get a 
> default
> value from a StringAttribute or StringAttributeDefinition. I see where
> StringAttributeDefinition contains a default value, but I don't see a
> method to return the default value. For my purposes, the only 
> attributes I
> care about are StringAttributes, although I may want to use
> IntegerAttributes as well.
>
> Am I missing something?
>
> Dave
> _______________________________________________
> ptp-dev mailing list
> ptp-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ptp-dev

_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev




Back to the top