fix some constant conditions concerning VirtualFile.getPresentableUrl

This commit is contained in:
peter
2013-12-18 17:32:20 +01:00
parent 935cfc5692
commit da559b806b
4 changed files with 3 additions and 19 deletions
@@ -87,12 +87,7 @@ class CacheUpdateRunner {
int percent = (int)(processed.size() * 100 / total);
indicator.setText("Indexing... " + percent + "%");
if (ApplicationManager.getApplication().isInternal()) {
if (virtualFile.isValid()) {
indicator.setText2(virtualFile.getPresentableUrl());
}
else {
indicator.setText2("");
}
indicator.setText2(virtualFile.getPresentableUrl());
}
}
}
@@ -100,12 +100,7 @@ public class DirectoryGroupingRule implements UsageGroupingRule {
@NotNull
public String getText(UsageView view) {
String relativePath = VfsUtilCore.getRelativePath(myDir, myProject.getBaseDir(), File.separatorChar);
if (relativePath != null) {
return relativePath;
}
String url = myDir.getPresentableUrl();
return url != null ? url : "<invalid>";
return relativePath != null ? relativePath : myDir.getPresentableUrl();
}
@Override
@@ -79,12 +79,6 @@ public class GitUtil {
if (o2 == null) {
return 1;
}
if (o1.getPresentableUrl() == null) {
return -1;
}
if (o2.getPresentableUrl() == null) {
return 1;
}
return o1.getPresentableUrl().compareTo(o2.getPresentableUrl());
}
};
@@ -155,7 +155,7 @@ public class GitUIUtil {
return new ListCellRendererWrapper<VirtualFile>() {
@Override
public void customize(final JList list, final VirtualFile file, final int index, final boolean selected, final boolean hasFocus) {
setText(file == null || !file.isValid() ? "(invalid)" : file.getPresentableUrl());
setText(file == null ? "(invalid)" : file.getPresentableUrl());
}
};
}