diff --git a/packages/core/src/browser/style/dialog.css b/packages/core/src/browser/style/dialog.css index abac64c4144d3..af1b163a6690e 100644 --- a/packages/core/src/browser/style/dialog.css +++ b/packages/core/src/browser/style/dialog.css @@ -105,3 +105,25 @@ font-size: var(--theia-ui-font-size1); display: block; } + +.theia-dialog-node { + line-height: var(--theia-content-line-height); + margin-top: calc(var(--theia-ui-padding)*1.5); + margin-left: calc(var(--theia-ui-padding)*2.5); +} + +.theia-dialog-node-content { + display: flex; + align-items: center; + margin-right: calc(var(--theia-ui-padding)*1.5);} + +.theia-dialog-node-segment { + flex-grow: 0; + user-select: none; + white-space: nowrap; +} + +.theia-dialog-icon { + align-content: center; + margin-right: calc(var(--theia-ui-padding)*1.5); +} diff --git a/packages/workspace/src/browser/workspace-commands.ts b/packages/workspace/src/browser/workspace-commands.ts index a81ff7fb66a42..0a9ef07795c47 100644 --- a/packages/workspace/src/browser/workspace-commands.ts +++ b/packages/workspace/src/browser/workspace-commands.ts @@ -403,17 +403,30 @@ export class WorkspaceCommandContribution implements CommandContribution { }; } + /** + * Removes the list of folders from the workspace upon confirmation from the user. + * @param uris the list of folder uris to remove. + */ protected async removeFolderFromWorkspace(uris: URI[]): Promise { - const roots = new Set(this.workspaceService.tryGetRoots().map(r => r.uri)); - const toRemove = uris.filter(u => roots.has(u.toString())); + const roots = new Set(this.workspaceService.tryGetRoots().map(root => root.uri)); + const toRemove = uris.filter(uri => roots.has(uri.toString())); if (toRemove.length > 0) { const messageContainer = document.createElement('div'); - messageContainer.textContent = 'Remove the following folders from workspace? (note: nothing will be erased from disk)'; - const list = document.createElement('ul'); - list.style.listStyleType = 'none'; - toRemove.forEach(u => { - const listItem = document.createElement('li'); - listItem.textContent = u.displayName; + messageContainer.textContent = `Are you sure you want to remove the following folder${toRemove.length > 1 ? 's' : ''} from the workspace?`; + messageContainer.title = 'Note: Nothing will be erased from disk'; + const list = document.createElement('div'); + list.classList.add('theia-dialog-node'); + toRemove.forEach(uri => { + const listItem = document.createElement('div'); + listItem.classList.add('theia-dialog-node-content'); + const folderIcon = document.createElement('span'); + folderIcon.classList.add('codicon', 'codicon-root-folder', 'theia-dialog-icon'); + listItem.appendChild(folderIcon); + listItem.title = this.labelProvider.getLongName(uri); + const listContent = document.createElement('span'); + listContent.classList.add('theia-dialog-node-segment'); + listContent.appendChild(document.createTextNode(uri.displayName)); + listItem.appendChild(listContent); list.appendChild(listItem); }); messageContainer.appendChild(list);