本文整理汇总了Java中com.intellij.openapi.vfs.VFileProperty类的典型用法代码示例。如果您正苦于以下问题:Java VFileProperty类的具体用法?Java VFileProperty怎么用?Java VFileProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VFileProperty类属于com.intellij.openapi.vfs包,在下文中一共展示了VFileProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isFileSelectable
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
/**
* Defines whether a file can be chosen.
*/
public boolean isFileSelectable(VirtualFile file) {
if (file == null) return false;
if (file.is(VFileProperty.SYMLINK) && file.getCanonicalPath() == null) {
return false;
}
if (file.isDirectory() && myChooseFolders) {
return true;
}
if (acceptAsJarFile(file)) {
return true;
}
if (acceptAsGeneralFile(file)) {
return true;
}
if (myFileFilter != null && !file.isDirectory() && myFileFilter.value(file)) {
return true;
}
return false;
}
示例2: checkAndScheduleFileTypeChange
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
private boolean checkAndScheduleFileTypeChange(@NotNull VirtualFile parent,
@NotNull VirtualFile child,
@NotNull FileAttributes childAttributes) {
boolean currentIsDirectory = child.isDirectory();
boolean currentIsSymlink = child.is(VFileProperty.SYMLINK);
boolean currentIsSpecial = child.is(VFileProperty.SPECIAL);
boolean upToDateIsDirectory = childAttributes.isDirectory();
boolean upToDateIsSymlink = childAttributes.isSymLink();
boolean upToDateIsSpecial = childAttributes.isSpecial();
if (currentIsDirectory != upToDateIsDirectory || currentIsSymlink != upToDateIsSymlink || currentIsSpecial != upToDateIsSpecial) {
scheduleDeletion(child);
scheduleCreation(parent, child.getName(), upToDateIsDirectory, true);
return true;
}
return false;
}
示例3: createFile
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@Nullable
protected PsiFile createFile(@NotNull Project project, @NotNull VirtualFile file, @NotNull FileType fileType) {
if (fileType.isBinary() || file.is(VFileProperty.SPECIAL)) {
return new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this);
}
if (!isTooLargeForIntelligence(file)) {
final PsiFile psiFile = createFile(getBaseLanguage());
if (psiFile != null) return psiFile;
}
if (isTooLargeForContentLoading(file)) {
return new PsiLargeFileImpl((PsiManagerImpl)getManager(), this);
}
return new PsiPlainTextFileImpl(this);
}
示例4: processFile
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
public boolean processFile(NewVirtualFile file) {
if (file.isDirectory() || file.is(VFileProperty.SPECIAL)) {
return true;
}
try {
DataInputStream stream = FSRecords.readContent(file.getId());
if (stream == null) return true;
byte[] bytes = FileUtil.loadBytes(stream);
totalSize.addAndGet(bytes.length);
count.incrementAndGet();
ProgressManager.getInstance().getProgressIndicator().setText(file.getPresentableUrl());
}
catch (IOException e) {
LOG.error(e);
}
return true;
}
示例5: patchIcon
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
protected Icon patchIcon(Icon original, VirtualFile file) {
Icon icon = original;
final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
if (bookmarkAtFile != null) {
final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
composite.setIcon(icon, 0);
composite.setIcon(bookmarkAtFile.getIcon(), 1);
icon = composite;
}
if (!file.isWritable()) {
icon = LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON);
}
if (file.is(VFileProperty.SYMLINK)) {
icon = LayeredIcon.create(icon, PlatformIcons.SYMLINK_ICON);
}
return icon;
}
示例6: updateImpl
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
PsiFile value = getValue();
data.setPresentableText(value.getName());
data.setIcon(value.getIcon(Iconable.ICON_FLAG_READ_STATUS));
VirtualFile file = getVirtualFile();
if (file != null && file.is(VFileProperty.SYMLINK)) {
String target = file.getCanonicalPath();
if (target == null) {
data.setAttributesKey(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);
data.setTooltip(CommonBundle.message("vfs.broken.link"));
}
else {
data.setTooltip(FileUtil.toSystemDependentName(target));
}
}
}
示例7: checkAndScheduleAttributesChange
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
private boolean checkAndScheduleAttributesChange(@NotNull VirtualFile parent,
@NotNull VirtualFile child,
@NotNull FileAttributes childAttributes) {
boolean currentIsDirectory = child.isDirectory();
boolean currentIsSymlink = child.is(VFileProperty.SYMLINK);
boolean currentIsSpecial = child.is(VFileProperty.SPECIAL);
boolean upToDateIsDirectory = childAttributes.isDirectory();
boolean upToDateIsSymlink = childAttributes.isSymLink();
boolean upToDateIsSpecial = childAttributes.isSpecial();
if (currentIsDirectory != upToDateIsDirectory || currentIsSymlink != upToDateIsSymlink || currentIsSpecial != upToDateIsSpecial) {
scheduleDeletion(child);
scheduleReCreation(parent, child.getName(), upToDateIsDirectory);
return true;
}
return false;
}
示例8: isFileSelectable
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
/**
* Defines whether file can be chosen or not
*/
@RequiredDispatchThread
public boolean isFileSelectable(VirtualFile file) {
if (file == null) return false;
if (file.is(VFileProperty.SYMLINK) && file.getCanonicalPath() == null) {
return false;
}
if (file.isDirectory() && myChooseFolders) {
return true;
}
if (myFileFilter != null && !file.isDirectory()) {
return myFileFilter.value(file);
}
return acceptAsJarFile(file) || acceptAsGeneralFile(file);
}
示例9: findFileByPath
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@Nullable
public static NewVirtualFile findFileByPath(@Nonnull NewVirtualFileSystem vfs, @Nonnull String path) {
Pair<NewVirtualFile, Iterable<String>> data = prepare(vfs, path);
if (data == null) return null;
NewVirtualFile file = data.first;
for (String pathElement : data.second) {
if (pathElement.isEmpty() || ".".equals(pathElement)) continue;
if ("..".equals(pathElement)) {
if (file.is(VFileProperty.SYMLINK)) {
final NewVirtualFile canonicalFile = file.getCanonicalFile();
file = canonicalFile != null ? canonicalFile.getParent() : null;
}
else {
file = file.getParent();
}
}
else {
file = file.findChild(pathElement);
}
if (file == null) return null;
}
return file;
}
示例10: checkAndScheduleFileTypeChange
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
private boolean checkAndScheduleFileTypeChange(@Nonnull VirtualFile parent,
@Nonnull VirtualFile child,
@Nonnull FileAttributes childAttributes) {
boolean currentIsDirectory = child.isDirectory();
boolean currentIsSymlink = child.is(VFileProperty.SYMLINK);
boolean currentIsSpecial = child.is(VFileProperty.SPECIAL);
boolean upToDateIsDirectory = childAttributes.isDirectory();
boolean upToDateIsSymlink = childAttributes.isSymLink();
boolean upToDateIsSpecial = childAttributes.isSpecial();
if (currentIsDirectory != upToDateIsDirectory || currentIsSymlink != upToDateIsSymlink || currentIsSpecial != upToDateIsSpecial) {
scheduleDeletion(child);
scheduleCreation(parent, child.getName(), upToDateIsDirectory, true);
return true;
}
return false;
}
示例11: createFile
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@Nullable
protected PsiFile createFile(@Nonnull Project project, @Nonnull VirtualFile file, @Nonnull FileType fileType) {
if (fileType.isBinary() || file.is(VFileProperty.SPECIAL)) {
return SingleRootFileViewProvider.isTooLargeForContentLoading(file) ?
new PsiLargeBinaryFileImpl((PsiManagerImpl)getManager(), this) :
new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this);
}
if (!SingleRootFileViewProvider.isTooLargeForIntelligence(file)) {
final PsiFile psiFile = createFile(getBaseLanguage());
if (psiFile != null) return psiFile;
}
if (SingleRootFileViewProvider.isTooLargeForContentLoading(file)) {
return new PsiLargeTextFileImpl(this);
}
return new PsiPlainTextFileImpl(this);
}
示例12: updateIcon
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@RequiredReadAction
@Override
public void updateIcon(@Nonnull IconDescriptor iconDescriptor, @Nonnull PsiElement element, int flags) {
if (element instanceof PsiFile) {
if (iconDescriptor.getMainIcon() == null) {
FileType fileType = ((PsiFile)element).getFileType();
iconDescriptor.setMainIcon(fileType.getIcon());
}
VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
if (virtualFile != null && virtualFile.is(VFileProperty.SYMLINK)) {
iconDescriptor.addLayerIcon(AllIcons.Nodes.Symlink);
}
}
else {
Icon languageElementIcon = LanguageElementIcons.INSTANCE.forLanguage(element.getLanguage());
if (languageElementIcon == null) {
return;
}
iconDescriptor.addLayerIcon(languageElementIcon);
}
}
示例13: processFile
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
public boolean processFile(NewVirtualFile file) {
if (file.isDirectory() || file.is(VFileProperty.SPECIAL)) return true;
try {
DataInputStream stream = FSRecords.readContent(file.getId());
if (stream == null) return true;
byte[] bytes = FileUtil.loadBytes(stream);
totalSize.addAndGet(bytes.length);
count.incrementAndGet();
ProgressManager.getInstance().getProgressIndicator().setText(file.getPresentableUrl());
}
catch (IOException e1) {
LOG.error(e1);
}
return true;
}
示例14: patchIcon
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
protected Icon patchIcon(Icon original, VirtualFile file) {
Icon icon = original;
final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
if (bookmarkAtFile != null) {
final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
composite.setIcon(icon, 0);
composite.setIcon(bookmarkAtFile.getIcon(), 1);
icon = composite;
}
if (!file.isWritable()) {
icon = LayeredIcon.create(icon, AllIcons.Nodes.Locked);
}
if (file.is(VFileProperty.SYMLINK)) {
icon = LayeredIcon.create(icon, AllIcons.Nodes.Symlink);
}
return icon;
}
示例15: updateImpl
import com.intellij.openapi.vfs.VFileProperty; //导入依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
PsiFile value = getValue();
data.setPresentableText(value.getName());
data.setIcon(IconDescriptorUpdaters.getIcon(value, Iconable.ICON_FLAG_READ_STATUS));
VirtualFile file = getVirtualFile();
if (file != null && file.is(VFileProperty.SYMLINK)) {
String target = file.getCanonicalPath();
if (target == null) {
data.setAttributesKey(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);
data.setTooltip(CommonBundle.message("vfs.broken.link"));
}
else {
data.setTooltip(FileUtil.toSystemDependentName(target));
}
}
}