57
57
import cc .arduino .contributions .packages .ContributedPlatform ;
58
58
import cc .arduino .contributions .ui .InstallerTableCell ;
59
59
import processing .app .Base ;
60
+ import processing .app .PreferencesData ;
60
61
import processing .app .Theme ;
61
62
62
63
@ SuppressWarnings ("serial" )
63
64
public class ContributedPlatformTableCellJPanel extends JPanel {
64
65
66
+ final JButton moreInfoButton ;
67
+ final JButton onlineHelpButton ;
65
68
final JButton installButton ;
66
69
final JButton removeButton ;
67
70
final Component removeButtonPlaceholder ;
@@ -79,6 +82,10 @@ public ContributedPlatformTableCellJPanel() {
79
82
80
83
{
81
84
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 );
82
89
int width = installButton .getPreferredSize ().width ;
83
90
installButtonPlaceholder = Box .createRigidArea (new Dimension (width , 1 ));
84
91
}
@@ -115,6 +122,11 @@ public ContributedPlatformTableCellJPanel() {
115
122
buttonsPanel .setOpaque (false );
116
123
117
124
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 ));
118
130
buttonsPanel .add (downgradeChooser );
119
131
buttonsPanel .add (Box .createHorizontalStrut (5 ));
120
132
buttonsPanel .add (downgradeButton );
@@ -216,16 +228,35 @@ void update(JTable parentTable, Object value, boolean isSelected,
216
228
} else if (selected .getParentPackage ().getHelp () != null ) {
217
229
help = selected .getParentPackage ().getHelp ();
218
230
}
231
+
232
+ boolean accessibleIDE = PreferencesData .getBoolean ("ide.accessible" );
233
+
219
234
if (help != null ) {
220
235
String url = help .getOnline ();
221
236
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
+ }
223
246
}
224
247
}
225
248
226
249
String url = selected .getParentPackage ().getWebsiteURL ();
227
250
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
+ }
229
260
}
230
261
231
262
desc += "</body></html>" ;
0 commit comments