Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Problem using PropertyChangeListener in a FieldEditor
Problem using PropertyChangeListener in a FieldEditor [message #253865] Thu, 12 June 2008 00:15 Go to next message
Eclipse UserFriend
Originally posted by: gdind2003.gmail.com

Hi,

I am writing a plugin and I am creating a PreferencePage which extends
FieldEditorPreferencePage.
Inside the createFieldEditors method I am creating a FieldEditor and
setting a PropertyChangeListener
using setPropertyChangeListener. But when the value change no events are
being fired.

Any ideas?

Thanks,

--Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #253869 is a reply to message #253865] Thu, 12 June 2008 04:13 Go to previous messageGo to next message
Eclipse UserFriend
G Gev wrote:
> Hi,
>
> I am writing a plugin and I am creating a PreferencePage which extends
> FieldEditorPreferencePage.
> Inside the createFieldEditors method I am creating a FieldEditor and
> setting a PropertyChangeListener
> using setPropertyChangeListener. But when the value change no events
> are being fired.
>
> Any ideas?
The FieldEditorPreferencePage itself sets a listener and since
FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
supports one listener at a time it probably overrides yours.

Dani
>
> Thanks,
>
> --Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #253885 is a reply to message #253869] Thu, 12 June 2008 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gdind2003.gmail.com

Daniel Megert wrote:
> G Gev wrote:
>> Hi,
>>
>> I am writing a plugin and I am creating a PreferencePage which extends
>> FieldEditorPreferencePage.
>> Inside the createFieldEditors method I am creating a FieldEditor and
>> setting a PropertyChangeListener
>> using setPropertyChangeListener. But when the value change no events
>> are being fired.
>>
>> Any ideas?
> The FieldEditorPreferencePage itself sets a listener and since
> FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
> supports one listener at a time it probably overrides yours.
>
> Dani
>>
>> Thanks,
>>
>> --Gautam

Then can you suggest me how to write code that will happen when the
property changes? E.g I want to enable some field if one checks a
checkbox, etc.

Thanks,

--Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #253891 is a reply to message #253885] Thu, 12 June 2008 11:10 Go to previous messageGo to next message
Eclipse UserFriend
G Gev wrote:
> Daniel Megert wrote:
>> G Gev wrote:
>>> Hi,
>>>
>>> I am writing a plugin and I am creating a PreferencePage which
>>> extends FieldEditorPreferencePage.
>>> Inside the createFieldEditors method I am creating a FieldEditor and
>>> setting a PropertyChangeListener
>>> using setPropertyChangeListener. But when the value change no events
>>> are being fired.
>>>
>>> Any ideas?
>> The FieldEditorPreferencePage itself sets a listener and since
>> FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
>> supports one listener at a time it probably overrides yours.
>>
>> Dani
>>>
>>> Thanks,
>>>
>>> --Gautam
>
> Then can you suggest me how to write code that will happen when the
> property changes? E.g I want to enable some field if one checks a
> checkbox, etc.
Extend
org.eclipse.jface.preference.FieldEditorPreferencePage.prope rtyChange(PropertyChangeEvent)

Dani
>
> Thanks,
>
> --Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #253904 is a reply to message #253891] Thu, 12 June 2008 23:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gdind2003.gmail.com

Daniel Megert wrote:
> G Gev wrote:
>> Daniel Megert wrote:
>>> G Gev wrote:
>>>> Hi,
>>>>
>>>> I am writing a plugin and I am creating a PreferencePage which
>>>> extends FieldEditorPreferencePage.
>>>> Inside the createFieldEditors method I am creating a FieldEditor and
>>>> setting a PropertyChangeListener
>>>> using setPropertyChangeListener. But when the value change no events
>>>> are being fired.
>>>>
>>>> Any ideas?
>>> The FieldEditorPreferencePage itself sets a listener and since
>>> FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
>>> supports one listener at a time it probably overrides yours.
>>>
>>> Dani
>>>>
>>>> Thanks,
>>>>
>>>> --Gautam
>>
>> Then can you suggest me how to write code that will happen when the
>> property changes? E.g I want to enable some field if one checks a
>> checkbox, etc.
> Extend
> org.eclipse.jface.preference.FieldEditorPreferencePage.prope rtyChange(PropertyChangeEvent)
>
>
> Dani
>>
>> Thanks,
>>
>> --Gautam

Thanks Dani. It worked! Why doesn't setPropertyChangeListener work? Is
this a known bug? Also FieldEditorPreferencePage does not allow multi
line textbox. Is there any work around for that as well?

Thanks,

--Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #253908 is a reply to message #253904] Fri, 13 June 2008 04:02 Go to previous messageGo to next message
Eclipse UserFriend
G Gev wrote:
> Daniel Megert wrote:
>> G Gev wrote:
>>> Daniel Megert wrote:
>>>> G Gev wrote:
>>>>> Hi,
>>>>>
>>>>> I am writing a plugin and I am creating a PreferencePage which
>>>>> extends FieldEditorPreferencePage.
>>>>> Inside the createFieldEditors method I am creating a FieldEditor
>>>>> and setting a PropertyChangeListener
>>>>> using setPropertyChangeListener. But when the value change no
>>>>> events are being fired.
>>>>>
>>>>> Any ideas?
>>>> The FieldEditorPreferencePage itself sets a listener and since
>>>> FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
>>>> supports one listener at a time it probably overrides yours.
>>>>
>>>> Dani
>>>>>
>>>>> Thanks,
>>>>>
>>>>> --Gautam
>>>
>>> Then can you suggest me how to write code that will happen when the
>>> property changes? E.g I want to enable some field if one checks a
>>> checkbox, etc.
>> Extend
>> org.eclipse.jface.preference.FieldEditorPreferencePage.prope rtyChange(PropertyChangeEvent)
>>
>>
>> Dani
>>>
>>> Thanks,
>>>
>>> --Gautam
>
> Thanks Dani. It worked! Why doesn't setPropertyChangeListener work? Is
> this a known bug?
It was a design decision to have a single listener on the field and do
the field pref page most of the needed work. If you don't like to hook
your enablement story into the FieldEditorPreferencePage.propertyChange,
you could make anonymous subclasses of the field editors and put the
enablement code into FieldEditor.fireValueChanged(String, Object, Object).
> Also FieldEditorPreferencePage does not allow multi line textbox.
This works fine for me. You need to create your own subclass of
StringFieldEditor that creates the Text widget with the SWT.MULTI style
bit set and the corresponding layout data.

Dani
> Is there any work around for that as well?
>
> Thanks,
>
> --Gautam
Re: Problem using PropertyChangeListener in a FieldEditor [message #254763 is a reply to message #253891] Sat, 05 July 2008 13:23 Go to previous message
Eclipse UserFriend
Originally posted by: fastcodejava.gmail.com

Daniel Megert wrote:
> G Gev wrote:
>> Daniel Megert wrote:
>>> G Gev wrote:
>>>> Hi,
>>>>
>>>> I am writing a plugin and I am creating a PreferencePage which
>>>> extends FieldEditorPreferencePage.
>>>> Inside the createFieldEditors method I am creating a FieldEditor and
>>>> setting a PropertyChangeListener
>>>> using setPropertyChangeListener. But when the value change no events
>>>> are being fired.
>>>>
>>>> Any ideas?
>>> The FieldEditorPreferencePage itself sets a listener and since
>>> FieldEditor.setPropertyChangeListener(IPropertyChangeListene r) only
>>> supports one listener at a time it probably overrides yours.
>>>
>>> Dani
>>>>
>>>> Thanks,
>>>>
>>>> --Gautam
>>
>> Then can you suggest me how to write code that will happen when the
>> property changes? E.g I want to enable some field if one checks a
>> checkbox, etc.
> Extend
> org.eclipse.jface.preference.FieldEditorPreferencePage.prope rtyChange(PropertyChangeEvent)
>
>
> Dani
>>
>> Thanks,
>>
>> --Gautam

Looks like I can not change the values of the field editors directly. Is
there any way?

--Gautam
http://fastcodejava.blogspot.com/
Previous Topic:ASTNode and fulley qualified names
Next Topic:Refactoring Error
Goto Forum:
  


Current Time: Sun Jul 27 16:10:22 EDT 2025

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

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

Back to the top