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


Java IWorkspaceRoot类代码示例

本文整理汇总了Java中org.eclipse.core.resources.IWorkspaceRoot的典型用法代码示例。如果您正苦于以下问题:Java IWorkspaceRoot类的具体用法?Java IWorkspaceRoot怎么用?Java IWorkspaceRoot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IWorkspaceRoot类属于org.eclipse.core.resources包,在下文中一共展示了IWorkspaceRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResourcesWithExtension

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public ArrayList<String> getResourcesWithExtension(String ext, String containerName) {
	ArrayList<String> ret = new ArrayList<String>();
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File prjLoc = new File(loc.toString());
		Collection<File> res = FileUtils.listFiles(prjLoc, FileFilterUtils.suffixFileFilter(ext, IOCase.INSENSITIVE), TrueFileFilter.INSTANCE);
		for (File file : res)
			ret.add(file.getAbsolutePath());
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:15,代码来源:PluginUtil.java

示例2: getChildren

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
@Override
public Object[] getChildren(final Object element) {

	if (workingSetManagerBroker.isWorkingSetTopLevel()) {
		if (element instanceof IWorkspaceRoot) {
			final WorkingSetManager manager = workingSetManagerBroker.getActiveManager();
			if (manager != null) {
				return manager.getWorkingSets();
			}
		} else if (element instanceof WorkingSet) {
			return ((WorkingSet) element).getElements();
		}
	}

	final Object[] children = super.getChildren(element);

	if (element instanceof IProject && ((IProject) element).isAccessible()) {
		return Arrays2.add(children, getVirtualNodes((IProject) element));
	}

	return children;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:N4JSProjectExplorerContentProvider.java

示例3: 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

示例4: createProjectPluginResource

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public IProject createProjectPluginResource(String projectName, IProgressMonitor monitor) throws CoreException {
	IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
	IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
	IProject resourceProject = myWorkspaceRoot.getProject(projectName);
	
	if (!resourceProject.exists()) {		
		if(myWorkspaceRoot.getLocation().toFile().equals(new Path(Engine.PROJECTS_PATH).toFile())){
			logDebug("createProjectPluginResource : project is in the workspace folder");
			
			resourceProject.create(monitor);
		}else{
			logDebug("createProjectPluginResource: project isn't in the workspace folder");
	
			IPath projectPath = new Path(Engine.PROJECTS_PATH + "/" + projectName).makeAbsolute();
			IProjectDescription description = myWorkspace.newProjectDescription(projectName);
			description.setLocation(projectPath);
			resourceProject.create(description, monitor);
		}
	}
	
	return resourceProject;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:23,代码来源:ConvertigoPlugin.java

示例5: collectAllWorkspaceFiles

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public static List<ResourceItem> collectAllWorkspaceFiles(IWorkspaceRoot workspace) {
	List<ResourceItem> files = new ArrayList<>();
	
	IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
		public boolean visit(IResourceProxy proxy) throws CoreException {
			if (proxy.getType() != IResource.FILE) return true;
			if (proxy.isDerived()) return false;
			if (proxy.isPhantom()) return false;
			if (proxy.isHidden()) return false;
			IFile file = (IFile) proxy.requestResource();
			files.add(makeResourceItem(file));
			return false;
		}
	};
	
	try {
		IResource[] resources = workspace.members();
		for(IResource resource : resources) {
			if (!resource.getProject().isOpen()) continue;
			resource.accept(visitor, 0);
		}
	} catch (CoreException e) {
		throw new RuntimeException(e);
	}
	return files;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:27,代码来源:EclipseWorkbench.java

示例6: getFinalAssemblyDefinition

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public CompositeNode getFinalAssemblyDefinition(String name, String containerName) {
	CompositeNode ret = null;
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File file = new File(loc.toOSString() + File.separator + name + ".fassmbl");
		try {
			ret = ParseUtil.getFinalAssemblyNodeFromText(FileUtils.readFileToString(file));
		} catch (IOException e) {
			EclipseUtil.writeStactTraceToConsole(e);
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:PluginUtil.java

示例7: getLogicalSystemDefinition

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public LogicalSystemNode getLogicalSystemDefinition(String name, String containerName) {
	LogicalSystemNode ret = null;
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File file = new File(loc.toOSString() + File.separator + name + ".lsys");
		try {
			ret = ParseUtil.getLogicalSystemNodeFromText(FileUtils.readFileToString(file));
		} catch (IOException e) {
			EclipseUtil.writeStactTraceToConsole(e);
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:PluginUtil.java

示例8: getComponentImplementationDefinition

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
public ComponentImplementationNode getComponentImplementationDefinition(String name, String containerName) {
	ComponentImplementationNode ret = null;
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File file = new File(loc.toOSString() + File.separator + name + ".cimpl");
		try {
			ret = ParseUtil.getComponentImplementationNodeFromText(FileUtils.readFileToString(file));
		} catch (IOException e) {
			EclipseUtil.writeStactTraceToConsole(e);
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:PluginUtil.java

示例9: 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

示例10: createFileDeleteIfExists

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
/**
 * Create a file in a folder with the specified name and content
 * 
 * @param fullpath
 * @param filename
 * @param content
 * @throws CoreException
 * @throws InterruptedException
 */
public static IFile createFileDeleteIfExists(String fullpath, String filename, String content,
		IProgressMonitor monitor) throws CoreException, InterruptedException {
	SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
	subMonitor.setTaskName("Create file delete if it exists " + fullpath);
	IFile newFile;
	try {
		IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
		IContainer container = (IContainer) wroot.findMember(new Path(fullpath));
		newFile = container.getFile(new Path(filename));
		if (newFile.exists()) {
			JDTManager.rename(newFile, new NullProgressMonitor());
			newFile.delete(true, new NullProgressMonitor());
		}
		subMonitor.split(30);
		byte[] source = content.getBytes(Charset.forName("UTF-8"));
		newFile.create(new ByteArrayInputStream(source), true, new NullProgressMonitor());
		subMonitor.split(70);
	} finally {
		subMonitor.done();
	}
	return newFile;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:32,代码来源:ResourceManager.java

示例11: createChange

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	
	copyToPath=getArguments().getDestination().toString();
	IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = workSpaceRoot.getProject(copyToPath.split("/")[1]);
	IFolder jobFolder = project.getFolder(copyToPath.substring(copyToPath.indexOf('/', 2)));
	previousJobFiles=new ArrayList<>();
	for (IResource iResource : jobFolder.members()) {
		if (!(iResource instanceof IFolder)) {
			IFile iFile = (IFile) iResource;
			 if (iFile.getFileExtension().equalsIgnoreCase(Messages.JOB_EXT)) {
				 previousJobFiles.add(iFile);
			 }
		}
	}
	copiedFileList.add(modifiedResource);
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:JobCopyParticipant.java

示例12: doSaveAs

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
@Override
public void doSaveAs() {
	String jobId = getActiveProject() + "." + getJobName();
	DataViewerUtility.INSTANCE.closeDataViewerWindows(JobManager.INSTANCE.getPreviouslyExecutedJobs().get(jobId));
	
	deleteDebugFiles(jobId);
	
	Map<String, String> currentParameterMap = getCurrentParameterMap();
	IFile file=opeSaveAsDialog();
	saveJob(file,true);
	IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = workSpaceRoot.getProject(getActiveProject());
	IFolder paramFolder = project.getFolder(Messages.PARAM);
	IFile filename=paramFolder.getFile(oldFileName.replace(Messages.JOBEXTENSION,Messages.PROPERTIES_EXTENSION));
	copyParameterFile(currentParameterMap,filename);
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:ELTGraphicalEditor.java

示例13: 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

示例14: getEditorInput

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
@Override
public IEditorInput getEditorInput(Object element) {
	if (element instanceof ILineBreakpoint) {
		return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
	}
	IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(element.toString()));
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	IFile[] files = root.findFilesForLocationURI(fileStore.toURI());
	if (files != null) {
		for (IFile file : files) {
			if (file.exists()) {
				return new FileEditorInput(file);
			}
		}
	}
	return new FileStoreEditorInput(fileStore);
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:18,代码来源:DSPDebugModelPresentation.java

示例15: linkPressed

import org.eclipse.core.resources.IWorkspaceRoot; //导入依赖的package包/类
@Override
protected void linkPressed(final HyperlinkEvent event, final EObject project_p, final Session session) {
	if (project_p instanceof Project) {
		TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(project_p);
		domain.getCommandStack().execute(new RecordingCommand(domain) {

			@Override
			protected void doExecute() {
				final Project prj = ((Project) project_p);
				final Mapping mapping = ToPeriodicDerivation.getOrApply(prj);
				final DesignModel toBeAnalysedModel = (DesignModel) mapping.getSubLinks().get(0).getUniqueTargetValue("copy");
				final URI uri = prj.eResource().getURI();
				IPath path = new Path(uri.toPlatformString(true));
				final String filename = path.lastSegment().replaceAll(".time4sys", "-report.asciidoc");
				path = path.removeLastSegments(1);
				path = path.append(filename);
				IWorkspaceRoot wrkspc = ResourcesPlugin.getWorkspace().getRoot();
				final IFile output = wrkspc.getFile(path);
				generateReport(toBeAnalysedModel, output, null);
			}
		});

	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:25,代码来源:DesignSimpleReport.java


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