public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment, IntentionFilterOwner
JavaCodeFragment.ExceptionHandler, JavaCodeFragment.VisibilityChecker
IntentionFilterOwner.IntentionActionsFilter
Queryable.Contributor, Queryable.PrintInfo, Queryable.Util
BUILDING_STUB, myContentElementType, myManager, myOriginalFile
FLAGS_LOCKED, ICON_PLACEHOLDER
EMPTY_ARRAY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
BATCH_REFERENCE_PROCESSING
Constructor and Description |
---|
PsiCodeFragmentImpl(Project project,
IElementType contentElementType,
boolean isPhysical,
java.lang.String name,
java.lang.CharSequence text,
PsiElement context) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
void |
addImportsFromString(java.lang.String imports)
Adds the specified classes to the list of classes considered to be imported by the
code fragment.
|
protected PsiCodeFragmentImpl |
clone() |
void |
forceResolveScope(GlobalSearchScope scope)
Force search scope for this fragment
|
PsiElement |
getContext()
Returns the element which should be used as the parent of this element in a tree up
walk during a resolve operation.
|
JavaCodeFragment.ExceptionHandler |
getExceptionHandler()
Gets the exception handler which is used to determine which exceptions are considered handled
in the context where the fragment is used.
|
FileType |
getFileType()
Returns the file type for the file.
|
GlobalSearchScope |
getForcedResolveScope() |
IntentionFilterOwner.IntentionActionsFilter |
getIntentionActionsFilter()
Sets the intention actions filter which is used to determine which intention actions should be available in an editor.
|
Language |
getLanguage()
Returns the language of the PSI element.
|
GlobalSearchScope |
getResolveScope()
Returns the scope in which the declarations for the references in this PSI element are searched.
|
PsiType |
getSuperType()
Returns the type corresponding to the
super keyword in the code fragment. |
PsiType |
getThisType()
Returns the type corresponding to the
this keyword in the code fragment. |
FileViewProvider |
getViewProvider() |
JavaCodeFragment.VisibilityChecker |
getVisibilityChecker()
Gets the visibility checker which is used to determine the visibility of declarations
from the code fragment.
|
boolean |
importClass(PsiClass aClass)
Adds an import statement for importing the specified class.
|
java.lang.String |
importsToString()
Returns the list of classes considered to be imported by the code fragment.
|
boolean |
isPhysical()
Checks if an actual source or class file corresponds to the element.
|
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.
|
void |
setExceptionHandler(JavaCodeFragment.ExceptionHandler exceptionHandler)
Sets the exception handler which is used to determine which exceptions are considered handled
in the context where the fragment is used.
|
void |
setIntentionActionsFilter(IntentionFilterOwner.IntentionActionsFilter filter)
Sets the intention actions filter which is used to determine which intention actions should be available in an editor.
|
void |
setSuperType(PsiType superType)
Sets the type corresponding to the
super keyword in the code fragment. |
void |
setThisType(PsiType psiType)
Sets the type corresponding to the
this keyword in the code fragment. |
void |
setVisibilityChecker(JavaCodeFragment.VisibilityChecker checker)
Sets the visibility checker which is used to determine the visibility of declarations
from the code fragment.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, assertReadAccessAllowed, beforeAstChange, calcStubTree, calcTreeElement, canNavigate, canNavigateToSource, checkAdd, checkDelete, checkSetName, clearCaches, cloneImpl, copy, createContentLeafElement, createFileElement, delete, deleteChildRange, derefStub, findChildByClass, findChildrenByClass, findElementAt, findReferenceAt, getChildren, getContainingDirectory, getContainingFile, getContentElementType, getElementTypeForStubBuilder, getFileElementType, getFirstChild, getGreenStub, getGreenStubTree, getLastChild, getManager, getModificationStamp, getName, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOriginalFile, getParent, getPresentation, getPrevSibling, getProject, getPsiRoots, getReference, getReferences, getStartOffsetInParent, getStub, getStubbedSpine, getStubTree, getText, getTextLength, getTextOffset, getTextRange, getTreeElement, getUseScope, getVirtualFile, init, isContentsLoaded, isDirectory, isEquivalentTo, isTemplateDataFile, isValid, isWritable, markInvalidated, navigate, onContentReload, processChildren, putInfo, putInfo, replace, setContentElementType, setName, setOriginalFile, setTreeElementPointer, subtreeChanged, textContains, textMatches, textMatches, textToCharArray
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clearCaches, getContainingDirectory, getFileElementType, getModificationStamp, getNode, getOriginalFile, getParent, getPsiRoots, getVirtualFile, subtreeChanged
getName, isDirectory, processChildren
checkSetName
setName
getPresentation
canNavigate, canNavigateToSource, navigate
public PsiCodeFragmentImpl(Project project, IElementType contentElementType, boolean isPhysical, java.lang.String name, java.lang.CharSequence text, PsiElement context)
public Language getLanguage()
PsiElement
getLanguage
in interface PsiElement
getLanguage
in class PsiFileImpl
protected PsiCodeFragmentImpl clone()
clone
in class PsiFileImpl
public FileViewProvider getViewProvider()
getViewProvider
in interface PsiFile
getViewProvider
in class PsiFileImpl
public FileType getFileType()
PsiFile
getFileType
in interface PsiFile
public PsiElement getContext()
PsiElement
getParent()
,
but the context can be overridden for some elements like code fragments (see
JavaCodeFragmentFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)
).getContext
in interface PsiElement
getContext
in class PsiFileImpl
public PsiType getThisType()
JavaCodeFragment
this
keyword in the code fragment.getThisType
in interface JavaCodeFragment
this
in the fragment.public void setThisType(PsiType psiType)
JavaCodeFragment
this
keyword in the code fragment.setThisType
in interface JavaCodeFragment
psiType
- the type of this
in the fragment.public PsiType getSuperType()
JavaCodeFragment
super
keyword in the code fragment.getSuperType
in interface JavaCodeFragment
super
in the fragment.public void setSuperType(PsiType superType)
JavaCodeFragment
super
keyword in the code fragment.setSuperType
in interface JavaCodeFragment
superType
- the type of super
in the fragment.public java.lang.String importsToString()
JavaCodeFragment
importsToString
in interface JavaCodeFragment
public void addImportsFromString(java.lang.String imports)
JavaCodeFragment
addImportsFromString
in interface JavaCodeFragment
imports
- the comma-separated list of full-qualified names of classes to import.public void setVisibilityChecker(JavaCodeFragment.VisibilityChecker checker)
JavaCodeFragment
setVisibilityChecker
in interface JavaCodeFragment
checker
- the checker instance.public JavaCodeFragment.VisibilityChecker getVisibilityChecker()
JavaCodeFragment
getVisibilityChecker
in interface JavaCodeFragment
public boolean isPhysical()
PsiElement
PsiDocumentManager.getDocument(PsiFile)
returns null for non-physical elements.
Not to be confused with FileViewProvider.isPhysical()
.isPhysical
in interface PsiElement
isPhysical
in class PsiFileImpl
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
visitor
- the visitor to pass the element to.public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElement
processDeclarations
in interface PsiElement
processDeclarations
in class PsiFileImpl
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 java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class PsiFileImpl
public boolean importClass(PsiClass aClass)
PsiImportHolder
importClass
in interface PsiImportHolder
aClass
- the class to import.public JavaCodeFragment.ExceptionHandler getExceptionHandler()
JavaCodeFragment
getExceptionHandler
in interface JavaCodeFragment
public void setIntentionActionsFilter(IntentionFilterOwner.IntentionActionsFilter filter)
IntentionFilterOwner
setIntentionActionsFilter
in interface IntentionFilterOwner
filter
- the intention actions filter instance.public IntentionFilterOwner.IntentionActionsFilter getIntentionActionsFilter()
IntentionFilterOwner
getIntentionActionsFilter
in interface IntentionFilterOwner
public void forceResolveScope(GlobalSearchScope scope)
PsiCodeFragment
forceResolveScope
in interface PsiCodeFragment
scope
- Scope to use when resolving references in this contextpublic GlobalSearchScope getForcedResolveScope()
getForcedResolveScope
in interface PsiCodeFragment
public GlobalSearchScope getResolveScope()
PsiElement
getResolveScope
in interface PsiElement
getResolveScope
in class PsiFileImpl
public void setExceptionHandler(JavaCodeFragment.ExceptionHandler exceptionHandler)
JavaCodeFragment
setExceptionHandler
in interface JavaCodeFragment
exceptionHandler
- the exception handler instance.