Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334470 - Keysequence embedded into updated label of rendered MHandledToolItem
Summary: Keysequence embedded into updated label of rendered MHandledToolItem
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-15 20:04 EST by Brian de Alwis CLA
Modified: 2011-05-30 10:47 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch to ToolItemRenderer (1.26 KB, patch)
2011-02-16 18:29 EST, Brian de Alwis CLA
no flags Details | Diff
v02 (1.34 KB, patch)
2011-03-29 09:07 EDT, Brian de Alwis CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian de Alwis CLA 2011-01-15 20:04:18 EST
The code in ToolItemRenderer#setItemText() causes the bound keysequence to be embedded in the corresponding ToolItem's label text.  This doesn't seem to be the desired action, does it?
Comment 1 Remy Suen CLA 2011-01-16 06:10:29 EST
Is this a new bug (presumably caused by the renderer changes on Friday to support translations)?
Comment 2 Oleg Besedin CLA 2011-01-17 09:45:37 EST
(In reply to comment #1)
> Is this a new bug (presumably caused by the renderer changes on Friday to
> support translations)?

I don't think so. The code is:

private void setItemText(MToolItem model, ToolItem item) {
   String text = model.getLabel();
   if (model instanceof MHandledItem) {
      ...
      TriggerSequence sequence = [BindingService].getBestSequenceFor(handledItem);
      if (sequence != null) {
         text = text + '\t' + sequence.format();
      }
   item.setText(text);
   }
   ...
}

The changes for translation replaced
   String text = model.getLabel();
with
   String text = model.getLocalizedLabel();
Comment 3 Brian de Alwis CLA 2011-02-16 18:29:20 EST
Created attachment 189144 [details]
Proposed patch to ToolItemRenderer

I suppose this problem isn't commonly seen as most ToolItems in actual use specify an icon.  I think the code came from a copy-n-paste from HandledMenuItemRenderer.

Embedding the keysequence is definitely not correct for the ToolItem label.  But it would make sense for the tooltip?
Comment 4 Brian de Alwis CLA 2011-03-29 09:07:18 EDT
Created attachment 192083 [details]
v02

setItemText() doesn't need to compute the tooltip at all; that's done in getToolTipText() directly below.
Comment 5 Brian de Alwis CLA 2011-03-29 09:10:42 EDT
Patch v02 committed to HEAD