diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 50e6b0d3004e..26c0751abdae 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -146,11 +146,7 @@ public class BuildManager implements ApplicationComponent{ projectManager.addProjectManagerListener(new ProjectWatcher()); final MessageBusConnection conn = ApplicationManager.getApplication().getMessageBus().connect(); - conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull List events) { - } - + conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull List events) { if (shouldTriggerMake(events)) { diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java index b0cd8b7b207e..90c521abab8e 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * @author max - */ package com.intellij.openapi.vfs.newvfs; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; @@ -24,7 +20,15 @@ import org.jetbrains.annotations.NotNull; import java.util.List; +/** + * @author max + */ public interface BulkFileListener { + class Adapter implements BulkFileListener { + @Override public void before(@NotNull List events) { } + @Override public void after(@NotNull List events) { } + } + void before(@NotNull List events); void after(@NotNull List events); } \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/JarDirectoryWatcherImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/JarDirectoryWatcherImpl.java index 638956e670ac..f685d88e76b2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/JarDirectoryWatcherImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/JarDirectoryWatcherImpl.java @@ -64,11 +64,7 @@ public class JarDirectoryWatcherImpl implements JarDirectoryWatcher { if (myBusConnection == null) { myBusConnection = ApplicationManager.getApplication().getMessageBus().connect(); - myBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull final List events) { - } - + myBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull final List events) { boolean changesDetected = false; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index 28e6070b8e93..119aed9a94b0 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -219,7 +219,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { } }); - connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { + connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void before(@NotNull List events) { for (VFileEvent event : events) { @@ -230,10 +230,6 @@ public class FileBasedIndexImpl extends FileBasedIndex { } } } - - @Override - public void after(@NotNull List events) { - } }); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { diff --git a/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java b/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java index bbebfc9f762c..8fff3f7e6c26 100644 --- a/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java +++ b/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.execution; import com.intellij.openapi.editor.Document; @@ -96,11 +111,7 @@ public class DelayedDocumentWatcher implements Runnable { } messageBusConnection = project.getMessageBus().connect(); - messageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull List events) { - } - + messageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull List events) { for (VFileEvent event : events) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java index 245f58007c14..b9f6a1f8e7d9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java @@ -55,11 +55,7 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo private String[] jarPathsCache; // jarPathsCache = myHandlers.keySet() public JarFileSystemImpl(MessageBus bus) { - bus.connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull final List events) { - } - + bus.connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull final List events) { final List rootsToRefresh = new ArrayList(); @@ -77,9 +73,8 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo } for (String jarPath : jarPaths) { - if (FileUtil.startsWith(jarPath.substring(0, jarPath.length() - JAR_SEPARATOR.length()), - path, - SystemInfo.isFileSystemCaseSensitive)) { + final String jarFile = jarPath.substring(0, jarPath.length() - JAR_SEPARATOR.length()); + if (FileUtil.startsWith(jarFile, path, SystemInfo.isFileSystemCaseSensitive)) { VirtualFile jarRootToRefresh = markDirty(jarPath); if (jarRootToRefresh != null) { rootsToRefresh.add(jarRootToRefresh); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java index 4b0baa463d97..dba16f98f306 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java @@ -94,11 +94,7 @@ public class FileWatcherTest extends PlatformLangTestCase { assertNotNull(myFileSystem); myConnection = ApplicationManager.getApplication().getMessageBus().connect(); - myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull List events) { - } - + myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull List events) { myEvents.addAll(events); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java index 8eadd98dbcf0..edd480152be2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,7 @@ public class IgnoredFilesComponent { myFilesToIgnore = new LinkedHashSet(); if (registerListener) { - project.getMessageBus().connect(project).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { - @Override - public void before(@NotNull List events) {} - + project.getMessageBus().connect(project).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() { @Override public void after(@NotNull List events) { resetCaches();