1 11 package org.eclipse.jdt.internal.corext.refactoring.changes; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.core.resources.IFolder; 15 import org.eclipse.core.resources.IProject; 16 import org.eclipse.core.resources.IResource; 17 import org.eclipse.core.resources.ResourcesPlugin; 18 import org.eclipse.core.runtime.IPath; 19 20 class Utils { 21 22 private Utils(){ 24 } 25 26 static IPath getResourcePath(IResource resource){ 27 return resource.getFullPath().removeFirstSegments(ResourcesPlugin.getWorkspace().getRoot().getFullPath().segmentCount()); 28 } 29 30 static IFile getFile(IPath path){ 31 return ResourcesPlugin.getWorkspace().getRoot().getFile(path); 32 } 33 34 static IFolder getFolder(IPath path){ 35 return ResourcesPlugin.getWorkspace().getRoot().getFolder(path); 36 } 37 38 static IProject getProject(IPath path){ 39 return (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember(path); 40 } 41 42 } 43 44 | Popular Tags |