From: shingil.kang Date: Thu, 12 Dec 2013 07:16:15 +0000 (+0900) Subject: CLI: add progress monitor to show the progress status of creating web/native project. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c9e022b614c1fd63e9627ddeae33ae0dae42808;p=sdk%2Ftools%2Fcli.git CLI: add progress monitor to show the progress status of creating web/native project. Change-Id: I522e90a05a3f0ff0fcab65f7f131d3dbbb86dcfd Signed-off-by: shingil.kang --- diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateNativeProjectCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateNativeProjectCLI.java index 4c6f65b..9cdd27f 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateNativeProjectCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateNativeProjectCLI.java @@ -1,16 +1,39 @@ +/* + * IDE + * + * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Shingil Kang + * Hyeongseok Heo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + */ package org.tizen.ncli.ide.shell; import java.io.File; import java.io.IOException; import org.kohsuke.args4j.Option; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -//import org.tizen.ncli.ide.subcommands.CreateNativeProjectCommand; +import org.tizen.ncli.core.TizenSubCommand; import org.tizen.ncli.ide.messages.TizenCLIMessages; import org.tizen.ncli.ide.subcommands.CreateNativeProjectCommand; import org.tizen.ncli.ide.subcommands.CreateNativeProjectCommandData; +@TizenSubCommand(name="native-project" , usage="Create the tizen native project") public class CreateNativeProjectCLI extends AbstractCLI { @Option(name = "-t", aliases = { "--type" }, usage = "Specify template name") @@ -47,8 +70,7 @@ public class CreateNativeProjectCLI extends AbstractCLI CreateNativeProjectCommandData data = nativeCommand.runCommand(); - progressLog.info("Project Location : {}",data.getOutputName()); - progressLog.info("Creating native project succeeded!"); + progressLog.info("Project Location: {}",data.getOutputName()); } } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateWebProjectCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateWebProjectCLI.java index e05b755..c861fa9 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateWebProjectCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateWebProjectCLI.java @@ -29,6 +29,7 @@ import java.io.File; import java.io.IOException; import org.kohsuke.args4j.Option; +import org.tizen.ncli.core.TizenSubCommand; import org.tizen.ncli.ide.messages.TizenCLIMessages; import org.tizen.ncli.ide.subcommands.CreateProjectCommandData; import org.tizen.ncli.ide.subcommands.CreateWebProjectCommand; @@ -36,6 +37,7 @@ import org.tizen.ncli.ide.subcommands.CreateWebProjectCommand; /** * @author Shingil Kang{@literal } (S-core) */ +@TizenSubCommand(name="web-project" , usage="Create the tizen web project") public class CreateWebProjectCLI extends AbstractCLI { @Option(name = "-t", aliases = { "--type" }, usage = "Specify template name") @@ -52,8 +54,6 @@ public class CreateWebProjectCLI extends AbstractCLI @Override public void execute() { - log.info("Template Name:{}", templateName); - CreateWebProjectCommand webCommand = new CreateWebProjectCommand(); // set template name @@ -79,7 +79,6 @@ public class CreateWebProjectCLI extends AbstractCLI CreateProjectCommandData data = webCommand.runCommand(); - progressLog.info("project Location : {}",data.getOutputName()); - progressLog.info("Creating web project succeeded!"); + progressLog.info("Project Location: {}",data.getOutputName()); } } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateNativeProjectCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateNativeProjectCommand.java index d6f4c41..df73a8c 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateNativeProjectCommand.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateNativeProjectCommand.java @@ -27,6 +27,7 @@ package org.tizen.ncli.ide.subcommands; import java.io.File; import java.io.IOException; +import java.io.PrintWriter; import java.net.URL; import java.text.MessageFormat; import java.util.HashMap; @@ -34,6 +35,7 @@ import java.util.Map; import org.eclipse.cdt.core.templateengine.process.processes.Messages; import org.tizen.common.util.FileUtil; +import org.tizen.core.ide.TextProgressMonitor; import org.tizen.nativeappcommon.wizards.TizenProjectWizard; import org.tizen.nativecommon.Activator; import org.tizen.nativecommon.exception.TizenProcessFailureException; @@ -49,6 +51,8 @@ public class CreateNativeProjectCommand extends AbstractSubCommand * Hyeongseok Heo * Kangho Kim - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -45,7 +45,7 @@ import org.w3c.dom.Element; /** * This class provides data which is used to create Tizen native project. - * + * * @author Shingil Kang{@literal } (S-core) */ public class CreateNativeProjectCommandData diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java index 11905f6..9b80da3 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java @@ -7,7 +7,7 @@ * Shingil Kang * Hyeongseok Heo * Kangho Kim - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,6 +34,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; +import java.io.PrintWriter; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -61,6 +62,7 @@ import org.tizen.common.core.application.tproject.Tproject; import org.tizen.common.util.FileUtil; import org.tizen.common.util.FreeMarkerUtil; import org.tizen.common.util.IOUtil; +import org.tizen.core.ide.TextProgressMonitor; import org.tizen.ncli.ide.messages.TizenCLIMessages; import org.tizen.web.apptemplate.model.LibraryElement; import org.tizen.web.apptemplate.model.OptionElement; @@ -81,7 +83,7 @@ import freemarker.template.Configuration; /** * @author Shingil Kang{@literal } (S-core) - * + * */ public class CreateWebProjectCommand extends AbstractSubCommand { @@ -100,9 +102,11 @@ public class CreateWebProjectCommand extends AbstractSubCommand"; private final String CONFIG_EXTRA_NAME_INFO = " ${WIDGET_ID}"; @@ -809,33 +824,33 @@ class ProjectGenUtil /* extract jar file and get the extracted folder path * when jar file is already extracted in a folder, return the folder path. - * folder path has the name appended '_dir' to jar file name. + * folder path has the name appended '_dir' to jar file name. */ - + public String extractBuiltinJarFiles(String resource) { URL url = getClass().getClassLoader().getResource(resource); - + if(url == null){ logger.error("not found jar file"); return null; } - + String urlPath = url.getPath(); - + String templateLibPath = urlPath + File.separator; - + // if the url is not expressed jar file if(urlPath.contains("!")) { String urlPathTemp = urlPath.replaceAll("file:", ""); String jarPath = urlPathTemp.substring(0, urlPathTemp.lastIndexOf('!')); - + String destDirPath = jarPath + "_dir"; - + templateLibPath = destDirPath + File.separator + resource + File.separator; - - // make it if the destination directory is not created. + + // make it if the destination directory is not created. File destDirFile = new File(destDirPath); if (destDirFile.isDirectory()) { @@ -845,7 +860,7 @@ class ProjectGenUtil { destDirFile.mkdir(); } - + try { JarFile jar = new JarFile(jarPath); @@ -877,7 +892,7 @@ class ProjectGenUtil logger.error(e.getMessage()); } } - + return templateLibPath; } }