summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xorg.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java4
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/exception/BuildException.java5
-rw-r--r--org.tizen.common/src/org/tizen/common/util/FontUtil.java28
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ResourceUtil.java9
4 files changed, 38 insertions, 8 deletions
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java b/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
index ab5f50fc5..f93460d11 100755
--- a/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
@@ -64,8 +64,8 @@ implements IBuilder
this.buildListener = buildListener;
}
- public AbstractBuilder(String output) {
- this.fileHandler.setCurrentWorkingDirectory(output);
+ public AbstractBuilder(String outputDir) {
+ this.fileHandler.setCurrentWorkingDirectory(outputDir);
}
public AbstractBuilder(String output, IBuildListener buildListener) {
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/exception/BuildException.java b/org.tizen.common.builder/src/org/tizen/common/builder/exception/BuildException.java
index 6bbb597bc..780e26a27 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/exception/BuildException.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/exception/BuildException.java
@@ -39,4 +39,9 @@ extends Exception
super( th );
}
+ public BuildException(String message, Throwable th)
+ {
+ super(message, th);
+ }
+
}
diff --git a/org.tizen.common/src/org/tizen/common/util/FontUtil.java b/org.tizen.common/src/org/tizen/common/util/FontUtil.java
index 17f7be4c9..bb611682f 100644
--- a/org.tizen.common/src/org/tizen/common/util/FontUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/FontUtil.java
@@ -2,6 +2,8 @@ package org.tizen.common.util;
import java.awt.Font;
import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
import java.util.Locale;
import com.lowagie.text.pdf.BaseFont;
@@ -35,7 +37,7 @@ public class FontUtil {
}
return families[0][FONT_FAMILY_NAME_ARRAY_NUM];
} else {
- fontType = Font.TYPE1_FONT;
+ throw new FontException("Unsupported extension: " + ext);
}
Font font = Font.createFont(fontType, new File(fontPath));
return font.getFamily(Locale.ENGLISH);
@@ -43,4 +45,28 @@ public class FontUtil {
throw new FontException(e);
}
}
+
+ /**
+ * Gets font path list.
+ * @param project
+ * @return ttf, otf file list.
+ * @throws IOException
+ */
+ public static String[] getFontPathList(String fontDir, String ... fontExtensions) throws IOException {
+ ArrayList<String> fontPathList = new ArrayList<String>();
+ File file = new File(fontDir);
+ String[] list = file.list();
+ if (list == null) {
+ return fontPathList.toArray(new String[0]);
+ }
+ for (String path : list) {
+ String ext = FilenameUtil.getExtension(path);
+ for (String fontExt : fontExtensions) {
+ if (fontExt.equalsIgnoreCase(ext)) {
+ fontPathList.add(path);
+ }
+ }
+ }
+ return fontPathList.toArray(new String[0]);
+ }
}
diff --git a/org.tizen.common/src/org/tizen/common/util/ResourceUtil.java b/org.tizen.common/src/org/tizen/common/util/ResourceUtil.java
index 74f0a8154..7b455c1aa 100644
--- a/org.tizen.common/src/org/tizen/common/util/ResourceUtil.java
+++ b/org.tizen.common/src/org/tizen/common/util/ResourceUtil.java
@@ -4,12 +4,11 @@ import org.tizen.common.file.IResource;
public class ResourceUtil {
- public static IResource getResource(final String fullPath, IResource ... resources) {
- String findPath = fullPath;
+ public static IResource getResource(final String relativePath, IResource ... resources) {
+ String findPath = relativePath;
for (IResource resource : resources) {
- String compPath = FileUtil.appendPath(resource.getFileHandler().getCurrentWorkingDirectory(), resource.getPath());
- compPath = FilenameUtil.getCanonicalForm(compPath);
- findPath = FilenameUtil.getCanonicalForm(fullPath);
+ String compPath = FilenameUtil.getCanonicalForm(resource.getPath());
+ findPath = FilenameUtil.getCanonicalForm(relativePath);
if (compPath.equals(findPath)) {
return resource;
}