content: /*******************************************************************************
   * Copyright (c) 2000, 2007 IBM Corporation and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
   * which accompanies this distribution, and is available at
   * http://www.eclipse.org/legal/epl-v10.html
   *
   * Contributors:
   *     IBM Corporation - initial API and implementation
   *******************************************************************************/
  package org.eclipse.wst.jsdt.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);
  	}
  	
  }
  
  