Skip to content

Commit

Permalink
Restore Plugin Toolbar Button Tooltips (runelite#2833)
Browse files Browse the repository at this point in the history
* Always set button tooltips
* Completely remove name property and replace it with tooltips
* Make tooltips final
  • Loading branch information
MrCoolTheCucumber authored and deathbeam committed May 19, 2018
1 parent cea85de commit 53f7dea
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Configuration")
.tooltip("Configuration")
.icon(icon)
.priority(0)
.panel(configPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Developer Tools")
.tooltip("Developer Tools")
.icon(icon)
.priority(1)
.panel(panel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void startUp() throws Exception
panel = new FarmingTrackerPanel(client, itemManager, configManager, config, farmingWorld);

navButton = NavigationButton.builder()
.name("Farming Tracker")
.tooltip("Farming Tracker")
.icon(icon)
.panel(panel)
.priority(4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("News Feed")
.tooltip("News Feed")
.icon(icon)
.priority(8)
.panel(feedPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected void startUp() throws IOException
}

button = NavigationButton.builder()
.name("GE Offers")
.tooltip("GE Offers")
.icon(icon)
.priority(3)
.panel(panel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Hiscore")
.tooltip("Hiscore")
.icon(icon)
.priority(5)
.panel(hiscorePanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Info")
.tooltip("Info")
.icon(icon)
.priority(9)
.panel(panel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Kourend Library")
.tooltip("Kourend Library")
.priority(6)
.icon(icon)
.panel(panel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("Notes")
.tooltip("Notes")
.icon(icon)
.priority(7)
.panel(panel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void startUp() throws Exception

uiPanel = new SkillCalculatorPanel(skillIconManager, client);
uiNavigationButton = NavigationButton.builder()
.name("Skill Calculator")
.tooltip("Skill Calculator")
.icon(icon)
.priority(6)
.panel(uiPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void startUp() throws Exception
}

navButton = NavigationButton.builder()
.name("XP Tracker")
.tooltip("XP Tracker")
.icon(icon)
.priority(2)
.panel(xpPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@
*/
@Data
@Builder
@EqualsAndHashCode(of = {"name", "tooltip"})
@EqualsAndHashCode(of = {"tooltip"})
public class NavigationButton
{
/**
* Button name.
*/
private final String name;

/**
* Icon of button.
*/
Expand All @@ -52,7 +47,7 @@ public class NavigationButton
/**
* Tooltip to show when hovered.
*/
private String tooltip;
private final String tooltip;

/**
* Button selection state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PluginToolbar
private final TreeSet<NavigationButton> buttons = new TreeSet<>((a, b) ->
ComparisonChain.start()
.compare(a.getPriority(), b.getPriority())
.compare(a.getName(), b.getName())
.compare(a.getTooltip(), b.getTooltip())
.result());

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ public static JButton createSwingButton(

final JButton button = new JButton();
button.setMaximumSize(new Dimension(30, 30));
button.setName(navigationButton.getName());
button.setToolTipText(navigationButton.getTooltip());
button.setIcon(new ImageIcon(scaledImage));
button.putClientProperty(SubstanceSynapse.FLAT_LOOK, Boolean.TRUE);
Expand Down

0 comments on commit 53f7dea

Please sign in to comment.