use of com.intellij.ide.highlighter.ArchiveFileType in project intellij-community by JetBrains.
the class DiffContentFactoryImpl method createBinaryImpl.
@NotNull
private static DiffContent createBinaryImpl(@Nullable Project project, @NotNull byte[] content, @NotNull FileType type, @NotNull String fileName, @Nullable VirtualFile highlightFile) throws IOException {
// workaround - our JarFileSystem and decompilers can't process non-local files
boolean useTemporalFile = type instanceof ArchiveFileType || BinaryFileTypeDecompilers.INSTANCE.forFileType(type) != null;
VirtualFile file;
if (useTemporalFile) {
file = createTemporalFile(project, "tmp", fileName, content);
} else {
file = new BinaryLightVirtualFile(fileName, type, content);
file.setWritable(false);
}
return new FileContentImpl(project, file, highlightFile);
}
use of com.intellij.ide.highlighter.ArchiveFileType in project intellij-community by JetBrains.
the class CompositeDiffTool method chooseTool.
@Nullable
private DiffTool chooseTool(DiffRequest data) {
final DiffContent[] contents = data.getContents();
if (contents.length == 2) {
final FileType type1 = contents[0].getContentType();
final FileType type2 = contents[1].getContentType();
if (type1 == type2 && type1 instanceof UIBasedFileType) {
return BinaryDiffTool.INSTANCE;
}
//todo[kb] register or not this instance in common diff tools ?
if (type1 == type2 && type1 instanceof ArchiveFileType) {
return ArchiveDiffTool.INSTANCE;
}
}
for (DiffTool tool : myTools) {
if (tool.canShow(data))
return tool;
}
return null;
}
use of com.intellij.ide.highlighter.ArchiveFileType in project intellij-community by JetBrains.
the class ArchiveDiffTool method canShow.
@Override
public boolean canShow(DiffRequest request) {
final DiffContent[] contents = request.getContents();
final DialogWrapper instance = DialogWrapper.findInstance(IdeFocusManager.getInstance(request.getProject()).getFocusOwner());
if (instance != null && instance.isModal())
return false;
if (contents.length == 2) {
final VirtualFile file1 = contents[0].getFile();
final VirtualFile file2 = contents[1].getFile();
if (file1 != null && file2 != null) {
final FileType type1 = contents[0].getContentType();
final FileType type2 = contents[1].getContentType();
return type1 == type2 && type1 instanceof ArchiveFileType;
}
}
return false;
}
use of com.intellij.ide.highlighter.ArchiveFileType in project intellij-community by JetBrains.
the class CompareFiles method getDiffRequest.
@Nullable
private static DiffRequest getDiffRequest(Project project, VirtualFile[] files) {
if (files == null || files.length != 2)
return null;
if (files[0].isDirectory() || files[1].isDirectory() || files[0].getFileType() instanceof ArchiveFileType || files[1].getFileType() instanceof ArchiveFileType) {
return null;
}
String title = DiffBundle.message("diff.element.qualified.name.vs.element.qualified.name.dialog.title", getVirtualFileContentTitle(files[0]), getVirtualFileContentTitle(files[1]));
SimpleDiffRequest diffRequest = DiffContentFactory.compareVirtualFiles(project, files[0], files[1], title);
if (diffRequest == null)
return null;
diffRequest.setContentTitles(getVirtualFileContentTitle(files[0]), getVirtualFileContentTitle(files[1]));
return diffRequest;
}
use of com.intellij.ide.highlighter.ArchiveFileType in project android by JetBrains.
the class AndroidSdkUtils method checkSdkRoots.
public static boolean checkSdkRoots(@NotNull Sdk sdk, @NotNull IAndroidTarget target, boolean forMaven) {
String homePath = sdk.getHomePath();
if (homePath == null) {
return false;
}
AndroidSdks androidSdks = AndroidSdks.getInstance();
AndroidSdkAdditionalData sdkAdditionalData = androidSdks.getAndroidSdkAdditionalData(sdk);
Sdk javaSdk = sdkAdditionalData != null ? sdkAdditionalData.getJavaSdk() : null;
if (javaSdk == null) {
return false;
}
Set<VirtualFile> filesInSdk = Sets.newHashSet(sdk.getRootProvider().getFiles(CLASSES));
List<VirtualFile> platformAndAddOnJars = androidSdks.getPlatformAndAddOnJars(target);
for (VirtualFile file : platformAndAddOnJars) {
if (filesInSdk.contains(file) == forMaven) {
return false;
}
}
boolean containsJarFromJdk = false;
for (VirtualFile file : javaSdk.getRootProvider().getFiles(CLASSES)) {
if (file.getFileType() instanceof ArchiveFileType && filesInSdk.contains(file)) {
containsJarFromJdk = true;
}
}
return containsJarFromJdk == forMaven;
}
Aggregations