Skip to content

Commit

Permalink
changing API
Browse files Browse the repository at this point in the history
* sidebar entries do not have be closable
* make sidebarService exception checked
  • Loading branch information
infeo committed Jun 18, 2024
1 parent 957fdcb commit c96eceb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ public interface SidebarService {
*
* @param displayName The display name of the sidebar entry
* @param target The filesystem path the sidebar entry points to.
* @return a @{link SidebarEntry } object
* @return a @{link SidebarEntry } object, used to remove the entry again
* @apiNote Depending on the implemenation, the display name may not be used.
*/
SidebarEntry add(@NotNull String displayName, @NotNull Path target) throws SidebarServiceException;
SidebarEntry add(@NotNull Path target, @NotNull String displayName) throws SidebarServiceException;

/**
* An entry of the filemanager sidebar, created with this service.
* An entry of the filemanager sidebar, created by an implementation of this service.
*/
interface SidebarEntry extends Closeable {
interface SidebarEntry {

/**
* Removes this entry from the sidebar. Once removed, this object cannot be added again.
*/
void remove() throws SidebarServiceException;
void remove();

default void close() {
remove();
}
}

static Optional<SidebarService> get() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
package org.cryptomator.integrations.filemanagersidebar;

public class SidebarServiceException extends RuntimeException {
public class SidebarServiceException extends Exception {

public SidebarServiceException(String message) {
super(message);
}

public SidebarServiceException(String message, Throwable t) {
super(message, t);
}
}

0 comments on commit c96eceb

Please sign in to comment.