BaseImageViewItem : delete 'BaseImageItem' class
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 2 Jun 2015 05:39:25 +0000 (14:39 +0900)
committerjihye424.kim <jihye424.kim@samsung.com>
Fri, 5 Jun 2015 01:33:14 +0000 (10:33 +0900)
- 'BaseImage' class replace 'BaseImageItem' class
- Set default value of VMPropertyValue
- Delete base image related variables in VMPropertyValue

Change-Id: I3527032b42ad150cddcff4b7902a038d2fa6cc28
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
17 files changed:
src/org/tizen/emulator/manager/console/ConsoleCreateVM.java
src/org/tizen/emulator/manager/platform/Profile.java
src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java
src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java
src/org/tizen/emulator/manager/ui/detail/item/property/CPUSupportSubViewItem.java
src/org/tizen/emulator/manager/ui/detail/item/property/GPUSupportSubViewItem.java
src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItemWin.java
src/org/tizen/emulator/manager/ui/detail/item/property/SkinSubViewItem.java
src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java
src/org/tizen/emulator/manager/ui/widgets/CommonVMButtonPainter.java
src/org/tizen/emulator/manager/ui/widgets/VMCreateButton.java
src/org/tizen/emulator/manager/vms/Creator.java
src/org/tizen/emulator/manager/vms/Modifier.java
src/org/tizen/emulator/manager/vms/VMLauncher.java
src/org/tizen/emulator/manager/vms/VMPropertyValue.java
src/org/tizen/emulator/manager/vms/VMWorkerCommon.java
src/org/tizen/emulator/manager/vms/option/CommonOption.java

index 178cb4d..430a227 100644 (file)
@@ -156,9 +156,10 @@ public class ConsoleCreateVM {
                                                checkVMName(c.getCurrentValue());
                                                property.vmsName = c.getCurrentValue();
                                        } else if (c.getShortName() == "c") {
-                                               property.baseImagePath = checkImagePath(c.getCurrentValue());
-                                               if (property.baseImagePath.endsWith(".x86")) {
-                                                       property.archType = "x86";
+                                               String path = checkImagePath(c.getCurrentValue());
+                                               if (path.endsWith(".x86")) {
+                                                       Platform platform = property.baseImage.getPlatform();
+                                                       property.baseImage = new BaseImage(platform, path);
                                                } else {
                                                        throw new ConsoleException("Avaliable format of base image is .x86 or .arm.");
                                                }
@@ -354,10 +355,10 @@ public class ConsoleCreateVM {
                        }
                }
                else if (c.getLongName() == Actions.OP_VIRTUALIZATION) {
-                       prop.isHWVirtualization = checkHWVirtualization(c.getCurrentValue(), prop.archType.equals("arm"));
+                       prop.isHWVirtualization = checkHWVirtualization(c.getCurrentValue(), false);
                }
                else if (c.getLongName() == Actions.OP_GLACCELERATION) {
-                       prop.isGLAcceleration = checkGLAcceleration(c.getCurrentValue(), prop.archType.equals("arm"));
+                       prop.isGLAcceleration = checkGLAcceleration(c.getCurrentValue(), false);
                }
                else if (c.getLongName() == Actions.OP_MAXTOUCH) {
                        int i = Integer.valueOf(c.getCurrentValue());
index a9eca64..0bf1e98 100644 (file)
@@ -89,12 +89,14 @@ public class Profile {
                                return image;
                        }
                }
+               /*
                // return custom base image
                Platform platform = ProfileList.getProfile(createProperty.getImageProfile()).
                                getPlatformByVersion(createProperty.getImageVersion());
                if (platform != null) {
                        return new BaseImage(platform, createProperty.getBaseImagePath());
                }
+               */
                return null;
        }
 
index 6915698..e684562 100644 (file)
@@ -315,14 +315,14 @@ class ViewItemList {
                if (platform != propertyValue.baseImage.getPlatform()) {
                        return false;
                } else {
-                       if (imageName != null && !imageName.equals(propertyValue.baseName)) {
+                       if (imageName != null && !imageName.equals(propertyValue.baseImage.getName())) {
                                return false;
                        }
                }
-               if (isCustom &&  propertyValue.isStandard) {
+               if (isCustom &&  propertyValue.baseImage.isStandard()) {
                        return false;
                }
-               if (!isCustom && !propertyValue.isStandard) {
+               if (!isCustom && !propertyValue.baseImage.isStandard()) {
                        return false;
                }
 
index cf82ce2..500153c 100644 (file)
@@ -45,7 +45,9 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.FileDialog;
 import org.tizen.emulator.manager.EmulatorManager;
+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.platform.ProfileList;
 import org.tizen.emulator.manager.resources.FontResources;
@@ -60,42 +62,35 @@ import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 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.SKIN_SHAPE;
 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 BaseImageViewItem extends ComboViewItem {
 
-       Button addButton;
        protected static int BUTTON_WIDTH = 38;
        protected static int BUTTON_HEIGHT = 20;
        protected static int COMBOBOX_WIDTH_MODIFY = 133;
 
+       protected Button addButton;
        protected FileDialog fd;
        protected List<String> filters = new ArrayList<String>();
 
-       private BaseImageItem currentBaseImageItem = new BaseImageItem();
-
+       // For base image combo
        private boolean isSelected;
-
-       private List<BaseImageItem> baseImageItemList = new ArrayList<BaseImageItem>();
-
+       private BaseImage currentBaseImage = null;
+       private List<BaseImage> baseImageList = new ArrayList<BaseImage>();
        // Remember custom image list while emulator manager life-cycle.
-       private static List<BaseImageItem> customImageItemList = new ArrayList<BaseImageItem>();
+       //private static List<BaseImage> customBaseImageList = new ArrayList<BaseImage>();
 
        // For disable state.
        protected ImageLabel filePathLabel;
        private Image IMAGE_INPUTBOX_IMAGE = null;
        protected int DIR_INPUTBOX_ON_WIDTH     = 133;
 
-
-       // For itemlist change
+       // For item list change
        private VMPropertyValue value;
 
-       // For custom image add.
-       private String profile;
-
        public BaseImageViewItem(Item template,
                        LineLabelViewItem lineLabelViewItem) {
                super(template, lineLabelViewItem);
@@ -103,21 +98,16 @@ public class BaseImageViewItem extends ComboViewItem {
 
        @Override
        public void setValue(VMPropertyValue value) {
-               value.baseImagePath = currentBaseImageItem.getFilePath();
-               value.baseImagePathName = currentBaseImageItem.getFileName();
-               value.isStandard = currentBaseImageItem.isStandard();
-               value.baseName = currentBaseImageItem.getImageName();
-               value.version = value.isStandard ?
-                               currentBaseImageItem.getVersion() : getLatestVersion(value.profile);
-               value.skinShape = currentBaseImageItem.getSkinShape();
+               value.baseImage = currentBaseImage;
+               value.baseImagePath = currentBaseImage.getPath();
        }
 
        @Override
        public boolean settingDetailItem(VMPropertyValue value) {
                if (valueLabel != null) {
-                       valueLabel.setText(value.baseName);
-                       if (!value.isStandard) {
-                               valueLabel.setToolTipText(value.baseImagePath);
+                       valueLabel.setText(value.baseImage.getName());
+                       if (!value.baseImage.isStandard()) {
+                               valueLabel.setToolTipText(value.baseImage.getPath());
                        }
                }
                return true;
@@ -125,7 +115,6 @@ public class BaseImageViewItem extends ComboViewItem {
 
        @Override
        public void drawModify() {
-
                // Disable label
                if (IMAGE_INPUTBOX_IMAGE == null) {
                        IMAGE_INPUTBOX_IMAGE = PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH);
@@ -183,8 +172,7 @@ public class BaseImageViewItem extends ComboViewItem {
                data.height = BUTTON_HEIGHT;
                addButton.setLayoutData(data);
 
-
-               // make combobox list
+               // make combo box list
                addWidgetListener();
 
        }
@@ -194,11 +182,9 @@ public class BaseImageViewItem extends ComboViewItem {
                combo.addSelectionListener(new SelectionListener() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-//                             newValue = combo.getText();
-
                                // Select image.
                                int index = combo.getSelectionIndex();
-                               changePropertyView(baseImageItemList.get(index));
+                               changePropertyView(baseImageList.get(index));
                                if(isCreateMode()) {
                                        getListener().changeCreateConfirmButton();
                                }
@@ -233,19 +219,21 @@ public class BaseImageViewItem extends ComboViewItem {
                                                return;
                                        }
                                        String newPath = path;
-                                       String newPathName = path.substring(
-                                                       path.lastIndexOf(File.separator) + 1, path.length());
-
-                                       BaseImageItem newItem = new BaseImageItem(newPathName,
-                                                       newPathName, newPath, profile, "", false, SKIN_SHAPE.NONE);
-                                       addToBaseImageItemList(newItem);
-                                       storeCustomImage(newItem);
-                                       resetComboList();
-                                       changePropertyView(newItem);
-
-                                       isSelected = true;
-                                       getListener().changeCreateConfirmButton();
 
+                                       BaseImage newItem;
+                                       newItem = new BaseImage(ProfileList.getProfile(currentBaseImage.getProfile()).getPlatformByLatestVersion(), newPath);
+                                       if (storeCustomImage(newItem)) {
+                                               baseImageList.add(newItem);
+                                               resetComboList();
+                                               changePropertyView(newItem);
+                                               isSelected = true;
+                                               getListener().changeCreateConfirmButton();
+                                       } else {
+                                               EMLogger.getLogger().warning("Failed to store 'Custom Base Image'");
+                                               new MessageDialog()
+                                               .openWarningDialog("Failed to store 'Custom Base Image'");
+                                               return;
+                                       }
                                }
                        }
 
@@ -259,12 +247,8 @@ public class BaseImageViewItem extends ComboViewItem {
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
                this.value = value;
-               this.profile = value.profile;
 
-               currentBaseImageItem.setValue(value);
-               if (!value.isStandard) {
-                       storeCustomImage(currentBaseImageItem);
-               }
+               currentBaseImage = value.baseImage;
 
                isSelected = false;
 
@@ -273,22 +257,21 @@ public class BaseImageViewItem extends ComboViewItem {
                        filePathLabel.setVisible(false);
                        combo.setVisible(true);
                        addButton.setEnabled(true);
-                       loadBaseImageItemList(value.profile);
-                       loadCustomImageItemList(value.profile);
+                       loadBaseImageList(value.baseImage.getProfile());
+                       //loadCustomBaseImageList(value.baseImage.getProfile());
                        resetComboList();
-
                } else {
                        combo.removeAll();
-                       combo.add(value.baseName);
+                       combo.add(value.baseImage.getName());
                        combo.select(0);
-                       combo.setText(value.baseName);
+                       combo.setText(value.baseImage.getName());
                        combo.setEnabled(false);
                        addButton.setEnabled(false);
                        isSelected = true;
                        combo.setVisible(false);
 
-                       filePathLabel.setText(value.baseName);
-                       filePathLabel.setToolTipText(currentBaseImageItem.getFileName());
+                       filePathLabel.setText(value.baseImage.getName());
+                       filePathLabel.setToolTipText(currentBaseImage.getPath());
                        filePathLabel.setVisible(true);
                        filePathLabel.setEnabled(false);
                        filePathLabel.redraw();
@@ -301,63 +284,39 @@ public class BaseImageViewItem extends ComboViewItem {
                return false;
        }
 
-       public static String getLatestVersion(String profileName) {
-               Profile profile = ProfileList.getProfile(profileName);
-               if (profile != null) {
-                       return profile.getLatestPlatformVersion();
-               }
-               return "";
-       }
-
-       private void changePropertyView(BaseImageItem item) {
-               currentBaseImageItem = item;
+       private void changePropertyView(BaseImage item) {
+               currentBaseImage = item;
+               value.baseImage = item;
+               value.baseImagePath = item.getPath();
                setValue(value);
                getListener().changePropertyView(value, isCreateMode());
        }
 
-       private void loadBaseImageItemList(String profileName) {
-               baseImageItemList.clear();
+       private void loadBaseImageList(String profileName) {
+               baseImageList.clear();
                Profile profile = ProfileList.getProfile(profileName);
                if (profile != null) {
                        for (BaseImage img : profile.getImageList()) {
-                               addToBaseImageItemList(new BaseImageItem(img.getName(), img
-                                               .getPathName(), img.getPath(), img.getProfile(), img.getVersion(),
-                                               true, img.getSkinShape()));
-                       }
-               }
-       }
-
-       private void loadCustomImageItemList(String profile) {
-               for (BaseImageItem customImageItem : customImageItemList) {
-                       if (customImageItem.getProfile().equals(profile)) {
-                               addToBaseImageItemList(new BaseImageItem(customImageItem));
+                               if (img.getPlatform().getPlugin() != null
+                                               && img.getItemList() != null) {
+                                       baseImageList.add(img);
+                               }
                        }
                }
        }
-
-       private void addToBaseImageItemList(BaseImageItem baseImageItem) {
-               // Check duplicated custom image.
-               int index = -1;
-               for (int i = 0; i < baseImageItemList.size(); i++) {
-                       BaseImageItem item = baseImageItemList.get(i);
-                       if (item.equals(baseImageItem)) {
-                               index = i;
-                               break;
-                       }
-               }
-
-               if (index == -1) {
-                       // Add to image list
-                       if (checkBaseImageFile(baseImageItem.getFilePath())) {
-                               baseImageItemList.add(baseImageItem);
+/*
+       private void loadCustomBaseImageList(String profile) {
+               for (BaseImage custom : customBaseImageList) {
+                       if (custom.getProfile().equals(profile)) {
+                               baseImageList.add(custom);
                        }
                }
        }
-
-       private void storeCustomImage(BaseImageItem customImageItem) {
+*/
+       private boolean storeCustomImage(BaseImage customImageItem) {
                int index = -1;
-               for (int i = 0; i < customImageItemList.size(); i++) {
-                       BaseImageItem item = customImageItemList.get(i);
+               for (int i = 0; i < customImageItem.getPlatform().getProfileClass().getImageList().size(); i++) {
+                       BaseImage item = customImageItem.getPlatform().getProfileClass().getImageList().get(i);
                        if (item.equals(customImageItem)) {
                                index = i;
                                break;
@@ -365,10 +324,13 @@ public class BaseImageViewItem extends ComboViewItem {
                }
 
                if (index == -1) {
-                       if (checkBaseImageFile(customImageItem.getFilePath())) {
-                               customImageItemList.add(new BaseImageItem(customImageItem));
+                       if (checkBaseImageFile(customImageItem.getPath())) {
+                               customImageItem.getPlatform().getProfileClass().addBaseImage(customImageItem);
+                       } else {
+                               return false;
                        }
                }
+               return true;
        }
 
        private void resetComboList() {
@@ -377,24 +339,24 @@ public class BaseImageViewItem extends ComboViewItem {
                }
 
                // make combo box list
-               for (BaseImageItem item : baseImageItemList) {
-                       combo.add(item.getImageName());
+               for (BaseImage item : baseImageList) {
+                       combo.add(item.getName());
                }
 
                // Select combo-box item.
                int index = -1;
-               for (int i = 0; i < baseImageItemList.size(); i++) {
-                       if (baseImageItemList.get(i).equals(currentBaseImageItem)) {
+               for (int i = 0; i < baseImageList.size(); i++) {
+                       if (baseImageList.get(i).getPath().equals(currentBaseImage.getPath())) {
                                index = i;
                                break;
                        }
                }
-               if (baseImageItemList.size() > 0) {
+               if (baseImageList.size() > 0) {
                        if (index == -1) { // if value not matches..
                                index = 0;
                        }
                        combo.select(index);
-                       currentBaseImageItem = baseImageItemList.get(index);
+                       currentBaseImage = baseImageList.get(index);
                        isSelected = true;
                }
                combo.setEnabled(true);
@@ -405,11 +367,15 @@ public class BaseImageViewItem extends ComboViewItem {
                itemState.setNormal();
 
                if (isSelected) {
-                       File f = new File(currentBaseImageItem.getFilePath());
+                       File f = new File(currentBaseImage.getPath());
                        if (!f.exists()) {
                                itemState.setError("Base image file is not exist.");
                        }
 
+                       Platform platform = currentBaseImage.getPlatform();
+                       if (platform != null && platform.getPlugin() == null) {
+                               itemState.setError("Failed to load plugin");
+                       }
                } else {
                        itemState.setError("Please select base image file.");
                }
@@ -442,123 +408,4 @@ public class BaseImageViewItem extends ComboViewItem {
                return true;
        }
 
-}
-
-class BaseImageItem {
-
-       private String imageName;
-       private String fileName;
-       private String filePath;
-       private String profile;
-       private String version;
-       private boolean isStandard;
-       private SKIN_SHAPE skinShape;
-
-       public BaseImageItem() {
-       }
-
-       public BaseImageItem(String imageName, String fileName, String path,
-                       String profile, String version, boolean isStandard, SKIN_SHAPE skinShape) {
-               this.imageName = imageName;
-               this.fileName = fileName;
-               this.filePath = path;
-               this.profile = profile;
-               this.version = version;
-               this.isStandard = isStandard;
-               this.skinShape = skinShape;
-       }
-
-       public BaseImageItem(BaseImageItem item) {
-               this(item.getImageName(), item.getFileName(), item.getFilePath(),
-                               item.getProfile(), item.getVersion(), item.isStandard(), item.getSkinShape());
-       }
-
-       public String getImageName() {
-               return imageName;
-       }
-
-       public void setValue(VMPropertyValue value) {
-               setFileName(value.baseImagePathName);
-               setFilePath(value.baseImagePath);
-               setStandard(value.isStandard);
-               setImageName(value.baseName);
-               setProfile(value.profile);
-               setSkinShape(value.skinShape);
-               setVersion(value.version);
-       }
-
-       public void setImageName(String imageName) {
-               this.imageName = imageName;
-       }
-
-       public String getFileName() {
-               return fileName;
-       }
-
-       public void setFileName(String fileName) {
-               this.fileName = fileName;
-       }
-
-       public String getFilePath() {
-               return filePath;
-       }
-
-       public void setFilePath(String path) {
-               this.filePath = path;
-       }
-
-       public String getProfile() {
-               return profile;
-       }
-
-       public void setProfile(String profile) {
-               this.profile = profile;
-       }
-
-       public String getVersion() {
-               return version;
-       }
-
-       public void setVersion(String version) {
-               this.version = version;
-       }
-
-       public boolean isStandard() {
-               return isStandard;
-       }
-
-       public void setStandard(boolean isStandard) {
-               this.isStandard = isStandard;
-       }
-
-       public SKIN_SHAPE getSkinShape() {
-               return skinShape;
-       }
-
-       public void setSkinShape(SKIN_SHAPE skinShape) {
-               this.skinShape = skinShape;
-       }
-
-       @Override
-       public boolean equals(Object object) {
-               if (!(object instanceof BaseImageItem)) {
-                       return false;
-               }
-               BaseImageItem item = (BaseImageItem)object;
-
-               if (!item.getFilePath().equals(filePath)) {
-                       return false;
-               }
-
-               if (!item.getProfile().equals(profile)) {
-                       return false;
-               }
-
-               if (!item.getImageName().equals(imageName)) {
-                       return false;
-               }
-
-               return true;
-       }
-
-}
+}
\ No newline at end of file
index 8dbcbeb..fa9bd9c 100644 (file)
@@ -58,10 +58,7 @@ public class CPUSupportSubViewItem extends OnOffSubViewItem {
 
        @Override
        public boolean settingDetailItem(VMPropertyValue value) {
-               isArm = value.archType.equals("arm");
-
-               if (!CheckVirtualization.getInstance().isSupportVirtualization()
-                               || isArm) {
+               if (!CheckVirtualization.getInstance().isSupportVirtualization()) {
                        valueLabel.setText(StringResources.DISABLED);
                        valueLabel.setToolTipText(CPUDisableToolTipText);
                } else {
@@ -76,12 +73,7 @@ public class CPUSupportSubViewItem extends OnOffSubViewItem {
 
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
-               isArm = value.archType.equals("arm");
-               if (parentItem.isCreateMode() && isArm) {
-                       newValue  = oldValue  = false;
-               } else {
-                       newValue = oldValue  = value.isHWVirtualization;
-               }
+               newValue = oldValue  = value.isHWVirtualization;
 
                if (!CheckVirtualization.getInstance().isSupportVirtualization()
                                || isArm) {
index 9522a3d..094a3ef 100644 (file)
@@ -95,10 +95,7 @@ public class GPUSupportSubViewItem extends OnOffSubViewItem {
 
        @Override
        public boolean settingDetailItem(VMPropertyValue value) {
-               isArm = value.archType.equals("arm");
-
-               if (!CheckVirtualization.getInstance().isSupportGPU()
-                               || isArm) {
+               if (!CheckVirtualization.getInstance().isSupportGPU()) {
                        valueLabel.setText(StringResources.DISABLED);
                        valueLabel.setToolTipText(GPUDisableToolTipText);
                } else {
@@ -112,12 +109,7 @@ public class GPUSupportSubViewItem extends OnOffSubViewItem {
 
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
-               isArm = value.archType.equals("arm");
-               if (parentItem.isCreateMode() && isArm) {
-                       newValue = oldValue  = false;
-               } else {
-                       oldValue = newValue = value.isGLAcceleration;
-               }
+               oldValue = newValue = value.isGLAcceleration;
 
                if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) {
                        onOffButton.setEnabled(false);
index f00af9b..f41436c 100644 (file)
@@ -167,7 +167,7 @@ public class NetTapDeviceViewItemWin extends ComboViewItem {
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
                oldValue = newValue = value.getAdvancedOptionValue(name);
-               platformVersion = value.version;
+               platformVersion = value.baseImage.getVersion();
                // text.setText(newValue);
 
                AdvancedViewItem item = lineLabelViewItem
index 0b5ffe6..0c6515b 100644 (file)
@@ -126,7 +126,7 @@ public class SkinSubViewItem extends ComboSubViewItem {
 
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
-               imageSkinShape = value.skinShape;
+               imageSkinShape = value.baseImage.getSkinShape();
                newSkin = oldSkin = value.skin;
                skinList = value.baseImage.getPlatform().getSkins();
 
index 031b596..0ca8f43 100644 (file)
@@ -207,8 +207,8 @@ public class VMNameViewItem extends TextViewItem{
        // ex) "m-0626-1"
        private String getDefaultVMName(VMPropertyValue value) {
                StringBuilder sb = new StringBuilder();
-               sb.append(value.profile.substring(0,1).toLowerCase());
-               if (!value.isStandard) {
+               sb.append(value.baseImage.getProfile().substring(0,1).toLowerCase());
+               if (!value.baseImage.isStandard()) {
                        sb.append("c");
                }
                sb.append("-");
index 2deec55..ef951f7 100644 (file)
@@ -81,7 +81,7 @@ public abstract class CommonVMButtonPainter implements PaintListener {
                        }
 
                        // If VM is custom,
-                       if (!button.getProperty().getPropertyValue().isStandard) {
+                       if (!button.getProperty().getPropertyValue().baseImage.isStandard()) {
                                if (state == WSTATE.HOVER || state == WSTATE.SELECTED_HOVER) {
                                        image = PluginImageResources.VM_IMAGE_CUSTOM_HOVER
                                                        .getImage(button.getPlatformName(), skinShape);
index 2a0e4da..2088a3a 100644 (file)
@@ -11,7 +11,7 @@ import org.tizen.emulator.manager.platform.Platform;
 import org.tizen.emulator.manager.plugin.PluginImageResources;
 
 public class VMCreateButton extends VMButton {
-       private VMCreateButton button;
+       //private VMCreateButton button;
 
        public VMCreateButton(Composite parent, int style, Platform platform) {
                super(parent, style, platform, null);
@@ -29,7 +29,7 @@ public class VMCreateButton extends VMButton {
                                PluginImageResources.VM_IMAGE_CREATE.getImage(platformName)); //selected_hover
 
                this.addPaintListener(CreateButtonPaintListener);
-               button = this;
+               //button = this;
        }
 
        @Override
index 866a46b..db41635 100644 (file)
@@ -105,7 +105,7 @@ public class Creator {
                        // Save last created property file.
                        boolean isCreated = false;
                        File f = null;
-                       Profile p = ProfileList.getProfile(newVM.profile);
+                       Profile p = ProfileList.getProfile(newVM.baseImage.getProfile());
                        if (p != null) {
                                f = new File(p.getLastCreatedPropertyPath());
                                if (!f.exists()) {
@@ -170,7 +170,7 @@ public class Creator {
                checkCustomBaseImage(newVM.baseImagePath);
 
                customPath = folder.getAbsolutePath() + File.separator + "emulimg-" +
-                               newVM.vmsName + "." + newVM.archType.toString();
+                               newVM.vmsName + "." + newVM.baseImage.getCpu();
 
                createInitialVMImageInternal(newVM.baseImagePath, customPath);
 
@@ -282,34 +282,31 @@ public class Creator {
                ec.setDevice(factory.createDeviceType());
 
                ec.getBaseInformation().setName(newVM.vmsName);
-               ec.getBaseInformation().setArchitecture(newVM.archType.toString());
+               ec.getBaseInformation().setArchitecture(newVM.baseImage.getCpu());
 
                ec.getBaseInformation().setDiskImage(factory.createBaseInformationTypeDiskImage());
-               if (newVM.isStandard) {
+               if (newVM.baseImage.isStandard()) {
                        ec.getBaseInformation().getDiskImage().setType("standard");
                } else {
                        ec.getBaseInformation().getDiskImage().setType("custom");
                }
 
-               // TODO : get version
-               if (newVM.version != null) {
-                       ec.getBaseInformation().getDiskImage().setVersion(newVM.version);
+               if (newVM.baseImage.getVersion() != null) {
+                       ec.getBaseInformation().getDiskImage().setVersion(newVM.baseImage.getVersion());
                } else {
-                       // TODO : temp name
                        ec.getBaseInformation().getDiskImage().setVersion("Standard");
                }
-               if (newVM.baseName != null) {
-                       ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
+               if (newVM.baseImage.getName() != null) {
+                       ec.getBaseInformation().getDiskImage().setBase(newVM.baseImage.getName());
                }
 
                //
-               ec.getBaseInformation().getDiskImage().setProfile(newVM.profile);
+               ec.getBaseInformation().getDiskImage().setProfile(newVM.baseImage.getProfile());
                ec.getBaseInformation().getDiskImage().setBaseDiskImage(factory.createDiskImageFormatType());
                ec.getBaseInformation().getDiskImage().setCurrentDiskImage(factory.createDiskImageFormatType());
                // TODO :
                ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2");
                ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath);
-               ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
 
                if (!newVM.baseImage.getBinaryVersion().isEmpty()) {
                        ec.getBaseInformation().getDiskImage().getBaseDiskImage().setVersion(newVM.baseImage.getBinaryVersion());
index bbee954..bd4526b 100644 (file)
@@ -129,9 +129,9 @@ public class Modifier {
                        }
                }
 
-               if (newVM.baseName != null) { // baseName can be modified only in Custom VM.
-                       if (!newVM.baseName.equals(oldVM.baseName)) {
-                               property.getConfiguration().getBaseInformation().getDiskImage().setBase(newVM.baseName);
+               if (newVM.baseImage != null) { // baseName can be modified only in Custom VM.
+                       if (!newVM.baseImage.getName().equals(oldVM.baseImage.getName())) {
+                               property.getConfiguration().getBaseInformation().getDiskImage().setBase(newVM.baseImage.getName());
                        }
                }
 
index bf51bb3..4a2dea1 100644 (file)
@@ -32,7 +32,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.logging.Level;
 
 import org.eclipse.swt.widgets.Display;
@@ -64,7 +63,7 @@ public class VMLauncher {
 
                CheckingRunningEmulator.addEmulator(property);
                MonitoringEmulator monitor = new MonitoringEmulator(property);
-               Process process = launch(property.getName(), property.getPropertyValue().version,
+               Process process = launch(property.getName(), property.getPropertyValue().baseImage.getVersion(),
                                cmd, path);
                if (process != null) {
                        monitor.setProcess(process);
@@ -101,7 +100,7 @@ public class VMLauncher {
 
        private static List<String> getCommand(VMProperty property)
                        throws VMLauncherException {
-               String binaryPath = FilePathResources.getEmulatorBinPath(property.getPropertyValue().version)
+               String binaryPath = FilePathResources.getEmulatorBinPath(property.getPropertyValue().baseImage.getVersion())
                                + File.separator + getBinary();
                String configPath = LaunchConfig
                                .getLaunchConfigPath(property.getName());
index 4726a6b..1ab0b75 100644 (file)
@@ -37,7 +37,6 @@ import java.util.List;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.BaseImage;
-import org.tizen.emulator.manager.platform.PlatformStringResources;
 import org.tizen.emulator.manager.platform.Skin;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
@@ -52,34 +51,27 @@ import org.tizen.emulator.manager.vms.xml.TouchType;
 public class VMPropertyValue implements Cloneable {
        public BaseImage baseImage;
        public VMProperty template;
-       public String vmsName;
+       public String vmsName = "";
 
-       public String archType;
-       public String profile;
-       public String version;          // BaseImage version(=platform)
-       public String baseName;         // BaseImage name
-       public boolean isStandard;
        public String baseImagePath;
-       public String baseImagePathName;
-       public SKIN_SHAPE skinShape = SKIN_SHAPE.SQUARE;
 
-       public RESOLUTION resolution;
-       public int dpi;
+       public RESOLUTION resolution = RESOLUTION.HD;
+       public int dpi  = RESOLUTION.HD.getDPI();
        public int keyType;
        public Skin skin;
-       public String skinPath;
+       public String skinPath = "";
 
-       public int ramSize;
-       public int cpu;
+       public int ramSize = 512;
+       public int cpu = 1;
 
        public boolean isFileShareSupport; 
-       public String fileSharePath;
-       public String fileSharePathName;
+       public String fileSharePath = "";
+       public String fileSharePathName = "";
 
        public boolean isHWVirtualization;
        public boolean isGLAcceleration;
-       public static int maxTouch = 10;
-       public int maxTouchCount;
+       public static int MAX_TOUCH = 10;
+       public int maxTouchCount = MAX_TOUCH;
        public OCI ociDevice;
 
        public String addOptions;
@@ -118,17 +110,7 @@ public class VMPropertyValue implements Cloneable {
                this.baseImage  = image;
                this.template   = template;
 
-               vmsName = "";
-
-               baseImagePath     = image.getPath();
-               baseImagePathName = image.getPathName();
-               archType        = image.getCpu();
-               profile = image.getProfile();
-               version         = image.getVersion();
-               baseName        = image.getName();
-               skinShape = image.getSkinShape();
-
-               isStandard      = image.isStandard();
+               baseImagePath = image.getPath();
 
                settingConfigure(template);
        }
@@ -145,22 +127,9 @@ public class VMPropertyValue implements Cloneable {
                        this.template = property;
 
                        vmsName         = property.getName();
-                       archType        = property.getArch().toString();
-
-                       if (property.getImageProfile() != null) {
-                               profile = property.getImageProfile();
-                       } else {
-                               profile = PlatformStringResources.MOBILE_PROFILE;
-                       }
-
-                       version = property.getConfiguration().getBaseInformation().getDiskImage().getVersion();
-                       baseName = property.getConfiguration().getBaseInformation().getDiskImage().getBase();
-                       isStandard = property.getConfiguration().getBaseInformation().getDiskImage().getType()
-                                               .equals("standard") ? true : false;
                        baseImagePath = property.getConfiguration().getBaseInformation().getDiskImage()
                                                .getBaseDiskImage().getValue();
-                       baseImagePathName = baseImagePath.substring
-                                               (baseImagePath.lastIndexOf(File.separator) + 1, baseImagePath.length());
+
 
                        settingConfigure(property);
                } else {
@@ -175,13 +144,7 @@ public class VMPropertyValue implements Cloneable {
                dest.template   = this.template;
                dest.vmsName    = this.vmsName;
 
-               dest.archType   = this.archType;
-               dest.profile    = this.profile;
-               dest.version    = this.version;
-               dest.baseName   = this.baseName;
-               dest.isStandard = this.isStandard;
                dest.baseImagePath              = this.baseImagePath;
-               dest.baseImagePathName  = this.baseImagePathName;
 
                dest.resolution         = this.resolution;
                dest.dpi                = this.dpi;
@@ -280,13 +243,14 @@ public class VMPropertyValue implements Cloneable {
                        return false;
                }
 
-               if (this.baseName != null) {
-                       if (dest.baseName == null
-                                       || (dest.baseName != null && !this.baseName.equals(dest.baseName))) {
+               if (this.baseImage != null) {
+                       if (dest.baseImage == null
+                                       || (dest.baseImage != null
+                                               && this.baseImage.getName().equals(dest.baseImage.getName()))) {
                                return false;
                        }
                } else {
-                       if (dest.baseName != null) {
+                       if (dest.baseImage.getName() != null) {
                                return false;
                        }
                }
index f1e6f8c..5300a62 100644 (file)
@@ -39,7 +39,6 @@ import java.util.List;
 import java.util.logging.Level;
 
 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.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
index f9c1b28..3077e79 100644 (file)
@@ -66,7 +66,7 @@ public class CommonOption extends Option {
                        config.addQemuOption("#-device virtconsole,chardev=virtcon1");
                }
 
-               String platformVersion = property.getPropertyValue().version;
+               String platformVersion = property.getPropertyValue().baseImage.getVersion();
                // bios
                config.addVariable(VAR_BIOS_PATH, FilePathResources.getEmulatorBiosPath(platformVersion));
                config.addQemuOption("-L", varForm(VAR_BIOS_PATH));