Skip to content

Commit

Permalink
Simplify getToolTip() logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Jan 13, 2024
1 parent 2fb2eaa commit f48f9e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,15 @@ protected void paintFigure(Graphics graphics) {

@Override
public IFigure getToolTip() {
boolean doShowViewTooltips = ArchiPlugin.PREFERENCES.getBoolean(IPreferenceConstants.VIEW_TOOLTIPS);
if(!ArchiPlugin.PREFERENCES.getBoolean(IPreferenceConstants.VIEW_TOOLTIPS)) {
return null;
}

if(fTooltip == null && doShowViewTooltips) {
if(fTooltip == null) {
fTooltip = new MultiToolTipFigure();
setToolTip(fTooltip);
}

if(fTooltip == null || !doShowViewTooltips) {
return null;
}

String notes = getDiagramModelObject().getNotes();
if(StringUtils.isSet(notes)) {
fTooltip.setText(notes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,15 @@ protected void setLineWidth() {

@Override
public IFigure getToolTip() {
boolean doShowViewTooltips = ArchiPlugin.PREFERENCES.getBoolean(IPreferenceConstants.VIEW_TOOLTIPS);
if(!ArchiPlugin.PREFERENCES.getBoolean(IPreferenceConstants.VIEW_TOOLTIPS)) {
return null;
}

if(super.getToolTip() == null && doShowViewTooltips) {
if(super.getToolTip() == null) {
setToolTip(new ToolTipFigure());
}

return doShowViewTooltips ? super.getToolTip() : null;
return super.getToolTip();
}

/**
Expand Down

0 comments on commit f48f9e7

Please sign in to comment.