/** * @see Platform#getLocation() */ public IPath getLocation() throws IllegalStateException { if (cachedInstanceLocation == null) { Location location = getInstanceLocation(); if (location == null) return null; // This makes the assumption that the instance location is a file: URL File file = new File(location.getURL().getFile()); cachedInstanceLocation = new Path(file.toString()); } return cachedInstanceLocation; }
public Properties getProductCustomization() { initValues(); URL url = null; if (customizationValue != null) { // try to convert the key to a URL try { url = new URL(customizationValue); } catch (MalformedURLException e) { // didn't work so treat it as a filename url = FileLocator.find(customizationBundle, new Path(customizationValue), null); } } if (url == null) { if (InternalPlatform.DEBUG_PLUGIN_PREFERENCES) InternalPlatform.message("Product preference customization file: " + customizationValue + " not found for bundle: " + productID); //$NON-NLS-1$//$NON-NLS-2$ } return loadProperties(url); }
@Override public IPath apply(String path) { return new Path(path); } });
@Override public IPath apply(String path) { return new Path(path); } });
@Override public IPath apply(String path) { return new Path(path); } });
public Collection<IPath> toPathList() { Set<IPath> result = Sets.newLinkedHashSet(); result.add(new Path(".gradle")); if (this.projectBuildDir != null) { result.add(this.projectBuildDir); } result.addAll(this.nestedProjectBuildDirs); return result; } }
public IPath makeRelative() { if (!isAbsolute()) { return this; } return new Path(device, segments, separators & HAS_TRAILING); }
public IPath setDevice(String value) { if (value != null) { Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$ } //return the receiver if the device is the same if (value == device || (value != null && value.equals(device))) return this; return new Path(value, segments, separators); }
public IPath removeTrailingSeparator() { if (!hasTrailingSeparator()) { return this; } return new Path(device, segments, separators & (HAS_LEADING | IS_UNC)); }
public static void recreatePersistedContainer(String propertyName, String containerString, boolean addToContainerValues) { int containerPrefixLength = CP_CONTAINER_PREFERENCES_PREFIX.length(); int index = propertyName.indexOf('|', containerPrefixLength); if (containerString != null) containerString = containerString.trim(); if (index > 0) { String projectName = propertyName.substring(containerPrefixLength, index).trim(); IJavaProject project = getJavaModelManager().getJavaModel().getJavaProject(projectName); IPath containerPath = new Path(propertyName.substring(index+1).trim()); recreatePersistedContainer(project, containerPath, containerString, addToContainerValues); } }
public IPath addFileExtension(String extension) { if (isRoot() || isEmpty() || hasTrailingSeparator()) return this; int len = segments.length; String[] newSegments = new String[len]; System.arraycopy(segments, 0, newSegments, 0, len - 1); newSegments[len - 1] = segments[len - 1] + '.' + extension; return new Path(device, newSegments, separators); }
public static ErrorMarkerLocation findErrorLocation(InternalGradleBuild gradleBuild, Throwable t) { Matcher errorLocationInStackTrace = tryFindStackTraceErrorLocation(t); if (errorLocationInStackTrace != null) { IResource resource = tryFindWorkspaceFile(gradleBuild, new Path(errorLocationInStackTrace.group(1))); if (resource != null) { int lineNumber = Integer.parseInt(errorLocationInStackTrace.group(2)); return new ErrorMarkerLocation(resource, lineNumber); } } return new ErrorMarkerLocation(calculateFallbackLocation(gradleBuild)); }
public static void delete(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { file.delete(true, null); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
public boolean isValidPath(String path) { Path test = new Path(path); for (int i = 0, max = test.segmentCount(); i < max; i++) if (!isValidSegment(test.segment(i))) return false; return true; }
@Override public IResource resource(PackageFragmentRoot root) { if (root == null) return null; // working copy not in workspace return ((IContainer) ((Openable) this.parent).resource(root)).getFile(new Path(getElementName())); } /**
private void updateReadOnlyPackageFragmentsForCopy(IContainer sourceFolder, PackageFragmentRoot root, String[] newFragName) { IContainer parentFolder = (IContainer) root.resource(); for (int i = 0, length = newFragName.length; i <length; i++) { String subFolderName = newFragName[i]; parentFolder = parentFolder.getFolder(new Path(subFolderName)); sourceFolder = sourceFolder.getFolder(new Path(subFolderName)); if (sourceFolder.exists() && Util.isReadOnly(sourceFolder)) { Util.setReadOnly(parentFolder, true); } } }
public IPath getFirstWorkspaceLocation() { if (WORKSPACE_MAPPINGS.isEmpty(getNd(), this.address)) { return Path.EMPTY; } return new Path(WORKSPACE_MAPPINGS.get(getNd(), this.address, 0).getPath().toString()); }
@Override public void close() throws JavaModelException { if (this.externalAnnotationBase != null) { String entryName = Util.concatWith(((PackageFragment) getParent()).names, this.name, '/'); ExternalAnnotationTracker.unregisterClassFile(this.externalAnnotationBase, new Path(entryName)); } super.close(); } /**
private static IClasspathEntry createContainerEntry(EclipseClasspathContainer container) { IPath containerPath = new Path(container.getPath()); boolean isExported = container.isExported(); IAccessRule[] accessRules = ClasspathUtils.createAccessRules(container); IClasspathAttribute[] attributes = ClasspathUtils.createClasspathAttributes(container); return JavaCore.newContainerEntry(containerPath, accessRules, attributes, isExported); }
@Override protected ISchedulingRule getSchedulingRule() { if (this.pkgName.length == 0) return null; // no resource is going to be created IResource parentResource = ((JavaElement) getParentElement()).resource(); IResource resource = ((IContainer) parentResource).getFolder(new Path(this.pkgName[0])); return resource.getWorkspace().getRuleFactory().createRule(resource); } /**