Skip to content

Commit ebb0e40

Browse files
author
Joe Wegner
committed
When the ide.accessible setting is enabled use a button instead of a link for more info
1 parent ba3f506 commit ebb0e40

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import cc.arduino.contributions.libraries.ContributedLibraryReleases;
2929
import cc.arduino.contributions.ui.InstallerTableCell;
3030
import processing.app.Base;
31+
import processing.app.PreferencesData;
3132
import processing.app.Theme;
3233

3334
public class ContributedLibraryTableCellJPanel extends JPanel {
3435

36+
final JButton moreInfoButton;
3537
final JButton installButton;
3638
final Component installButtonPlaceholder;
3739
final JComboBox downgradeChooser;
@@ -46,6 +48,8 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
4648
super();
4749
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
4850

51+
moreInfoButton = new JButton(tr("More info"));
52+
moreInfoButton.setVisible(false);
4953
installButton = new JButton(tr("Install"));
5054
int width = installButton.getPreferredSize().width;
5155
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
@@ -79,6 +83,9 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
7983
buttonsPanel.setOpaque(false);
8084

8185
buttonsPanel.add(Box.createHorizontalStrut(7));
86+
buttonsPanel.add(moreInfoButton);
87+
buttonsPanel.add(Box.createHorizontalStrut(5));
88+
buttonsPanel.add(Box.createHorizontalStrut(15));
8289
buttonsPanel.add(downgradeChooser);
8390
buttonsPanel.add(Box.createHorizontalStrut(5));
8491
buttonsPanel.add(downgradeButton);
@@ -141,7 +148,7 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
141148
String name = selected.getName();
142149
String author = selected.getAuthor();
143150
// String maintainer = selectedLib.getMaintainer();
144-
String website = selected.getWebsite();
151+
final String website = selected.getWebsite();
145152
String sentence = selected.getSentence();
146153
String paragraph = selected.getParagraph();
147154
// String availableVer = selectedLib.getVersion();
@@ -188,7 +195,16 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
188195
desc += "<br />";
189196
}
190197
if (author != null && !author.isEmpty()) {
191-
desc += format("<a href=\"{0}\">More info</a>", website);
198+
boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible");
199+
if (accessibleIDE) {
200+
moreInfoButton.setVisible(true);
201+
moreInfoButton.addActionListener(e -> {
202+
Base.openURL(website);
203+
});
204+
}
205+
else {
206+
desc += format("<a href=\"{0}\">More info</a>", website);
207+
}
192208
}
193209

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

0 commit comments

Comments
 (0)