From: jihye424.kim Date: Sat, 13 Feb 2016 02:43:16 +0000 (+0900) Subject: profile button: change to new 'Profile' class X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea8af578827750c0cbf23727bbf2b4b577b79a6f;p=sdk%2Femulator%2Femulator-manager.git profile button: change to new 'Profile' class Change-Id: Ia6ba98eb3088ed1e78bb60d4616694e13ed10d33 Signed-off-by: jihye424.kim --- diff --git a/src/org/tizen/emulator/manager/devices/DeviceTemplateList.java b/src/org/tizen/emulator/manager/devices/DeviceTemplateList.java index 12feea9..a2c90ac 100644 --- a/src/org/tizen/emulator/manager/devices/DeviceTemplateList.java +++ b/src/org/tizen/emulator/manager/devices/DeviceTemplateList.java @@ -65,11 +65,11 @@ public class DeviceTemplateList { templateList = loadTemplates(); } - public static DeviceTemplate[] getDeviceTemplateList(boolean isRefresh) { + public static List getDeviceTemplateList(boolean isRefresh) { if (templateList == null || isRefresh) { templateList = loadTemplates(); } - return templateList.toArray(new DeviceTemplate[templateList.size()]); + return templateList; } public static void addTemplate(DeviceTemplate template) { diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java index 12a4a1f..004834a 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java +++ b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java @@ -49,6 +49,7 @@ import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.devices.DeviceTemplate; +import org.tizen.emulator.manager.devices.DeviceTemplateList; import org.tizen.emulator.manager.devices.DeviceTemplatePriority; import org.tizen.emulator.manager.devices.DeviceTemplateType; import org.tizen.emulator.manager.devices.DeviceTemplateValue; @@ -341,7 +342,11 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer { } private void makeTableItem(ProfileButton pButton, boolean needCheck) { - for (DeviceTemplate template : pButton.getProfile().getTemplateList()) { + for (DeviceTemplate template : DeviceTemplateList.getDeviceTemplateList(false)) { + if (!template.getValue().getProfile().equals(pButton.getProfile())) { + continue; + } + if (!needCheck || !existTemplateInTable(template)) { addTableItem(pButton, template); } @@ -551,25 +556,15 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer { if (!b.isSelection()) { makeTableItem(pButton, true); } else { - if (pButton.getProfile().getTemplateList().isEmpty()) { - return; - } - String profile = pButton.getProfileName(); - for (TableItem item : table.getSelection()) { - DeviceTemplate template = (DeviceTemplate)(item.getData()); - if (template.getValue().getProfile().equals(profile)) { - table.deselectAll(); - } - } - for (DeviceTemplate template : pButton.getProfile().getTemplateList()) { - for (TableItem item : table.getItems()) { - if (item.getData() == template) { - int index = table.indexOf(item); - table.remove(index); - break; - } + + for (TableItem item : table.getItems()) { + DeviceTemplate template = (DeviceTemplate)item.getData(); + if (!template.getValue().getProfile().equals(profile)) { + continue; } + int index = table.indexOf(item); + table.remove(index); } } tablePack(); @@ -691,10 +686,12 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer { value = template.getValue(); } else { // finding default template - ProfileButton pButton = findTopPriorityProfileButton(); - if (pButton != null && pButton.getProfile().getDefaultTemplate() != null) { - value = pButton.getProfile().getDefaultTemplate().getValue(); - } +// ProfileButton pButton = findTopPriorityProfileButton(); +// if (pButton != null && pButton.getProfile().getDefaultTemplate() != null) { +// value = pButton.getProfile().getDefaultTemplate().getValue(); +// } + // FIXME: find default template + value = DeviceTemplateList.getDeviceTemplateList(false).get(0).getValue(); } // open create dialog diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButton.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButton.java index abf6874..55e5b65 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButton.java +++ b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButton.java @@ -31,7 +31,7 @@ package org.tizen.emulator.manager.ui.renewal.tableviewer; import org.eclipse.swt.graphics.Image; -import org.tizen.emulator.manager.platform.backup.Profile; +import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.renewal.resources.ImageKind; import org.tizen.emulator.manager.renewal.resources.Images; import org.tizen.emulator.manager.ui.renewal.widgets.ImageButton; diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java index 9af5715..3a8ce12 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java +++ b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java @@ -265,7 +265,7 @@ public class VMListTableViewer extends AbstractTableViewer { for (ProfileButton pButton : profileButtonList) { for (Platform platform : Platform.getPlatformList()) { if (pButton.getProfileName().equals(platform.getProfile().getName())) { - //pButton.setProfile(platform.getProfile()); + pButton.setProfile(platform.getProfile()); pButton.getButton().setEnabled(true); pButton.getButton().addSelectionListener(profileButtonSelectionListener); break; diff --git a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java index ab9fb01..00f5d0f 100644 --- a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java +++ b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java @@ -104,8 +104,8 @@ public class HelperClass { isWindows = true; t = t.toLowerCase(); } - DeviceTemplate[] list = DeviceTemplateList.getDeviceTemplateList(false); - for (DeviceTemplate template : list) { + + for (DeviceTemplate template : DeviceTemplateList.getDeviceTemplateList(false)) { if (isWindows ) { if (template.getValue().getName().toLowerCase().equals(t)) { return template;