Bug 96301

Summary: [CLabel] Custom behaviour when the whole text of a CLabel cannot be displayed
Product: [Eclipse Project] Platform Reporter: Michal Tkacz <Michal.Tkacz>
Component: SWTAssignee: Duong Nguyen <duongn>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: steve_northover
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch proposal none

Description Michal Tkacz CLA 2005-05-23 10:30:21 EDT
I'd like to introduce a custom behaviour (in fact a custom tooltip) in cases
when there's not enough space to display the whole text of a CLabel. To achieve
that, I'd like to propose the following enhancements in CLabel class:

1. Ability to turn off default behaviour (system tooltip) by means of either a
style flag or a setter.
2. Notification mechanism to notify clients that the CLabel's text has been
shortened. This should probably be an additional Listener class.

Please, let me know if these enhancements are acceptable. If they're, I'll
implement a patch for the CLabel class.
Comment 1 Michal Tkacz CLA 2005-05-30 07:33:34 EDT
Created attachment 21956 [details]
Patch proposal

In fact much simpler solution would probably be to extract some of the code
into a protected method that could then be overriden. Here is a patch proposal.
It defines a new method internalSetToolTipText() that gets two parameters:
label's text if it's not completely visible (null otherwise) and tooltip text
set by the application. This method is then called instead of
super.setTooltipText(). My implementation would then look like this:

class MyCLabel extends CLabel {
  protected void internalSetToolTipText(String text, String appToolTipText) {
    String string = appToolTipText != null ? appToolTipText;
    // display string using custom tooltip
  }
}

This is how this method is implemented in CLabel, the only difference is that
it uses system tooltip.
Comment 2 Eclipse Webmaster CLA 2019-09-06 16:03:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.