本文整理了Java中org.eclipse.jdt.core.Signature.getQualifier()
方法的一些代码示例,展示了Signature.getQualifier()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getQualifier()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Signature
类名称:Signature
方法名:getQualifier
[英]Returns a string containing all but the last segment of the given dot-separated qualified name. Returns the empty string if it is not qualified.
For example:
getQualifier("java.lang.Object") -> "java.lang"
getQualifier("Outer.Inner") -> "Outer"
getQualifier("java.util.List<java.lang.String>") -> "java.util"
[中]返回一个字符串,该字符串包含给定的以点分隔的限定名称的最后一段以外的所有部分。如果不合格,则返回空字符串。
例如:
getQualifier("java.lang.Object") -> "java.lang"
getQualifier("Outer.Inner") -> "Outer"
getQualifier("java.util.List<java.lang.String>") -> "java.util"
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public String getEnclosingName() {
return Signature.getQualifier(fMatch.getTypeQualifiedName());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
public String getEnclosingName() {
return Signature.getQualifier(fMatch.getTypeQualifiedName());
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public String getEnclosingName() {
return Signature.getQualifier(fMatch.getTypeQualifiedName());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
public static ImportName createFor(boolean isStatic, String qualifiedName) {
String containerName = Signature.getQualifier(qualifiedName);
String simpleName = Signature.getSimpleName(qualifiedName);
return new ImportName(isStatic, containerName, simpleName);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
public static ImportName createFor(boolean isStatic, String qualifiedName) {
String containerName = Signature.getQualifier(qualifiedName);
String simpleName = Signature.getSimpleName(qualifiedName);
return new ImportName(isStatic, containerName, simpleName);
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
public static ImportName createFor(boolean isStatic, String qualifiedName) {
String containerName = Signature.getQualifier(qualifiedName);
String simpleName = Signature.getSimpleName(qualifiedName);
return new ImportName(isStatic, containerName, simpleName);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException {
IJavaProject project= compilationUnit.getJavaProject();
if (project == null)
return null;
String name= getResourceBundleName(compilationUnit);
if (name == null)
return null;
String packName= Signature.getQualifier(name);
String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT;
return getResourceBundle(project, packName, resourceName);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException {
IJavaProject project= compilationUnit.getJavaProject();
if (project == null)
return null;
String name= getResourceBundleName(compilationUnit);
if (name == null)
return null;
String packName= Signature.getQualifier(name);
String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT;
return getResourceBundle(project, packName, resourceName);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException {
IJavaProject project= compilationUnit.getJavaProject();
if (project == null)
return null;
String name= getResourceBundleName(compilationUnit);
if (name == null)
return null;
String packName= Signature.getQualifier(name);
String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT;
return getResourceBundle(project, packName, resourceName);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private void addImports(ICompilationUnit unit, ClipboardData data) throws CoreException {
ImportRewrite rewrite= StubUtility.createImportRewrite(unit, true);
String[] imports= data.getTypeImports();
for (int i= 0; i < imports.length; i++) {
rewrite.addImport(imports[i]);
}
String[] staticImports= data.getStaticImports();
for (int i= 0; i < staticImports.length; i++) {
String name= Signature.getSimpleName(staticImports[i]);
boolean isField= !name.endsWith("()"); //$NON-NLS-1$
if (!isField) {
name= name.substring(0, name.length() - 2);
}
String qualifier= Signature.getQualifier(staticImports[i]);
rewrite.addStaticImport(qualifier, name, isField);
}
JavaModelUtil.applyEdit(unit, rewrite.rewriteImports(null), false, null);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException {
String resourceBundle= accessorClassReference.getResourceBundleName();
if (resourceBundle == null)
return null;
String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT;
String packName= Signature.getQualifier(resourceBundle);
ITypeBinding accessorClass= accessorClassReference.getBinding();
if (accessorClass.isFromSource())
return getResourceBundle(javaProject, packName, resourceName);
else if (accessorClass.getJavaElement() != null)
return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName);
return null;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException {
String resourceBundle= accessorClassReference.getResourceBundleName();
if (resourceBundle == null)
return null;
String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT;
String packName= Signature.getQualifier(resourceBundle);
ITypeBinding accessorClass= accessorClassReference.getBinding();
if (accessorClass.isFromSource())
return getResourceBundle(javaProject, packName, resourceName);
else if (accessorClass.getJavaElement() != null)
return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName);
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private void updateImport(ICompilationUnit cu, IImportDeclaration importDeclaration, String updatedImport) throws JavaModelException {
ImportChange importChange= fImportsManager.getImportChange(cu);
if (Flags.isStatic(importDeclaration.getFlags())) {
importChange.removeStaticImport(importDeclaration.getElementName());
importChange.addStaticImport(Signature.getQualifier(updatedImport), Signature.getSimpleName(updatedImport));
} else {
importChange.removeImport(importDeclaration.getElementName());
importChange.addImport(updatedImport);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException {
String resourceBundle= accessorClassReference.getResourceBundleName();
if (resourceBundle == null)
return null;
String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT;
String packName= Signature.getQualifier(resourceBundle);
ITypeBinding accessorClass= accessorClassReference.getBinding();
if (accessorClass.isFromSource())
return getResourceBundle(javaProject, packName, resourceName);
else if (accessorClass.getJavaElement() != null)
return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName);
return null;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
private void updateImport(ICompilationUnit cu, IImportDeclaration importDeclaration, String updatedImport) throws JavaModelException {
ImportChange importChange= fImportsManager.getImportChange(cu);
if (Flags.isStatic(importDeclaration.getFlags())) {
importChange.removeStaticImport(importDeclaration.getElementName());
importChange.addStaticImport(Signature.getQualifier(updatedImport), Signature.getSimpleName(updatedImport));
} else {
importChange.removeImport(importDeclaration.getElementName());
importChange.addImport(updatedImport);
}
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
static CompilationUnitChange createAddImportChange(ICompilationUnit cu, Name name, String fullyQualifiedName) throws CoreException {
String[] args= { BasicElementLabels.getJavaElementName(Signature.getSimpleName(fullyQualifiedName)),
BasicElementLabels.getJavaElementName(Signature.getQualifier(fullyQualifiedName)) };
String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_importtype_description, args);
CompilationUnitChange cuChange= new CompilationUnitChange(label, cu);
ImportRewrite importRewrite = CodeStyleConfiguration.createImportRewrite((CompilationUnit) name.getRoot(), true);
importRewrite.addImport(fullyQualifiedName);
cuChange.setEdit(importRewrite.rewriteImports(null));
return cuChange;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private void updateImport(ICompilationUnit cu, IImportDeclaration importDeclaration, String updatedImport) throws JavaModelException {
ImportChange importChange= fImportsManager.getImportChange(cu);
if (Flags.isStatic(importDeclaration.getFlags())) {
importChange.removeStaticImport(importDeclaration.getElementName());
importChange.addStaticImport(Signature.getQualifier(updatedImport), Signature.getSimpleName(updatedImport));
} else {
importChange.removeImport(importDeclaration.getElementName());
importChange.addImport(updatedImport);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private void updateImport(ICompilationUnit cu, IImportDeclaration importDeclaration, String updatedImport) throws JavaModelException {
ImportChange importChange= fImportsManager.getImportChange(cu);
if (Flags.isStatic(importDeclaration.getFlags())) {
importChange.removeStaticImport(importDeclaration.getElementName());
importChange.addStaticImport(Signature.getQualifier(updatedImport), Signature.getSimpleName(updatedImport));
} else {
importChange.removeImport(importDeclaration.getElementName());
importChange.addImport(updatedImport);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
static CompilationUnitChange createAddImportChange(ICompilationUnit cu, Name name, String fullyQualifiedName) throws CoreException {
String[] args= { BasicElementLabels.getJavaElementName(Signature.getSimpleName(fullyQualifiedName)),
BasicElementLabels.getJavaElementName(Signature.getQualifier(fullyQualifiedName)) };
String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_importtype_description, args);
CompilationUnitChange cuChange= new CompilationUnitChange(label, cu);
ImportRewrite importRewrite= StubUtility.createImportRewrite((CompilationUnit) name.getRoot(), true);
importRewrite.addImport(fullyQualifiedName);
cuChange.setEdit(importRewrite.rewriteImports(null));
return cuChange;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
static CompilationUnitChange createAddImportChange(ICompilationUnit cu, Name name, String fullyQualifiedName) throws CoreException {
String[] args= { BasicElementLabels.getJavaElementName(Signature.getSimpleName(fullyQualifiedName)),
BasicElementLabels.getJavaElementName(Signature.getQualifier(fullyQualifiedName)) };
String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_importtype_description, args);
CompilationUnitChange cuChange= new CompilationUnitChange(label, cu);
ImportRewrite importRewrite= StubUtility.createImportRewrite((CompilationUnit) name.getRoot(), true);
importRewrite.addImport(fullyQualifiedName);
cuChange.setEdit(importRewrite.rewriteImports(null));
return cuChange;
}
内容来源于网络,如有侵权,请联系作者删除!