communicating editor preferences to editparts [message #100442] |
Fri, 17 October 2003 02:46  |
Eclipse User |
|
|
|
I need to implement a couple of features that require editparts to
respond to changes in editor settings rather than just changes in the
model. Also these operations are not in the context of the current tool
or selection. Instead I need to traverse all the editparts in my diagram
to find the ones that are affected.
For example my application has different kinds of connections, some of
which have labels. I want to implement an action that toggles the
display of a connection's label between a terse and a verbose
representation.
I'm not sure of the best GEF-centric way to do this. From my editor
class I could iterate over all the editparts in the EditPart registry,
but then what...? Just filter on instances of the EditPart sublasses
I'm looking for and invoke their appropriate method, or should I be
using Requests, making a new EditPolicy, ...
|
|
|
|
Re: communicating editor preferences to editparts [message #100509 is a reply to message #100470] |
Fri, 17 October 2003 12:58  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
We plan on adding EditPartViewer properties in 3.0. Probably just a mapping
of Strings to Objects. So, you could do something like
viewer.setProperty("VERBOSE_LABELS", new Boolean(true));. You don't
necessarily need the feature, but it might be cleaner with.
Then, you can either take Guy's approach and have every editpart listen to
the property change, or you can have a single listener, which then
multi-casts the change to the editparts which are interested (maybe they
implement some additional interface). If you are against adding new
interfaces, you could send a Request like:
for each editpart ep:
ep.performRequest(new ToggleLabelVisibilityRequest("VERBOSE");
"Guy Slade" <gsladeNOSPAM@us.ibm.com> wrote in message
news:bmoqii$su9$1@eclipse.org...
> Why not just make the edit parts listeners on whatever is changing your
> settings. The thing controlling the setting changes can fire an event (
that
> you make up ) to all the listeners and if the event is of interest to the
> listener then it does something. Don't forget to unregister the listener
on
> dispose.
>
> Guy
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05169 seconds