mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Adapter
This commit is contained in:
@@ -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<? extends VFileEvent> events) {
|
||||
}
|
||||
|
||||
conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
if (shouldTriggerMake(events)) {
|
||||
|
||||
@@ -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<? extends VFileEvent> events) { }
|
||||
@Override public void after(@NotNull List<? extends VFileEvent> events) { }
|
||||
}
|
||||
|
||||
void before(@NotNull List<? extends VFileEvent> events);
|
||||
void after(@NotNull List<? extends VFileEvent> events);
|
||||
}
|
||||
+1
-5
@@ -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<? extends VFileEvent> events) {
|
||||
}
|
||||
|
||||
myBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull final List<? extends VFileEvent> events) {
|
||||
boolean changesDetected = false;
|
||||
|
||||
@@ -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<? extends VFileEvent> events) {
|
||||
for (VFileEvent event : events) {
|
||||
@@ -230,10 +230,6 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
}
|
||||
});
|
||||
|
||||
connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
|
||||
|
||||
@@ -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<? extends VFileEvent> events) {
|
||||
}
|
||||
|
||||
messageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
for (VFileEvent event : events) {
|
||||
|
||||
@@ -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<? extends VFileEvent> events) {
|
||||
}
|
||||
|
||||
bus.connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull final List<? extends VFileEvent> events) {
|
||||
final List<VirtualFile> rootsToRefresh = new ArrayList<VirtualFile>();
|
||||
@@ -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);
|
||||
|
||||
@@ -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<? extends VFileEvent> events) {
|
||||
}
|
||||
|
||||
myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
myEvents.addAll(events);
|
||||
|
||||
@@ -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<IgnoredFileBean>();
|
||||
|
||||
if (registerListener) {
|
||||
project.getMessageBus().connect(project).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
|
||||
@Override
|
||||
public void before(@NotNull List<? extends VFileEvent> events) {}
|
||||
|
||||
project.getMessageBus().connect(project).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
resetCaches();
|
||||
|
||||
Reference in New Issue
Block a user