Search in sources :

Example 1 with TemplateSettings

use of com.intellij.codeInsight.template.impl.TemplateSettings in project intellij-community by JetBrains.

the class CodeInsightTestUtil method addTemplate.

public static void addTemplate(final Template template, Disposable parentDisposable) {
    final TemplateSettings settings = TemplateSettings.getInstance();
    settings.addTemplate(template);
    Disposer.register(parentDisposable, new Disposable() {

        @Override
        public void dispose() {
            settings.removeTemplate(template);
        }
    });
}
Also used : TemplateSettings(com.intellij.codeInsight.template.impl.TemplateSettings) Disposable(com.intellij.openapi.Disposable)

Example 2 with TemplateSettings

use of com.intellij.codeInsight.template.impl.TemplateSettings in project intellij-community by JetBrains.

the class CustomTemplateCallback method getMatchingTemplates.

@NotNull
private static List<TemplateImpl> getMatchingTemplates(@NotNull String templateKey) {
    TemplateSettings settings = TemplateSettings.getInstance();
    List<TemplateImpl> candidates = new ArrayList<>();
    for (TemplateImpl template : settings.getTemplates(templateKey)) {
        if (!template.isDeactivated()) {
            candidates.add(template);
        }
    }
    return candidates;
}
Also used : TemplateSettings(com.intellij.codeInsight.template.impl.TemplateSettings) TemplateImpl(com.intellij.codeInsight.template.impl.TemplateImpl) ArrayList(java.util.ArrayList) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TemplateSettings (com.intellij.codeInsight.template.impl.TemplateSettings)2 TemplateImpl (com.intellij.codeInsight.template.impl.TemplateImpl)1 Disposable (com.intellij.openapi.Disposable)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1