001    /*
002     * Copyright 2010-2015 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.kotlin.idea;
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 String EXTENSION = "kt";
028        public static final JetFileType INSTANCE = new JetFileType();
029    
030        private final NotNullLazyValue<Icon> myIcon = new NotNullLazyValue<Icon>() {
031            @NotNull
032            @Override
033            protected Icon compute() {
034                return IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.png");
035            }
036        };
037    
038        private JetFileType() {
039            super(JetLanguage.INSTANCE);
040        }
041    
042        @Override
043        @NotNull
044        public String getName() {
045            return JetLanguage.NAME;
046        }
047    
048        @Override
049        @NotNull
050        public String getDescription() {
051            return getName();
052        }
053    
054        @Override
055        @NotNull
056        public String getDefaultExtension() {
057            return EXTENSION;
058        }
059    
060        @Override
061        public Icon getIcon() {
062            return myIcon.getValue();
063        }
064    
065        @Override
066        public boolean isJVMDebuggingSupported() {
067            return true;
068        }
069    }