ArchiveFileType -> core-api

This commit is contained in:
Dmitry Jemerov
2012-05-11 15:58:55 +02:00
parent bbbacefa0f
commit aaf664ed3e
3 changed files with 18 additions and 7 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -18,13 +18,22 @@ package com.intellij.ide.highlighter;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class ArchiveFileType implements FileType {
private static final Icon ICON = IconLoader.getIcon("/fileTypes/archive.png");
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
@NotNull
@Override
protected Icon compute() {
return IconLoader.getIcon("/fileTypes/archive.png");
}
};
public static final ArchiveFileType INSTANCE = new ArchiveFileType();
@NotNull
public String getName() {
@@ -42,7 +51,7 @@ public class ArchiveFileType implements FileType {
}
public Icon getIcon() {
return ICON;
return ICON.getValue();
}
public boolean isBinary() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -15,13 +15,15 @@
*/
package com.intellij.openapi.fileTypes;
import com.intellij.ide.highlighter.ArchiveFileType;
/**
* @author max
*/
public class FileTypes {
protected FileTypes() { }
public static final FileType ARCHIVE = FileTypeManager.getInstance().getStdFileType("ARCHIVE");
public static final FileType ARCHIVE = ArchiveFileType.INSTANCE;
public static final FileType UNKNOWN = UnknownFileType.INSTANCE;
public static final LanguageFileType PLAIN_TEXT = (LanguageFileType)FileTypeManager.getInstance().getStdFileType("PLAIN_TEXT");
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
*/
public class PlatformFileTypeFactory extends FileTypeFactory {
public void createFileTypes(@NotNull final FileTypeConsumer consumer) {
consumer.consume(new ArchiveFileType(), "zip;jar;war;ear;swc;ane;egg;apk");
consumer.consume(ArchiveFileType.INSTANCE, "zip;jar;war;ear;swc;ane;egg;apk");
consumer.consume(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess");
consumer.consume(NativeFileType.INSTANCE, "doc;xls;ppt;mdb;vsd;pdf;hlp;chm;odt");
consumer.consume(UnknownFileType.INSTANCE);