Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EGL] How to access classes from certain package?
[EGL] How to access classes from certain package? [message #997344] Sun, 06 January 2013 17:16 Go to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hello,

How do I know what are the classes from certain package? Is there an operation for such thing?

I will include an example, let's say I have this model:

Package A:
- Class: aa
- Class: bb
- Class: cc
Package B:
- Class: aa
- Class: ee


And I wanna create two folders, like this:

A/aa
A/bb
A/cc
B/aa
B/ee


But as far as I tried what I get looks like this (which I don't want, obviously):
A/aa
A/bb
A/cc
A/ee
B/aa
B/bb
B/cc
B/ee


If anyone could help me.
Thanks in advance.
Re: [EGL] How to access classes from certain package? [message #997369 is a reply to message #997344] Mon, 07 January 2013 08:31 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

I suspect that your code looks something like this:

for (p in Package.all) {
for (c in Class.all) {
// Create directory
}
}

while it should look like this instead:

for (p in Package.all) {
for (c in p.classes) { // Iterate only through the classes of that package
// Create directory
}
}

If this is not the case, please feel free to attach a minimal example [1] and I'll have a closer look at this.

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [EGL] How to access classes from certain package? [message #997377 is a reply to message #997369] Mon, 07 January 2013 09:10 Go to previous messageGo to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hi Dimitris,


Dimitris Kolovos wrote on Mon, 07 January 2013 03:31


for (p in Package.all) {
for (c in p.classes) { // Iterate only through the classes of that package
// Create directory
}
}


Yes, I have something like that but I don't know how to do the p.classes line, as it gives me this error:

Property 'classes' not found in object org.eclipse.uml2.uml.internal.impl.PackageImpl@97fb72 [name: Recursive, visibility: <unset>] [URI: null]


Minimal attached.
  • Attachment: Minimal.zip
    (Size: 19.67KB, Downloaded 169 times)
Re: [EGL] How to access classes from certain package? [message #997381 is a reply to message #997377] Mon, 07 January 2013 09:20 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

Would the following do the trick?

for (c in p.packagedElement.select(e|e.isTypeOf(Class))) { ... }

The EPackage Registry view may help with similar problems in the future:

http://eclipse.org/epsilon/doc/articles/epackage-registry-view/

Cheers,
Dimitris
Re: [EGL] How to access classes from certain package? [message #997386 is a reply to message #997381] Mon, 07 January 2013 09:26 Go to previous messageGo to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member

I just tried that line but it gives me this error:
Method 'isTypeOf' not found for: org.eclipse.uml2.uml.internal.impl.ClassImpl@1651826 [name: Graph, visibility: <unset>] [isLeaf: false, isAbstract: false, isFinalSpecialization: false] [isActive: false]

[Updated on: Mon, 07 January 2013 09:28]

Report message to a moderator

Re: [EGL] How to access classes from certain package? [message #997388 is a reply to message #997386] Mon, 07 January 2013 09:28 Go to previous message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Ahh, nevermind, I just did something wrong.

It works perfectly now.
Thanks for the help and the tips!
Cheers.
Previous Topic:[EVL] Problem running a evl file
Next Topic:[Eugenia] Changing the figure of a node depending of one of its attributes
Goto Forum:
  


Current Time: Fri Apr 19 13:31:16 GMT 2024

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

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

Back to the top