From: jihye424.kim Date: Wed, 13 May 2015 08:47:26 +0000 (+0900) Subject: Refactoring: delete not used files X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8dff27e25a41ec9e9f44ff8e2d11e4302867fce8;p=sdk%2Femulator%2Femulator-manager.git Refactoring: delete not used files - delete files: PlatformList, CustomPlatform, PlatformTabItem, PlatformTabFolder - delete sources using PlatformList class - modify CLI source to use profile list. - delete vm list source from BaseImage class - delete base image list source from Platform class Change-Id: I872017634f18b18e5ed04db3e6c2c8a5b58f9ddf Signed-off-by: jihye424.kim --- diff --git a/common-project/src/org/tizen/emulator/manager/EmulatorManager.java b/common-project/src/org/tizen/emulator/manager/EmulatorManager.java index 9a077ec..2410ab5 100755 --- a/common-project/src/org/tizen/emulator/manager/EmulatorManager.java +++ b/common-project/src/org/tizen/emulator/manager/EmulatorManager.java @@ -43,7 +43,6 @@ import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.console.Action; import org.tizen.emulator.manager.console.CommandLineParser; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.platform.PlatformList; import org.tizen.emulator.manager.resources.FilePathResources; import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.About; @@ -52,7 +51,6 @@ import org.tizen.emulator.manager.tool.CheckVirtualization; import org.tizen.emulator.manager.tool.CocoaUtil; import org.tizen.emulator.manager.tool.SettingInfoFile; import org.tizen.emulator.manager.ui.MainDialog; -import org.tizen.emulator.manager.ui.VMsMainView; import org.tizen.emulator.manager.ui.dialog.MessageDialog; import org.tizen.emulator.manager.vms.helper.WorkerLock; @@ -315,9 +313,6 @@ public class EmulatorManager { CheckEmulatorDir.CheckSDCardDir(); CheckEmulatorDir.CheckSwapDir(); - PlatformList.makePlatformList(); -// EMPluginLoader.completeLoadPlugin(); - if (isConsoleMode) { EmulatorManager.startConsoleProcessor(); } else { @@ -372,9 +367,11 @@ public class EmulatorManager { WorkerLock.release(); if (!isConsoleMode) { SettingInfoFile.setLastTapIndex(current_tab_index); + /* if (VMsMainView.getInstance().getCurrentPlatform() != null) { SettingInfoFile.setLastImageIndex(VMsMainView.getInstance().getCurrentPlatform().getCurrentImageIndex()); } + */ } } } diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index 3a96306..c58638d 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -36,10 +36,10 @@ import java.util.List; import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.CustomPlatform; import org.tizen.emulator.manager.platform.Platform; -import org.tizen.emulator.manager.platform.PlatformList; import org.tizen.emulator.manager.platform.PlatformStringResources; +import org.tizen.emulator.manager.platform.Profile; +import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.platform.Skin; import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.CheckVirtualization; @@ -109,14 +109,11 @@ public class ConsoleCreateVM { if (c.getShortName() == "p") { boolean check = false; - for (Platform platform : PlatformList.getPlatformList()) { - if (platform.getName().equals(c.getCurrentValue())) { - for (CustomPlatform cp : PlatformList.getCustomPlatform()) { - if (platform.getProfile().equals(cp.getProfile())) { - image = cp.getImageList().get(0); - check = true; - break; - } + for (Profile profile : ProfileList.getProfileList()) { + for (Platform platform : profile.getPlatformList()) { + if (platform.getName().equals(c.getCurrentValue())) { + image = platform.getProfileClass().getImageList().get(0); + break; } } } @@ -129,22 +126,20 @@ public class ConsoleCreateVM { } if (image == null) { - int count = PlatformList.getCustomPlatform().size(); + int count = ProfileList.getProfileList().size(); if (count == 0) { - throw new ConsoleException("There not avaliable custom platform."); + throw new ConsoleException("There not avaliable profile."); } else if (count == 1){ - image = PlatformList.getCustomPlatform().get(0).getImageList().get(0); + image = ProfileList.getProfileList().get(0).getImageList().get(0); } else { // default profile is mobile profile - for (CustomPlatform cp : PlatformList.getCustomPlatform()) { - if (cp.getProfile().equals(PlatformStringResources.MobileProfile)) { - image = cp.getImageList().get(0); - break; - } + Profile profile = ProfileList.findProfile(PlatformStringResources.MobileProfile); + if (profile != null) { + image = profile.getImageList().get(0); } // if mobile profile does not exist, set first image if (image == null) { - image = PlatformList.getCustomPlatform().get(0).getImageList().get(0); + image = ProfileList.getProfileList().get(0).getImageList().get(0); } } } @@ -207,8 +202,8 @@ public class ConsoleCreateVM { if (c.getShortName() == "b") { boolean check = false; - for (Platform platform : PlatformList.getPlatformList()) { - for (BaseImage image : platform.getImageList()) { + for (Profile profile : ProfileList.getProfileList()) { + for (BaseImage image : profile.getImageList()) { if (image.getID().equals(c.getCurrentValue())) { check = true; if (property != null @@ -245,40 +240,29 @@ public class ConsoleCreateVM { } else { // Find property from platform's imagelist - for (Platform platform : PlatformList.getPlatformList()) { - if (platform.getName().equals(c.getCurrentValue())) { - for (BaseImage image : platform.getImageList()) { + for (Profile profile : ProfileList.getProfileList()) { + for (BaseImage image : profile.getImageList()) { + if (image.getPlatformName().equals(c.getCurrentValue())) { if (image.getName().contains("standard")) { check = true; property = new VMPropertyValue(image); break; } } - if (property == null) { - if (platform.getImageList().size() > 0) { + } + } + if (property == null) { + for (Profile profile : ProfileList.getProfileList()) { + for (BaseImage image : profile.getImageList()) { + if (image.getPlatformName().equals(c.getCurrentValue())) { check = true; - property = new VMPropertyValue(platform.getImageList().get(0)); + property = new VMPropertyValue(image); + break; } } } } } -// for (Platform platform : PlatformList.getPlatformList()) { -// for (BaseImage image : platform.getImageList()) { -// if (image.getPlatform().getName().equals(c.getCurrentValue())) { -// check = true; -// if (property != null -// && !property.baseImage.getID().equals(image.getID())) { -// throw new ConsoleException("Inputted platform name does not match inputted base image id's platform." -// + StringResources.NEW_LINE -// + "Base Image ID Platform: " + image.getPlatformName() -// + "Platform: " + property.baseImage.getPathName()); -// } else { -// property = new VMPropertyValue(image); -// } -// } -// } -// } if (!check) { throw new ConsoleException("The Platform (" + c.getCurrentValue() +") is not avaliable."); @@ -401,13 +385,8 @@ public class ConsoleCreateVM { ArrayList list = null; if (prop.baseImage != null) { list = prop.baseImage.getPlatform().findSkinList(prop.resolution); - } else { - for (CustomPlatform platform : PlatformList.getCustomPlatform()) { - if (platform.getProfile().equals(prop.profile)) { - list = platform.findSkinList(prop.resolution); - } - } } + if (list != null && !list.isEmpty()) { prop.skin = list.get(0); } else { @@ -428,13 +407,8 @@ public class ConsoleCreateVM { i = Integer.parseInt(skinCommand.getCurrentValue()); if (prop.baseImage != null) { list = prop.baseImage.getPlatform().findSkinList(prop.resolution); - } else { - for (CustomPlatform platform : PlatformList.getCustomPlatform()) { - if (platform.getProfile().equals(prop.profile)) { - list = platform.findSkinList(prop.resolution); - } - } } + if (list != null && !list.isEmpty()) { // if (i <= 0 || i > list.size()) { // throw new ConsoleException("Skin value (" + skinCommand.getCurrentValue() + ") is not avaliable."); diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java index a352fdc..ec675ec 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java @@ -39,8 +39,8 @@ import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; -import org.tizen.emulator.manager.platform.PlatformList; +import org.tizen.emulator.manager.platform.Profile; +import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.resources.FilePathResources; import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.About; @@ -165,8 +165,8 @@ public class ConsoleProcessor { ArrayList list = new ArrayList(); list.add("Avaliable Base Image: " + StringResources.NEW_LINE); - for (Platform platform : PlatformList.getPlatformList()) { - for (BaseImage image : platform.getImageList()) { + for (Profile profile : ProfileList.getProfileList()) { + for (BaseImage image : profile.getImageList()) { list.add(image.toString()); } } @@ -180,15 +180,13 @@ public class ConsoleProcessor { } public int getCountOfImageList() { - ArrayList list = new ArrayList(); - - for (Platform platform : PlatformList.getPlatformList()) { - for (BaseImage image : platform.getImageList()) { - list.add(image.getName()); - } + //ArrayList list = new ArrayList(); + int count = 0; + for (Profile profile : ProfileList.getProfileList()) { + count += profile.getImageList().size(); } - return list.size(); + return count; } public boolean launchEmulator(String name, String path, boolean isTest) { diff --git a/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java b/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java index 14f71ce..46a95f8 100644 --- a/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java +++ b/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java @@ -32,7 +32,6 @@ package org.tizen.emulator.manager.platform; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.logging.Level; @@ -252,42 +251,6 @@ public class BaseImage { return binaryVersion; } - protected ArrayList vmsList = new ArrayList(); - private SortBy sortType = SortBy.DateDes; - private boolean isSort = false; - - public void sortVMList(SortBy type) { - sortType = type; - if (!vmsList.isEmpty()) { - vmsList = sortType.sort(vmsList); - } - } - - public ArrayList getVmsList() { - if (!isSort) { - sortVMList(sortType); - isSort = true; - } - return vmsList; - } - - public void addVMsProperty(VMProperty property) { - vmsList.add(property); - } - - public void removeVMsProerty(VMProperty property) { - vmsList.remove(property); - } - - public void clearVMsList() { - vmsList.clear(); - isSort = false; - } - - public SortBy getSortType() { - return sortType; - } - // For usability : return last-created property. public VMProperty getCreateProperty() { File lastCreated = new File(lastCreatedPropertyPath); diff --git a/common-project/src/org/tizen/emulator/manager/platform/CustomPlatform.java b/common-project/src/org/tizen/emulator/manager/platform/CustomPlatform.java deleted file mode 100644 index 6b7e8d3..0000000 --- a/common-project/src/org/tizen/emulator/manager/platform/CustomPlatform.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * YeongKyoon Lee - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.platform; - -import java.io.IOException; - -import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.vms.VMProperty; - -public class CustomPlatform extends Platform { - - public CustomPlatform(String name, String profile) { - this.platformName = name; - this.platformPath = ""; - //this.version = name; - try { - imageList.add(new CustomBaseImage(this, "")); - - // TODO - this.profile = imageList.get(0).getProfile(); - this.version = "0"; - } catch (IOException e) { - // TODO - EMLogger.getLogger().warning("Error: " + e.getMessage()); - } - if (!imageList.isEmpty()) { - loadSkins(); - loadTemplate(); - loadPlugin(); - } - } - - - private void loadSkins() { - Platform latest = null; - - for (Platform p : PlatformList.getPlatformList()) { - if (p.getProfile().equals(profile)) { - if (latest == null) { - latest = p; - } else { - if (p.getVersion().compareTo(latest.getVersion()) > 0) { - latest = p; - } - } - } - } - - if (latest != null) { - skinList = latest.getSkins(); - } - } - - private void loadTemplate() { - Platform latest = null; - - for (Platform p : PlatformList.getPlatformList()) { - if (p.getProfile().equals(profile)) { - if (latest == null) { - latest = p; - } else { - if (p.getVersion().compareTo(latest.getVersion()) > 0) { - latest = p; - } - } - } - } -/* - if (latest != null) { - template = latest.getTemplate(); - } - */ - } - - private void loadPlugin() { - Platform latest = null; - - for (Platform p : PlatformList.getPlatformList()) { - if (p.getProfile().equals(profile)) { - if (latest == null) { - latest = p; - } else { - if (p.getVersion().compareTo(latest.getVersion()) > 0) { - latest = p; - } - } - } - } - - if (latest != null) { - plugin = latest.getPlugin(); - } - } - - public void clearImageList() { - imageList.clear(); - } - - //private boolean isX86 = false; - //private boolean isArm = false; - public void addVMsProperty(VMProperty prop) { - /* - if (prop.getArch() == Architecture.x86) { - if (!isX86) { - try { - imageList.add(new CustomBaseImage(this, "x86-custom", "x86")); - } catch (IOException e) { - // TODO - } - isX86 = true; - } - - } else { - if (!isArm) { - try { - imageList.add(new CustomBaseImage(this, "arm-custom", "arm")); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - isArm = true; - } - } - */ - - for (BaseImage b : getImageList()) { - if (prop.getArch().toString().equals(b.getCpu())) { - prop.getPropertyValue().baseImage = b; - b.addVMsProperty(prop); - break; - } - } - } - - @ Override - public String getPluginPlatformName() { - if (plugin != null && plugin.getPlatform() != null) { - return plugin.getPlatform().getPluginPlatformName(); - } - - return platformName; - } -} diff --git a/common-project/src/org/tizen/emulator/manager/platform/Platform.java b/common-project/src/org/tizen/emulator/manager/platform/Platform.java index f90048d..c7cbfae 100644 --- a/common-project/src/org/tizen/emulator/manager/platform/Platform.java +++ b/common-project/src/org/tizen/emulator/manager/platform/Platform.java @@ -44,7 +44,6 @@ import org.tizen.emulator.manager.plugin.ExtensionItem; import org.tizen.emulator.manager.plugin.PluginStringResources; import org.tizen.emulator.manager.resources.FilePathResources; import org.tizen.emulator.manager.resources.StringResources; -import org.tizen.emulator.manager.tool.SettingInfoFile; import org.tizen.emulator.manager.ui.detail.item.OptionType; import org.tizen.emulator.manager.vms.RESOLUTION; import org.tizen.emulator.manager.vms.VMProperty; @@ -75,26 +74,10 @@ public class Platform { private VMProperty customDefaultProperty; private List customOptionList; - protected ArrayList imageList = new ArrayList(); - protected int currentImageIndex = -1; protected Platform() { } - public Platform(String name) { - this.platformName = name; -// this.platformPath = FilePathResources.getPlatformsPath() -// + File.separator + platformName; - this.platformPath = FilePathResources.getPlatformsPath() + File.separator - + getPlatformPath(platformName); - - loadProperties(); - if (!imageList.isEmpty()) { - loadSkins(); - loadPlugin(); - } - } - - public Platform(Profile profile, String version, String path) { + Platform(Profile profile, String version, String path) { this.profileClass = profile; this.profile = profile.getName(); this.version = version; @@ -142,112 +125,6 @@ public class Platform { return customOptionList; } - private void loadProperties() { - if (platformPath == null) { - return; - } - File dir = new File(platformPath); - if (dir == null || !dir.isDirectory()) { - // TODO - EMLogger.getLogger().warning("This is not platform directory." - + StringResources.NEW_LINE + "Path: "+ platformPath); - return; - } - - File defaultImages = new File(platformPath + FilePathResources.getDefaultImagePath()); - File oldImages = new File(platformPath + FilePathResources.getOldDefaultImagePath()); - - //boolean isDuplicate = false; - if(defaultImages.exists() && defaultImages.isDirectory()) { - for (File f : defaultImages.listFiles()) { - if (!f.getName().equals("default")) { // skip default directory - //makeBaseImage(f); - } - } - } - - if (oldImages.exists() && oldImages.isDirectory()) { - for (File f : oldImages.listFiles()) { - //makeBaseImage(f); - } - } - - // TODO - if (!imageList.isEmpty()) { - profile = imageList.get(0).getProfile(); - version = imageList.get(0).getVersion(); - if (version.contains("-")) { - isOldVersion = true; - } else if (! platformName.equals(profile + "-" + version)) { - platformName = profile + "-" + version; - } - } - - // set image id - BaseImage top = null; - for (BaseImage i : imageList) { - if (i.getCpu().equals("x86")) { - i.setID(id++); - top = i; - break; - } - } - - for (BaseImage i : imageList) { - if (top == null || top != i) { - i.setID(id++); - } - } - } - - public int getCurrentImageIndex() { - if (currentImageIndex >= 0) { - return currentImageIndex; - } else { - return SettingInfoFile.getLastImageIndex(); - } - } - - public void setCurrentImageIndex(int index) { - this.currentImageIndex = index; - } - - private void makeBaseImage(File path) { - BaseImage image = null; - if (path.isDirectory()) { - try { - image = new BaseImage(this, path); - for (BaseImage i : imageList) { - if (i.getName().equals(image.getName())) { - // TODO: duplicate name - EMLogger.getLogger().info("The same name of the base disk image already exist.(name : " + image.getName() + " )"); - throw new IOException(); - } - } - - // Default image is added at first index of image-list. - String imageType = image.getType(); - if (imageType != null && imageType.equals("default")) { - imageList.add(0, image); - - } else { - imageList.add(image); - } - } catch (IOException e) { - EMLogger.getLogger().warning("Failed adding base image.." - + StringResources.NEW_LINE + "Base Disk Image Path: " + path.getAbsolutePath() - + StringResources.NEW_LINE + "Error: " + e.getMessage()); - } - } else { - EMLogger.getLogger().info("This is not base image directroy" - + StringResources.NEW_LINE + "Path: " + path); - } - } - - public ArrayList getImageList() { - return imageList; - } - public String getName() { return platformName; } @@ -268,13 +145,6 @@ public class Platform { return isOldVersion; } - public void clearVMs() { - for (BaseImage base : imageList) { - base.clearVMsList(); - } - } - - private void createCustomDefaultProperty() { // If custom default property not exist, load standard property for (BaseImage image : getProfileClass().getImageList()) { diff --git a/common-project/src/org/tizen/emulator/manager/platform/PlatformList.java b/common-project/src/org/tizen/emulator/manager/platform/PlatformList.java deleted file mode 100644 index bc381d1..0000000 --- a/common-project/src/org/tizen/emulator/manager/platform/PlatformList.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * SeokYeon Hwang - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.platform; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.resources.FilePathResources; -import org.tizen.emulator.manager.resources.StringResources; -import org.tizen.emulator.manager.vms.EmulatorVMList; -import org.tizen.emulator.manager.vms.VMProperty; -import org.tizen.emulator.manager.vms.VMProperty.FSImageType; -import org.tizen.emulator.manager.vms.helper.VMWorkerException; -import org.tizen.emulator.manager.vms.option.IOption; - -public class PlatformList { - private static ArrayList platformList = null; - - public static ArrayList getPlatformList() { - return platformList; - } - - private static ArrayList customList = new ArrayList(); - - private static ArrayList profileList = new ArrayList(); - - public static ArrayList getCustomPlatform() { - return customList; - } - - private static void makeCustomPlatformList() { - int profileCount = profileList.size(); - if (profileCount == 0) { - customList.add(new CustomPlatform("custom", - PlatformStringResources.MobileProfile)); - } else if (profileCount == 1) { - customList.add(new CustomPlatform("custom", profileList.get(0))); - } else if (profileCount >= 2) { - for (String profile : profileList) { - customList - .add(new CustomPlatform(profile + "-custom", profile)); - } - } - } - - private static void addPlatform(Platform platform) { - if (platform != null && platformList != null) { - String name = platform.getName(); - Platform p = null; - int i = 0; - platformList.add(platform); - for (i = (platformList.size() - 2); i >= 0; i--) { - p = platformList.get(i); - if (p.getName().compareTo(name) > 0) { - for (int j = platformList.size() - 2; j >= i; j--) { - platformList.set(j + 1, platformList.get(j)); - } - break; - } - } - if (i >= 0) { - platformList.set(i, platform); - } - } - } - - public static void makePlatformList() { - platformList = new ArrayList(); - - File platforms = new File(FilePathResources.getPlatformsPath()); - if (platforms.isDirectory() && platforms.exists()) { -// for (File platform : platforms.listFiles()) { -// if (platform.isDirectory()) { -// Platform p = new Platform(platform.getName()); -// if (!p.getImageList().isEmpty()) { -// //platformList.add(p); -// addPlatform(p); -// //addProfile(p.getProfile()); -// } -// } -// } - for (File platform : platforms.listFiles()) { - if (platform.isDirectory()) { - for (File profile : platform.listFiles()) { - if (profile.isDirectory()) { - String versionSplit[] = platform.getName().split("-"); - if (versionSplit != null && versionSplit.length == 2) { - Platform p = new Platform(profile.getName() + "-" + versionSplit[1]); - if (!p.getImageList().isEmpty()) { - //platformList.add(p); - addPlatform(p); - //addProfile(p.getProfile()); - } - } - } - } - } - } - } - - // add Profile - for (Platform p : platformList) { - addProfile(p.getProfile()); - } - - makeCustomPlatformList(); - - // check version() - checkingBaseImageBinaryVersion(); - settingVMPropertyList(); - - // Remove invalid last-created property file. - checkLastCreatedPropertyFile(); - - // Load option list - //loadOptionList(); - } - - private static void addProfile(String profile) { - if (profile == null) { - return; - } - - boolean isFind = false; - for (String s : profileList) { - if (s.equals(profile)) { - isFind = true; - break; - } - } - - if (!isFind) { - profileList.add(profile); - } - } - - public static void settingVMPropertyList() { - EmulatorVMList vms = EmulatorVMList.getInstance(); - vms.refreshProperties(); - - for (Platform p : getPlatformList()) { - p.clearVMs(); - } - - for (CustomPlatform p : getCustomPlatform()) { - p.clearVMs(); - } - - for (VMProperty prop : (VMProperty[]) vms.getProperties()) { - if (prop.getImageType() == FSImageType.custom) { - for (CustomPlatform p : getCustomPlatform()) { - if (prop.getPropertyValue().profile.equals(p.getProfile())) { - p.addVMsProperty(prop); - } - } - } else { - for (Platform p : getPlatformList()) { - if (prop.getImageVersion().equals(p.getVersion())) { - if (p.isOldVersion() - || prop.getImageProfile() - .equals(p.getProfile())) { - for (BaseImage b : p.getImageList()) { - if (prop.getBaseImageName().equals(b.getName())) { - prop.getPropertyValue().baseImage = b; - b.addVMsProperty(prop); - break; - } - } - } - } - } - } - // init vm worker - prop.initVMWorker(); - } - } - - private static void checkingBaseImageBinaryVersion() { - settingVMPropertyList(); - - for (VMProperty prop : (VMProperty[]) EmulatorVMList.getInstance() - .getProperties()) { - if (prop.getImageType() == FSImageType.standard) { - for (Platform p : getPlatformList()) { - if (!p.isOldVersion() - && prop.getImageVersion().equals(p.getVersion()) - && prop.getImageProfile().equals(p.getProfile())) { - for (BaseImage b : p.getImageList()) { - if (prop.getBaseImageName().equals(b.getName())) { - String binaryVersion = prop.getConfiguration() - .getBaseInformation().getDiskImage() - .getBaseDiskImage().getVersion(); - String path = prop.getConfiguration() - .getBaseInformation().getDiskImage() - .getBaseDiskImage().getValue(); - if (b.getPath().equals(path) - && (binaryVersion == null || !binaryVersion - .equals(b.binaryVersion))) { - try { - prop.getWorker().deleteVM(); - } catch (VMWorkerException e) { - EMLogger.getLogger().warning( - e.getMessage()); - } - } - break; - } - } - } - } - } - } - } - - private static void checkLastCreatedPropertyFile() { - // Get current last-created property file path. - List currentPathList = new ArrayList(); - for (Platform p : getPlatformList()) { - for (BaseImage image : p.getImageList()) { - currentPathList.add(image.getLastCreatedPropertyPath()); - } - } - for (Platform p : getCustomPlatform()) { - for (BaseImage image : p.getImageList()) { - currentPathList.add(image.getLastCreatedPropertyPath()); - } - } - - // Remove old last-created property. - File vms = new File(FilePathResources.getTizenVmsPath()); - File[] files = vms.listFiles(); - if (files != null) { - for (File f : files) { - String path = f.getAbsolutePath(); - String[] arr = null; - if (EmulatorManager.isWin()) { - arr = path.split("\\\\"); - } else { - arr = path.split(File.separator); - } - String fileName = arr[arr.length - 1]; - if (fileName - .startsWith(StringResources.LAST_CREATED_XML_PREFIX)) { - boolean isOld = true; - for (String currentPath : currentPathList) { - if (path.equals(currentPath)) { - isOld = false; - } - } - if (isOld) { - f.delete(); - } - } - } - } - } - - public static List getOptionList(VMProperty property) { - List optionList = null; - String profile = property.getPropertyValue().profile; - boolean isStandard = property.getPropertyValue().isStandard; - - if (isStandard) { - String image = property.getPropertyValue().baseName; - for (Platform p : platformList) { - if (p.profile.equals(profile)) { - for (BaseImage img : p.getImageList()) { - if (img.imageName.equals(image)) { - optionList = img.getOptionList(); - } - } - } - } - - } else { // custom - for (CustomPlatform p : customList) { - if (p.profile.equals(profile)) { - optionList = p.getImageList().get(0).getOptionList(); - } - } - } - - return optionList; - } -} diff --git a/common-project/src/org/tizen/emulator/manager/platform/Profile.java b/common-project/src/org/tizen/emulator/manager/platform/Profile.java index 4f9752e..47ab516 100644 --- a/common-project/src/org/tizen/emulator/manager/platform/Profile.java +++ b/common-project/src/org/tizen/emulator/manager/platform/Profile.java @@ -82,6 +82,18 @@ public class Profile { return getPlatformByName(name + "-" + version); } + public Platform getPlatformByLatestVersion() { + Platform latest = null; + for (Platform platform :platformList){ + if (latest == null) { + latest = platform; + } else if ((platform.getVersion().compareTo(latest.getVersion()) > 0)) { + latest = platform; + } + } + return latest; + } + public void addEmulator(VMProperty vm) { //setting BaseImage if (vm.getPropertyValue().baseImage == null) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java b/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java index d218132..2b49c62 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java +++ b/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java @@ -37,7 +37,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; -import org.tizen.emulator.manager.ui.detail.item.ItemState; public class StatusBar { private Composite bar = null; diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java b/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java index dac0d70..e49c228 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java @@ -53,7 +53,6 @@ public class VMsDetailView { private DetailViewPage modifyView = null; private boolean isModifyMode = false; - private boolean isChnagePlatform = false; private boolean isChangeProfile = false; public VMsDetailView(Composite parent) { @@ -117,10 +116,6 @@ public class VMsDetailView { init(WIDTH, HEIGHT); } - public void changePlatform() { - isChnagePlatform = true; - } - public void changeProfile() { isChangeProfile = true; } diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java b/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java index 706f475..8d4bbd5 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java @@ -38,8 +38,6 @@ import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; -import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; @@ -233,30 +231,6 @@ public class VMsListView { }); } - public void drawPlatform(Platform platform, int imageIndex, boolean isRefresh) { - if (!isRefresh) { - itemButton.setEnabled(true); - selectRadioButton(false); - } - - if (!platform.getImageList().isEmpty()) { - imageCombo.removeAll(); - imageCombo.setEnabled(true); - for (BaseImage image : platform.getImageList()) { - imageCombo.add(image.getName()); - } - if (imageIndex >= imageCombo.getItemCount()) { - imageIndex = 0; - } - imageCombo.select(imageIndex); - } else { - // TODO - return; - } - - TopListView.drawPlatform(platform, imageIndex); - } - public void drawProfile(Profile profile, boolean isRefresh) { if (profile.getName().equals(StringResources.TOTAL_PROFILE)) { // TODO if (!isRefresh) { @@ -276,11 +250,6 @@ public class VMsListView { TopListView.drawProfile(profile); } - public void drawVMList(BaseImage base, int select, boolean isCreate) { - TopListView.drawVMList(base, select, isCreate); - mainView.layout(true, true); - } - public void drawVMList(int select, boolean isCreate) { TopListView.drawVMList(select, isCreate); mainView.layout(true, true); diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMsMainView.java b/common-project/src/org/tizen/emulator/manager/ui/VMsMainView.java index dbdb32f..5429ef6 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/VMsMainView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/VMsMainView.java @@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.StringResources; @@ -155,8 +154,6 @@ public class VMsMainView { return detailView.isModifyMode(); } - private Platform currentPlatform = null; - private BaseImage currentImage = null; private Profile currentProfile = null; private VMProperty currentProperty = null; @@ -192,51 +189,6 @@ public class VMsMainView { currentProperty = null; } - public Platform getCurrentPlatform() { - return currentPlatform; - } - - public void setPlatform(Platform platform, int index, boolean isRefresh) { - if (platform == null) { - // TODO - return; - } - - this.currentPlatform = platform; - detailView.changePlatform(); - listView.drawPlatform(platform, index, isRefresh); - } - - public void setPlatform(Platform platform) { - setPlatform(platform, platform.getCurrentImageIndex(), false); - } - - public void resetPlatform() { - if (detailView != null && currentPlatform != null) { - detailView.reset(); - setPlatform(currentPlatform, - currentPlatform.getImageList().indexOf(currentImage), true); - } - } - - public void clearPlatform() { - currentPlatform = null; - currentImage = null; - currentProperty = null; - } - - public Platform getPlatform() { - return currentPlatform; - } - - public void setCurrentImage(BaseImage image) { - this.currentImage = image; - } - - public BaseImage getCurrentImage() { - return currentImage; - } - public VMProperty getCurrentProperty() { return currentProperty; } @@ -245,18 +197,6 @@ public class VMsMainView { this.currentProperty = currentProperty; } - public void drawVMList(BaseImage image) { - isCreateMode = false; - currentImage = image; - if (image.getVmsList().isEmpty()) { - drawEmptyVMList(); - } else { - listView.drawVMList(image, - currentProperty == null ? 0 - : currentImage.getVmsList().indexOf(currentProperty), false); - } - } - public void drawVMList(int index) { if (currentProfile == null) { return; diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java index c42e46b..031b596 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java @@ -45,8 +45,6 @@ import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Text; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.platform.Platform; -import org.tizen.emulator.manager.platform.PlatformList; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; import org.tizen.emulator.manager.resources.PatchImageResources; @@ -58,7 +56,6 @@ import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem; import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem; import org.tizen.emulator.manager.ui.widgets.ImageLabel; import org.tizen.emulator.manager.vms.VMProperty; -import org.tizen.emulator.manager.vms.VMProperty.FSImageType; import org.tizen.emulator.manager.vms.VMPropertyValue; import org.tizen.emulator.manager.vms.helper.HelperClass; import org.tizen.emulator.manager.vms.xml.template.Item; @@ -66,7 +63,6 @@ import org.tizen.emulator.manager.vms.xml.template.Item; public class VMNameViewItem extends TextViewItem{ Canvas canvas; - private boolean isStandard; public VMNameViewItem(Item template, LineLabelViewItem lineLabelViewItem) { super(template, lineLabelViewItem); @@ -237,54 +233,23 @@ public class VMNameViewItem extends TextViewItem{ public static String checkImageName(String newName) { String errorMsg = ""; VMProperty prop = null; - boolean result = true; + if (newName.length() > VMProperty.MAX_NAME_LEN) { errorMsg = "Max length is 20."; - result = false; } else if (!HelperClass.checkString(newName)) { errorMsg = "Name has invalid character!"; - result = false; } else if ((prop = HelperClass.checkDupulicateName(newName)) != null) { - String platform = prop.getImagePlatform(); - errorMsg = "Same name already exists in " + platform + "!"; - - if (!existPlatform(prop)){ - errorMsg += " (" + platform + " platform image does not exist.)"; - EMLogger.getLogger().info(platform + " platform image does not exist." + StringResources.NEW_LINE - + "If you do not need this VM(" + newName + "), delete VM folder." - + StringResources.NEW_LINE + "VM folder path: " + prop.getPropertyFile().getAbsolutePath()); - } + errorMsg = "Same name already exists!"; - result = false; + EMLogger.getLogger().info("If you do not need this VM(" + newName + "), delete VM folder." + + StringResources.NEW_LINE + "VM folder path: " + prop.getPropertyFile().getAbsolutePath()); } else if (newName.length() == VMProperty.MAX_NAME_LEN) { errorMsg = "Max length is 20."; } else if (newName.isEmpty()) { errorMsg = "Please input VM name."; - result = false; } return errorMsg; } - private static boolean existPlatform(VMProperty prop) { - boolean existPlatform = false; - - String platform = prop.getImagePlatform(); - - for (Platform p : PlatformList.getPlatformList()) { - if (p.getName().equals(platform)) { - existPlatform = true; - break; - } - } - - if (!existPlatform) { - if (prop.getImageType() == FSImageType.custom) { - existPlatform = true; - } - } - - return existPlatform; - } - } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java index 05c7f71..66a60b4 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java @@ -58,7 +58,7 @@ public class FileViewItem extends AdvancedViewItem { protected String name; - private String oldValue; + //private String oldValue; private String newValue; // for Info view diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java index db24691..6bcc32c 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java @@ -53,7 +53,7 @@ public class OnOffViewItem extends AdvancedViewItem{ protected String name; - private boolean oldValue; + //private boolean oldValue; private boolean newValue; public static String VALUE_ON = "on"; diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextViewItem.java index a4927d0..8a0a240 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextViewItem.java @@ -36,15 +36,10 @@ import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Text; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; diff --git a/common-project/src/org/tizen/emulator/manager/ui/dialog/ProxyDialog.java b/common-project/src/org/tizen/emulator/manager/ui/dialog/ProxyDialog.java index 48bfd48..c1d3b1c 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/dialog/ProxyDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/dialog/ProxyDialog.java @@ -53,11 +53,9 @@ import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; import org.tizen.emulator.manager.resources.ImageResources; import org.tizen.emulator.manager.resources.PatchImageResources; -import org.tizen.emulator.manager.tool.TapUtil; import org.tizen.emulator.manager.ui.MainDialog; import org.tizen.emulator.manager.ui.widgets.ImageButton; import org.tizen.emulator.manager.ui.widgets.ImageLabel; -import org.tizen.emulator.manager.vms.helper.HelperClass; public class ProxyDialog { private static int SHELL_WIDTH = 370; @@ -77,7 +75,7 @@ public class ProxyDialog { private static ImageButton applyAllProtocol; private static int BUTTON_WIDTH = 90; private static int BUTTON_HEIGHT = 26; - private static int MAX_INPUT_COUNT = 8; + //private static int MAX_INPUT_COUNT = 8; private static String returnValue; public static String open(String value) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/AbstractListView.java b/common-project/src/org/tizen/emulator/manager/ui/list/AbstractListView.java index fdfb7f5..4ae1ba9 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/AbstractListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/AbstractListView.java @@ -31,17 +31,13 @@ package org.tizen.emulator.manager.ui.list; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; -import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.Profile; public abstract class AbstractListView { protected Composite listView; public abstract void init(Composite parent, int width, int height); - public abstract void drawPlatform(Platform platform, int imageIndex); public abstract void drawProfile(Profile profile); - public abstract void drawVMList(BaseImage base, int select, boolean isCreate); public abstract void drawVMList(int select, boolean isCreate); public abstract void drawEmptyVMList(); public abstract void cancelModify(int index); diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java b/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java index 6533b49..3d36486 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java @@ -35,16 +35,10 @@ import java.util.Map; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.TreeItem; -import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.CustomPlatform; -import org.tizen.emulator.manager.platform.Platform; -import org.tizen.emulator.manager.platform.PlatformList; -import org.tizen.emulator.manager.platform.PlatformStringResources; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.ui.VMsMainView; import org.tizen.emulator.manager.vms.VMProperty; -import org.tizen.emulator.manager.vms.VMProperty.FSImageType; public class ExtendTreeListView extends TreeListView { private ArrayList createItems = new ArrayList(); @@ -52,132 +46,6 @@ public class ExtendTreeListView extends TreeListView { private Map itemsMap = new HashMap(); @Override - public void drawVMList(BaseImage baseImage, int select, boolean isCreate) { - if (select < 0) { - return; - } - currentItem = null; - vmsTree.removeAll(); - createItems.clear(); - typeItems.clear(); - itemsMap.clear(); - - RowItem rowItem = null; - TreeItem createItem = null; - TreeItem propertyItem = null; - TreeItem customItem = null; - - // add standard image - for (Platform p : PlatformList.getPlatformList()) { - String standardVersion = p.getName(); - if (!standardVersion.isEmpty()) { - TreeItem tempItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new StandardVMsMarker(standardVersion, tempItem); - tempItem.setData(rowItem); - itemsMap.put(p.getName(), tempItem); - typeItems.add(tempItem); - - for (BaseImage b : p.getImageList()) { - TreeItem t = new TreeItem(tempItem, SWT.NONE); - rowItem = new StandardVMsMarker(b.getName(), t); - t.setData(rowItem); - if (!p.isOldVersion()) { - itemsMap.put(p.getProfile() + "-" + p.getVersion() + b.getName(), t); - } else { - itemsMap.put(p.getName() + b.getName(), t); - } - typeItems.add(t); - - createItem = new TreeItem(t, SWT.NONE); - rowItem = new CreateMarker(createItem, b); - createItem.setData(rowItem); - createItems.add(createItem); - } - } - } - // - - // add custom image - for (CustomPlatform p : PlatformList.getCustomPlatform()) { - TreeItem t = new TreeItem(vmsTree, SWT.NONE); - BaseImage b = p.getImageList().get(0); - rowItem = new CustomVMsMarker(p.getName(), t); - t.setData(rowItem); - itemsMap.put(p.getProfile(), t); - typeItems.add(t); - - createItem = new TreeItem(t, SWT.NONE); - rowItem = new CreateMarker(createItem, b); - createItem.setData(rowItem); - createItems.add(createItem); - } - - // add VM - ArrayList properties = VMsMainView.getInstance().getCurrentImage().getVmsList(); - VMProperty prop; - for(int i = 0; i < properties.size(); ++i) { - // temporarily hard coded now... - //if(properties[i].getArch() == Architecture.ARM) - // continue; - prop = properties.get(i); - if(FSImageType.standard == prop.getImageType()) { - String version = prop.getImageVersion(); - String profile = prop.getImageProfile(); - - version = profile + "-" + version; - - String base = prop.getConfiguration().getBaseInformation().getDiskImage().getBase(); - propertyItem = itemsMap.get(version+base); - if(propertyItem == null) { - propertyItem = itemsMap.get(version); - if (propertyItem == null) { - propertyItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new StandardVMsMarker(version, propertyItem); - propertyItem.setData(rowItem); - itemsMap.put(version, propertyItem); - typeItems.add(propertyItem); - } - propertyItem = new TreeItem(propertyItem, SWT.NONE); - rowItem = new StandardVMsMarker(base, propertyItem); - propertyItem.setData(rowItem); - - itemsMap.put(version+base, propertyItem); - typeItems.add(propertyItem); - } - propertyItem = new TreeItem(propertyItem, SWT.NONE); - } - else { - String profile = prop.getImageProfile(); - customItem = itemsMap.get((profile == null ? PlatformStringResources.MobileProfile : profile)); - propertyItem = new TreeItem(customItem, SWT.NONE); - } - - rowItem = new PropertyContent(prop, propertyItem); - propertyItem.setData(rowItem); - if (i == select) { - currentItem = propertyItem; - } - } - - for (TreeItem item : createItems) { - item.setExpanded(true); - } - - for(TreeItem item : typeItems) { - item.setExpanded(true); - } - - packAll(); - packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ??? - - if (currentItem == null) { - currentItem = vmsTree.getItem(0); - } - - setSelectProperty(); - } - - @Override public void drawVMList(int select, boolean isCreate) { if (select < 0) { return; diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java b/common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java index 9449c83..8dd9de9 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java @@ -44,8 +44,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Text; -import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.platform.SortBy; import org.tizen.emulator.manager.resources.ColorResources; @@ -181,8 +179,8 @@ public class ItemListVew extends AbstractListView { } } - VMsMainView.getInstance().getCurrentImage().sortVMList(sortType); - VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getCurrentImage()); + VMsMainView.getInstance().getProfile().sortVMList(sortType); + VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getProfile()); } private void resetPopupMenu(SortBy t) { @@ -196,10 +194,6 @@ public class ItemListVew extends AbstractListView { dateItem.setSelection(false); } } - @Override - public void drawPlatform(Platform platform, int imageIndex) { - VMsMainView.getInstance().drawVMList(imageIndex); - } @Override public void drawProfile(Profile profile) { @@ -271,68 +265,6 @@ public class ItemListVew extends AbstractListView { } @Override - public void drawVMList(BaseImage base, int select, boolean isCreate) { - if (createButton != null) { - if (base.getVmsList().isEmpty()) { - FormData data = new FormData(); - data.width = 0; - data.height = 0; - createButton.setLayoutData(data); - createButton.setEnabled(false); - } else { - createButton.dispose(); - createButton = null; - } - } - - resetPopupMenu(base.getSortType()); - - if (select == -1) { - select = 0; - } - - state = VIEW_STATE.DETAIL; - - VMButtonFactory.clear(); - if (base.getVmsList().size() != 0) { - VMButton button = null; - for (int i = 0; i < base.getVmsList().size(); i++) { - button = VMButtonFactory.getButton(vmList, base); - button.setProperty(base.getVmsList().get(i)); - if (i == select) { - VMButtonFactory.clickVMButton(button); - } - } - } - - // add create button - addNewButton = VMButtonFactory.getCreateButton(vmList, base); - if (isCreate) { - addNewButton.setSelection(true); - } else { - addNewButton.setSelection(false); - } - addNewButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - clickCreateButton(); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - - } - }); - - BUTTON_WIDTH = VMButtonFactory.getButtonSize().x + 4; - BUTTON_HEIGHT = VMButtonFactory.getButtonSize().y + 4; - - arrayVMList(); - dumyText.setFocus(); - } - - @Override public void drawEmptyVMList() { if (createButton != null) { createButton.dispose(); diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java b/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java index ed7aee8..ca71697 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java @@ -43,8 +43,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.swt.widgets.TreeItem; -import org.tizen.emulator.manager.platform.BaseImage; -import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.resources.ColorResources; import org.tizen.emulator.manager.resources.FontResources; @@ -240,11 +238,6 @@ public class TreeListView extends AbstractListView { } @Override - public void drawPlatform(Platform platform, int imageIndex) { - VMsMainView.getInstance().drawVMList(imageIndex); - } - - @Override public void drawProfile(Profile profile) { VMsMainView.getInstance().drawVMList(profile); } @@ -282,41 +275,6 @@ public class TreeListView extends AbstractListView { } } - //private ArrayList createItems = new ArrayList(); - //private ArrayList typeItems = new ArrayList(); - //private Map itemsMap = new HashMap(); - @Override - public void drawVMList(BaseImage base, int select, boolean isCreate) { - if (select >= 0) { - vmsTree.removeAll(); - //currentProp = null; - currentItem = null; - RowItem rowItem = null; - TreeItem createItem = null; - TreeItem propertyItem = null; - - createItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new CreateMarker(createItem, base); - createItem.setData(rowItem); - - VMProperty prop = null; - for(int i = 0; i < base.getVmsList().size(); i++) { - prop = base.getVmsList().get(i); - propertyItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new PropertyContent(prop, propertyItem); - propertyItem.setData(rowItem); - if (i == select) { - //currentProp = (PropertyContent)rowItem; - currentItem = propertyItem; - VMsMainView.getInstance().drawDetailVM(prop, -1); - } - } - packAll(); - packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ??? - setSelectProperty(); - } - } - @Override public void drawEmptyVMList() { drawVMList(0, false); diff --git a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java b/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java deleted file mode 100644 index b894fb2..0000000 --- a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * YeongKyoon Lee - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.ui.tabfolder; - -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.resources.ColorResources; -import org.tizen.emulator.manager.resources.FontResources; -import org.tizen.emulator.manager.resources.PatchImageResources; -import org.tizen.emulator.manager.resources.StringResources; -import org.tizen.emulator.manager.tool.SettingInfoFile; -import org.tizen.emulator.manager.ui.VMsMainView; -import org.tizen.emulator.manager.ui.widgets.ImageButton; -import org.tizen.emulator.manager.ui.widgets.WSTATE; - -public class PlatformTabFolder { - private static final int TAB_WIDTH = 120; - private static final int TAB_HEIGHT = 29; - private static final int RIGHT_BUTTON_WIDTH = 18; - private static final int RIGHT_BUTTON_HEIGHT = 18; - private static final int RIGHT_BUTTON_GAP = 11; - - private ArrayList items - = new ArrayList(5); - private ArrayList buttons - = new ArrayList(5); - - private ArrayList rightButtons - = new ArrayList(5); - - private Composite mainComposite = null; - private Composite tabComposite = null; - private Composite contentsComposite = null; - - // - private static VMsMainView view; - - public Composite getTabComposite() { - return tabComposite; - } - - public Composite getComposite() { - return mainComposite; - } - - public PlatformTabFolder(Composite parent) { - mainComposite = new Composite(parent, SWT.NONE); - mainComposite.setLayout(new FormLayout()); - // - mainComposite.setBackground(ColorResources.TAB_BG_COLOR.getColor()); - // - /* - FormData data = new FormData(); - data.top = new FormAttachment(0, 0); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.height = 460; - mainComposite.setLayoutData(data); - */ - - tabComposite = new Composite(mainComposite, SWT.DOUBLE_BUFFERED); - tabComposite.setLayout(new FormLayout()); - - contentsComposite = new Composite(mainComposite, SWT.DOUBLE_BUFFERED); - contentsComposite.setLayout(new FillLayout()); - - // initialize main view - view = VMsMainView.getInstance(); - view.setInit(contentsComposite); - - FormData data = new FormData(); - data.top = new FormAttachment(0, 0); - data.left = new FormAttachment(0, 2); - data.right = new FormAttachment(100, -2); - data.height = TAB_HEIGHT + 1; - tabComposite.setLayoutData(data); - tabComposite.setBackground(ColorResources.TAB_BG_COLOR.getColor()); - - data = new FormData(); - data.top = new FormAttachment(tabComposite, 0); - data.left = new FormAttachment(0, 2); - data.right = new FormAttachment(100, -2); - data.bottom = new FormAttachment(100, 0); - contentsComposite.setLayoutData(data); - contentsComposite.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor()); - } - - public void draw() { - if(!items.isEmpty()) { - // clear - if (!buttons.isEmpty()) { - for (ImageButton b : buttons) { - b.dispose(); - } - buttons.clear(); - } - - for (PlatformTabItem item : items) { - buttons.add(makeTabButton(item)); - } - - int index = SettingInfoFile.getLastTapIndex(); - if (index >= buttons.size()) { - index = 0; - } - selectionItem(buttons.get(index)); - } - - if(!rightButtons.isEmpty()) { - int size = rightButtons.size() - 1; - for (int i = rightButtons.size() - 1; i >= 0; i--) { - FormData data = new FormData(); - data.top = new FormAttachment(0, 6); - if (i == size) { - data.right = new FormAttachment(99, 0); - } else { - data.right = new FormAttachment(rightButtons.get(i+1), -RIGHT_BUTTON_GAP); - } - data.width = RIGHT_BUTTON_WIDTH; - data.height = RIGHT_BUTTON_HEIGHT; - rightButtons.get(i).setLayoutData(data); - } - } - } - - public void redraw() { - items.get(getSelectionIndex()).redraw(); - } - - private ImageButton makeTabButton(PlatformTabItem item) { - ImageButton tabButton = new ImageButton(tabComposite, SWT.NONE); - Image unselectTab = PatchImageResources.getUnselectedTabFolder(120, 29); - Image selectTab = PatchImageResources.getSelectTabFolder(120, 29); - tabButton.setImages(unselectTab, unselectTab, selectTab, - selectTab, selectTab, selectTab, - unselectTab); - tabButton.setFont(FontResources.TAB_BUTTON_FONT.getFont()); - tabButton.setFontColor(WSTATE.NORMAL, ColorResources.TAB_NORMAL_FONT_COLOR.getColor()); - tabButton.setFontColor(WSTATE.SELECTED, ColorResources.TAB_SELECTED_FONT_COLOR.getColor()); - tabButton.setFontColor(WSTATE.HOVER, ColorResources.TAB_HOVER_FONT_COLOR.getColor()); - tabButton.setFontColor(WSTATE.PUSH, ColorResources.TAB_SELECTED_FONT_COLOR.getColor()); - tabButton.setFontColor(WSTATE.SELECTED_HOVER, ColorResources.TAB_SELECTED_FONT_COLOR.getColor()); - tabButton.setFontColor(WSTATE.SELECTED_PUSH, ColorResources.TAB_SELECTED_FONT_COLOR.getColor()); - tabButton.setText(item.getText()); - tabButton.setEnabled(true); - - FormData data = new FormData(); - data.top = new FormAttachment(0, 2); - if (buttons.size() == 0) { - data.left = new FormAttachment(0, 0); - } else { - data.left = new FormAttachment(buttons.get(buttons.size() - 1), 2); - } - - data.width = TAB_WIDTH; - data.height = TAB_HEIGHT; - tabButton.setLayoutData(data); - - tabButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - selectionItem((ImageButton)e.widget); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - - } - }); - - return tabButton; - } - - private void selectionItem(ImageButton button) { - ImageButton b = null; - for (int i = 0; i < buttons.size(); i++) { - b = buttons.get(i); - if (button == b) { - if (!b.isSelection()) { - // draw main view using selected platform - items.get(i).draw(); - // this is temp code..please fix me - if (items.get(i).getPlatform().getName().equals(StringResources.TOTAL_PROFILE)) { - items.get(i).draw(); - } - contentsComposite.layout(true, false); - EmulatorManager.setCurrentTabIndex(i); - } - this.setSelection(i); - b.setSelection(true); - } else { - b.setSelection(false); - } - } - } - - private int selection = -1; - - public void setSelection(int index) { - selection = index; - } - - public PlatformTabItem getSelection() { - if (selection == -1) { - return items.get(0); - } else { - return items.get(selection); - } - } - - public int getSelectionIndex() { - return selection; - } - - public void clear() { - // TODO - } - - public VMsMainView getView() { - return view; - } - - public void addTabItem(PlatformTabItem item) { - items.add(item); - } - - public void addTabItem(int index, PlatformTabItem item) { - items.add(index, item); - } - - public void removeTabItem(PlatformTabItem item) { - items.remove(item); - } - - public PlatformTabItem removeTabItem(int index) { - return items.remove(index); - } - - public void addTabRightButton(ImageButton button) { - rightButtons.add(button); - } - - public void addTabRightButton(int index, ImageButton button) { - rightButtons.add(index, button); - } - - public void removeTabRightButton(ImageButton button) { - rightButtons.remove(button); - } - - public ImageButton removeTabRightButton(int index) { - return rightButtons.remove(index); - } - - public int width() { - int width = 0; - if (!buttons.isEmpty()) { - width += buttons.size() * TAB_WIDTH; - } - - if (!rightButtons.isEmpty()) { - width += rightButtons.size() * (RIGHT_BUTTON_WIDTH + RIGHT_BUTTON_GAP); - } - - return width; - } -} diff --git a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java b/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java deleted file mode 100644 index e084c4c..0000000 --- a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * YeongKyoon Lee - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.ui.tabfolder; - -import org.tizen.emulator.manager.platform.Platform; -import org.tizen.emulator.manager.ui.VMsMainView; - -public class PlatformTabItem { - private Platform platform; - - private static VMsMainView view; - - private String text; -// private Control control; - - public PlatformTabItem(Platform platform, PlatformTabFolder mainTab, int style) { - this.platform = platform; - mainTab.addTabItem(this); - - this.text = this.platform.getName(); - view = mainTab.getView(); - } - - public void draw() { - // TODO - view.clearPlatform(); - view.setPlatform(platform); - } - - public void redraw() { - // TODO - view.resetPlatform(); - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } -/* - public Control getControl() { - return control; - } - - public void setControl(Control control) { - this.control = control; - } -*/ - public Platform getPlatform() { - return platform; - } - - public void setPlatform(Platform platform) { - this.platform = platform; - } -} diff --git a/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java b/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java index fab80c9..f42c962 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java +++ b/common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java @@ -49,7 +49,6 @@ import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.ui.MainDialog; import org.tizen.emulator.manager.vms.EmulatorVMList; import org.tizen.emulator.manager.vms.VMProperty; -import org.tizen.emulator.manager.vms.VMProperty.FSImageType; public class HelperClass { @@ -81,13 +80,7 @@ public class HelperClass { } } else { if (p.getName().equals(t)) { - if (p.getImageType() != null && p.getImageType() == FSImageType.custom) { - return p; - } else if (p.getImageType() != null) { // p.getImageType is standard - if (p.getImagePlatform() != null) { - return p; - } - } + return p; } } }