mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-10-23 05:31:02 +00:00
Merge remote-tracking branch 'origin/GP-4621_dev747368_dialog_statustext_tooltip_hover_rawhtml' into Ghidra_11.1
This commit is contained in:
commit
32f066c815
|
@ -800,15 +800,10 @@ public class DialogComponentProvider
|
|||
* If the status message fits then there is no tool tip.
|
||||
*/
|
||||
private void updateStatusToolTip() {
|
||||
String text = statusLabel.getText();
|
||||
// Get the width of the message.
|
||||
FontMetrics fm = statusLabel.getFontMetrics(statusLabel.getFont());
|
||||
int messageWidth = 0;
|
||||
if ((fm != null) && (text != null)) {
|
||||
messageWidth = fm.stringWidth(text);
|
||||
}
|
||||
if (messageWidth > statusLabel.getWidth()) {
|
||||
statusLabel.setToolTipText(text);
|
||||
Dimension preferredSize = statusLabel.getPreferredSize();
|
||||
Dimension size = statusLabel.getSize();
|
||||
if (preferredSize.width > size.width || preferredSize.height > size.height) {
|
||||
statusLabel.setToolTipText(statusLabel.getOriginalText());
|
||||
}
|
||||
else {
|
||||
statusLabel.setToolTipText(null);
|
||||
|
|
|
@ -76,6 +76,18 @@ public abstract class AbstractHtmlLabel extends JLabel
|
|||
updateHtmlView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original text of the label.
|
||||
* <p>
|
||||
* The {@link #getText()} method for this class can return a value that is missing the leading
|
||||
* <html> tag.
|
||||
*
|
||||
* @return text of this label
|
||||
*/
|
||||
public String getOriginalText() {
|
||||
return isHtml ? HTML_TAG + getText() : getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
|
|
Loading…
Reference in New Issue
Block a user