mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -17,16 +17,20 @@
|
||||
package com.intellij.openapi.projectRoots.ex;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author mike
|
||||
*/
|
||||
public interface ProjectRoot {
|
||||
boolean isValid();
|
||||
@NotNull
|
||||
VirtualFile[] getVirtualFiles();
|
||||
|
||||
@NotNull
|
||||
String[] getUrls();
|
||||
|
||||
@NotNull
|
||||
String getPresentableString();
|
||||
|
||||
void update();
|
||||
|
||||
+7
-4
@@ -41,10 +41,12 @@ class CompositeProjectRoot implements ProjectRoot {
|
||||
return myRoots.toArray(new ProjectRoot[myRoots.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPresentableString() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile[] getVirtualFiles() {
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
for (ProjectRoot root : myRoots) {
|
||||
@@ -54,6 +56,7 @@ class CompositeProjectRoot implements ProjectRoot {
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[] getUrls() {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
for (ProjectRoot root : myRoots) {
|
||||
@@ -66,22 +69,22 @@ class CompositeProjectRoot implements ProjectRoot {
|
||||
return true;
|
||||
}
|
||||
|
||||
void remove(ProjectRoot root) {
|
||||
void remove(@NotNull ProjectRoot root) {
|
||||
myRoots.remove(root);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
ProjectRoot add(VirtualFile virtualFile) {
|
||||
ProjectRoot add(@NotNull VirtualFile virtualFile) {
|
||||
final SimpleProjectRoot root = new SimpleProjectRoot(virtualFile);
|
||||
myRoots.add(root);
|
||||
return root;
|
||||
}
|
||||
|
||||
void add(ProjectRoot root) {
|
||||
void add(@NotNull ProjectRoot root) {
|
||||
myRoots.add(root);
|
||||
}
|
||||
|
||||
void remove(VirtualFile root) {
|
||||
void remove(@NotNull VirtualFile root) {
|
||||
for (Iterator<ProjectRoot> iterator = myRoots.iterator(); iterator.hasNext();) {
|
||||
ProjectRoot projectRoot = iterator.next();
|
||||
if (projectRoot instanceof SimpleProjectRoot) {
|
||||
|
||||
@@ -58,6 +58,7 @@ public class SimpleProjectRoot implements ProjectRoot, JDOMExternalizable {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPresentableString() {
|
||||
String path = VirtualFileManager.extractPath(myUrl);
|
||||
if (path.endsWith(JarFileSystem.JAR_SEPARATOR)) {
|
||||
@@ -66,6 +67,7 @@ public class SimpleProjectRoot implements ProjectRoot, JDOMExternalizable {
|
||||
return path.replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile[] getVirtualFiles() {
|
||||
if (!myInitialized) initialize();
|
||||
|
||||
@@ -77,6 +79,7 @@ public class SimpleProjectRoot implements ProjectRoot, JDOMExternalizable {
|
||||
return myFileArray;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[] getUrls() {
|
||||
return new String[]{myUrl};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user