Search in sources :

Example 1 with XmlAttributePanel

use of org.intellij.plugins.intelliLang.inject.config.ui.XmlAttributePanel 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)1 AbstractInjectionPanel (org.intellij.plugins.intelliLang.inject.config.ui.AbstractInjectionPanel)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