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 org
.intellij
.plugins
.intelliLang
.inject
;
18 import com
.intellij
.lang
.Language
;
19 import com
.intellij
.openapi
.actionSystem
.AnAction
;
20 import com
.intellij
.openapi
.extensions
.ExtensionPointName
;
21 import com
.intellij
.openapi
.options
.Configurable
;
22 import com
.intellij
.openapi
.project
.Project
;
23 import com
.intellij
.openapi
.util
.Factory
;
24 import com
.intellij
.openapi
.util
.Key
;
25 import com
.intellij
.psi
.PsiElement
;
26 import com
.intellij
.psi
.PsiLanguageInjectionHost
;
27 import com
.intellij
.ui
.SimpleColoredText
;
28 import com
.intellij
.util
.Consumer
;
29 import org
.intellij
.plugins
.intelliLang
.Configuration
;
30 import org
.intellij
.plugins
.intelliLang
.inject
.config
.BaseInjection
;
31 import org
.jdom
.Element
;
32 import org
.jetbrains
.annotations
.NonNls
;
33 import org
.jetbrains
.annotations
.NotNull
;
36 * @author Gregory.Shrago
38 public interface LanguageInjectionSupport
{
39 ExtensionPointName
<LanguageInjectionSupport
> EP_NAME
= ExtensionPointName
.create("org.intellij.intelliLang.languageSupport");
41 Key
<Boolean
> HAS_UNPARSABLE_FRAGMENTS
= Key
.create("HAS_UNPARSABLE_FRAGMENTS");
43 @NonNls String XML_SUPPORT_ID
= "xml";
44 @NonNls String JAVA_SUPPORT_ID
= "java";
51 Class
[] getPatternClasses();
53 boolean useDefaultInjector(final PsiElement host
);
55 boolean addInjectionInPlace(final Language language
, final PsiLanguageInjectionHost psiElement
);
57 boolean removeInjectionInPlace(final PsiLanguageInjectionHost psiElement
);
59 boolean editInjectionInPlace(final PsiLanguageInjectionHost psiElement
);
61 BaseInjection
createInjection(final Element element
);
63 void setupPresentation(final BaseInjection injection
, final SimpleColoredText presentation
, final boolean isSelected
);
65 Configurable
[] createSettings(final Project project
, final Configuration configuration
);
67 AnAction
[] createAddActions(final Project project
, final Consumer
<BaseInjection
> consumer
);
69 AnAction
createEditAction(final Project project
, final Factory
<BaseInjection
> producer
);