mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs] Deprecate VcsContextFactory.create FilePath with directory detector
Detector is called right away, so there is no point in it. Just inline the call & deprecate the method.
This commit is contained in:
@@ -74,7 +74,10 @@ public interface VcsContextFactory {
|
||||
* @param file the file for which the FilePath should be created.
|
||||
* @param detector - called to get to know whether the file is directory, if local file is not found
|
||||
* @return the FilePath instance.
|
||||
*
|
||||
* @deprecated to remove in IDEA 16. Check the virtual file right away and pass to the right constructor.
|
||||
*/
|
||||
@Deprecated
|
||||
FilePath createFilePathOn(final File file, final NotNullFunction<File, Boolean> detector);
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,10 +54,9 @@ public class VcsContextFactoryImpl implements VcsContextFactory {
|
||||
public FilePath createFilePathOn(final File file, final NotNullFunction<File, Boolean> detector) {
|
||||
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
|
||||
if (virtualFile != null) {
|
||||
// detector information (loaded here lazily) is not needed - we have real file
|
||||
return FilePathImpl.create(file);
|
||||
return createFilePathOn(virtualFile);
|
||||
}
|
||||
return FilePathImpl.create(file, detector.fun(file).booleanValue());
|
||||
return createFilePathOn(file, detector.fun(file).booleanValue());
|
||||
}
|
||||
|
||||
public FilePath createFilePathOn(final File file, final boolean isDirectory) {
|
||||
|
||||
@@ -18,8 +18,10 @@ package org.jetbrains.idea.svn.history;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.RepositoryLocation;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.actions.VcsContextFactory;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.svn.RootUrlInfo;
|
||||
import org.jetbrains.idea.svn.SvnUtil;
|
||||
@@ -84,8 +86,8 @@ public class SvnRepositoryLocation implements RepositoryLocation {
|
||||
if (rootForUrl != null) {
|
||||
String relativePath = SvnUtil.getRelativeUrl(rootForUrl.getUrl(), fullPath);
|
||||
File file = new File(rootForUrl.getPath(), relativePath);
|
||||
|
||||
result = VcsContextFactory.SERVICE.getInstance().createFilePathOn(file, detector);
|
||||
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
|
||||
result = virtualFile != null ? VcsUtil.getFilePath(virtualFile) : VcsUtil.getFilePath(file, detector.fun(file).booleanValue());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user