本文整理汇总了Java中com.intellij.psi.impl.file.impl.FileManager.setViewProvider方法的典型用法代码示例。如果您正苦于以下问题:Java FileManager.setViewProvider方法的具体用法?Java FileManager.setViewProvider怎么用?Java FileManager.setViewProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.impl.file.impl.FileManager
的用法示例。
在下文中一共展示了FileManager.setViewProvider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInMemoryFileHandledGracefully
import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
@Test
public void testInMemoryFileHandledGracefully() {
createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(['**/*.java'])");
LightVirtualFile inMemoryFile =
new LightVirtualFile("mockProjectViewFile", ProjectViewLanguage.INSTANCE, "");
FileManager fileManager =
((PsiManagerEx) PsiManager.getInstance(getProject())).getFileManager();
fileManager.setViewProvider(
inMemoryFile, fileManager.createFileViewProvider(inMemoryFile, true));
PsiFile psiFile = fileManager.findFile(inMemoryFile);
FindUsages.findAllReferences(psiFile);
}
示例2: getPsi
import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
@Override
@Nullable
public final PsiFile getPsi(@NotNull Language target) {
if (!isPhysical()) {
FileManager fileManager = ((PsiManagerEx)myManager).getFileManager();
VirtualFile virtualFile = getVirtualFile();
if (fileManager.findCachedViewProvider(virtualFile) == null) {
fileManager.setViewProvider(virtualFile, this);
}
}
return getPsiInner(target);
}
示例3: createEditor
import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
private static EditorEx createEditor(String tooltip) {
Project project = getProject();
LightVirtualFile virtualFile =
new LightVirtualFile("mockProjectViewFile", ProjectViewLanguage.INSTANCE, "");
final Document document =
((EditorFactoryImpl) EditorFactory.getInstance()).createDocument(true);
((DocumentImpl) document).setAcceptSlashR(true);
FileDocumentManagerImpl.registerDocument(document, virtualFile);
FileManager fileManager = ((PsiManagerEx) PsiManager.getInstance(project)).getFileManager();
fileManager.setViewProvider(virtualFile, fileManager.createFileViewProvider(virtualFile, true));
if (project.isDefault()) {
// Undo-redo doesn't work with the default project.
// Explicitly turn it off to avoid error dialogs.
UndoUtil.disableUndoFor(document);
}
EditorEx editor =
(EditorEx)
EditorFactory.getInstance()
.createEditor(document, project, ProjectViewFileType.INSTANCE, false);
final EditorSettings settings = editor.getSettings();
settings.setLineNumbersShown(false);
settings.setLineMarkerAreaShown(false);
settings.setFoldingOutlineShown(false);
settings.setRightMarginShown(false);
settings.setAdditionalPageAtBottom(false);
editor.getComponent().setMinimumSize(getEditorSize());
editor.getComponent().setPreferredSize(getEditorSize());
editor.getComponent().setToolTipText(tooltip);
editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
return editor;
}
示例4: getPsi
import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
@Override
@Nullable
public final PsiFile getPsi(@Nonnull Language target) {
if (!isPhysical()) {
FileManager fileManager = getManager().getFileManager();
VirtualFile virtualFile = getVirtualFile();
if (fileManager.findCachedViewProvider(virtualFile) == null && getCachedPsiFiles().isEmpty()) {
fileManager.setViewProvider(virtualFile, this);
}
}
return getPsiInner(target);
}