org.powermock.tests.utils.impl,
org.slf4j,
org.tizen.common,
- org.tizen.common.adapter,
org.tizen.common.classloader,
org.tizen.common.config,
org.tizen.common.config.loader,
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
import org.eclipse.core.resources.IProject;
/**
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
public interface ITizenNativeLaunchConfiguration extends ITizenLaunchConfiguration{
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
import java.util.List;
/**
- * Interface about Tizen native project
+ * Interface about Tizen native project.
* @author hyunsik
*
*/
-public interface ITizenNativeProject extends ITizenProject{
+public interface ITizenNativeProject extends ITizenProject {
/**
- * Return build configuration list
- * @return a List<String>
+ * Returns build configuration list.
+ * @return a build configuration list
*/
public List<String> getBuildConfiguration();
+
/**
- * Return default build configuration name.
+ * Returns default build configuration name.
* @return String
*/
public String getDefaultBuildConfiguration();
-
}
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
-import org.tizen.common.TizenProjectType;
/**
- * Interface to get information about Tizen project
+ * Interface to get information about Tizen project.
* @author hyunsik
*
*/
public interface ITizenProject {
/**
- * Returns true if project is for Tizen native.
- *
- * @return boolean
- */
-
- boolean isTizenNativeProject();
- /**
- * Returns true if project is for Tizen web.
- *
- * @return boolean
- */
-
- boolean isTizenWebProject();
- /**
* Returns the App ID from a config.xml.
*
- * @return an App ID string. If could not get a value, return null.
+ * @return an App ID string. If could not get a value, returns {@code null}.
*/
-
public String getAppId();
/**
* Returns the Package ID from a manifest.xml.
*
- * @return a Package ID string. If could not get a value, return null.
+ * @return a Package ID string. If could not get a value, returns {@code null}.
*/
public String getPackageId();
/**
- * Returns the Tizen project type
+ * Returns the Tizen project type.
*
- * @return TizenProjectType
+ * @return {@link TizenProjectType}
*/
public TizenProjectType getTizenProjectType();
}
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
/**
* Interface to get information from launch configuration for Tizen web project
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
/**
- * Interface to get information about Tizen web project
+ * Interface about Tizen web project.
* @author hyunsik
*
*/
-public abstract class ITizenWebProject implements ITizenProject{
-
+public interface ITizenWebProject extends ITizenProject {
}
/**
- * Represents that TIZEN supports the given project types.
+ * Represents TIZEN project types.
*/
public enum TizenProjectType {
TIZEN_C_UI_APPLICATION(true, false, false),
TIZEN_CPP_SERVICE_APPLICATION(false, false, true),
TIZEN_CPP_SHAREDLIBRARY(false, false, false),
TIZEN_CPP_STATICLIBRARY(false, false, false),
- TIZEN_PLATFORM_PROJECT(false, false, false);
+ TIZEN_PLATFORM_PROJECT(false, false, false),
+
+ TIZEN_WEB_APPLICATION(false, true, false),
+ TIZEN_WEB_UIFW_APPLICATION(false, true, false),
+ TIZEN_WEB_UIBUILDER_APPLICATION(false, true, false);
private boolean isNeededIconValidation;
private boolean isRootPrj;
/**
* Returns whether this project can be root project of multi app project.
- * @return {@code true} if this project can be root project. {@code false} if not.
+ * @return {@code true} if this project can be root project, otherwise {@code false}
*/
public boolean isRootProject() {
return isRootPrj;
/**
* Returns whether this project can be referenced project of multi app project.
- * @return {@code true} if this project can be referenced project. {@code false} if not.
+ * @return {@code true} if this project can be referenced project, otherwise {@code false}
*/
public boolean isReferencedProject() {
return isRefPrj;
}
+
+ /**
+ * Returns {@code true} if the project type is native.
+ * @return {@code true} if this project type is native, otherwise {@code false}
+ */
+ public boolean isNativeProject() {
+ switch (this) {
+ case TIZEN_C_UI_APPLICATION :
+ case TIZEN_C_SERVICE_APPLICATION :
+ case TIZEN_C_SHAREDLIBRARY :
+ case TIZEN_C_STATICLIBRARY :
+ case TIZEN_CPP_UI_APPLICATION :
+ case TIZEN_CPP_SERVICE_APPLICATION :
+ case TIZEN_CPP_SHAREDLIBRARY :
+ case TIZEN_CPP_STATICLIBRARY :
+ case TIZEN_PLATFORM_PROJECT :
+ return true;
+ default :
+ return false;
+ }
+ }
+
+ /**
+ * Returns {@code true} if the project type is web.
+ * @return {@code true} if this project type is web, otherwise {@code false}
+ */
+ public boolean isWebProject() {
+ switch (this) {
+ case TIZEN_WEB_APPLICATION :
+ case TIZEN_WEB_UIFW_APPLICATION :
+ case TIZEN_WEB_UIBUILDER_APPLICATION :
+ return true;
+ default :
+ return false;
+ }
+ }
}
import org.eclipse.core.runtime.Platform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.tizen.common.adapter.ITizenNativeProject;
-import org.tizen.common.adapter.ITizenWebProject;
-import org.tizen.common.adapter.ITizenProject;
+import org.tizen.common.ITizenNativeProject;
+import org.tizen.common.ITizenProject;
+import org.tizen.common.ITizenWebProject;
/**
* ProjectUtil.
/**
* Checks whether target project is located in default location or not.
* @param descriptionLocation .cproject location of target project.
- * @return true if it is located in default location. False if not.
+ * @return {@code true} if it is located in default location, otherwise {@code false}
*/
public static boolean isDefaultProjectLocation(IPath descriptionLocation) {
if(descriptionLocation.segmentCount() < 2) {
}
return descriptionLocation.removeLastSegments(2).toFile().equals(Platform.getLocation().toFile());
}
-
+
+ /**
+ * Returns {@link ITizenProject} object for the project.
+ * @param project
+ * @return {@link ITizenProject}
+ */
+ public static ITizenProject getTizenProject(IProject project, Class adapter) {
+ if (project == null)
+ throw new IllegalArgumentException("project can not be null");
+ Object obj = project.getAdapter(adapter);
+ if (obj == null || !(obj instanceof ITizenProject))
+ throw new IllegalArgumentException("project can not be adapted (obj - " + obj + ", adapter - " + adapter + ")");
+ return (ITizenProject) obj;
+ }
+
/**
- * Check whether project is for tizen native or not.
+ * Checks whether project is for Tizen native or not.
* @param project
- * @return true if it is tizen native project.
+ * @return {@code true} if it is Tizen native project
*/
public static boolean isTizenNativeProject(IProject project) {
- ITizenProject adapter = (ITizenProject) project.getAdapter(ITizenNativeProject.class);
- return adapter.isTizenNativeProject();
+ ITizenProject adapter = getTizenProject(project, ITizenNativeProject.class);
+ return (adapter.getTizenProjectType() == null) ? false : adapter.getTizenProjectType().isNativeProject();
}
/**
- * Check whether project is for tizen web or not.
+ * Checks whether project is for Tizen web or not.
* @param project
- * @return true if it is tizen web project.
+ * @return {@code true} if it is Tizen web project
*/
public static boolean isTizenWebProject(IProject project) {
- ITizenProject adapter = (ITizenProject) project.getAdapter(ITizenWebProject.class);
- return adapter.isTizenWebProject();
+ ITizenProject adapter = getTizenProject(project, ITizenWebProject.class);
+ return (adapter.getTizenProjectType() == null) ? false : adapter.getTizenProjectType().isWebProject();
}
/**
- * Check whether project is for tizen or not.
+ * Checks whether project is for Tizen or not.
* @param project
- * @return true if it is tizen project.
+ * @return {@code true} if it is Tizen project
*/
public static boolean isTizenProject(IProject project) {
return (isTizenNativeProject(project) || isTizenWebProject(project));