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

 

你可能感兴趣的:(eclipse,UI,Security,OS,OpenSource)