本文整理汇总了Java中org.eclipse.core.resources.IWorkspaceRoot.getProjects方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkspaceRoot.getProjects方法的具体用法?Java IWorkspaceRoot.getProjects怎么用?Java IWorkspaceRoot.getProjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IWorkspaceRoot
的用法示例。
在下文中一共展示了IWorkspaceRoot.getProjects方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProjectLocation
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
private Multimap<String, IProject> initProjectLocation() {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IProject[] projects = root.getProjects();
final Multimap<String, IProject> locations = HashMultimap.create();
// initialize the repository paths
repositoryPaths = repositoriesProvider.getWorkspaceRepositories().stream()
.map(r -> r.getDirectory().getParentFile().toPath()).collect(Collectors.toSet());
for (final IProject project : projects) {
if (isRemoteEditNature(project)) {
continue;
}
final String pair = getWorkingSetId(project);
locations.put(pair, project);
}
return locations;
}
示例2: resourceChanged
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event)
{
if( event.getType() == IResourceChangeEvent.PRE_BUILD )
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
if( fTouchWorkspace )
{
IProject[] projects = root.getProjects();
for( int i = 0; i < projects.length; i++ )
{
touchProject(projects[i]);
}
}
else
{
Iterator<String> iter = fProjectNames.iterator();
while( iter.hasNext() )
{
touchProject(root.getProject(iter.next()));
}
}
fTouchWorkspace = false;
fProjectNames.clear();
}
}
示例3: getProjectMap
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
/**
* Obtient la map Project vers Projet Java du workspace courant.
*
* @return Map des projets.
*/
public static JavaProjectMap getProjectMap() {
JavaProjectMap projects = new JavaProjectMap();
/* Racine du workspace courant. */
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
/* Parcourt les projets de la racine. */
for (IProject project : wsRoot.getProjects()) {
/* Vérication que le projet est un projet Java accessible. */
if (!project.isAccessible() || !JdtUtils.isJavaProject(project)) {
continue;
}
/* Obtient l'AST du projet. */
IJavaProject javaProject = JavaCore.create(project);
projects.put(project, javaProject);
}
return projects;
}
示例4: addProjectsToList
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
private void addProjectsToList() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject[] projects = root.getProjects();
for (IProject project : projects){
try {
if (project.isNatureEnabled("jasonide.jasonNature")){
projectsList.add(project.getName());
}
} catch (CoreException e) {
//e.printStackTrace();
//MessageDialog.openError(shell, "CoreException", e.getMessage());
}
}
}
示例5: getResourcesFor
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
/**
* Gets the resources to which the local filesystem <code>location</code> is corresponding to.
* The resources do not need to exists (yet)
* @return IResource[]
* @throws SVNException
*/
public static IResource[] getResourcesFor(IPath location, boolean includeProjects) {
Set<IResource> resources = new LinkedHashSet<IResource>();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = root.getProjects();
for (IProject project : projects) {
IResource resource = getResourceFor(project, location);
if (resource != null) {
resources.add(resource);
}
if (includeProjects && isManagedBySubclipse(project) && location.isPrefixOf(project.getLocation())) {
resources.add(project);
}
}
return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
示例6: getRepositoryFor
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
/**
* Gets the repository which the local filesystem <code>location</code> belongs to.
*/
public static ISVNRepositoryLocation getRepositoryFor(IPath location) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = root.getProjects();
for (IProject project : projects) {
if (project.getLocation().isPrefixOf(location) && SVNWorkspaceRoot.isManagedBySubclipse(project)) {
try {
SVNTeamProvider teamProvider = (SVNTeamProvider)RepositoryProvider.getProvider(project, SVNProviderPlugin.getTypeId());
return teamProvider.getSVNWorkspaceRoot().getRepository();
} catch (SVNException e) {
// an exception is thrown when resource is not managed
SVNProviderPlugin.log(e);
return null;
}
}
}
return null;
}
示例7: updateProjects
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
public void updateProjects() {
WPILibCPPPlugin.logInfo("Updating projects");
// Get the root of the workspace
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
// Get all projects in the workspace
IProject[] projects = root.getProjects();
// Loop over all projects
for (IProject project : projects) {
try {
if(project.hasNature("edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature") && project.hasNature("org.eclipse.cdt.core.ccnature")){
updateVariables(project);
}
} catch (CoreException e) {
WPILibCPPPlugin.logError("Error updating projects.", e);
}
}
}
示例8: updateProjects
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
public void updateProjects() {
WPILibJavaPlugin.logInfo("Updating projects");
// Get the root of the workspace
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
// Get all projects in the workspace
IProject[] projects = root.getProjects();
// Loop over all projects
for (IProject project : projects) {
try {
if(project.hasNature("edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature") && project.hasNature("org.eclipse.jdt.core.javanature")){
updateVariables(project);
} else {
}
} catch (CoreException e) {
WPILibJavaPlugin.logError("Error updating projects.", e);
}
}
}
示例9: addBuilder
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
public static void addBuilder(final IProject project) {
try {
// verify already registered builders
if (hasBuilder(project))
// already enabled
return;
// Remove all incremental builders from all other projects
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
for (IProject p : workspaceRoot.getProjects())
RemoveBuilder.removeBuilder(p);
// add builder to project properties
IProjectDescription description = project.getDescription();
final ICommand buildCommand = description.newCommand();
buildCommand.setBuilderName(Config.BUILDER_ID);
final List<ICommand> commands = new ArrayList<ICommand>();
commands.addAll(Arrays.asList(description.getBuildSpec()));
commands.add(buildCommand);
description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
project.setDescription(description, null);
} catch (final CoreException e) {
// Could not read/write project description
e.printStackTrace();
}
}
示例10: getAllTopLevelPackages
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
public static Collection<IPackageFragment> getAllTopLevelPackages() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
Set<IPackageFragment> packages = new LinkedHashSet<>();
for (IProject project : root.getProjects()) {
if (project.isAccessible()){
IJavaProject jp = JavaCore.create(project);
if (jp != null) {
packages.addAll(getTopLevelPackages(jp));
}
}
}
return packages;
}
示例11: projectAlreadyExistsInWorkspace
import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
private IProject projectAlreadyExistsInWorkspace(File directory, IWorkspaceRoot workspaceRoot) {
for (IProject project : workspaceRoot.getProjects()) {
if (project.getLocation().toFile().getAbsoluteFile().equals(directory.getAbsoluteFile())) {
return project;
}
}
return null;
}