本文整理汇总了Java中com.intellij.openapi.fileTypes.StdFileTypes.CLASS属性的典型用法代码示例。如果您正苦于以下问题:Java StdFileTypes.CLASS属性的具体用法?Java StdFileTypes.CLASS怎么用?Java StdFileTypes.CLASS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.fileTypes.StdFileTypes
的用法示例。
在下文中一共展示了StdFileTypes.CLASS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCreateFile
@Override
public void checkCreateFile(@NotNull final String name) throws IncorrectOperationException {
final FileType type = FileTypeManager.getInstance().getFileTypeByFileName(name);
if (type == StdFileTypes.CLASS) {
throw new IncorrectOperationException("Cannot create class-file");
}
super.checkCreateFile(name);
}
示例2: accept
@Override
public boolean accept(VirtualFile file) {
if (file instanceof VirtualFileWindow) return false;
if (myAddedClasses.contains(file) || myTreeAccessAllowed) return false;
FileType fileType = file.getFileType();
return (fileType == StdFileTypes.JAVA || fileType == StdFileTypes.CLASS) && !file.getName().equals("package-info.java");
}
示例3: visitFile
@Override
public boolean visitFile(@NotNull VirtualFile file) {
if (file.isDirectory()) {
System.out.println(file.getPath());
}
else if (file.getFileType() == StdFileTypes.CLASS && !file.getName().contains("$")) {
PsiFile clsFile = getPsiManager().findFile(file);
assertNotNull(file.getPath(), clsFile);
PsiElement mirror = ((ClsFileImpl)clsFile).getMirror();
String decompiled = mirror.getText();
assertTrue(file.getPath(), decompiled.contains(file.getNameWithoutExtension()));
// check that no mapped line number is on an empty line
String prefix = "// ";
for (String s : decompiled.split("\n")) {
int pos = s.indexOf(prefix);
if (pos == 0 && prefix.length() < s.length() && Character.isDigit(s.charAt(prefix.length()))) {
fail("Incorrect line mapping in file " + file.getPath() + " line: " + s);
}
}
}
else if (ArchiveFileType.INSTANCE.equals(file.getFileType())) {
VirtualFile jarFile = StandardFileSystems.getJarRootForLocalFile(file);
if (jarFile != null) {
VfsUtilCore.visitChildrenRecursively(jarFile, new MyFileVisitor());
}
}
return true;
}
示例4: getPlace
@Nullable
private static PlaceInDocument getPlace(AnActionEvent event) {
final Project project = event.getData(CommonDataKeys.PROJECT);
if(project == null) {
return null;
}
PsiElement method = null;
Document document = null;
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(event.getPlace()) ||
ActionPlaces.STRUCTURE_VIEW_POPUP.equals(event.getPlace()) ||
ActionPlaces.FAVORITES_VIEW_POPUP.equals(event.getPlace()) ||
ActionPlaces.NAVIGATION_BAR_POPUP.equals(event.getPlace())) {
final PsiElement psiElement = event.getData(CommonDataKeys.PSI_ELEMENT);
if(psiElement instanceof PsiMethod) {
final PsiFile containingFile = psiElement.getContainingFile();
if (containingFile != null) {
method = psiElement;
document = PsiDocumentManager.getInstance(project).getDocument(containingFile);
}
}
}
else {
Editor editor = event.getData(CommonDataKeys.EDITOR);
if(editor == null) {
editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
}
if (editor != null) {
document = editor.getDocument();
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
if (file != null) {
final VirtualFile virtualFile = file.getVirtualFile();
FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
if (StdFileTypes.JAVA == fileType || StdFileTypes.CLASS == fileType) {
method = findMethod(project, editor);
}
}
}
}
return method != null ? new PlaceInDocument(document, method.getTextOffset()) : null;
}
示例5: isEditable
private static boolean isEditable(VirtualFile file, final boolean checkboxState) {
FileType type = file.getFileType();
if (!checkboxState && type == StdFileTypes.JAVA) return false;
return type != StdFileTypes.CLASS;
}