Skip to content

Commit

Permalink
Adjust SidebarService:
Browse files Browse the repository at this point in the history
* add doc
* extend "add" method with displayName parameter
* add service specific exception
  • Loading branch information
infeo committed Jun 18, 2024
1 parent 82d9342 commit 957fdcb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
package org.cryptomator.integrations.filemanagersidebar;

import org.cryptomator.integrations.common.IntegrationsLoader;
import org.jetbrains.annotations.NotNull;

import java.io.Closeable;
import java.nio.file.Path;
import java.util.Optional;

/**
* Service for integrating a given path into the sidebar/quick access bar of a filemanager.
*/
public interface SidebarService {

SidebarEntry add(Path mountpoint);
/**
* Creates an entry in the filemanager sidebar.
*
* @param displayName The display name of the sidebar entry
* @param target The filesystem path the sidebar entry points to.
* @return a @{link SidebarEntry } object
*/
SidebarEntry add(@NotNull String displayName, @NotNull Path target) throws SidebarServiceException;

interface SidebarEntry {
void remove();
/**
* An entry of the filemanager sidebar, created with this service.
*/
interface SidebarEntry extends Closeable {

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

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

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

public class SidebarServiceException extends RuntimeException {
}

0 comments on commit 957fdcb

Please sign in to comment.