Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Find all elements of the same type
Find all elements of the same type [message #160214] Wed, 14 November 2007 11:03 Go to next message
Eclipse UserFriend
Originally posted by: boucher.fbk.eu

Hi,

I'm a beginner with GMF and I'm facing some problems.

I'd like to know how to get access to all elements of the same type than
the element that has just be modified (in order to apply the same outline
properties like color, size,...).
Is it also possible to get access to all elements of a diagram in order to
check that there is a minimal distance between them?!

Thank you for your help.

Quentin
Re: Find all elements of the same type [message #160249 is a reply to message #160214] Wed, 14 November 2007 13:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Quentin wrote:
> Hi,
>
> I'm a beginner with GMF and I'm facing some problems.
>
> I'd like to know how to get access to all elements of the same type than
> the element that has just be modified (in order to apply the same
> outline properties like color, size,...).
This should be doable. All your objects are contained by some element
(Like library in the tutorial). This element holds a collection over all
model elements of this type, so you can just iterate through it.

> Is it also possible to get access to all elements of a diagram in order
> to check that there is a minimal distance between them?!
You can get access to all elements like I described above, but check for
minimal distance is a bit more tricky. Maybe this will be of help:

http://wiki.eclipse.org/index.php/GMF_Newsgroup_Q&A#How_ do_I_prevent_figure_overlap.3F

HTH,

Tomas Zijdemans
Re: Find all elements of the same type [message #160428 is a reply to message #160249] Wed, 14 November 2007 15:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.msn.com

I prevent overlapping in each ElementEditPart, in the
handleNotificationEvent method.
When the notifier is a Bounds, it is because You have moved a figure, and I
prevent that the new position not overlap with another figure using the
figures of the editpart.

"Tomas Zijdemans" <trommas@yahoo.com> escribió en el mensaje de
noticias:fheudq$hgj$1@build.eclipse.org...
> Quentin wrote:
>> Hi,
>>
>> I'm a beginner with GMF and I'm facing some problems.
>>
>> I'd like to know how to get access to all elements of the same type than
>> the element that has just be modified (in order to apply the same outline
>> properties like color, size,...).
> This should be doable. All your objects are contained by some element
> (Like library in the tutorial). This element holds a collection over all
> model elements of this type, so you can just iterate through it.
>
>> Is it also possible to get access to all elements of a diagram in order
>> to check that there is a minimal distance between them?!
> You can get access to all elements like I described above, but check for
> minimal distance is a bit more tricky. Maybe this will be of help:
>
> http://wiki.eclipse.org/index.php/GMF_Newsgroup_Q&A#How_ do_I_prevent_figure_overlap.3F
>
> HTH,
>
> Tomas Zijdemans
Re: Find all elements of the same type [message #160559 is a reply to message #160428] Thu, 15 November 2007 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.boucher.gmail.com

Thank you for your answers,

I'm trying to use the method suggested by Tomas but I don't understand
which elements contain all elements of the same type. I'm looking for
information about it on the Web but I don't find useful sources.

Could you help me please?
Thanks

Quentin
Re: Find all elements of the same type [message #160584 is a reply to message #160559] Thu, 15 November 2007 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Quentin wrote:
> Thank you for your answers,
>
> I'm trying to use the method suggested by Tomas but I don't understand
> which elements contain all elements of the same type.

If I understand you correctly, you want to access all elements of some
type. I'll try to explain. There are two possibilities.

1. If you want access from the "main plugin" - that is: from your model
plugin (Ex: MyProject). You can for example do:
aBook.eContainer().getBooks();

2. Access from the diagram plugin (Ex: MyProject.LibraryEditor). Here is
some code I use in a popup action:

Diagram n = (Diagram) selectedElement.getNotationView();
xyzDiagramElement diagram = (xyzDiagramElement) n.getElement();
// Then you have your diagram element, and can iterate through ex. books

Does this help, or did I misunderstand you?

Best Regards,


Tomas Zijdemans
Re: Find all elements of the same type [message #160617 is a reply to message #160584] Thu, 15 November 2007 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

You can access for all same type elements from two ways that I can remember:
- In a EditPart, you can access to the diagram editpart and then you find in
all children (getChildren() method I use) to obtain all elements.
- I model, you can obtain a EList which all elements of the same types.

I don?t know if I understand you correctly.
Regards.

"Tomas Zijdemans" <trommas@yahoo.com> escribió en el mensaje de
noticias:fhh7l9$h8r$1@build.eclipse.org...
> Quentin wrote:
>> Thank you for your answers,
>>
>> I'm trying to use the method suggested by Tomas but I don't understand
>> which elements contain all elements of the same type.
>
> If I understand you correctly, you want to access all elements of some
> type. I'll try to explain. There are two possibilities.
>
> 1. If you want access from the "main plugin" - that is: from your model
> plugin (Ex: MyProject). You can for example do:
> aBook.eContainer().getBooks();
>
> 2. Access from the diagram plugin (Ex: MyProject.LibraryEditor). Here is
> some code I use in a popup action:
>
> Diagram n = (Diagram) selectedElement.getNotationView();
> xyzDiagramElement diagram = (xyzDiagramElement) n.getElement();
> // Then you have your diagram element, and can iterate through ex. books
>
> Does this help, or did I misunderstand you?
>
> Best Regards,
>
>
> Tomas Zijdemans
Re: Find all elements of the same type [message #160643 is a reply to message #160617] Thu, 15 November 2007 12:41 Go to previous message
Eclipse UserFriend
Originally posted by: quentin.boucher.gmail.com

Thank you,

Actually I want to check some properties (compared to some elements of the
same type) of an element whent it is modified/created. I'll try to do this
with the informations you gave me.

Regards,

Quentin
Previous Topic:Connection Anchor for Connection
Next Topic:Connection with a label
Goto Forum:
  


Current Time: Thu Apr 25 12:05:59 GMT 2024

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

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

Back to the top