Skip to content

Commit 14a056b

Browse files
authored
🚸 Add device name for running processes (#6774)
Resolves #6189 (comment). ![image](https://github.com/flutter/flutter-intellij/assets/15884415/6f7c0cda-5bfa-4015-9c10-255bdb9c43d6) ![image](https://github.com/flutter/flutter-intellij/assets/15884415/991e0e7e-d784-4270-8068-2c97a0b1325a) ![image](https://github.com/flutter/flutter-intellij/assets/15884415/1fdec68e-d0a8-4236-951a-4eea297bc936) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
1 parent 9742db1 commit 14a056b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

‎flutter-idea/src/io/flutter/run/LaunchState.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.jetbrains.annotations.NotNull;
5050
import org.jetbrains.annotations.Nullable;
5151

52+
import java.lang.reflect.Field;
5253
import java.util.ArrayList;
5354
import java.util.Arrays;
5455
import java.util.List;
@@ -148,12 +149,22 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
148149
}
149150

150151
final FlutterLaunchMode launchMode = FlutterLaunchMode.fromEnv(env);
152+
final RunContentDescriptor descriptor;
151153
if (launchMode.supportsDebugConnection()) {
152-
return createDebugSession(env, app, result).getRunContentDescriptor();
154+
descriptor = createDebugSession(env, app, result).getRunContentDescriptor();
153155
}
154156
else {
155-
return new RunContentBuilder(result, env).showRunContent(env.getContentToReuse());
157+
descriptor = new RunContentBuilder(result, env).showRunContent(env.getContentToReuse());
156158
}
159+
try {
160+
final Field f = descriptor.getClass().getDeclaredField("myDisplayName");
161+
f.setAccessible(true);
162+
f.set(descriptor, descriptor.getDisplayName() + " (" + device.deviceName() + ")");
163+
}
164+
catch (IllegalAccessException | NoSuchFieldException e) {
165+
LOG.info(e);
166+
}
167+
return descriptor;
157168
}
158169

159170
private static Class classForName(String className) {

0 commit comments

Comments
 (0)