Since Scout supports modularity in projects we decided to modularize things. Problem is when we add an Outline to a project: how to add a page to that outline, but when page is present in child project. Function that adds pages to outline lives inside the outline and the problem is we should not have parent dependent on the child since we will get cycles in dependencies.
The outline is of type AbstractExtensibleOutline and probably supports extending/extensions based on name and comment in class header, but I haven't been able to figure out yet where and how to do that.
I do not doubt that your programmatically solution is working, but I like to propose another one using eclipse extension points. I think this is the intended way of using this API.
In your extension, you do not need a DesktopExtension
at all.
mycore.client (Core Project)
|
\- Desktop
|
\- MyOutline
myext.client (Extended Project)
|
\- MyPage
If MyOutline
extends AbstractExtensibleOutline
, you can just add MyPage
directly to the MyOutline
(defined in the core) with a pageContribution
(using the org.eclipse.scout.rt.extension.client.pages
extension point).
The plugin.xml
of the client extention bundle (myext.client
) File is looking like that if you display the text:
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension
point="org.eclipse.scout.rt.extension.client.pages">
<pageContribution
active="true"
class="myext.client.pages.MyPage"
order="1">
<outline
class="mycore.client.ui.desktop.outlines.MyOutline">
</outline>
</pageContribution>
</extension>
</plugin>
With the Order field, you can indicate the position in the page list (this way you can insert pages in the middle of the list).
You can also register:
pageModification
pageRemoval
... depending on your needs.
Check also this Forum Post where I have described how you can contribute a Menu
the same way: Multi Module - Menu Extension
Please also notice that for Mars (starting with version 4.2) we have introduced another mechanism for extensibility. Check this wiki page to read more about it: Scout Concepts - Extensibility.
This new mechanism is more powerfull than what we had introduced with Kepler (Scout 3.9). The Mars Version supports both the new and the old extensibility pattern. On the long term, I think that only the new pattern will be supported.