在我们的rcp应用程序中,我们通过使用eclipse框架(Splash屏幕上的登录功能)实现了登录功能。绕过登录屏幕
现在我们如何通过提供虚拟机参数来绕过此登录(包括启动屏幕)?
如果VM参数设置有正确的用户名和密码,我们不希望显示的登录页面(包括开机画面,因为登录的特点是闪屏本身)
任何想法?
在我们的rcp应用程序中,我们通过使用eclipse框架(Splash屏幕上的登录功能)实现了登录功能。绕过登录屏幕
现在我们如何通过提供虚拟机参数来绕过此登录(包括启动屏幕)?
如果VM参数设置有正确的用户名和密码,我们不希望显示的登录页面(包括开机画面,因为登录的特点是闪屏本身)
任何想法?
启动画面登录对话框通过使用SplashScreenHandler实现。这实际上被添加到你的应用程序包中。查看启动画面处理程序的源代码并在其中添加VM参数应该相对容易。
您也可以使用-noSplash
命令行选项禁用启动屏幕。
不知道是否有可能跳过启动画面(也看不出有什么好的理由这样做),但是如果要将它从启动画面中分开,可以跳过显示登录对话框。
在应用程序启动创建您的对话框,不知何故像:
Application implements IApplication {
@Override
public Object start(IApplicationContext context) throws Exception {
Display display = PlatformUI.createDisplay();
try {
LoginDialog dialog = new LoginDialog(display.getActiveShell());
if (dialog.open() == Dialog.CANCEL) {
return EXIT_OK;
}
int code = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
// Exit the application with an appropriate return code.
return code == PlatformUI.RETURN_RESTART ? EXIT_RESTART : EXIT_OK;
} finally {
if (display != null) {
display.dispose();
}
}
}
然后,您可以通过检查所需的系统性能跳过显示对话框并用属性值验证用户:也
String username = System.getProperty("username");
String pwd = System.getProperty("password");
if (username != null && pwd != null) {
// do something with username and password
} else {
LoginDialog dialog = new LoginDialog(display.getActiveShell());
if (dialog.open() == Dialog.CANCEL) {
return EXIT_OK;
}
}
, Platform.endSplash();
可能会有所帮助。
噢,我能够跳过登录部分,但不是闪屏本身。因为在控制进入应用程序的启动方法之前,splash会弹出!所以即使我在启动方法中调用Platform.endSplash(),它也没有效果!感谢您的指点 –
可能您可以尝试创建自定义splash处理程序,该处理程序不会显示(或可能会提前关闭)?否则,正如我之前提到的,可能没有办法跳过有条件的飞溅。 –
是的,可能是我需要检查。无论如何,感谢您的建议 –
我指的是从运行配置传递虚拟机参数,看看eclipse框架是否绕过自己的登录页面 –
请参阅http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html – parasietje
您正在寻找的选项是' - noSplash' – parasietje