Filtering Views [message #143346] |
Wed, 18 July 2007 19:31 |
Eclipse User |
|
|
|
Originally posted by: marcio.debarros.gmail.com
I am trying to do the same thing as the other use belo, however when I
override the getModelChildren() method, the Node I want to filter goes away
from the
diagram, but its connection to a non-filtered/visible Node is still
displayed.
How can I get around that ?
Thanks,
--Marcio
"Mohammed Mostafa" <mmostafa@ca.ibm.com> wrote in message
news:epvoar$og2$1@utils.eclipse.org...
> Hi Noelia ;
>
> Figures displayed on the diagram surface depends on what the
> GraphicalEditPart#getModelChildren returns;
>
> For example, we hide all views that had FALSE visibility by default so,
> although the view is created the figure and the edit part will not be
> created
>
> to achieve this we override the getModelChildren in the GraphicalEditPart
> and implemented it like this
>
> protected List getModelChildren() {
> Object model = getModel();
> if(model!=null && model instanceof View){
> return new ArrayList(((View)model).getVisibleChildren());
> }
> return Collections.EMPTY_LIST;
> }
>
> you can override this method in the edit part where you had filtering and
> do more checks there for example you can remove any view that had semantic
> element of type X
>
>
> This is one way to implement filtering from the runtime point of view
>
>
> Noelia Rodriguez wrote:
>> Hi!
>>
>> I am trying to add some kind of view filter to my gmf diagram. The
>> purpose is to be able to show/hide certain type of objects. For
>> example,if I have elements of the types A,B & C, I would like to be able
>> to choose that only the types A & B are displayed.
>> I have found some information:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=114225
>> where it says it should be possible by using EditPolicies, but I really
>> dont know which role should I use (I didnt find any examples)
>>
>> I also found this other link:
>> http://wiki.eclipse.org/index.php/FAQ_How_do_I_filter_the_co ntents_of_a_viewer%3F
>> but I am afraid it may be only for views of the Eclipse editor, and not
>> only the gmf diagram. Could I use this for my purpose? I tried to add a
>> filter to MyDiagramEditPart.getViewer but it didnt work.
>> I would be glad if someone could give me a hint. Thanks!
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04003 seconds