From fe66dd6e2ef35b5c9841e6e33747f78bce383f15 Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Mon, 8 Oct 2012 13:46:00 +0900 Subject: [PATCH] [Title] emulator manager : modify to support MAC [Desc.] modify 'check hax' and 'modify(create) view' and 'about dialog' [Issue] N/A Signed-off-by: Munkyu Im --- package/pkginfo.manifest | 2 +- src/org/tizen/emulator/manager/EmulatorManager.java | 13 +++++++------ .../emulator/manager/tool/CheckVirtualization.java | 6 ++++-- src/org/tizen/emulator/manager/tool/FilePath.java | 1 + src/org/tizen/emulator/manager/ui/AboutDialog.java | 17 ++++++++++++++--- .../emulator/manager/ui/detail/VMPropertyView.java | 2 ++ 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 218f19d..1069943 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Source: emulator-manager -Version: 1.3.41 +Version: 1.3.42 Maintainer: Yeong-Kyoon Lee Package: emulator-manager diff --git a/src/org/tizen/emulator/manager/EmulatorManager.java b/src/org/tizen/emulator/manager/EmulatorManager.java index 452527c..f5ed9e4 100755 --- a/src/org/tizen/emulator/manager/EmulatorManager.java +++ b/src/org/tizen/emulator/manager/EmulatorManager.java @@ -64,6 +64,8 @@ public class EmulatorManager { // for multi touch private static boolean isInhoseMode = true; + private static RandomAccessFile randomAccessFile; + public static EmulatorManager getInstance() { return instance; } @@ -182,13 +184,14 @@ public class EmulatorManager { try{ checkConsoleMode(args); + randomAccessFile = new RandomAccessFile(new File(FilePath.getInstance().getBinPath() + + File.separator + "." +System.getProperty("user.name"))+ ".lock", + "rw"); if (isConsoleMode) { EMLogger.getInstance().initConsoleLogger(); try { - FileLock lock = new RandomAccessFile(new File(FilePath.getInstance().getBinPath() - + File.separator + "." +System.getProperty("user.name"))+ ".lock", - "rw").getChannel().tryLock(); + FileLock lock = randomAccessFile.getChannel().tryLock(); if (lock == null) { EMLogger.getLogger().log(Level.WARNING, "Can not launch Emulator Manager.\n" + "Another one with the same user name is running now.\n"); @@ -209,9 +212,7 @@ public class EmulatorManager { EMLogger.getInstance().initLogger(); MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); try { - FileLock lock = new RandomAccessFile(new File(FilePath.getInstance().getBinPath() - + File.separator + "." +System.getProperty("user.name"))+ ".lock", - "rw").getChannel().tryLock(); + FileLock lock = randomAccessFile.getChannel().tryLock(); if (lock == null) { msg.openInfoDialog("Can not launch Emulator Manager.\n" + "Another one with the same user name is running now."); diff --git a/src/org/tizen/emulator/manager/tool/CheckVirtualization.java b/src/org/tizen/emulator/manager/tool/CheckVirtualization.java index 1c18874..9121950 100644 --- a/src/org/tizen/emulator/manager/tool/CheckVirtualization.java +++ b/src/org/tizen/emulator/manager/tool/CheckVirtualization.java @@ -104,11 +104,13 @@ public class CheckVirtualization { private class Work extends Thread { public void run() { - if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { + if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 + || System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { int exitValue = 0; List cmd = new ArrayList(); - cmd.add(FilePath.getInstance().getBinPath() + File.separator + "check-hax.exe"); + cmd.add(FilePath.getInstance().getBinPath() + File.separator + + (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-hax.exe" : "check-hax")); ProcessBuilder pb = new ProcessBuilder(cmd); pb.directory(new File(FilePath.getInstance().getBinPath())); diff --git a/src/org/tizen/emulator/manager/tool/FilePath.java b/src/org/tizen/emulator/manager/tool/FilePath.java index e307584..ec389c1 100644 --- a/src/org/tizen/emulator/manager/tool/FilePath.java +++ b/src/org/tizen/emulator/manager/tool/FilePath.java @@ -148,6 +148,7 @@ public class FilePath { sdkPath = s2; } } + in.close(); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/org/tizen/emulator/manager/ui/AboutDialog.java b/src/org/tizen/emulator/manager/ui/AboutDialog.java index 956e8d3..4adf587 100644 --- a/src/org/tizen/emulator/manager/ui/AboutDialog.java +++ b/src/org/tizen/emulator/manager/ui/AboutDialog.java @@ -47,9 +47,12 @@ public class AboutDialog { Composite upperComposite = new Composite(dialog, SWT.NONE); upperComposite.setLayout(getGridLayout(2, false)); upperComposite.setSize(width, 180); - upperComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); upperComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + if (!(System.getProperty("os.name").toLowerCase().indexOf("mac") > -1)) { + upperComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + } + // About icon Label label = new Label(upperComposite, SWT.NONE); label.setImage(ResourceRegistry.getImage(ImageName.ABOUTSDK)); @@ -105,7 +108,11 @@ public class AboutDialog { public void widgetDefaultSelected(SelectionEvent arg0) { } public void widgetSelected(SelectionEvent arg0) { - org.eclipse.swt.program.Program.launch(EmulatorVMs.getInstance().getVMsBaseDirectory()); + try { + org.eclipse.swt.program.Program.launch(EmulatorVMs.getInstance().getVMsBaseDirectory()); + } catch (Exception e) { + return; + } } }); @@ -119,7 +126,11 @@ public class AboutDialog { public void widgetDefaultSelected(SelectionEvent arg0) { } public void widgetSelected(SelectionEvent arg0) { - org.eclipse.swt.program.Program.launch("https://developer.tizen.org"); + try { + org.eclipse.swt.program.Program.launch("https://developer.tizen.org"); + } catch (Exception e) { + return; + } } }); diff --git a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java b/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java index b2d982a..7fcf899 100644 --- a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java +++ b/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java @@ -108,6 +108,8 @@ public class VMPropertyView implements TableWidgetChangeListener { TableWidget widget = null; TableEditor editor = null; for (int i = 0; i < list.size(); i++) { + // clear table item.. + itemList.get(i).setText(1,""); widget = list.get(i); widget.settingWidget(table, oldValue); -- 2.7.4