org.eclipse.swt.widgets.ToolBar.pack()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.eclipse.swt.widgets.ToolBar.pack()方法的一些代码示例,展示了ToolBar.pack()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToolBar.pack()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.ToolBar
类名称:ToolBar
方法名:pack

ToolBar.pack介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void update() {
 Rectangle rect = toolBar.getBounds();
 if ( connectDropdown != null && !connectDropdown.isDisposed() ) {
  if ( spoon.rep != null ) {
   StringBuilder connectionLabel = new StringBuilder();
   if ( spoon.rep.getUserInfo() != null ) {
    connectionLabel.append( spoon.rep.getUserInfo().getLogin() );
    connectionLabel.append( "  |  " );
   }
   StringBuilder connectionLabelTip = new StringBuilder( connectionLabel.toString() );
   if ( repoConnectController != null && repoConnectController.getConnectedRepository() != null ) {
    connectionLabel.append( truncateName( spoon.getRepositoryName() ) );
    connectionLabelTip.append( spoon.getRepositoryName() );
   }
   connectDropdown.setText( connectionLabel.toString() );
   connectDropdown.setToolTipText( connectionLabelTip.toString() );
  } else {
   connectDropdown.setText( BaseMessages.getString( PKG, "RepositoryConnectMenu.Connect" ) );
  }
 }
 // This fixes some SWT goofiness
 toolBar.pack();
 toolBar.setBounds( rect );
}

代码示例来源:origin: pentaho/pentaho-kettle

swtToolbar.pack();
 swtToolbar.pack();
} catch ( Throwable t ) {
 log.logError( Const.getStackTracker( t ) );

代码示例来源:origin: pentaho/pentaho-kettle

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_PREVIEW_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
  swtToolBar.pack();
  firstRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-first" );
  lastRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-last" );
  offRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-off" );
  PropsUI.getInstance().setLook( (Control) firstRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
  PropsUI.getInstance().setLook( (Control) lastRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
  PropsUI.getInstance().setLook( (Control) offRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
 } catch ( Throwable t ) {
  log.logError( toString(), Const.getStackTracker( t ) );
  new ErrorDialog( transPreviewComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_PREVIEW_TOOLBAR ),
   new Exception( t ) );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

swtToolbar.pack();
 swtToolbar.pack();
} catch ( Throwable t ) {
 log.logError( "Error loading the navigation toolbar for Spoon", t );

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

private void fixSize() {
  perspSwitcherToolbar.pack();
  perspSwitcherToolbar.getParent().pack();
  perspSwitcherToolbar.getShell().layout(new Control[] { perspSwitcherToolbar }, SWT.DEFER);
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@Override
public void childRendered(MElementContainer<MUIElement> parentElement,
    MUIElement element) {
  super.childRendered(parentElement, element);
  processContents(parentElement);
  ToolBar toolbar = (ToolBar) getUIContainer(element);
  if (toolbar != null && !toolbar.isDisposed()) {
    toolbar.pack(true);
    toolbar.getShell().layout(new Control[] { toolbar }, SWT.DEFER);
  }
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@Override
public void processContents(MElementContainer<MUIElement> container) {
  // I can either simply stop processing, or we can walk the model
  // ourselves like the "old" days
  // EMF gives us null lists if empty
  if (container == null)
    return;
  Object obj = container;
  ToolBarManager parentManager = getManager((MToolBar) obj);
  if (parentManager == null) {
    return;
  }
  // Process any contents of the newly created ME
  List<MUIElement> parts = container.getChildren();
  if (parts != null) {
    MUIElement[] plist = parts.toArray(new MUIElement[parts.size()]);
    for (int i = 0; i < plist.length; i++) {
      MUIElement childME = plist[i];
      modelProcessSwitch(parentManager, (MToolBarElement) childME);
    }
  }
  parentManager.update(true);
  ToolBar tb = getToolbarFrom(container.getWidget());
  if (tb != null) {
    tb.pack(true);
    tb.getShell().layout(new Control[] { tb }, SWT.DEFER);
  }
}

代码示例来源:origin: stackoverflow.com

item2.setImage(display.getSystemImage(SWT.ICON_QUESTION));
treeToolBar.pack();
final int trimSize = treeToolBar.getSize().x - textItem.getWidth() - item1.getWidth() - item2.getWidth();

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private ToolBar addViewMenu(final Composite parent) {
  fToolBar= new ToolBar(parent, SWT.FLAT);
  final ToolItem menuButton = new ToolItem(fToolBar, SWT.PUSH, 0);
  fMenuImage= JavaPluginImages.DESC_ELCL_VIEW_MENU.createImage();
  menuButton.setImage(fMenuImage);
  menuButton.setToolTipText(ReorgMessages.RenameInformationPopup_menu);
  fToolBar.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseDown(MouseEvent e) {
      showMenu(fToolBar);
    }
  });
  menuButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      showMenu(fToolBar);
    }
  });
  fToolBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
  fToolBar.pack();
  return fToolBar;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private ToolBar addViewMenu(final Composite parent) {
  fToolBar= new ToolBar(parent, SWT.FLAT);
  final ToolItem menuButton = new ToolItem(fToolBar, SWT.PUSH, 0);
  fMenuImage= JavaPluginImages.DESC_ELCL_VIEW_MENU.createImage();
  menuButton.setImage(fMenuImage);
  menuButton.setToolTipText(ReorgMessages.RenameInformationPopup_menu);
  fToolBar.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseDown(MouseEvent e) {
      showMenu(fToolBar);
    }
  });
  menuButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      showMenu(fToolBar);
    }
  });
  fToolBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
  fToolBar.pack();
  return fToolBar;
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@Override
public void postProcess(MUIElement element) {
  ToolBar tb = (ToolBar) element.getWidget();
  if (((EObject) element).eContainer() instanceof MPart) {
    MPart part = (MPart) ((EObject) element).eContainer();
    MMenu viewMenu = getViewMenu(part);
    // View menu (if any)
    if (viewMenu != null) {
      addMenuButton(part, tb, viewMenu);
    }
  }
  tb.pack();
  tb.setVisible(true);
  super.postProcess(element);
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private ToolBar addViewMenu(final Composite parent) {
  fToolBar= new ToolBar(parent, SWT.FLAT);
  final ToolItem menuButton = new ToolItem(fToolBar, SWT.PUSH, 0);
  fMenuImage= JavaPluginImages.DESC_ELCL_VIEW_MENU.createImage();
  menuButton.setImage(fMenuImage);
  menuButton.setToolTipText(ReorgMessages.RenameInformationPopup_menu);
  fToolBar.addMouseListener(new MouseAdapter() {
    public void mouseDown(MouseEvent e) {
      showMenu(fToolBar);
    }
  });
  menuButton.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      showMenu(fToolBar);
    }
  });
  fToolBar.pack();
  return fToolBar;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

private void createFeedback() {
  dragShell = new Shell(SWT.NO_TRIM | SWT.NO_BACKGROUND);
  dragShell.setAlpha(175);
  ToolBar dragTB = new ToolBar(dragShell, SWT.RIGHT);
  ToolItem newTI = new ToolItem(dragTB, SWT.RADIO);
  newTI.setText(dragItem.getText());
  newTI.setImage(dragItem.getImage());
  dragTB.pack();
  dragShell.pack();
  dragShell.setVisible(true);
}

代码示例来源:origin: org.eclipse.xtext/ui

protected ToolBar addViewMenu(final Composite parent) {
  toolBar = new ToolBar(parent, SWT.FLAT);
  final ToolItem menuButton = new ToolItem(toolBar, SWT.PUSH, 0);
  menuImage = Activator.getImageDescriptor("icons/elcl16/view_menu.gif").createImage();
  menuButton.setImage(menuImage);
  menuButton.setToolTipText("Menu");
  toolBar.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseDown(MouseEvent e) {
      showMenu(toolBar);
    }
  });
  menuButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      showMenu(toolBar);
    }
  });
  toolBar.pack();
  return toolBar;
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@Override
public void hideChild(MElementContainer<MUIElement> parentElement,
    MUIElement child) {
  super.hideChild(parentElement, child);
  // only handle the disposal of this element if it was actually rendered
  // by the engine
  if (child.getRenderer() != null) {
    // Since there's no place to 'store' a child that's not in a menu
    // we'll blow it away and re-create on an add
    Widget widget = (Widget) child.getWidget();
    if (widget != null && !widget.isDisposed()) {
      widget.dispose();
    }
    ToolBar toolbar = (ToolBar) getUIContainer(child);
    if (toolbar != null && !toolbar.isDisposed()) {
      toolbar.pack(true);
      toolbar.getShell().layout(new Control[] { toolbar }, SWT.DEFER);
    }
    // disposeToolbarIfNecessary(parentElement);
  }
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

ToolBar tb = parent.getControl();
if (tb != null && !tb.isDisposed()) {
  tb.pack(true);
  tb.getShell().layout(new Control[] { tb },
      SWT.DEFER);
tb.pack(true);
tb.getShell().layout(new Control[] { tb }, SWT.DEFER);

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

if ((oldCount != newCount) && (newCount!=0)) {
  Point beforePack = layoutBar.getSize();
  layoutBar.pack(true);
  Point afterPack = layoutBar.getSize();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

if (oldCount != newCount && newCount != 0) {
  Point beforePack = layoutBar.getSize();
  layoutBar.pack(true);
  Point afterPack = layoutBar.getSize();

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

if (oldCount != newCount && newCount != 0) {
  Point beforePack = layoutBar.getSize();
  layoutBar.pack(true);
  Point afterPack = layoutBar.getSize();

代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt

trimStackTB.pack();
trimStackTB.getShell().layout(new Control[] { trimStackTB }, SWT.DEFER);

相关文章

ToolBar类方法