Java Code Examples for com.intellij.openapi.util.text.StringUtil#getPackageName()
The following examples show how to use
com.intellij.openapi.util.text.StringUtil#getPackageName() .
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: BasePathMacroManager.java From consulo with Apache License 2.0 | 6 votes |
protected static void addFileHierarchyReplacements(ReplacePathToMacroMap result, String macroName, @javax.annotation.Nullable String path, @Nullable String stopAt) { if (path == null) return; String macro = "$" + macroName + "$"; path = StringUtil.trimEnd(FileUtil.toSystemIndependentName(path), "/"); boolean overwrite = true; while (StringUtil.isNotEmpty(path) && path.contains("/")) { result.addReplacement(path, macro, overwrite); if (path.equals(stopAt)) { break; } macro += "/.."; overwrite = false; path = StringUtil.getPackageName(path, '/'); } }
Example 2
Source File: CSharpLightNamespaceDeclarationBuilder.java From consulo-csharp with Apache License 2.0 | 5 votes |
@RequiredReadAction @Nullable @Override public String getPresentableParentQName() { return StringUtil.getPackageName(myQualifiedName); }
Example 3
Source File: CSharpNamespaceDeclarationImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@RequiredReadAction @Nullable @Override public String getPresentableParentQName() { String fullQName = buildQualifiedName(); if(fullQName == null) { return null; } return StringUtil.getPackageName(fullQName); }
Example 4
Source File: TempDirTestFixtureImpl.java From consulo with Apache License 2.0 | 5 votes |
public File createTempFile(String fileName) throws IOException { String prefix = StringUtil.getPackageName(fileName); if (prefix.length() < 3) { prefix += "___"; } String suffix = "." + StringUtil.getShortName(fileName); return FileUtil.createTempFile(new File(getTempDirPath()), prefix, suffix, true); }
Example 5
Source File: UnusedUsingVisitor.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Override @RequiredReadAction public void visitLinqExpression(CSharpLinqExpressionImpl expression) { super.visitLinqExpression(expression); String packageOfEnumerable = StringUtil.getPackageName(DotNetTypes2.System.Linq.Enumerable); String className = StringUtil.getShortName(DotNetTypes2.System.Linq.Enumerable); for(Map.Entry<CSharpUsingListChild, Boolean> entry : myUsingContext.entrySet()) { if(entry.getValue()) { continue; } CSharpUsingListChild key = entry.getKey(); if(key instanceof CSharpUsingTypeStatement) { if(DotNetTypeRefUtil.isVmQNameEqual(((CSharpUsingTypeStatement) key).getTypeRef(), expression, DotNetTypes2.System.Linq.Enumerable)) { myUsingContext.put(key, Boolean.TRUE); break; } } else if(key instanceof CSharpUsingNamespaceStatement) { String referenceText = ((CSharpUsingNamespaceStatement) key).getReferenceText(); // our namespace, try find class if(packageOfEnumerable.equals(referenceText)) { DotNetNamespaceAsElement namespaceAsElement = ((CSharpUsingNamespaceStatement) key).resolve(); if(namespaceAsElement != null && namespaceAsElement.findChildren(className, expression.getResolveScope(), DotNetNamespaceAsElement.ChildrenFilter.ONLY_ELEMENTS).size() > 0) { myUsingContext.put(key, Boolean.TRUE); break; } } } } }
Example 6
Source File: BaseUnusedUsingVisitor.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Override @RequiredReadAction public void visitLinqExpression(CSharpLinqExpressionImpl expression) { super.visitLinqExpression(expression); String packageOfEnumerable = StringUtil.getPackageName(DotNetTypes2.System.Linq.Enumerable); String className = StringUtil.getShortName(DotNetTypes2.System.Linq.Enumerable); Collection<? extends CSharpUsingListChild> statements = getStatements(); for(CSharpUsingListChild key : statements) { if(isProcessed(key)) { continue; } if(key instanceof CSharpUsingTypeStatement) { if(DotNetTypeRefUtil.isVmQNameEqual(((CSharpUsingTypeStatement) key).getTypeRef(), expression, DotNetTypes2.System.Linq.Enumerable)) { putElement(key, expression); break; } } else if(key instanceof CSharpUsingNamespaceStatement) { String referenceText = ((CSharpUsingNamespaceStatement) key).getReferenceText(); // our namespace, try find class if(packageOfEnumerable.equals(referenceText)) { DotNetNamespaceAsElement namespaceAsElement = ((CSharpUsingNamespaceStatement) key).resolve(); if(namespaceAsElement != null && namespaceAsElement.findChildren(className, expression.getResolveScope(), DotNetNamespaceAsElement.ChildrenFilter.ONLY_ELEMENTS).size() > 0) { putElement(key, expression); break; } } } } }
Example 7
Source File: GotoFileItemProvider.java From consulo with Apache License 2.0 | 4 votes |
@Nullable private String getParentPath(@Nonnull PsiFileSystemItem item) { String fullName = myModel.getFullName(item); return fullName == null ? null : StringUtil.getPackageName(FileUtilRt.toSystemIndependentName(fullName), '/') + '/'; }