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


Java SelectInContext.getSelectorInFile方法代码示例

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


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

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

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

示例8: 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:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SelectInDefaultBrowserTarget.java

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

示例10: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public void selectIn(SelectInContext context, boolean requestFocus)
{
	PsiElement element = (PsiElement) context.getSelectorInFile();
	LOG.assertTrue(element != null);
	BaseOpenInBrowserAction.open(OpenInBrowserRequest.create(element), false, null);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:8,代码来源:SelectInDefaultBrowserTarget.java

示例11: selectIn

import com.intellij.ide.SelectInContext; //导入方法依赖的package包/类
@Override
public void selectIn(SelectInContext context, boolean requestFocus) {
  PsiElement element = (PsiElement)context.getSelectorInFile();
  LOG.assertTrue(element != null);
  BaseOpenInBrowserAction.open(OpenInBrowserRequest.create(element), false, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:SelectInDefaultBrowserTarget.java


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