Bug 521427 - ControlDecoration should allow showing hovers without an image
Summary: ControlDecoration should allow showing hovers without an image
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-25 12:42 EDT by Brian de Alwis CLA
Modified: 2017-08-25 12:42 EDT (History)
0 users

See Also:


Attachments
Demo of the problem (81.25 KB, image/png)
2017-08-25 12:42 EDT, Brian de Alwis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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);
    }
  }