001 /*
002 * Copyright 2010-2013 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.jet.plugin;
018
019 import com.intellij.openapi.fileTypes.LanguageFileType;
020 import com.intellij.openapi.util.IconLoader;
021 import com.intellij.openapi.util.NotNullLazyValue;
022 import org.jetbrains.annotations.NotNull;
023
024 import javax.swing.*;
025
026 public class JetFileType extends LanguageFileType {
027 public static final JetFileType INSTANCE = new JetFileType();
028 private final NotNullLazyValue<Icon> myIcon = new NotNullLazyValue<Icon>() {
029 @NotNull
030 @Override
031 protected Icon compute() {
032 return IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/kotlin_file.png");
033 }
034 };
035
036 private JetFileType() {
037 super(JetLanguage.INSTANCE);
038 }
039
040 @Override
041 @NotNull
042 public String getName() {
043 return JetLanguage.NAME;
044 }
045
046 @Override
047 @NotNull
048 public String getDescription() {
049 return getName();
050 }
051
052 @Override
053 @NotNull
054 public String getDefaultExtension() {
055 return "kt";
056 }
057
058 @Override
059 public Icon getIcon() {
060 return myIcon.getValue();
061 }
062
063 @Override
064 public boolean isJVMDebuggingSupported() {
065 return true;
066 }
067 }