cleanup (default impl, simplify code)

This commit is contained in:
Vladimir Krivosheev
2017-05-04 16:25:14 +02:00
parent 7bfb25a3e8
commit 67c8554b94
4 changed files with 8 additions and 20 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -88,7 +88,9 @@ public interface Project extends ComponentManager, AreaInstance {
* @return presentable project path
*/
@Nullable
String getPresentableUrl();
default String getPresentableUrl() {
return null;
}
/**
* <p>Returns a workspace file:
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -80,13 +80,6 @@ public class MockProject extends MockComponentManager implements Project {
return "";
}
@Override
@Nullable
@NonNls
public String getPresentableUrl() {
return null;
}
@Override
@NotNull
@NonNls
@@ -33,7 +33,7 @@ import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFilePathWrapper
import com.intellij.util.PathUtil
import com.intellij.util.PathUtilRt
import com.intellij.util.io.exists
import java.nio.file.InvalidPathException
import java.nio.file.Path
@@ -143,8 +143,7 @@ private fun Project.getPresentableFileName(): String {
return name
}
val location = presentableUrl!!
val projectName = PathUtil.getFileName(FileUtilRt.toSystemIndependentName(location))
val projectName = FileUtilRt.toSystemIndependentName(PathUtilRt.getFileName(presentableUrl!!))
.toLowerCase(Locale.US)
.removeSuffix(ProjectFileType.DOT_DEFAULT_EXTENSION)
return FileUtil.sanitizeFileName(projectName, false)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -53,12 +53,6 @@ public class DummyProject extends UserDataHolderBase implements Project {
return "";
}
@Override
@Nullable
public String getPresentableUrl() {
return null;
}
@Override
@NotNull
public String getLocationHash() {