RAP Step by step--二、建立第一个rap程序

本文介绍如何使用Eclipse创建首个RAP应用程序,并通过修改ApplicationWorkbenchWindowAdvisor实现界面自定义,包括最大化窗口、移除操作按钮及调整布局。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

二、建立第一个rap程序

菜单 FileàNewà Project 在弹出的向导中选择 Plug-in Project

输入工程名称如 com.sword.rapdemo然后点Next 按钮。

选择 This plug-in will make contributions to the UI

Rich Client Application 选择no.

 

Next 按钮

选择 Rap Application with a view 然后点 Finish按钮。

 

选择 RunàRun Configurations …

 

选择 Rap Applicationàcom.sword.rapdemo 然后点Run按钮。

运行界面如图

 

更改界面。

1.最大化

ApplicationWorkbenchWindowAdvisor中加入重载函数

    public void postWindowOpen(){

        getWindowConfigurer().getWindow().getShell().setMaximized(true);

}

2.去掉最大化,最小化,关闭按钮

修改ApplicationWorkbenchWindowAdvisor中的函数加入黑体代码

    public void preWindowOpen() {

        IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

        configurer.setInitialSize(new Point(400, 300));

        configurer.setShowCoolBar(true);

        configurer.setShowStatusLine(false);

        configurer.setTitle("Gps巡线管理系统");

        //去掉最大化,最小化,关闭按钮

        configurer.setShellStyle(SWT.NONE);

       }

3.更改界面类似eclipse的界面

 

 

1)从ViewPart继承两个类 BottomPart和ClientPart

2)双击plugin.xm

 

选择Extensions.然后选择org.eclipse.ui.views,右键

 

选择Newàview

然后修改相关属性,class修改为以上创建的BottomPart

如图

 

同理,ClientPart也加入到,plugin.xml.

3)排列ViewPart

Perspective中修改代码如下

    public void createInitialLayout(IPageLayout layout) {

       String editorArea = layout.getEditorArea();

       layout.setEditorAreaVisible(false);

       //创建最左边的栏目

        IFolderLayout topLeft = layout.createFolder( "topLeft",

                                                     IPageLayout.LEFT,

                                                     0.22f,

                                                     editorArea );

        //创建最下放的栏目

        IFolderLayout bottom = layout.createFolder( "bottom",

                IPageLayout.BOTTOM,

                0.80f,

                editorArea );

        //创建右上方的栏目

        IFolderLayout client = layout.createFolder( "client",

                                                      IPageLayout.RIGHT,

                                                      0.70f,

                                                      editorArea );

        bottom.addView(BottomPart.ID);

        topLeft.addView( View.ID );

        client.addView( ClientPart.ID );

       

    }

4.程序运行界面如下

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值