本文整理匯總了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;
}