BaseImageDialog: make modify dialog
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 27 Oct 2015 04:11:28 +0000 (13:11 +0900)
committerJiHye Kim <jihye424.kim@samsung.com>
Thu, 29 Oct 2015 02:56:21 +0000 (11:56 +0900)
Change-Id: I0748c8fd677d3d08c5af99f80bdc8893ab15fab6
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/renewal/dialog/BaseImageCreateDialog.java
src/org/tizen/emulator/manager/ui/renewal/dialoghandler/BaseImageDialogHandler.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java

index a6c26a9..64ade03 100644 (file)
@@ -38,12 +38,11 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem
 import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 
 public class BaseImageCreateDialog extends ModifyDialog {
-       private final static String TITLE = "New Base Image";
        public final static int WIDTH = 484;
        private final static int HEIGHT = 305;
 
-       public BaseImageCreateDialog(Shell parent) {
-               super(parent, TITLE, WIDTH, HEIGHT);
+       public BaseImageCreateDialog(Shell parent, String title) {
+               super(parent, title, WIDTH, HEIGHT);
        }
 
        public void create(CustomBaseImageValue imageValue, List<ModifyDialogItem> itemList) {
index cea5511..b636669 100644 (file)
@@ -34,6 +34,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
+import org.tizen.emulator.manager.platform.BaseImage;
 import org.tizen.emulator.manager.platform.baseimage.CustomBaseImageValue;
 import org.tizen.emulator.manager.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.ui.renewal.dialog.BaseImageCreateDialog;
@@ -46,12 +47,25 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProfileItem;
 
 public class BaseImageDialogHandler {
        public static CustomBaseImageValue create() {
-               BaseImageCreateDialog dialog
-                       = new BaseImageCreateDialog(MainDialog.getShell());
-
-               dialog.setDialogMode(DIALOG_MODE.CREATE);
                CustomBaseImageValue value = new CustomBaseImageValue();
-               dialog.create(value, getDefaultItemList() );
+               value = openDialog("New Base Image", DIALOG_MODE.CREATE, value);
+
+               return value;
+       }
+
+       public static CustomBaseImageValue modify(BaseImage image) {
+               CustomBaseImageValue value = new CustomBaseImageValue(image);
+               value = openDialog("Modify Base Image", DIALOG_MODE.MODIFY, value);
+
+               return value;
+       }
+
+       private static CustomBaseImageValue openDialog(String dialogTitle, DIALOG_MODE mode,
+                       CustomBaseImageValue value) {
+               BaseImageCreateDialog dialog
+                       = new BaseImageCreateDialog(MainDialog.getShell(), dialogTitle);
+               dialog.setDialogMode(mode);
+               dialog.create(value, getDefaultItemList());
 
                if (dialog.open() == SWT.OK) {
                        dialog.saveDataInto(value);
index e13335b..fb53f17 100644 (file)
@@ -449,6 +449,13 @@ public class PropertyValue {
                }
        }
 
+       public Platform getPlatform() {
+               if (isBaseImageValue()) {
+                       return baseImageValue.getPlatform();
+               }
+               return null;
+       }
+
        public void setPlatform(Platform platform) {
                if (isBaseImageValue()) {
                        baseImageValue.setPlatform(platform);
@@ -456,12 +463,26 @@ public class PropertyValue {
                }
        }
 
+       public String getDescritpion() {
+               if (isBaseImageValue()) {
+                       return baseImageValue.getDescription();
+               }
+               return "";
+       }
+
        public void setDescription(String message) {
                if (isBaseImageValue()) {
                        baseImageValue.setDescription(message);
                }
        }
 
+       public boolean isAmendable() {
+               if (isBaseImageValue()) {
+                       return baseImageValue.isAmendable();
+               }
+               return false;
+       }
+
        private static boolean checkOn(String onOffVal) {
                if (onOffVal.equals(VALUE_ON)) {
                        return true;