本文整理汇总了Java中org.eclipse.swt.widgets.Composite.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Composite.getChildren方法的具体用法?Java Composite.getChildren怎么用?Java Composite.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Composite
的用法示例。
在下文中一共展示了Composite.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeSize
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
int width = 0;
int height = 0;
Point textDimension = textDimensions();
Control[] children = composite.getChildren();
for (Control child : children) {
if (child instanceof Text) {
final String textContent = ((Text) child).getText();
textDimension = gc.textExtent(textContent);
width += textDimension.x;
height += textDimension.y;
}
if (child instanceof Label) {
Point computedSize = child.computeSize(0, 0);
width += computedSize.x;
}
}
return new Point(width, height + 4);
}
示例2: isAdded
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public boolean isAdded(Composite composite, Control ctrl, int level) {
Control[] subs = composite.getChildren();
for (Control sub : subs) {
if (sub.getClass().getName().equalsIgnoreCase(Composite.class.getName())) {
Control[] comps = ((Composite) sub).getChildren();
for (Control comp : comps) {
if (comp.getClass().getName().equalsIgnoreCase(Button.class.getName())) {
Button btn = (Button) comp;
if (StringUtils.contains(btn.getText(), "ype"))
return true;
}
}
}
}
return false;
}
示例3: createContainerControls
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
protected void createContainerControls(Composite parent, int nColumns) {
super.createContainerControls(parent, nColumns);
Text text = (Text) parent.getChildren()[1];
text.setEditable(false);
IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor().getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
IProject project = fileEditorInput.getFile().getProject();
if (project != null) {
IFolder srcFolder = project.getFolder("src/main/java");
if (srcFolder != null && srcFolder.exists()) {
text.setText(project.getName() + "/" + srcFolder.getProjectRelativePath().toString());
}
}
Button button = (Button) parent.getChildren()[2];
button.setEnabled(false);
}
}
示例4: bind
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Recursive helper function to find and bind Browser controls
* @param control
*/
private static void bind(Control control) {
if (control instanceof Browser) {
bindControl(null, control, false);
}
//If composite, look through children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
bind(curControl);
}
}
}
示例5: unbind
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Recursive helper function to find and unbind Browser controls
* @param control
*/
private static void unbind(Control control) {
if (control instanceof Browser) {
bindControl(null, control, true);
}
//If composite, look through children
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
unbind(curControl);
}
}
}
示例6: bindControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Bind a control. If it is a composite, also bind all of its children.
* @param control Highest level control.
* @param unbind If true, unbind instead of bind.
*/
private static void bindControl(IWorkbenchPartReference partRef,
Control control, boolean unbind) {
//If composite, bind children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
bindControl(partRef, curControl, unbind);
}
}
//control should not have any data set
//upon reaching this part of the method
IGazeHandler handler = GazeHandlerFactory.
createHandler(control, partRef);
if (handler != null && !unbind)
control.setData(KEY_HANDLER, handler);
else
control.setData(KEY_HANDLER, null);
}
示例7: setupBrowsers
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Recursive helper function to find and set up Browser control managers
* @param control
*/
private void setupBrowsers(Control control) {
if (control instanceof Browser) {
setupControls(null, control);
}
//If composite, look through children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
setupBrowsers(curControl);
}
}
}
示例8: setupControls
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Recursive function for setting up children controls for a control if it is
* a composite and setting up the main control's manager.
* @param part
* @param control
*/
private void setupControls(IWorkbenchPart part, Control control) {
//If composite, setup children controls.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
setupControls(part, curControl);
}
}
if (control instanceof StyledText) {
//set up styled text manager if there is one
setupStyledText((IEditorPart) part, (StyledText) control);
} else if (control instanceof Browser) {
//set up browser manager if there is one
setupBrowser((Browser) control);
}
//TODO: no control set up for a ProjectExplorer, since there isn't an need for
//a Manager right now, might be needed in the future
}
示例9: obfuscatedImage
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void obfuscatedImage(Composite c, Image image) {
if (c == null || c.isDisposed() || !c.isVisible()) {
return;
}
Control[] children = c.getChildren();
for (Control childControl : children) {
if (!childControl.isVisible()) {
continue;
}
ObfuscateImage oi = (ObfuscateImage) childControl.getData("ObfuscateImage");
if (oi != null) {
oi.obfuscatedImage(image);
continue;
}
if (childControl instanceof Composite) {
obfuscatedImage((Composite) childControl, image);
}
}
}
示例10: betterComputeSize
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
protected Point betterComputeSize(Composite c, Point size, int wHint,
int hHint) {
if (c.getChildren().length == 0 && (size.x == 64 || size.y == 64)) {
Object ld = c.getLayoutData();
if (ld instanceof FormData) {
FormData fd = (FormData) ld;
if (fd.width != 0 && fd.height != 0) {
Rectangle trim = c.computeTrim (0, 0, fd.width, fd.height);
return new Point(trim.width, trim.height);
}
}
return new Point(1, 1);
}
if (size.x == 0 || size.y == 0) {
return size;
}
if (minWidth > 0 && size.x < minWidth) {
size.x = minWidth;
}
if (minHeight > 0 && size.y < minHeight) {
size.y = minHeight;
}
return size;
}
示例11: createDialogArea
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite buttonComposite = (Composite) composite.getChildren()[0];
Button browseRegisteredExtensionsButton = new Button(buttonComposite,
SWT.PUSH);
browseRegisteredExtensionsButton
.setText(Messages.LoadExtensionDialog_ExtensionRegistry);
prepareBrowseRegisteredPackagesButton(browseRegisteredExtensionsButton);
{
FormData data = new FormData();
Control[] children = buttonComposite.getChildren();
data.right = new FormAttachment(children[0], -CONTROL_OFFSET);
browseRegisteredExtensionsButton.setLayoutData(data);
}
return composite;
}
示例12: addRowToTextGrid
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void addRowToTextGrid() {
if(textGrid.getLastAddedRow() != null){
((Text)textGrid.getLastAddedRow().getChildren()[2]).removeTraverseListener(lastRowLastColumnTraverseListener);
}
TextGridRowLayout textGridRowLayout = getTextGridRowLayout();
Composite emptyRow = textGrid.addEmptyRow(textGridRowLayout);
((Text)emptyRow.getChildren()[1]).setFocus();
addRowCheckBoxListener(emptyRow);
headerCompositeCheckBox.setSelection(false);
for(Composite row:textGrid.getGrid()){
final Text text=((Text)row.getChildren()[1]);
txtDecorator=WidgetUtility.addDecorator(text,Messages.CHARACTERSET);
txtDecorator.hide();
attachKeyValidator(text);
attachKeyFocusListener(text);
}
((Text)textGrid.getLastAddedRow().getChildren()[2]).addTraverseListener(lastRowLastColumnTraverseListener);
textGrid.refresh();
textGrid.scrollToLastRow();
}
示例13: installMouseWheelScrollRecursively
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public static void installMouseWheelScrollRecursively(MouseWheelListener scroller, Control c) {
c.addMouseWheelListener(scroller);
if (c instanceof Composite) {
Composite comp = (Composite) c;
for (Control child : comp.getChildren()) {
installMouseWheelScrollRecursively(scroller, child);
}
}
}
示例14: installMouseWheelScrollRecursively
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void installMouseWheelScrollRecursively(MouseWheelListener scroller, Control c) {
c.addMouseWheelListener(scroller);
if (c instanceof Composite) {
Composite comp = (Composite) c;
for (Control child : comp.getChildren()) {
installMouseWheelScrollRecursively(scroller, child);
}
}
}
示例15: setEnabledRecursive
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public static void setEnabledRecursive(final Composite composite, final boolean enabled) {
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
if (children[i] instanceof Composite) {
setEnabledRecursive((Composite) children[i], enabled);
} else {
children[i].setEnabled(enabled);
}
}
composite.setEnabled(enabled);
}