• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SelectInContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doCreateEditorContext

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
private static SelectInContext doCreateEditorContext(Project project, FileEditor editor, @Nullable DataContext dataContext) {
  if (project == null || editor == null) {
    return null;
  }
  VirtualFile file = FileEditorManagerEx.getInstanceEx(project).getFile(editor);
  if (file == null) {
    file = dataContext == null ? null : CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
    if (file == null) {
      return null;
    }
  }
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  if (psiFile == null) {
    return null;
  }
  if (editor instanceof TextEditor) {
    return new TextEditorContext((TextEditor)editor, psiFile);
  }
  else {
    StructureViewBuilder builder = editor.getStructureViewBuilder();
    StructureView structureView = builder != null ? builder.createStructureView(editor, project) : null;
    Object selectorInFile = structureView != null ? structureView.getTreeModel().getCurrentEditorElement() : null;
    if (structureView != null) Disposer.dispose(structureView);
    return new SimpleSelectInContext(psiFile, ObjectUtils.chooseNotNull(selectorInFile, psiFile));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SelectInContextImpl.java


示例2: 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


示例3: 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


示例4: 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


示例5: doCreateEditorContext

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
private static SelectInContext doCreateEditorContext(Project project, FileEditor editor, @Nullable DataContext dataContext) {
  if (project == null || editor == null) {
    return null;
  }
  VirtualFile file = FileEditorManagerEx.getInstanceEx(project).getFile(editor);
  if (file == null) {
    file = dataContext == null ? null : PlatformDataKeys.VIRTUAL_FILE.getData(dataContext);
    if (file == null) {
      return null;
    }
  }
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  if (psiFile == null) {
    return null;
  }
  if (editor instanceof TextEditor) {
    return new TextEditorContext((TextEditor)editor, psiFile);
  }
  else {
    return new SimpleSelectInContext(psiFile);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:SelectInContextImpl.java


示例6: 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


示例7: canSelect

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
public boolean canSelect(SelectInContext context) {
  Object selectorInFile = context.getSelectorInFile();
  if (!(selectorInFile instanceof PsiElement)) {
    return false;
  }

  PsiFile file = ((PsiElement)selectorInFile).getContainingFile();
  if (file == null || file.getVirtualFile() == null) {
    return false;
  }

  Pair<WebBrowserUrlProvider, Url> browserUrlProvider = WebBrowserServiceImpl.getProvider(file);
  currentName = XmlBundle.message("browser.select.in.default.name");
  if (browserUrlProvider == null) {
    return HtmlUtil.isHtmlFile(file) && !(file.getVirtualFile() instanceof LightVirtualFile);
  }
  else {
    String customText = browserUrlProvider.first.getOpenInBrowserActionText(file);
    if (customText != null) {
      currentName = customText;
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SelectInDefaultBrowserTarget.java


示例8: selectElementFromEditor

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
protected void selectElementFromEditor(@Nonnull FileEditor editor) {
  final VirtualFile file = FileEditorManagerEx.getInstanceEx(myProject).getFile(editor);
  if (file != null) {
    final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
    if (psiFile != null) {
      final SelectInTarget target = mySelectInTarget;
      if (target != null) {
        final SelectInContext selectInContext = SelectInContextImpl.createEditorContext(myProject, editor);

        if (target.canSelect(selectInContext)) {
          target.selectIn(selectInContext, false);
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FavoritesAutoscrollFromSourceHandler.java


示例9: createEditorContext

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
public static SelectInContext createEditorContext(Project project, FileEditor editor) {
  if (project == null || editor == null) {
    return null;
  }
  VirtualFile file = FileEditorManagerEx.getInstanceEx(project).getFile(editor);
  if (file == null) {
    return null;
  }
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  if (psiFile == null) {
    return null;
  }
  if (editor instanceof TextEditor) {
    return new TextEditorContext((TextEditor)editor, psiFile);
  }
  else {
    return new SimpleSelectInContext(psiFile);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:SelectInContextImpl.java


示例10: selectIn

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final FileEditor fileEditor = context.getFileEditorProvider().get();

  ToolWindowManager windowManager=ToolWindowManager.getInstance(context.getProject());
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      StructureViewFactoryEx.getInstanceEx(myProject).runWhenInitialized(new Runnable() {
        @Override
        public void run() {
          final StructureViewWrapper structureView = getStructureViewWrapper();
          structureView.selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus);
        }
      });
    }
  };
  if (requestFocus) {
    windowManager.getToolWindow(ToolWindowId.STRUCTURE_VIEW).activate(runnable);
  }
  else {
    runnable.run();
  }

}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:StructureViewSelectInTarget.java


示例11: 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


示例12: 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


示例13: canSelect

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
public boolean canSelect(SelectInContext context)
{
	Object selectorInFile = context.getSelectorInFile();
	OpenInBrowserRequest request = selectorInFile instanceof PsiElement ? OpenInBrowserRequest.create((PsiElement) selectorInFile) : null;
	if(request == null)
	{
		return false;
	}

	WebBrowserUrlProvider urlProvider = WebBrowserServiceImpl.getProvider(request);
	if(urlProvider == null)
	{
		VirtualFile virtualFile = request.getVirtualFile();
		return virtualFile instanceof HttpVirtualFile || (HtmlUtil.isHtmlFile(request.getFile()) && !(virtualFile instanceof LightVirtualFile));
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:SelectInDefaultBrowserTarget.java


示例14: 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


示例15: 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


示例16: selectElementFromEditor

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
protected void selectElementFromEditor(@NotNull FileEditor editor) {
  final VirtualFile file = FileEditorManagerEx.getInstanceEx(myProject).getFile(editor);
  if (file != null) {
    final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
    if (psiFile != null) {
      final SelectInContext selectInContext = SelectInContextImpl.createEditorContext(myProject, editor);
      if (mySelectInTarget.canSelect(selectInContext)) {
        mySelectInTarget.selectIn(selectInContext, false);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:FavoritesAutoscrollFromSourceHandler.java


示例17: createPsiContext

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Nullable
private static SelectInContext createPsiContext(AnActionEvent event) {
  final DataContext dataContext = event.getDataContext();
  PsiElement psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
  if (psiElement == null || !psiElement.isValid()) {
    return null;
  }
  PsiFile psiFile = psiElement.getContainingFile();
  if (psiFile == null) {
    return null;
  }
  return new SimpleSelectInContext(psiFile, psiElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SelectInContextImpl.java


示例18: create

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Nullable
public static SelectInContext create(Project project, VirtualFile file) {
  final Document document = FileDocumentManager.getInstance().getDocument(file);
  if (document == null) return null;
  final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
  if (psiFile == null) return null;
  return new OpenFileDescriptorContext(psiFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SelectInContextImpl.java


示例19: selectIn

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  @SuppressWarnings("ConstantConditions")
  final FileEditor fileEditor = context.getFileEditorProvider().openFileEditor();

  StructureViewWrapper customStructureView = CUSTOM_STRUCTURE_VIEW_KEY.get(context.getVirtualFile());
  if (customStructureView != null) {
    customStructureView.selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus);
    return;
  }

  ToolWindowManager windowManager = ToolWindowManager.getInstance(context.getProject());
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      StructureViewFactoryEx.getInstanceEx(myProject).runWhenInitialized(new Runnable() {
        @Override
        public void run() {
          getStructureViewWrapper().selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus);
        }
      });
    }
  };
  if (requestFocus) {
    windowManager.getToolWindow(ToolWindowId.STRUCTURE_VIEW).activate(runnable);
  }
  else {
    runnable.run();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:StructureViewSelectInTarget.java


示例20: canSelect

import com.intellij.ide.SelectInContext; //导入依赖的package包/类
@Override
public boolean canSelect(SelectInContext context) {
  ProjectView projectView = ProjectView.getInstance(context.getProject());
  Collection<SelectInTarget> targets = projectView.getSelectInTargets();
  for (SelectInTarget projectViewTarget : targets) {
    if (projectViewTarget.canSelect(context)) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectViewSelectInGroupTarget.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleDiagramRenderer类代码示例发布时间:2022-05-22
下一篇:
Java GraphAlgoFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap