use of org.eclipse.core.resources.IProject 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.resources.IProject in project che by eclipse.
the class WorkspaceRoot method getProjects.
@Override
public IProject[] getProjects() {
ProjectRegistry projectRegistry = workspace.getProjectRegistry();
List<IProject> projects = new ArrayList<>();
List<RegisteredProject> rootProjects = projectRegistry.getProjects();
for (RegisteredProject rootProject : rootProjects) {
Project project = new Project(new Path(rootProject.getPath()), workspace);
projects.add(project);
}
return projects.toArray(new IProject[projects.size()]);
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class WorkspaceRoot method getProject.
@Override
public IProject getProject(String name) {
//first check our project cache
Project result = projectTable.get(name);
if (result == null) {
IPath projectPath = new Path(null, name).makeAbsolute();
//try to get the project using a canonical name
//.lastSegment();
String canonicalName = projectPath.toOSString();
result = projectTable.get(canonicalName);
if (result != null)
return result;
result = new Project(projectPath, workspace);
projectTable.putIfAbsent(canonicalName, result);
}
return result;
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class RenameJavaProjectChange method doRename.
@Override
protected void doRename(IProgressMonitor pm) throws CoreException {
try {
pm.beginTask(getName(), 2);
if (fUpdateReferences)
modifyClassPaths(new SubProgressMonitor(pm, 1));
IProject project = getProject();
if (project != null) {
IProjectDescription description = project.getDescription();
description.setName(getNewName());
project.move(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(pm, 1));
}
} finally {
pm.done();
}
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class RefactoringScopeFactory method addReferencingProjects.
/*
* Adds to <code> projects </code> IJavaProject objects for all projects directly or indirectly referencing focus. @param projects IJavaProjects will be added to this set
*/
private static void addReferencingProjects(IJavaProject focus, Set<IJavaProject> projects) throws JavaModelException {
IProject[] referencingProjects = focus.getProject().getReferencingProjects();
for (int i = 0; i < referencingProjects.length; i++) {
IJavaProject candidate = JavaCore.create(referencingProjects[i]);
if (candidate == null || projects.contains(candidate) || !candidate.exists())
// break cycle
continue;
IClasspathEntry entry = getReferencingClassPathEntry(candidate, focus);
if (entry != null) {
projects.add(candidate);
if (entry.isExported())
addReferencingProjects(candidate, projects);
}
}
}
Aggregations