diff options
Diffstat (limited to 'org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java')
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java index 055607dbaf..69cf2e9a03 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java @@ -54,7 +54,7 @@ public class PackageFragment extends Openable implements IPackageFragment, Suffi * Constant empty list of compilation units */ protected static final ICompilationUnit[] NO_COMPILATION_UNITS = new ICompilationUnit[] {}; - + public String[] names; protected PackageFragment(PackageFragmentRoot root, String[] names) { @@ -96,7 +96,7 @@ protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, } catch (CoreException e) { throw new JavaModelException(e); } - + if (kind == IPackageFragmentRoot.K_SOURCE) { // add primary compilation units ICompilationUnit[] primaryCompilationUnits = getCompilationUnits(DefaultWorkingCopyOwner.PRIMARY); @@ -105,7 +105,7 @@ protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, vChildren.add(primary); } } - + IJavaElement[] children = new IJavaElement[vChildren.size()]; vChildren.toArray(children); info.setChildren(children); @@ -123,7 +123,7 @@ public boolean containsJavaResources() throws JavaModelException { */ public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Messages.operation_nullContainer); + throw new IllegalArgumentException(Messages.operation_nullContainer); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -161,8 +161,8 @@ public void delete(boolean force, IProgressMonitor monitor) throws JavaModelExce public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof PackageFragment)) return false; - - PackageFragment other = (PackageFragment) o; + + PackageFragment other = (PackageFragment) o; return Util.equalArraysOrNull(this.names, other.names) && this.parent.equals(other.parent); } @@ -171,7 +171,7 @@ public boolean exists() { // so also ensure that: // - the package is not excluded (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138577) // - its name is valide (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108456) - return super.exists() && !Util.isExcluded(this) && isValidPackageName(); + return super.exists() && !Util.isExcluded(this) && isValidPackageName(); } /** * @see IPackageFragment#getClassFile(String) @@ -179,7 +179,7 @@ public boolean exists() { */ public IClassFile getClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { - throw new IllegalArgumentException(Messages.element_invalidClassFileName); + throw new IllegalArgumentException(Messages.element_invalidClassFileName); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary @@ -199,7 +199,7 @@ public IClassFile[] getClassFiles() throws JavaModelException { if (getKind() == IPackageFragmentRoot.K_SOURCE) { return NO_CLASSFILES; } - + ArrayList list = getChildrenOfType(CLASS_FILE); IClassFile[] array= new IClassFile[list.size()]; list.toArray(array); @@ -211,7 +211,7 @@ public IClassFile[] getClassFiles() throws JavaModelException { */ public ICompilationUnit getCompilationUnit(String cuName) { if (!org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(cuName)) { - throw new IllegalArgumentException(Messages.convention_unit_notJavaName); + throw new IllegalArgumentException(Messages.convention_unit_notJavaName); } return new CompilationUnit(this, cuName, DefaultWorkingCopyOwner.PRIMARY); } @@ -222,7 +222,7 @@ public ICompilationUnit[] getCompilationUnits() throws JavaModelException { if (getKind() == IPackageFragmentRoot.K_BINARY) { return NO_COMPILATION_UNITS; } - + ArrayList list = getChildrenOfType(COMPILATION_UNIT); ICompilationUnit[] array= new ICompilationUnit[list.size()]; list.toArray(array); @@ -293,7 +293,7 @@ public int getKind() throws JavaModelException { * Returns an array of non-java resources contained in the receiver. */ public Object[] getNonJavaResources() throws JavaModelException { - if (this.isDefaultPackage()) { + if (isDefaultPackage()) { // We don't want to show non java resources of the default package (see PR #1G58NB8) return JavaElementInfo.NO_NON_JAVA_RESOURCES; } else { @@ -304,7 +304,7 @@ public Object[] getNonJavaResources() throws JavaModelException { * @see IJavaElement#getPath() */ public IPath getPath() { - PackageFragmentRoot root = this.getPackageFragmentRoot(); + PackageFragmentRoot root = getPackageFragmentRoot(); if (root.isArchive()) { return root.getPath(); } else { @@ -363,7 +363,7 @@ public int hashCode() { return hash; } /** - * @see IParent + * @see IParent */ public boolean hasChildren() throws JavaModelException { return getChildren().length > 0; @@ -405,7 +405,7 @@ private boolean isValidPackageName() { */ public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Messages.operation_nullContainer); + throw new IllegalArgumentException(Messages.operation_nullContainer); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -424,10 +424,10 @@ public void move(IJavaElement container, IJavaElement sibling, String rename, bo */ public void rename(String newName, boolean force, IProgressMonitor monitor) throws JavaModelException { if (newName == null) { - throw new IllegalArgumentException(Messages.element_nullName); + throw new IllegalArgumentException(Messages.element_nullName); } IJavaElement[] elements= new IJavaElement[] {this}; - IJavaElement[] dests= new IJavaElement[] {this.getParent()}; + IJavaElement[] dests= new IJavaElement[] {getParent()}; String[] renamings= new String[] {newName}; getJavaModel().rename(elements, dests, renamings, force, monitor); } @@ -443,7 +443,7 @@ protected void toStringChildren(int tab, StringBuffer buffer, Object info) { * Debugging purposes */ protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) { - buffer.append(this.tabString(tab)); + buffer.append(tabString(tab)); if (this.names.length == 0) { buffer.append("<default>"); //$NON-NLS-1$ } else { @@ -461,7 +461,7 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean s * @see IJavaElement#getAttachedJavadoc(IProgressMonitor) */ public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException { - PerProjectInfo projectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(this.getJavaProject().getProject()); + PerProjectInfo projectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(getJavaProject().getProject()); String cachedJavadoc = null; synchronized (projectInfo.javadocCache) { cachedJavadoc = (String) projectInfo.javadocCache.get(this); @@ -478,9 +478,9 @@ public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelExcep if (!(pathBuffer.charAt(pathBuffer.length() - 1) == '/')) { pathBuffer.append('/'); } - String packPath= this.getElementName().replace('.', '/'); + String packPath= getElementName().replace('.', '/'); pathBuffer.append(packPath).append('/').append(JavadocConstants.PACKAGE_FILE_NAME); - + if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); final String contents = getURLContents(String.valueOf(pathBuffer)); if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); @@ -497,9 +497,9 @@ protected IStatus validateExistence(IResource underlyingResource) { return newDoesNotExistStatus(); // check whether this pkg can be opened - if (underlyingResource != null && !resourceExists(underlyingResource)) + if (underlyingResource != null && !resourceExists(underlyingResource)) return newDoesNotExistStatus(); - + // check that it is not excluded (https://bugs.eclipse.org/bugs/show_bug.cgi?id=138577) int kind; try { @@ -507,9 +507,9 @@ protected IStatus validateExistence(IResource underlyingResource) { } catch (JavaModelException e) { return e.getStatus(); } - if (kind == IPackageFragmentRoot.K_SOURCE && Util.isExcluded(this)) + if (kind == IPackageFragmentRoot.K_SOURCE && Util.isExcluded(this)) return newDoesNotExistStatus(); - + return JavaModelStatus.VERIFIED_OK; } } |