public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Queryable
Iconable.IconFlags, Iconable.LastComputedIcon
Queryable.Contributor, Queryable.PrintInfo, Queryable.Util
FLAGS_LOCKED, ICON_PLACEHOLDER
EMPTY_ARRAY, PACKAGE_INFO_CLASS, PACKAGE_INFO_CLS_FILE, PACKAGE_INFO_FILE
EMPTY_NAVIGATION_ITEM_ARRAY
ARRAY_FACTORY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
Constructor and Description |
---|
PsiPackageImpl(PsiManager manager,
java.lang.String qualifiedName) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
protected GlobalSearchScope |
allScope() |
boolean |
canNavigate()
Indicates whether this instance supports navigation of any kind.
|
boolean |
containsClassNamed(java.lang.String name) |
PsiClass [] |
findClassByShortName(java.lang.String name,
GlobalSearchScope scope) |
protected PsiPackageImpl |
findPackage(java.lang.String qName) |
protected java.util.Collection<PsiDirectory> |
getAllDirectories(boolean includeLibrarySources) |
PsiModifierList |
getAnnotationList()
Returns the list of package-level annotations for the package.
|
PsiClass [] |
getClasses()
Returns the list of classes in all directories corresponding to the package.
|
PsiClass [] |
getClasses(GlobalSearchScope scope)
Returns the list of classes in directories corresponding to the package in the specified
search scope.
|
PsiFile [] |
getFiles(GlobalSearchScope scope)
Returns the list of all files in the package, restricted by the specified scope.
|
Language |
getLanguage()
Returns the language of the PSI element.
|
PsiModifierList |
getModifierList()
Returns the list of modifiers for the element.
|
PsiPackageImpl |
getParentPackage()
Returns the parent of the package.
|
ItemPresentation |
getPresentation() |
PsiPackage [] |
getSubPackages()
Returns the list of subpackages of this package under all source roots of the project.
|
PsiPackage [] |
getSubPackages(GlobalSearchScope scope)
Returns the list of subpackages of this package in the specified search scope.
|
void |
handleQualifiedNameChange(java.lang.String newQualifiedName)
This method must be invoked on the package after all directories corresponding
to it have been renamed/moved accordingly to qualified name change.
|
boolean |
hasModifierProperty(java.lang.String name)
Checks if the element has the specified modifier.
|
boolean |
isValid()
Checks if this PSI element is valid.
|
boolean |
mayHaveContentInScope(GlobalSearchScope scope) |
void |
navigate(boolean requestFocus)
Open editor and select/navigate to the object there if possible.
|
VirtualFile [] |
occursInPackagePrefixes()
Returns source roots that this package occurs in package prefixes of.
|
boolean |
processDeclarations(PsiScopeProcessor processor,
ResolveState state,
PsiElement lastParent,
PsiElement place)
Passes the declarations contained in this PSI element and its children
for processing to the specified scope processor.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
add, addAfter, addBefore, canNavigateToSource, checkAdd, checkDelete, checkSetName, copy, delete, equals, findElementAt, getAllDirectories, getChildren, getContainingFile, getDirectories, getDirectories, getElementIcon, getManager, getName, getNode, getParent, getQualifiedName, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, hashCode, isPhysical, isWritable, putInfo, replace, setName, textMatches, textMatches, textToCharArray
acceptChildren, addRange, addRangeAfter, addRangeBefore, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getContext, getFirstChild, getLastChild, getNavigationElement, getNextSibling, getOriginalElement, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getUseScope, isEquivalentTo, notNullChild, textContains
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
finalize, getClass, notify, notifyAll, wait, wait, wait
getName, getQualifiedName
checkSetName
canNavigateToSource
getAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifier
accept
getDirectories, getDirectories
setName
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getCopyableUserData, getFirstChild, getLastChild, getManager, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isEquivalentTo, isPhysical, isWritable, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray
getUserData, putUserData
public PsiPackageImpl(PsiManager manager, java.lang.String qualifiedName)
protected java.util.Collection<PsiDirectory> getAllDirectories(boolean includeLibrarySources)
getAllDirectories
in class PsiPackageBase
protected PsiPackageImpl findPackage(java.lang.String qName)
findPackage
in class PsiPackageBase
public void handleQualifiedNameChange(java.lang.String newQualifiedName)
PsiPackage
handleQualifiedNameChange
in interface PsiPackage
newQualifiedName
- the new qualified name of the package.public VirtualFile [] occursInPackagePrefixes()
PsiPackage
occursInPackagePrefixes
in interface PsiPackage
public PsiPackageImpl getParentPackage()
PsiPackage
getParentPackage
in interface JvmPackage
getParentPackage
in interface PsiPackage
getParentPackage
in class PsiPackageBase
public Language getLanguage()
PsiElement
getLanguage
in interface PsiElement
public boolean isValid()
PsiElement
PsiDocumentManager.commitDocument(com.intellij.openapi.editor.Document)
).
(In this case an attempt to change PSI will result in an exception).
Any access to invalid elements results in PsiInvalidElementAccessException
.
Once invalid, elements can't become valid again.
Elements become invalid in following cases:
PsiElement.delete()
)isValid
in interface PsiElement
isValid
in class PsiElementBase
PsiUtilCore.ensureValid(PsiElement)
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class PsiElementBase
visitor
- the visitor to pass the element to.public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class PsiPackageBase
public PsiClass [] getClasses()
PsiPackage
getClasses
in interface PsiPackage
protected GlobalSearchScope allScope()
public PsiClass [] getClasses(GlobalSearchScope scope)
PsiPackage
getClasses
in interface PsiPackage
scope
- the scope in which directories are searched.public PsiFile [] getFiles(GlobalSearchScope scope)
PsiPackage
getFiles
in interface PsiPackage
public PsiModifierList getAnnotationList()
PsiPackage
getAnnotationList
in interface PsiPackage
public PsiPackage [] getSubPackages()
PsiPackage
getSubPackages
in interface PsiPackage
public PsiPackage [] getSubPackages(GlobalSearchScope scope)
PsiPackage
getSubPackages
in interface PsiPackage
scope
- the scope in which packages are searched.public boolean containsClassNamed(java.lang.String name)
containsClassNamed
in interface PsiPackage
public PsiClass [] findClassByShortName(java.lang.String name, GlobalSearchScope scope)
findClassByShortName
in interface PsiPackage
public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElement
processDeclarations
in interface PsiElement
processDeclarations
in class PsiElementBase
processor
- the processor receiving the declarations.lastParent
- the child of this element has been processed during the previous
step of the tree up walk (declarations under this element do not need
to be processed again)place
- the original element from which the tree up walk was initiated.public boolean canNavigate()
Navigatable
Navigatable.canNavigateToSource()
returns true
.
We assume that this method should return true
in such case,
so implement this method respectively.canNavigate
in interface Navigatable
canNavigate
in class PsiPackageBase
false
if navigation is not possible for any reason.public ItemPresentation getPresentation()
getPresentation
in interface NavigationItem
getPresentation
in class PsiElementBase
public void navigate(boolean requestFocus)
Navigatable
navigate
in interface Navigatable
navigate
in class PsiElementBase
requestFocus
- true
if focus requesting is necessarypublic boolean mayHaveContentInScope(GlobalSearchScope scope)
public PsiModifierList getModifierList()
PsiModifierListOwner
getModifierList
in interface PsiModifierListOwner
public boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwner
PsiModifier
class.hasModifierProperty
in interface PsiModifierListOwner
name
- the name of the modifier to check.