问题
I just completed the export of my RCP application for Windows and I noticed some strange behavior when testing the app on computer with 2 monitors.
The first time the application is launched, the splash screen and the main apllication windows are displayed on the primary monitor => it's ok !!!
Then I move my application on the second monitor and close it. Relaunch the app displays the splash screen on the second monitor, it's perfect, but it then brings the application window on the first monitor => it's boring and not the expected behavior ...
My Eclipse SDK doesn't have this problem, it simply opens at the last location. I guess I am missing something in my RCP in order to have the same behavior.
Any idea on the subject will be really helpful for me because after many "googling" I was not able to solve my issue.
Thanks in advance for your help
Manu
回答1:
Did you try some kind of workbench customization, using the IWorkbenchConfigurer like in this example?
// in preWindowOpen(IWorkbenchWindowConfigurer configurer)
Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
configurer.setInitialSize(new Point((int)dim.getWidth(),
(int)dim.getHeight()));
Or:
if you use
configurer.setSaveAndRestore(true);
in yourinitialize()
then the rcp re-opens in the last used size.
Since it only set the size, it may not be enough in your (double-screen) case though.
来源:https://stackoverflow.com/questions/3184999/rcp-opening-monitor