From: Gun Kim Date: Fri, 30 Aug 2013 04:52:42 +0000 (+0900) Subject: [Title] added getDescription(boolean) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2827a465da7bbe6e3fcdc8ac47472896a384c6b5;p=sdk%2Fide%2Fcommon-eplugin.git [Title] added getDescription(boolean) [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Ie1ca142fe7e4713fb45853ce70150a2b02e0748e --- diff --git a/org.tizen.common/src/org/tizen/common/AbstractTizenProject.java b/org.tizen.common/src/org/tizen/common/AbstractTizenProject.java index 33b145a..55e24bc 100644 --- a/org.tizen.common/src/org/tizen/common/AbstractTizenProject.java +++ b/org.tizen.common/src/org/tizen/common/AbstractTizenProject.java @@ -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.
+ * Otherwise, returns null.
+ * + * @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 ) {