コード例 #1
0
 @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);
     }
   }
 }
コード例 #2
0
 @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);
     }
   }
 }
コード例 #3
0
    @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));
    }
コード例 #4
0
  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);
              }
            }
          }
        });
  }
コード例 #5
0
    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);
          }
        }
      }
    }