Java Code Examples for com.intellij.openapi.util.text.StringUtil#strip()
The following examples show how to use
com.intellij.openapi.util.text.StringUtil#strip() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PantsCompletionTestBase.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
protected void doTestVariantsInner(String fileName) throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject(fileName); final Scanner in = new Scanner(virtualFile.getInputStream()); final CompletionType type = CompletionType.valueOf(in.next()); final int count = in.nextInt(); final CheckType checkType = CheckType.valueOf(in.next()); final List<String> variants = new ArrayList<>(); while (in.hasNext()) { final String variant = StringUtil.strip(in.next(), CharFilter.NOT_WHITESPACE_FILTER); if (variant.length() > 0) { variants.add(variant); } } myFixture.complete(type, count); checkCompletion(checkType, variants); }
Example 2
Source File: QualifiedNamespaceKindProcessor.java From consulo-csharp with Apache License 2.0 | 6 votes |
@RequiredReadAction private void processDefaultCompletion(@Nonnull Processor<ResolveResult> processor, PsiElement element, PsiElement qualifier) { DotNetNamespaceAsElement namespace; String qualifiedText = ""; if(qualifier != null) { qualifiedText = StringUtil.strip(qualifier.getText(), CSharpReferenceExpression.DEFAULT_REF_FILTER); } namespace = DotNetPsiSearcher.getInstance(element.getProject()).findNamespace(qualifiedText, element.getResolveScope()); if(namespace == null) { return; } processNamespaceChildren(processor, element, namespace); }
Example 3
Source File: CSharpUsingNamespaceStatementImpl.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Nullable @RequiredReadAction private DotNetNamespaceAsElement resolveInner() { String referenceText = getReferenceText(); if(referenceText == null) { return null; } final String qName = StringUtil.strip(referenceText, CSharpReferenceExpression.DEFAULT_REF_FILTER); PsiElement parent = getParent(); DotNetPsiSearcher psiSearcher = DotNetPsiSearcher.getInstance(getProject()); if(parent instanceof CSharpNamespaceDeclaration) { String newNamespaceName = ((CSharpNamespaceDeclaration) parent).getPresentableQName() + "." + qName; DotNetNamespaceAsElement namespace = psiSearcher.findNamespace(newNamespaceName, getResolveScope()); if(namespace != null) { return namespace; } } return psiSearcher.findNamespace(qName, getResolveScope()); }
Example 4
Source File: HaxeCompletionTestBase.java From intellij-haxe with Apache License 2.0 | 6 votes |
protected void doTestVariantsInner(String fileName) throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject(fileName); final Scanner in = new Scanner(virtualFile.getInputStream()); final CompletionType type = CompletionType.valueOf(in.next()); final int count = in.nextInt(); final CheckType checkType = CheckType.valueOf(in.next()); final List<String> variants = new ArrayList<String>(); while (in.hasNext()) { final String variant = StringUtil.strip(in.next(), CharFilter.WHITESPACE_FILTER); if (variant.length() > 0) { variants.add(variant); } } myFixture.complete(type, count); checkCompletion(checkType, variants); }
Example 5
Source File: ThriftCompletionTestBase.java From intellij-thrift with Apache License 2.0 | 6 votes |
protected void doTestVariantsInner(String fileName) throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject(fileName); final Scanner in = new Scanner(virtualFile.getInputStream()); final CompletionType type = CompletionType.valueOf(in.next()); final int count = in.nextInt(); final CheckType checkType = CheckType.valueOf(in.next()); final List<String> variants = new ArrayList<String>(); while (in.hasNext()) { final String variant = StringUtil.strip(in.next(), CharFilter.NOT_WHITESPACE_FILTER); if (variant.length() > 0) { variants.add(variant); } } myFixture.complete(type, count); checkCompletion(checkType, variants); }
Example 6
Source File: CSharpUsingNamespaceStatementImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@RequiredReadAction @Override @Nullable public String getReferenceText() { CSharpWithStringValueStub<CSharpUsingNamespaceStatement> stub = getGreenStub(); if(stub != null) { return stub.getReferenceText(); } DotNetReferenceExpression namespaceReference = getNamespaceReference(); return namespaceReference == null ? null : StringUtil.strip(namespaceReference.getText(), CharFilter.NOT_WHITESPACE_FILTER); }
Example 7
Source File: CSharpNamespaceDeclarationImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nullable @RequiredReadAction public String getReferenceText() { CSharpNamespaceDeclStub stub = getGreenStub(); if(stub != null) { return stub.getReferenceTextRef(); } CSharpReferenceExpression childByClass = findChildByClass(CSharpReferenceExpression.class); return childByClass != null ? StringUtil.strip(childByClass.getText(), CSharpReferenceExpression.DEFAULT_REF_FILTER) : null; }
Example 8
Source File: QualifiedNamespaceKindProcessor.java From consulo-csharp with Apache License 2.0 | 4 votes |
@RequiredReadAction @Override public void process(@Nonnull CSharpResolveOptions options, @Nonnull DotNetGenericExtractor defaultExtractor, @Nullable PsiElement forceQualifierElement, @Nonnull final Processor<ResolveResult> processor) { PsiElement element = options.getElement(); String qName = StringUtil.strip(element.getText(), CSharpReferenceExpression.DEFAULT_REF_FILTER); DotNetNamespaceAsElement namespace = null; PsiElement qualifier = options.getQualifier(); PsiElement parent = element.getParent(); if(!options.isCompletion()) { if(parent instanceof CSharpUsingNamespaceStatement) { DotNetNamespaceAsElement namespaceAsElement = ((CSharpUsingNamespaceStatement) parent).resolve(); if(namespaceAsElement != null) { processor.process(new CSharpResolveResult(namespaceAsElement)); } } else { namespace = DotNetPsiSearcher.getInstance(element.getProject()).findNamespace(qName, element.getResolveScope()); if(namespace != null) { processor.process(new CSharpResolveResult(namespace)); } } } else { processDefaultCompletion(processor, element, qualifier); if(parent instanceof CSharpUsingNamespaceStatement) { PsiElement parentOfStatement = parent.getParent(); if(parentOfStatement instanceof CSharpNamespaceDeclaration) { DotNetReferenceExpression namespaceReference = ((CSharpNamespaceDeclaration) parentOfStatement).getNamespaceReference(); if(namespaceReference != null) { PsiElement resolvedElement = namespaceReference.resolve(); if(resolvedElement instanceof DotNetNamespaceAsElement) { processNamespaceChildren(processor, element, (DotNetNamespaceAsElement) resolvedElement); } } } } } }
Example 9
Source File: GuiUtils.java From consulo with Apache License 2.0 | 4 votes |
public static String getTextWithoutMnemonicEscaping(String text) { return StringUtil.strip(text, NOT_MNEMONIC_CHAR_FILTER); }