-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/org/cryptomator/frontend/fuse/mount/RevealException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.cryptomator.frontend.fuse.mount; | ||
|
||
public class RevealException extends Exception { | ||
|
||
public RevealException(String msg) { | ||
super(msg); | ||
} | ||
|
||
public RevealException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public RevealException(String msg, Throwable cause) { | ||
super(msg, cause); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/cryptomator/frontend/fuse/mount/Revealer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.cryptomator.frontend.fuse.mount; | ||
|
||
import java.nio.file.Path; | ||
|
||
@FunctionalInterface | ||
public interface Revealer { | ||
|
||
void reveal(Path path) throws RevealException; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/java/org/cryptomator/frontend/fuse/mount/AwtFrameworkRevealer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.cryptomator.frontend.fuse.mount; | ||
|
||
import java.awt.Desktop; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
public class AwtFrameworkRevealer implements Revealer { | ||
|
||
@Override | ||
public void reveal(Path path) throws RevealException { | ||
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) { | ||
try { | ||
Desktop.getDesktop().open(path.toFile()); | ||
} catch (IOException e) { | ||
throw new RevealException(e); | ||
} | ||
} else { | ||
throw new RevealException("Desktop API to browse files not supported."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters