Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4d94c72

Browse files
author
Alberto Iannaccone
committed
use same dialog for new file and rename
1 parent 5197920 commit 4d94c72

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

‎arduino-ide-extension/src/browser/theia/workspace/workspace-commands.ts‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
SketchesServiceClientImpl,
1818
} from '../../../common/protocol/sketches-service-client-impl';
1919
import { SaveAsSketch } from '../../contributions/save-as-sketch';
20-
import { SingleTextInputDialog } from '@theia/core/lib/browser';
2120
import { nls } from '@theia/core/lib/common';
2221

2322
@injectable()
@@ -161,20 +160,26 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
161160
return;
162161
}
163162
const initialValue = uri.path.base;
164-
const dialog = new SingleTextInputDialog({
165-
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
166-
initialValue,
167-
initialSelectionRange: {
168-
start: 0,
169-
end: uri.path.name.length,
170-
},
171-
validate: (name, mode) => {
172-
if (initialValue === name && mode === 'preview') {
173-
return false;
174-
}
175-
return this.validateFileName(name, parent, false);
163+
const parentUri = parent.resource;
164+
165+
const dialog = new WorkspaceInputDialog(
166+
{
167+
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
168+
initialValue,
169+
parentUri,
170+
initialSelectionRange: {
171+
start: 0,
172+
end: uri.path.name.length,
173+
},
174+
validate: (name, mode) => {
175+
if (initialValue === name && mode === 'preview') {
176+
return false;
177+
}
178+
return this.validateFileName(name, parent, false);
179+
},
176180
},
177-
});
181+
this.labelProvider
182+
);
178183
const newName = await dialog.open();
179184
const newNameWithExt = this.maybeAppendInoExt(newName);
180185
if (newNameWithExt) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /