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