mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-38466 (nullity check; annotations)
This commit is contained in:
@@ -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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.openapi.vfs;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Provides data for event which is fired when a virtual file is copied.
|
||||
@@ -26,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class VirtualFileCopyEvent extends VirtualFileEvent {
|
||||
private final VirtualFile myOriginalFile;
|
||||
|
||||
public VirtualFileCopyEvent(Object requestor, VirtualFile original, VirtualFile created){
|
||||
public VirtualFileCopyEvent(@Nullable Object requestor, @NotNull VirtualFile original, @NotNull VirtualFile created) {
|
||||
super(requestor, created, created.getName(), created.getParent());
|
||||
myOriginalFile = original;
|
||||
}
|
||||
|
||||
@@ -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,7 +34,7 @@ public class VirtualFileEvent extends EventObject {
|
||||
private long myOldModificationStamp;
|
||||
private long myNewModificationStamp;
|
||||
|
||||
public VirtualFileEvent(@Nullable Object requestor, @NotNull VirtualFile file, @NotNull String fileName, VirtualFile parent){
|
||||
public VirtualFileEvent(@Nullable Object requestor, @NotNull VirtualFile file, @NotNull String fileName, @Nullable VirtualFile parent) {
|
||||
super(file);
|
||||
myRequestor = requestor != null ? requestor : file.getUserData(VirtualFile.REQUESTOR_MARKER);
|
||||
myFile = file;
|
||||
@@ -42,7 +42,11 @@ public class VirtualFileEvent extends EventObject {
|
||||
myParent = parent;
|
||||
}
|
||||
|
||||
public VirtualFileEvent(@Nullable Object requestor, @NotNull VirtualFile file, VirtualFile parent, long oldModificationStamp, long newModificationStamp){
|
||||
public VirtualFileEvent(@Nullable Object requestor,
|
||||
@NotNull VirtualFile file,
|
||||
@Nullable VirtualFile parent,
|
||||
long oldModificationStamp,
|
||||
long newModificationStamp) {
|
||||
super(file);
|
||||
myFile = file;
|
||||
myFileName = file.getName();
|
||||
@@ -76,7 +80,7 @@ public class VirtualFileEvent extends EventObject {
|
||||
* Returns the parent of the virtual file.
|
||||
*
|
||||
* @return the parent, or null if the file is a root directory or it was not possible to determine the parent
|
||||
* (depends on the specific VFS implementation).
|
||||
* (depends on the specific VFS implementation).
|
||||
*/
|
||||
@Nullable
|
||||
public VirtualFile getParent() {
|
||||
@@ -100,7 +104,7 @@ public class VirtualFileEvent extends EventObject {
|
||||
* @return the modification stamp of the file before the event.
|
||||
* @see com.intellij.openapi.vfs.VirtualFile#getModificationStamp()
|
||||
*/
|
||||
public long getOldModificationStamp(){
|
||||
public long getOldModificationStamp() {
|
||||
return myOldModificationStamp;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vfs;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Provides data for event which is fired when a virtual file is moved.
|
||||
@@ -27,7 +28,10 @@ public class VirtualFileMoveEvent extends VirtualFileEvent {
|
||||
private final VirtualFile myOldParent;
|
||||
private final VirtualFile myNewParent;
|
||||
|
||||
public VirtualFileMoveEvent(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile oldParent, @NotNull VirtualFile newParent){
|
||||
public VirtualFileMoveEvent(@Nullable Object requestor,
|
||||
@NotNull VirtualFile file,
|
||||
@NotNull VirtualFile oldParent,
|
||||
@NotNull VirtualFile newParent) {
|
||||
super(requestor, file, file.getName(), file.getParent());
|
||||
myOldParent = oldParent;
|
||||
myNewParent = newParent;
|
||||
|
||||
+20
-20
@@ -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.
|
||||
@@ -27,10 +27,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public class BulkVirtualFileListenerAdapter implements BulkFileListener {
|
||||
private final VirtualFileListener myAdaptee;
|
||||
private final VirtualFileListener myAdapted;
|
||||
|
||||
public BulkVirtualFileListenerAdapter(final VirtualFileListener adaptee) {
|
||||
myAdaptee = adaptee;
|
||||
public BulkVirtualFileListenerAdapter(final VirtualFileListener adapted) {
|
||||
myAdapted = adapted;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,34 +51,35 @@ public class BulkVirtualFileListenerAdapter implements BulkFileListener {
|
||||
if (event instanceof VFileContentChangeEvent) {
|
||||
final VFileContentChangeEvent ce = (VFileContentChangeEvent)event;
|
||||
final VirtualFile file = ce.getFile();
|
||||
myAdaptee
|
||||
.contentsChanged(new VirtualFileEvent(event.getRequestor(), file, file.getParent(), ce.getOldModificationStamp(), ce.getModificationStamp()));
|
||||
myAdapted.contentsChanged(
|
||||
new VirtualFileEvent(event.getRequestor(), file, file.getParent(), ce.getOldModificationStamp(), ce.getModificationStamp()));
|
||||
}
|
||||
else if (event instanceof VFileCopyEvent) {
|
||||
final VFileCopyEvent ce = (VFileCopyEvent)event;
|
||||
myAdaptee
|
||||
.fileCopied(new VirtualFileCopyEvent(event.getRequestor(), ce.getFile(), ce.getNewParent().findChild(ce.getNewChildName())));
|
||||
final VirtualFile original = ce.getFile();
|
||||
final VirtualFile copy = ce.getNewParent().findChild(ce.getNewChildName());
|
||||
if (original != null && copy != null) {
|
||||
myAdapted.fileCopied(new VirtualFileCopyEvent(event.getRequestor(), original, copy));
|
||||
}
|
||||
}
|
||||
else if (event instanceof VFileCreateEvent) {
|
||||
final VFileCreateEvent ce = (VFileCreateEvent)event;
|
||||
final VirtualFile newChild = ce.getFile();
|
||||
if (newChild != null) {
|
||||
myAdaptee.fileCreated(
|
||||
new VirtualFileEvent(event.getRequestor(), newChild, ce.getChildName(), ce.getParent()));
|
||||
myAdapted.fileCreated(new VirtualFileEvent(event.getRequestor(), newChild, ce.getChildName(), ce.getParent()));
|
||||
}
|
||||
}
|
||||
else if (event instanceof VFileDeleteEvent) {
|
||||
final VFileDeleteEvent de = (VFileDeleteEvent)event;
|
||||
myAdaptee
|
||||
.fileDeleted(new VirtualFileEvent(event.getRequestor(), de.getFile(), de.getFile().getParent(), 0, 0));
|
||||
myAdapted.fileDeleted(new VirtualFileEvent(event.getRequestor(), de.getFile(), de.getFile().getParent(), 0, 0));
|
||||
}
|
||||
else if (event instanceof VFileMoveEvent) {
|
||||
final VFileMoveEvent me = (VFileMoveEvent)event;
|
||||
myAdaptee.fileMoved(new VirtualFileMoveEvent(event.getRequestor(), me.getFile(), me.getOldParent(), me.getNewParent()));
|
||||
myAdapted.fileMoved(new VirtualFileMoveEvent(event.getRequestor(), me.getFile(), me.getOldParent(), me.getNewParent()));
|
||||
}
|
||||
else if (event instanceof VFilePropertyChangeEvent) {
|
||||
final VFilePropertyChangeEvent pce = (VFilePropertyChangeEvent)event;
|
||||
myAdaptee.propertyChanged(
|
||||
myAdapted.propertyChanged(
|
||||
new VirtualFilePropertyEvent(event.getRequestor(), pce.getFile(), pce.getPropertyName(), pce.getOldValue(), pce.getNewValue()));
|
||||
}
|
||||
}
|
||||
@@ -87,21 +88,20 @@ public class BulkVirtualFileListenerAdapter implements BulkFileListener {
|
||||
if (event instanceof VFileContentChangeEvent) {
|
||||
final VFileContentChangeEvent ce = (VFileContentChangeEvent)event;
|
||||
final VirtualFile file = ce.getFile();
|
||||
myAdaptee
|
||||
.beforeContentsChange(new VirtualFileEvent(event.getRequestor(), file, file.getParent(), ce.getOldModificationStamp(), ce.getModificationStamp()));
|
||||
myAdapted.beforeContentsChange(
|
||||
new VirtualFileEvent(event.getRequestor(), file, file.getParent(), ce.getOldModificationStamp(), ce.getModificationStamp()));
|
||||
}
|
||||
else if (event instanceof VFileDeleteEvent) {
|
||||
final VFileDeleteEvent de = (VFileDeleteEvent)event;
|
||||
myAdaptee
|
||||
.beforeFileDeletion(new VirtualFileEvent(event.getRequestor(), de.getFile(), de.getFile().getParent(), 0, 0));
|
||||
myAdapted.beforeFileDeletion(new VirtualFileEvent(event.getRequestor(), de.getFile(), de.getFile().getParent(), 0, 0));
|
||||
}
|
||||
else if (event instanceof VFileMoveEvent) {
|
||||
final VFileMoveEvent me = (VFileMoveEvent)event;
|
||||
myAdaptee.beforeFileMovement(new VirtualFileMoveEvent(event.getRequestor(), me.getFile(), me.getOldParent(), me.getNewParent()));
|
||||
myAdapted.beforeFileMovement(new VirtualFileMoveEvent(event.getRequestor(), me.getFile(), me.getOldParent(), me.getNewParent()));
|
||||
}
|
||||
else if (event instanceof VFilePropertyChangeEvent) {
|
||||
final VFilePropertyChangeEvent pce = (VFilePropertyChangeEvent)event;
|
||||
myAdaptee.beforePropertyChange(
|
||||
myAdapted.beforePropertyChange(
|
||||
new VirtualFilePropertyEvent(event.getRequestor(), pce.getFile(), pce.getPropertyName(), pce.getOldValue(), pce.getNewValue()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user