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

[DialogBox] : Improve display for remove folder from workspace #7449

Merged
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
22 changes: 22 additions & 0 deletions packages/core/src/browser/style/dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
29 changes: 21 additions & 8 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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);
Expand Down