Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix close all and others commands #6994

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/api-tests/src/views.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('Views', function () {
assert.notEqual(view, undefined);
assert.equal(shell.getAreaFor(view), contribution.defaultViewOptions.area);
assert.isDefined(shell.getTabBarFor(view));
assert.equal(shell.getAreaFor(shell.getTabBarFor(view)), contribution.defaultViewOptions.area);
assert.isTrue(view.isVisible);
assert.equal(view, shell.activeWidget);

Expand Down
51 changes: 25 additions & 26 deletions packages/core/src/browser/shell/application-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,41 +1326,40 @@ export class ApplicationShell extends Widget {
* Determine the name of the shell area where the given widget resides. The result is
* undefined if the widget does not reside directly in the shell.
*/
getAreaFor(input: Widget): ApplicationShell.Area | undefined {
const widget = this.toTrackedStack(input.id).pop();
if (!widget) {
return undefined;
}
if (widget instanceof TabBar) {
if (find(this.mainPanel.tabBars(), tb => tb === widget)) {
return 'main';
}
if (find(this.bottomPanel.tabBars(), tb => tb === widget)) {
return 'bottom';
}
if (this.leftPanelHandler.tabBar === widget) {
return 'left';
}
if (this.rightPanelHandler.tabBar === widget) {
return 'right';
}
} else {
const title = widget.title;
const mainPanelTabBar = this.mainPanel.findTabBar(title);
if (mainPanelTabBar) {
getAreaFor(input: TabBar<Widget> | Widget): ApplicationShell.Area | undefined {
if (input instanceof TabBar) {
if (find(this.mainPanel.tabBars(), tb => tb === input)) {
return 'main';
}
const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
if (bottomPanelTabBar) {
if (find(this.bottomPanel.tabBars(), tb => tb === input)) {
return 'bottom';
}
if (ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
if (this.leftPanelHandler.tabBar === input) {
return 'left';
}
if (ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
if (this.rightPanelHandler.tabBar === input) {
return 'right';
}
}
const widget = this.toTrackedStack(input.id).pop();
if (!widget) {
return undefined;
}
const title = widget.title;
const mainPanelTabBar = this.mainPanel.findTabBar(title);
if (mainPanelTabBar) {
return 'main';
}
const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
if (bottomPanelTabBar) {
return 'bottom';
}
if (ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
return 'left';
}
if (ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
return 'right';
}
return undefined;
}

Expand Down