本文整理汇总了Java中com.jetbrains.php.lang.psi.elements.ParameterList类的典型用法代码示例。如果您正苦于以下问题:Java ParameterList类的具体用法?Java ParameterList怎么用?Java ParameterList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterList类属于com.jetbrains.php.lang.psi.elements包,在下文中一共展示了ParameterList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeAutoPopup
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@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;
}
示例2: findParamRefByElement
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@Nullable
public static PsiElement findParamRefByElement(PsiElement element) {
int limit = 10;
PsiElement prevElement = element;
PsiElement currElement = element.getParent();
while (limit > 0) {
if (currElement instanceof ParameterList)
return prevElement;
else {
prevElement = currElement;
currElement = currElement.getParent();
limit--;
}
}
return null;
}
示例3: invokeAutoPopup
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
MethodReference reference = PsiTreeUtil.getParentOfType(position, MethodReference.class);
if (reference != null && reference.getName() != null && reference.getName().equals("t") && reference.getClassReference() instanceof ClassReference) {
ClassReference classReference = (ClassReference) reference.getClassReference();
if (classReference == null || classReference.getName() == null || !classReference.getName().equals("Yii")) {
return false;
}
if (typeChar == '\'' || typeChar == '"') {
if (position instanceof LeafPsiElement && (position.getText().equals("$category") || position.getText().equals("$message"))) {
return true;
}
if (position.getNextSibling() instanceof ParameterList) {
return true;
}
}
}
return false;
}
示例4: isFunctionParameter
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
private static boolean isFunctionParameter(PsiElement psiElement, int parameterIndex, String... funcName) {
PsiElement variableContext = psiElement.getContext();
if(!(variableContext instanceof ParameterList)) {
return false;
} else {
ParameterList parameterList = (ParameterList) variableContext;
PsiElement context = parameterList.getContext();
if(!(context instanceof FunctionReference)) {
return false;
} else {
FunctionReference methodReference = (FunctionReference) context;
String name = methodReference.getName();
return (name != null && Arrays.asList(funcName).contains(name) && getParameterIndex(parameterList, psiElement) == parameterIndex);
}
}
}
示例5: isInsidePointcutBuilderMethod
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
/**
* Checks if host is PointcutBuilder->method('<pointcutExpression>', function () {...})
* @param host Host element is typically PHP string
*
* @return boolean
*/
public static boolean isInsidePointcutBuilderMethod(StringLiteralExpression host)
{
PsiElement element = host.getParent();
if (!(element instanceof ParameterList)) {
return false;
}
element = element.getParent();
if (!(element instanceof MethodReference)) {
return false;
}
PsiElement resolvedElement = ((MethodReference) element).resolve();
if (!(resolvedElement instanceof MethodImpl)) {
return false;
}
MethodImpl methodImpl = (MethodImpl) resolvedElement;
if (methodImpl.getFQN() == null) {
return false;
}
return methodImpl.getFQN().startsWith("\\Go\\Aop\\Support\\PointcutBuilder");
}
示例6: isFunctionReference
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
public static boolean isFunctionReference(@NotNull PsiElement psiElement, @NotNull String functionName, int parameterIndex) {
PsiElement parameterList = psiElement.getParent();
if(!(parameterList instanceof ParameterList)) {
return false;
}
ParameterBag index = PhpElementsUtil.getCurrentParameterIndex(psiElement);
if(index == null || index.getIndex() != parameterIndex) {
return false;
}
PsiElement functionCall = parameterList.getParent();
if(!(functionCall instanceof FunctionReference)) {
return false;
}
return functionName.equals(((FunctionReference) functionCall).getName());
}
示例7: getArrayParameterDirectiveForElementType
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
/**
* "@foobar(['<caret>'])"
*
* whereas "foobar" is registered a directive
*/
public static PsiElementPattern.Capture<PsiElement> getArrayParameterDirectiveForElementType(@NotNull IElementType... elementType) {
return PlatformPatterns.psiElement()
.withParent(
PlatformPatterns.psiElement(StringLiteralExpression.class)
.withParent(
PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).withParent(
PlatformPatterns.psiElement(ArrayCreationExpression.class)
.withParent(ParameterList.class)
)
)
.with(
new MyDirectiveInjectionElementPatternCondition(elementType)
)
)
.withLanguage(PhpLanguage.INSTANCE);
}
示例8: isDirectiveWithInstance
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
public static boolean isDirectiveWithInstance(@NotNull PsiElement psiElement, @NotNull String clazz, @NotNull String method) {
PsiElement stringLiteral = psiElement.getParent();
if(stringLiteral instanceof StringLiteralExpression) {
PsiElement parameterList = stringLiteral.getParent();
if(parameterList instanceof ParameterList) {
PsiElement methodReference = parameterList.getParent();
if(methodReference instanceof MethodReference && method.equals(((MethodReference) methodReference).getName())) {
String text = methodReference.getText();
int i = text.indexOf(":");
// method resolve dont work; extract class name from text "Foo::method(..."
return i > 0 && StringUtils.stripStart(text.substring(0, i), "\\").equals(clazz);
}
}
}
return false;
}
示例9: isDirectiveWithName
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
private boolean isDirectiveWithName(PsiElement psiElement, String directiveName) {
PsiElement stringLiteral = psiElement.getParent();
if(stringLiteral instanceof StringLiteralExpression) {
PsiElement parameterList = stringLiteral.getParent();
if(parameterList instanceof ParameterList) {
PsiElement methodReference = parameterList.getParent();
if(methodReference instanceof MethodReference) {
String name = ((MethodReference) methodReference).getName();
if(name != null && name.equalsIgnoreCase(directiveName)) {
return true;
}
}
}
}
return false;
}
示例10: getNamespaceFromConfigValueParameter
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
/**
*
*/
@Nullable
public static String getNamespaceFromConfigValueParameter(@NotNull StringLiteralExpression parent) {
MethodMatcher.MethodMatchParameter match = MethodMatcher.getMatchedSignatureWithDepth(parent, ShopwarePhpCompletion.CONFIG_NAMESPACE, 1);
if(match == null) {
return null;
}
PsiElement parameterList = parent.getParent();
if(!(parameterList instanceof ParameterList)) {
return null;
}
PsiElement[] funcParameters = ((ParameterList) parameterList).getParameters();
if(funcParameters.length == 0 || !(funcParameters[0] instanceof StringLiteralExpression)) {
return null;
}
String namespace = ((StringLiteralExpression) funcParameters[0]).getContents();
if(StringUtils.isBlank(namespace)) {
return null;
}
return namespace;
}
示例11: invoke
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
private void invoke(@NotNull ProblemsHolder holder, @NotNull PsiElement psiElement) {
if (!(psiElement instanceof StringLiteralExpression) || !(psiElement.getContext() instanceof ParameterList)) {
return;
}
ParameterList parameterList = (ParameterList) psiElement.getContext();
PsiElement methodReference = parameterList.getContext();
if (!(methodReference instanceof MethodReference)) {
return;
}
if (!PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) methodReference, TranslationUtil.PHP_TRANSLATION_SIGNATURES)) {
return;
}
int domainParameter = 2;
if("transChoice".equals(((MethodReference) methodReference).getName())) {
domainParameter = 3;
}
ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement);
if(currentIndex != null && currentIndex.getIndex() == domainParameter) {
annotateTranslationDomain((StringLiteralExpression) psiElement, holder);
}
}
示例12: getReferencesByElement
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
if (!Symfony2ProjectComponent.isEnabled(psiElement) || !(psiElement.getContext() instanceof ParameterList)) {
return new PsiReference[0];
}
ParameterList parameterList = (ParameterList) psiElement.getContext();
PsiElement methodReference = parameterList.getContext();
if (!(methodReference instanceof MethodReference)) {
return new PsiReference[0];
}
for(Call call: this.oneOfCall) {
if (PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) methodReference, call.getClassName(), call.getMethodName()) && PsiElementUtils.getParameterIndexValue(psiElement) == call.getIndex()) {
return this.getPsiReferenceBase(psiElement);
}
}
return new PsiReference[0];
}
示例13: getMethodReferenceWithFirstStringParameter
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@Nullable
public static MethodReference getMethodReferenceWithFirstStringParameter(PsiElement psiElement) {
if (!PlatformPatterns.psiElement()
.withParent(StringLiteralExpression.class).inside(ParameterList.class)
.withLanguage(PhpLanguage.INSTANCE).accepts(psiElement)) {
return null;
}
ParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);
if (parameterList == null) {
return null;
}
if (!(parameterList.getContext() instanceof MethodReference)) {
return null;
}
return (MethodReference) parameterList.getContext();
}
示例14: applyFix
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement item = descriptor.getPsiElement();
PsiElement context = item.getContext();
if (context instanceof ArrayCreationExpression) {
ArrayCreationExpression params = (ArrayCreationExpression) item.getParent();
PsiUtil.deleteArrayElement(item);
if (!params.getHashElements().iterator().hasNext()) {
if (params.getPrevSibling() instanceof PsiWhiteSpace) {
params.getPrevSibling().delete();
}
params.getPrevSibling().delete();
params.delete();
}
}
if (context instanceof ParameterList && context.getParent() instanceof FunctionReference) {
FunctionReference functionReference = (FunctionReference) context.getParent();
if (functionReference.getName() != null && functionReference.getName().equals("compact")) {
PsiUtil.deleteFunctionParam(item);
if (functionReference.getParameters().length == 0) {
PsiUtil.deleteFunctionParam(functionReference);
}
}
}
}
示例15: getPostRenameCallback
import com.jetbrains.php.lang.psi.elements.ParameterList; //导入依赖的package包/类
@Nullable
@Override
public Runnable getPostRenameCallback(PsiElement psiElement, String s, RefactoringElementListener refactoringElementListener) {
return () -> {
for (PsiElement render : renders) {
StringLiteralExpression element = (StringLiteralExpression) ((ParameterList) render).getParameters()[0];
final PsiElement parent = element.getParent();
String fileName = element.getContents();
if (Objects.equals(parent.getUserData(WITH_EXT), false)) {
if (Objects.equals(fileName.substring(fileName.lastIndexOf('.')), parent.getUserData(OLD_EXT))) {
fileName = fileName.substring(0, fileName.lastIndexOf('.'));
}
}
parent.putUserData(WITH_EXT, null);
parent.putUserData(OLD_EXT, null);
if (parent.getUserData(RELATIVE_PATH) != null) {
fileName = parent.getUserData(RELATIVE_PATH) + fileName;
parent.putUserData(RELATIVE_PATH, null);
}
fileName = element.isSingleQuote() ? "'" + fileName + "'" : "\"" + fileName + "\"";
PsiElement newValue = PhpPsiElementFactory.createFromText(psiElement.getProject(), StringLiteralExpression.class, fileName);
if (newValue != null) {
element.replace(newValue);
}
}
};
}