当前位置: 首页>>代码示例>>Java>>正文


Java ClassUtil.getJVMClassName方法代码示例

本文整理汇总了Java中com.intellij.psi.util.ClassUtil.getJVMClassName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassUtil.getJVMClassName方法的具体用法?Java ClassUtil.getJVMClassName怎么用?Java ClassUtil.getJVMClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.ClassUtil的用法示例。


在下文中一共展示了ClassUtil.getJVMClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ChangeFormComponentTypeFix

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
public ChangeFormComponentTypeFix(PsiPlainTextFile formFile, String fieldName, PsiType componentTypeToSet) {
  myFormFile = formFile;
  myFieldName = fieldName;
  if (componentTypeToSet instanceof PsiClassType) {
    PsiClass psiClass = ((PsiClassType)componentTypeToSet).resolve();
    if (psiClass != null) {
      myComponentTypeToSet = ClassUtil.getJVMClassName(psiClass);
    }
    else {
      myComponentTypeToSet = ((PsiClassType) componentTypeToSet).rawType().getCanonicalText();
    }
  }
  else {
    myComponentTypeToSet = componentTypeToSet.getCanonicalText();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChangeFormComponentTypeFix.java

示例2: actionPerformed

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PsiClass psiClass = getPsiClass(e);
  if (psiClass == null) return;

  final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
  final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
  if (module == null || virtualFile == null) return;

  final String className = ClassUtil.getJVMClassName(psiClass);

  final Project project = getEventProject(e);
  CompilerManager.getInstance(project).make(new FileSetCompileScope(Collections.singletonList(virtualFile), new Module[]{module}), new CompileStatusNotification() {
    @Override
    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
      if (aborted || errors > 0) return;
      generateAndShowXml(module, className);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ShowSerializedXmlAction.java

示例3: actionPerformed

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PsiClass psiClass = getPsiClass(e);
  if (psiClass == null) return;

  final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
  final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
  if (module == null || virtualFile == null) return;

  final String className = ClassUtil.getJVMClassName(psiClass);

  final Project project = getEventProject(e);
  CompilerManager.getInstance(project).make(new FileSetCompileScope(Arrays.asList(virtualFile), new Module[]{module}), new CompileStatusNotification() {
    @Override
    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
      if (aborted || errors > 0) return;
      generateAndShowXml(module, className);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ShowSerializedXmlAction.java

示例4: getClassVMName

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Nullable
public static String getClassVMName(@Nullable PsiClass containingClass)
{
	// no support for local classes for now
	if(containingClass == null || PsiUtil.isLocalClass(containingClass))
	{
		return null;
	}
	if(containingClass instanceof PsiAnonymousClass)
	{
		String parentName = getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class));
		if(parentName == null)
		{
			return null;
		}
		else
		{
			return parentName + JavaAnonymousClassesHelper.getName((PsiAnonymousClass) containingClass);
		}
	}
	return ClassUtil.getJVMClassName(containingClass);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:JVMNameUtil.java

示例5: getClassVMName

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Nullable
public static String getClassVMName(@Nullable PsiClass containingClass) {
  // no support for local classes for now
  if (containingClass == null || PsiUtil.isLocalClass(containingClass)) return null;
  if (containingClass instanceof PsiAnonymousClass) {
    String parentName = getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class));
    if (parentName == null) {
      return null;
    }
    else {
      return parentName + JavaAnonymousClassesHelper.getName((PsiAnonymousClass)containingClass);
    }
  }
  return ClassUtil.getJVMClassName(containingClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JVMNameUtil.java

示例6: handleElementRename

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Override
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
  if (myClass != null) {
    final String className = ClassUtil.getJVMClassName(myClass);
    if (className != null) {
      final String newFileName = className.substring(0, className.lastIndexOf(myClass.getName())) + newElementName;
      return getElement().setName(newFileName);
    }
  }
  return getElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SPIFile.java

示例7: bindToElement

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  if (element instanceof PsiClass) {
    final String className = ClassUtil.getJVMClassName((PsiClass)element);
    if (className != null) {
      return getElement().setName(className);
    }
  }
  return getElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SPIFile.java

示例8: bindToElement

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  if (element instanceof PsiPackage) {
    return handleElementRename(((PsiPackage)element).getQualifiedName());
  } else if (element instanceof PsiClass) {
    final String className = ClassUtil.getJVMClassName((PsiClass)element);
    return className != null ? handleElementRename(className) : null;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SPIPackageOrClassReferenceElement.java

示例9: getTextOccurrenceSearchStrings

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Nullable
public Pair<String, String> getTextOccurrenceSearchStrings(@NotNull final PsiElement element, @NotNull final String newName) {
  if (element instanceof PsiClass) {
    final PsiClass aClass = (PsiClass)element;
    if (aClass.getParent() instanceof PsiClass) {
      final String dollaredStringToSearch = ClassUtil.getJVMClassName(aClass);
      final String dollaredStringToReplace = dollaredStringToSearch == null ? null : RefactoringUtil.getNewInnerClassName(aClass, dollaredStringToSearch, newName);
      if (dollaredStringToReplace != null) {
        return Pair.create(dollaredStringToSearch, dollaredStringToReplace);
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RenameJavaClassProcessor.java

示例10: getInternalName

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
/**
 * Computes the internal class name of the given class.
 * For example, for PsiClass foo.bar.Foo.Bar it returns foo/bar/Foo$Bar.
 *
 * @param psiClass the class to look up the internal name for
 * @return the internal class name
 * @see ClassContext#getInternalName(String)
 */
@Nullable
public static String getInternalName(@NonNull PsiClass psiClass) {
  if (psiClass instanceof PsiAnonymousClass) {
    PsiClass parent = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class);
    if (parent != null) {
      String internalName = getInternalName(parent);
      if (internalName == null) {
        return null;
      }
      return internalName + JavaAnonymousClassesHelper.getName((PsiAnonymousClass)psiClass);
    }
  }
  String sig = ClassUtil.getJVMClassName(psiClass);
  if (sig == null) {
    String qualifiedName = psiClass.getQualifiedName();
    if (qualifiedName != null) {
      return ClassContext.getInternalName(qualifiedName);
    }
    return null;
  } else if (sig.indexOf('.') != -1) {
    // Workaround -- ClassUtil doesn't treat this correctly!
    // .replace('.', '/');
    sig = ClassContext.getInternalName(sig);
  }
  return sig;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:IntellijLintUtils.java

示例11: getListener

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
public RefactoringElementListener getListener(PsiElement element) {
  if (element instanceof PsiClass) {
    PsiClass psiClass = (PsiClass) element;
    final String oldName = ClassUtil.getJVMClassName(psiClass);
    if (oldName != null) {
      final ComponentItem item = myPalette.getItem(oldName);
      if (item != null) {
        return new MyRefactoringElementListener(item);
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PaletteRefactoringListenerProvider.java

示例12: elementRenamedOrMoved

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
public void elementRenamedOrMoved(@NotNull PsiElement newElement) {
  PsiClass psiClass = (PsiClass) newElement;
  final String qName = ClassUtil.getJVMClassName(psiClass);
  if (qName != null) {
    myItem.setClassName(qName);
    myUiDesignerPaletteProvider.fireGroupsChanged();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PaletteRefactoringListenerProvider.java

示例13: getClassToBindName

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
public String getClassToBindName(LwRootContainer container) {
  PsiClass psiClass =
    JavaPsiFacade.getInstance(myModule.getProject()).findClass(container.getClassToBind(), myModule.getModuleWithDependenciesScope());
  if (psiClass != null) {
    return ClassUtil.getJVMClassName(psiClass);
  }

  return container.getClassToBind();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiNestedFormLoader.java

示例14: getClassVMName

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@Nullable
private static String getClassVMName(PsiClass containingClass) {
  if (containingClass instanceof PsiAnonymousClass) {
    return getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class)) +
           JavaAnonymousClassesHelper.getName((PsiAnonymousClass)containingClass);
  }
  return ClassUtil.getJVMClassName(containingClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ByteCodeViewerManager.java

示例15: getReferences

import com.intellij.psi.util.ClassUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferences() {
  final List<PsiReference> refs = new ArrayList<PsiReference>();
  int idx = 0;
  int d;
  final String fileName = getName();
  while ((d = fileName.indexOf(".", idx)) > -1) {
    final PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(fileName.substring(0, d));
    if (aPackage != null) {
      refs.add(new SPIFileName2PackageReference(this, aPackage));
    }
    idx = d + 1;
  }
  final PsiReference reference = getReference();
  PsiElement resolve = reference.resolve();
  while (resolve instanceof PsiClass) {
    resolve = ((PsiClass)resolve).getContainingClass();
    if (resolve != null) {
      final String jvmClassName = ClassUtil.getJVMClassName((PsiClass)resolve);
      if (jvmClassName != null) {
        refs.add(new SPIFileName2PackageReference(this, resolve));
      }
    }
  }
  refs.add(reference);
  return refs.toArray(new PsiReference[refs.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:SPIFile.java


注:本文中的com.intellij.psi.util.ClassUtil.getJVMClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。