当前位置: 首页>>代码示例>>Java>>正文


Java IWorkspaceRoot.getProjects方法代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:ProjectLocationAwareWorkingSetManager.java

示例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();
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:JPFPluginRebuilder.java

示例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;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:26,代码来源:ResourceUtils.java

示例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());
		}
	}
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:17,代码来源:JasonWizardPage.java

示例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()]);
  }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:22,代码来源:SVNWorkspaceRoot.java

示例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;
  }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:21,代码来源:SVNWorkspaceRoot.java

示例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);
		  }
    }
}
 
开发者ID:wpilibsuite,项目名称:EclipsePlugins,代码行数:20,代码来源:WPILibCPPPlugin.java

示例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);
			}
		}
}
 
开发者ID:wpilibsuite,项目名称:EclipsePlugins,代码行数:21,代码来源:WPILibJavaPlugin.java

示例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();
		}
	}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:31,代码来源:AddBuilder.java

示例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;
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:15,代码来源:HotClassReloaderUtil.java

示例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;
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:9,代码来源:NgProjectJob.java


注:本文中的org.eclipse.core.resources.IWorkspaceRoot.getProjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。