|
Lines 13-24
Link Here
|
| 13 |
|
13 |
|
| 14 |
import java.net.URI; |
14 |
import java.net.URI; |
| 15 |
import java.net.URISyntaxException; |
15 |
import java.net.URISyntaxException; |
| 16 |
|
|
|
| 17 |
import org.eclipse.core.filesystem.IFileInfo; |
16 |
import org.eclipse.core.filesystem.IFileInfo; |
| 18 |
import org.eclipse.core.filesystem.URIUtil; |
17 |
import org.eclipse.core.filesystem.URIUtil; |
| 19 |
import org.eclipse.core.resources.IProject; |
18 |
import org.eclipse.core.resources.IProject; |
|
|
19 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 20 |
import org.eclipse.core.runtime.CoreException; |
20 |
import org.eclipse.core.runtime.CoreException; |
| 21 |
import org.eclipse.core.runtime.IPath; |
|
|
| 22 |
import org.eclipse.core.runtime.IStatus; |
21 |
import org.eclipse.core.runtime.IStatus; |
| 23 |
import org.eclipse.core.runtime.Path; |
22 |
import org.eclipse.core.runtime.Path; |
| 24 |
import org.eclipse.core.runtime.Platform; |
23 |
import org.eclipse.core.runtime.Platform; |
|
Lines 382-401
Link Here
|
| 382 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
381 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
| 383 |
} |
382 |
} |
| 384 |
|
383 |
|
| 385 |
if (existingProject == null) { |
384 |
//create a dummy project for the purpose of validation if necessary |
| 386 |
IPath projectPath = new Path(locationFieldContents); |
385 |
IProject project = existingProject; |
| 387 |
if (Platform.getLocation().isPrefixOf(projectPath)) { |
386 |
if (project == null) { |
| 388 |
return IDEWorkbenchMessages.WizardNewProjectCreationPage_defaultLocationError; |
387 |
String name = new Path(locationFieldContents).lastSegment(); |
| 389 |
} |
388 |
project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); |
| 390 |
|
389 |
} |
| 391 |
} else { |
390 |
IStatus locationStatus = project.getWorkspace() |
| 392 |
IStatus locationStatus = existingProject.getWorkspace() |
391 |
.validateProjectLocationURI(project, newPath); |
| 393 |
.validateProjectLocationURI(existingProject, newPath); |
|
|
| 394 |
|
| 395 |
if (!locationStatus.isOK()) { |
| 396 |
return locationStatus.getMessage(); |
| 397 |
} |
| 398 |
|
392 |
|
|
|
393 |
if (!locationStatus.isOK()) { |
| 394 |
return locationStatus.getMessage(); |
| 395 |
} |
| 396 |
if (existingProject != null) { |
| 399 |
URI projectPath = existingProject.getLocationURI(); |
397 |
URI projectPath = existingProject.getLocationURI(); |
| 400 |
if (projectPath != null && URIUtil.equals(projectPath, newPath)) { |
398 |
if (projectPath != null && URIUtil.equals(projectPath, newPath)) { |
| 401 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |
399 |
return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; |