Bug 521427

Summary: ControlDecoration should allow showing hovers without an image
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 4.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Demo of the problem none

Description Brian de Alwis CLA 2017-08-25 12:42:13 EDT
Created attachment 269982 [details]
Demo of the problem

ControlDecoration's hover is useful and should be possible to use without an image.  There may be other ways used to indicate error (e.g., changing the colours of controls in error).

But doing so results in the hover being shown against the parent composite instead.  

Ideally I want to be able to write code like:

  public class MyPrefPage extends PreferencePage {
    @Override
    public Control createControls() {
      // … etc …
      Combo stagingLocationInput = new Combo(target, SWT.DROP_DOWN);
      ControlDecoration stagingLocationCreationResults =
        new ControlDecoration(stagingLocationInput, SWT.TOP | SWT.LEFT);

      // when changed, hide previous creation failure results
      stagingLocationInput.addModifyListener(e -> {
        setErrorMessage(null);
        stagingLocationResults.hide()
      });
      // … etc …
    }

    private void stagingLocationCreationFailed(String message) {
       setErrorMessage("Could not create staging location");
       stagingLocationResults.showHoverText(message);
    }
  }