public static void enableWithChildren(Composite composite, boolean enable) { composite.setEnabled(enable); for (Control child : composite.getChildren()) { if (child instanceof Composite) { enableWithChildren((Composite) child, enable); } else { child.setEnabled(enable); } } }
protected int getStyle() { int result = SWT.NONE; Control[] ctrls = styleComp.getChildren(); if (ctrls.length == 0) { result = defaultStyle; } else { for (int i = 0; i < ctrls.length; i++) { if (ctrls[i] instanceof Button) { Button button = (Button) ctrls[i]; if (button.getSelection()) { Object data = button.getData("style"); if (data instanceof Integer) { int style = ((Integer) data).intValue(); result |= style; } } } } } return result; }
void onMnemonic(TraverseEvent event) { char mnemonic = _findMnemonic(text); if (mnemonic == '\0') return; if (Character.toLowerCase(event.character) != mnemonic) return; Composite control = this.getParent(); while (control != null) { Control[] children = control.getChildren(); int index = 0; while (index < children.length) { if (children[index] == this) break; index++; } index++; if (index < children.length) { if (children[index].setFocus()) { event.doit = true; event.detail = SWT.TRAVERSE_NONE; } } control = control.getParent(); } }
private void destroyExampleControls() { Control[] controls = exmplComp.getChildren(); for (int i = 0; i < controls.length; i++) { controls[i].dispose(); } }