Skip to content

Commit 3d94f24

Browse files
committed
refined API
1 parent c96eceb commit 3d94f24

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/main/java/module-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import org.cryptomator.integrations.filemanagersidebar.SidebarService;
1+
import org.cryptomator.integrations.sidebar.SidebarService;
22
import org.cryptomator.integrations.mount.MountService;
33
import org.cryptomator.integrations.revealpath.RevealPathService;
44
import org.cryptomator.integrations.tray.TrayMenuController;
@@ -19,7 +19,7 @@
1919
exports org.cryptomator.integrations.revealpath;
2020
exports org.cryptomator.integrations.tray;
2121
exports org.cryptomator.integrations.uiappearance;
22-
exports org.cryptomator.integrations.filemanagersidebar;
22+
exports org.cryptomator.integrations.sidebar;
2323

2424
uses AutoStartProvider;
2525
uses KeychainAccessProvider;

src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java renamed to src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package org.cryptomator.integrations.filemanagersidebar;
1+
package org.cryptomator.integrations.sidebar;
22

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

6-
import java.io.Closeable;
77
import java.nio.file.Path;
88
import java.util.Optional;
99

@@ -15,11 +15,13 @@ public interface SidebarService {
1515
/**
1616
* Creates an entry in the filemanager sidebar.
1717
*
18+
* @param target The filesystem path the sidebar entry points to
1819
* @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, used to remove the entry again
21-
* @apiNote Depending on the implemenation, the display name may not be used.
20+
* @return a {@link SidebarEntry }, used to remove the entry again
21+
* @throws SidebarServiceException if adding an entry to the filemanager sidebar fails
22+
* @apiNote It depends on the service implementation wether the display name is used or not.
2223
*/
24+
@Blocking
2325
SidebarEntry add(@NotNull Path target, @NotNull String displayName) throws SidebarServiceException;
2426

2527
/**
@@ -28,9 +30,13 @@ public interface SidebarService {
2830
interface SidebarEntry {
2931

3032
/**
31-
* Removes this entry from the sidebar. Once removed, this object cannot be added again.
33+
* Removes this entry from the sidebar.
34+
*
35+
* @throws SidebarServiceException if removal fails.
36+
* @implSpec ServiceProviders should make this function <em>idempotent</em>, i.e. after the method is called once and succeeded, consecutive calls should not change anything or throw an error.
3237
*/
33-
void remove();
38+
@Blocking
39+
void remove() throws SidebarServiceException;
3440

3541
}
3642

src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java renamed to src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.cryptomator.integrations.filemanagersidebar;
1+
package org.cryptomator.integrations.sidebar;
22

33
public class SidebarServiceException extends Exception {
44

0 commit comments

Comments
 (0)