if (remotePathStr.length() == 0) {
setError(Messages.PathMapperEntryDialog_9);
return;
}
try {
mapping.remotePath = new VirtualPath(remotePathStr);
} catch (IllegalArgumentException e) {
setError(Messages.PathMapperEntryDialog_10);
return;
}
// Workspace file:
if (fWorkspacePathBtn.getSelection()) {
String workspacePath = fWorkspacePathText.getText().trim();
if (workspacePath.length() == 0) {
setError(Messages.PathMapperEntryDialog_11);
return;
}
boolean pathExistsInWorkspace = false;
mapping.type = (Type) fWorkspacePathText.getData();
if (mapping.type == Type.INCLUDE_FOLDER
|| mapping.type == Type.INCLUDE_VAR) {
pathExistsInWorkspace = new File(workspacePath).exists();
} else {
pathExistsInWorkspace = (ResourcesPlugin.getWorkspace()
.getRoot().findMember(workspacePath) != null);
}
if (!pathExistsInWorkspace) {
setError(NLS.bind(Messages.PathMapperEntryDialog_12,
workspacePath));
return;
}
try {
mapping.localPath = new VirtualPath(workspacePath);
} catch (IllegalArgumentException e) {
setError(Messages.PathMapperEntryDialog_13);
return;
}
} else if (ignoreMappingBtn.getSelection()) {
mapping.type = Type.SERVER;
mapping.localPath = mapping.remotePath.clone();
} else { // External file:
String externalPath = fExternalPathText.getText().trim();
if (externalPath.length() == 0) {
setError(Messages.PathMapperEntryDialog_14);
return;
}
if (!new File(externalPath).exists()) {
setError(NLS.bind(Messages.PathMapperEntryDialog_15,
externalPath));
return;
}
try {
mapping.type = Type.EXTERNAL;
mapping.localPath = new VirtualPath(externalPath);
} catch (IllegalArgumentException e) {
setError(Messages.PathMapperEntryDialog_16);
return;
}
}