本文整理汇总了Java中com.intellij.openapi.fileEditor.ex.FileEditorManagerEx类的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerEx类的具体用法?Java FileEditorManagerEx怎么用?Java FileEditorManagerEx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileEditorManagerEx类属于com.intellij.openapi.fileEditor.ex包,在下文中一共展示了FileEditorManagerEx类的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: testAllTheseConcurrentThreadsDoNotCrashAnything
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
public void testAllTheseConcurrentThreadsDoNotCrashAnything() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i < 20/*00000*/; i++) {
//System.out.println("i = " + i);
getPsiManager().dropResolveCaches();
((PsiManagerEx)getPsiManager()).getFileManager().cleanupForNextTest();
DaemonCodeAnalyzer.getInstance(getProject()).restart();
configureFromFileText("Stress.java", text);
List<HighlightInfo> infos = doHighlighting();
assertEmpty(DaemonAnalyzerTestCase.filter(infos, HighlightSeverity.ERROR));
UIUtil.dispatchAllInvocationEvents();
FileEditorManagerEx.getInstanceEx(getProject()).closeAllFiles();
}
System.out.println(System.currentTimeMillis() - time+"ms");
}
示例4: projectClosed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
@Override
public void projectClosed() {
final ArrayList<FinalizableCommand> commandsList = new ArrayList<FinalizableCommand>();
final String[] ids = getToolWindowIds();
// Remove ToolWindowsPane
if (myFrame != null) {
((IdeRootPane)myFrame.getRootPane()).setToolWindowsPane(null);
myWindowManager.releaseFrame(myFrame);
}
appendUpdateToolWindowsPaneCmd(commandsList);
// Hide all tool windows
for (final String id : ids) {
deactivateToolWindowImpl(id, true, commandsList);
}
// Remove editor component
final JComponent editorComponent = FileEditorManagerEx.getInstanceEx(myProject).getComponent();
myEditorComponentFocusWatcher.deinstall(editorComponent);
appendSetEditorComponentCmd(null, commandsList);
execute(commandsList);
}
示例5: trimToSize
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
void trimToSize(final int limit, @Nullable final VirtualFile fileToIgnore, final boolean transferFocus) {
if (myTabbedPane == null) return;
FileEditorManagerEx.getInstanceEx(getManager().getProject()).getReady(this).doWhenDone(new Runnable() {
@Override
public void run() {
if (myTabbedPane == null) return;
final boolean closeNonModifiedFilesFirst = UISettings.getInstance().CLOSE_NON_MODIFIED_FILES_FIRST;
final EditorComposite selectedComposite = getSelectedEditor();
try {
doTrimSize(limit, fileToIgnore, closeNonModifiedFilesFirst, transferFocus);
}
finally {
setSelectedEditor(selectedComposite, false);
}
}
});
}
示例6: 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);
}
}
}
}
示例7: 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);
}
}
}
});
}
示例8: dragOutFinished
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
if (!copy) {
myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
}
else {
source.setHidden(false);
}
mySession.process(event);
if (!copy) {
myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
}
myFile = null;
mySession = null;
}
示例9: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent event) {
final DataContext dataContext = event.getDataContext();
final VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (vFile == null || project == null){
return;
}
final EditorWindow window = EditorWindow.DATA_KEY.getData(dataContext);
if (window != null) {
final EditorWindow[] siblings = window.findSiblings();
if (siblings != null && siblings.length == 1) {
final EditorWithProviderComposite editorComposite = window.getSelectedEditor();
final HistoryEntry entry = editorComposite.currentStateAsHistoryEntry();
((FileEditorManagerImpl)FileEditorManagerEx.getInstanceEx(project)).openFileImpl3(siblings[0], vFile, true, entry, true);
closeOldFile(vFile, window);
}
}
}
示例10: openFiles
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
private void openFiles(final Project project, final List<File> fileList, EditorWindow editorWindow) {
if (editorWindow == null && myEditor != null) {
editorWindow = findEditorWindow(project);
}
final LocalFileSystem fileSystem = LocalFileSystem.getInstance();
for (File file : fileList) {
final VirtualFile vFile = fileSystem.refreshAndFindFileByIoFile(file);
final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
if (vFile != null) {
if (editorWindow != null) {
fileEditorManager.openFileWithProviders(vFile, true, editorWindow);
}
else {
new OpenFileDescriptor(project, vFile).navigate(true);
}
}
}
}
示例11: findEditorWindow
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
@Nullable
private EditorWindow findEditorWindow(Project project) {
final Document document = myEditor.getDocument();
final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
if (file != null) {
final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
final EditorWindow[] windows = fileEditorManager.getWindows();
for (EditorWindow window : windows) {
final EditorWithProviderComposite composite = window.findFileComposite(file);
if (composite == null) {
continue;
}
for (FileEditor editor : composite.getEditors()) {
if (editor instanceof TextEditor && ((TextEditor)editor).getEditor() == myEditor) {
return window;
}
}
}
}
return null;
}
示例12: 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());
}
示例13: 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);
}
}
}
示例14: 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);
}
示例15: actionPerformed
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
FileEditorManagerEx editorManager = getEditorManager(project);
EditorWindow window = e.getData(EditorWindow.DATA_KEY);
VirtualFile file = null;
if (window == null) {
window = editorManager.getActiveWindow().getResult();
if (window != null) {
file = window.getSelectedFile();
}
}
else {
file = e.getData(CommonDataKeys.VIRTUAL_FILE);
}
if (file != null) {
editorManager.closeFile(file, window);
}
}