blob: b9aae84f8368b3e00c2e014006fbeec63433096a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.changes;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
class Utils {
//no instances
private Utils(){
}
static IPath getResourcePath(IResource resource){
return resource.getFullPath().removeFirstSegments(ResourcesPlugin.getWorkspace().getRoot().getFullPath().segmentCount());
}
static IFile getFile(IPath path){
return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
}
static IFolder getFolder(IPath path){
return ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
}
static IProject getProject(IPath path){
return (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember(path);
}
}