當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。