Armin Schrenk 5 月之前
父节点
当前提交
b9512c9e93

+ 1 - 1
src/main/java/org/cryptomator/common/vaults/Vault.java

@@ -259,7 +259,7 @@ public class Vault {
 
 
 	private void consumeVaultEvent(FilesystemEvent e) {
-		fileSystemEventAggregator.enqueue(this, e);
+		fileSystemEventAggregator.put(this, e);
 	}
 
 	// ******************************************************************************

+ 2 - 2
src/main/java/org/cryptomator/event/FileSystemEventAggregator.java

@@ -29,12 +29,12 @@ public class FileSystemEventAggregator {
 	}
 
 	/**
-	 * Enques the given event to be inserted into the map.
+	 * Adds the given event to the map. If a bucket for this event already exists, only the count is updated and the event set as the most recent one.
 	 *
 	 * @param v Vault where the event occurred
 	 * @param e Actual {@link FilesystemEvent}
 	 */
-	public void enqueue(Vault v, FilesystemEvent e) {
+	public void put(Vault v, FilesystemEvent e) {
 		var key = computeKey(v, e);
 		hasUpdates.set(true);
 		map.compute(key, (k, val) -> {

+ 5 - 6
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java

@@ -34,15 +34,10 @@ public class FxFSEventList {
 				flush();
 			}
 		}, 1000, 1000, TimeUnit.MILLISECONDS);
-		//TODO: allow the task to be canceled (to enable ui actions, e.g. when the contextMenu is open, the list should not be updated
-	}
-
-	public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getObservableList() {
-		return events;
 	}
 
 	/**
-	 * Clones the aggregator into the observable list
+	 * Starts the clone task on the FX thread and wait till it is completed
 	 */
 	private void flush() {
 		var latch = new CountDownLatch(1);
@@ -58,6 +53,10 @@ public class FxFSEventList {
 		}
 	}
 
+	public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getObservableList() {
+		return events;
+	}
+
 	public BooleanProperty unreadEventsProperty() {
 		return unreadEvents;
 	}