Cannot see outline and menu [message #717560] |
Sun, 21 August 2011 07:08  |
Eclipse User |
|
|
|
As you can see in attached images, my app has an outline with a table page, and the default menus. However, when I start the SWT application, I cannot see none of these.
I tried various combination, but nothing changed.
The only warning I see at start of the app is:
!ENTRY org.eclipse.ui 4 4 2011-08-21 12:52:19.477
!MESSAGE Referenced part does not exist yet: frantoio.ui.swt.views.TablePageView.
I updated to the last nightly update, but nothing changed.
Thanks for your help
|
|
|
|
|
|
Re: Cannot see outline and menu [message #735430 is a reply to message #717560] |
Tue, 11 October 2011 14:54   |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: Cannot see outline and menu [message #735956 is a reply to message #735430] |
Thu, 13 October 2011 04:21  |
Eclipse User |
|
|
|
thanks,
it works although I don't quite understand why in the code below the first call MessageBox.showOkMessage() gives an error and the second, inside the run() works well.
Regards Bertin
@Override
protected void makeActions(IWorkbenchWindow window) {
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
vensterClientenAction = new Action("Clienten...") {
@Override
public void run() {
MessageBox.showOkMessage("Clienten", "Toon Clienten", "Deze dialog toont clienten");
ISwtEnvironment env = Activator.getDefault().getEnvironment();
final IDesktop desktop = env.getScoutDesktop();
Runnable t = new Runnable() {
@Override
public void run() {
MessageBox.showOkMessage("Clienten", "Toon Clienten", "Deze dialog toont clienten");
}
};
env.invokeScoutLater(t, 0);
}
};
|
|
|
Powered by
FUDForum. Page generated in 0.03579 seconds