Lines 103-109
Link Here
|
103 |
import org.eclipse.core.resources.IWorkspaceRoot; |
103 |
import org.eclipse.core.resources.IWorkspaceRoot; |
104 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
104 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
105 |
import org.eclipse.core.resources.ResourcesPlugin; |
105 |
import org.eclipse.core.resources.ResourcesPlugin; |
106 |
import org.eclipse.core.runtime.Assert; |
|
|
107 |
import org.eclipse.core.runtime.CoreException; |
106 |
import org.eclipse.core.runtime.CoreException; |
108 |
import org.eclipse.core.runtime.IConfigurationElement; |
107 |
import org.eclipse.core.runtime.IConfigurationElement; |
109 |
import org.eclipse.core.runtime.IExtension; |
108 |
import org.eclipse.core.runtime.IExtension; |
Lines 3765-3775
Link Here
|
3765 |
boolean isExported) { |
3764 |
boolean isExported) { |
3766 |
|
3765 |
|
3767 |
if (containerPath == null) { |
3766 |
if (containerPath == null) { |
3768 |
Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$ |
3767 |
throw new ClasspathEntry.AssertionFailedException("Container path cannot be null"); //$NON-NLS-1$ |
3769 |
} else if (containerPath.segmentCount() < 1) { |
3768 |
} else if (containerPath.segmentCount() < 1) { |
3770 |
Assert.isTrue( |
3769 |
throw new ClasspathEntry.AssertionFailedException("Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ |
3771 |
false, |
|
|
3772 |
"Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ |
3773 |
} |
3770 |
} |
3774 |
return new ClasspathEntry( |
3771 |
return new ClasspathEntry( |
3775 |
IPackageFragmentRoot.K_SOURCE, |
3772 |
IPackageFragmentRoot.K_SOURCE, |
Lines 3952-3964
Link Here
|
3952 |
IClasspathAttribute[] extraAttributes, |
3949 |
IClasspathAttribute[] extraAttributes, |
3953 |
boolean isExported) { |
3950 |
boolean isExported) { |
3954 |
|
3951 |
|
3955 |
if (path == null) Assert.isTrue(false, "Library path cannot be null"); //$NON-NLS-1$ |
3952 |
if (path == null) throw new ClasspathEntry.AssertionFailedException("Library path cannot be null"); //$NON-NLS-1$ |
3956 |
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute: " + path); //$NON-NLS-1$ |
3953 |
if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute: " + path); //$NON-NLS-1$ |
3957 |
if (sourceAttachmentPath != null) { |
3954 |
if (sourceAttachmentPath != null) { |
3958 |
if (sourceAttachmentPath.isEmpty()) { |
3955 |
if (sourceAttachmentPath.isEmpty()) { |
3959 |
sourceAttachmentPath = null; // treat empty path as none |
3956 |
sourceAttachmentPath = null; // treat empty path as none |
3960 |
} else if (!sourceAttachmentPath.isAbsolute()) { |
3957 |
} else if (!sourceAttachmentPath.isAbsolute()) { |
3961 |
Assert.isTrue(false, "Source attachment path '" //$NON-NLS-1$ |
3958 |
throw new ClasspathEntry.AssertionFailedException("Source attachment path '" //$NON-NLS-1$ |
3962 |
+ sourceAttachmentPath |
3959 |
+ sourceAttachmentPath |
3963 |
+ "' for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
3960 |
+ "' for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
3964 |
} |
3961 |
} |
Lines 4007-4013
Link Here
|
4007 |
*/ |
4004 |
*/ |
4008 |
public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { |
4005 |
public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { |
4009 |
|
4006 |
|
4010 |
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4007 |
if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4011 |
|
4008 |
|
4012 |
return newProjectEntry( |
4009 |
return newProjectEntry( |
4013 |
path, |
4010 |
path, |
Lines 4072-4078
Link Here
|
4072 |
IClasspathAttribute[] extraAttributes, |
4069 |
IClasspathAttribute[] extraAttributes, |
4073 |
boolean isExported) { |
4070 |
boolean isExported) { |
4074 |
|
4071 |
|
4075 |
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4072 |
if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4076 |
|
4073 |
|
4077 |
return new ClasspathEntry( |
4074 |
return new ClasspathEntry( |
4078 |
IPackageFragmentRoot.K_SOURCE, |
4075 |
IPackageFragmentRoot.K_SOURCE, |
Lines 4274-4283
Link Here
|
4274 |
*/ |
4271 |
*/ |
4275 |
public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation, IClasspathAttribute[] extraAttributes) { |
4272 |
public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation, IClasspathAttribute[] extraAttributes) { |
4276 |
|
4273 |
|
4277 |
if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$ |
4274 |
if (path == null) throw new ClasspathEntry.AssertionFailedException("Source path cannot be null"); //$NON-NLS-1$ |
4278 |
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4275 |
if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ |
4279 |
if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ |
4276 |
if (exclusionPatterns == null) throw new ClasspathEntry.AssertionFailedException("Exclusion pattern set cannot be null"); //$NON-NLS-1$ |
4280 |
if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$ |
4277 |
if (inclusionPatterns == null) throw new ClasspathEntry.AssertionFailedException("Inclusion pattern set cannot be null"); //$NON-NLS-1$ |
4281 |
|
4278 |
|
4282 |
return new ClasspathEntry( |
4279 |
return new ClasspathEntry( |
4283 |
IPackageFragmentRoot.K_SOURCE, |
4280 |
IPackageFragmentRoot.K_SOURCE, |
Lines 4418-4428
Link Here
|
4418 |
IClasspathAttribute[] extraAttributes, |
4415 |
IClasspathAttribute[] extraAttributes, |
4419 |
boolean isExported) { |
4416 |
boolean isExported) { |
4420 |
|
4417 |
|
4421 |
if (variablePath == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ |
4418 |
if (variablePath == null) throw new ClasspathEntry.AssertionFailedException("Variable path cannot be null"); //$NON-NLS-1$ |
4422 |
if (variablePath.segmentCount() < 1) { |
4419 |
if (variablePath.segmentCount() < 1) { |
4423 |
Assert.isTrue( |
4420 |
throw new ClasspathEntry.AssertionFailedException("Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ |
4424 |
false, |
|
|
4425 |
"Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ |
4426 |
} |
4421 |
} |
4427 |
|
4422 |
|
4428 |
return new ClasspathEntry( |
4423 |
return new ClasspathEntry( |
Lines 4641-4647
Link Here
|
4641 |
*/ |
4636 |
*/ |
4642 |
public static void setClasspathContainer(IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { |
4637 |
public static void setClasspathContainer(IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { |
4643 |
if (affectedProjects.length != respectiveContainers.length) |
4638 |
if (affectedProjects.length != respectiveContainers.length) |
4644 |
Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ |
4639 |
throw new ClasspathEntry.AssertionFailedException("Projects and containers collections should have the same size"); //$NON-NLS-1$ |
4645 |
SetContainerOperation operation = new SetContainerOperation(containerPath, affectedProjects, respectiveContainers); |
4640 |
SetContainerOperation operation = new SetContainerOperation(containerPath, affectedProjects, respectiveContainers); |
4646 |
operation.runOperation(monitor); |
4641 |
operation.runOperation(monitor); |
4647 |
} |
4642 |
} |
Lines 4692-4698
Link Here
|
4692 |
IProgressMonitor monitor) |
4687 |
IProgressMonitor monitor) |
4693 |
throws JavaModelException { |
4688 |
throws JavaModelException { |
4694 |
|
4689 |
|
4695 |
if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ |
4690 |
if (path == null) throw new ClasspathEntry.AssertionFailedException("Variable path cannot be null"); //$NON-NLS-1$ |
4696 |
setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); |
4691 |
setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); |
4697 |
} |
4692 |
} |
4698 |
|
4693 |
|
Lines 4727-4733
Link Here
|
4727 |
IProgressMonitor monitor) |
4722 |
IProgressMonitor monitor) |
4728 |
throws JavaModelException { |
4723 |
throws JavaModelException { |
4729 |
|
4724 |
|
4730 |
if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ |
4725 |
if (variableNames.length != paths.length) throw new ClasspathEntry.AssertionFailedException("Variable names and paths collections should have the same size"); //$NON-NLS-1$ |
4731 |
SetVariablesOperation operation = new SetVariablesOperation(variableNames, paths, true/*update preferences*/); |
4726 |
SetVariablesOperation operation = new SetVariablesOperation(variableNames, paths, true/*update preferences*/); |
4732 |
operation.runOperation(monitor); |
4727 |
operation.runOperation(monitor); |
4733 |
} |
4728 |
} |