Skip to content

Commit

Permalink
Added more keyword substitutions
Browse files Browse the repository at this point in the history
  • Loading branch information
maccasoft committed May 6, 2024
1 parent 09104df commit 25f7e0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ public void widgetSelected(SelectionEvent e) {
arguments.addFocusListener(textFocusListener);

label = new Label(composite, SWT.NONE);
label.setText("${file} insert the currently selected editor's file or pinned top file.");
label.setText("" +
"${file} insert the currently selected editor's file or pinned top file.\n" +
"${file.name} insert the currently selected editor's file or pinned top file name.\n" +
"${file.loc} insert the currently selected editor's file or pinned top file location.\n" +
"${serial} insert the selected serial port.");
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));

if (externalTool != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,11 @@ public void handleEvent(Event event) {
cmd.add(program);

if (arguments != null) {
String cmdline = arguments.replace("${file}", "\"" + editorTab.getFile().getAbsolutePath() + "\"");
String file = editorTab.getFile().getName();
String fileName = file.lastIndexOf('.') != -1 ? file.substring(0, file.lastIndexOf('.')) : file;
String fileLoc = editorTab.getFile().getParentFile().getAbsolutePath();

String cmdline = arguments.replace("${file}", file).replace("${file.name}", fileName).replace("${file.loc}", fileLoc).replace("${serial}", serialPortList.getSelection());

String[] args = Utils.splitArguments(cmdline);
cmd.addAll(Arrays.asList(args));
Expand Down

0 comments on commit 25f7e0a

Please sign in to comment.