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;
}
Aggregations