Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8ceb6c2

Browse files
authored
Merge pull request #11508 from cmaglie/deprecation_field
Added basic "deprecation" support for platforms
2 parents 69e91ca + 12cb3f0 commit 8ceb6c2

File tree

4 files changed

+50
-6
lines changed

4 files changed

+50
-6
lines changed

‎app/src/cc/arduino/contributions/packages/ui/ContributedPlatformReleases.java‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ public class ContributedPlatformReleases {
4444
public final List<ContributedPlatform> releases;
4545
public final List<String> versions;
4646
public ContributedPlatform selected = null;
47+
public boolean deprecated;
4748

4849
public ContributedPlatformReleases(ContributedPlatform platform) {
4950
packager = platform.getParentPackage();
5051
arch = platform.getArchitecture();
5152
releases = new LinkedList<>();
5253
versions = new LinkedList<>();
54+
deprecated = platform.isDeprecated();
5355
add(platform);
5456
}
5557

@@ -65,7 +67,9 @@ public void add(ContributedPlatform platform) {
6567
if (version != null) {
6668
versions.add(version);
6769
}
68-
selected = getLatest();
70+
ContributedPlatform latest = getLatest();
71+
selected = latest;
72+
deprecated = latest.isDeprecated();
6973
}
7074

7175
public ContributedPlatform getInstalled() {
@@ -89,6 +93,10 @@ public ContributedPlatform getSelected() {
8993
return selected;
9094
}
9195

96+
public boolean isDeprecated() {
97+
return deprecated;
98+
}
99+
92100
public void select(ContributedPlatform value) {
93101
for (ContributedPlatform plat : releases) {
94102
if (plat == value) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ void update(JTable parentTable, Object value, boolean hasBuiltInRelease) {
232232
+ format(tr("version <b>{0}</b>"), installed.getParsedVersion())
233233
+ " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
234234
}
235+
if (releases.isDeprecated()) {
236+
desc += " <strong><font color=\"#C03030\">DEPRECATED</font></strong>";
237+
}
235238
desc += "<br />";
236239

237240
desc += tr("Boards included in this package:") + "<br />";

‎app/src/cc/arduino/contributions/packages/ui/ContributionIndexTableModel.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import processing.app.BaseNoGui;
3737

3838
import java.util.ArrayList;
39+
import java.util.Collections;
3940
import java.util.List;
4041
import java.util.function.Predicate;
4142
import java.util.stream.Collectors;
@@ -73,6 +74,18 @@ private void updateContributions() {
7374
addContribution(platform);
7475
}
7576
}
77+
Collections.sort(contributions, (x,y)-> {
78+
if (x.isDeprecated() != y.isDeprecated()) {
79+
return x.isDeprecated() ? 1 : -1;
80+
}
81+
ContributedPlatform x1 = x.getLatest();
82+
ContributedPlatform y1 = y.getLatest();
83+
int category = (x1.getCategory().equals("Arduino") ? -1 : 0) + (y1.getCategory().equals("Arduino") ? 1 : 0);
84+
if (category != 0) {
85+
return category;
86+
}
87+
return x1.getName().compareToIgnoreCase(y1.getName());
88+
});
7689
fireTableDataChanged();
7790
}
7891

‎arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@
2929

3030
package cc.arduino.contributions.packages;
3131

32-
import cc.arduino.contributions.DownloadableContribution;
32+
import java.io.File;
33+
import java.util.ArrayList;
34+
import java.util.Collection;
35+
import java.util.Comparator;
36+
import java.util.HashMap;
37+
import java.util.LinkedList;
38+
import java.util.List;
39+
import java.util.Map;
40+
3341
import com.fasterxml.jackson.annotation.JsonIgnore;
3442

35-
import java.io.File;
36-
import java.util.*;
43+
import cc.arduino.contributions.DownloadableContribution;
3744

3845
public class ContributedPlatform extends DownloadableContribution {
3946

@@ -45,21 +52,26 @@ public class ContributedPlatform extends DownloadableContribution {
4552
private String category;
4653
private String architecture;
4754
private String checksum;
48-
private ArrayList<ContributedToolReference> toolsDependencies = new ArrayList<ContributedToolReference>();
49-
private ArrayList<ContributedBoard> boards = new ArrayList<ContributedBoard>();
55+
private ArrayList<ContributedToolReference> toolsDependencies = new ArrayList<>();
56+
private ArrayList<ContributedBoard> boards = new ArrayList<>();
5057
private ContributedHelp help;
5158
private boolean installed;
5259
private File installedFolder;
5360
private boolean builtIn;
5461
private Map<ContributedToolReference, ContributedTool> resolvedToolReferences;
5562
private ContributedPackage parentPackage;
63+
private boolean deprecated;
5664

65+
@Override
5766
public String getUrl() { return url; }
5867

68+
@Override
5969
public String getVersion() { return version; }
6070

71+
@Override
6172
public long getSize() { return size; }
6273

74+
@Override
6375
public String getArchiveFileName() { return archiveFileName; }
6476

6577
public String getName() { return name; }
@@ -146,6 +158,14 @@ public void setParentPackage(ContributedPackage parentPackage) {
146158
this.parentPackage = parentPackage;
147159
}
148160

161+
public boolean isDeprecated() {
162+
return deprecated;
163+
}
164+
165+
public void setDeprecated(boolean deprecated) {
166+
this.deprecated = deprecated;
167+
}
168+
149169
@Override
150170
public String toString() {
151171
return getParsedVersion();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /