forked from oracle/javavscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8690.diff
More file actions
41 lines (38 loc) · 2.12 KB
/
8690.diff
File metadata and controls
41 lines (38 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/actions/SingleJavaSourceRunActionProvider.java b/java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/actions/SingleJavaSourceRunActionProvider.java
index 05c9d1ff1ccd..c279d6d7b868 100644
--- a/java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/actions/SingleJavaSourceRunActionProvider.java
+++ b/java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/actions/SingleJavaSourceRunActionProvider.java
@@ -19,6 +19,7 @@
package org.netbeans.modules.java.file.launcher.actions;
import java.nio.charset.Charset;
+import java.util.Locale;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.Future;
@@ -55,6 +56,19 @@ public String[] getSupportedActions() {
};
}
+ private String getTaskName(String command, String fileName){
+ if(command == null || command.isEmpty()) return fileName;
+ String action = command.contains(".")
+ ? command.substring(0, command.indexOf('.'))
+ : command;
+ String capitalized = action.substring(0, 1).toUpperCase(Locale.ROOT)
+ + action.substring(1).toLowerCase(Locale.ROOT);
+ String baseName = fileName.contains(".")
+ ? fileName.substring(0, fileName.lastIndexOf('.'))
+ : fileName;
+ return String.format("%s (%s)", capitalized, baseName);
+ }
+
@NbBundle.Messages({
"CTL_SingleJavaFile=Running Single Java File"
})
@@ -91,7 +105,7 @@ public void invokeAction(String command, Lookup context) throws IllegalArgumentE
LaunchProcess process = invokeActionHelper(command, fileObject, params);
ExecutionService exeService = ExecutionService.newService(
process,
- descriptor, fileObject.getNameExt());
+ descriptor, this.getTaskName(command, fileObject.getNameExt()));
Future<Integer> future = exeService.run();
if (NbPreferences.forModule(JavaPlatformManager.class).getBoolean(SingleSourceFileUtil.GLOBAL_STOP_AND_RUN_OPTION, false)) {