Skip to content

Commit 5f69c50

Browse files
committed
♻️ Refactored from myDisplayName to myDisplayNameView
1 parent 0e4511e commit 5f69c50

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.intellij.execution.runners.RunContentBuilder;
2121
import com.intellij.execution.ui.ConsoleView;
2222
import com.intellij.execution.ui.ConsoleViewContentType;
23+
import com.intellij.execution.ui.MutableReactiveProperty;
2324
import com.intellij.execution.ui.RunContentDescriptor;
2425
import com.intellij.icons.AllIcons;
2526
import com.intellij.openapi.actionSystem.AnAction;
@@ -156,12 +157,12 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
156157
else {
157158
descriptor = new RunContentBuilder(result, env).showRunContent(env.getContentToReuse());
158159
}
160+
final String nameWithDeviceName = descriptor.getDisplayName() + " (" + device.deviceName() + ")";
159161
try {
160-
final Field f = descriptor.getClass().getDeclaredField("myDisplayName");
161-
f.setAccessible(true);
162-
f.set(descriptor, descriptor.getDisplayName() + " (" + device.deviceName() + ")");
162+
final MutableReactiveProperty<String> property = (MutableReactiveProperty<String>) descriptor.getDisplayNameProperty();
163+
property.setValue(nameWithDeviceName);
163164
}
164-
catch (IllegalAccessException | NoSuchFieldException e) {
165+
catch (ClassCastException e) {
165166
LOG.info(e);
166167
}
167168
return descriptor;

0 commit comments

Comments
 (0)