本文整理汇总了Java中com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.getInstanceEx方法的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerEx.getInstanceEx方法的具体用法?Java FileEditorManagerEx.getInstanceEx怎么用?Java FileEditorManagerEx.getInstanceEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
的用法示例。
在下文中一共展示了FileEditorManagerEx.getInstanceEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectionChanged
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent fileEditorManagerEvent) {
final Project project = fileEditorManagerEvent.getManager().getProject();
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
final FileColorManager fileColorManager = FileColorManager.getInstance(project);
final HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);
final VirtualFile oldFile = fileEditorManagerEvent.getOldFile();
final VirtualFile newFile = fileEditorManagerEvent.getNewFile();
for (EditorWindow editorWindow : manager.getWindows()) {
setUnfocusedTabWithColorManagerDefaultColor(fileColorManager, oldFile, editorWindow);
setFocusedTabHighlighterColor(highlighterSettingsConfig, newFile, editorWindow);
}
}
示例2: getEditorTabColor
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@Nullable
@Override
public Color getEditorTabColor(@NotNull Project project, @NotNull VirtualFile virtualFile) {
final FileEditorManagerEx fileEditorManagerEx = FileEditorManagerEx.getInstanceEx(project);
FileColorManager fileColorManager = FileColorManager.getInstance(project);
HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);
EditorWindow activeWindow = fileEditorManagerEx.getCurrentWindow();
if (activeWindow != null) {
final EditorWithProviderComposite selectedEditor = activeWindow.getSelectedEditor();
if (selectedEditor != null && selectedEditor.getFile() != null && selectedEditor.getFile().equals(virtualFile)) {
return highlighterSettingsConfig.buildHighlightColor();
}
}
return fileColorManager.getFileColor(virtualFile);
}
示例3: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
EditorWindow window;
final VirtualFile file = (VirtualFile)myTabInfo.getObject();
if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) {
window = myWindow;
}
else {
window = mgr.getCurrentWindow();
}
if (window != null) {
if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) {
window.closeAllExcept(file);
}
else {
if (window.findFileComposite(file) != null) {
mgr.closeFile(file, window);
}
}
}
}
示例4: close
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@Override
public void close() {
TabInfo selected = myTabs.getTargetInfo();
if (selected == null) return;
final VirtualFile file = (VirtualFile)selected.getObject();
final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
AsyncResult<EditorWindow> window = mgr.getActiveWindow();
window.doWhenDone(new Consumer<EditorWindow>() {
@Override
public void consume(EditorWindow wnd) {
if (wnd != null) {
if (wnd.findFileComposite(file) != null) {
mgr.closeFile(file, wnd);
}
}
}
});
}
示例5: update
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Project project = CommonDataKeys.PROJECT.getData(dataContext);
presentation.setEnabled(false);
if (project == null) {
return;
}
final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
if (windowManager.isEditorComponentActive()) {
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext);
if (currentWindow == null){
editorManager.getCurrentWindow ();
}
if (currentWindow != null) {
final VirtualFile[] files = currentWindow.getFiles();
presentation.setEnabled(files.length > 1);
}
return;
}
ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
示例6: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
FileEditorManagerEx fileEditorManager=FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile;
final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
if (window != null){
window.closeAllExcept(e.getData(CommonDataKeys.VIRTUAL_FILE));
return;
}
selectedFile = fileEditorManager.getSelectedFiles()[0];
final VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
for (final VirtualFile sibling : siblings) {
if (!Comparing.equal(selectedFile, sibling)) {
fileEditorManager.closeFile(sibling);
}
}
}
示例7: update
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile;
final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
if (window != null){
presentation.setEnabled(window.getFiles().length > 1);
return;
} else {
if (fileEditorManager.getSelectedFiles().length == 0) {
presentation.setEnabled(false);
return;
}
selectedFile = fileEditorManager.getSelectedFiles()[0];
}
VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
presentation.setEnabled(siblings.length > 1);
}
示例8: setOpenOrClosedIcon
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
/**
* Try to mimic the "open or closed" folder feature
*/
private void setOpenOrClosedIcon(final PresentationData data, final VirtualFile file, final Project project) {
if (!file.isDirectory()) {
return;
}
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
for (final EditorWindow editorWindow : manager.getWindows()) {
final VirtualFile[] files = editorWindow.getFiles();
for (final VirtualFile leaf : files) {
if (leaf.getPath().contains(file.getPath())) {
setDirectoryIcon(data, file, project);
colorOpenDirectories(data);
}
}
}
}
示例9: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
EditorWindow window;
final VirtualFile file = (VirtualFile)myTabInfo.getObject();
if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) {
window = myWindow;
}
else {
window = mgr.getCurrentWindow();
}
if (window != null) {
if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) {
window.closeAllExcept(file);
}
else {
if (window.findFileComposite(file) != null) {
mgr.closeFile(file, window);
}
}
}
}
示例10: update
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
presentation.setEnabled(false);
if (project == null) {
return;
}
final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
if (windowManager.isEditorComponentActive()) {
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext);
if (currentWindow == null){
editorManager.getCurrentWindow ();
}
if (currentWindow != null) {
final VirtualFile[] files = currentWindow.getFiles();
presentation.setEnabled(files.length > 1);
}
return;
}
ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
示例11: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
FileEditorManagerEx fileEditorManager=FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile;
final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
if (window != null){
window.closeAllExcept(e.getData(PlatformDataKeys.VIRTUAL_FILE));
return;
}
selectedFile = fileEditorManager.getSelectedFiles()[0];
final VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
for (final VirtualFile sibling : siblings) {
if (!Comparing.equal(selectedFile, sibling)) {
fileEditorManager.closeFile(sibling);
}
}
}
示例12: update
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
Project project = event.getData(PlatformDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile;
final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
if (window != null){
presentation.setEnabled(window.getFiles().length > 1);
return;
} else {
if (fileEditorManager.getSelectedFiles().length == 0) {
presentation.setEnabled(false);
return;
}
selectedFile = fileEditorManager.getSelectedFiles()[0];
}
VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
presentation.setEnabled(siblings.length > 1);
}
示例13: setConsoleEditorEnabled
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
public void setConsoleEditorEnabled(boolean consoleEditorEnabled) {
if (isConsoleEditorEnabled() == consoleEditorEnabled) return;
final FileEditorManagerEx fileManager = FileEditorManagerEx.getInstanceEx(getProject());
if (consoleEditorEnabled) {
fileManager.closeFile(myVirtualFile);
myPanel.removeAll();
myPanel.add(myHistoryViewer.getComponent());
myPanel.add(myConsoleEditor.getComponent());
myHistoryViewer.setHorizontalScrollbarVisible(false);
myCurrentEditor = myConsoleEditor;
}
else {
myPanel.removeAll();
myPanel.add(myHistoryViewer.getComponent(), BorderLayout.CENTER);
myHistoryViewer.setHorizontalScrollbarVisible(true);
}
}
示例14: collect_active_editors
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
private ArrayList<Editor> collect_active_editors(AnActionEvent e) {
ArrayList<Editor> editors = new ArrayList<Editor>();
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
FileEditor[] selectedEditors = fileEditorManager.getSelectedEditors();
for (FileEditor selectedEditor : selectedEditors) {
if (selectedEditor instanceof TextEditor) {
Editor editor = ((TextEditor) selectedEditor).getEditor();
editors.add(editor);
}
}
return editors;
}
示例15: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public void actionPerformed(final AnActionEvent e) {
final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
consulo.fileEditor.impl.EditorWindow window;
final VirtualFile file = (VirtualFile)myTabInfo.getObject();
if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) {
window = myWindow;
}
else {
window = mgr.getCurrentWindow();
}
if (window != null) {
if (BitUtil.isSet(e.getModifiers(), InputEvent.ALT_MASK)) {
window.closeAllExcept(file);
}
else {
if (window.findFileComposite(file) != null) {
mgr.closeFile(file, window);
}
}
}
}