Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Scout RT model
Scout RT model [message #988745] Sun, 02 December 2012 09:58 Go to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
I am working on the Scout RT model. I wonder which meta-information indicates a containment relation (between table and menu for example).

I have identified the code that load the menus of a table:
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);


So I could look for all uses of ConfigurationUtility#sortFilteredClassesByOrderAnnotation and ConfigurationUtility#filterClasses...

Is there on other method / marker / way?

For example: How does the SDK knows it should add a "Menu" folder under a "Table"?
Re: Scout RT model [message #988824 is a reply to message #988745] Mon, 03 December 2012 05:58 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias Villiger
Messages: 78
Registered: September 2011
Member
Hi Jeremie,

As you are working on the runtime, the way the SDK finds e.g. menus in a table would not help you much I guess.
The SDK has no binaries available when calculating the menues. Actually it is done using the JDT Type Hierarchies. Have a look at the following code snippet:

IType interfaceType = TypeUtility.getType(RuntimeClasses.IMenu);
Comparator<IType> sortingComparator = ScoutTypeComparators.getOrderAnnotationComparator();
ITypeHierarchy typeHierarchy = TypeUtility.getLocalTypeHierarchy(declaringType);
TypeUtility.getInnerTypes(declaringType, TypeFilters.getSubtypeFilter(interfaceType, typeHierarchy), sortingComparator);

Where declaringType is the IType defining the table containing the menues.

This is the way the SDK calculates the menus in a table at design time.
If you have a Scout application running at runtime, you can use reflection like it is done in the ConfigurationUtility as shown in your code. This would then be the correct way to go.

regards,
matthias
Re: Scout RT model [message #988984 is a reply to message #988824] Tue, 04 December 2012 02:23 Go to previous message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
Hi Matthias,

Thanks a lot for your answer...

At runtime, when I have an instance of a Table (in the scout model domain) I can obtain the menus with:
ITable#getMenus() returns IMenu[]

My question is a little bit different... How can I know that a Table contains Menu...
Maybe it is something that I can not derive from the code (anywhere RT, SDK)...

I do not expect so many Composition relationships, the best solution is probably to review the code manually.
Previous Topic:Eclipse Scout Roadmap
Next Topic:ServerJob doesn't wait for delay before to reschedule
Goto Forum:
  


Current Time: Sat Aug 30 10:32:43 EDT 2014

Powered by FUDForum. Page generated in 0.01612 seconds