public class FileShareDialogSubViewItem extends FileSubViewItem {
- private String oldPathName;
- private String newPathName;
-
public FileShareDialogSubViewItem(LabelViewItem parentItem, Composite comp,
Item template) {
super(parentItem, comp, template);
@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);
}
}
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);
}
}
protected String oldValue;
protected String newValue;
+ protected String oldPathName;
+ protected String newPathName;
+
// for modify view
protected ImageLabel filePathLabel;
protected ImageButton selectFileButton;
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);
}
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);
}
}
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.");
+ }
}
}
}
}
+ // 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)) {