Skip to content

Commit

Permalink
Make FileSystemCommands.UPLOAD to return FileUploadResult
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Epstein <tomer.epstein@sap.com>
  • Loading branch information
tomer-epstein authored and amiramw committed Dec 3, 2020
1 parent e3e323e commit 75bf8df
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { MimeService } from '@theia/core/lib/browser/mime-service';
import { TreeWidgetSelection } from '@theia/core/lib/browser/tree/tree-widget-selection';
import { FileSystemPreferences } from './filesystem-preferences';
import { FileSelection } from './file-selection';
import { FileUploadService } from './file-upload-service';
import { FileUploadService, FileUploadResult } from './file-upload-service';
import { FileService, UserFileOperationEvent } from './file-service';
import { FileChangesEvent, FileChangeType, FileOperation } from '../common/files';
import { Deferred } from '@theia/core/lib/common/promise-util';
Expand Down Expand Up @@ -128,13 +128,14 @@ export class FileSystemFrontendContribution implements FrontendApplicationContri
return !environment.electron.is() && fileStat.isDirectory;
}

protected async upload(selection: FileSelection): Promise<void> {
protected async upload(selection: FileSelection): Promise<FileUploadResult | undefined> {
try {
const source = TreeWidgetSelection.getSource(this.selectionService.selection);
await this.uploadService.upload(selection.fileStat.resource);
const fileUploadResult = await this.uploadService.upload(selection.fileStat.resource);
if (ExpandableTreeNode.is(selection) && source) {
await source.model.expandNode(selection);
}
return fileUploadResult;
} catch (e) {
if (!isCancelled(e)) {
console.error(e);
Expand Down

0 comments on commit 75bf8df

Please sign in to comment.