Skip to content

Commit

Permalink
in order to test #5859
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov committed Aug 6, 2019
1 parent 5f0a29c commit 492d02a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/filesystem/src/browser/file-dialog/file-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { injectable, inject } from 'inversify';
import { Message } from '@phosphor/messaging';
import { Disposable, MaybeArray } from '@theia/core/lib/common';
import { Key } from '@theia/core/lib/browser';
import { Key, SingleTextInputDialog } from '@theia/core/lib/browser';
import { AbstractDialog, DialogProps, setEnabled, createIconButton, Widget } from '@theia/core/lib/browser';
import { FileStatNode } from '../file-tree';
import { LocationListRenderer } from '../location';
Expand Down Expand Up @@ -237,6 +237,8 @@ export abstract class FileDialog<T> extends AbstractDialog<T> {
@injectable()
export class OpenFileDialog extends FileDialog<MaybeArray<FileStatNode>> {

protected openButton: HTMLButtonElement | undefined;

constructor(
@inject(OpenFileDialogProps) readonly props: OpenFileDialogProps,
@inject(FileDialogWidget) readonly widget: FileDialogWidget
Expand All @@ -245,6 +247,22 @@ export class OpenFileDialog extends FileDialog<MaybeArray<FileStatNode>> {
if (props.canSelectFiles !== undefined) {
this.widget.disableFileSelection = !props.canSelectFiles;
}
this.openButton = this.createButton('open single text');
this.controlPanel.appendChild(this.openButton);
this.openButton.classList.add('main');
this.openButton.addEventListener('click', () => this.openInputDialog());
}

private openInputDialog(): void {
const dialog = new SingleTextInputDialog({
title: 'New File',
initialValue: '12131'
});
dialog.open().then((name: string) => {
if (name) {
console.log(name);
}
});
}

protected getAcceptButtonLabel(): string {
Expand Down

0 comments on commit 492d02a

Please sign in to comment.