- 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 <jihye424.kim@samsung.com>
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;
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;
CheckEmulatorDir.CheckSDCardDir();
CheckEmulatorDir.CheckSwapDir();
- PlatformList.makePlatformList();
-// EMPluginLoader.completeLoadPlugin();
-
if (isConsoleMode) {
EmulatorManager.startConsoleProcessor();
} else {
WorkerLock.release();
if (!isConsoleMode) {
SettingInfoFile.setLastTapIndex(current_tab_index);
+ /*
if (VMsMainView.getInstance().getCurrentPlatform() != null) {
SettingInfoFile.setLastImageIndex(VMsMainView.getInstance().getCurrentPlatform().getCurrentImageIndex());
}
+ */
}
}
}
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;
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;
}
}
}
}
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);
}
}
}
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
} 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.");
ArrayList<Skin> 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 {
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.");
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;
ArrayList<String> list = new ArrayList<String>();
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());
}
}
}
public int getCountOfImageList() {
- ArrayList<String> list = new ArrayList<String>();
-
- for (Platform platform : PlatformList.getPlatformList()) {
- for (BaseImage image : platform.getImageList()) {
- list.add(image.getName());
- }
+ //ArrayList<String> list = new ArrayList<String>();
+ 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) {
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;
return binaryVersion;
}
- protected ArrayList<VMProperty> vmsList = new ArrayList<VMProperty>();
- 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<VMProperty> 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);
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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;
- }
-}
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;
private VMProperty customDefaultProperty;
private List<IOption> customOptionList;
- protected ArrayList<BaseImage> imageList = new ArrayList<BaseImage>();
- 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;
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<BaseImage> getImageList() {
- return imageList;
- }
-
public String getName() {
return platformName;
}
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()) {
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * 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<Platform> platformList = null;
-
- public static ArrayList<Platform> getPlatformList() {
- return platformList;
- }
-
- private static ArrayList<CustomPlatform> customList = new ArrayList<CustomPlatform>();
-
- private static ArrayList<String> profileList = new ArrayList<String>();
-
- public static ArrayList<CustomPlatform> 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<Platform>();
-
- 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<String> currentPathList = new ArrayList<String>();
- 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<IOption> getOptionList(VMProperty property) {
- List<IOption> 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;
- }
-}
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) {
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;
private DetailViewPage modifyView = null;
private boolean isModifyMode = false;
- private boolean isChnagePlatform = false;
private boolean isChangeProfile = false;
public VMsDetailView(Composite parent) {
init(WIDTH, HEIGHT);
}
- public void changePlatform() {
- isChnagePlatform = true;
- }
-
public void changeProfile() {
isChangeProfile = true;
}
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;
});
}
- 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) {
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);
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;
return detailView.isModifyMode();
}
- private Platform currentPlatform = null;
- private BaseImage currentImage = null;
private Profile currentProfile = null;
private VMProperty currentProperty = null;
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;
}
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;
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;
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;
public class VMNameViewItem extends TextViewItem{
Canvas canvas;
- private boolean isStandard;
public VMNameViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
super(template, lineLabelViewItem);
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;
- }
-
}
protected String name;
- private String oldValue;
+ //private String oldValue;
private String newValue;
// for Info view
protected String name;
- private boolean oldValue;
+ //private boolean oldValue;
private boolean newValue;
public static String VALUE_ON = "on";
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;
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;
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) {
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);
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<TreeItem> createItems = new ArrayList<TreeItem>();
private Map<String, TreeItem> itemsMap = new HashMap<String, TreeItem>();
@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<VMProperty> 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;
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;
}
}
- 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) {
dateItem.setSelection(false);
}
}
- @Override
- public void drawPlatform(Platform platform, int imageIndex) {
- VMsMainView.getInstance().drawVMList(imageIndex);
- }
@Override
public void drawProfile(Profile profile) {
}
@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();
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;
}
@Override
- public void drawPlatform(Platform platform, int imageIndex) {
- VMsMainView.getInstance().drawVMList(imageIndex);
- }
-
- @Override
public void drawProfile(Profile profile) {
VMsMainView.getInstance().drawVMList(profile);
}
}
}
- //private ArrayList<TreeItem> createItems = new ArrayList<TreeItem>();
- //private ArrayList<TreeItem> typeItems = new ArrayList<TreeItem>();
- //private Map<String, TreeItem> itemsMap = new HashMap<String, TreeItem>();
- @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);
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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<PlatformTabItem> items
- = new ArrayList<PlatformTabItem>(5);
- private ArrayList<ImageButton> buttons
- = new ArrayList<ImageButton>(5);
-
- private ArrayList<ImageButton> rightButtons
- = new ArrayList<ImageButton>(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;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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;
- }
-}
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 {
}
} 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;
}
}
}