[Title] added getDescription(boolean)
authorGun Kim <gune.kim@samsung.com>
Fri, 30 Aug 2013 04:52:42 +0000 (13:52 +0900)
committerGun Kim <gune.kim@samsung.com>
Fri, 30 Aug 2013 05:38:09 +0000 (14:38 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ie1ca142fe7e4713fb45853ce70150a2b02e0748e

org.tizen.common/src/org/tizen/common/AbstractTizenProject.java

index 33b145a..55e24bc 100644 (file)
@@ -28,15 +28,40 @@ package org.tizen.common;
 
 import org.eclipse.core.resources.IProject;
 import org.tizen.common.core.application.InstallPathConfig;
-import org.tizen.common.core.application.ProfileInfo;
 import org.tizen.common.core.application.TizenProjectDescription;
 import org.tizen.common.core.application.tproject.TprojectHandler;
 
 public abstract class AbstractTizenProject implements ITizenProject {
     public TizenProjectDescription getDescription() {
+        return getDescription(true);
+    }
+    
+    /**
+     * Returns the information of the tizen project.<br>
+     * Otherwise, returns null.<br>
+     * 
+     * @param generate If the given generate is true and the information cannot be found,
+     * creates the information by using latest platform, and returns it.
+     */
+    public TizenProjectDescription getDescription(boolean generate) {
         TprojectHandler handler = new TprojectHandler(getProject());
-        
-        return handler.unmarshal();
+        TizenProjectDescription desc = handler.unmarshal();
+        if ( desc != null ) {
+            return desc;
+        }
+        else {
+            if ( generate ) {
+                desc = new TizenProjectDescription(getProject());
+                desc.setPlatform(InstallPathConfig.getLatestProfileInfo());
+                if ( setDescription(desc) ) {
+                    return desc;
+                }
+                else {
+                    desc = null;
+                }
+            }
+        }
+        return desc;
     }
     
     public boolean setDescription( TizenProjectDescription desc ) {