diff --git a/plugin/META-INF/MANIFEST.MF b/plugin/META-INF/MANIFEST.MF index ce1fc20..f017320 100644 --- a/plugin/META-INF/MANIFEST.MF +++ b/plugin/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.cdt.ui;resolution:=optional, org.eclipse.cdt.core;resolution:=optional, org.eclipse.ui.workbench.texteditor, - org.eclipse.jface.text + org.eclipse.jface.text, + org.eclipse.debug.ui Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-ClassPath: target/easyshell-library.jar diff --git a/plugin/plugin.xml b/plugin/plugin.xml index 4a06513..3169b14 100644 --- a/plugin/plugin.xml +++ b/plugin/plugin.xml @@ -235,5 +235,12 @@ name="EasyShell All (Multiple Action)"> + + + + diff --git a/plugin/src/de/anbos/eclipse/easyshell/plugin/misc/DynamicVariableSelector.java b/plugin/src/de/anbos/eclipse/easyshell/plugin/misc/DynamicVariableSelector.java new file mode 100644 index 0000000..bc160c8 --- /dev/null +++ b/plugin/src/de/anbos/eclipse/easyshell/plugin/misc/DynamicVariableSelector.java @@ -0,0 +1,28 @@ +package de.anbos.eclipse.easyshell.plugin.misc; + +import org.eclipse.core.variables.IStringVariable; +import org.eclipse.debug.ui.stringsubstitution.IArgumentSelector; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +import de.anbos.eclipse.easyshell.plugin.types.Variable; + +public class DynamicVariableSelector implements IArgumentSelector { + + @Override + public String selectArgument(IStringVariable stringVariable, Shell shell) { + ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider()); + var varNames = Variable.getVisibleVariables().stream().map(variable -> variable.getName()).sorted() + .toArray(String[]::new); + dialog.setElements(varNames); + dialog.setTitle("Select EasyShell Variable"); + dialog.setMessage("Select an EasyShell variable (? = any character, * = any String):"); + if (dialog.open() == Window.OK) { + return (String) dialog.getResult()[0]; + } + return null; + } + +}