From: minkee.lee Date: Wed, 15 Oct 2014 14:04:22 +0000 (+0900) Subject: Property: Fix file sharing option. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8384eefe278ea86da805c319bc73a3ba486f3519;p=sdk%2Femulator%2Femulator-manager.git Property: Fix file sharing option. - Check if sharing directory exists.(when create/modify VM, launch VM) Change-Id: I892374651797596b67bbd6329f5511ac8ec2c5d9 Signed-off-by: minkee.lee --- diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareDialogSubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareDialogSubViewItem.java index 8055a8a..a43fa05 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareDialogSubViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareDialogSubViewItem.java @@ -39,9 +39,6 @@ import org.tizen.emulator.manager.vms.xml.template.Item; public class FileShareDialogSubViewItem extends FileSubViewItem { - private String oldPathName; - private String newPathName; - public FileShareDialogSubViewItem(LabelViewItem parentItem, Composite comp, Item template) { super(parentItem, comp, template); @@ -65,15 +62,15 @@ public class FileShareDialogSubViewItem extends FileSubViewItem { @Override public boolean settingModifyItem(VMPropertyValue value) { - newValue = value.fileSharePath; + newValue = oldValue = value.fileSharePath; newPathName = oldPathName = value.fileSharePathName; if (value.isFileShareSupport) { - filePathLabel.setText(oldPathName); + filePathLabel.setText(newPathName); filePathLabel.setToolTipText(newValue); selectFileButton.setEnabled(true); } else { - filePathLabel.setText(oldPathName); + filePathLabel.setText(newPathName); selectFileButton.setEnabled(false); } @@ -81,12 +78,18 @@ public class FileShareDialogSubViewItem extends FileSubViewItem { } public void setFileShareOn() { + newValue = oldValue; + newPathName = oldPathName; selectFileButton.setEnabled(true); filePathLabel.setText(newPathName); + filePathLabel.setToolTipText(newValue); } public void setFileShareOff() { + newValue = ""; + newPathName = ""; selectFileButton.setEnabled(false); - filePathLabel.setText(""); + filePathLabel.setText(newPathName); + filePathLabel.setToolTipText(newValue); } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileSubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileSubViewItem.java index 3aecfbf..175f4a6 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileSubViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileSubViewItem.java @@ -59,6 +59,9 @@ public class FileSubViewItem extends SubViewItem { protected String oldValue; protected String newValue; + protected String oldPathName; + protected String newPathName; + // for modify view protected ImageLabel filePathLabel; protected ImageButton selectFileButton; @@ -147,10 +150,10 @@ public class FileSubViewItem extends SubViewItem { String path = fd.open(); if (path != null) { - newValue = path; - String fileName = newValue.substring(newValue + oldValue = newValue = path; + oldPathName = newPathName = newValue.substring(newValue .lastIndexOf(File.separator) + 1, newValue.length()); - filePathLabel.setText(fileName); + filePathLabel.setText(newPathName); filePathLabel.setToolTipText(newValue); } @@ -164,10 +167,10 @@ public class FileSubViewItem extends SubViewItem { EMLogger.getLogger().fine("Open Directory Dialog"); String path = dd.open(); if (path != null) { - newValue = path; - String dirName = path.substring(path + oldValue = newValue = path; + oldPathName = newPathName = path.substring(path .lastIndexOf(File.separator) + 1, path.length()); - filePathLabel.setText(dirName); + filePathLabel.setText(newPathName); filePathLabel.setToolTipText(newValue); } } diff --git a/common-project/src/org/tizen/emulator/manager/vms/Creator.java b/common-project/src/org/tizen/emulator/manager/vms/Creator.java index 73c8547..20cc9b9 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/Creator.java +++ b/common-project/src/org/tizen/emulator/manager/vms/Creator.java @@ -232,6 +232,10 @@ public class Creator { if (newVM.fileSharePath == null || newVM.fileSharePath.isEmpty()) { throw new VMCreatorException("Select sharing file path"); } + File file = new File(newVM.fileSharePath); + if (!file.exists()) { + throw new VMCreatorException("Sharing file path is invalid."); + } } } diff --git a/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java b/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java index 1de2db5..2e98a9b 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java +++ b/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java @@ -113,6 +113,15 @@ public abstract class VMWorkerCommon { } } + // Check File sharing + String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath(); + if (fileshare != null) { + File f = new File(fileshare); + if (!f.exists()) { + throw new VMWorkerException("File sharing path is invalid or not exist."); + } + } + isRunningNow(); if (!launcher.launch(property, wait)) {