Search in sources :

Example 1 with AbstractInjectionPanel

use of org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel in project intellij-community by JetBrains.

the class JavaLanguageInjectionSupport method showInjectionUI.

private static BaseInjection showInjectionUI(final Project project, final MethodParameterInjection methodParameterInjection) {
    final AbstractInjectionPanel panel = new MethodParameterPanel(methodParameterInjection, project);
    panel.reset();
    final DialogBuilder builder = new DialogBuilder(project);
    builder.setHelpId("reference.settings.injection.language.injection.settings.java.parameter");
    builder.addOkAction();
    builder.addCancelAction();
    builder.setCenterPanel(panel.getComponent());
    builder.setTitle(EditInjectionSettingsAction.EDIT_INJECTION_TITLE);
    builder.setOkOperation(() -> {
        panel.apply();
        builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
    });
    if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
        return new BaseInjection(methodParameterInjection.getSupportId()).copyFrom(methodParameterInjection);
    }
    return null;
}
Also used : MethodParameterPanel(org.intellij.plugins.intelliLang.inject.config.ui.MethodParameterPanel) AbstractInjectionPanel(org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) BaseInjection(org.intellij.plugins.intelliLang.inject.config.BaseInjection)

Example 2 with AbstractInjectionPanel

use of org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel in project intellij-community by JetBrains.

the class XmlLanguageInjectionSupport method showInjectionUI.

@Nullable
private static BaseInjection showInjectionUI(final Project project, final BaseInjection xmlInjection) {
    final DialogBuilder builder = new DialogBuilder(project);
    final AbstractInjectionPanel panel;
    if (xmlInjection instanceof XmlTagInjection) {
        panel = new XmlTagPanel((XmlTagInjection) xmlInjection, project);
        builder.setHelpId("reference.settings.injection.language.injection.settings.xml.tag");
    } else if (xmlInjection instanceof XmlAttributeInjection) {
        panel = new XmlAttributePanel((XmlAttributeInjection) xmlInjection, project);
        builder.setHelpId("reference.settings.injection.language.injection.settings.xml.attribute");
    } else
        throw new AssertionError();
    panel.reset();
    builder.addOkAction();
    builder.addCancelAction();
    builder.setCenterPanel(panel.getComponent());
    builder.setTitle(EditInjectionSettingsAction.EDIT_INJECTION_TITLE);
    builder.setOkOperation(() -> {
        panel.apply();
        builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
    });
    if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
        return xmlInjection.copy();
    }
    return null;
}
Also used : AbstractInjectionPanel(org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel) XmlTagPanel(org.intellij.plugins.intelliLang.inject.config.ui.XmlTagPanel) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) XmlAttributePanel(org.intellij.plugins.intelliLang.inject.config.ui.XmlAttributePanel) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DialogBuilder (com.intellij.openapi.ui.DialogBuilder)2 AbstractInjectionPanel (org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel)2 BaseInjection (org.intellij.plugins.intelliLang.inject.config.BaseInjection)1 MethodParameterPanel (org.intellij.plugins.intelliLang.inject.config.ui.MethodParameterPanel)1 XmlAttributePanel (org.intellij.plugins.intelliLang.inject.config.ui.XmlAttributePanel)1 XmlTagPanel (org.intellij.plugins.intelliLang.inject.config.ui.XmlTagPanel)1 Nullable (org.jetbrains.annotations.Nullable)1