本文整理汇总了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;
}
示例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);
}
}
示例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();
}
}
示例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();
}
示例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;
}
示例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);
}
}
示例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());
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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;
}