コード例 #1
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);
              }
            }
          }
        });
  }
コード例 #2
0
 @Nullable
 public Object getSelectedComponent() {
   final TabInfo info = myTabs.getTargetInfo();
   return info != null ? info.getComponent() : null;
 }