X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/refactoring/util/ResourceUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/refactoring/util/ResourceUtil.java index fec6cc2..2983884 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/refactoring/util/ResourceUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/refactoring/util/ResourceUtil.java @@ -23,14 +23,14 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; public class ResourceUtil { - - private ResourceUtil(){ + + private ResourceUtil() { } - + public static IFile[] getFiles(ICompilationUnit[] cus) { - List files= new ArrayList(cus.length); - for (int i= 0; i < cus.length; i++) { - IResource resource= ResourceUtil.getResource(cus[i]); + List files = new ArrayList(cus.length); + for (int i = 0; i < cus.length; i++) { + IResource resource = ResourceUtil.getResource(cus[i]); if (resource != null && resource.getType() == IResource.FILE) files.add(resource); } @@ -38,27 +38,28 @@ public class ResourceUtil { } public static IFile getFile(ICompilationUnit cu) { - IResource resource= ResourceUtil.getResource(cu); + IResource resource = ResourceUtil.getResource(cu); if (resource != null && resource.getType() == IResource.FILE) - return (IFile)resource; + return (IFile) resource; else return null; } - //----- other ------------------------------ - + // ----- other ------------------------------ + /** - * Finds an IResource for a given ICompilationUnit. - * If the parameter is a working copy then the IResource for - * the original element is returned. + * Finds an IResource for a given + * ICompilationUnit. If the parameter is a working copy then + * the IResource for the original element is returned. */ public static IResource getResource(ICompilationUnit cu) { return cu.getResource(); } - /** - * Returns the IResource that the given IMember is defined in. + * Returns the IResource that the given IMember + * is defined in. + * * @see #getResource */ public static IResource getResource(IMember member) { @@ -66,20 +67,20 @@ public class ResourceUtil { return getResource(member.getCompilationUnit()); } - public static IResource getResource(Object o){ + public static IResource getResource(Object o) { if (o instanceof IResource) - return (IResource)o; + return (IResource) o; if (o instanceof IJavaElement) - return getResource((IJavaElement)o); - return null; + return getResource((IJavaElement) o); + return null; } - private static IResource getResource(IJavaElement element){ - if (element.getElementType() == IJavaElement.COMPILATION_UNIT) + private static IResource getResource(IJavaElement element) { + if (element.getElementType() == IJavaElement.COMPILATION_UNIT) return getResource((ICompilationUnit) element); - else if (element instanceof IOpenable) + else if (element instanceof IOpenable) return element.getResource(); - else - return null; + else + return null; } }