This commit is contained in:
Alexey Kudravtsev
2010-06-30 14:14:30 +04:00
parent 0c47e8b158
commit bcb4dcc6f5
3 changed files with 20 additions and 16 deletions
@@ -30,20 +30,21 @@ import org.jetbrains.annotations.NotNull;
public interface ProjectRootContainer {
@NotNull
VirtualFile[] getRootFiles(OrderRootType type);
ProjectRoot[] getRoots(OrderRootType type);
VirtualFile[] getRootFiles(@NotNull OrderRootType type);
@NotNull ProjectRoot[] getRoots(@NotNull OrderRootType type);
void startChange();
void finishChange();
ProjectRoot addRoot(VirtualFile virtualFile, OrderRootType type);
void addRoot(ProjectRoot root, OrderRootType type);
void removeRoot(ProjectRoot root, OrderRootType type);
void removeAllRoots(OrderRootType type);
@NotNull
ProjectRoot addRoot(@NotNull VirtualFile virtualFile, @NotNull OrderRootType type);
void addRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type);
void removeRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type);
void removeAllRoots(@NotNull OrderRootType type);
void removeAllRoots();
void removeRoot(VirtualFile root, OrderRootType type);
void removeRoot(@NotNull VirtualFile root, @NotNull OrderRootType type);
void update();
}
@@ -62,11 +62,12 @@ public class ProjectRootContainerImpl implements JDOMExternalizable, ProjectRoot
}
@NotNull
public VirtualFile[] getRootFiles(OrderRootType type) {
public VirtualFile[] getRootFiles(@NotNull OrderRootType type) {
return myFiles.get(type);
}
public ProjectRoot[] getRoots(OrderRootType type) {
@NotNull
public ProjectRoot[] getRoots(@NotNull OrderRootType type) {
return myRoots.get(type).getProjectRoots();
}
@@ -116,27 +117,28 @@ public class ProjectRootContainerImpl implements JDOMExternalizable, ProjectRoot
}
public void removeRoot(ProjectRoot root, OrderRootType type) {
public void removeRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type) {
LOG.assertTrue(myInsideChange);
myRoots.get(type).remove(root);
}
public ProjectRoot addRoot(VirtualFile virtualFile, OrderRootType type) {
@NotNull
public ProjectRoot addRoot(@NotNull VirtualFile virtualFile, @NotNull OrderRootType type) {
LOG.assertTrue(myInsideChange);
return myRoots.get(type).add(virtualFile);
}
public void addRoot(ProjectRoot root, OrderRootType type) {
public void addRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type) {
LOG.assertTrue(myInsideChange);
myRoots.get(type).add(root);
}
public void removeAllRoots(OrderRootType type ) {
public void removeAllRoots(@NotNull OrderRootType type ) {
LOG.assertTrue(myInsideChange);
myRoots.get(type).clear();
}
public void removeRoot(VirtualFile root, OrderRootType type) {
public void removeRoot(@NotNull VirtualFile root, @NotNull OrderRootType type) {
LOG.assertTrue(myInsideChange);
myRoots.get(type).remove(root);
}
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.ex.http.HttpFileSystem;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -39,12 +40,12 @@ public class SimpleProjectRoot implements ProjectRoot, JDOMExternalizable {
private boolean myInitialized = false;
@NonNls private static final String ATTRIBUTE_URL = "url";
SimpleProjectRoot(VirtualFile file) {
SimpleProjectRoot(@NotNull VirtualFile file) {
myFile = file;
myUrl = myFile.getUrl();
}
public SimpleProjectRoot(String url) {
public SimpleProjectRoot(@NotNull String url) {
myUrl = url;
}