Modular Application [message #1024146] |
Mon, 25 March 2013 18:41  |
Eclipse User |
|
|
|
Hello,
I'm new in the scout community . I'm working on a project using eclipse scout. I want to know how I can develop a modular application.
Is there any experience on how to design such kind of applications?
I looked at the documation published by Ivan Motsch and Stefan Mutschler
but I could not know how to use the injectDesktopExtensions function.
thank you pout your cooperation.
|
|
|
|
|
Re: Modular Application [message #1028210 is a reply to message #1028047] |
Wed, 27 March 2013 21:00   |
Eclipse User |
|
|
|
Hi Yassine
Short answer: If you already have a desktop extension class, simply create a new instance of it, set the core desktop, and add it to the list of desktop extensions.
@Override
protected void injectDesktopExtensions(List<IDesktopExtension> desktopExtensions) {
DesktopExtension extension = new DesktopExtension();
extension.setCoreDesktop(this);
desktopExtensions.add(extension);
}
A somewhat more elaborate answer:
/!\ Disclaimer: The area of Scout modules and extensions is under heavy development for the upcoming Eclipse Kepler release (3.9). There will be much better support for Scout modules also in the SDK. As of now (Eclipse Juno, 3.8), there is quite some manual work involved to set-up a Scout module. There is also a risk that this answer will be outdated in a few months.
But now let's get started :) We'll start from scratch with a core Scout application and will add a Scout module to it.
- create core application
[Scout View] Create a new Scout project with name org.example.myapp and postfix core. This will create bundles with names org.example.myapp.[client|shared|server].core
- create extension bundles
[Java View] Manually create three bundles (plug-in projects) with names org.example.myapp.[client|shared|server].extension. The naming pattern is important (the postfix extension should reflect the name of your module, though).
- set-up bundle dependencies
[Java View] Open the manifest editor for all three bundles and define bundle dependencies:
org.example.myapp.client.extension depends on org.eclipse.scout.rt.client and org.example.myapp.shared.extension.
org.example.myapp.shared.extension depends on org.eclipse.scout.rt.shared. Re-export this dependency!
org.example.myapp.server.extension depends on org.eclipse.scout.rt.server and org.example.myapp.shared.extension.
- make your bundles Scout bundles
[Scout View] Use menu "Import Plugin..." on the "Scout Projects" folder and import all three extension bundles. Restart Eclipse.
- create a desktop extension
[Java View] Create a new class in the
org.example.myapp.client.extension bundle: org.example.myapp.client.extension.ui.desktop.DesktopExtension which inherits from org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension
- building the extension
[Scout View] The Scout SDK now displays your three extension bundles as a separate Scout module. The orange client node also contains a "Desktop-Extension" node. You can now use the Scout SDK to build your module as you would with a normal Scout application. Well, almost. There are a few further caveats: You also need to create a separate TextProviderService for your extension module (do this in the corresponding folder in the shared bundle).
Also, when adding a new outline to the desktop extension, the generated Java code did not compile in my test. You need to fix this manually: In the constructor of the generated OutlineViewButton change Desktop.this to getCoreDesktop() and you should be fine.
You might stumble over some more issues like this, but all of them can be resolved in one way or another :)
- integrate with the core application
Finally we're back to your initial question :) We now have a desktop extension class which we will integrate to the core application.
[Java View] Open the manifest editor for the client extension bundle. Export the package containing the desktop extension class (org.example.myapp.client.extension.ui.desktop).
Open the manifest editor for the client core bundle. Import the above package from the client extension bundle.
Adapt the product files for both the client and server products. Add the extension bundles to the dependencies (client and shared bundles in the client product, server and shared in the server product).
In the Desktop class of the client core bundle, override the method injectDesktopExtensions() and add an instance of the desktop extension class to the list of extensions (see above).
Scout SDK with a Scout module:

Simple demo with an extension outline:

Cheers Lukas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Modular Application [message #1042897 is a reply to message #1041478] |
Tue, 16 April 2013 22:29  |
Eclipse User |
|
|
|
Thank you very much Mr. Jeremie for your explanation.
In fact the error occurred because I had not inserted a key (named Extension) in the file Texts.properties found in the Resources folder of the plugin shared.
I did that and it works very well.
Thank you once again for your help
Best regards.
|
|
|
Powered by
FUDForum. Page generated in 0.07990 seconds