ConfigurablesModifiedTest fixed
[fedora-idea.git] / platform / lang-api / src / com / intellij / psi / LanguageSubstitutors.java
blobba5fcdab556218699c49a43b952a63a2585b9dfa
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.psi;
18 import com.intellij.lang.Language;
19 import com.intellij.lang.LanguageExtension;
20 import com.intellij.openapi.project.Project;
21 import com.intellij.openapi.vfs.VirtualFile;
22 import org.jetbrains.annotations.NotNull;
24 /**
25 * @author peter
27 public final class LanguageSubstitutors extends LanguageExtension<LanguageSubstitutor> {
28 public static final LanguageSubstitutors INSTANCE = new LanguageSubstitutors();
30 private LanguageSubstitutors() {
31 super("com.intellij.lang.substitutor");
34 @NotNull
35 public Language substituteLanguage(@NotNull Language lang, @NotNull VirtualFile file, @NotNull Project project) {
36 for (final LanguageSubstitutor substitutor : forKey(lang)) {
37 final Language language = substitutor.getLanguage(file, project);
38 if (language != null) return language;
40 return lang;