Ver código fonte

Use internal dock panel's currentChanged signal instead of creating a shell-specific focus tracker.

Afshin Darian 8 anos atrás
pai
commit
ef4cd21788
1 arquivos alterados com 3 adições e 11 exclusões
  1. 3 11
      src/application/shell.ts

+ 3 - 11
src/application/shell.ts

@@ -16,10 +16,6 @@ import {
   DockPanel
 } from 'phosphor/lib/ui/dockpanel';
 
-import {
-  FocusTracker
-} from 'phosphor/lib/ui/focustracker';
-
 import {
   each
 } from 'phosphor/lib/algorithm/iteration';
@@ -145,8 +141,7 @@ class ApplicationShell extends Widget {
 
     this.layout = rootLayout;
 
-    this._tracker = new FocusTracker<Widget>();
-    this._tracker.currentChanged.connect((sender, args) => {
+    this._dockPanel.currentChanged.connect((sender, args) => {
       if (args.newValue) {
         args.newValue.title.className += ` ${CURRENT_CLASS}`;
       }
@@ -216,7 +211,6 @@ class ApplicationShell extends Widget {
       return;
     }
     this._dockPanel.addWidget(widget, { mode: 'tab-after' });
-    this._tracker.add(widget);
   }
 
   /**
@@ -262,9 +256,7 @@ class ApplicationShell extends Widget {
    * Close all tracked widgets.
    */
   closeAll(): void {
-    each(this._tracker.widgets, widget => {
-      widget.close();
-    });
+    each(this._dockPanel.widgets, widget => { widget.close(); });
   }
 
   private _topPanel: Panel;
@@ -273,7 +265,6 @@ class ApplicationShell extends Widget {
   private _hsplitPanel: SplitPanel;
   private _leftHandler: SideBarHandler;
   private _rightHandler: SideBarHandler;
-  private _tracker: FocusTracker<Widget>;
 }
 
 
@@ -321,6 +312,7 @@ class SideBarHandler {
     let widget = this._findWidgetByID(id);
     if (widget) {
       this._sideBar.currentTitle = widget.title;
+      widget.activate();
     }
   }