use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class MavenTestClasspathProviderTest method buildMocks.
private void buildMocks(List<ClasspathEntry> entries) throws JavaModelException {
when(classpathService.getClasspath(anyString())).thenReturn(entries.stream().map(ClasspathEntry::dto).collect(Collectors.toList()));
for (ClasspathEntry entry : entries) {
if (!entry.external && entry.kind == IClasspathEntry.CPE_LIBRARY) {
IPath resourceLocation = new Path(entry.fileSystemPath);
IResource result = mock(IResource.class);
when(result.getLocation()).thenReturn(resourceLocation);
when(workspaceRoot.findMember(new Path(entry.fullPath))).thenReturn(result);
}
}
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class Container method findMember.
@Override
public IResource findMember(String memberPath, boolean phantom) {
IPath childPath = getFullPath().append(memberPath);
ResourceInfo info = workspace.getResourceInfo(childPath);
return info == null ? null : workspace.newResource(childPath, info.getType());
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class FileUtil method computeOverlap.
/**
* Returns true if the given file system locations overlap. If "bothDirections" is true,
* this means they are the same, or one is a proper prefix of the other. If "bothDirections"
* is false, this method only returns true if the locations are the same, or the first location
* is a prefix of the second. Returns false if the locations do not overlap
* Does the right thing with respect to case insensitive platforms.
*/
private static boolean computeOverlap(IPath location1, IPath location2, boolean bothDirections) {
IPath one = location1;
IPath two = location2;
// If we are on a case-insensitive file system then convert to all lower case.
if (!Workspace.caseSensitive) {
one = new Path(location1.toOSString().toLowerCase());
two = new Path(location2.toOSString().toLowerCase());
}
return one.isPrefixOf(two) || (bothDirections && two.isPrefixOf(one));
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class Project method getDescription.
@Override
public IProjectDescription getDescription() throws CoreException {
return new IProjectDescription() {
@Override
public IBuildConfiguration[] getBuildConfigReferences(String s) {
return new IBuildConfiguration[0];
}
@Override
public ICommand[] getBuildSpec() {
return new ICommand[0];
}
@Override
public String getComment() {
return null;
}
@Override
public IProject[] getDynamicReferences() {
return new IProject[0];
}
@Override
public IPath getLocation() {
return null;
}
@Override
public URI getLocationURI() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public String[] getNatureIds() {
RegisteredProject project = workspace.getProjectRegistry().getProject(path.toString());
if (project == null) {
ResourcesPlugin.log(new Status(IStatus.ERROR, "resource", "Can't find project: " + path.toOSString()));
return new String[0];
}
Map<String, List<String>> attributes = project.getAttributes();
String language = "";
if (attributes.containsKey("language")) {
language = attributes.get("language").get(0);
}
return "java".equals(language) ? new String[] { "org.eclipse.jdt.core.javanature" } : new String[] { language };
}
@Override
public IProject[] getReferencedProjects() {
return new IProject[0];
}
@Override
public boolean hasNature(String s) {
String[] natureIds = getNatureIds();
for (String id : natureIds) {
if (s.equals(id)) {
return true;
}
}
return false;
}
@Override
public ICommand newCommand() {
return null;
}
@Override
public void setActiveBuildConfig(String s) {
}
@Override
public void setBuildConfigs(String[] strings) {
}
@Override
public void setBuildConfigReferences(String s, IBuildConfiguration[] iBuildConfigurations) {
}
@Override
public void setBuildSpec(ICommand[] iCommands) {
}
@Override
public void setComment(String s) {
}
@Override
public void setDynamicReferences(IProject[] iProjects) {
}
@Override
public void setLocation(IPath iPath) {
}
@Override
public void setLocationURI(URI uri) {
}
@Override
public void setName(String s) {
}
@Override
public void setNatureIds(String[] strings) {
}
@Override
public void setReferencedProjects(IProject[] iProjects) {
}
};
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class Resource method isConflicting.
@Override
public boolean isConflicting(ISchedulingRule rule) {
if (this == rule)
return true;
//must not schedule at same time as notification
if (rule.getClass().equals(WorkManager.NotifyRule.class))
return true;
if (rule instanceof MultiRule) {
MultiRule multi = (MultiRule) rule;
ISchedulingRule[] children = multi.getChildren();
for (int i = 0; i < children.length; i++) if (isConflicting(children[i]))
return true;
return false;
}
if (!(rule instanceof IResource))
return false;
IResource resource = (IResource) rule;
if (!workspace.equals(resource.getWorkspace()))
return false;
IPath otherPath = resource.getFullPath();
return path.isPrefixOf(otherPath) || otherPath.isPrefixOf(path);
}
Aggregations