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