summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkh5325.kim <kh5325.kim@samsung.com>2013-05-13 23:46:37 +0900
committerGerrit Code Review <gerrit2@system.s-core.co.kr>2013-05-13 23:46:37 +0900
commit232ebe766816c6c03001a19912131ac2e7c3c566 (patch)
tree9eda31ee1e5a99a4eccd4732b3d4c61c259f2167
parentaed3fcc0e62fd8e7315627119bd68ed5cb234023 (diff)
parent9350fabddd8ffee9a4dad540e5dbeb4ebb8ed8b4 (diff)
downloadcommon-eplugin-232ebe766816c6c03001a19912131ac2e7c3c566.tar.gz
common-eplugin-232ebe766816c6c03001a19912131ac2e7c3c566.tar.bz2
common-eplugin-232ebe766816c6c03001a19912131ac2e7c3c566.zip
Merge "Refactored pacakge and added web types to TizenProjectType" into develop
-rwxr-xr-xorg.tizen.common/META-INF/MANIFEST.MF1
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenLaunchConfiguration.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenLaunchConfiguration.java)2
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenNativeLaunchConfiguration.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenNativeLaunchConfiguration.java)2
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenNativeProject.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenNativeProject.java)14
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenProject.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenProject.java)28
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenWebLaunchConfiguration.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenWebLaunchConfiguration.java)2
-rw-r--r--org.tizen.common/src/org/tizen/common/ITizenWebProject.java (renamed from org.tizen.common/src/org/tizen/common/adapter/ITizenWebProject.java)7
-rw-r--r--org.tizen.common/src/org/tizen/common/TizenProjectType.java48
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ProjectUtil.java44
9 files changed, 92 insertions, 56 deletions
diff --git a/org.tizen.common/META-INF/MANIFEST.MF b/org.tizen.common/META-INF/MANIFEST.MF
index 96a73ee1a..7c5ff7690 100755
--- a/org.tizen.common/META-INF/MANIFEST.MF
+++ b/org.tizen.common/META-INF/MANIFEST.MF
@@ -177,7 +177,6 @@ Export-Package:
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,
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenLaunchConfiguration.java b/org.tizen.common/src/org/tizen/common/ITizenLaunchConfiguration.java
index 3da32b970..0a36644f8 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenLaunchConfiguration.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenLaunchConfiguration.java
@@ -23,7 +23,7 @@
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
import org.eclipse.core.resources.IProject;
/**
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenNativeLaunchConfiguration.java b/org.tizen.common/src/org/tizen/common/ITizenNativeLaunchConfiguration.java
index b1dec876b..00bd38acc 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenNativeLaunchConfiguration.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenNativeLaunchConfiguration.java
@@ -23,7 +23,7 @@
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
public interface ITizenNativeLaunchConfiguration extends ITizenLaunchConfiguration{
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenNativeProject.java b/org.tizen.common/src/org/tizen/common/ITizenNativeProject.java
index f26bda32e..9e2a01569 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenNativeProject.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenNativeProject.java
@@ -23,25 +23,25 @@
* - 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&lt;String&gt;
+ * 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();
-
}
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenProject.java b/org.tizen.common/src/org/tizen/common/ITizenProject.java
index 8c72aef2c..09d212444 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenProject.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenProject.java
@@ -23,49 +23,33 @@
* - 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();
}
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenWebLaunchConfiguration.java b/org.tizen.common/src/org/tizen/common/ITizenWebLaunchConfiguration.java
index b3b46f761..d2295cb3e 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenWebLaunchConfiguration.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenWebLaunchConfiguration.java
@@ -23,7 +23,7 @@
* - S-Core Co., Ltd
*
*/
-package org.tizen.common.adapter;
+package org.tizen.common;
/**
* Interface to get information from launch configuration for Tizen web project
diff --git a/org.tizen.common/src/org/tizen/common/adapter/ITizenWebProject.java b/org.tizen.common/src/org/tizen/common/ITizenWebProject.java
index 5316ef91c..42fd4a73a 100644
--- a/org.tizen.common/src/org/tizen/common/adapter/ITizenWebProject.java
+++ b/org.tizen.common/src/org/tizen/common/ITizenWebProject.java
@@ -23,13 +23,12 @@
* - 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 {
}
diff --git a/org.tizen.common/src/org/tizen/common/TizenProjectType.java b/org.tizen.common/src/org/tizen/common/TizenProjectType.java
index b9c1b5a23..6589facc0 100644
--- a/org.tizen.common/src/org/tizen/common/TizenProjectType.java
+++ b/org.tizen.common/src/org/tizen/common/TizenProjectType.java
@@ -27,7 +27,7 @@ package org.tizen.common;
/**
- * Represents that TIZEN supports the given project types.
+ * Represents TIZEN project types.
*/
public enum TizenProjectType {
TIZEN_C_UI_APPLICATION(true, false, false),
@@ -38,7 +38,11 @@ public enum TizenProjectType {
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;
@@ -56,7 +60,7 @@ public enum TizenProjectType {
/**
* 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;
@@ -64,9 +68,45 @@ public enum TizenProjectType {
/**
* 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;
+ }
+ }
}
diff --git a/org.tizen.common/src/org/tizen/common/util/ProjectUtil.java b/org.tizen.common/src/org/tizen/common/util/ProjectUtil.java
index 64bf5bda4..786aa081e 100644
--- a/org.tizen.common/src/org/tizen/common/util/ProjectUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/ProjectUtil.java
@@ -37,9 +37,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
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.
@@ -208,7 +208,7 @@ public class 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) {
@@ -216,31 +216,45 @@ public class ProjectUtil {
}
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));