Skip to content

Commit 6667325

Browse files
authored
Merge branch 'master' into serialPlotterConfigurableBuffer
2 parents 6c75f09 + a1e43ce commit 6667325

File tree

124 files changed

+910
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+910
-606
lines changed

.classpath

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<classpathentry kind="lib" path="app/lib/bcprov-jdk15on-152.jar"/>
2424
<classpathentry kind="lib" path="app/lib/jackson-core-2.9.5.jar"/>
2525
<classpathentry kind="lib" path="app/lib/jackson-databind-2.9.5.jar"/>
26-
<classpathentry kind="lib" path="app/lib/jackson-module-mrbean-2.9.5.jar"/>
2726
<classpathentry kind="lib" path="app/lib/jackson-annotations-2.9.5.jar"/>
2827
<classpathentry kind="lib" path="app/lib/commons-compress-1.8.jar"/>
2928
<classpathentry kind="lib" path="app/lib/commons-lang3-3.8.1.jar"/>

.github/workflows/ant.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Java CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 1.8
18+
- name: Build with Ant
19+
working-directory: ./build
20+
run: |
21+
sed -i 's#<input .*/>##' build.xml
22+
ant clean dist
23+
- name: Install X virtual framebuffer
24+
run: sudo apt-get install -y xvfb
25+
- name: Run tests
26+
working-directory: ./app
27+
run: xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" ant test
28+
- name: Cleanup xvfb
29+
uses: bcomnes/cleanup-xvfb@v1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ and David A. Mellis.
5050
Arduino uses
5151
[GNU avr-gcc toolchain](https://gcc.gnu.org/wiki/avr-gcc),
5252
[GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded),
53-
[avr-libc](http://www.nongnu.org/avr-libc/),
54-
[avrdude](http://www.nongnu.org/avrdude/),
53+
[avr-libc](https://www.nongnu.org/avr-libc/),
54+
[avrdude](https://www.nongnu.org/avrdude/),
5555
[bossac](http://www.shumatech.com/web/products/bossa),
5656
[openOCD](http://openocd.org/)
5757
and code from [Processing](https://www.processing.org)

app/.classpath

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
<classpathentry kind="lib" path="lib/jackson-annotations-2.9.5.jar"/>
3535
<classpathentry kind="lib" path="lib/jackson-core-2.9.5.jar"/>
3636
<classpathentry kind="lib" path="lib/jackson-databind-2.9.5.jar"/>
37-
<classpathentry kind="lib" path="lib/jackson-module-mrbean-2.9.5.jar"/>
3837
<classpathentry kind="lib" path="lib/java-semver-0.8.0.jar"/>
3938
<classpathentry kind="lib" path="lib/jmdns-3.5.3.jar"/>
4039
<classpathentry kind="lib" path="lib/slf4j-api-1.7.22.jar"/>

app/build.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<fileset dir="test" includes="**/*.pac" />
110110
</copy>
111111

112-
<junit printsummary="yes" dir="${work.dir}" fork="true">
112+
<junit printsummary="yes" dir="${work.dir}" fork="true" showoutput="yes" failureproperty="test.failed">
113113
<jvmarg value="-Djava.library.path=${java.additional.library.path}"/>
114114
<jvmarg value="-DWORK_DIR=."/>
115115
<jvmarg value="-ea"/>
@@ -131,6 +131,7 @@
131131
</batchtest>
132132
</junit>
133133

134+
<fail if="test.failed"/>
134135
</target>
135136

136137
<target name="build" depends="compile" description="Build PDE">
-78.8 KB
Binary file not shown.

app/lib/jtouchbar-1.0.0.jar

8.28 KB
Binary file not shown.

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import cc.arduino.contributions.libraries.ContributedLibrary;
3333
import cc.arduino.contributions.libraries.ContributedLibraryReleases;
3434

35+
import java.util.Arrays;
3536
import java.util.Comparator;
37+
import java.util.List;
3638

3739
public class ContributedLibraryReleasesComparator implements Comparator<ContributedLibraryReleases> {
3840

@@ -47,9 +49,11 @@ public int compare(ContributedLibraryReleases o1, ContributedLibraryReleases o2)
4749
ContributedLibrary lib1 = o1.getLatest();
4850
ContributedLibrary lib2 = o2.getLatest();
4951

50-
if (lib1.getTypes() == null || lib2.getTypes() == null) {
51-
return compareName(lib1, lib2);
52-
}
52+
List<String> types1 = lib1.getTypes();
53+
List<String> types2 = lib2.getTypes();
54+
if (types1 == null) types1 = Arrays.asList();
55+
if (types2 == null) types2 = Arrays.asList();
56+
5357
if (lib1.getTypes().contains(firstType) && lib2.getTypes().contains(firstType)) {
5458
return compareName(lib1, lib2);
5559
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public Component getTableCellEditorComponent(JTable table, Object value,
125125
editorCell.versionToInstallChooser
126126
.setVisible(!mayInstalled.isPresent() && notInstalled.size() > 1);
127127

128+
editorCell.setForeground(Color.BLACK);
128129
editorCell.setBackground(new Color(218, 227, 227)); // #dae3e3
129130
return editorCell;
130131
}

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

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,12 @@
33
import static processing.app.I18n.format;
44
import static processing.app.I18n.tr;
55

6-
import java.awt.Color;
7-
import java.awt.Component;
8-
import java.awt.Dimension;
9-
import java.awt.Insets;
6+
import java.awt.*;
107
import java.util.Optional;
118

12-
import javax.swing.Box;
13-
import javax.swing.BoxLayout;
14-
import javax.swing.JButton;
15-
import javax.swing.JComboBox;
16-
import javax.swing.JLabel;
17-
import javax.swing.JPanel;
18-
import javax.swing.JTable;
19-
import javax.swing.JTextPane;
9+
import javax.swing.*;
2010
import javax.swing.border.EmptyBorder;
11+
import javax.swing.border.TitledBorder;
2112
import javax.swing.event.HyperlinkEvent;
2213
import javax.swing.text.Document;
2314
import javax.swing.text.html.HTMLDocument;
@@ -42,13 +33,20 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
4233
final JPanel buttonsPanel;
4334
final JPanel inactiveButtonsPanel;
4435
final JLabel statusLabel;
36+
final JTextPane description;
37+
final TitledBorder titledBorder;
4538
private final String moreInfoLbl = tr("More info");
4639

4740
public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
4841
boolean isSelected) {
4942
super();
5043
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
5144

45+
// Actual title set below
46+
titledBorder = BorderFactory.createTitledBorder("");
47+
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
48+
setBorder(titledBorder);
49+
5250
moreInfoButton = new JButton(moreInfoLbl);
5351
moreInfoButton.setVisible(false);
5452
installButton = new JButton(tr("Install"));
@@ -77,7 +75,8 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
7775
versionToInstallChooser
7876
.setMinimumSize(new Dimension((int)versionToInstallChooser.getPreferredSize().getWidth() + 50, (int)versionToInstallChooser.getPreferredSize().getHeight()));
7977

80-
makeNewDescription();
78+
description = makeNewDescription();
79+
add(description);
8180

8281
buttonsPanel = new JPanel();
8382
buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
@@ -121,13 +120,13 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
121120
add(Box.createVerticalStrut(15));
122121

123122
ContributedLibraryReleases releases = (ContributedLibraryReleases) value;
124-
JTextPane description = makeNewDescription();
125123

126124
// FIXME: happens on macosx, don't know why
127125
if (releases == null)
128126
return;
129127

130128
ContributedLibrary selected = releases.getSelected();
129+
titledBorder.setTitle(selected.getName());
131130
Optional<ContributedLibrary> mayInstalled = releases.getInstalled();
132131

133132
boolean installable, upgradable;
@@ -162,7 +161,7 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
162161
String desc = "<html><body>";
163162

164163
// Library name...
165-
desc += format("<b>{0}</b>", name);
164+
// desc += format("<b>{0}</b>", name);
166165
if (mayInstalled.isPresent() && mayInstalled.get().isIDEBuiltIn()) {
167166
desc += " Built-In ";
168167
}
@@ -205,7 +204,6 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
205204
description.setText(desc);
206205
// copy description to accessibility context for screen readers to use
207206
description.getAccessibleContext().setAccessibleDescription(desc);
208-
description.setBackground(Color.WHITE);
209207

210208
// for modelToView to work, the text area has to be sized. It doesn't
211209
// matter if it's visible or not.
@@ -215,14 +213,6 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
215213
InstallerTableCell
216214
.setJTextPaneDimensionToFitContainedText(description,
217215
parentTable.getBounds().width);
218-
219-
if (isSelected) {
220-
setBackground(parentTable.getSelectionBackground());
221-
setForeground(parentTable.getSelectionForeground());
222-
} else {
223-
setBackground(parentTable.getBackground());
224-
setForeground(parentTable.getForeground());
225-
}
226216
}
227217

228218
// same function as in ContributedPlatformTableCellJPanel - is there a utils file this can move to?
@@ -246,9 +236,6 @@ private String setButtonOrLink(JButton button, String desc, String label, String
246236

247237
// TODO Make this a method of Theme
248238
private JTextPane makeNewDescription() {
249-
if (getComponentCount() > 0) {
250-
remove(0);
251-
}
252239
JTextPane description = new JTextPane();
253240
description.setInheritsPopupMenu(true);
254241
Insets margin = description.getMargin();
@@ -274,7 +261,6 @@ private JTextPane makeNewDescription() {
274261
}
275262
});
276263
// description.addKeyListener(new DelegatingKeyListener(parentTable));
277-
add(description, 0);
278264
return description;
279265
}
280266

@@ -283,4 +269,13 @@ public void setButtonsVisible(boolean enabled) {
283269
buttonsPanel.setVisible(enabled);
284270
inactiveButtonsPanel.setVisible(!enabled);
285271
}
272+
273+
public void setForeground(Color c) {
274+
super.setForeground(c);
275+
// The description is not opaque, so copy our foreground color to it.
276+
if (description != null)
277+
description.setForeground(c);
278+
if (titledBorder != null)
279+
titledBorder.setTitleColor(c);
280+
}
286281
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public Component getTableCellRendererComponent(JTable table, Object value,
4646
value, isSelected);
4747
cell.setButtonsVisible(false);
4848

49+
cell.setForeground(Color.BLACK);
4950
if (row % 2 == 0) {
5051
cell.setBackground(new Color(236, 241, 241)); // #ecf1f1
5152
} else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ public Component getTableCellEditorComponent(JTable table, Object _value,
129129
cell.versionToInstallChooser
130130
.setVisible(installed == null && uninstalledReleases.size() > 1);
131131

132-
cell.update(table, _value, true, !installedBuiltIn.isEmpty());
132+
cell.update(table, _value, !installedBuiltIn.isEmpty());
133+
cell.setForeground(Color.BLACK);
133134
cell.setBackground(new Color(218, 227, 227)); // #dae3e3
134135
return cell;
135136
}

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

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,11 @@
3232
import static processing.app.I18n.format;
3333
import static processing.app.I18n.tr;
3434

35-
import java.awt.Color;
36-
import java.awt.Component;
37-
import java.awt.Dimension;
38-
import java.awt.Insets;
39-
40-
import javax.swing.Box;
41-
import javax.swing.BoxLayout;
42-
import javax.swing.JButton;
43-
import javax.swing.JComboBox;
44-
import javax.swing.JLabel;
45-
import javax.swing.JPanel;
46-
import javax.swing.JTable;
47-
import javax.swing.JTextPane;
35+
import java.awt.*;
36+
37+
import javax.swing.*;
4838
import javax.swing.border.EmptyBorder;
39+
import javax.swing.border.TitledBorder;
4940
import javax.swing.event.HyperlinkEvent;
5041
import javax.swing.text.Document;
5142
import javax.swing.text.html.HTMLDocument;
@@ -75,13 +66,20 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
7566
final JPanel buttonsPanel;
7667
final JPanel inactiveButtonsPanel;
7768
final JLabel statusLabel;
69+
final JTextPane description;
70+
final TitledBorder titledBorder;
7871
private final String moreInfoLbl = tr("More Info");
7972
private final String onlineHelpLbl = tr("Online Help");
8073

8174
public ContributedPlatformTableCellJPanel() {
8275
super();
8376
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
8477

78+
// Actual title set by update()
79+
titledBorder = BorderFactory.createTitledBorder("");
80+
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
81+
setBorder(titledBorder);
82+
8583
{
8684
installButton = new JButton(tr("Install"));
8785
moreInfoButton = new JButton(moreInfoLbl);
@@ -117,7 +115,8 @@ public ContributedPlatformTableCellJPanel() {
117115
versionToInstallChooser
118116
.setMaximumSize(versionToInstallChooser.getPreferredSize());
119117

120-
makeNewDescription();
118+
description = makeNewDescription();
119+
add(description);
121120

122121
buttonsPanel = new JPanel();
123122
buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
@@ -184,18 +183,16 @@ private String setButtonOrLink(JButton button, String desc, String label, String
184183
return retString;
185184
}
186185

187-
void update(JTable parentTable, Object value, boolean isSelected,
188-
boolean hasBuiltInRelease) {
186+
void update(JTable parentTable, Object value, boolean hasBuiltInRelease) {
189187
ContributedPlatformReleases releases = (ContributedPlatformReleases) value;
190188

191-
JTextPane description = makeNewDescription();
192-
193189
// FIXME: happens on macosx, don't know why
194190
if (releases == null) {
195191
return;
196192
}
197193

198194
ContributedPlatform selected = releases.getSelected();
195+
titledBorder.setTitle(selected.getName());
199196
ContributedPlatform installed = releases.getInstalled();
200197

201198
boolean removable, installable, upgradable;
@@ -221,7 +218,7 @@ void update(JTable parentTable, Object value, boolean isSelected,
221218
removeButtonPlaceholder.setVisible(!removable);
222219

223220
String desc = "<html><body>";
224-
desc += "<b>" + selected.getName() + "</b>";
221+
// desc += "<b>" + selected.getName() + "</b>";
225222
if (installed != null && installed.isBuiltIn()) {
226223
desc += " Built-In ";
227224
}
@@ -268,7 +265,6 @@ void update(JTable parentTable, Object value, boolean isSelected,
268265
description.setText(desc);
269266
// copy description to accessibility context for screen readers to use
270267
description.getAccessibleContext().setAccessibleDescription(desc);
271-
description.setBackground(Color.WHITE);
272268

273269
// for modelToView to work, the text area has to be sized. It doesn't
274270
// matter if it's visible or not.
@@ -278,20 +274,9 @@ void update(JTable parentTable, Object value, boolean isSelected,
278274
int width = parentTable.getBounds().width;
279275
InstallerTableCell.setJTextPaneDimensionToFitContainedText(description,
280276
width);
281-
282-
if (isSelected) {
283-
setBackground(parentTable.getSelectionBackground());
284-
setForeground(parentTable.getSelectionForeground());
285-
} else {
286-
setBackground(parentTable.getBackground());
287-
setForeground(parentTable.getForeground());
288-
}
289277
}
290278

291279
private JTextPane makeNewDescription() {
292-
if (getComponentCount() > 0) {
293-
remove(0);
294-
}
295280
JTextPane description = new JTextPane();
296281
description.setInheritsPopupMenu(true);
297282
Insets margin = description.getMargin();
@@ -315,7 +300,6 @@ private JTextPane makeNewDescription() {
315300
Base.openURL(e.getDescription());
316301
}
317302
});
318-
add(description, 0);
319303
return description;
320304
}
321305

@@ -326,4 +310,12 @@ public void setButtonsVisible(boolean enabled) {
326310
inactiveButtonsPanel.setVisible(!enabled);
327311
}
328312

313+
public void setForeground(Color c) {
314+
super.setForeground(c);
315+
// The description is not opaque, so copy our foreground color to it.
316+
if (description != null)
317+
description.setForeground(c);
318+
if (titledBorder != null)
319+
titledBorder.setTitleColor(c);
320+
}
329321
}

0 commit comments

Comments
 (0)