/** * if debugging is enabled (see {@link Debug}), debug info is set to the widget as tooltip and/or * decoration. Can be overridden by subclass to add specific debug info * * @param widget widget to apply debug info to */ protected void setDebugInfo(RCPWidget widget) { if (Debug.layout()) { String debugInfo = ""; // $NON-NLS-1$ if (widget instanceof RCPControl) { if (widget instanceof RCPComposite) { Layout layout = ((RCPComposite) widget).getClientComposite().getLayout(); if (layout != null) { debugInfo += widget.getId() + ".layout = " + layout.toString() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ } } RCPControl control = (RCPControl) widget; Object layoutData = control.getSWTControl().getLayoutData(); if (layoutData != null) { debugInfo += widget.getId() + ".layoutData = " + layoutData.toString() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ } control.getSWTControl().setToolTipText(debugInfo); } } }
/** * true if the builder should automatically add a layout to the given control. For simple controls * it always adds a layout specified by the add methods defined for the builder. * * <p>For compound controls it applies auto layout for non extensible components, which are * prefabricated arrangements of controls which clients can use without any configuration. This is * opposite to extensible components where clients will add children themselves and thus take over * layout, binding and creation of children. * * @param control control to check * @return true, if builder should manage component automatically */ protected boolean isAutoLayoutControl(RCPControl control) { return !control.isContainer() || !((RCPCompound) control).isExtensible(); }
/** * create control, its label control and maintain all relationships * * @param control control to create */ protected void createControl(RCPControl control) { Validate.notNull(formToolkit); control.setRcpParent(currentParent); control.createUI(formToolkit); createdControls.add(control); }