org.eclipse.jface.action.ToolBarManager.getControl()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(125)

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

ToolBarManager.getControl介绍

[英]Returns the tool bar control for this manager.
[中]返回此管理器的工具栏控件。

代码示例

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

/**
 * Returns the control for the window's toolbar.
 * <p>
 * Subclasses may override this method to customize the tool bar manager.
 * </p>
 * @return a Control
 */
protected Control getToolBarControl() {
  if (toolBarManager != null) {
    if (toolBarManager instanceof IToolBarManager2) {
      return ((IToolBarManager2) toolBarManager).getControl2();
    }
    if (toolBarManager instanceof ToolBarManager) {
      return ((ToolBarManager) toolBarManager).getControl();
    }
  }
  return null;
}

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

/**
 * Returns the control for the window's toolbar.
 * <p>
 * Subclasses may override this method to customize the tool bar manager.
 * </p>
 * @return a Control
 */
protected Control getToolBarControl() {
  if (toolBarManager != null) {
    if (toolBarManager instanceof IToolBarManager2) {
      return ((IToolBarManager2) toolBarManager).getControl2();
    }
    if (toolBarManager instanceof ToolBarManager) {
      return ((ToolBarManager) toolBarManager).getControl();
    }
  }
  return null;
}

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

/**
 * Returns the control for the window's toolbar.
 * <p>
 * Subclasses may override this method to customize the tool bar manager.
 * </p>
 * @return a Control
 */
protected Control getToolBarControl() {
  if (toolBarManager != null) {
    if (toolBarManager instanceof IToolBarManager2) {
      return ((IToolBarManager2) toolBarManager).getControl2();
    }
    if (toolBarManager instanceof ToolBarManager) {
      return ((ToolBarManager) toolBarManager).getControl();
    }
  }
  return null;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Sets the enabled state of this part.
 */
private void updateEnabledState() {
  if (null != toolBarManager) {
    toolBarManager.getControl().setEnabled(isEditable());
  }
}

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

protected void updateToolbar(boolean visible) {
  if (clearButtonControl != null) {
    clearButtonControl.setVisible(visible);
  }
  if (filterToolBar != null) {
    filterToolBar.getControl().setVisible(visible);
  }
}

代码示例来源:origin: com.diffplug.durian/durian-swt

public static void addDropSupport(ToolBarManager toolbarManager, IAction action, Transfer[] transfers, DropTargetListener listener) {
  pool.forWidget(toolbarManager.getControl()).add(action, transfers, listener);
}

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

/**
 * Set the background for the widgets that support the filter text area.
 *
 * @param background
 *            background <code>Color</code> to set
 */
@Override
public void setBackground(Color background) {
  super.setBackground(background);
  if (filterComposite != null && (!useNewLook || useNativeSearchField(filterComposite))) {
    filterComposite.setBackground(background);
  }
  if (filterToolBar != null && filterToolBar.getControl() != null) {
    filterToolBar.getControl().setBackground(background);
  }
}

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

@Override
  protected void layout(Composite composite, boolean changed) {
    boolean vertical = (getOrientation() & SWT.VERTICAL) != 0;
    int marginWidth = vertical | isPlain() ? 1 : simple ? 4 : 7;
    int marginHeight = !vertical | isPlain() ? 1 : simple ? 4 : 7;
    Point tsize = toolBarManager.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
    Rectangle carea = composite.getClientArea();
    int x = carea.x + (getLocation() == SideValue.LEFT ? 0 : marginWidth);
    int y = carea.y + marginHeight;
    if (vertical) {
      toolBarManager.getControl().setBounds(x, y, carea.width - marginWidth, tsize.y);
    } else {
      toolBarManager.getControl().setBounds(x, y, tsize.x, carea.height - marginHeight);
    }
  }
}

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

/**
 * @param toolbarModel
 * @param elementId
 */
public void processContribution(MToolBar toolbarModel, String elementId) {
  ToolBarManager manager = getManager(toolbarModel);
  if (manager != null && manager.getControl() != null) {
    addCleanupDisposeListener(toolbarModel, manager.getControl());
  }
  final ArrayList<MToolBarContribution> toContribute = new ArrayList<>();
  ContributionsAnalyzer.XXXgatherToolBarContributions(toolbarModel,
      application.getToolBarContributions(), elementId, toContribute);
  generateContributions(toolbarModel, toContribute);
}

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

private void internalSetBackground(Color bg) {
  titleRegion.setBackground(bg);
  if (messageRegion != null)
    messageRegion.setBackground(bg);
  if (toolBarManager != null)
    toolBarManager.getControl().setBackground(bg);
  putColor(COLOR_BASE_BG, bg);
}

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

public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

@Override
  public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

private void internalSetBackground(Color bg) {
  titleRegion.setBackground(bg);
  if (messageRegion != null)
    messageRegion.setBackground(bg);
  if (toolBarManager != null)
    toolBarManager.getControl().setBackground(bg);
  putColor(COLOR_BASE_BG, bg);
}

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

@Override
  public void handleEvent(Event innerEvent) {
    ToolBar innerToolBar = toolBarManager.getControl();
    if (innerToolBar != null) {
      innerToolBar.setMenu(null);
      Menu innerParentMenu = innerToolBar.getParent()
          .getMenu();
      if (innerParentMenu != null) {
        innerParentMenu.removeListener(SWT.Hide, this);
      }
    }
  }
});

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

/**
 * Adds standard actions to the given <code>ToolBarManager</code>.
 * <p>
 * Subclasses may override to add their own actions.
 * </p>
 *
 * @param toolBarManager the <code>ToolBarManager</code> to which to contribute
 */
public void contributeToToolBar(ToolBarManager toolBarManager) {
  ResourceBundle bundle= CompareUI.getResourceBundle();
  ChangePropertyAction ignoreWhitespace= ChangePropertyAction.createIgnoreWhiteSpaceAction(bundle, getCompareConfiguration());
  toolBarManager.getControl().addDisposeListener(ignoreWhitespace);
  ChangePropertyAction showPseudoConflicts= ChangePropertyAction.createShowPseudoConflictsAction(bundle, getCompareConfiguration());
  toolBarManager.getControl().addDisposeListener(showPseudoConflicts);
  toolBarManager.add(new Separator());
  toolBarManager.add(ignoreWhitespace);
  toolBarManager.add(showPseudoConflicts);
}

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

/**
 * Adds standard actions to the given <code>ToolBarManager</code>.
 * <p>
 * Subclasses may override to add their own actions.
 * </p>
 *
 * @param toolBarManager the <code>ToolBarManager</code> to which to contribute
 */
public void contributeToToolBar(ToolBarManager toolBarManager) {
  ResourceBundle bundle= CompareUI.getResourceBundle();
  ChangePropertyAction ignoreWhitespace= ChangePropertyAction.createIgnoreWhiteSpaceAction(bundle, getCompareConfiguration());
  toolBarManager.getControl().addDisposeListener(ignoreWhitespace);
  ChangePropertyAction showPseudoConflicts= ChangePropertyAction.createShowPseudoConflictsAction(bundle, getCompareConfiguration());
  toolBarManager.getControl().addDisposeListener(showPseudoConflicts);
  toolBarManager.add(new Separator());
  toolBarManager.add(ignoreWhitespace);
  toolBarManager.add(showPseudoConflicts);
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Sets the enabled state of this part.
 */
private void setEnabledState() {
  toolBarManager.getControl().setEnabled(isEditable());
  treeViewer.getControl().getMenu().setEnabled(isEditable());
  treeViewer.getTree().setEnabled(isEditable());
}

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

private void setSmartButtonVisible(boolean visible) {
  if (fSmartActionItem == null)
    return;
  Control c= getControl();
  if (c == null || c.isDisposed())
    return;
  fSmartActionItem.setVisible(visible);
  ToolBarManager tbm= CompareViewerPane.getToolBarManager(c.getParent());
  if (tbm != null) {
    tbm.update(true);
    ToolBar tb= tbm.getControl();
    if (!tb.isDisposed())
      tb.getParent().layout(true);
  }
}

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

private void setSmartButtonVisible(boolean visible) {
  if (fSmartActionItem == null)
    return;
  Control c= getControl();
  if (c == null || c.isDisposed())
    return;
  fSmartActionItem.setVisible(visible);
  ToolBarManager tbm= CompareViewerPane.getToolBarManager(c.getParent());
  if (tbm != null) {
    tbm.update(true);
    ToolBar tb= tbm.getControl();
    if (!tb.isDisposed())
      tb.getParent().layout(true);
  }
}

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

private void setSmartButtonVisible(boolean visible) {
    if (fSmartActionItem == null)
      return;
    Control c= getControl();
    if (c == null || c.isDisposed())
      return;
      
    fSmartActionItem.setVisible(visible);
    ToolBarManager tbm= CompareViewerPane.getToolBarManager(c.getParent());
    if (tbm != null) {
      tbm.update(true);
      ToolBar tb= tbm.getControl();
      if (!tb.isDisposed())
        tb.getParent().layout(true);
    }
  }
}

相关文章