本文整理汇总了Java中com.intellij.psi.impl.file.impl.FileManager类的典型用法代码示例。如果您正苦于以下问题:Java FileManager类的具体用法?Java FileManager怎么用?Java FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileManager类属于com.intellij.psi.impl.file.impl包,在下文中一共展示了FileManager类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:GlobFindUsagesTest.java
示例2: enableLanguageSupport
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
private static void enableLanguageSupport(Project project) {
OCLanguage.LANGUAGE_SUPPORT_DISABLED.set(project, false);
UIUtil.invokeLaterIfNeeded(
() ->
ApplicationManager.getApplication()
.runWriteAction(
() -> {
if (project.isDisposed()) {
return;
}
Language langToReset = PlainTextLanguage.INSTANCE;
FileManager fileManager =
((PsiManagerEx) PsiManager.getInstance(project)).getFileManager();
for (PsiFile file : fileManager.getAllCachedFiles()) {
if (file.getLanguage() == langToReset) {
VirtualFile vf = OCInclusionContextUtil.getVirtualFile(file);
if (vf != null) {
fileManager.setViewProvider(vf, null);
}
}
}
}));
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:StubOCWorkspaceManager.java
示例3: convertRoots
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
public static PsiDirectory[] convertRoots(final FileManager fileManager, VirtualFile[] roots)
{
ArrayList<PsiDirectory> dirs = new ArrayList<PsiDirectory>();
for(VirtualFile root : roots)
{
if(!root.isValid())
{
LOG.error("Root " + root + " is not valid!");
}
PsiDirectory dir = fileManager.findDirectory(root);
if(dir != null)
{
dirs.add(dir);
}
}
return dirs.toArray(new PsiDirectory[dirs.size()]);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:PackageUtil.java
示例4: convertRoots
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
public static PsiDirectory[] convertRoots(final FileManager fileManager, VirtualFile[] roots) {
ArrayList<PsiDirectory> dirs = new ArrayList<PsiDirectory>();
for (VirtualFile root : roots) {
if (!root.isValid()) {
LOG.error("Root " + root + " is not valid!");
}
PsiDirectory dir = fileManager.findDirectory(root);
if (dir != null) {
dirs.add(dir);
}
}
return dirs.toArray(new PsiDirectory[dirs.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ProjectRootUtil.java
示例5: 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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SingleRootFileViewProvider.java
示例6: dropResolveCaches
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Override
public void dropResolveCaches() {
FileManager fileManager = myFileManager;
if (fileManager instanceof FileManagerImpl) { // mock tests
((FileManagerImpl)fileManager).processQueue();
}
beforeChange(true);
beforeChange(false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiManagerImpl.java
示例7: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Override
@NotNull
public FileManager getFileManager() {
if (myMockFileManager == null) {
myMockFileManager = new MockFileManager(this);
}
return myMockFileManager;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MockPsiManager.java
示例8: 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;
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:36,代码来源:ProjectViewUi.java
示例9: 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);
}
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:AbstractFileViewProvider.java
示例10: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Override
@Nonnull
public FileManager getFileManager() {
if (myMockFileManager == null) {
myMockFileManager = new MockFileManager(this);
}
return myMockFileManager;
}
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:MockPsiManager.java
示例11: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@NotNull
public abstract FileManager getFileManager();
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:PsiManagerEx.java
示例12: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Override
@NotNull
public FileManager getFileManager() {
return myFileManager;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:PsiManagerImpl.java
示例13: doPostponedFormattingInner
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
private void doPostponedFormattingInner(@NotNull FileViewProvider key) {
final List<ASTNode> astNodes = getContext().myReformatElements.remove(key);
final Document document = key.getDocument();
// Sort ranges by end offsets so that we won't need any offset adjustment after reformat or reindent
if (document == null) return;
final VirtualFile virtualFile = key.getVirtualFile();
if (!virtualFile.isValid()) return;
PsiManager manager = key.getManager();
if (manager instanceof PsiManagerEx) {
FileManager fileManager = ((PsiManagerEx)manager).getFileManager();
FileViewProvider viewProvider = fileManager.findCachedViewProvider(virtualFile);
if (viewProvider != key) { // viewProvider was invalidated e.g. due to language level change
if (viewProvider == null) viewProvider = fileManager.findViewProvider(virtualFile);
if (viewProvider != null) {
key = viewProvider;
}
}
}
final TreeSet<PostprocessFormattingTask> postProcessTasks = new TreeSet<PostprocessFormattingTask>();
Collection<Disposable> toDispose = ContainerUtilRt.newArrayList();
try {
// process all roots in viewProvider to find marked for reformat before elements and create appropriate range markers
handleReformatMarkers(key, postProcessTasks);
toDispose.addAll(postProcessTasks);
// then we create ranges by changed nodes. One per node. There ranges can intersect. Ranges are sorted by end offset.
if (astNodes != null) createActionsMap(astNodes, key, postProcessTasks);
if (Boolean.getBoolean("check.psi.is.valid") && ApplicationManager.getApplication().isUnitTestMode()) {
checkPsiIsCorrect(key);
}
while (!postProcessTasks.isEmpty()) {
// now we have to normalize actions so that they not intersect and ordered in most appropriate way
// (free reformatting -> reindent -> formatting under reindent)
final List<PostponedAction> normalizedActions = normalizeAndReorderPostponedActions(postProcessTasks, document);
toDispose.addAll(normalizedActions);
// only in following loop real changes in document are made
for (final PostponedAction normalizedAction : normalizedActions) {
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myPsiManager.getProject());
boolean old = settings.ENABLE_JAVADOC_FORMATTING;
settings.ENABLE_JAVADOC_FORMATTING = false;
try {
normalizedAction.execute(key);
}
finally {
settings.ENABLE_JAVADOC_FORMATTING = old;
}
}
}
}
finally {
for (Disposable disposable : toDispose) {
//noinspection SSBasedInspection
disposable.dispose();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:63,代码来源:PostprocessReformattingAspect.java
示例14: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@NotNull
private static FileManager getFileManager(@NotNull final Project project) {
return ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager();
}
开发者ID:ktisha,项目名称:TheRPlugin,代码行数:5,代码来源:TheRCodeFragment.java
示例15: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Nonnull
public abstract FileManager getFileManager();
开发者ID:consulo,项目名称:consulo,代码行数:3,代码来源:PsiManagerEx.java
示例16: getFileManager
import com.intellij.psi.impl.file.impl.FileManager; //导入依赖的package包/类
@Override
@Nonnull
public FileManager getFileManager() {
return myFileManager;
}
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:PsiManagerImpl.java
注:本文中的com.intellij.psi.impl.file.impl.FileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论