提交 721e3cf6 编写于 作者: J Joao Moreno

Merge branch 'joao/scm-views'

fixes #49054
......@@ -133,7 +133,6 @@ export abstract class Panel implements IView {
this._expanded = !!expanded;
this.updateHeader();
this._onDidChange.fire(expanded ? this.expandedSize : undefined);
if (expanded) {
if (typeof this.animationTimer === 'number') {
......@@ -146,6 +145,7 @@ export abstract class Panel implements IView {
}, 200);
}
this._onDidChange.fire(expanded ? this.expandedSize : undefined);
return true;
}
......
......@@ -173,6 +173,13 @@ export abstract class Composite extends Component implements IComposite {
return null;
}
/**
* Provide a context to be passed to the toolbar.
*/
getActionsContext(): any {
return null;
}
/**
* Returns the instance of IActionRunner to use with this composite for the
* composite tool bar.
......
......@@ -342,6 +342,9 @@ export abstract class CompositePart<T extends Composite> extends Part {
primaryActions.push(...this.getActions());
secondaryActions.push(...this.getSecondaryActions());
// Update context
this.toolBar.context = this.actionsContextProvider();
// Return fn to set into toolbar
return this.toolBar.setActions(prepareActions(primaryActions), prepareActions(secondaryActions));
}
......@@ -438,6 +441,16 @@ export abstract class CompositePart<T extends Composite> extends Part {
return null;
}
protected actionsContextProvider(): any {
// Check Active Composite
if (this.activeComposite) {
return this.activeComposite.getActionsContext();
}
return null;
}
createContentArea(parent: HTMLElement): HTMLElement {
const contentContainer = append(parent, $('.content'));
......
......@@ -43,7 +43,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
private readonly visibleViewsCountFromCache: number;
private readonly visibleViewsStorageId: string;
private readonly viewsModel: PersistentContributableViewsModel;
protected readonly viewsModel: PersistentContributableViewsModel;
private viewDisposables: IDisposable[] = [];
constructor(
......
......@@ -13,6 +13,8 @@
}
.scm-viewlet .empty-message {
box-sizing: border-box;
height: 100%;
padding: 10px 22px 0 22px;
}
......
......@@ -38,16 +38,13 @@ class OpenSCMViewletAction extends ShowViewletAction {
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(DirtyDiffWorkbenchController, LifecyclePhase.Restored);
const viewletDescriptor = new ViewletDescriptor(
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(new ViewletDescriptor(
SCMViewlet,
VIEWLET_ID,
localize('source control', "Source Control"),
'scm',
2
);
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets)
.registerViewlet(viewletDescriptor);
));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册