Skip to content

Commit 16a2e0f

Browse files
authored
Merge pull request #4885 from microsoft/qianjin-bugfix-20210112
Bug Fix #4720 & #4885 Subscription Selection Related Issues.
2 parents 2884d51 + 2e8e047 commit 16a2e0f

File tree

2 files changed

+5
-29
lines changed

2 files changed

+5
-29
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azuretools/ijidea/ui/SubscriptionsDialog.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.microsoft.azuretools.authmanage.SubscriptionManager;
3737
import com.microsoft.azuretools.authmanage.models.SubscriptionDetail;
3838
import com.microsoft.azuretools.ijidea.actions.SelectSubscriptionsAction;
39+
import com.microsoft.azuretools.ijidea.utility.JTableUtils;
3940
import com.microsoft.azuretools.sdkmanage.AzureManager;
4041
import com.microsoft.azuretools.telemetry.AppInsightsClient;
4142
import com.microsoft.azuretools.telemetrywrapper.EventType;
@@ -50,8 +51,6 @@
5051
import javax.swing.*;
5152
import javax.swing.table.DefaultTableModel;
5253
import javax.swing.table.TableColumn;
53-
import java.awt.event.MouseAdapter;
54-
import java.awt.event.MouseEvent;
5554
import java.util.List;
5655

5756
import static com.microsoft.azuretools.telemetry.TelemetryConstants.ACCOUNT;
@@ -156,30 +155,10 @@ private void createUIComponents() {
156155
column.setHeaderValue(""); // Don't show title text
157156
column.setMinWidth(23);
158157
column.setMaxWidth(23);
158+
JTableUtils.enableBatchSelection(table, CHECKBOX_COLUMN);
159159
table.getTableHeader().setReorderingAllowed(false);
160160
new TableSpeedSearch(table);
161161

162-
// secret functionality: select all subs
163-
table.getTableHeader().addMouseListener(new MouseAdapter() {
164-
@Override
165-
public void mouseClicked(MouseEvent e) {
166-
int col = table.columnAtPoint(e.getPoint());
167-
if (col == CHECKBOX_COLUMN) {
168-
boolean anySelected = false;
169-
for (int row = 0; row < table.getRowCount(); row++) {
170-
Boolean b = (Boolean) table.getValueAt(row, CHECKBOX_COLUMN);
171-
if (b) {
172-
anySelected = true;
173-
break;
174-
}
175-
}
176-
for (int row = 0; row < table.getRowCount(); row++) {
177-
table.getModel().setValueAt(!anySelected, row, CHECKBOX_COLUMN);
178-
}
179-
}
180-
}
181-
});
182-
183162
AnActionButton refreshAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {
184163
@Override
185164
public void actionPerformed(AnActionEvent anActionEvent) {

Utils/azuretools-core/src/com/microsoft/azure/toolkit/lib/common/task/AzureTaskManager.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import lombok.extern.java.Log;
2626
import rx.Emitter;
2727
import rx.Observable;
28-
import rx.observables.ConnectableObservable;
2928

3029
import java.util.function.BiConsumer;
3130
import java.util.function.Supplier;
@@ -253,8 +252,8 @@ public final <T> Observable<T> runInModalAsObservable(AzureTask<T> task) {
253252
return this.runInObservable(this::doRunInModal, task);
254253
}
255254

256-
private <T> ConnectableObservable<T> runInObservable(final BiConsumer<? super Runnable, ? super AzureTask<T>> consumer, final AzureTask<T> task) {
257-
final ConnectableObservable<T> observable = Observable.create((Emitter<T> emitter) -> {
255+
private <T> Observable<T> runInObservable(final BiConsumer<? super Runnable, ? super AzureTask<T>> consumer, final AzureTask<T> task) {
256+
return Observable.create((Emitter<T> emitter) -> {
258257
final AzureTaskContext.Node context = AzureTaskContext.current().derive();
259258
task.setContext(context);
260259
context.setTask(task);
@@ -268,9 +267,7 @@ private <T> ConnectableObservable<T> runInObservable(final BiConsumer<? super Ru
268267
}
269268
}, context);
270269
consumer.accept(t, task);
271-
}, Emitter.BackpressureMode.BUFFER).publish();
272-
observable.connect();
273-
return observable;
270+
}, Emitter.BackpressureMode.BUFFER);
274271
}
275272

276273
protected abstract void doRead(Runnable runnable, AzureTask<?> task);

0 commit comments

Comments
 (0)