mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Support "prompt" macro in parameters of run configurations
This commit is contained in:
+5
-3
@@ -60,7 +60,10 @@ public class ProgramParametersConfigurator {
|
||||
public static void addMacroSupport(@NotNull ExpandableTextField expandableTextField) {
|
||||
if (Registry.is("allow.macros.for.run.configurations")) {
|
||||
expandableTextField.addExtension(ExtendableTextComponent.Extension.create(AllIcons.General.Add, "Insert Macros", ()
|
||||
-> MacrosDialog.show(expandableTextField, macro -> !(macro instanceof PromptingMacro) && !(macro instanceof EditorMacro))));
|
||||
-> MacrosDialog.show(expandableTextField, macro -> {
|
||||
if (macro instanceof PromptMacro) return true;
|
||||
return !(macro instanceof PromptingMacro) && !(macro instanceof EditorMacro);
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +72,7 @@ public class ProgramParametersConfigurator {
|
||||
Collection<Macro> macros = MacroManager.getInstance().getMacros();
|
||||
for (Macro macro: macros) {
|
||||
String value = StringUtil.notNullize(
|
||||
macro instanceof PromptingMacro || macro instanceof EditorMacro
|
||||
? null :
|
||||
macro instanceof PromptMacro ? ((PromptMacro)macro).promptUser():
|
||||
macro.preview(), "");
|
||||
if (StringUtil.containsWhitespaces(value)) {
|
||||
value = "\"" + value + "\"";
|
||||
|
||||
@@ -35,6 +35,10 @@ public final class PromptMacro extends PromptingMacro implements SecondQueueExpa
|
||||
@Override
|
||||
@Nullable
|
||||
protected String promptUser(DataContext dataContext) {
|
||||
return promptUser();
|
||||
}
|
||||
|
||||
public String promptUser() {
|
||||
return Messages.showInputDialog(IdeBundle.message("prompt.enter.parameters"), IdeBundle.message("title.input"), Messages.getQuestionIcon());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user