Skip to content

Commit d2f24f1

Browse files
author
Joe Wegner
committed
When the ide.accessible setting is enabled used buttons instead of links for online help and more info
1 parent ebb0e40 commit d2f24f1

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@
5757
import cc.arduino.contributions.packages.ContributedPlatform;
5858
import cc.arduino.contributions.ui.InstallerTableCell;
5959
import processing.app.Base;
60+
import processing.app.PreferencesData;
6061
import processing.app.Theme;
6162

6263
@SuppressWarnings("serial")
6364
public class ContributedPlatformTableCellJPanel extends JPanel {
6465

66+
final JButton moreInfoButton;
67+
final JButton onlineHelpButton;
6568
final JButton installButton;
6669
final JButton removeButton;
6770
final Component removeButtonPlaceholder;
@@ -79,6 +82,10 @@ public ContributedPlatformTableCellJPanel() {
7982

8083
{
8184
installButton = new JButton(tr("Install"));
85+
moreInfoButton = new JButton(tr("More Info"));
86+
moreInfoButton.setVisible(false);
87+
onlineHelpButton = new JButton(tr("Online Help"));
88+
onlineHelpButton.setVisible(false);
8289
int width = installButton.getPreferredSize().width;
8390
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
8491
}
@@ -115,6 +122,11 @@ public ContributedPlatformTableCellJPanel() {
115122
buttonsPanel.setOpaque(false);
116123

117124
buttonsPanel.add(Box.createHorizontalStrut(7));
125+
buttonsPanel.add(onlineHelpButton);
126+
buttonsPanel.add(Box.createHorizontalStrut(5));
127+
buttonsPanel.add(moreInfoButton);
128+
buttonsPanel.add(Box.createHorizontalStrut(5));
129+
buttonsPanel.add(Box.createHorizontalStrut(15));
118130
buttonsPanel.add(downgradeChooser);
119131
buttonsPanel.add(Box.createHorizontalStrut(5));
120132
buttonsPanel.add(downgradeButton);
@@ -216,16 +228,35 @@ void update(JTable parentTable, Object value, boolean isSelected,
216228
} else if (selected.getParentPackage().getHelp() != null) {
217229
help = selected.getParentPackage().getHelp();
218230
}
231+
232+
boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible");
233+
219234
if (help != null) {
220235
String url = help.getOnline();
221236
if (url != null && !url.isEmpty()) {
222-
desc += " " + format("<a href=\"{0}\">Online help</a><br/>", url);
237+
if (accessibleIDE) {
238+
onlineHelpButton.setVisible(true);
239+
onlineHelpButton.addActionListener(e -> {
240+
Base.openURL(url);
241+
});
242+
}
243+
else {
244+
desc += " " + format("<a href=\"{0}\">Online help</a><br/>", url);
245+
}
223246
}
224247
}
225248

226249
String url = selected.getParentPackage().getWebsiteURL();
227250
if (url != null && !url.isEmpty()) {
228-
desc += " " + format("<a href=\"{0}\">More info</a>", url);
251+
if (accessibleIDE) {
252+
moreInfoButton.setVisible(true);
253+
moreInfoButton.addActionListener(e -> {
254+
Base.openURL(url);
255+
});
256+
}
257+
else {
258+
desc += " " + format("<a href=\"{0}\">More info</a>", url);
259+
}
229260
}
230261

231262
desc += "</body></html>";

0 commit comments

Comments
 (0)