private Set<IPath> toPathSet(Set<? extends IContainer> resources) { if (resources == null || resources.isEmpty()) { return Collections.emptySet(); } Set<IPath> res = new HashSet<>(); for (IContainer container : resources) { res.add(container.getLocation()); } return res; }
/** * Gets the descriptor directory. * * @return the descriptor directory */ public String getDescriptorDirectory() { String sDir = file.getParent().getLocation().toString(); if (sDir.charAt(sDir.length() - 1) != '/') { sDir += '/'; } return sDir; }
private String getPathForContainer(IContainer container) { return container.getLocation().toPortableString(); }
/** * Instantiates a new export importable part dialog. * * @param aSection the a section */ public ExportImportablePartDialog(AbstractSection aSection) { super(aSection, "Export an importable part", "Specify a base file name, and perhaps alter the path where it should be stored, and press OK"); rootPath = aSection.editor.getFile().getParent().getLocation().toString() + '/'; }
public File getTargetFile(IProject project) { return new File(project.getParent().getLocation().toFile(), project.getName()); } };
public File getTargetFile(IProject project) { return new File(project.getParent().getLocation().toFile(), project.getName()); } };
@Override public String getInstallLocation() { IPath path = file.getParent().getLocation(); return path == null ? null : path.toOSString(); }
public String getInstallLocation() { return fFile.getParent().getLocation().toOSString(); } public IResource getUnderlyingResource() {
@Override public String getInstallLocation() { return fFile.getParent().getLocation().toOSString(); }
public String getInstallLocation() { IPath path = file.getParent().getLocation(); return path == null ? null : path.toOSString(); } public IResource getUnderlyingResource() {
private IPath makeAbsolutePathFromRelative(IPath path) { if (!path.isAbsolute()) { if (fXmlfile == null) { return null; } IPath basePath= fXmlfile.getParent().getLocation(); // relative to the ant file location if (basePath == null) { return null; } return basePath.append(path); } return path; }
static File getProgram(IContainer project) { IPath projectFile = ProjectFileAccessor.getProjectFile(project); String projectConfiguration = "Debug"; //$NON-NLS-1$ String[] frameworks = ProjectFileAccessor.getTargetFrameworks(project.getWorkspace().getRoot().getFile(projectFile).getLocation()); if (frameworks.length > 0) { return new File(project.getLocation().toFile().getAbsolutePath() + "/bin/" + projectConfiguration + "/" + frameworks[0] + "/" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + projectFile.removeFileExtension().addFileExtension("dll").lastSegment()); //$NON-NLS-1$ } return null; }
private IPath makeAbsolutePathFromRelative(IPath path) { if (!path.isAbsolute()) { if (fXmlfile == null) { return null; } // The XML file is always local. So ok to use getLocation here IPath basePath= fXmlfile.getParent().getLocation(); // relative to the ant file location if (basePath == null) { return null; } return basePath.append(path); } return path; }
private IPath makeAbsolutePathFromRelative(IPath path) { if (!path.isAbsolute()) { if (fXmlfile == null) { return null; } // The XML file is always local. So ok to use getLocation here IPath basePath= fXmlfile.getParent().getLocation(); // relative to the ant file location if (basePath == null) { return null; } return basePath.append(path); } return path; }
/** * Returns whether the source location conflicts with the destination resource. This will occur * if the source is already under the destination. * * @param sourcePath * the path to check * @return <code>true</code> if there is a conflict, <code>false</code> if not */ protected boolean sourceConflictsWithDestination(IPath sourcePath) { IContainer container = getSpecifiedContainer(); if (container == null) return false; return getSpecifiedContainer().getLocation().isPrefixOf(sourcePath); }
private IPath makeAbsolutePathFromRelative(IPath path) { if (!path.isAbsolute()) { if (fXmlfile == null) { return null; } // The XML file is always local. So ok to use getLocation here IPath basePath= fXmlfile.getParent().getLocation(); // relative to the ant file location if (basePath == null) { return null; } return basePath.append(path); } return path; }
private static FeatureExportInfo getInfo(IFeatureModel[] models, ISiteModel siteModel) { FeatureExportInfo info = new FeatureExportInfo(); info.useJarFormat = true; info.toDirectory = true; info.allowBinaryCycles = true; info.destinationDirectory = siteModel.getUnderlyingResource().getParent().getLocation().toOSString(); info.items = models; return info; }
/** * Returns whether the source location conflicts * with the destination resource. This will occur if * the source is already under the destination. * * @param sourcePath the path to check * @return <code>true</code> if there is a conflict, <code>false</code> if not */ @Override protected boolean sourceConflictsWithDestination(IPath sourcePath) { IContainer container = getSpecifiedContainer(); if (container == null) { return false; } IPath destinationLocation = getSpecifiedContainer().getLocation(); if (destinationLocation != null) { return destinationLocation.isPrefixOf(sourcePath); } // null destination location is handled in // WizardResourceImportPage return false; }
/** * @param container * @return whether the container has some projects as direct children */ public boolean hasDirectChildrenProjects(IContainer container) { if (container instanceof IWorkspaceRoot) { IWorkspaceRoot root = (IWorkspaceRoot) container; return root.getProjects().length > 0; } IPath containerLocation = container.getLocation(); IPath projectLocation = container.getProject().getLocation(); if (containerLocation == null || projectLocation == null) { return false; } synchronized (locationsToProjects) { for (Entry<IPath, IProject> entry : locationsToProjects.tailMap(containerLocation).entrySet()) { if (entry.getValue().equals(container.getProject())) { // ignore current project } else if (containerLocation.isPrefixOf(entry.getKey())) { if (entry.getKey().segmentCount() == containerLocation.segmentCount() + 1) { return true; } } else { // moved to another branch, not worth continuing break; } } } return false; } }
@Override public String validateDestination(IContainer destination, IResource[] sourceResources) { IPath destinationLocation = destination.getLocation(); for (int i = 0; i < sourceResources.length; i++) { IResource sourceResource = sourceResources[i]; // is the source being copied onto itself? if (sourceResource.getParent().equals(destination)) { return NLS .bind( IDEWorkbenchMessages.MoveFilesAndFoldersOperation_sameSourceAndDest, sourceResource.getName()); } // test if linked source is copied onto itself. Fixes bug 29913. if (destinationLocation != null) { IPath sourceLocation = sourceResource.getLocation(); IPath destinationResource = destinationLocation .append(sourceResource.getName()); if (sourceLocation != null && sourceLocation.isPrefixOf(destinationResource)) { return NLS .bind( IDEWorkbenchMessages.MoveFilesAndFoldersOperation_sameSourceAndDest, sourceResource.getName()); } } } return super.validateDestination(destination, sourceResources); }