use of com.intellij.openapi.fileTypes.FileType in project intellij-community by JetBrains.
the class CorruptedProjectFilesDialog method showNextFileInfo.
private void showNextFileInfo() {
VirtualFile currentVirtualFile = getCurrentVirtualFile();
FileType fileType = currentVirtualFile.getFileType();
myMessageLabel.setText(com.intellij.CvsBundle.message("label.project.files.cannot.be.merged.without.conflict", fileType.getDescription(), currentVirtualFile.getPresentableUrl()));
setTitle(com.intellij.CvsBundle.message("dialog.title.file.cannot.be.merged.without.conflicts", fileType.getDescription(), currentVirtualFile.getName()));
}
use of com.intellij.openapi.fileTypes.FileType in project intellij-community by JetBrains.
the class VirtualFilePresentation method getIconImpl.
public static Icon getIconImpl(@NotNull VirtualFile vFile) {
Icon icon = TypePresentationService.getService().getIcon(vFile);
if (icon != null) {
return icon;
}
FileType fileType = vFile.getFileType();
if (vFile.isDirectory() && vFile.isInLocalFileSystem() && !(fileType instanceof DirectoryFileType)) {
return PlatformIcons.FOLDER_ICON;
}
return fileType.getIcon();
}
use of com.intellij.openapi.fileTypes.FileType in project intellij-community by JetBrains.
the class LightVirtualFile method setLanguage.
public void setLanguage(@NotNull Language language) {
myLanguage = language;
FileType type = language.getAssociatedFileType();
if (type == null) {
type = FileTypeRegistry.getInstance().getFileTypeByFileName(getName());
}
setFileType(type);
}
use of com.intellij.openapi.fileTypes.FileType in project intellij-community by JetBrains.
the class UnknownFileTypeDiffRequest method getComponent.
@NotNull
@Override
public JComponent getComponent(@NotNull final DiffContext context) {
final SimpleColoredComponent label = new SimpleColoredComponent();
label.setTextAlign(SwingConstants.CENTER);
label.append("Can't show diff for unknown file type. ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
if (myFileName != null) {
label.append("Associate", SimpleTextAttributes.LINK_ATTRIBUTES, new Runnable() {
@Override
public void run() {
FileType type = FileTypeChooser.associateFileType(myFileName);
if (type != null)
onSuccess(context);
}
});
LinkMouseListenerBase.installSingleTagOn(label);
}
return new DiffUtil.CenteredPanel(label, JBUI.Borders.empty(5));
}
use of com.intellij.openapi.fileTypes.FileType in project intellij-community by JetBrains.
the class LangDiffIgnoredRangeProvider method getLanguage.
@Nullable
private static Language getLanguage(@NotNull Project project, @NotNull DiffContent content) {
Language language = content.getUserData(DiffUserDataKeys.LANGUAGE);
if (language != null)
return language;
FileType type = content.getContentType();
if (type instanceof LanguageFileType)
language = ((LanguageFileType) type).getLanguage();
if (language != null && content instanceof DocumentContent) {
VirtualFile highlightFile = ((DocumentContent) content).getHighlightFile();
if (highlightFile != null)
language = LanguageSubstitutors.INSTANCE.substituteLanguage(language, highlightFile, project);
}
return language;
}
Aggregations