本文整理汇总了Java中com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.getSelectedEditorWithProvider方法的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerEx.getSelectedEditorWithProvider方法的具体用法?Java FileEditorManagerEx.getSelectedEditorWithProvider怎么用?Java FileEditorManagerEx.getSelectedEditorWithProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
的用法示例。
在下文中一共展示了FileEditorManagerEx.getSelectedEditorWithProvider方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateHistoryEntry
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
private void updateHistoryEntry(@Nullable final VirtualFile file,
@Nullable final FileEditor fallbackEditor,
@Nullable FileEditorProvider fallbackProvider,
final boolean changeEntryOrderOnly) {
if (file == null) {
return;
}
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(myProject);
final Pair<FileEditor[], FileEditorProvider[]> editorsWithProviders = editorManager.getEditorsWithProviders(file);
FileEditor[] editors = editorsWithProviders.getFirst();
FileEditorProvider[] providers = editorsWithProviders.getSecond();
if (editors.length <= 0 && fallbackEditor != null) {
editors = new FileEditor[] {fallbackEditor};
providers = new FileEditorProvider[] {fallbackProvider};
}
if (editors.length == 0) {
// obviously not opened in any editor at the moment,
// makes no sense to put the file in the history
return;
}
final HistoryEntry entry = getEntry(file);
if(entry == null){
// Size of entry list can be less than number of opened editors (some entries can be removed)
if (file.isValid()) {
// the file could have been deleted, so the isValid() check is essential
fileOpenedImpl(file, fallbackEditor, fallbackProvider);
}
return;
}
if (!changeEntryOrderOnly) { // update entry state
//LOG.assertTrue(editors.length > 0);
for (int i = editors.length - 1; i >= 0; i--) {
final FileEditor editor = editors [i];
final FileEditorProvider provider = providers [i];
if (!editor.isValid()) {
// this can happen for example if file extension was changed
// and this method was called during corresponding myEditor close up
continue;
}
final FileEditorState oldState = entry.getState(provider);
final FileEditorState newState = editor.getState(FileEditorStateLevel.FULL);
if (!newState.equals(oldState)) {
entry.putState(provider, newState);
}
}
}
final Pair <FileEditor, FileEditorProvider> selectedEditorWithProvider = editorManager.getSelectedEditorWithProvider(file);
if (selectedEditorWithProvider != null) {
//LOG.assertTrue(selectedEditorWithProvider != null);
entry.mySelectedProvider = selectedEditorWithProvider.getSecond ();
LOG.assertTrue(entry.mySelectedProvider != null);
if(changeEntryOrderOnly){
removeEntry(entry);
addEntry(entry);
}
}
}
示例2: updateHistoryEntry
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
private void updateHistoryEntry(@Nullable final VirtualFile file,
@Nullable final FileEditor fallbackEditor,
@Nullable FileEditorProvider fallbackProvider,
final boolean changeEntryOrderOnly)
{
if (file == null) {
return;
}
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(myProject);
final Pair<FileEditor[], FileEditorProvider[]> editorsWithProviders = editorManager.getEditorsWithProviders(file);
FileEditor[] editors = editorsWithProviders.getFirst();
FileEditorProvider[] providers = editorsWithProviders.getSecond();
if (editors.length <= 0 && fallbackEditor != null) {
editors = new FileEditor[] {fallbackEditor};
providers = new FileEditorProvider[] {fallbackProvider};
}
if (editors.length == 0) {
// obviously not opened in any editor at the moment,
// makes no sense to put the file in the history
return;
}
final HistoryEntry entry = getEntry(file);
if(entry == null){
// Size of entry list can be less than number of opened editors (some entries can be removed)
if (file.isValid()) {
// the file could have been deleted, so the isValid() check is essential
fileOpenedImpl(file, fallbackEditor, fallbackProvider);
}
return;
}
if (!changeEntryOrderOnly) { // update entry state
//LOG.assertTrue(editors.length > 0);
for (int i = editors.length - 1; i >= 0; i--) {
final FileEditor editor = editors [i];
final FileEditorProvider provider = providers [i];
if (!editor.isValid()) {
// this can happen for example if file extension was changed
// and this method was called during correponding myEditor close up
continue;
}
final FileEditorState oldState = entry.getState(provider);
final FileEditorState newState = editor.getState(FileEditorStateLevel.FULL);
if (!newState.equals(oldState)) {
entry.putState(provider, newState);
}
}
}
final Pair <FileEditor, FileEditorProvider> selectedEditorWithProvider = editorManager.getSelectedEditorWithProvider(file);
if (selectedEditorWithProvider != null) {
//LOG.assertTrue(selectedEditorWithProvider != null);
entry.mySelectedProvider = selectedEditorWithProvider.getSecond ();
LOG.assertTrue(entry.mySelectedProvider != null);
if(changeEntryOrderOnly){
myEntriesList.remove(entry);
myEntriesList.add(entry);
}
}
}
示例3: updateHistoryEntry
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
private void updateHistoryEntry(@Nullable final VirtualFile file,
@Nullable final FileEditor fallbackEditor,
@Nullable FileEditorProvider fallbackProvider,
final boolean changeEntryOrderOnly) {
if (file == null) {
return;
}
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(myProject);
final Pair<FileEditor[], FileEditorProvider[]> editorsWithProviders = editorManager.getEditorsWithProviders(file);
FileEditor[] editors = editorsWithProviders.getFirst();
FileEditorProvider[] providers = editorsWithProviders.getSecond();
if (editors.length <= 0 && fallbackEditor != null) {
editors = new FileEditor[]{fallbackEditor};
providers = new FileEditorProvider[]{fallbackProvider};
}
if (editors.length == 0) {
// obviously not opened in any editor at the moment,
// makes no sense to put the file in the history
return;
}
final HistoryEntry entry = getEntry(file);
if (entry == null) {
// Size of entry list can be less than number of opened editors (some entries can be removed)
if (file.isValid()) {
// the file could have been deleted, so the isValid() check is essential
fileOpenedImpl(file, fallbackEditor, fallbackProvider);
}
return;
}
if (!changeEntryOrderOnly) { // update entry state
//LOG.assertTrue(editors.length > 0);
for (int i = editors.length - 1; i >= 0; i--) {
final FileEditor editor = editors[i];
final FileEditorProvider provider = providers[i];
if (!editor.isValid()) {
// this can happen for example if file extension was changed
// and this method was called during corresponding myEditor close up
continue;
}
final FileEditorState oldState = entry.getState(provider);
final FileEditorState newState = editor.getState(FileEditorStateLevel.FULL);
if (!newState.equals(oldState)) {
entry.putState(provider, newState);
}
}
}
final Pair<FileEditor, FileEditorProvider> selectedEditorWithProvider = editorManager.getSelectedEditorWithProvider(file);
if (selectedEditorWithProvider != null) {
//LOG.assertTrue(selectedEditorWithProvider != null);
entry.setSelectedProvider(selectedEditorWithProvider.getSecond());
LOG.assertTrue(entry.getSelectedProvider() != null);
if (changeEntryOrderOnly) {
moveOnTop(entry);
}
}
}