当前位置: 首页>>代码示例>>Java>>正文


Java SwtDeck类代码示例

本文整理汇总了Java中org.pentaho.ui.xul.swt.tags.SwtDeck的典型用法代码示例。如果您正苦于以下问题:Java SwtDeck类的具体用法?Java SwtDeck怎么用?Java SwtDeck使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SwtDeck类属于org.pentaho.ui.xul.swt.tags包,在下文中一共展示了SwtDeck类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GitPerspective

import org.pentaho.ui.xul.swt.tags.SwtDeck; //导入依赖的package包/类
public GitPerspective() throws XulException {
  // Loading Xul Document
  KettleXulLoader loader = new KettleXulLoader();
  loader.registerClassLoader( getClass().getClassLoader() );
  container = loader.loadXul( "org/pentaho/di/git/spoon/xul/git_perspective.xul", resourceBundle );

  // Adding Event Handlers
  controller = new GitController();
  gitSpoonMenuController = new GitSpoonMenuController();
  gitSpoonMenuController.setGitController( controller );
  container.addEventHandler( controller );
  container.addEventHandler( gitSpoonMenuController );

  final XulRunner runner = new SwtXulRunner();
  runner.addContainer( container );
  runner.initialize(); //calls any onload events

  /*
   * To make compatible with webSpoon
   * Create a temporary parent for the UI and then call layout().
   * A different parent will be assigned to the UI in SpoonPerspectiveManager.PerspectiveManager.performInit().
   */
  SwtDeck deck = (SwtDeck) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "canvas-deck" );
  box = deck.createVBoxCard();
  getUI().setParent( (Composite) box.getManagedObject() );
  getUI().layout();

  /**
   * Hack: setAccelerator 'CTRL(CMD) + D' to "Data Integration" menu
   */
  int mask = 'D';
  if ( System.getProperty( "KETTLE_CONTEXT_PATH" ) == null ) { // Spoon
    boolean isMac = System.getProperty( "os.name" ).toLowerCase().indexOf( "mac" ) >= 0;
    mask += isMac ? SWT.COMMAND : SWT.CTRL;
  } else { // webSpoon
    mask += SWT.CTRL;
  }
  int keyCode = mask;
  XulMenupopup menuPopup = (XulMenupopup) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "view-perspectives-popup" );
  MenuManager menuMgr = (MenuManager) menuPopup.getManagedObject();
  // No guarantee that "Data Integration" gets "menuitem-0" as its ID, but looks ok so far
  Stream.of( menuMgr.getItems() )
    .filter( menu -> menu.getId().equals( "menuitem-0" ) ).findFirst().ifPresent( menu -> {
      IAction action = ( (ActionContributionItem) menu ).getAction();
      action.setAccelerator( keyCode );
    } );
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:48,代码来源:GitPerspective.java


注:本文中的org.pentaho.ui.xul.swt.tags.SwtDeck类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。