Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » property change notification
property change notification [message #173441] Thu, 24 March 2005 13:52 Go to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

Hi!

Having problems with property change notification. I have the editor, a
property view, as well as an outline view. Model objects extend
org.eclipse.jface.util.ListenerList. The edit parts for both editor and
outline views implement IPropertyChangeListener. When I update an
attribute in the property view, the corresponding edit parts for both
editor and outline views are notified, as expected.

The outline view will always display a complete edit part hierarchy but
the editor might only show a subset (one, several or all panels).
Selection in the outline view determines what to show in the editor, so
the tree edit parts in the outline view implement
org.eclipse.jface.viewers.ISelectionChangedListener. When a panel is
selected the model is updated (visible=true/false, for example) and this
in turn fires a propertyChange. However, on this ocassion, only the edit
parts for the outline view are notified but I need the editor to be
notified so I can show/hide the appropriate model objects. The edit parts
in the editor do not implement ISelectionChangedListener as selected
objects may not be visible.

Any suggestions?

Many Thanks!
Re: property change notification [message #173521 is a reply to message #173441] Thu, 24 March 2005 16:06 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Sidney Lee" <sidus68@yahoo.com> wrote in message
news:f8d95960e372e0c45508d1c27cfa388b$1@www.eclipse.org...
> Hi!
>
> Having problems with property change notification. I have the editor, a
> property view, as well as an outline view. Model objects extend
> org.eclipse.jface.util.ListenerList. The edit parts for both editor and
> outline views implement IPropertyChangeListener. When I update an
> attribute in the property view, the corresponding edit parts for both
> editor and outline views are notified, as expected.
>
> The outline view will always display a complete edit part hierarchy but
> the editor might only show a subset (one, several or all panels).
> Selection in the outline view determines what to show in the editor, so
> the tree edit parts in the outline view implement
> org.eclipse.jface.viewers.ISelectionChangedListener. When a panel is
> selected the model is updated (visible=true/false, for example) and this
> in turn fires a propertyChange. However, on this ocassion, only the edit
> parts for the outline view are notified but I need the editor to be
> notified so I can show/hide the appropriate model objects. The edit parts
> in the editor do not implement ISelectionChangedListener as selected
> objects may not be visible.

They need to. Listening for the visibility property is not the same as
setting the value of that property when the selection changes. What you
should do is have the visibility notification happen in the same way as the
rest of the notification (i.e., no need for ISelectionChangedListener).
Then your editor will get notified of visibility changes and can update
appropriately. However, only your OutlineViewer should change that property
(when an EditPart is selected).

>
> Any suggestions?
>
> Many Thanks!
>
Re: property change notification [message #174154 is a reply to message #173521] Tue, 29 March 2005 12:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

Hi! Thanks for the response but not sure I followed entirely. The main
issue here is to show/hide panels in the editor (a panel contains a
collection of controls, i.e. labels, editboxes, buttons, etc.), based on
the panel (or contained control) selected in the outline view. As
mentioned before, the edit parts for both editor and outline views are
listeners to property changes in the model. The outline view always
displays a complete edit part hierarchy while the editor may only show a
subset (based on panel selection in the outline view). Apropos your
advice, the tree edit parts in the outline view no longer implement the
ISelectionChangedListener interface.
My panel objects have a visibility property but I still need some sort of
notificaion in order to set it. So I extended the SelectionEditPolicy and
implemented the showSelection/hideSelection, and the edit part for the
tree item in my outline view installs the policy for
SELECTION_FEEDBACK_ROLE. So, when the visibility property is set on the
panel object, I fire a property change (as I do with other property
changes). However, only the edit part for the outline view is notified
whereas I need the edit part for the editor to be notified as well so I
can show/hide the appropriate model objects, i.e. the propertyChange
method would call refreshChilden, which in turn calls my getModelChildren
that would exclude panels which are not visible from the editor.

Where am I going wrong?

Regards,
Re: property change notification [message #174239 is a reply to message #174154] Tue, 29 March 2005 16:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

(with the the edit parts for both editor and outline views as listeners to
property changes in the model, when I update an attribute in the property
view (the width of the component, for example), the corresponding edit
parts for both editor and outline views are notified, as expected.
However, and what puzzles me, when a component is selected in the outline
view and the component's visibility is updated, only the tree edit part
for the outline view is notified)
Re: property change notification [message #174270 is a reply to message #174239] Tue, 29 March 2005 17:02 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Sidney Lee" <sidus68@yahoo.com> wrote in message
news:40842aaaef019bd696ee59d56336bacd$1@www.eclipse.org...
> (with the the edit parts for both editor and outline views as listeners to
> property changes in the model, when I update an attribute in the property
> view (the width of the component, for example), the corresponding edit
> parts for both editor and outline views are notified, as expected.
> However, and what puzzles me, when a component is selected in the outline
> view and the component's visibility is updated, only the tree edit part
> for the outline view is notified)
>

Right, so that's the problem. And it shouldn't be happening. You need to
get to the bottom of this. The problem is in your set-up somewhere, so we
can't do anything to help you there. Just set a breakpoint in the
setVisible() method in your model and look at the list of listeners. See if
the editor's edit part is in that list, and if not, why not.
Re: property change notification [message #174443 is a reply to message #174270] Wed, 30 March 2005 08:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

that I have verified... when I update an attribute in the property
view (the width of the component, for example), the list of listeners
contains the edit parts for both editor and outline views. However, when a
component is selected in the outline view, only the tree edit part for the
outline view is in the listener list. I assume that since the listener
list contains the edit parts for both editor and outline views when I
update an attribute in the property view that my setup would seem to be
correct. Is there any reason u could perhaps think of that would be
causing the discrepancies in the list?
Re: property change notification [message #174450 is a reply to message #174270] Wed, 30 March 2005 08:59 Go to previous message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

(nevermind, found the problem - thanks for the help!)
Previous Topic:Please Help!!!
Next Topic:canExecute() method give some problems
Goto Forum:
  


Current Time: Wed Apr 24 23:19:39 GMT 2024

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

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

Back to the top