本文整理汇总了Java中com.intellij.openapi.util.text.StringUtil.unquoteString方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.unquoteString方法的具体用法?Java StringUtil.unquoteString怎么用?Java StringUtil.unquoteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.text.StringUtil
的用法示例。
在下文中一共展示了StringUtil.unquoteString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (!(element instanceof XmlElement)) {
return PsiReference.EMPTY_ARRAY;
}
List<PsiReference> psiReferences = new ArrayList<>();
String methodName = StringUtil.unquoteString(element.getText());
PhpClass phpClass = DiIndex.getPhpClassOfServiceMethod((XmlElement) element);
if (phpClass != null) {
Collection<Method> methods = phpClass.getMethods();
methods.removeIf(m -> !m.getName().equalsIgnoreCase(methodName));
psiReferences.add(new PolyVariantReferenceBase(element, methods));
}
return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
示例2: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
DiIndex index = DiIndex.getInstance(element.getProject());
Collection<PsiElement> targets = index.getVirtualTypeElements(value, element.getResolveScope());
if (!(targets.size() > 0)) {
return PsiReference.EMPTY_ARRAY;
}
return new PsiReference[] {
new PolyVariantReferenceBase(element, targets)
};
}
示例3: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
Collection<PsiElement> targets = EventIndex.getInstance(element.getProject())
.getEventElements(
value,
GlobalSearchScope.getScopeRestrictedByFileTypes(
GlobalSearchScope.allScope(element.getProject()),
XmlFileType.INSTANCE
)
);
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例4: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String parameterName = StringUtil.unquoteString(element.getText());
if (parameterName.isEmpty() || !(element instanceof XmlElement)) {
return PsiReference.EMPTY_ARRAY;
}
DiIndex diIndex = DiIndex.getInstance(element.getProject());
PhpClass phpClass = diIndex.getPhpClassOfArgument((XmlElement) element);
if (phpClass != null) {
Method constructor = phpClass.getConstructor();
if (constructor != null) {
Collection<Parameter> parameterList = new THashSet<>(Arrays.asList(constructor.getParameters()));
parameterList.removeIf(p -> !p.getName().contains(parameterName));
if (parameterList.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, parameterList)};
}
}
}
return PsiReference.EMPTY_ARRAY;
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:PhpConstructorArgumentReferenceProvider.java
示例5: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
.getContainingFiles(EventNameIndex.KEY, value,
GlobalSearchScope.getScopeRestrictedByFileTypes(
GlobalSearchScope.allScope(element.getProject()),
PhpFileType.INSTANCE
)
);
PsiManager psiManager = PsiManager.getInstance(element.getProject());
for (VirtualFile virtualFile: containingFiles) {
PhpFile phpFile = (PhpFile) psiManager.findFile(virtualFile);
if (phpFile != null) {
List<PsiElement> psiElements = new ArrayList<>();
recursiveFill(psiElements, phpFile, value);
if (psiElements.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, psiElements)};
}
}
}
return PsiReference.EMPTY_ARRAY;
}
示例6: recursiveFill
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private void recursiveFill(List<String> results, PsiElement psiElement) {
if (PhpPatternsHelper.STRING_METHOD_ARGUMENT.accepts(psiElement) && isInContextOfDispatchMethod(psiElement)) {
String eventName= StringUtil.unquoteString(psiElement.getText());
if (eventName.length() > 0) {
results.add(eventName);
}
return;
}
for(PsiElement child: psiElement.getChildren()) {
recursiveFill(results, child);
}
}
示例7: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
List<PsiReference> psiReferences = new ArrayList<>();
final Collection<PhpClassMember> members = new THashSet<>();
String origValue = element.getText();
String value = StringUtil.unquoteString(element.getText());
Matcher matcher = Pattern.compile(PhpRegex.Xml.CLASS_MEMBER_NAME).matcher(value);
if (!matcher.find()) {
return PsiReference.EMPTY_ARRAY;
}
String elementName = matcher.group(1);
String classFQN = value.substring(0, value.lastIndexOf("::"));
PhpIndex phpIndex = PhpIndex.getInstance(element.getProject());
for (final PhpClass phpClass : phpIndex.getAnyByFQN(classFQN)) {
members.addAll(phpClass.getFields());
members.addAll(phpClass.getMethods());
members.removeIf(c -> !c.getName().equals(elementName));
}
if (members.size() > 0) {
TextRange range = new TextRange(
origValue.indexOf(elementName),
origValue.indexOf(elementName) + elementName.length()
);
psiReferences.add(new PolyVariantReferenceBase(element, range, members));
}
return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
示例8: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlTag> targets = LayoutIndex.getContainerDeclarations(value, element.getProject());
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例9: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlFile> targets = LayoutIndex.getLayoutFiles(element.getProject(), value);
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例10: getReferencesByElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlTag> targets = LayoutIndex.getBlockDeclarations(value, element.getProject());
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例11: findTargetFeature
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private static PsiElement findTargetFeature( PsiAnnotation psiAnnotation, ManifoldPsiClass facade )
{
PsiAnnotationMemberValue value = psiAnnotation.findAttributeValue( SourcePosition.FEATURE );
String featureName = StringUtil.unquoteString( value.getText() );
// value = psiAnnotation.findAttributeValue( SourcePosition.TYPE );
// if( value != null )
// {
// String ownersType = StringUtil.unquoteString( value.getText() );
// if( ownersType != null )
// {
// PsiElement target = findIndirectTarget( ownersType, featureName, facade.getRawFile().getProject() );
// if( target != null )
// {
// return target;
// }
// }
// }
int iOffset = Integer.parseInt( psiAnnotation.findAttributeValue( SourcePosition.OFFSET ).getText() );
int iLength = Integer.parseInt( psiAnnotation.findAttributeValue( SourcePosition.LENGTH ).getText() );
List<PsiFile> sourceFiles = facade.getRawFiles();
if( iOffset >= 0 )
{
//PsiElement target = sourceFile.findElementAt( iOffset );
//## todo: handle multiple files
return new FakeTargetElement( sourceFiles.get( 0 ), iOffset, iLength >= 0 ? iLength : 1, featureName );
}
return facade;
}
示例12: getIndexer
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
return inputData -> {
Map<String, String> map = new HashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (!Settings.isEnabled(psiFile.getProject())) {
return map;
}
if (psiFile instanceof PhpFile) {
MethodReference method = PsiTreeUtil.findChildOfAnyType(psiFile, MethodReference.class);
if (method != null) {
ParameterList parameterList = method.getParameterList();
if (parameterList != null) {
PsiElement firstParameter = parameterList.getFirstPsiChild();
if (firstParameter != null && firstParameter instanceof ClassConstantReference) {
String constantName = ((ClassConstantReference) firstParameter).getName();
if (constantName != null) {
PsiElement moduleNameEl = ((ClassConstantReference) firstParameter).getNextPsiSibling();
if (moduleNameEl != null && moduleNameEl instanceof StringLiteralExpression) {
String moduleName = StringUtil.unquoteString(moduleNameEl.getText());
PsiElement modulePathEl =
((StringLiteralExpression) moduleNameEl).getNextPsiSibling();
if (modulePathEl != null) {
Pattern pattern = Pattern.compile(
"__DIR__(\\s*[.,]\\s*[\\'\\\"]((/[\\w-]+)+)/?[\\'\\\"])?"
);
Matcher matcher = pattern.matcher(modulePathEl.getText());
if (matcher.find()) {
String modulePath = matcher.group(2);
map.put(
moduleName,
modulePath == null ? "" : modulePath
);
}
}
}
}
}
}
}
}
return map;
};
}