Skip to content

Commit 957fdcb

Browse files
committed
Adjust SidebarService:
* add doc * extend "add" method with displayName parameter * add service specific exception
1 parent 82d9342 commit 957fdcb

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
package org.cryptomator.integrations.filemanagersidebar;
22

33
import org.cryptomator.integrations.common.IntegrationsLoader;
4+
import org.jetbrains.annotations.NotNull;
45

6+
import java.io.Closeable;
57
import java.nio.file.Path;
68
import java.util.Optional;
79

10+
/**
11+
* Service for integrating a given path into the sidebar/quick access bar of a filemanager.
12+
*/
813
public interface SidebarService {
914

10-
SidebarEntry add(Path mountpoint);
15+
/**
16+
* Creates an entry in the filemanager sidebar.
17+
*
18+
* @param displayName The display name of the sidebar entry
19+
* @param target The filesystem path the sidebar entry points to.
20+
* @return a @{link SidebarEntry } object
21+
*/
22+
SidebarEntry add(@NotNull String displayName, @NotNull Path target) throws SidebarServiceException;
1123

12-
interface SidebarEntry {
13-
void remove();
24+
/**
25+
* An entry of the filemanager sidebar, created with this service.
26+
*/
27+
interface SidebarEntry extends Closeable {
28+
29+
/**
30+
* Removes this entry from the sidebar. Once removed, this object cannot be added again.
31+
*/
32+
void remove() throws SidebarServiceException;
33+
34+
default void close() {
35+
remove();
36+
}
1437
}
1538

1639
static Optional<SidebarService> get() {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package org.cryptomator.integrations.filemanagersidebar;
2+
3+
public class SidebarServiceException extends RuntimeException {
4+
}

0 commit comments

Comments
 (0)