本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorProvider.accept方法的典型用法代码示例。如果您正苦于以下问题:Java FileEditorProvider.accept方法的具体用法?Java FileEditorProvider.accept怎么用?Java FileEditorProvider.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileEditor.FileEditorProvider
的用法示例。
在下文中一共展示了FileEditorProvider.accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateEditorText
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
private void updateEditorText() {
disposeNonTextEditor();
final PsiElement elt = myElements[myIndex].getNavigationElement();
Project project = elt.getProject();
PsiFile psiFile = getContainingFile(elt);
final VirtualFile vFile = psiFile.getVirtualFile();
if (vFile == null) return;
final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile);
for (FileEditorProvider provider : providers) {
if (provider instanceof TextEditorProvider) {
updateTextElement(elt);
myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
break;
}
else if (provider.accept(project, vFile)) {
myCurrentNonTextEditorProvider = provider;
myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
myBinaryPanel.removeAll();
myBinaryPanel.add(myNonTextEditor.getComponent());
myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
break;
}
}
}
示例2: updateEditorText
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
private void updateEditorText() {
disposeNonTextEditor();
final PsiElement foundElement = myElements[myIndex];
final PsiElement elt = foundElement.getNavigationElement();
LOG.assertTrue(elt != null, foundElement);
final Project project = foundElement.getProject();
final PsiFile psiFile = getContainingFile(elt);
final VirtualFile vFile = psiFile != null ? psiFile.getVirtualFile() : null;
if (vFile == null) return;
final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile);
for (FileEditorProvider provider : providers) {
if (provider instanceof TextEditorProvider) {
updateTextElement(elt);
myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
break;
}
else if (provider.accept(project, vFile)) {
myCurrentNonTextEditorProvider = provider;
myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
myBinaryPanel.removeAll();
myBinaryPanel.add(myNonTextEditor.getComponent());
myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
break;
}
}
}
示例3: getProviders
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
@NotNull
public synchronized FileEditorProvider[] getProviders(@NotNull Project project, @NotNull VirtualFile file){
// Collect all possible editors
mySharedProviderList.clear();
boolean doNotShowTextEditor = false;
final boolean dumb = DumbService.getInstance(project).isDumb();
for(int i = myProviders.size() -1 ; i >= 0; i--){
FileEditorProvider provider=myProviders.get(i);
if((!dumb || DumbService.isDumbAware(provider)) && provider.accept(project, file)){
mySharedProviderList.add(provider);
doNotShowTextEditor |= provider.getPolicy() == FileEditorPolicy.HIDE_DEFAULT_EDITOR;
}
}
// Throw out default editors provider if necessary
if(doNotShowTextEditor){
for(int i = mySharedProviderList.size() - 1; i >= 0; i--){
if(mySharedProviderList.get(i) instanceof TextEditorProvider){
mySharedProviderList.remove(i);
}
}
}
// Sort editors according policies
Collections.sort(mySharedProviderList, MyComparator.ourInstance);
if(!mySharedProviderList.isEmpty()){
return mySharedProviderList.toArray(new FileEditorProvider[mySharedProviderList.size()]);
}
else{
return EMPTY_ARRAY;
}
}