RCP 自定义启动界面

自定义启动界面的工作主要为实现一个自定义扩展类(继承自AbstractSplashHandler)。



主要步骤;

1、为RCP工程增加org.eclipse.core.runtime.products扩展点,并设定ID属性,此ID即为RCP程序的ProductID。

2、在org.eclipse.core.runtime.products扩展点中增加product扩展项,设定application属性,绑定ProductID与Application。

3、为RCP工程增加org.eclipse.ui.splashHandlers扩展点。

4、在org.eclipse.ui.splashHandlers扩展点中增加splashHandlers扩展项,设定HandlerID跟HandlerClass.

5、在org.eclipse.ui.splashHandlers扩展点中增加splashHandlerProductBinding扩展项,设定splashId跟productId,绑定Handler与ProductID,即绑定SplashHandler与程序。

6、实现第4步中指定的HandlerClass,其需继承自AbstractSplashHandler。

示例代码:

  1. * The splash screen controller for the RCP application. This has been modified to also act as a login screen for the  
  2. package xxxx.SplashHandler; 
  3.  
  4. import org.eclipse.jface.dialogs.MessageDialog; 
  5.  
  6. /**
  7. * The splash handler overrides the default RCP splash handler.
  8. */ 
  9. public class LoginSplashHandler extends AbstractSplashHandler { 
  10.  
  11.     private Composite loginComposite; 
  12.     private Text usernameTextBox; 
  13.     private Text passwordTextBox; 
  14.     private Button okButton; 
  15.     private Button cancelButton; 
  16.     private boolean isAuthenticated; 
  17.     private Label usernameLabel; 
  18.     private Label passwordLabel; 
  19.  
  20.     public LoginSplashHandler() { 
  21.         isAuthenticated = false
  22.     } 
  23.  
  24.     public void init(final Shell splash) { 
  25.         splash.setMinimumSize(new Point(400, 165)); 
  26.         System.out.println("In splash windows."); 
  27.         super.init(splash); 
  28.  
  29.         configureUISplash(); 
  30.         createUI(); 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值