/** Adds validation overlay component to the control. */ private void addValidationOverlay( final AttributeDescriptor descriptor, final IAttributeEditor editor, final Object defaultValue, final Control label) { final ControlDecoration decoration = new ControlDecoration(label, SWT.LEFT | SWT.BOTTOM); decoration.hide(); final FieldDecoration requiredDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); decoration.setImage(requiredDecoration.getImage()); decoration.setDescriptionText("Invalid value"); final IAttributeListener validationListener = new InvalidStateDecorationListener(decoration, descriptor, defaultValue); globalEventsProvider.addAttributeListener(validationListener); editor.addAttributeListener(validationListener); label.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { globalEventsProvider.removeAttributeListener(validationListener); editor.removeAttributeListener(validationListener); decoration.dispose(); } }); }
private void updateFieldProgressMessageEnablement(boolean buttonEnabled) { boolean enable = (fAddMessageButton.getSelection() && buttonEnabled); for (Control messageControl : fMessageControls) { messageControl.setEnabled(enable); } }
private void updateFieldProgressBarEnablement(boolean buttonEnabled) { boolean enable = (fAddBarButton.getSelection() && buttonEnabled); for (Control barControl : fBarControls) { barControl.setEnabled(enable); } }