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);
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;
}
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: ");
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));
}
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());
// 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));
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;
}
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, _");
}
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());
}
}
}
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;
}
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());
public ArrayList<String> getInfoOfImageList(boolean isDetail) {
ArrayList<String> list = new ArrayList<String>();
- list.add("Avaliable Base Image: \n");
+ list.add("Avaliable Base Image: " + StringResources.NEW_LINE);
for (Platform platform : PlatformList.getPlatformList()) {
for (BaseImage image : platform.getImageList()) {
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
package org.tizen.emulator.manager.ui;
+import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
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;
if(is != null) {
icon = new Image(Display.getCurrent(), is);
shell.setImage(icon);
+ try {
+ is.close();
+ } catch (IOException e) {
+ EMLogger.getLogger().info(e.getMessage());
+ }
}
}
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;
// 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 <a>https://developer.tizen.org</a>");
visit.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
visit.addSelectionListener(new SelectionListener(){
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));
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<String> cmd = null;
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();
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;
}
}
} 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();
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.";
}
}
}
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();
} 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) {