protected void scrollToSource(final Component tree) { DataContext dataContext=DataManager.getInstance().getDataContext(tree); getReady(dataContext).doWhenDone(new Runnable() { @Override public void run() { DataContext context = DataManager.getInstance().getDataContext(tree); final VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(context); if (vFile != null) { // Attempt to navigate to the virtual file with unknown file type will show a modal dialog // asking to register some file type for this file. This behaviour is undesirable when autoscrolling. if (vFile.getFileType() == FileTypes.UNKNOWN || vFile.getFileType() instanceof INativeFileType) return; //IDEA-84881 Don't autoscroll to very large files if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return; } Navigatable[] navigatables = CommonDataKeys.NAVIGATABLE_ARRAY.getData(context); if (navigatables != null) { if (navigatables.length > 1) { return; } for (Navigatable navigatable : navigatables) { // we are not going to open modal dialog during autoscrolling if (!navigatable.canNavigateToSource()) return; } } OpenSourceUtil.navigate(false, true, navigatables); } }); }
@Override public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (element instanceof PsiFile && element.getTextLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) { holder.createWarningAnnotation(element, "File size exceeds configured limit (" + PersistentFSConstants.getMaxIntellisenseFileSize() + "). " + "Code insight features are not available.").setFileLevelAnnotation(true); } }
@Nullable private FileEditor createTempFileEditor(@NotNull VirtualFile file) { if (file.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return null; FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance(); final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file); return providers.length == 0 ? null : providers[0].createEditor(myProject, file); }
protected void scrollToSource(final Component tree) { DataContext dataContext=DataManager.getInstance().getDataContext(tree); getReady(dataContext).doWhenDone(new Runnable() { @Override public void run() { DataContext context = DataManager.getInstance().getDataContext(tree); final VirtualFile vFile = PlatformDataKeys.VIRTUAL_FILE.getData(context); if (vFile != null) { // Attempt to navigate to the virtual file with unknown file type will show a modal dialog // asking to register some file type for this file. This behaviour is undesirable when autoscrolling. if (vFile.getFileType() == FileTypes.UNKNOWN || vFile.getFileType() instanceof INativeFileType) return; //IDEA-84881 Don't autoscroll to very large files if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return; } Navigatable[] navigatables = PlatformDataKeys.NAVIGATABLE_ARRAY.getData(context); if (navigatables != null) { if (navigatables.length > 1) { return; } for (Navigatable navigatable : navigatables) { // we are not going to open modal dialog during autoscrolling if (!navigatable.canNavigateToSource()) return; } } OpenSourceUtil.navigate(false, true, navigatables); } }); }
protected void scrollToSource(final Component tree) { DataContext dataContext=DataManager.getInstance().getDataContext(tree); getReady(dataContext).doWhenDone(new Runnable() { @Override public void run() { DataContext context = DataManager.getInstance().getDataContext(tree); final VirtualFile vFile = context.getData(PlatformDataKeys.VIRTUAL_FILE); if (vFile != null) { // Attempt to navigate to the virtual file with unknown file type will show a modal dialog // asking to register some file type for this file. This behaviour is undesirable when autoscrolling. if (vFile.getFileType() == UnknownFileType.INSTANCE || vFile.getFileType() instanceof INativeFileType) return; //IDEA-84881 Don't autoscroll to very large files if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return; } Navigatable[] navigatables = context.getData(PlatformDataKeys.NAVIGATABLE_ARRAY); if (navigatables != null) { if (navigatables.length > 1) { return; } for (Navigatable navigatable : navigatables) { // we are not going to open modal dialog during autoscrolling if (!navigatable.canNavigateToSource()) return; } } OpenSourceUtil.openSourcesFrom(context, false); } }); }
@Nullable private FileEditor createTempFileEditor(@Nonnull VirtualFile file) { if (file.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return null; FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance(); final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file); return providers.length == 0 ? null : providers[0].createEditor(myProject, file); }
public static boolean isTooLargeForIntelligence(@NotNull VirtualFile vFile) { if (!checkFileSizeLimit(vFile)) return false; return fileSizeIsGreaterThan(vFile, PersistentFSConstants.getMaxIntellisenseFileSize()); }
public static boolean isTooLargeForContentLoading(@NotNull VirtualFile vFile) { return fileSizeIsGreaterThan(vFile, PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD); }
public static boolean isTooLargeForIntelligence(@NotNull VirtualFile vFile, final long contentSize) { if (!checkFileSizeLimit(vFile)) return false; return contentSize > PersistentFSConstants.getMaxIntellisenseFileSize(); }
@SuppressWarnings("UnusedParameters") public static boolean isTooLargeForContentLoading(@NotNull VirtualFile vFile, final long contentSize) { return contentSize > PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD; }
public static boolean isTooLargeForContentLoading(@NotNull VirtualFile vFile) { if (!checkFileSizeLimit(vFile)) return false; return fileSizeIsGreaterThan(vFile, PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD); }
public static boolean isTooLargeForIntelligence(@Nonnull VirtualFile vFile) { if (!checkFileSizeLimit(vFile)) return false; return fileSizeIsGreaterThan(vFile, PersistentFSConstants.getMaxIntellisenseFileSize()); }
public static boolean isTooLargeForContentLoading(@Nonnull VirtualFile vFile) { return fileSizeIsGreaterThan(vFile, PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD); }
public static boolean isTooLargeForIntelligence(@Nonnull VirtualFile vFile, final long contentSize) { if (!checkFileSizeLimit(vFile)) return false; return contentSize > PersistentFSConstants.getMaxIntellisenseFileSize(); }
public static boolean isTooLargeForContentLoading(@Nonnull VirtualFile vFile, final long contentSize) { return contentSize > PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD; }