import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.FileDialog;
import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.Profile;
import org.tizen.emulator.manager.platform.ProfileList;
import org.tizen.emulator.manager.ui.widgets.ImageCombo;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
import org.tizen.emulator.manager.vms.SKIN_SHAPE;
import org.tizen.emulator.manager.vms.VMPropertyValue;
import org.tizen.emulator.manager.vms.helper.HelperClass;
fd.setText(String.format("Select existing Base Image"));
String[] filter = null;
String[] filterName = null;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- filter = new String[] { "*.x86", "*.arm" };
- filterName = new String[] { "Disk Image Files(*.x86)",
- "Disk Image Files(*.arm)" };
- } else {
- filter = new String[] { "*.x86" };
- filterName = new String[] { "Disk Image Files(*.x86)" };
- }
+ filter = new String[] { "*.x86" };
+ filterName = new String[] { "Disk Image Files(*.x86)" };
fd.setFilterExtensions(filter);
fd.setFilterNames(filterName);
}
String newPathName = path.substring(
path.lastIndexOf(File.separator) + 1, path.length());
- // for arm emulator
- boolean isArm = newPathName.endsWith("arm");
- EmulatorVMList.getInstance().CustomArch = !isArm ? "x86"
- : "arm";
-
BaseImageItem newItem = new BaseImageItem(newPathName,
newPathName, newPath, profile, "", false, SKIN_SHAPE.NONE);
addToBaseImageItemList(newItem);
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.tool.CheckEmulatorDir;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
-
public class EmulatorVMList {
- static EmulatorVMList instance = null;
- static JAXBContext context = null;
+ static private EmulatorVMList instance = null;
+ static private JAXBContext context = null;
+ static private String vmsConfigDirectory = "";
+
+ private List<VMProperty> propertiesList = new ArrayList<VMProperty>();
+ private ObjectFactory objectFactory = new ObjectFactory();
static {
synchronized(EmulatorVMList.class) {
}
}
- static String vmsConfigDirectory = "";
-
- public String CustomArch = "x86";
-
public static void makeSDKDataPath(String vmsPath) {
vmsConfigDirectory = vmsPath;
File vmsFolder = new File (vmsPath);
}
}
- List<VMProperty> propertiesList = new ArrayList<VMProperty>();
-
- ObjectFactory objectFactory = new ObjectFactory();
-
public static EmulatorVMList getInstance() {
return instance;
}
}
}
}
- loadOldVersionProperties();
}
- private void loadOldVersionProperties() {
- if (CheckEmulatorDir.CheckOldEmulatorVmsDir()) {
- // traverse VMs...
- File vmsDirectory = new File(FilePathResources.getOldSdkDataVmsPath());
- String configFilename = null;
- File configFile = null;
- VMProperty property = null;
- File[] files = vmsDirectory.listFiles(new FileFilter() {
- @Override
- public boolean accept(File pathname) {
- if(!pathname.isDirectory()) {
- return false;
- }
- return true;
- }
- });
-
- for(File vm : files) {
- configFilename = StringResources.PROPERTY_XML_NAME;
- configFile = new File(vm, configFilename);
- if(!configFile.exists()) {
- EMLogger.getLogger().info(StringResources.PROPERTY_XML_NAME + " file dose not exist."
- + StringResources.NEW_LINE + "VM Path: " + configFile.getAbsolutePath());
- continue ; // FIXME
- }
+ public VMProperty parseXML(File configFile) {
+ JAXBElement<EmulatorConfiguration> element = null;
- property = parseXML(configFile);
- if (property != null) {
- // check duplicate name
- boolean isDuplicated = false;
- for (VMProperty prop : propertiesList) {
- if (prop.getName().equals(property.getName())) {
- EMLogger.getLogger().warning(property.getName() + " is exist already."
- + StringResources.NEW_LINE + "Check vms path: " + FilePathResources.getOldSdkDataVmsPath());
- isDuplicated = true;
- break;
- }
- }
- if (!isDuplicated) {
- propertiesList.add(property);
- }
- }
- }
+ try {
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ element = unmarshaller.unmarshal(new StreamSource(configFile), EmulatorConfiguration.class);
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ EMLogger.getLogger().warning("Can not load config file( "
+ + configFile.getName() + ")" + StringResources.NEW_LINE + e.getMessage());
+ return null;
}
+
+ return new VMProperty(configFile, element.getValue());
}
- public VMProperty parseXML(File configFile) {
+ public EmulatorConfiguration parseXML(VMProperty prop) {
JAXBElement<EmulatorConfiguration> element = null;
+ File configFile = prop.getPropertyFile();
try {
Unmarshaller unmarshaller = context.createUnmarshaller();
return null;
}
- return new VMProperty(configFile, element.getValue());
+ return element.getValue();
}
public VMProperty getProperty(String name) {
return propertiesList.toArray(new VMProperty[propertiesList.size()]);
}
+ public void addProperty(VMProperty prop) {
+ if (prop != null) {
+ propertiesList.add(prop);
+ }
+ }
+
public boolean storeXML(VMProperty property) {
return storeXML(property, null);
}
return new VMProperty(configFile, ec);
}
-
- // for testing "load properties"...
- /*
- public static void main(String[] args) {
- EmulatorVMs fsImage = EmulatorVMs.getInstance();
- try {
- fsImage.loadProperties();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- for(VMsProperty property : fsImage.getProperties()) {
- System.out.println(property.getName());
- }
-
- VMsProperty property = fsImage.getNewProperty("test6");
- fsImage.storeXML(property);
- }
- */
}