本文整理了Java中org.eclipse.swt.widgets.ToolBar.getParent()
方法的一些代码示例,展示了ToolBar.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToolBar.getParent()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.ToolBar
类名称:ToolBar
方法名:getParent
暂无
代码示例来源:origin: pentaho/pentaho-kettle
toolbarLeft.setLayoutData( fdToolbarLeft );
toolbarLeft.setCursor( cursorEnabled );
toolbarLeft.setBackground( toolbarLeft.getParent().getBackground() );
toolbarRight.setLayoutData( fdToolbarRight );
toolbarRight.setCursor( cursorEnabled );
toolbarRight.setBackground( toolbarRight.getParent().getBackground() );
代码示例来源: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.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.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.pde/org.eclipse.pde.runtime
private void createLocationURI(SpyFormToolkit toolkit, Object object, FormText text, StringBuilder buffer, String id) {
IContributionManager parent = ((ContributionItem) object).getParent();
if (parent instanceof IMenuManager) {
String parentId = ((IMenuManager) parent).getId();
String locationURI = "menu:" + parentId + (id == null ? "?after=additions" : "?after=" + id); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_7, new String[] {locationURI}));
} else if (parent instanceof ToolBarManager) {
ToolBar bar = ((ToolBarManager) parent).getControl();
if (bar.getParent() instanceof CoolBar) {
CoolItem[] items = ((CoolBar) bar.getParent()).getItems();
for (CoolItem item : items) {
if (item.getControl() == bar) {
Object o = item.getData();
if (o instanceof ToolBarContributionItem) {
String parentId = ((ToolBarContributionItem) o).getId();
String locationURI = "toolbar:" + parentId + (id == null ? "?after=additions" : "?after=" + id); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_7, new String[] {locationURI}));
}
continue;
}
}
}
}
}
代码示例来源:origin: com.eclipsesource.tabris/tabris
private void updateToolItems( PageDescriptor descriptor, String title ) {
for( ToolItem toolItem : pageSwitcher.getItems() ) {
if( toolItem.getData() == descriptor ) {
toolItem.setText( title );
toolItem.getParent().getParent().layout( true, true );
}
}
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
public Object createWidget(final MUIElement element, Object parent) {
if (!(element instanceof MRenderedToolBar)
|| !(parent instanceof Composite))
return null;
final MRenderedToolBar toolBar = (MRenderedToolBar) element;
if (!(toolBar.getContributionManager() instanceof ToolBarManager)) {
return null;
}
ToolBarManager tbm = (ToolBarManager) toolBar.getContributionManager();
ToolBar tb = tbm.createControl((Composite) parent);
if (tb.getParent() != parent) {
tb.setParent((Composite) parent);
tb.setVisible(true);
}
tbm.update(true);
tb.setData(ToolBarManager.class.getName(), tbm);
tb.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cleanUp(toolBar);
}
});
tb.getParent().layout(true);
return tb;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
@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.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
@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.rap/org.eclipse.rap.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
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.e4.ui.workbench.addons/swt
public void drop(MElementContainer<MUIElement> newContainer, int itemIndex) {
if (dragElement.getParent() != null)
dragElement.getParent().getChildren().remove(dragElement);
if (itemIndex >= 0)
newContainer.getChildren().add(itemIndex, dragElement);
else
newContainer.getChildren().add(dragElement);
newContainer.setSelectedElement(dragElement);
if (dragElement.getWidget() instanceof ToolItem) {
ToolItem ti = (ToolItem) dragElement.getWidget();
ToolBar tb = ti.getParent();
tb.layout(true);
tb.getParent()
.layout(new Control[] { tb }, SWT.CHANGED | SWT.DEFER);
}
baseWindow.getChildren().remove(dragWindow);
newContainer.setSelectedElement(dragElement);
if (getShell() != null)
getShell().dispose();
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
public void renderInitialization( ToolBar toolBar ) throws IOException {
RemoteObject remoteObject = createRemoteObject( toolBar, TYPE );
remoteObject.setHandler( new ToolBarOperationHandler( toolBar ) );
remoteObject.set( "parent", getId( toolBar.getParent() ) );
remoteObject.set( "style", createJsonArray( getStyles( toolBar, ALLOWED_STYLES ) ) );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
public void drop(MElementContainer<MUIElement> newContainer, int itemIndex) {
if (dragElement.getParent() != null) {
dragElement.getParent().getChildren().remove(dragElement);
}
if (itemIndex >= 0) {
newContainer.getChildren().add(itemIndex, dragElement);
} else {
newContainer.getChildren().add(dragElement);
}
newContainer.setSelectedElement(dragElement);
if (dragElement.getWidget() instanceof ToolItem) {
ToolItem ti = (ToolItem) dragElement.getWidget();
ToolBar tb = ti.getParent();
tb.layout(true);
tb.getParent()
.layout(new Control[] { tb }, SWT.CHANGED | SWT.DEFER);
}
baseWindow.getWindows().remove(dragWindow);
newContainer.setSelectedElement(dragElement);
if (getShell() != null) {
getShell().dispose();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private void initButton(Image im, final String tt) {
toolButton.setImage(im);
toolButton.setToolTipText(tt);
toolbar.setVisible(true);
toolbar.getParent().requestLayout(); // must layout
if (currentAccessibleListener != null)
toolbar.getAccessible().removeAccessibleListener(currentAccessibleListener);
currentAccessibleListener = new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = tt;
}
};
toolbar.getAccessible().addAccessibleListener(currentAccessibleListener);
}
代码示例来源: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);
}
}
}
代码示例来源:origin: org.eclipse/org.eclipse.compare
updateToolItems();
tbm.update(true);
tbm.getControl().getParent().layout(true);
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
private void internalRefresh(Object input) {
IMergeViewerContentProvider content= getMergeContentProvider();
if (content != null) {
Object ancestor= content.getAncestorContent(input);
boolean oldFlag = fIsThreeWay;
if (Utilities.isHunk(input)) {
fIsThreeWay = true;
} else if (input instanceof ICompareInput) {
fIsThreeWay= (((ICompareInput) input).getKind() & Differencer.DIRECTION_MASK) != 0;
} else {
fIsThreeWay= ancestor != null;
}
if (fAncestorItem != null)
fAncestorItem.setVisible(fIsThreeWay);
if (fAncestorVisible && oldFlag != fIsThreeWay)
fComposite.layout(true);
Object left= content.getLeftContent(input);
Object right= content.getRightContent(input);
updateContent(ancestor, left, right);
updateHeader();
if (Utilities.okToUse(fComposite) && Utilities.okToUse(fComposite.getParent())) {
ToolBarManager tbm = (ToolBarManager) getToolBarManager(fComposite.getParent());
if (tbm != null ) {
updateToolItems();
tbm.update(true);
tbm.getControl().getParent().layout(true);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!