mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-21 10:52:14 +01:00
Merge pull request #11508 from cmaglie/deprecation_field
Added basic "deprecation" support for platforms
This commit is contained in:
commit
8ceb6c29f8
@ -44,12 +44,14 @@ public class ContributedPlatformReleases {
|
||||
public final List<ContributedPlatform> releases;
|
||||
public final List<String> versions;
|
||||
public ContributedPlatform selected = null;
|
||||
public boolean deprecated;
|
||||
|
||||
public ContributedPlatformReleases(ContributedPlatform platform) {
|
||||
packager = platform.getParentPackage();
|
||||
arch = platform.getArchitecture();
|
||||
releases = new LinkedList<>();
|
||||
versions = new LinkedList<>();
|
||||
deprecated = platform.isDeprecated();
|
||||
add(platform);
|
||||
}
|
||||
|
||||
@ -65,7 +67,9 @@ public class ContributedPlatformReleases {
|
||||
if (version != null) {
|
||||
versions.add(version);
|
||||
}
|
||||
selected = getLatest();
|
||||
ContributedPlatform latest = getLatest();
|
||||
selected = latest;
|
||||
deprecated = latest.isDeprecated();
|
||||
}
|
||||
|
||||
public ContributedPlatform getInstalled() {
|
||||
@ -89,6 +93,10 @@ public class ContributedPlatformReleases {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public boolean isDeprecated() {
|
||||
return deprecated;
|
||||
}
|
||||
|
||||
public void select(ContributedPlatform value) {
|
||||
for (ContributedPlatform plat : releases) {
|
||||
if (plat == value) {
|
||||
|
@ -232,6 +232,9 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
|
||||
+ format(tr("version <b>{0}</b>"), installed.getParsedVersion())
|
||||
+ " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
|
||||
}
|
||||
if (releases.isDeprecated()) {
|
||||
desc += " <strong><font color=\"#C03030\">DEPRECATED</font></strong>";
|
||||
}
|
||||
desc += "<br />";
|
||||
|
||||
desc += tr("Boards included in this package:") + "<br />";
|
||||
|
@ -36,6 +36,7 @@ import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
||||
import processing.app.BaseNoGui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
@ -73,6 +74,18 @@ public class ContributionIndexTableModel
|
||||
addContribution(platform);
|
||||
}
|
||||
}
|
||||
Collections.sort(contributions, (x,y)-> {
|
||||
if (x.isDeprecated() != y.isDeprecated()) {
|
||||
return x.isDeprecated() ? 1 : -1;
|
||||
}
|
||||
ContributedPlatform x1 = x.getLatest();
|
||||
ContributedPlatform y1 = y.getLatest();
|
||||
int category = (x1.getCategory().equals("Arduino") ? -1 : 0) + (y1.getCategory().equals("Arduino") ? 1 : 0);
|
||||
if (category != 0) {
|
||||
return category;
|
||||
}
|
||||
return x1.getName().compareToIgnoreCase(y1.getName());
|
||||
});
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,18 @@
|
||||
|
||||
package cc.arduino.contributions.packages;
|
||||
|
||||
import cc.arduino.contributions.DownloadableContribution;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import cc.arduino.contributions.DownloadableContribution;
|
||||
|
||||
public class ContributedPlatform extends DownloadableContribution {
|
||||
|
||||
@ -45,21 +52,26 @@ public class ContributedPlatform extends DownloadableContribution {
|
||||
private String category;
|
||||
private String architecture;
|
||||
private String checksum;
|
||||
private ArrayList<ContributedToolReference> toolsDependencies = new ArrayList<ContributedToolReference>();
|
||||
private ArrayList<ContributedBoard> boards = new ArrayList<ContributedBoard>();
|
||||
private ArrayList<ContributedToolReference> toolsDependencies = new ArrayList<>();
|
||||
private ArrayList<ContributedBoard> boards = new ArrayList<>();
|
||||
private ContributedHelp help;
|
||||
private boolean installed;
|
||||
private File installedFolder;
|
||||
private boolean builtIn;
|
||||
private Map<ContributedToolReference, ContributedTool> resolvedToolReferences;
|
||||
private ContributedPackage parentPackage;
|
||||
private boolean deprecated;
|
||||
|
||||
@Override
|
||||
public String getUrl() { return url; }
|
||||
|
||||
@Override
|
||||
public String getVersion() { return version; }
|
||||
|
||||
@Override
|
||||
public long getSize() { return size; }
|
||||
|
||||
@Override
|
||||
public String getArchiveFileName() { return archiveFileName; }
|
||||
|
||||
public String getName() { return name; }
|
||||
@ -146,6 +158,14 @@ public class ContributedPlatform extends DownloadableContribution {
|
||||
this.parentPackage = parentPackage;
|
||||
}
|
||||
|
||||
public boolean isDeprecated() {
|
||||
return deprecated;
|
||||
}
|
||||
|
||||
public void setDeprecated(boolean deprecated) {
|
||||
this.deprecated = deprecated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getParsedVersion();
|
||||
|
Loading…
x
Reference in New Issue
Block a user