• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PhpDocTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



PhpDocTag类属于com.jetbrains.php.lang.documentation.phpdoc.psi.tags包,在下文中一共展示了PhpDocTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findClassInSeeTags

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
@Nullable
public static PhpClass findClassInSeeTags(PhpIndex index, PhpClass phpClass, String searchClassFQN) {
    if (phpClass.getDocComment() == null)
        return null;
    PhpClass activeRecordClass = null;
    PhpDocTag[] tags = phpClass.getDocComment().getTagElementsByName("@see");
    for (PhpDocTag tag : tags) {
        String className = tag.getText().replace(tag.getName(), "").trim();
        if (className.indexOf('\\') == -1) {
            className = phpClass.getNamespaceName() + className;
        }
        PhpClass classInSee = getClass(index, className);
        if (isClassInheritsOrEqual(classInSee, getClass(index, searchClassFQN))) {
            activeRecordClass = classInSee;
            break;
        }
    }
    return activeRecordClass;
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:20,代码来源:ClassUtils.java


示例2: isValidReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
private static boolean isValidReference(PhpNamedElement referencedElement, PsiElement contextElement) {
    MagentoModule referenceSourceModule = getMagentoModule(referencedElement);
    MagentoModule currentModule = getMagentoModule(contextElement);


    if (!areDifferentModules(referenceSourceModule, currentModule)) {
        return true;
    }

    PhpDocComment docComment = referencedElement.getDocComment();
    if(docComment == null) {
        return false;
    }

    PhpDocTag[] elements = docComment.getTagElementsByName(API_TAG);
    return elements.length > 0;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:18,代码来源:MagentoApiInspection.java


示例3: isInsideAnnotation

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * Checks if host is concrete annotation to inject syntax into it
 *
 * @param host Host element, typically string literal expression
 * @param annotationPrefix Annotation prefix
 * @return boolean
 */
public static boolean isInsideAnnotation(@NotNull StringLiteralExpression host, String annotationPrefix) {

    PhpDocTag phpDocTag = PsiTreeUtil.getParentOfType(host, PhpDocTag.class);
    if (phpDocTag == null || !AnnotationPattern.getDocBlockTag().accepts(phpDocTag)) {
        return false;
    }

    PhpDocTagAnnotation phpDocAnnotationContainer = AnnotationUtil.getPhpDocAnnotationContainer(phpDocTag);
    PhpClass phpClass = null;
    if (phpDocAnnotationContainer != null) {
        phpClass = phpDocAnnotationContainer.getPhpClass();
    }

    if (phpClass == null || phpClass.getFQN() == null) {
        return false;
    }

    return phpClass.getFQN().startsWith(annotationPrefix);

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


示例4: matches

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
@Override
public boolean matches(PhpNamedElement element) {
    if (!canMatchElement(element)) {
        return false;
    }
    PhpDocComment docComment = element.getDocComment();
    if (docComment == null) {
        return false;
    }

    List<PhpDocTag> docTagList = PsiTreeUtil.getChildrenOfTypeAsList(docComment, PhpDocTag.class);
    for (PhpDocTag phpDocTag : docTagList) {
        PhpClass annotationReference = AnnotationUtil.getAnnotationReference(phpDocTag);
        if (annotationReference == null || annotationReference.getPresentableFQN() == null) {
            continue;
        }
        String fqn = annotationReference.getFQN();
        if (fqn != null && fqn.equals(expectedClass)) {
            return true;
        };
    }

    return false;
}
 
开发者ID:goaop,项目名称:idea-plugin,代码行数:25,代码来源:AnnotationPointcut.java


示例5: resolveType

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
@Nullable
@Override
public String resolveType(PsiElement psiElement)
{
    String variableName = psiElement.getText();
    PsiElement statement = PsiTreeUtil.getParentOfType(psiElement, Statement.class);
    PsiElement sibling = PsiTreeUtil.getPrevSiblingOfType(statement, PhpDocComment.class);
    PhpDocTag tag;

    // Check all statements within current scope for doc-blocks.
    do {
        tag = PsiTreeUtil.getChildOfType(sibling, PhpDocTag.class);
        if (tagMatches(tag, variableName)) {
            break;
        }
        sibling = PsiTreeUtil.getPrevSiblingOfType(sibling, PhpDocComment.class);
        tag = null;
    } while (sibling != null);

    if (tag == null) {
        return null;
    }

    return parsePhpDoc(tag);
}
 
开发者ID:whitefire,项目名称:eZ-completion,代码行数:26,代码来源:ContentVariableTypeProvider.java


示例6: tagMatches

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
protected boolean tagMatches(PhpDocTag tag, String variableName)
{
    if (tag == null) {
        return false;
    }

    variableName = variableName.replace("$", "");
    String[] parts = tag.getTagValue().split(" ");
    for (String part : parts) {
        part = part.replace("$", "");
        if (part.equals(variableName)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:whitefire,项目名称:eZ-completion,代码行数:18,代码来源:ContentVariableTypeProvider.java


示例7: parsePhpDoc

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
protected String parsePhpDoc(PhpDocTag tag)
{
    if (!tag.getName().equals("@ContentType")) {
        return null;
    }

    String value = tag.getTagValue();
    if (value.length() == 0) {
        return null;
    }

    String[] parts = value.split(" ");
    if (parts.length == 1) {
        return parts[0];
    }

    String firstPart = parts[0];
    String secondPart = parts.length > 1 ? parts[1] : null;
    String contentClass = firstPart.contains("$") ? secondPart : firstPart;

    return typeSeparator() + contentClass;
}
 
开发者ID:whitefire,项目名称:eZ-completion,代码行数:23,代码来源:ContentVariableTypeProvider.java


示例8: getTemplateAnnotationFilesWithSiblingMethod

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * Get templates on "@Template()" and on method attached to given PhpDocTag
 */
@NotNull
public static Map<String, Collection<PsiElement>> getTemplateAnnotationFilesWithSiblingMethod(@NotNull PhpDocTag phpDocTag) {
    Map<String, Collection<PsiElement>> targets = new HashMap<>();

    // template on direct PhpDocTag
    Pair<String, Collection<PsiElement>> templateAnnotationFiles = TwigUtil.getTemplateAnnotationFiles(phpDocTag);
    if(templateAnnotationFiles != null) {
        targets.put(templateAnnotationFiles.getFirst(), templateAnnotationFiles.getSecond());
    }

    // templates on "Method" of PhpDocTag
    PhpDocComment phpDocComment = PsiTreeUtil.getParentOfType(phpDocTag, PhpDocComment.class);
    if(phpDocComment != null) {
        PsiElement method = phpDocComment.getNextPsiSibling();
        if(method instanceof Method) {
            for (String name : TwigUtil.getControllerMethodShortcut((Method) method)) {
                targets.put(name, new HashSet<>(getTemplatePsiElements(method.getProject(), name)));
            }
        }
    }

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


示例9: visitPhpDocTag

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

        // "@var" and user non related tags dont need an action
        if(AnnotationBackportUtil.NON_ANNOTATION_TAGS.contains(phpDocTag.getName())) {
            return;
        }

        Map<String, String> fileImports = AnnotationBackportUtil.getUseImportMap(phpDocTag);
        if(fileImports.size() == 0) {
            return;
        }

        String annotationFqnName = AnnotationBackportUtil.getClassNameReference(phpDocTag, fileImports);
        for (String annotation : annotations) {
            if(annotation.equals(annotationFqnName)) {
                this.phpDocTagProcessor.process(phpDocTag);
            }
        }
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:20,代码来源:AnnotationElementWalkingVisitor.java


示例10: getController

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * FooController::fooAction
 */
@Nullable
private String getController(@NotNull PhpDocTag phpDocTag) {
    Method method = AnnotationBackportUtil.getMethodScope(phpDocTag);
    if(method == null) {
        return null;
    }

    PhpClass containingClass = method.getContainingClass();
    if(containingClass == null) {
        return null;
    }

    return String.format("%s::%s",
        StringUtils.stripStart(containingClass.getFQN(), "\\"),
        method.getName()
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:21,代码来源:AnnotationRouteElementWalkingVisitor.java


示例11: 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


示例12: hasReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
public static boolean hasReference(@Nullable PhpDocComment docComment, String... className) {
    if(docComment == null) return false;

    Map<String, String> uses = AnnotationBackportUtil.getUseImportMap(docComment);

    for(PhpDocTag phpDocTag: PsiTreeUtil.findChildrenOfAnyType(docComment, PhpDocTag.class)) {
        if(!AnnotationBackportUtil.NON_ANNOTATION_TAGS.contains(phpDocTag.getName())) {
            PhpClass annotationReference = AnnotationBackportUtil.getAnnotationReference(phpDocTag, uses);
            if(annotationReference != null && PhpElementsUtil.isEqualClassName(annotationReference, className)) {
                return true;
            }
        }

    }

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


示例13: getReference

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
public static PhpDocTag getReference(@Nullable PhpDocComment docComment, String className) {
    if(docComment == null) return null;

    Map<String, String> uses = AnnotationBackportUtil.getUseImportMap(docComment);

    for(PhpDocTag phpDocTag: PsiTreeUtil.findChildrenOfAnyType(docComment, PhpDocTag.class)) {
        if(AnnotationBackportUtil.NON_ANNOTATION_TAGS.contains(phpDocTag.getName())) {
            continue;
        }

        PhpClass annotationReference = AnnotationBackportUtil.getAnnotationReference(phpDocTag, uses);
        if(annotationReference != null && PhpElementsUtil.isEqualClassName(annotationReference, className)) {
            return phpDocTag;
        }
    }

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


示例14: addCompletions

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    PsiElement psiElement = parameters.getOriginalPosition();
    if(psiElement == null) {
        return;
    }

    PhpDocTag phpDocTag = PsiTreeUtil.getParentOfType(parameters.getOriginalPosition(), PhpDocTag.class);
    PhpClass phpClass = AnnotationUtil.getAnnotationReference(phpDocTag);
    if(phpClass == null) {
        return;
    }

    AnnotationPropertyParameter annotationPropertyParameter = new AnnotationPropertyParameter(parameters.getOriginalPosition(), phpClass, AnnotationPropertyParameter.Type.DEFAULT);
    providerWalker(parameters, context, result, annotationPropertyParameter);

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


示例15: addDocTagNameGoto

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * Add goto for DocTag itself which should be the PhpClass and provide Extension
 *
 * @param psiElement origin DOC_TAG_NAME psi element
 * @param targets Goto targets
 */
private void addDocTagNameGoto(PsiElement psiElement, List<PsiElement> targets) {

    PsiElement phpDocTagValue = psiElement.getContext();
    if(!(phpDocTagValue instanceof PhpDocTag)) {
        return;
    }

    PhpClass phpClass = AnnotationUtil.getAnnotationReference((PhpDocTag) phpDocTagValue);
    if(phpClass == null) {
        return;
    }

    targets.add(phpClass);

    AnnotationDocTagGotoHandlerParameter parameter = new AnnotationDocTagGotoHandlerParameter((PhpDocTag) phpDocTagValue, phpClass, targets);
    for(PhpAnnotationDocTagGotoHandler phpAnnotationExtension : AnnotationUtil.EP_DOC_TAG_GOTO.getExtensions()) {
        phpAnnotationExtension.getGotoDeclarationTargets(parameter);
    }

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


示例16: 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


示例17: getPhpDocCommentAnnotationContainer

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
@Nullable
public static PhpDocCommentAnnotation getPhpDocCommentAnnotationContainer(@Nullable PhpDocComment phpDocComment) {
    if(phpDocComment == null) return null;

    Map<String, String> uses = AnnotationUtil.getUseImportMap(phpDocComment);

    Map<String, PhpDocTagAnnotation> annotationRefsMap = new HashMap<>();
    for(PhpDocTag phpDocTag: PsiTreeUtil.findChildrenOfType(phpDocComment, PhpDocTag.class)) {
        if(!AnnotationUtil.NON_ANNOTATION_TAGS.contains(phpDocTag.getName())) {
            PhpClass annotationClass = AnnotationUtil.getAnnotationReference(phpDocTag, uses);
            if(annotationClass != null) {
                annotationRefsMap.put(annotationClass.getPresentableFQN(), new PhpDocTagAnnotation(annotationClass, phpDocTag));
            }
        }

    }

    return new PhpDocCommentAnnotation(annotationRefsMap, phpDocComment);
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:20,代码来源:AnnotationUtil.java


示例18: 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


示例19: getPropertyValue

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * Get the property value by given name
 *
 * "@Template(template="foobar.html.twig")"
 */
@Nullable
public static String getPropertyValue(@NotNull PhpDocTag phpDocTag, @NotNull String property) {
    PhpPsiElement attributeList = phpDocTag.getFirstPsiChild();
    if(attributeList == null || attributeList.getNode().getElementType() != PhpDocElementTypes.phpDocAttributeList) {
        return null;
    }

    PsiElement lParen = attributeList.getFirstChild();
    if(lParen == null) {
        return null;
    }

    StringLiteralExpression psiProperty = getPropertyValueAsPsiElement(phpDocTag, property);
    if(psiProperty == null) {
        return null;
    }

    String contents = psiProperty.getContents();
    if(StringUtils.isNotBlank(contents)) {
        return contents;
    }

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


示例20: getPropertyValueAsPsiElement

import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag; //导入依赖的package包/类
/**
 * Get the property value by given name
 *
 * "@Template(template="foobar.html.twig")"
 */
@Nullable
public static StringLiteralExpression getPropertyValueAsPsiElement(@NotNull PhpDocTag phpDocTag, @NotNull String property) {
    PhpPsiElement attributeList = phpDocTag.getFirstPsiChild();
    if(attributeList == null || attributeList.getNode().getElementType() != PhpDocElementTypes.phpDocAttributeList) {
        return null;
    }

    PsiElement lParen = attributeList.getFirstChild();
    if(lParen == null) {
        return null;
    }

    PsiElement psiProperty = Arrays.stream(attributeList.getChildren())
        .filter(psiElement1 -> getPropertyIdentifierValue(property).accepts(psiElement1))
        .findFirst()
        .orElse(null);

    if(psiProperty instanceof StringLiteralExpression) {
        return (StringLiteralExpression) psiProperty;
    }

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Furnace类代码示例发布时间:2022-05-22
下一篇:
Java FileIndexFacade类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap