|
Re: Cannot see outline and menu [message #717574 is a reply to message #717560] |
Sun, 21 August 2011 13:15 |
|
Hi Pietro
When creating a new scout application you can choose between some application templates. It seems to me that your application was created with the template "Application with a single form". This template does not include the code for starting the forms used by outline and pages.
To change this behavior you need to add the code to startup the outline forms when opening the desktop:
@Override
protected void execOpened() throws ProcessingException {
// outline tree
DefaultOutlineTreeForm treeForm = new DefaultOutlineTreeForm();
treeForm.startView();
//outline table
DefaultOutlineTableForm tableForm = new DefaultOutlineTableForm();
tableForm.startView();
if (getAvailableOutlines().length > 0) {
setOutline(getAvailableOutlines()[0]);
}
}
This should solve your issue with the outline. To solve the issue with the menus some hand work need to be done because scout does not link the menus defined in the desktop with the eclipse menu bar so far.
Basically you need to declare the eclipse menus in the plugin.xml of the ui.swt plugin, create a command and link its handler with the menu action in the desktop. I suggest to have a look at the org.eclipse.ui.menus extension point and the command/handler concept.
If I have time next week I can provide a howto but do not rely on that.
Hope that helps
Claudio
|
|
|
|
|
Re: Cannot see outline and menu [message #735430 is a reply to message #717560] |
Tue, 11 October 2011 18:54 |
Jeremie Bresson Messages: 124 Registered: November 2010 |
Senior Member |
|
|
I imagine you have defined menus in your Desktop class (Scout Model). Menus are defined as inner class of other elements that accept them (Desktop in this case, but also Table, Pages, SmartField...).
Something like:
public class Desktop extends AbstractDesktop implements IDesktop {
private static IScoutLogger logger = ScoutLogManager.getLogger(Desktop.class);
public Desktop() {
}
//...
@Order(10.0)
public class FileMenu extends AbstractMenu {
@Override
public String getConfiguredText() {
return Texts.get("FileMenu");
}
@Order(10.0)
public class AddMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return Texts.get("Add");
}
@Order(10.0)
public class CollectionMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return Texts.get("Collection");
}
@Override
protected void execAction() throws ProcessingException {
//TODO add logic to add a new collection
}
}
@Order(20.0)
public class PictureMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return Texts.get("Picture");
}
@Override
protected void execAction() throws ProcessingException {
//TODO add logic to add a new image
}
}
}
@Order(20.0)
public class ExitMenu extends AbstractMenu {
@Override
public String getConfiguredText() {
return Texts.get("ExitMenu");
}
@Override
public void execAction() throws ProcessingException {
ClientSyncJob.getCurrentSession(ClientSession.class).stopSession();
}
}
}
}
Are you using a SWT UI rendering plug in?
If yes, what you point out is a big limitation of the current implementation of the SWT rendering plug-in. Desktop is not correctly supported rendered. (See also: [SWT GUI] switch between outlines attached to the desktop)
This is because of a timing problem. The SWT Rendering plug-in uses the traditional Eclipse RCP Stack (Application ApplicationWorkbenchAdvisor, ApplicationWorkbenchWindowAdvisor, ApplicationActionBarAdvisor...). When the application is started, the Scout Client model isn't instantiated yet.
This could be solved with e4 (considering Scout Client Model as a processor that contribute elements to the application model).
Current solution:
Add the code to add the menu as you would do for any other RCP Application. If you only want a SWT application, you can do this instead of the scout client model. If you want have a single sourced application with multiple UI (multiple renderer like SWT, Swing, RAP...) you need to duplicate in SWT, what you have coded in the Scout Client model.
In SWT, if you want to access something on the scout desktop, you can use the code given here:
ISwtEnvironment env = Activator.getDefault().getEnvironment();
final IDesktop desktop = env.getScoutDesktop();
Runnable t = new Runnable() {
@Override
public void run() {
// your code here, using the scout desktop.
}
};
env.invokeScoutLater(t, 0);
Other solution: use Swing renderer.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03629 seconds