improve file observer mechanism to work with multiple files

This commit is contained in:
Martin Lippert
2020-01-31 09:42:41 +01:00
parent 6413bcb7cc
commit 4d6de9f41c
9 changed files with 200 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -54,8 +54,8 @@ public abstract class AbstractFileToProjectCache<P extends IJavaProject> extends
protected void attachListeners(File file, P project) {
super.attachListeners(file, project);
List<String> globPattern = Arrays.asList(file.toString().replace(File.separator, "/"));
subscriptions.add(getFileObserver().onFileChanged(globPattern, (uri) -> performUpdate(project, asyncUpdate, true)));
subscriptions.add(getFileObserver().onFileDeleted(globPattern, (uri) -> {
subscriptions.add(getFileObserver().onFilesChanged(globPattern, (uris) -> performUpdate(project, asyncUpdate, true)));
subscriptions.add(getFileObserver().onFilesDeleted(globPattern, (uris) -> {
cache.invalidate(file);
notifyProjectDeleted(project);
dispose();