From 1370e6f6cc9babeada861ff300decfcc15876be0 Mon Sep 17 00:00:00 2001 From: jihye kim Date: Wed, 28 Aug 2013 17:11:57 +0900 Subject: [PATCH] delete \n character Change-Id: Ia5ffa070ca4244a14784921020bf5e1b7d41c8f4 Signed-off-by: jihye kim --- .../tizen/emulator/manager/EmulatorManager.java | 5 ++- .../tizen/emulator/manager/console/ActionList.java | 13 +++--- .../emulator/manager/console/ConsoleCreateVM.java | 6 ++- .../emulator/manager/console/ConsoleProcessor.java | 48 +++++++++++----------- .../emulator/manager/tool/SettingInfoFile.java | 2 +- .../org/tizen/emulator/manager/ui/MainDialog.java | 7 ++++ .../tizen/emulator/manager/ui/MenuHandling.java | 3 +- .../emulator/manager/ui/dialog/AboutDialog.java | 2 +- .../emulator/manager/ui/dialog/CloneDialog.java | 3 +- .../emulator/manager/vms/helper/QemuImgProc.java | 31 ++++++++------ 10 files changed, 71 insertions(+), 49 deletions(-) diff --git a/common-project/src/org/tizen/emulator/manager/EmulatorManager.java b/common-project/src/org/tizen/emulator/manager/EmulatorManager.java index c7d4317..05ea050 100755 --- a/common-project/src/org/tizen/emulator/manager/EmulatorManager.java +++ b/common-project/src/org/tizen/emulator/manager/EmulatorManager.java @@ -172,8 +172,9 @@ public class EmulatorManager { MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); if (isArgsError == true) { - msg.openWarningDialog("Used option parameter is not proper. Aborting...\n" + - "\nSee right examples below.\n" + + msg.openWarningDialog("Used option parameter is not proper. Aborting..." + + StringResources.NEW_LINE + StringResources.NEW_LINE + + "See right examples below." + StringResources.NEW_LINE + "--inhouse: Emulator Manager start with inhouse mode. You can use extend function." + "--debug: Emulator Manager start with debug mode. Print more log at emulator-manager.log"); exitEmulatorManager(1); diff --git a/common-project/src/org/tizen/emulator/manager/console/ActionList.java b/common-project/src/org/tizen/emulator/manager/console/ActionList.java index a806f36..d8941cc 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ActionList.java +++ b/common-project/src/org/tizen/emulator/manager/console/ActionList.java @@ -32,6 +32,7 @@ package org.tizen.emulator.manager.console; import java.util.ArrayList; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.resources.FilePathResources; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.SelectTemplate; import org.tizen.emulator.manager.vms.RAM_SIZE; import org.tizen.emulator.manager.vms.RESOLUTION; @@ -103,7 +104,8 @@ public class ActionList { } public void printAction(Action action) { - System.out.println("\n--------------------------------------------------------------------------"); + System.out.println(); + System.out.println("--------------------------------------------------------------------------"); System.out.println("Action: \"" + (action.getAction()) +"\""); System.out.println(" -> " + action.getDescription()); System.out.println("Usage: "); @@ -210,7 +212,7 @@ class Detail extends Action { this.usage = "detail -n test"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of virtual machine.\n" + + "Name of virtual machine." + StringResources.NEW_LINE + " If you do not enter a name, emulator manager's information is printed.","", false, true)); } @@ -246,8 +248,8 @@ class Create extends Action { public Create() { this.action = Actions.AC_CREATE; this.description = "Create new 'Virtual Machine'."; - this.usage = "Standard Image: create -n test -b 1 [options]\n" + - " Custom Image: create -n test -p path [options]\n" + + this.usage = "Standard Image: create -n test -b 1 [options]" + StringResources.NEW_LINE + + " Custom Image: create -n test -p path [options]" + StringResources.NEW_LINE + " You can not use both '-b' and '-p' at the same time."; property = new VMPropertyValue(null, SelectTemplate.getInstance().getDefaultTemplate()); @@ -257,7 +259,8 @@ class Create extends Action { // b : standard image // p : custom image commandList.add(new Command("b", Actions.OP_BASE, - "Select ID of base disk image.\n\t\t(Avaliable disk image can be found using 'list-image' command)", + "Select ID of base disk image." + StringResources.NEW_LINE + + "\t\t(Avaliable disk image can be found using 'list-image' command)", "1", false, true)); commandList.add(new Command("p", Actions.OP_PATH, "Select path of base target image.", "", false, true)); diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index 8ff63b4..ca89105 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -38,6 +38,7 @@ import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.PlatformList; import org.tizen.emulator.manager.platform.Skin; import org.tizen.emulator.manager.platform.SkinList; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.CheckVirtualization; import org.tizen.emulator.manager.vms.Creator; import org.tizen.emulator.manager.vms.EmulatorVMList; @@ -376,7 +377,7 @@ public class ConsoleCreateVM { } if (!HelperClass.checkString(name)) { - throw new ConsoleException("Name has invalid character.\n" + + throw new ConsoleException("Name has invalid character." + StringResources.NEW_LINE + "Valid Charater : a-z, A-Z, 0-9, 0, _"); } @@ -402,7 +403,8 @@ public class ConsoleCreateVM { try { return f.getCanonicalPath(); } catch (IOException e) { - throw new ConsoleException("Path of base image has problem : \n" + e.getMessage()); + throw new ConsoleException("Path of base image has problem : " + + StringResources.NEW_LINE + e.getMessage()); } } } diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java index 8b6f78c..b0f8ec0 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleProcessor.java @@ -43,6 +43,7 @@ import org.tizen.emulator.manager.plugin.EMPluginList; import org.tizen.emulator.manager.plugin.Extension; import org.tizen.emulator.manager.plugin.ExtensionItem; import org.tizen.emulator.manager.plugin.PluginStringResources; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.About; import org.tizen.emulator.manager.vms.EmulatorVMList; import org.tizen.emulator.manager.vms.ILauncher; @@ -61,58 +62,58 @@ public class ConsoleProcessor { } public String getAboutInfo() { - return "Emulator Manager\n"+ + return "Emulator Manager" + StringResources.NEW_LINE + About.getInstance().getContents(); } public String getDetailInfoOfVM(VMProperty prop) { String str = new String(); try { - str += String.format("%s\n", prop.getName()); - str+= String.format("\t%-17s : %s\n", "ImageType",prop.getImageType()); + str += String.format("%s" + StringResources.NEW_LINE, prop.getName()); + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "ImageType",prop.getImageType()); if (prop.getImageType() == FSImageType.standard) { - str+= String.format("\t%-17s : %s\n", "Version" , + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Version" , prop.getConfiguration().getBaseInformation().getDiskImage().getVersion()); - str+= String.format("\t%-17s : %s\n", "Image Version" , + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Image Version" , prop.getConfiguration().getBaseInformation().getDiskImage().getBase()); } - str+= String.format("\t%-17s : %s\n", "Base Disk Image", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Base Disk Image", prop.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue()); - str+= String.format("\t%-17s : %s\n", "Child Disk Image", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Child Disk Image", prop.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()); - str+= String.format("\t%-17s : %s\n", "Resolution", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Resolution", (prop.getConfiguration().getDevice().getDisplay().getResolution().getWidth() + "x" + prop.getConfiguration().getDevice().getDisplay().getResolution().getHeight())); - str+= String.format("\t%-17s : %s\n", "DPI", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "DPI", prop.getConfiguration().getDevice().getDisplay().getDensity().getValue()); - str+= String.format("\t%-17s : %s\n", "Skin Path", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Skin Path", prop.getConfiguration().getDevice().getDisplay().getSkinPath().getPath()); if (prop.getConfiguration().getDevice().getTouch() != null) { - str+= String.format("\t%-17s : %s\n", "Max Touch Point", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Max Touch Point", prop.getConfiguration().getDevice().getTouch().getMaxTouchPoint()); } - str+= String.format("\t%-17s : %s\n", "RAM Size", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "RAM Size", prop.getConfiguration().getDevice().getRAM().getSize().getValue()); if (prop.getConfiguration().getUsability().getFileSharing() != null) { String filePath = prop.getConfiguration().getUsability().getFileSharing().getPath(); if (filePath != null && !filePath.isEmpty()) { - str+= String.format("\t%-17s : %s\n", "File Sharing Path", filePath); + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "File Sharing Path", filePath); } } - str+= String.format("\t%-17s : %s\n", "HW Virtualization", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "HW Virtualization", (prop.getConfiguration().getUsability().isHwVirtualization() ? "TRUE" : "FALSE")); - str+= String.format("\t%-17s : %s\n", "HW GL Acceleration", + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "HW GL Acceleration", (prop.getConfiguration().getUsability().isHwGLAcceleration() ? "TRUE" : "FALSE")); if (prop.getConfiguration().getUsability().getAdvancedOptions() != null) { - str+= String.format("\t%-17s : %s\n", "Advanced Options: ", prop.getConfiguration().getUsability().getAdvancedOptions()); + str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Advanced Options: ", prop.getConfiguration().getUsability().getAdvancedOptions()); } } catch (NullPointerException e) { System.out.println(e.getMessage()); @@ -164,7 +165,7 @@ public class ConsoleProcessor { public ArrayList getInfoOfImageList(boolean isDetail) { ArrayList list = new ArrayList(); - list.add("Avaliable Base Image: \n"); + list.add("Avaliable Base Image: " + StringResources.NEW_LINE); for (Platform platform : PlatformList.getPlatformList()) { for (BaseImage image : platform.getImageList()) { @@ -251,7 +252,7 @@ public class ConsoleProcessor { if (!isTest) { if(prop.getWorker().isRunningNow()) { - System.out.println("Error: Can not execute this VM.\n" + + System.out.println("Error: Can not execute this VM." + StringResources.NEW_LINE + "The same name is running now."); return false; } @@ -288,7 +289,7 @@ public class ConsoleProcessor { } if(prop.getWorker().isRunningNow()) { - System.out.println("Error: Not allowed to delete active VMs\n" + System.out.println("Error: Not allowed to delete active VMs" + StringResources.NEW_LINE + "[" + name + "] is running now..."); return false; } @@ -313,7 +314,7 @@ public class ConsoleProcessor { } if(prop.getWorker().isRunningNow()) { - System.out.println("Error: Not allowed to reset active VMs\n" + System.out.println("Error: Not allowed to reset active VMs" + StringResources.NEW_LINE + "[" + name + "] is running now..."); return false; } @@ -338,7 +339,7 @@ public class ConsoleProcessor { } if(prop.getWorker().isRunningNow()) { - System.out.println("Error: Not allowed to 'Create Base Image' while source VM is running.\n" + System.out.println("Error: Not allowed to 'Create Base Image' while source VM is running." + StringResources.NEW_LINE + "[" + name + "] is running now..."); return false; } @@ -360,7 +361,8 @@ public class ConsoleProcessor { return false; } - System.out.println("Success: To create 'Base Image' is succeeded!\nPath: " + path); + System.out.println("Success: To create 'Base Image' is succeeded! + StringResources.NEW_LINE" + + "Path: " + path); return true; } @@ -373,7 +375,7 @@ public class ConsoleProcessor { } if(prop.getWorker().isRunningNow()) { - System.out.println("Error: Not allowed to 'Clone' while source VM is running.\n" + System.out.println("Error: Not allowed to 'Clone' while source VM is running." + StringResources.NEW_LINE + "[" + name + "] is running now..."); return false; } diff --git a/common-project/src/org/tizen/emulator/manager/tool/SettingInfoFile.java b/common-project/src/org/tizen/emulator/manager/tool/SettingInfoFile.java index a602a96..bb888fc 100644 --- a/common-project/src/org/tizen/emulator/manager/tool/SettingInfoFile.java +++ b/common-project/src/org/tizen/emulator/manager/tool/SettingInfoFile.java @@ -76,7 +76,7 @@ public class SettingInfoFile { out = new BufferedWriter(writer); try { - out.write(StringResources.MAC_ADDRESS + "=\n"); + out.write(StringResources.MAC_ADDRESS + "=" + StringResources.NEW_LINE); } catch (IOException e1) { prop = null; return; diff --git a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java index 798417a..c2bd38d 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java @@ -30,6 +30,7 @@ package org.tizen.emulator.manager.ui; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import org.eclipse.swt.SWT; @@ -48,6 +49,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; +import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.CustomPlatform; import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.platform.PlatformList; @@ -117,6 +119,11 @@ public class MainDialog { if(is != null) { icon = new Image(Display.getCurrent(), is); shell.setImage(icon); + try { + is.close(); + } catch (IOException e) { + EMLogger.getLogger().info(e.getMessage()); + } } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/MenuHandling.java b/common-project/src/org/tizen/emulator/manager/ui/MenuHandling.java index 92239b8..4678ca8 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/MenuHandling.java +++ b/common-project/src/org/tizen/emulator/manager/ui/MenuHandling.java @@ -52,7 +52,8 @@ public class MenuHandling { public void resetVirtualMachine(VMProperty property) { MessageDialog msg = new MessageDialog(); - int response = msg.openSelectionDialog("This VM will be formatted.\nAre you sure you want to continue?"); + int response = msg.openSelectionDialog("This VM will be formatted." + + StringResources.NEW_LINE + "Are you sure you want to continue?"); if (response != SWT.OK) { return; diff --git a/common-project/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java b/common-project/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java index 0efa4bf..c4d1342 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java @@ -151,7 +151,7 @@ public class AboutDialog { // link to tizen developer site Link visit = new Link(textComposite, SWT.NONE); visit.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false)); - visit.setText("\n\n" + + visit.setText(StringResources.NEW_LINE + StringResources.NEW_LINE + "Visit https://developer.tizen.org"); visit.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); visit.addSelectionListener(new SelectionListener(){ diff --git a/common-project/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java b/common-project/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java index 11efe59..91207d6 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java @@ -70,7 +70,8 @@ public class CloneDialog { dialog.setLayout(new GridLayout(1, true)); Label info = new Label(dialog, SWT.WRAP); - info.setText("Clone new VM which has the same configurations\nas you selected."); + info.setText("Clone new VM which has the same configurations" + + StringResources.NEW_LINE + "as you selected."); Label sep = new Label(dialog, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true)); diff --git a/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java b/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java index 7e3615f..3eda63b 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java +++ b/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java @@ -38,6 +38,7 @@ import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.resources.FilePathResources; +import org.tizen.emulator.manager.resources.StringResources; public class QemuImgProc { private List cmd = null; @@ -68,13 +69,13 @@ public class QemuImgProc { if (str!= null) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Failed check base image...(from qemu-img)\n" + str); + "Failed check base image...(from qemu-img)" + StringResources.NEW_LINE + str); } } while (str != null); } catch (IOException e) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Failed check base image...(stderr of qemu-img)\n" + e.getMessage()); + "Failed check base image...(stderr of qemu-img)" + StringResources.NEW_LINE + e.getMessage()); } } }).start(); @@ -89,13 +90,16 @@ public class QemuImgProc { if (str.contains("format")) { if (!str.contains("qcow2")) { isError = true; - errorMsg = "Format of base image is not avaliable.\nBase image path :" + cmd.get(2); + errorMsg = "Format of base image is not avaliable." + + StringResources.NEW_LINE + "Base image path :" + cmd.get(2); break; } } else if (str != null && str.contains("backing file")) { isError = true; - errorMsg = "Base image is child image of other base image.\n" + - "This image is not using as base image.\n"; + errorMsg = "Base image is child image of other base image." + + StringResources.NEW_LINE + + "This image is not using as base image." + + StringResources.NEW_LINE; break; } } @@ -103,7 +107,8 @@ public class QemuImgProc { } catch (IOException e) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Failed check base image...(stdout of qemu-img)\n" + e.getMessage()); + "Failed check base image...(stdout of qemu-img)" + + StringResources.NEW_LINE + e.getMessage()); } } }).start(); @@ -114,19 +119,19 @@ public class QemuImgProc { isError = true; EMLogger.getLogger().log(Level.WARNING, "Error while running 'qemu-img'. Exit value : " + process.exitValue()); - errorMsg = "Error while running 'qemu-img'. Exit value : " + process.exitValue() + - "\nYou can get more information in log file (" + errorMsg = "Error while running 'qemu-img'. Exit value : " + process.exitValue() + + StringResources.NEW_LINE + "You can get more information in log file (" + FilePathResources.getTizenVmsPath() + File.separator + "emulator-manager)"; } } catch (InterruptedException e) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Error while running 'qemu-img'.\n" + e.getMessage()); + "Error while running 'qemu-img'." + StringResources.NEW_LINE + e.getMessage()); } if (isError) { if (errorMsg == null) { - errorMsg = "Failed check base image...\nPlease, select base image again."; + errorMsg = "Failed check base image..." + StringResources.NEW_LINE + "Please, select base image again."; } } } @@ -155,13 +160,13 @@ public class QemuImgProc { if (str!= null) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Error while running 'qemu-img'\n" + str); + "Error while running 'qemu-img'" + StringResources.NEW_LINE + str); } } while (str != null); } catch (IOException e) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Error while running 'qemu-img'(stderr)\n" + e.getMessage()); + "Error while running 'qemu-img'(stderr)" + StringResources.NEW_LINE + e.getMessage()); } } }).start(); @@ -176,7 +181,7 @@ public class QemuImgProc { } catch (InterruptedException e) { isError = true; EMLogger.getLogger().log(Level.WARNING, - "Error while running 'qemu-img'.\n" + e.getMessage()); + "Error while running 'qemu-img'." + StringResources.NEW_LINE + e.getMessage()); } if (isError) { -- 2.7.4