Skip to content

Commit abd03d3

Browse files
committed
Add BasePlatformFeature
1 parent 0ab327b commit abd03d3

14 files changed

Lines changed: 56 additions & 5 deletions

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
base.archivesName = "PlatformTools"
9-
version = "3.1.4"
9+
version = "3.1.5"
1010
group = "org.redlance"
1111

1212
repositories {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.redlance.platformtools;
2+
3+
public interface BasePlatformFeature {
4+
boolean isAvailable();
5+
}

src/main/java/org/redlance/platformtools/PlatformAccent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.function.Supplier;
1010

1111
@SuppressWarnings("unused") // API
12-
public interface PlatformAccent {
12+
public interface PlatformAccent extends BasePlatformFeature {
1313
Color MACOS_DEFAULT_ACCENT = new Color(0, 122, 255);
1414
PlatformAccent INSTANCE = new PlatformAccentImpl();
1515

src/main/java/org/redlance/platformtools/PlatformFileReferer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* which stores the URLs from which a file was downloaded.
1717
*/
1818
@SuppressWarnings("unused") // API
19-
public interface PlatformFileReferer {
19+
public interface PlatformFileReferer extends BasePlatformFeature {
2020
PlatformFileReferer INSTANCE = new PlatformFileRefererImpl();
2121

2222
/**

src/main/java/org/redlance/platformtools/PlatformFinderFavorites.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.nio.file.Path;
99

1010
@SuppressWarnings("unused") // API
11-
public interface PlatformFinderFavorites {
11+
public interface PlatformFinderFavorites extends BasePlatformFeature {
1212
PlatformFinderFavorites INSTANCE = new PlatformFinderFavoritesImpl();
1313

1414
/**

src/main/java/org/redlance/platformtools/impl/PlatformAccentImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ public void subscribeToChanges(Consumer<Color> consumer) {
3737
public boolean unsubscribeFromChanges(Consumer<Color> consumer) {
3838
return this.nativePlatformAccent.unsubscribeFromChanges(consumer);
3939
}
40+
41+
@Override
42+
public boolean isAvailable() {
43+
return this.nativePlatformAccent.isAvailable();
44+
}
4045
}

src/main/java/org/redlance/platformtools/impl/PlatformFileRefererImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ public class PlatformFileRefererImpl implements PlatformFileReferer {
2121
public @NotNull Set<String> getFileReferer(String path) throws IOException {
2222
return this.nativePlatformReferer.getFileReferer(path);
2323
}
24+
25+
@Override
26+
public boolean isAvailable() {
27+
return this.nativePlatformReferer.isAvailable();
28+
}
2429
}

src/main/java/org/redlance/platformtools/impl/PlatformFinderFavoritesImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ public boolean pin(String path, boolean isFolder, Position position) {
2626
public boolean unpin(String path) {
2727
return this.nativePlatformFinder.unpin(path);
2828
}
29+
30+
@Override
31+
public boolean isAvailable() {
32+
return this.nativePlatformFinder.isAvailable();
33+
}
2934
}

src/main/java/org/redlance/platformtools/impl/macos/MacAccent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,9 @@ public void run() {
113113
this.runnable.run();
114114
}
115115
}
116+
117+
@Override
118+
public boolean isAvailable() {
119+
return true;
120+
}
116121
}

src/main/java/org/redlance/platformtools/impl/macos/MacFileReferer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ public class MacFileReferer implements PlatformFileReferer {
5151
CoreServices.INSTANCE.CFRelease(mdItem);
5252
}
5353
}
54+
55+
@Override
56+
public boolean isAvailable() {
57+
return true;
58+
}
5459
}

0 commit comments

Comments
 (0)