VM-property: set VMPropertyValue early
authorMinkee Lee <minkee.lee@samsung.com>
Thu, 4 Feb 2016 13:12:20 +0000 (22:12 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 11 Feb 2016 07:19:46 +0000 (16:19 +0900)
Change-Id: I55333be372172204b27432196edac66e947eb402
Signed-off-by: Minkee Lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/platform/Profile.java
src/org/tizen/emulator/manager/vms/VMProperty.java

index 2aeb482..e7f69e3 100644 (file)
@@ -75,6 +75,11 @@ public class Profile {
                this.name = name;
                initLastCreatedPropertyPath();
 
+               // XXX remove if there is no listener in console mode.
+               if (EmulatorManager.isConsoleMode()) {
+                       return;
+               }
+
                VMKeeper.addListChangeListener(new ListChangeListener<VMProperty>() {
                        @Override
                        public void elementRemoved(VMProperty property) {
index d027b53..13eff8a 100644 (file)
@@ -170,21 +170,22 @@ public final class VMProperty {
                        configuration.setConfiguration(element);
                }
 
-               if (value != null) {
-                       value.settingConfigure(this);
+               value = new VMPropertyValue(this);
+
+               // Each platform has default-property and it doesn't have name.
+               if (value.vmsName == null) {
+                       return;
                }
 
-               if (configuration.getName() != null) {
-                       Path logFile = Paths.get(VMLogUtil.getEmulatorLogPath(configuration.getName()));
-                       if (Files.exists(logFile)) {
-                               try {
-                                       lastLaunched = Files.getLastModifiedTime(logFile).toMillis();
-                               } catch (IOException e) {
-                                       e.printStackTrace();
-                               }
-                       } else {
-                               lastLaunched = 0;
+               Path logFile = Paths.get(VMLogUtil.getEmulatorLogPath(value.vmsName));
+               if (Files.exists(logFile)) {
+                       try {
+                               lastLaunched = Files.getLastModifiedTime(logFile).toMillis();
+                       } catch (IOException e) {
+                               e.printStackTrace();
                        }
+               } else {
+                       lastLaunched = 0;
                }
        };
 
@@ -211,10 +212,7 @@ public final class VMProperty {
        }
 
        public VMPropertyValue getPropertyValue() {
-               if(this.value == null) {
-                       this.value = new VMPropertyValue(this);
-               }
-
+               assert value != null;
                return value;
        }