Skip to content

Commit ab61137

Browse files
committed
Fix code style and better naming
1 parent 45157ad commit ab61137

File tree

1 file changed

+13
-14
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/helpers

1 file changed

+13
-14
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/helpers/UIHelperImpl.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,21 @@ public void run() {
155155
@Override
156156
public boolean showConfirmation(@NotNull String message, @NotNull String title, @NotNull String[] options,
157157
String defaultOption) {
158-
return getValueFromDispatchThread(() -> Messages.showDialog(message,
158+
return runFromDispatchThread(() -> 0 == Messages.showDialog(message,
159159
title,
160160
options,
161161
ArrayUtils.indexOf(options, defaultOption),
162-
null) == 0);
162+
null));
163163
}
164164

165165
@Override
166166
public boolean showConfirmation(@NotNull Component node, @NotNull String message, @NotNull String title, @NotNull String[] options, String defaultOption) {
167-
return getValueFromDispatchThread(() -> Messages.showDialog(node,
167+
return runFromDispatchThread(() -> 0 == Messages.showDialog(node,
168168
message,
169169
title,
170170
options,
171171
ArrayUtils.indexOf(options, defaultOption),
172-
null)
173-
== 0);
172+
null));
174173
}
175174

176175
@Override
@@ -738,26 +737,26 @@ public void showMessageDialog(Component component, String message, String title,
738737
@Override
739738
public int showConfirmDialog(Component component, String message, String title, String[] options,
740739
String defaultOption, Icon icon) {
741-
return getValueFromDispatchThread(() -> Messages.showDialog(component,
742-
message,
743-
title,
744-
options,
745-
ArrayUtils.indexOf(options, defaultOption),
746-
icon));
740+
return runFromDispatchThread(() -> Messages.showDialog(component,
741+
message,
742+
title,
743+
options,
744+
ArrayUtils.indexOf(options, defaultOption),
745+
icon));
747746
}
748747

749748
@Override
750749
public boolean showYesNoDialog(Component component, String message, String title, Icon icon) {
751-
return getValueFromDispatchThread(() -> Messages.showYesNoDialog(component, message, title, icon)
750+
return runFromDispatchThread(() -> Messages.showYesNoDialog(component, message, title, icon)
752751
== Messages.YES);
753752
}
754753

755754
@Override
756755
public String showInputDialog(Component component, String message, String title, Icon icon) {
757-
return getValueFromDispatchThread(() -> Messages.showInputDialog(component, message, title, icon));
756+
return runFromDispatchThread(() -> Messages.showInputDialog(component, message, title, icon));
758757
}
759758

760-
private static <T> T getValueFromDispatchThread(Supplier<T> supplier) {
759+
private static <T> T runFromDispatchThread(Supplier<T> supplier) {
761760
if (ApplicationManager.getApplication().isDispatchThread()) {
762761
return supplier.get();
763762
}

0 commit comments

Comments
 (0)