mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VCS keeps asking me to associate unknown file type
This commit is contained in:
@@ -214,6 +214,9 @@ public class FilePathImpl implements FilePath {
|
|||||||
if (myVirtualFile != null && !myVirtualFile.isValid()) {
|
if (myVirtualFile != null && !myVirtualFile.isValid()) {
|
||||||
myVirtualFile = null;
|
myVirtualFile = null;
|
||||||
}
|
}
|
||||||
|
if (myVirtualFile == null) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
detectFileType();
|
detectFileType();
|
||||||
return myVirtualFile;
|
return myVirtualFile;
|
||||||
}
|
}
|
||||||
@@ -251,10 +254,11 @@ public class FilePathImpl implements FilePath {
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Document getDocument() {
|
public Document getDocument() {
|
||||||
if (myVirtualFile == null || myVirtualFile.getFileType().isBinary()) {
|
VirtualFile virtualFile = getVirtualFile();
|
||||||
|
if (virtualFile == null || virtualFile.getFileType().isBinary()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return FileDocumentManager.getInstance().getDocument(myVirtualFile);
|
return FileDocumentManager.getInstance().getDocument(virtualFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -290,7 +294,8 @@ public class FilePathImpl implements FilePath {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileType getFileType() {
|
public FileType getFileType() {
|
||||||
return myVirtualFile != null ? myVirtualFile.getFileType() : FileTypeManager.getInstance().getFileTypeByFileName(myFile.getName());
|
VirtualFile virtualFile = getVirtualFile();
|
||||||
|
return virtualFile != null ? virtualFile.getFileType() : FileTypeManager.getInstance().getFileTypeByFileName(myFile.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FilePathImpl create(VirtualFile file) {
|
public static FilePathImpl create(VirtualFile file) {
|
||||||
|
|||||||
+3
-2
@@ -75,8 +75,9 @@ public class ConflictedDiffRequestPresentable implements DiffRequestPresentable
|
|||||||
return new MyResult(request, DiffPresentationReturnValue.useRequest);
|
return new MyResult(request, DiffPresentationReturnValue.useRequest);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (myFile.getFileType().isBinary()) {
|
FilePathImpl filePath = new FilePathImpl(myFile);
|
||||||
final boolean nowItIsText = ChangeDiffRequestPresentable.checkAssociate(myProject, new FilePathImpl(myFile), context);
|
if (filePath.getFileType().isBinary()) {
|
||||||
|
final boolean nowItIsText = ChangeDiffRequestPresentable.checkAssociate(myProject, filePath, context);
|
||||||
if (! nowItIsText) {
|
if (! nowItIsText) {
|
||||||
return createErrorResult();
|
return createErrorResult();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -44,8 +44,9 @@ public class MergedDiffRequestPresentable implements DiffRequestPresentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MyResult step(DiffChainContext context) {
|
public MyResult step(DiffChainContext context) {
|
||||||
if (myFile.getFileType().isBinary()) {
|
FilePathImpl filePath = new FilePathImpl(myFile);
|
||||||
final boolean nowItIsText = ChangeDiffRequestPresentable.checkAssociate(myProject, new FilePathImpl(myFile), context);
|
if (filePath.getFileType().isBinary()) {
|
||||||
|
final boolean nowItIsText = ChangeDiffRequestPresentable.checkAssociate(myProject, filePath, context);
|
||||||
if (! nowItIsText) {
|
if (! nowItIsText) {
|
||||||
final SimpleDiffRequest request = new SimpleDiffRequest(myProject, null);
|
final SimpleDiffRequest request = new SimpleDiffRequest(myProject, null);
|
||||||
return new MyResult(request, DiffPresentationReturnValue.removeFromList);
|
return new MyResult(request, DiffPresentationReturnValue.removeFromList);
|
||||||
|
|||||||
Reference in New Issue
Block a user