@Override public void mouseClicked(MouseEvent e) { if (UIUtil.isActionClick(e, MouseEvent.MOUSE_CLICKED) && (e.isMetaDown() || (!SystemInfo.isMac && e.isControlDown()))) { final TabInfo info = myTabs.findInfo(e); if (info != null && info.getObject() != null) { final VirtualFile vFile = (VirtualFile) info.getObject(); ShowFilePathAction.show(vFile, e); } } }
@Override public void mouseReleased(MouseEvent e) { if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_RELEASED)) { final TabInfo info = myTabs.findInfo(e); if (info != null) { IdeEventQueue.getInstance().blockNextEvents(e); FileEditorManagerEx.getInstanceEx(myProject) .closeFile((VirtualFile) info.getObject(), myWindow); } } }
@Override public void dragOutStarted(MouseEvent mouseEvent, TabInfo info) { final TabInfo previousSelection = info.getPreviousSelection(); final Image img = myTabs.getComponentImage(info); info.setHidden(true); if (previousSelection != null) { myTabs.select(previousSelection, true); } myFile = (VirtualFile) info.getObject(); Presentation presentation = new Presentation(info.getText()); presentation.setIcon(info.getIcon()); mySession = getDockManager() .createDragSession( mouseEvent, new DockableEditor(img, myFile, presentation, myWindow)); }
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 AsyncResult.Handler<EditorWindow>() { @Override public void run(EditorWindow wnd) { if (wnd != null) { if (wnd.findFileComposite(file) != null) { mgr.closeFile(file, wnd); } } } }); }
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); } } } }