当前位置: 首页>>代码示例>>Java>>正文


Java PhpDocTag.getName方法代码示例

本文整理汇总了Java中com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag.getName方法的典型用法代码示例。如果您正苦于以下问题:Java PhpDocTag.getName方法的具体用法?Java PhpDocTag.getName怎么用?Java PhpDocTag.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag的用法示例。


在下文中一共展示了PhpDocTag.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAnnotationReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
@Nullable
public static PhpClass getAnnotationReference(PhpDocTag phpDocTag, final Map<String, String> useImports) {

    String tagName = phpDocTag.getName();
    if(tagName.startsWith("@")) {
        tagName = tagName.substring(1);
    }

    String className = tagName;
    String subNamespaceName = "";
    if(className.contains("\\")) {
        className = className.substring(0, className.indexOf("\\"));
        subNamespaceName = tagName.substring(className.length());
    }

    if(!useImports.containsKey(className)) {
        return null;
    }

    return PhpElementsUtil.getClass(phpDocTag.getProject(), useImports.get(className) + subNamespaceName);

}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:23,代码来源:AnnotationBackportUtil.java

示例2: getAnnotationReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
@Nullable
public static PhpClass getAnnotationReference(@Nullable PhpDocTag phpDocTag) {
    if(phpDocTag == null) return null;

    // check annoation in current namespace
    String tagName = phpDocTag.getName();
    if(tagName.startsWith("@")) {
        tagName = tagName.substring(1);
    }

    PhpNamespace phpNamespace = PsiTreeUtil.getParentOfType(phpDocTag, PhpNamespace.class);
    if(phpNamespace != null) {
        String currentNsClass = phpNamespace.getFQN() + "\\" + tagName;
        PhpClass phpClass = PhpElementsUtil.getClass(phpDocTag.getProject(), currentNsClass);
        if(phpClass != null) {
            return phpClass;
        }
    }

    return getAnnotationReference(phpDocTag, getUseImportMap(phpDocTag));

}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:23,代码来源:AnnotationUtil.java

示例3: getPossibleImportClasses

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
public static Collection<PhpClass> getPossibleImportClasses(PhpDocTag phpDocTag) {

        String className = phpDocTag.getName();
        if(className.startsWith("@")) {
            className = className.substring(1);
        }

        List<PhpClass> phpClasses = new ArrayList<>();

        for(PhpClass annotationClass: AnnotationUtil.getAnnotationsClasses(phpDocTag.getProject())) {
            if(annotationClass.getName().equals(className)) {
                phpClasses.add(annotationClass);
            }
        }

        return phpClasses;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:18,代码来源:AnnotationUtil.java

示例4: getClassNameReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
@Nullable
public static String getClassNameReference(PhpDocTag phpDocTag, Map<String, String> useImports) {

    if(useImports.size() == 0) {
        return null;
    }

    String annotationName = phpDocTag.getName();
    if(StringUtils.isBlank(annotationName)) {
        return null;
    }

    if(annotationName.startsWith("@")) {
        annotationName = annotationName.substring(1);
    }

    String className = annotationName;
    String subNamespaceName = "";
    if(className.contains("\\")) {
        className = className.substring(0, className.indexOf("\\"));
        subNamespaceName = annotationName.substring(className.length());
    }

    if(!useImports.containsKey(className)) {
        return null;
    }

    // normalize name
    String annotationFqnName = useImports.get(className) + subNamespaceName;
    if(!annotationFqnName.startsWith("\\")) {
        annotationFqnName = "\\" + annotationFqnName;
    }

    return annotationFqnName;

}
 
开发者ID:goaop,项目名称:idea-plugin,代码行数:37,代码来源:PluginUtil.java

示例5: getClassNameReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
@Nullable
public static String getClassNameReference(PhpDocTag phpDocTag, Map<String, String> useImports) {

    if(useImports.size() == 0) {
        return null;
    }

    String annotationName = phpDocTag.getName();
    if(StringUtils.isBlank(annotationName)) {
        return null;
    }

    if(annotationName.startsWith("@")) {
        annotationName = annotationName.substring(1);
    }

    String className = annotationName;
    String subNamespaceName = "";
    if(className.contains("\\")) {
        className = className.substring(0, className.indexOf("\\"));
        subNamespaceName = annotationName.substring(className.length());
    }

    if(!useImports.containsKey(className)) {
        return null;
    }

    // normalize name
    String annotationFqnName = useImports.get(className) + subNamespaceName;
    if(!annotationFqnName.startsWith("\\")) {
        annotationFqnName = "\\" + annotationFqnName;
    }

    return annotationFqnName;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:36,代码来源:AnnotationBackportUtil.java

示例6: visitAnnotationDocTag

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
private void visitAnnotationDocTag(PhpDocTag phpDocTag, @NotNull ProblemsHolder holder) {

        String name = phpDocTag.getName();
        if(StringUtils.isBlank(name) || AnnotationUtil.NON_ANNOTATION_TAGS.contains(name)) {
            return;
        }

        // Target for our inspection is DocTag name: @Foobar() => Foobar
        // This prevent highlighting the complete DocTag
        PsiElement firstChild = phpDocTag.getFirstChild();
        if(firstChild == null || firstChild.getNode().getElementType() != PhpDocElementTypes.DOC_TAG_NAME) {
            return;
        }

        PhpClass annotationReference = AnnotationUtil.getAnnotationReference(phpDocTag);
        if(annotationReference != null) {
            return;
        }

        Collection<PhpClass> phpClasses = AnnotationUtil.getPossibleImportClasses(phpDocTag);
        if(phpClasses.size() == 0) {
            return;
        }

        Set<String> collect = phpClasses.stream()
            .map(phpClass -> StringUtils.stripStart(phpClass.getFQN(), "\\"))
            .collect(Collectors.toSet());

        holder.registerProblem(
            firstChild,
            MESSAGE,
            ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
            new ImportUseForAnnotationQuickFix(phpDocTag, collect)
        );
    }
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:36,代码来源:AnnotationMissingUseInspection.java

示例7: getClassNameReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入方法依赖的package包/类
@Nullable
private static String getClassNameReference(@NotNull PhpDocTag phpDocTag, @NotNull Map<String, String> useImports) {

    if(useImports.size() == 0) {
        return null;
    }

    String annotationName = phpDocTag.getName();
    if(StringUtils.isBlank(annotationName)) {
        return null;
    }

    if(annotationName.startsWith("@")) {
        annotationName = annotationName.substring(1);
    }

    String className = annotationName;
    String subNamespaceName = "";
    if(className.contains("\\")) {
        className = className.substring(0, className.indexOf("\\"));
        subNamespaceName = annotationName.substring(className.length());
    }

    if(!useImports.containsKey(className)) {
        return null;
    }

    // normalize name
    String annotationFqnName = useImports.get(className) + subNamespaceName;
    if(!annotationFqnName.startsWith("\\")) {
        annotationFqnName = "\\" + annotationFqnName;
    }

    return annotationFqnName;
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:36,代码来源:PhpDocTagAnnotationRecursiveElementWalkingVisitor.java


注:本文中的com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。