Skip to content

Commit

Permalink
Add 'title' for widgets in the sidebar
Browse files Browse the repository at this point in the history
- added `title` to widgets present in the sidebar by using the widget's caption.
- added `caption` title to view containers.
- adjusted the `explorer` to display the workpace uri path when hovering over
the widget's title.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Aug 15, 2019
1 parent 17bfcb2 commit ae5047b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/core/src/browser/shell/side-panel-toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class SidePanelToolbar extends BaseWidget {
if (this.titleContainer && title) {
this._toolbarTitle = title;
this.titleContainer.innerHTML = this._toolbarTitle.label;
this.titleContainer.title = this._toolbarTitle.caption || this._toolbarTitle.label;
this.update();
}
}
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/browser/view-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,13 @@ export class ViewContainerPart extends BaseWidget {
const title = document.createElement('span');
title.classList.add('label', 'noselect');
const updateTitle = () => title.innerText = this.wrapped.title.label;
const updateCaption = () => title.title = this.wrapped.title.caption || this.wrapped.title.label;
updateTitle();
disposable.push(this.onTitleChanged(updateTitle));
updateCaption();
disposable.pushAll([
this.onTitleChanged(updateTitle),
this.onTitleChanged(updateCaption)
]);
header.appendChild(title);
return {
header,
Expand Down
9 changes: 7 additions & 2 deletions packages/navigator/src/browser/navigator-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { injectable, inject, postConstruct } from 'inversify';
import { Message } from '@phosphor/messaging';
import URI from '@theia/core/lib/common/uri';
import { CommandService, SelectionService } from '@theia/core/lib/common';
import { CommonCommands, CorePreferences } from '@theia/core/lib/browser';
import { CommonCommands, CorePreferences, LabelProvider } from '@theia/core/lib/browser';
import {
ContextMenuRenderer, ExpandableTreeNode,
TreeProps, TreeModel, TreeNode,
Expand All @@ -44,6 +44,8 @@ export class FileNavigatorWidget extends FileTreeWidget {

@inject(CorePreferences) protected readonly corePreferences: CorePreferences;

@inject(LabelProvider) protected readonly labelProvider: LabelProvider;

@inject(NavigatorContextKeyService)
protected readonly contextKeyService: NavigatorContextKeyService;

Expand Down Expand Up @@ -106,12 +108,15 @@ export class FileNavigatorWidget extends FileTreeWidget {
const rootNode = this.model.root.children[0];
if (WorkspaceRootNode.is(rootNode)) {
this.title.label = rootNode.name;
this.title.caption = this.labelProvider.getLongName(rootNode.uri);
}
} else {
this.title.label = this.model.root.name;
this.title.caption = this.title.label;
}
} else {
this.title.caption = this.title.label;
}
this.title.caption = this.title.label;
}

protected enableDndOnMainPanel(): void {
Expand Down

0 comments on commit ae5047b

Please sign in to comment.