@Override protected void internalRefresh() { super.internalRefresh(); final String description = getMessage(IStatus.INFO); if (description != null) { checkBoxControl.setToolTipText(description); } }
@Override protected void bindExpression() { if (control.isVisible()) { super.bindExpression(); } else { if (expressionBinding != null && externalDataBindingContext != null) { externalDataBindingContext.removeBinding(expressionBinding); expressionBinding.dispose(); } final IObservableValue nameObservable = getExpressionNameObservable(); final UpdateValueStrategy targetToModelNameStrategy = new UpdateValueStrategy(); targetToModelNameStrategy.setConverter( new Converter(Boolean.class, String.class) { @Override public Object convert(final Object fromObject) { final String input = ((Boolean) fromObject).toString(); updateContentType(ExpressionConstants.CONSTANT_TYPE); updateContent(getContentFromInput(input)); refresh(); return input; } }); final UpdateValueStrategy modelToTargetNameStrategy = new UpdateValueStrategy(); modelToTargetNameStrategy.setConverter( new Converter(String.class, Boolean.class) { @Override public Object convert(final Object fromObject) { if (fromObject != null) { final String input = fromObject.toString(); if (input.equalsIgnoreCase(Boolean.TRUE.toString())) { return true; } } return false; } }); internalDataBindingContext.bindValue( SWTObservables.observeSelection(checkBoxControl), nameObservable, targetToModelNameStrategy, modelToTargetNameStrategy); } }
@Override public void setSelection(final ISelection selection) { if (!selection.isEmpty()) { final Expression exp = (Expression) ((IStructuredSelection) selection).getFirstElement(); if (exp != null) { if (ExpressionConstants.CONSTANT_TYPE.equals(exp.getType())) { if (!checkBoxControl.isVisible()) { switchToCheckBoxMode(); mc.layout(true, true); } } else { if (!control.isVisible()) { switchToExpressionMode(); mc.layout(true, true); } } } } super.setSelection(selection); }
@Override public void setMessage(final String message, final int messageKind) { super.setMessage(message, messageKind); refreshDecoration(); }