Refine search
private IFile getFile(IPath path) { if (path.segmentCount() > 1) { return ResourcesPlugin.getWorkspace().getRoot().getFile(path); } return null; }
@Override public String getDefaultCharset(boolean checkImplicit) { if (checkImplicit) return ResourcesPlugin.getEncoding(); String enc = ResourcesPlugin.getPlugin().getPluginPreferences().getString(ResourcesPlugin.PREF_ENCODING); return enc == null || enc.length() == 0 ? null : enc; }
public LocalMetaArea() { super(); metaAreaLocation = ResourcesPlugin.getPlugin().getStateLocation(); projectMetaLocation = metaAreaLocation.append(F_PROJECTS); }
/** * Disposes this encoding support. */ public void dispose() { Preferences p= ResourcesPlugin.getPlugin().getPluginPreferences(); p.removePropertyChangeListener(fPropertyChangeListener); fTextEditor= null; }
/** * Returns whether the given project is available. * * @param projectName project name * @return whether the project exists and is open */ private boolean isAvailable(String projectName) { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); return project.exists() && project.isOpen(); }
private IContainer getContainer(ILaunchConfiguration configuration) throws CoreException { String projectPath = configuration.getAttribute(DotnetRunDelegate.PROJECT_FOLDER, ""); //$NON-NLS-1$ if (projectPath == null) { return null; } IPath location = new Path(projectPath); if (location.toFile().isDirectory()) { return ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(location); } else if (location.segmentCount() == 1) { return ResourcesPlugin.getWorkspace().getRoot().getProject(location.segments()[0]); } else { return ResourcesPlugin.getWorkspace().getRoot().getFolder(location); } }
/** * Return the IResource within the workspace that maps to the given File */ public static IResource findResource(String fullPath) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath path = new Path(fullPath); return root.getFileForLocation(path); }
public static IResource findResource(String file) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath path = new Path(file); path.makeRelative(); while (path.segmentCount() > 1) { IResource resource = root.findMember(path); if (resource != null) { return resource; } path = path.removeFirstSegments(1); } return null; }
private boolean hasClosedProjectsInWorkspace() { IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (int i = 0; i < projects.length; i++) { if (!projects[i].isOpen()) return true; } return false; }
@Override public void buildDelta(IResourceChangeDescriptionFactory builder) { IResource existing= ResourcesPlugin.getWorkspace().getRoot().findMember(fDestination); if (existing != null && !existing.equals(fResource)) { builder.delete(existing); } builder.copy(fResource, fDestination); } @Override
private IPath getProjectPath() { String projName = (String)getProperty(FACET_PROJECT_NAME); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName); if (project.exists()){ return project.getLocation(); } IDataModel projModel = (IDataModel)getProperty(MASTER_PROJECT_DM); if (projModel.getBooleanProperty(IProjectCreationPropertiesNew.USE_DEFAULT_LOCATION)){ return new Path(projModel.getStringProperty(IProjectCreationPropertiesNew.PROJECT_LOCATION)).append(projName); } return new Path(projModel.getStringProperty(IProjectCreationPropertiesNew.USER_DEFINED_LOCATION)).append(projName); }
private void refreshProjectsList() { IProject[] knownProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); synchronized (locationsToProjects) { locationsToProjects.clear(); for (IProject project : knownProjects) { IPath location = project.getLocation(); if (location != null) { locationsToProjects.put(location, project); } } } }
private IResource getResource() { IResource resource= ResourcesPlugin.getWorkspace().getRoot().findMember(fResourcePath); if (resource == null && fResourcePath.segmentCount() == 1) { resource= ResourcesPlugin.getWorkspace().getRoot().getProject(fResourcePath.segment(0)); } return resource; }
public static IPath makeAbsolute(IPath p) { IPath absolutePath = p; if (p.toFile().exists()) { return p; } IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(p); if (resource != null && resource.exists()) { absolutePath = resource.getLocation(); } return absolutePath; }
private IResource createSourceResource(IResourceDelta delta) { IPath sourcePath = delta.getMovedFromPath(); IResource resource = delta.getResource(); IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); switch (resource.getType()) { case IResource.PROJECT : return wsRoot.getProject(sourcePath.segment(0)); case IResource.FOLDER : return wsRoot.getFolder(sourcePath); case IResource.FILE : return wsRoot.getFile(sourcePath); } return null; }
private static URI getRealLocation(String projectName, URI location) { if (location == null) { // inside workspace try { URI rootLocation= ResourcesPlugin.getWorkspace().getRoot().getLocationURI(); location= new URI(rootLocation.getScheme(), null, Path.fromPortableString(rootLocation.getPath()).append(projectName).toString(), null); } catch (URISyntaxException e) { Assert.isTrue(false, "Can't happen"); //$NON-NLS-1$ } } return location; }
@Override public final Object convertToObject(final String parameterValue) throws ParameterValueConversionException { final Path path = new Path(parameterValue); final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace() .getRoot(); final IResource resource = workspaceRoot.findMember(path); if ((resource == null) || (!resource.exists())) { throw new ParameterValueConversionException( "parameterValue must be the path of an existing resource"); //$NON-NLS-1$ } return resource; }
private IPathVariableManager getManager(IPath workspacePath) { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = workspaceRoot.findMember(workspacePath); if (resource != null) return resource.getPathVariableManager(); return workspaceRoot.getFile(workspacePath).getPathVariableManager(); }
public static class ClasspathResolutionBreakpointListener { public void breakpoint(int bp) { // override in listener implementation } }