Bug 96301 - [CLabel] Custom behaviour when the whole text of a CLabel cannot be displayed
Summary: [CLabel] Custom behaviour when the whole text of a CLabel cannot be displayed
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Duong Nguyen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-23 10:30 EDT by Michal Tkacz CLA
Modified: 2019-09-06 16:03 EDT (History)
1 user (show)

See Also:


Attachments
Patch proposal (1.58 KB, patch)
2005-05-30 07:33 EDT, Michal Tkacz CLA
no flags Details | Diff

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