本文整理汇总了Java中com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag类的典型用法代码示例。如果您正苦于以下问题:Java PhpDocParamTag类的具体用法?Java PhpDocParamTag怎么用?Java PhpDocParamTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhpDocParamTag类属于com.jetbrains.php.lang.documentation.phpdoc.psi.tags包,在下文中一共展示了PhpDocParamTag类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCompletions
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
@Override
public void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
PsiElement psiElement = completionParameters.getPosition().getParent();
Collection<PhpDocParamTag> docTags = PhpDocUtil.getDocTagsForScope(psiElement);
if(docTags == null || docTags.size() == 0) {
return;
}
PhpToolboxCompletionContributorParameter parameter = null;
for(PhpDocParamTag phpDocParamTag: docTags) {
String providerName = extractProviderName(phpDocParamTag.getText());
if(providerName == null) {
continue;
}
List<PhpToolboxProviderInterface> filter = getProvidersByName(
psiElement,
providerName
);
if(filter.size() == 0) {
continue;
}
if(parameter == null) {
parameter = new PhpToolboxCompletionContributorParameter(completionParameters, context, resultSet, new HashSet<>());
}
for (PhpToolboxProviderInterface provider : filter) {
resultSet.addAllElements(provider.getLookupElements(parameter));
}
}
}
示例2: getDocTagsForScope
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
/**
* Collects all doc tag text for an index. does also visit also method implements cases
*/
@Nullable
public static Collection<PhpDocParamTag> getDocTagsForScope(@NotNull PsiElement psiElement) {
ParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);
if (parameterList == null) {
return null;
}
ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement);
if(currentIndex == null) {
return null;
}
PsiElement parent = parameterList.getParent();
PsiReference psiReference = getElementReference(parent);
if (psiReference == null) {
return null;
}
PsiElement resolvedReference = psiReference.resolve();
if (!(resolvedReference instanceof Function)) {
return null;
}
Function method = (Function) resolvedReference;
Parameter[] methodParameter = method.getParameters();
if(methodParameter.length -1 < currentIndex.getIndex()) {
return null;
}
Collection<PhpDocParamTag> phpDocParamTags = new ArrayList<>();
if(method instanceof Method) {
for(Method implementedMethod: getImplementedMethods((Method) method)) {
Parameter[] implementedParameters = implementedMethod.getParameters();
if(!(implementedParameters.length -1 < currentIndex.getIndex())) {
Parameter parameter = implementedParameters[currentIndex.getIndex()];
PsiElement implementedParameterList = parameter.getContext();
if(implementedParameterList instanceof ParameterList
|| implementedParameterList instanceof Method
) {
PhpDocParamTag phpDocParamTag = parameter.getDocTag();
if(phpDocParamTag != null) {
phpDocParamTags.add(phpDocParamTag);
}
}
}
}
} else {
PhpDocParamTag docTag = methodParameter[currentIndex.getIndex()].getDocTag();
if(docTag != null) {
phpDocParamTags.add(docTag);
}
}
return phpDocParamTags;
}
示例3: getGotoDeclarationTargets
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@NotNull PsiElement psiElement, int i, Editor editor) {
PsiElement element = psiElement.getParent();
if (!(element instanceof StringLiteralExpression)) {
return new PsiElement[0];
}
String contents = ((StringLiteralExpression) element).getContents();
if (StringUtils.isBlank(contents)) {
return new PsiElement[0];
}
PhpToolboxDeclarationHandlerParameter args = null;
Collection<PsiElement> targets = new ArrayList<>();
Collection<PhpDocParamTag> docTags = PhpDocUtil.getDocTagsForScope(psiElement);
if (docTags == null || docTags.size() == 0) {
return new PsiElement[0];
}
for (PhpDocParamTag phpDocParamTag : docTags) {
String providerName = extractProviderName(phpDocParamTag.getText());
if (providerName == null) {
continue;
}
List<PhpToolboxProviderInterface> filter = getProvidersByName(
psiElement,
providerName
);
if (filter.size() == 0) {
continue;
}
if (args == null) {
args = new PhpToolboxDeclarationHandlerParameter(psiElement, contents, psiElement.getContainingFile().getFileType());
}
for (PhpToolboxProviderInterface provider : filter) {
targets.addAll(provider.getPsiTargets(args));
}
}
return targets.toArray(new PsiElement[targets.size()]);
}
示例4: attachAnnotationInformation
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
public static void attachAnnotationInformation(Field field, DoctrineModelField doctrineModelField) {
// we already have that without regular expression
// @TODO: de.espend.idea.php.annotation.util.AnnotationUtil.getPhpDocCommentAnnotationContainer()
// fully require plugin now?
// get some more presentable completion information
// dont resolve docblocks; just extract them from doc comment
PhpDocComment docBlock = field.getDocComment();
if(docBlock == null) {
return;
}
String text = docBlock.getText();
// column type
Matcher matcher = Pattern.compile("type[\\s]*=[\\s]*[\"|']([\\w_\\\\]+)[\"|']").matcher(text);
if (matcher.find()) {
doctrineModelField.setTypeName(matcher.group(1));
}
// relation type
matcher = Pattern.compile("((Many|One)To(Many|One))\\(").matcher(text);
if (matcher.find()) {
doctrineModelField.setRelationType(matcher.group(1));
// targetEntity name
matcher = Pattern.compile("targetEntity[\\s]*=[\\s]*[\"|']([\\w_\\\\]+)[\"|']").matcher(text);
if (matcher.find()) {
doctrineModelField.setRelation(matcher.group(1));
} else {
// @TODO: external split
// FLOW shortcut:
// @var "\DateTime" is targetEntity
PhpDocParamTag varTag = docBlock.getVarTag();
if(varTag != null) {
String type = varTag.getType().toString();
if(org.apache.commons.lang.StringUtils.isNotBlank(type)) {
doctrineModelField.setRelation(type);
}
}
}
}
matcher = Pattern.compile("Column\\(").matcher(text);
if (matcher.find()) {
matcher = Pattern.compile("name\\s*=\\s*\"(\\w+)\"").matcher(text);
if(matcher.find()) {
doctrineModelField.setColumn(matcher.group(1));
}
}
}
示例5: getPhpDocParamTags
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
private ArrayList<PhpDocParamTag> getPhpDocParamTags() {
return phpDocParamTags;
}
示例6: isValid
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag; //导入依赖的package包/类
public boolean isValid() {
this.parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);
if (this.parameterList == null) {
return false;
}
ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement);
if(currentIndex == null) {
return false;
}
PsiElement parent = parameterList.getParent();
PsiReference psiReference = getElementReference(parent);
if (null == psiReference) {
return false;
}
PsiElement resolvedReference = psiReference.resolve();
if (!(resolvedReference instanceof Method)) {
return false;
}
Method method = (Method) resolvedReference;
Parameter[] methodParameter = method.getParameters();
if(methodParameter.length -1 < currentIndex.getIndex()) {
return false;
}
this.phpDocParamTags = new ArrayList<>();
Method[] implementedMethods = PhpElementsUtil.getImplementedMethods(method);
for(Method implementedMethod: implementedMethods) {
Parameter[] implementedParameters = implementedMethod.getParameters();
if(!(implementedParameters.length -1 < currentIndex.getIndex())) {
Parameter parameter = implementedParameters[currentIndex.getIndex()];
PsiElement implementedParameterList = parameter.getContext();
if(implementedParameterList instanceof ParameterList
|| implementedParameterList instanceof Method
) {
PhpDocParamTag phpDocParamTag = parameter.getDocTag();
if(phpDocParamTag != null) {
this.phpDocParamTags.add(phpDocParamTag);
this.parameters.add(implementedParameters);
}
}
}
}
return phpDocParamTags.size() > 0;
}