提交 a5109d24 编写于 作者: B Benjamin Pasero

fix #75354

上级 e7334909
......@@ -543,20 +543,9 @@ export class StatusbarPart extends Part implements IStatusbarService {
private getContextMenuActions(event: StandardMouseEvent): IAction[] {
const actions: Action[] = [];
// Figure out if mouse is over an entry
let statusEntryUnderMouse: IStatusbarViewModelEntry | undefined = undefined;
for (let element: HTMLElement | null = event.target; element; element = element.parentElement) {
const entry = this.viewModel.findEntry(element);
if (entry) {
statusEntryUnderMouse = entry;
break;
}
}
if (statusEntryUnderMouse) {
actions.push(new HideStatusbarEntryAction(statusEntryUnderMouse.id, this.viewModel));
actions.push(new Separator());
}
// Provide an action to hide the status bar at last
actions.push(this.instantiationService.createInstance(ToggleStatusbarVisibilityAction, ToggleStatusbarVisibilityAction.ID, nls.localize('hideStatusBar', "Hide Status Bar")));
actions.push(new Separator());
// Show an entry per known status entry
// Note: even though entries have an identifier, there can be multiple entries
......@@ -570,9 +559,20 @@ export class StatusbarPart extends Part implements IStatusbarService {
}
});
// Provide an action to hide the status bar at last
actions.push(new Separator());
actions.push(this.instantiationService.createInstance(ToggleStatusbarVisibilityAction, ToggleStatusbarVisibilityAction.ID, nls.localize('hideStatusBar', "Hide Status Bar")));
// Figure out if mouse is over an entry
let statusEntryUnderMouse: IStatusbarViewModelEntry | undefined = undefined;
for (let element: HTMLElement | null = event.target; element; element = element.parentElement) {
const entry = this.viewModel.findEntry(element);
if (entry) {
statusEntryUnderMouse = entry;
break;
}
}
if (statusEntryUnderMouse) {
actions.push(new Separator());
actions.push(new HideStatusbarEntryAction(statusEntryUnderMouse.id, this.viewModel));
}
return actions;
}
......
......@@ -189,12 +189,20 @@ export class StatusBarController implements IWorkbenchContribution {
const disposables = new DisposableStore();
for (const c of commands) {
const statusId = `status.scm.${repository.provider.id}.${c.tooltip}`; // needs to be unique, but c.id is too random
let statusLabel: string;
if (c.tooltip) {
statusLabel = localize('status.scm', "Source Control ({0}): {1}", repository.provider.label, c.tooltip.replace('...', ''));
} else {
statusLabel = localize('status.scm.short', "Source Control ({0})", repository.provider.label);
}
disposables.add(this.statusbarService.addEntry({
text: c.title,
tooltip: `${label} - ${c.tooltip}`,
command: c.id,
arguments: c.arguments
}, 'status.scm', localize('status.scm', "Source Control"), MainThreadStatusBarAlignment.LEFT, 10000));
}, statusId, statusLabel, MainThreadStatusBarAlignment.LEFT, 10000));
}
this.statusBarDisposable = disposables;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册