Java 类com.intellij.psi.PsiElement 实例源码

项目:TS-IJ    文件:TSMethodCallCompletionContributor.java   
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    PsiElement caller = parameters.getPosition().getPrevSibling().getPrevSibling();
    String ns = TSUtil.getElementNamespace(caller);

    //All global functions
    Project project = parameters.getOriginalFile().getProject();
    Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);
    for (TSFnDeclStmt function : functions) {
        if (function.getFunctionType() == TSFunctionType.GLOBAL)
            continue;

        result.addElement(
                LookupElementBuilder.create(function.getFunctionName())
                        .withCaseSensitivity(false)
                        .withPresentableText(function.getNamespace() + "." + function.getFunctionName())
                        .withBoldness(ns != null && function.getNamespace().equalsIgnoreCase(ns))
                        .withTailText(function.getArgList())
                        .withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
        );
    }
}
项目:ReactPropTypes-Plugin    文件:CommonAction.java   
@NotNull
private List<PropTypeBean>  findPropsNameListWithIdentityReference(String identity, PsiElement psiElement){
  return PsiTreeUtil.findChildrenOfType(psiElement, LeafPsiElement.class)
          .stream()
          .filter(o -> o.getText().equals(identity))
          .filter(o -> o.getElementType().toString().equals("JS:IDENTIFIER"))
          .filter(o -> {
            if(o.getParent() instanceof JSReferenceExpressionImpl){
              JSReferenceExpressionImpl parent = (JSReferenceExpressionImpl) o.getParent();
              if(parent.getTreeNext()!=null && parent.getTreeNext().getElementType().toString().equals("JS:DOT")
                      &&parent.getTreeNext().getTreeNext()!=null){
                return true;
              }
            }
            return  false;
          })
          .map(o -> ((JSReferenceExpressionImpl)o.getParent()).getTreeNext().getTreeNext().getText())
          .distinct()
          .map(o -> new PropTypeBean(o,"any", false))
          .collect(Collectors.toList());
}
项目:yii2support    文件:CompletionContributor.java   
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
    MethodReference reference = PsiTreeUtil.getParentOfType(position, MethodReference.class);
    if (reference != null && ArrayUtil.contains(reference.getName(), ViewsUtil.renderMethods)) {
        if (typeChar == '\'' || typeChar == '"') {
            if (position instanceof LeafPsiElement && position.getText().equals("$view")) {
                return true;
            }
            if (position.getNextSibling() instanceof ParameterList) {
                return true;
            }
        }
    }

    return false;
}
项目:educational-plugin    文件:StudyUtils.java   
public static void createFromTemplate(@NotNull Project project,
                                      @NotNull PsiDirectory taskDirectory,
                                      @NotNull String name,
                                      @Nullable IdeView view,
                                      boolean open) {
  FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate(name);
  if (template == null) {
    LOG.info("Template " + name + " wasn't found");
    return;
  }
  try {
    final PsiElement file = FileTemplateUtil.createFromTemplate(template, name, null, taskDirectory);
    if (view != null && open) {
      EditorHelper.openInEditor(file, false);
      view.selectElement(file);
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
项目:manifold-ij    文件:ExtensionClassAnnotator.java   
@Override
public void annotate( PsiElement element, AnnotationHolder holder )
{
  if( DumbService.getInstance( element.getProject() ).isDumb() )
  {
    // skip processing during index rebuild
    return;
  }

  PsiClass psiExtensionClass = findExtensionClass( element );

  if( psiExtensionClass != null )
  {
    // The enclosing class a @Extension class, verify usage of @This etc.

    verifyPackage( element, holder );
    verifyExtensionInterfaces( element, holder );
    verifyExtensionMethods( element, holder );
  }
  else
  {
    // The enclosing class is *not* an extension class; usage of @This or @Extension on methods are errors

    errrantThisOrExtension( element, holder );
  }
}
项目:manifold-ij    文件:RenameResourceElementProcessor.java   
static Map<Pair<FeaturePath, PsiElement>, List<UsageInfo>> findJavaUsages( PsiElement element, List<PsiElement> javaElems )
{
  if( !(element instanceof PsiNamedElement) || javaElems.isEmpty() )
  {
    return Collections.emptyMap();
  }

  Map<Pair<FeaturePath, PsiElement>, List<UsageInfo>> allUsages = new HashMap<>();
  for( PsiElement javaElem : javaElems )
  {
    if( javaElem == null )
    {
      continue;
    }

    List<UsageInfo> usages = findUsages( javaElem, element );
    if( !usages.isEmpty() )
    {
      FeaturePath path = javaElem.getUserData( KEY_FEATURE_PATH );
      allUsages.put( new Pair<>( path, javaElem ), usages );
    }
  }

  return allUsages;
}
项目:idea-php-dotenv-plugin    文件:DuplicateKeyInspection.java   
@NotNull
private ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
    DotEnvPsiElementsVisitor visitor = new DotEnvPsiElementsVisitor();
    file.acceptChildren(visitor);

    ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly);

    Map<String, PsiElement> existingKeys = new HashMap<>();
    Set<PsiElement> markedElements = new HashSet<>();
    for(KeyValuePsiElement keyValue : visitor.getCollectedItems()) {
        if(existingKeys.containsKey(keyValue.getKey())) {
            problemsHolder.registerProblem(keyValue.getElement(), "Duplicate key");

            PsiElement markedElement = existingKeys.get(keyValue.getKey());
            if(!markedElements.contains(markedElement)) {
                problemsHolder.registerProblem(markedElement, "Duplicate key");
                markedElements.add(markedElement);
            }
        } else {
            existingKeys.put(keyValue.getKey(), keyValue.getElement());
        }
    }

    return problemsHolder;
}
项目:manifold-ij    文件:ExtensionClassAnnotator.java   
private void errrantThisOrExtension( PsiElement element, AnnotationHolder holder )
{
  if( element instanceof PsiModifierList )
  {
    PsiModifierList mods = (PsiModifierList)element;
    PsiAnnotation annotation;
    if( (annotation = mods.findAnnotation( Extension.class.getName() )) != null ||
        (annotation = mods.findAnnotation( This.class.getName() )) != null)
    {
      TextRange range = new TextRange( annotation.getTextRange().getStartOffset(),
                                       annotation.getTextRange().getEndOffset() );
      //noinspection ConstantConditions
      holder.createErrorAnnotation( range, ExtIssueMsg.MSG_NOT_IN_EXTENSION_CLASS.get( ClassUtil.extractClassName( annotation.getQualifiedName() ) ) );
    }
  }
}
项目:reasonml-idea-plugin    文件:DescriptionProvider.java   
@Override
public String getElementDescription(@NotNull PsiElement element, @NotNull ElementDescriptionLocation location) {
    if (location == UsageViewNodeTextLocation.INSTANCE && element instanceof PsiNamedElement) {
        return getElementDescription(element, UsageViewShortNameLocation.INSTANCE);
    }

    if (location == UsageViewShortNameLocation.INSTANCE || location == UsageViewLongNameLocation.INSTANCE) {
        if (element instanceof PsiNamedElement) {
            return ((PsiNamedElement) element).getName();
        }
    }

    if (location == UsageViewTypeLocation.INSTANCE) {
        if (element instanceof PsiModuleName) {
            return "module";
        } else if (element instanceof PsiTypeName) {
            return "type";
        } else if (element instanceof PsiVarName) {
            return "let";
        }
    }

    return element.toString();
}
项目:EmojiPrefix    文件:EmojiResourceCompletionContributor.java   
public EmojiResourceCompletionContributor() {
    extend(CompletionType.BASIC, PlatformPatterns.psiElement(PsiElement.class), new CompletionProvider<CompletionParameters>() {
        @Override
        protected void addCompletions(@NotNull CompletionParameters completionParameters,
                                      ProcessingContext processingContext,
                                      @NotNull CompletionResultSet completionResultSet) {
            Document document = completionParameters.getEditor().getDocument();
            int lineStart = document.getLineStartOffset(document.getLineNumber(completionParameters.getOffset()));
            String lineText = document.getText(new TextRange(lineStart, completionParameters.getOffset()));
            if (includeCount(lineText) == 1) {
                for (Map.Entry<String, Icon> iconEntry : EmojiUtil.getEmojiMap().entrySet()) {
                    completionResultSet.addElement(LookupElementBuilder.create(iconEntry.getKey(), ":" + iconEntry.getKey() + ":")
                            .withIcon(iconEntry.getValue())
                            .withInsertHandler((insertionContext, lookupElement) -> {
                                int startOffset = insertionContext.getStartOffset();
                                Document insertDocument = insertionContext.getDocument();
                                if (startOffset > 0 && insertDocument.getCharsSequence().charAt(startOffset - 1) == ':') {
                                    insertDocument.deleteString(startOffset - 1, startOffset);
                                }
                            }));
                }
            }
        }
    });
}
项目:yii2support    文件:PsiUtil.java   
public static void deleteFunctionParam(PsiElement element) {
    PsiElement next = element.getNextSibling();
    if (next != null && next.getText().equals(",")) {
        next.delete();
    } else {
        PsiElement prev = element.getPrevSibling();
        if (prev != null && prev instanceof PsiWhiteSpace) {
            prev.delete();
            prev = element.getPrevSibling();
        }
        if (prev != null && prev.getText().equals(",")) {
            prev.delete();
        }
    }
    element.delete();
}
项目:hybris-integration-intellij-idea-plugin    文件:ImpexHeaderItemTypeAttributeNameCompletionProvider.java   
@Override
public void addCompletions(
    @NotNull final CompletionParameters parameters,
    final ProcessingContext context,
    @NotNull final CompletionResultSet result
) {
    Validate.notNull(parameters);
    Validate.notNull(result);

    final Project project = this.getProject(parameters);
    if (null == project) {
        return;
    }

    final PsiElement psiElementUnderCaret = parameters.getPosition();
    final ImpexHeaderTypeName headerTypeName = this.getHeaderTypeNamePsiElementOfAttribute(psiElementUnderCaret);

    if (headerTypeName != null) {
        fillDomAttributesCompletions(project, headerTypeName, result);
    }
}
项目:intellij-spring-assistant    文件:PropertiesDocumentationProvider.java   
@Override
public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
  if (element instanceof DocumentationProxyElement) {
    DocumentationProxyElement proxyElement = DocumentationProxyElement.class.cast(element);
    MetadataNode target = proxyElement.target;
    boolean requestedForTargetValue = proxyElement.requestedForTargetValue;
    String value = proxyElement.value;

    // Only group & leaf are expected to have documentation
    if (target != null && (target.isGroup() || target.isLeaf())) {
      if (requestedForTargetValue) {
        assert target.getProperty() != null;
        return target.getProperty().getDocumentationForValue(target, value);
      } else if (target.isGroup()) {
        assert target.getGroup() != null;
        return target.getGroup().getDocumentation(target);
      } else {
        assert target.getProperty() != null;
        return target.getProperty().getDocumentationForKey(target);
      }
    }
  }
  return super.generateDoc(element, originalElement);
}
项目:idea-php-behat-plugin    文件:BehatLightCodeInsightFixtureTestCase.java   
public void assertLineMarker(@NotNull PsiElement psiElement, @NotNull LineMarker.Assert assertMatch) {

        final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);

        for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
            Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>();
            lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);

            if(lineMarkerInfos.size() == 0) {
                continue;
            }

            for (LineMarkerInfo lineMarkerInfo : lineMarkerInfos) {
                if(assertMatch.match(lineMarkerInfo)) {
                    return;
                }
            }
        }

        fail(String.format("Fail that '%s' matches on of '%s' PsiElements", assertMatch.getClass(), elements.size()));
    }
项目:bamboo-soy    文件:SoyDocumentationProviderTest.java   
private void doTest(String expectedQuickNavigateInfo) {
  String filename = getTestName(false) + ".soy";
  myFixture.configureByFile(filename);
  PsiElement element = myFixture.getElementAtCaret();
  String info = (new SoyDocumentationProvider()).getQuickNavigateInfo(element, null);
  assertEquals(expectedQuickNavigateInfo, info);
}
项目:educational-plugin    文件:StudyMoveDelegate.java   
@Override
public boolean canMove(PsiElement[] elements, @Nullable PsiElement targetContainer) {
  if (elements.length == 1) {
    Project project = elements[0].getProject();
    Course course = StudyTaskManager.getInstance(project).getCourse();
    if (course == null || !EduNames.STUDY.equals(course.getCourseMode())) {
      return false;
    }
    return !StudyUtils.isRenameableOrMoveable(project, course, elements[0]);
  }
  return false;
}
项目:reasonml-idea-plugin    文件:ModulePath.java   
public ModulePath(List<PsiElement> elements) {
    m_names = new String[elements.size()];
    for (int i = 0; i < elements.size(); i++) {
        PsiElement element = elements.get(i);
        m_names[i] = element instanceof FileBase ? ((FileBase) element).asModuleName() : ((PsiNamedElement) element).getName();
    }
}
项目:jgiven-intellij-plugin    文件:MyLineMarkerInfo.java   
@Override
public boolean canMergeWith(@NotNull MergeableLineMarkerInfo<?> info) {
    if (!(info instanceof MyLineMarkerInfo)) return false;
    PsiElement otherElement = info.getElement();
    PsiElement myElement = getElement();
    return otherElement != null && myElement != null;
}
项目:yii2support    文件:CompletionProvider.java   
@NotNull
private String getValue(PsiElement expression) {
    if (expression instanceof StringLiteralExpression) {
        String value = ((StringLiteralExpression) expression).getContents();
        return value.substring(0, value.indexOf("IntellijIdeaRulezzz "));
    }

    return "";
}
项目:yii2support    文件:ViewsUtil.java   
public static PsiDirectory getRootDirectory(PsiElement element) {
    final PsiFile file = element.getContainingFile();

    if (file.getUserData(VIEWS_DIRECTORY) != null) {
        Long modified = file.getUserData(VIEWS_DIRECTORY_MODIFIED);
        if (modified != null && modified == file.getModificationStamp()) {
            return file.getUserData(VIEWS_DIRECTORY);
        }
    }

    return findDirectory(element);
}
项目:educational-plugin    文件:CCTaskMoveHandlerDelegate.java   
@Override
public boolean tryToMove(PsiElement element,
                         Project project,
                         DataContext dataContext,
                         @Nullable PsiReference reference,
                         Editor editor) {
  return CCUtils.isCourseCreator(project);
}
项目:manifold-ij    文件:RenameResourceElementProcessor.java   
@Nullable
@Override
public PsiElement substituteElementToRename( PsiElement elem, @Nullable Editor editor )
{
  PsiElement[] element = new PsiElement[]{elem};
  findJavaElements( element );
  return element[0];
}
项目:hybris-integration-intellij-idea-plugin    文件:ImpexColumnBreadcrumbsProvider.java   
private static PsiElement adjustWhiteSpaceAndSeparator(PsiElement psi) {
    if (psi instanceof PsiWhiteSpace) {
        //white space should be adjusted to left
        PsiElement prev = PsiTreeUtil.skipSiblingsBackward(psi, PsiWhiteSpace.class);
        if (prev != null) {
            psi = prev;
        }
    } else if (psi.getNode().getElementType() == ImpexTypes.PARAMETERS_SEPARATOR && psi.getNextSibling() != null) {
        //separator is always belongs to the *next* parameter, so adjusting to right
        psi = psi.getNextSibling();
    }
    return psi;
}
项目:TS-IJ    文件:TSPsiImplUtil.java   
public static PsiElement getNameNode(TSCallExpr call) {
    PsiElement nameElement = null;

    if (call.isParentCall()) {
        //Third
        nameElement = call.getFirstChild();
        if (nameElement != null) {
            nameElement = nameElement.getNextSibling();
        }
        if (nameElement != null) {
            nameElement = nameElement.getNextSibling();
        }
    } else {
        if (call.getFunctionType() == TSFunctionType.GLOBAL) {
            //First element is the function name
            nameElement = call.getFirstChild();
        } else {
            //Third
            nameElement = call.getFirstChild();
            if (nameElement != null) {
                nameElement = nameElement.getNextSibling();
            }
            if (nameElement != null) {
                nameElement = nameElement.getNextSibling();
            }
        }
    }
    if (nameElement == null) {
        return null;
    }
    return nameElement;
}
项目:laravel-insight    文件:PsiElementUtilTest.java   
@NotNull
private static PsiElement getStringLiteral(
    @NotNull final PsiElement fileSample,
    final String variableName
) {
    return valueOf((PhpExpression) ((AssignmentExpression) getElementByName(fileSample, variableName).getParent()).getValue());
}
项目:yii2support    文件:ActiveFormCompletionContributor.java   
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
    if ((typeChar == '\'' || typeChar == '"') && position.getParent() instanceof MethodReference) {
        return true;
    }

    return false;
}
项目:yii2support    文件:FieldAttributesCompletionProvider.java   
@Override

    protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {
        MethodReference methodRef = ClassUtils.getMethodRef(completionParameters.getPosition(), 10);
        PsiElement position = completionParameters.getPosition();
        if (methodRef != null) {
            Method method = (Method) methodRef.resolve();
            int paramPosition = ClassUtils.indexForElementInParameterList(completionParameters.getPosition());
            // attribute plus model parameters
            if (method != null && paramPosition > 0 && method.getParameters().length > paramPosition) {
                if (method.getParameters()[paramPosition].getName().equals("attribute") &&
                        method.getParameters()[paramPosition - 1].getName().equals("model")) {
                    PsiElement element = methodRef.getParameters()[paramPosition - 1];
                    if (element instanceof Variable) {
                        PhpClass classByVariable = ClassUtils.getClassByVariable((Variable) element);
                        if (classByVariable != null &&
                                ClassUtils.isClassInherit(classByVariable, "yii\\base\\Model", PhpIndex.getInstance(position.getProject()) )) {
                            Collection<Field> classFields = ClassUtils.getClassFields(classByVariable);
                            PhpExpression position2 = (PhpExpression) completionParameters.getPosition().getParent();
                            for (Field field : classFields) {
                                LookupElementBuilder lookupBuilder = buildLookup(field, position2);
                                completionResultSet.addElement(lookupBuilder);
                            }
                        }
                    }

                }
            }
        }
    }
项目:hybris-integration-intellij-idea-plugin    文件:HybrisEnumItemReferenceProvider.java   
@Override
@NotNull
public final PsiReference[] getReferencesByElement(
    @NotNull final PsiElement element,
    @NotNull final ProcessingContext context
) {

    final HybrisEnumItemReference reference
        = new HybrisEnumItemReference(element, true);
    final List<PsiReference> results = new ArrayList<>();
    results.add(reference);
    return results.toArray(new PsiReference[results.size()]);
}
项目:magento2-phpstorm-plugin    文件:EventIndex.java   
public Collection<PsiElement> getEventElements(final String name, final GlobalSearchScope scope) {
    Collection<PsiElement> result = new ArrayList<>();

    Collection<VirtualFile> virtualFiles =
            FileBasedIndex.getInstance().getContainingFiles(EventNameIndex.KEY, name, scope);

    for (VirtualFile virtualFile : virtualFiles) {
        XmlFile xmlFile = (XmlFile) PsiManager.getInstance(project).findFile(virtualFile);
        Collection<XmlAttributeValue> valueElements = XmlPsiTreeUtil
                .findAttributeValueElements(xmlFile, "event", "name", name);
        result.addAll(valueElements);
    }
    return result;
}
项目:intellij-postfix-templates    文件:CustomPostfixTemplateProvider.java   
/**
 * Loads the postfix templates from the given virtual file and returns them.
 *
 * @param vFile virtual templates file
 * @return set of postfix templates
 */
@SuppressWarnings("WeakerAccess")
public Set<PostfixTemplate> loadTemplatesFrom(@NotNull VirtualFile vFile) {
    Set<PostfixTemplate> templates = new OrderedSet<>();

    ApplicationManager.getApplication().runReadAction(() -> {
        Project project = ProjectManager.getInstance().getOpenProjects()[0];

        CptFile cptFile = (CptFile) PsiManager.getInstance(project).findFile(vFile);
        if (cptFile != null) {
            CptTemplate[] cptTemplates = PsiTreeUtil.getChildrenOfType(cptFile, CptTemplate.class);
            if (cptTemplates != null) {
                for (CptTemplate cptTemplate : cptTemplates) {
                    for (CptMapping mapping : cptTemplate.getMappings().getMappingList()) {
                        StringBuilder sb = new StringBuilder();
                        for (PsiElement element : mapping.getReplacement().getChildren()) {
                            sb.append(element.getText());
                        }

                        templates.add(createTemplate(mapping.getMatchingClass(), mapping.getConditionClass(), cptTemplate.getTemplateName(), cptTemplate.getTemplateDescription(), sb.toString()));
                    }
                }
            }
        }
    });

    return combineTemplatesWithSameName(templates);
}
项目:idea-php-dotenv-plugin    文件:RubyEnvironmentCallsVisitor.java   
@Override
public void visitElement(PsiElement element) {
    if(element instanceof RArrayIndexing) {
        this.visitFunction((RArrayIndexing) element);
    }

    super.visitElement(element);
}
项目:greycat-idea-plugin    文件:GCMUtil.java   
public static List<GCMTypeDeclaration> findProperties(Project project, final String key) {
    final List<GCMTypeDeclaration> result = new ArrayList<GCMTypeDeclaration>();
    Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, GCMLanguageType.INSTANCE,
            GlobalSearchScope.allScope(project));
    for (VirtualFile virtualFile : virtualFiles) {
        GCMFile simpleFile = (GCMFile) PsiManager.getInstance(project).findFile(virtualFile);
        if (simpleFile != null) {
            simpleFile.acceptChildren(new PsiElementVisitor() {
                @Override
                public void visitElement(PsiElement element) {
                    if (element instanceof GCMDeclaration) {
                        GCMDeclaration declaration = (GCMDeclaration) element;
                        if (declaration.getClassDeclaration() != null && declaration.getClassDeclaration().getTypeDeclaration() != null) {
                            if (key.equals(declaration.getClassDeclaration().getTypeDeclaration().getName())) {
                                result.add(declaration.getClassDeclaration().getTypeDeclaration());
                            }
                        }
                        if (declaration.getCustomTypeDeclaration() != null && declaration.getCustomTypeDeclaration().getIdent() != null) {
                            if (key.equals(declaration.getCustomTypeDeclaration().getIdent())) {
                                //result.add(declaration.getCustomTypeDeclaration().getIdent().getText());
                            }
                        }
                    }
                    super.visitElement(element);
                }
            });
        }
    }
    return result;
}
项目:jgiven-intellij-plugin    文件:JGivenUseScopeEnlarger.java   
@Nullable
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
    return scenarioStateAnnotationProvider.isJGivenScenarioState(element)
            ? GlobalSearchScope.everythingScope(element.getProject())
            : null;
}
项目:hybris-integration-intellij-idea-plugin    文件:ImpexFindUsagesProvider.java   
@NotNull
@Override
public String getType(@NotNull final PsiElement element) {
    if (isMacroNameDeclaration(element) || isMacroUsage(element)) {
        return "macros";
    }
    return "unknown";
}
项目:idea-php-typo3-plugin    文件:IconAnnotator.java   
private void annotateIcon(PsiElement psiElement, AnnotationHolder annotationHolder, String value) {
    if (IconIndex.getAllAvailableIcons(psiElement.getProject()).contains(value)) {
        annotationHolder.createInfoAnnotation(psiElement, null);
    } else {
        annotationHolder.createWarningAnnotation(psiElement, "Unresolved icon - this may also occur if the icon is defined in your extension, but not in the global icon registry.");
    }
}
项目:TS-IJ    文件:TSPsiImplUtil.java   
public static String getFunctionName(TSCallExpr call) {
    PsiElement nameNode = getNameNode(call);
    if (nameNode == null) {
        return null;
    }
    return nameNode.getText();
}
项目:TS-IJ    文件:TSObjectAnnotator.java   
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof TSLiteralExpr) {
        boolean valid = false;
        TSLiteralReference ref = (TSLiteralReference)element.getReference();
        if (ref != null) {
            valid = ref.multiResolve(false).length > 0;
        }

        if (valid) {
            createSuccessAnnotation(element, holder, TSSyntaxHighlighter.OBJECT_NAME);
        }
    }
}
项目:ReactPropTypes-Plugin    文件:PsiElementHelper.java   
public static PsiElement getRealFirstChild (ES6Class es6Class){
    PsiElement[] children = es6Class.getChildren();
    if(children.length>2){
       if((children[2] instanceof JSFunction)|| children[2] instanceof JSVarStatementBase){
           return children[2];
       }
    }
    if(children.length>3){
        if((children[3] instanceof JSFunction)|| children[3] instanceof JSVarStatementBase){
            return children[3];
        }
    }
    return null;
}
项目:intellij-csv-validator    文件:CsvUnquoteAllIntentionAction.java   
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
    if (!super.isAvailable(project, editor, element)) {
        return false;
    }

    return !CsvIntentionHelper.getAllElements(element.getContainingFile()).stream()
                    .anyMatch(psiElement -> CsvIntentionHelper.getElementType(psiElement) == TokenType.BAD_CHARACTER);
}
项目:Android_Lint_SRP_Practice_Example    文件:PsiClassStructureDetector.java   
public void report(String nodeName, String source, PsiElement element) {
    System.out.println();
    System.out.println("Node=" + nodeName);
    System.out.println("NodeImpl=" + element.getClass().getSimpleName());
    System.out.println("Source=>>>" + source + "<<<");
    System.out.println("parent=" + parseParent(element));
    System.out.println("children=" + parseChildren(element));
}