RCP application developement (some skills about RCP)

1, Show Action only for specific perspectives

IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getService( IContextService.class );

In 3.2 and 3.3, you can create an actionSet with visibility false.  Then   use your perspective factory or org.eclipse.ui.perspectiveExtensions to activate that actionSet.

In 3.3, an actionSet generates a context with the equivalent ID, so it is available for core expressions like activeWhen, visibleWhen, and enabledWhen.

2, Creating a declarative security model for RCP applications

http://www.ibm.com/developerworks/opensource/library/os-ecl-rcpsec/?ca=dgr-lnxw16RCPbuilding

Thick client-based business applications require rigid security regulations where different classes of users receive a predetermined set of access rights. This article explains how to build a flexible security model for Rich-Client Platform (RCP) applications by leveraging features provided by the Eclipse platform.

3, Custom UI style

PlatformUI.getPreferenceStore().setDefault(
    IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);
PlatformUI.getPreferenceStore().setDefault(
    IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, IWorkbenchPreferenceConstants.TOP_LEFT);

4, Show view in the activie perspective

String viewId = "testView";

try {
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId);

} catch (PartInitException e) {
          MessageDialog.openInformation(PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getShell(),"Information","No this view!");

}

5, Show perspective

PlatformUI.getWorkbench().showPerspective(perspectiveId, 

PlatformUI.getWorkbench().getActiveWorkbenchWindow());

 6、generate coolbar

  ToolBarManager commonbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
  ToolBarContributionItem commonItem = new ToolBarContributionItem(commonbar, "common");
  commonbar.add(exitAction);
  //
  coolBar.add(commonItem);

7、Window default size

  Rectangle displayBounds = Display.getDefault().getPrimaryMonitor().getBounds();
  configurer.setInitialSize(new Point(displayBounds.width,displayBounds.height));

8、RCP product parameters setting.

Specify the program and VM arguments to launch the product with.  Platform-specific arguments should be entered on their respective tabs.

program arguments : -Dsystem.property=value     

VM arguments : -Dfile.encoding=GBK

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值