当前位置: 首页>>代码示例>>Java>>正文


Java SelectInContext.getVirtualFile方法代码示例

本文整理汇总了Java中com.intellij.ide.SelectInContext.getVirtualFile方法的典型用法代码示例。如果您正苦于以下问题:Java SelectInContext.getVirtualFile方法的具体用法?Java SelectInContext.getVirtualFile怎么用?Java SelectInContext.getVirtualFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.SelectInContext的用法示例。


在下文中一共展示了SelectInContext.getVirtualFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContextPsiFile

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Nullable
protected PsiFileSystemItem getContextPsiFile(@NotNull SelectInContext context) {
  VirtualFile virtualFile = context.getVirtualFile();
  final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  final PsiFileSystemItem psiFile;
  if (document != null) {
    psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
  }
  else if (context.getSelectorInFile() instanceof PsiFile) {
    psiFile = (PsiFile)context.getSelectorInFile();
  }
  else if (virtualFile.isDirectory()) {
    psiFile = PsiManager.getInstance(myProject).findDirectory(virtualFile);
  }
  else {
    psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
  }
  return psiFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SelectInTargetPsiWrapper.java

示例2: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public final void selectIn(@NotNull SelectInContext context, boolean requestFocus) {
  VirtualFile file = context.getVirtualFile();
  Object selector = context.getSelectorInFile();
  if (selector == null) {
    PsiManager psiManager = PsiManager.getInstance(myProject);
    selector = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
  }

  if (selector instanceof PsiElement) {
    select(((PsiElement)selector).getOriginalElement(), requestFocus);
  }
  else {
    select(selector, file, requestFocus);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SelectInTargetPsiWrapper.java

示例3: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public void selectIn(SelectInContext context, final boolean requestFocus) {
  final Project project = context.getProject();
  final VirtualFile file = context.getVirtualFile();

  final MvcFramework framework = MvcFramework.getInstance(ModuleUtilCore.findModuleForFile(file, project));
  if (framework == null) {
    return;
  }

  final Runnable select = new Runnable() {
    @Override
    public void run() {
      final MvcProjectViewPane view = MvcProjectViewPane.getView(project, framework);
      if (view != null) {
        view.selectFile(file, requestFocus);
      }
    }
  };

  if (requestFocus) {
    ToolWindowManager.getInstance(project).getToolWindow(MvcToolWindowDescriptor.getToolWindowId(framework)).activate(select, false);
  } else {
    select.run();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MvcProjectViewSelectInTarget.java

示例4: canSelect

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public final boolean canSelect(SelectInContext context) {
  if (myProject.isDisposed()) return false;

  VirtualFile virtualFile = context.getVirtualFile();
  if (!virtualFile.isValid()) return false;

  final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  final PsiFileSystemItem psiFile;
  if (document != null) {
    psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
  }
  else if (context.getSelectorInFile() instanceof PsiFile) {
    psiFile = (PsiFile)context.getSelectorInFile();
  }
  else if (virtualFile.isDirectory()) {
    psiFile = PsiManager.getInstance(myProject).findDirectory(virtualFile);
  }
  else {
    psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
  }
  return psiFile != null && canSelect(psiFile) || canWorkWithCustomObjects();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:SelectInTargetPsiWrapper.java

示例5: getContextPsiFile

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Nullable
protected PsiFileSystemItem getContextPsiFile(@Nonnull SelectInContext context) {
  VirtualFile virtualFile = context.getVirtualFile();
  PsiFileSystemItem psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
  if (psiFile != null) {
    return psiFile;
  }

  if (context.getSelectorInFile() instanceof PsiFile) {
    return (PsiFile)context.getSelectorInFile();
  }
  if (virtualFile.isDirectory()) {
    return PsiManager.getInstance(myProject).findDirectory(virtualFile);
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:SelectInTargetPsiWrapper.java

示例6: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public final void selectIn(@Nonnull SelectInContext context, boolean requestFocus) {
  VirtualFile file = context.getVirtualFile();
  Object selector = context.getSelectorInFile();
  if (selector == null) {
    PsiManager psiManager = PsiManager.getInstance(myProject);
    selector = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
  }

  if (selector instanceof PsiElement) {
    select(((PsiElement)selector).getOriginalElement(), requestFocus);
  }
  else {
    select(selector, file, requestFocus);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:SelectInTargetPsiWrapper.java

示例7: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
public void selectIn(SelectInContext context, boolean requestFocus)
{
    Container container = this.container();
    Project project     = context.getProject();
    VirtualFile file    = context.getVirtualFile();

    container.runner().runForFile(project, file, this.container().openInBrowserHandler());
}
 
开发者ID:ben-gibson,项目名称:GitLink,代码行数:9,代码来源:BrowserSelectInTarget.java

示例8: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final VirtualFile file = context.getVirtualFile();
  Runnable runnable = new Runnable() {
    public void run() {
      ChangesViewContentManager.getInstance(myProject).selectContent(ChangesViewContentManager.LOCAL_CHANGES);
      ChangesViewManager.getInstance(myProject).selectFile(file);
    }
  };
  if (requestFocus) {
    ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID).activate(runnable);
  }
  else {
    runnable.run();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SelectInChangesViewTarget.java

示例9: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
public void selectIn(SelectInContext context, final boolean requestFocus) {
  VirtualFile virtualFile = context.getVirtualFile();
  VirtualFile parent = virtualFile.getParent();
  if (parent != null) {
    final Project project = context.getProject();
    ThumbnailView thumbnailView = ThumbnailManager.getManager(project).getThumbnailView();
    thumbnailView.setRoot(parent);
    thumbnailView.setVisible(true);
    thumbnailView.setSelected(virtualFile, true);
    thumbnailView.scrollToSelection();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ThumbnailSelectInTarget.java

示例10: canSelect

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public boolean canSelect(SelectInContext context) {
  final Project project = context.getProject();
  final VirtualFile file = context.getVirtualFile();
  final MvcFramework framework = MvcFramework.getInstance(ModuleUtilCore.findModuleForFile(file, project));
  if (framework == null) {
    return false;
  }

  return MvcProjectViewPane.canSelectFile(project, framework, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MvcProjectViewSelectInTarget.java

示例11: canSelect

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
public boolean canSelect(final SelectInContext context) {
  final CoverageSuitesBundle suitesBundle = CoverageDataManager.getInstance(myProject).getCurrentSuitesBundle();
  if (suitesBundle != null) {
    final CoverageView coverageView = CoverageViewManager.getInstance(myProject).getToolwindow(suitesBundle);
    if (coverageView != null) {
      final VirtualFile file = context.getVirtualFile();
      return !file.isDirectory() && coverageView.canSelect(file);
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SelectInCoverageView.java

示例12: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final VirtualFile file = context.getVirtualFile();
  Runnable runnable = new Runnable() {
    public void run() {
      ChangesViewContentManager.getInstance(myProject).selectContent("Local");
      ChangesViewManager.getInstance(myProject).selectFile(file);
    }
  };
  if (requestFocus) {
    ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID).activate(runnable);
  }
  else {
    runnable.run();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:SelectInChangesViewTarget.java

示例13: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public final void selectIn(SelectInContext context, final boolean requestFocus) {
  VirtualFile file = context.getVirtualFile();
  Object selector = context.getSelectorInFile();
  if (selector == null) {
    PsiManager psiManager = PsiManager.getInstance(myProject);
    selector = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
  }

  if (selector instanceof PsiElement) {
    select(((PsiElement)selector).getOriginalElement(), requestFocus);
  } else {
    select(selector, file, requestFocus);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:SelectInTargetPsiWrapper.java

示例14: isSubIdSelectable

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public boolean isSubIdSelectable(String subId, SelectInContext context) {
  if (context == null) return false;
  final NamedScope scope = NamedScopesHolder.getScope(myProject, subId);
  if (scope == null) return false;
  PackageSet packageSet = scope.getValue();
  final VirtualFile virtualFile = context.getVirtualFile();
  if (packageSet != null) {
    final NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, subId, DependencyValidationManager.getInstance(myProject));
    if (packageSet instanceof PackageSetBase ? ((PackageSetBase)packageSet).contains(virtualFile, myProject, holder) : packageSet.contains(PackageSetBase.getPsiFile(virtualFile, myProject), holder)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ScopePaneSelectInTarget.java

示例15: isSubIdSelectable

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public boolean isSubIdSelectable(String subId, SelectInContext context) {
  if (context == null) return false;
  final NamedScope scope = NamedScopesHolder.getScope(myProject, subId);
  if (scope == null) return false;
  PackageSet packageSet = scope.getValue();
  final VirtualFile virtualFile = context.getVirtualFile();
  if (packageSet != null) {
    final NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, subId, DependencyValidationManager.getInstance(myProject));
    if (packageSet instanceof PackageSetBase ? ((PackageSetBase)packageSet).contains(virtualFile, holder) : packageSet.contains(PackageSetBase.getPsiFile(virtualFile, holder), holder)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:ScopePaneSelectInTarget.java


注:本文中的com.intellij.ide.SelectInContext.getVirtualFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。