Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Properties view question - what about bad values?
Properties view question - what about bad values? [message #307118] Mon, 14 August 2006 17:07 Go to next message
Eclipse UserFriend
Originally posted by: combs.edgedynamics.com

I'd appreciate any help on the following:

I've got a TreeViewer that's showing a number of objects
that I want to adjust through the Properties view. I've
set things up so that the properties show correctly in
the Properties view. What I'm wondering is how, if at all,
the Properties view (through the 'setPropertyValue' method
on the IPropertySource) allows the IPropertySource object
to indicate that the value the user entered isn't valid?
For example, if I have a property that's a text entry but
is expecting the user to type in an integer and they don't,
is there any current mechanism to show an error, or blow
the value away, or otherwise let the IPropertySource say
"hey, that entry isn't good"?

Thanks for any help on this one!
Dave Combs
Re: Properties view question - what about bad values? [message #307120 is a reply to message #307118] Mon, 14 August 2006 17:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Usually that is done by the cell editor or cell editor validator itself
before the property is applied.

Dave Combs wrote:
> I'd appreciate any help on the following:
>
> I've got a TreeViewer that's showing a number of objects
> that I want to adjust through the Properties view. I've
> set things up so that the properties show correctly in
> the Properties view. What I'm wondering is how, if at all,
> the Properties view (through the 'setPropertyValue' method
> on the IPropertySource) allows the IPropertySource object
> to indicate that the value the user entered isn't valid?
> For example, if I have a property that's a text entry but
> is expecting the user to type in an integer and they don't,
> is there any current mechanism to show an error, or blow
> the value away, or otherwise let the IPropertySource say
> "hey, that entry isn't good"?
>
> Thanks for any help on this one!
> Dave Combs
>

--
Thanks,
Rich Kulp
Re: Properties view question - what about bad values? [message #307122 is a reply to message #307118] Mon, 14 August 2006 17:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vik_ram.hotmail.com

You could also do the validations in the setPropertyValue method.
If a prop val is invalid, you could reset it and display a message in
the status bar

Dave Combs wrote:

> I'd appreciate any help on the following:
>
> I've got a TreeViewer that's showing a number of objects
> that I want to adjust through the Properties view. I've
> set things up so that the properties show correctly in
> the Properties view. What I'm wondering is how, if at all,
> the Properties view (through the 'setPropertyValue' method
> on the IPropertySource) allows the IPropertySource object
> to indicate that the value the user entered isn't valid?
> For example, if I have a property that's a text entry but
> is expecting the user to type in an integer and they don't,
> is there any current mechanism to show an error, or blow
> the value away, or otherwise let the IPropertySource say
> "hey, that entry isn't good"?
>
> Thanks for any help on this one!
> Dave Combs
>
Re: Properties view question - what about bad values? [message #307124 is a reply to message #307122] Mon, 14 August 2006 17:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: combs.edgedynamics.com

vikram wrote:

This is the type of solution I had implemented for myself in
the Swing app that this Eclipse app is being ported from.

One other question, though--if I do decide to reset/ignore
the property change in setPropertyValue and display an error
message, is the property view smart enough to notice that the
value the user had typed in was not stored and to display
whatever value is really there when the setPropertyValue()
call is completed? I'll experiment, but was curious if anybody
knows already.

Thanks for the help--much appreciated!
Dave

> You could also do the validations in the setPropertyValue method.
> If a prop val is invalid, you could reset it and display a message in
> the status bar
>
> Dave Combs wrote:
>
>> I'd appreciate any help on the following:
>>
>> I've got a TreeViewer that's showing a number of objects
>> that I want to adjust through the Properties view. I've
>> set things up so that the properties show correctly in
>> the Properties view. What I'm wondering is how, if at all,
>> the Properties view (through the 'setPropertyValue' method
>> on the IPropertySource) allows the IPropertySource object
>> to indicate that the value the user entered isn't valid?
>> For example, if I have a property that's a text entry but
>> is expecting the user to type in an integer and they don't,
>> is there any current mechanism to show an error, or blow
>> the value away, or otherwise let the IPropertySource say
>> "hey, that entry isn't good"?
>>
>> Thanks for any help on this one!
>> Dave Combs
>>
Re: Properties view question - what about bad values? [message #307130 is a reply to message #307124] Mon, 14 August 2006 18:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vik_ram.hotmail.com

The getPropertyValue is always invoked after the setPropertyValue ( if I
remember correctly ). So, the value displayed will be whatever you
return in the getter.

Let's say your model variable is m_model, you could do something like this.


Object getPropertyValue(Object id)
{
if(id.equals("NAME")
{
return m_model.getName();
}

}

void setPropertyValue(Object id, Object val)
{
if(id.equals("NAME")
{
String name = (String)val;
if(isValid(name) )
{
m_model.setValue(name);
}
else
m_model.setValue("");
}

}

Dave Combs wrote:

> vikram wrote:
>
> This is the type of solution I had implemented for myself in
> the Swing app that this Eclipse app is being ported from.
>
> One other question, though--if I do decide to reset/ignore
> the property change in setPropertyValue and display an error
> message, is the property view smart enough to notice that the
> value the user had typed in was not stored and to display
> whatever value is really there when the setPropertyValue()
> call is completed? I'll experiment, but was curious if anybody
> knows already.
>
> Thanks for the help--much appreciated!
> Dave
>
>
>>You could also do the validations in the setPropertyValue method.
>>If a prop val is invalid, you could reset it and display a message in
>>the status bar
>>
>>Dave Combs wrote:
>>
>>
>>>I'd appreciate any help on the following:
>>>
>>>I've got a TreeViewer that's showing a number of objects
>>>that I want to adjust through the Properties view. I've
>>>set things up so that the properties show correctly in
>>>the Properties view. What I'm wondering is how, if at all,
>>>the Properties view (through the 'setPropertyValue' method
>>>on the IPropertySource) allows the IPropertySource object
>>>to indicate that the value the user entered isn't valid?
>>>For example, if I have a property that's a text entry but
>>>is expecting the user to type in an integer and they don't,
>>>is there any current mechanism to show an error, or blow
>>>the value away, or otherwise let the IPropertySource say
>>>"hey, that entry isn't good"?
>>>
>>>Thanks for any help on this one!
>>>Dave Combs
>>>
>
>
Re: Properties view question - what about bad values? [message #307132 is a reply to message #307130] Mon, 14 August 2006 18:17 Go to previous message
Eclipse UserFriend
Originally posted by: combs.edgedynamics.com

Excellent! That's exactly the behavior I was hoping for.
Thanks,
Dave

vikram wrote:

>
>
> The getPropertyValue is always invoked after the setPropertyValue ( if I
> remember correctly ). So, the value displayed will be whatever you
> return in the getter.
>
> Let's say your model variable is m_model, you could do something like
> this.
>
>
> Object getPropertyValue(Object id)
> {
> if(id.equals("NAME")
> {
> return m_model.getName();
> }
>
> }
>
> void setPropertyValue(Object id, Object val)
> {
> if(id.equals("NAME")
> {
> String name = (String)val;
> if(isValid(name) )
> {
> m_model.setValue(name);
> }
> else
> m_model.setValue("");
> }
>
> }
>
> Dave Combs wrote:
>
>> vikram wrote:
>>
>> This is the type of solution I had implemented for myself in
>> the Swing app that this Eclipse app is being ported from.
>>
>> One other question, though--if I do decide to reset/ignore
>> the property change in setPropertyValue and display an error
>> message, is the property view smart enough to notice that the
>> value the user had typed in was not stored and to display
>> whatever value is really there when the setPropertyValue()
>> call is completed? I'll experiment, but was curious if anybody
>> knows already.
>>
>> Thanks for the help--much appreciated!
>> Dave
>>
>>
>>>You could also do the validations in the setPropertyValue method.
>>>If a prop val is invalid, you could reset it and display a message in
>>>the status bar
>>>
>>>Dave Combs wrote:
>>>
>>>
>>>>I'd appreciate any help on the following:
>>>>
>>>>I've got a TreeViewer that's showing a number of objects
>>>>that I want to adjust through the Properties view. I've
>>>>set things up so that the properties show correctly in
>>>>the Properties view. What I'm wondering is how, if at all,
>>>>the Properties view (through the 'setPropertyValue' method
>>>>on the IPropertySource) allows the IPropertySource object
>>>>to indicate that the value the user entered isn't valid?
>>>>For example, if I have a property that's a text entry but
>>>>is expecting the user to type in an integer and they don't,
>>>>is there any current mechanism to show an error, or blow
>>>>the value away, or otherwise let the IPropertySource say
>>>>"hey, that entry isn't good"?
>>>>
>>>>Thanks for any help on this one!
>>>>Dave Combs
>>>>
>>
>>
Previous Topic:Is .sitebuild/sitebuild.xml still needed?
Next Topic:Turn off ".* resources" filter by default in xml?
Goto Forum:
  


Current Time: Wed Jul 17 23:29:32 GMT 2024

Powered by FUDForum. Page generated in 0.03769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top