Skip to content

Commit 50ed8ad

Browse files
[Fix] TabSwitching, checkPlatform, actionButtonText
1 parent 7a41763 commit 50ed8ad

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

mode/tools/SDKUpdater/src/processing/mode/android/tools/SDKUpdater.java

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public class SDKUpdater extends JFrame implements PropertyChangeListener, Tool {
9292
private JButton actionButtonPlatform;
9393
private JTable table;
9494
private JTable tablePlatforms;
95+
private JTabbedPane tabs;
9596

9697
private ArrayList<String> packagePathsList;
9798
private ArrayList<String> platformPathsList;
@@ -245,18 +246,20 @@ public Channel getChannel() {
245246
for (String path: installed.keySet()) {
246247
Vector info = new Vector();
247248
List locInfo = installed.get(path);
248-
packagePathsList.add(path);
249-
info.add(false);
250-
info.add(locInfo.get(0));
251-
info.add(locInfo.get(1));
252-
if (updated.containsKey(path)) {
253-
String upVer = updated.get(path).get(1);
254-
info.add(upVer);
255-
numUpdates++;
256-
} else {
257-
info.add("");
249+
if (!isPlatform(path)) {
250+
packagePathsList.add(path);
251+
info.add(false);
252+
info.add(locInfo.get(0));
253+
info.add(locInfo.get(1));
254+
if (updated.containsKey(path)) {
255+
String upVer = updated.get(path).get(1);
256+
info.add(upVer);
257+
numUpdates++;
258+
} else {
259+
info.add("");
260+
}
261+
packageList.add(info);
258262
}
259-
packageList.add(info);
260263
}
261264

262265
return null;
@@ -288,6 +291,15 @@ protected void done() {
288291
e.printStackTrace();
289292
}
290293
}
294+
295+
private Boolean isPlatform(String path){
296+
int end_pos = path.indexOf(";");
297+
String pathType = end_pos != -1 ? path.substring(0,end_pos) : "" ;
298+
if (pathType.equals("platforms")) {
299+
return true;
300+
}
301+
return false;
302+
}
291303
}
292304

293305
class DownloadTask extends SwingWorker<Object, Object> {
@@ -330,6 +342,7 @@ protected Object doInBackground() throws Exception {
330342

331343
if (remotes.size() == 0) {
332344
actionButtonPlatform.setText("Install");
345+
actionButton.setText("Update");
333346
Messages.showWarning("SDK Updater","No platform was selected");
334347
return null;
335348
}
@@ -360,6 +373,7 @@ protected void done() {
360373
try {
361374
get();
362375
actionButton.setEnabled(false);
376+
tabs.setEnabled(true);
363377
status.setText("Refreshing packages...");
364378
statusPlatform.setText("Refreshing packages...");
365379
queryTask = new QueryTask();
@@ -432,7 +446,7 @@ private void createLayout(final boolean standalone) {
432446
Box verticalBox1 = Box.createVerticalBox();
433447
verticalBox1.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
434448

435-
JTabbedPane tabs = new JTabbedPane();
449+
tabs = new JTabbedPane();
436450
tabs.add("SDK Tools",verticalBox);
437451
tabs.add("Platforms",verticalBox1);
438452
outer.add(tabs);
@@ -523,6 +537,7 @@ public void actionPerformed(ActionEvent e) {
523537

524538
status.setText("Downloading available updates...");
525539
actionButton.setText("Cancel");
540+
tabs.setEnabled(false);
526541
}
527542
}
528543
});
@@ -628,6 +643,7 @@ public void actionPerformed(ActionEvent e) {
628643
progressBarPlatform.setIndeterminate(true);
629644
downloadTask.execute();
630645
actionButtonPlatform.setText("Cancel");
646+
tabs.setEnabled(false);
631647
}
632648
}
633649
});

0 commit comments

Comments
 (0)