Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Filtering views
Filtering views [message #100401] Fri, 02 February 2007 08:35 Go to next message
Eclipse UserFriend
Originally posted by: seliva.gmail.com

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!
Re: Filtering views [message #100689 is a reply to message #100401] Fri, 02 February 2007 15:56 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Noelia,

Sounds to me like you want a non-canonical diagram. The GMF generator
generates canonical diagrams by default, I'm not sure how it works for
non-canonical diagrams.

You could get started by reading this FAQ:
http://wiki.eclipse.org/index.php/Graphical_Modeling_Framewo rk_FAQ#What_does_.27canonical.27_mean_in_the_context_of_GMF. 3F

The logic example diagram is non-canonical, but it was also not created
with the generator.

Regards,
Cherie

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!
>
Re: Filtering views [message #100722 is a reply to message #100401] Fri, 02 February 2007 16:17 Go to previous messageGo to next message
Mohammed Mostafa is currently offline Mohammed MostafaFriend
Messages: 143
Registered: July 2009
Senior Member
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!
>
Re: Filtering views [message #143335 is a reply to message #100722] Wed, 18 July 2007 18:26 Go to previous message
Eclipse UserFriend
Originally posted by: marcio.debarros.gmail.com

Hi Mohammed,

I am trying to do the same thing as Noelia was, however when I overrid the
getModelChildren() method, the I want to filter Node 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!
>>
Previous Topic:Refreshing missing edges/connections
Next Topic:Filtering Views
Goto Forum:
  


Current Time: Wed Jan 15 12:50:14 GMT 2025

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

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

Back to the top