mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Added filters properties for showing installed and upgradeable
This commit is contained in:
@@ -53,7 +53,7 @@ public class Base {
|
||||
/** True if heavy debugging error/log messages are enabled */
|
||||
static public boolean DEBUG = false;
|
||||
// static public boolean DEBUG = true;
|
||||
static public boolean ENABLE_LIBRARY_MANAGER = false;
|
||||
static public boolean ENABLE_LIBRARY_MANAGER = true;
|
||||
|
||||
static HashMap<Integer, String> platformNames =
|
||||
new HashMap<Integer, String>();
|
||||
|
||||
@@ -220,23 +220,39 @@ public class ContributionListing {
|
||||
return filteredList;
|
||||
}
|
||||
|
||||
private boolean matches(ContributionInfo libInfo, String filter) {
|
||||
private boolean matches(ContributionInfo info, String filter) {
|
||||
|
||||
// Maybe this can be fancy some other time
|
||||
if (filter.equals("has:update") || filter.equals("has:updates")) {
|
||||
return info.latestVersion != null;
|
||||
}
|
||||
if (filter.equals("is:installed")) {
|
||||
return info.isInstalled();
|
||||
}
|
||||
if (filter.equals("not:installed")) {
|
||||
return !info.isInstalled();
|
||||
}
|
||||
if (filter.contains(":")) {
|
||||
// Return true and ignore everything else if the property is invalid.
|
||||
return true;
|
||||
}
|
||||
// sdfikjfdslk Added filters properties for showing installed and upgrade
|
||||
filter = ".*" + filter.toLowerCase() + ".*";
|
||||
|
||||
if (filter.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Author author : libInfo.authorList) {
|
||||
for (Author author : info.authorList) {
|
||||
if (author.name.toLowerCase().matches(filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return libInfo.sentence != null && libInfo.sentence.toLowerCase().matches(filter)
|
||||
|| libInfo.paragraph != null && libInfo.paragraph.toLowerCase().matches(filter)
|
||||
|| libInfo.category != null && libInfo.category.toLowerCase().matches(filter)
|
||||
|| libInfo.name != null && libInfo.name.toLowerCase().matches(filter);
|
||||
return info.sentence != null && info.sentence.toLowerCase().matches(filter)
|
||||
|| info.paragraph != null && info.paragraph.toLowerCase().matches(filter)
|
||||
|| info.category != null && info.category.toLowerCase().matches(filter)
|
||||
|| info.name != null && info.name.toLowerCase().matches(filter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -755,8 +755,8 @@ public class ContributionManager {
|
||||
String filter = filterField.getFilterText();
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
// Replace anything but 0-9 or a-z with a space
|
||||
filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a]", " ");
|
||||
// Replace anything but 0-9, a-z, or : with a space
|
||||
filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a^\\x3a]", " ");
|
||||
filters = Arrays.asList(filter.split(" "));
|
||||
filterLibraries(category, filters);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user