本文整理匯總了Java中com.intellij.psi.PsiElement.isValid方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiElement.isValid方法的具體用法?Java PsiElement.isValid怎麽用?Java PsiElement.isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiElement
的用法示例。
在下文中一共展示了PsiElement.isValid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findProject
import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static Project findProject(PsiElement element) {
PsiFile containingFile = element.getContainingFile();
if (containingFile == null) {
if (!element.isValid()) {
return null;
}
} else if (!containingFile.isValid()) {
return null;
}
return (containingFile == null ? element : containingFile).getProject();
}
示例2: processQuery
import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
public void processQuery(
@NotNull final ReferencesSearch.SearchParameters queryParameters,
@NotNull final Processor<PsiReference> consumer
) {
final PsiElement elementToSearch = queryParameters.getElementToSearch();
if (!elementToSearch.isValid()) {
return;
}
final SearchScope scope = queryParameters.getEffectiveSearchScope();
if (!(scope instanceof GlobalSearchScope)) {
return;
}
// search macros usage references
if (isMacroUsage(elementToSearch) || isMacroNameDeclaration(elementToSearch)) {
final PsiFile file = elementToSearch.getContainingFile();
final PsiElement[] results = PsiTreeUtil.collectElements(
file,
element -> isMacroUsage(element) && element.textMatches(elementToSearch)
);
stream(results)
.map(ImpexMacrosReferenceBase::new)
.forEach(consumer::process);
}
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:28,代碼來源:ImpexReferenceSearcher.java
示例3: getAugments
import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public <E extends PsiElement> List<E> getAugments( Module module, PsiElement element, Class<E> cls )
{
// Module is assigned to user-data via ManTypeFinder, which loads the psiClass (element)
Module context = module != null ? module : element.getUserData( ModuleUtil.KEY_MODULE );
if( context == null )
{
return Collections.emptyList();
}
if( DumbService.getInstance( element.getProject() ).isDumb() )
{
// skip processing during index rebuild
return Collections.emptyList();
}
if( !(element instanceof PsiClass) || !element.isValid() || !PsiMethod.class.isAssignableFrom( cls ) )
{
return Collections.emptyList();
}
List<PsiElement> augFeatures = new ArrayList<>();
PsiClass psiClass = (PsiClass)element;
String className = psiClass.getQualifiedName();
if( className == null )
{
return Collections.emptyList();
}
addMethods( className, psiClass, context, augFeatures );
//noinspection unchecked
return (List<E>)augFeatures;
}