git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
889c91b
)
JAL-2792 added tooltip to menu items in case of truncation
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 31 Jan 2018 11:28:03 +0000
(11:28 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 31 Jan 2018 11:28:03 +0000
(11:28 +0000)
src/jalview/gui/PopupMenu.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/PopupMenu.java
b/src/jalview/gui/PopupMenu.java
index
97d051b
..
0cf7ef4
100644
(file)
--- a/
src/jalview/gui/PopupMenu.java
+++ b/
src/jalview/gui/PopupMenu.java
@@
-550,24
+550,27
@@
public class PopupMenu extends JPopupMenu implements ColourChangeListener
{
desc = String.format("%s %d-%d", sf.getType(), start, end);
}
{
desc = String.format("%s %d-%d", sf.getType(), start, end);
}
+ String tooltip = desc;
String description = sf.getDescription();
if (description != null)
{
description = StringUtils.stripHtmlTags(description);
String description = sf.getDescription();
if (description != null)
{
description = StringUtils.stripHtmlTags(description);
- if (description.length() <= 6)
+ if (description.length() > 12)
{
{
- desc = desc + " " + description;
+ desc = desc + " " + description.substring(0, 12) + "..";
}
else
{
}
else
{
- desc = desc + " " + description.substring(0, 6) + "..";
+ desc = desc + " " + description;
}
}
+ tooltip = tooltip + " " + description;
}
if (sf.getFeatureGroup() != null)
{
}
if (sf.getFeatureGroup() != null)
{
- desc = desc + " (" + sf.getFeatureGroup() + ")";
+ tooltip = tooltip + (" (" + sf.getFeatureGroup() + ")");
}
JMenuItem item = new JMenuItem(desc);
}
JMenuItem item = new JMenuItem(desc);
+ item.setToolTipText(tooltip);
item.addActionListener(new ActionListener()
{
@Override
item.addActionListener(new ActionListener()
{
@Override