use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class FileUndoState method createResourceHandle.
public IResource createResourceHandle() {
IWorkspaceRoot workspaceRoot = parent.getWorkspace().getRoot();
IPath fullPath = parent.getFullPath().append(name);
return workspaceRoot.getFile(fullPath);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class FolderUndoState method createResourceHandle.
public IResource createResourceHandle() {
IWorkspaceRoot workspaceRoot = getWorkspace().getRoot();
IPath folderPath = parent.getFullPath().append(name);
return workspaceRoot.getFolder(folderPath);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ImportOperation method getDestinationContainerFor.
/**
* Returns the container resource that the passed file system object should be
* imported into.
*
* @param fileSystemObject the file system object being imported
* @return the container resource that the passed file system object should be
* imported into
* @exception CoreException if this method failed
*/
IContainer getDestinationContainerFor(Object fileSystemObject) throws CoreException {
IPath pathname = new Path(provider.getFullPath(fileSystemObject));
if (createContainerStructure) {
return createContainersFor(pathname.removeLastSegments(1));
}
if (source == fileSystemObject) {
return null;
}
IPath sourcePath = new Path(provider.getFullPath(source));
IPath destContainerPath = pathname.removeLastSegments(1);
IPath relativePath = destContainerPath.removeFirstSegments(sourcePath.segmentCount()).setDevice(null);
return createContainersFor(relativePath);
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class ImportOperation method importFileSystemObjects.
/**
* Imports the specified file system objects into the workspace.
* If the import fails, adds a status object to the list to be returned by
* <code>getStatus</code>.
*
* @param filesToImport the list of file system objects to import
* (element type: <code>Object</code>)
* @throws CoreException
* @exception OperationCanceledException if canceled
*/
void importFileSystemObjects(List filesToImport) throws CoreException {
Iterator filesEnum = filesToImport.iterator();
while (filesEnum.hasNext()) {
Object fileSystemObject = filesEnum.next();
if (source == null) {
// We just import what we are given into the destination
IPath sourcePath = new Path(provider.getFullPath(fileSystemObject)).removeLastSegments(1);
if (provider.isFolder(fileSystemObject) && sourcePath.isEmpty()) {
// If we don't have a parent then we have selected the
// file systems root. Roots can't copied (at least not
// under windows).
errorTable.add(new Status(IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "DataTransferMessages.ImportOperation_cannotCopy", null));
continue;
}
source = sourcePath.toFile();
}
importRecursivelyFrom(fileSystemObject, POLICY_DEFAULT);
}
}
use of org.eclipse.core.runtime.IPath in project che by eclipse.
the class MavenWorkspace method addSourcePathFromConfiguration.
private void addSourcePathFromConfiguration(ClasspathHelper helper, MavenProject project, Element configuration, List<String> attributes) {
if (configuration != null) {
Element sources = configuration.getChild("sources");
if (sources != null) {
for (Object element : sources.getChildren()) {
final String path = ((Element) element).getTextTrim();
final IPath projectLocation = project.getProject().getLocation();
final String projectPath = projectLocation.toOSString();
final String sourceFolder = path.contains(projectPath) ? path.substring(projectPath.length() + 1) : path;
helper.addSourceEntry(project.getProject().getFullPath().append(sourceFolder));
if (!attributes.contains(sourceFolder)) {
attributes.add(sourceFolder);
}
}
}
}
}
Aggregations