mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-18 16:56:33 +00:00
Translating Arduino-IDE using Theia's nls API (#545)
This commit is contained in:
parent
61262c23ac
commit
11b75bd610
@ -16,6 +16,7 @@ import {
|
|||||||
StatusBar,
|
StatusBar,
|
||||||
StatusBarAlignment,
|
StatusBarAlignment,
|
||||||
} from '@theia/core/lib/browser';
|
} from '@theia/core/lib/browser';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
||||||
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
||||||
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution';
|
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution';
|
||||||
@ -225,7 +226,10 @@ export class ArduinoFrontendContribution
|
|||||||
if (!window.navigator.onLine) {
|
if (!window.navigator.onLine) {
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
this.messageService.warn(
|
this.messageService.warn(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/common/offlineIndicator',
|
||||||
'You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.'
|
'You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const updateStatusBar = ({
|
const updateStatusBar = ({
|
||||||
@ -236,15 +240,22 @@ export class ArduinoFrontendContribution
|
|||||||
alignment: StatusBarAlignment.RIGHT,
|
alignment: StatusBarAlignment.RIGHT,
|
||||||
text: selectedBoard
|
text: selectedBoard
|
||||||
? `$(microchip) ${selectedBoard.name}`
|
? `$(microchip) ${selectedBoard.name}`
|
||||||
: '$(close) no board selected',
|
: `$(close) ${nls.localize(
|
||||||
|
'arduino/common/noBoardSelected',
|
||||||
|
'No board selected'
|
||||||
|
)}`,
|
||||||
className: 'arduino-selected-board',
|
className: 'arduino-selected-board',
|
||||||
});
|
});
|
||||||
if (selectedBoard) {
|
if (selectedBoard) {
|
||||||
this.statusBar.setElement('arduino-selected-port', {
|
this.statusBar.setElement('arduino-selected-port', {
|
||||||
alignment: StatusBarAlignment.RIGHT,
|
alignment: StatusBarAlignment.RIGHT,
|
||||||
text: selectedPort
|
text: selectedPort
|
||||||
? `on ${Port.toString(selectedPort)}`
|
? nls.localize(
|
||||||
: '[not connected]',
|
'arduino/common/selectedOn',
|
||||||
|
'on {0}',
|
||||||
|
Port.toString(selectedPort)
|
||||||
|
)
|
||||||
|
: nls.localize('arduino/common/notConnected', '[not connected]'),
|
||||||
className: 'arduino-selected-port',
|
className: 'arduino-selected-port',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -437,7 +448,7 @@ export class ArduinoFrontendContribution
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: 'toggle-serial-monitor',
|
id: 'toggle-serial-monitor',
|
||||||
command: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR,
|
command: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR,
|
||||||
tooltip: 'Serial Monitor',
|
tooltip: nls.localize('arduino/common/serialMonitor', 'Serial Monitor'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,11 +483,20 @@ export class ArduinoFrontendContribution
|
|||||||
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(TerminalMenus.TERMINAL));
|
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(TerminalMenus.TERMINAL));
|
||||||
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(CommonMenus.VIEW));
|
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(CommonMenus.VIEW));
|
||||||
|
|
||||||
registry.registerSubmenu(ArduinoMenus.SKETCH, 'Sketch');
|
registry.registerSubmenu(
|
||||||
registry.registerSubmenu(ArduinoMenus.TOOLS, 'Tools');
|
ArduinoMenus.SKETCH,
|
||||||
|
nls.localize('arduino/menu/sketch', 'Sketch')
|
||||||
|
);
|
||||||
|
registry.registerSubmenu(
|
||||||
|
ArduinoMenus.TOOLS,
|
||||||
|
nls.localize('arduino/menu/tools', 'Tools')
|
||||||
|
);
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
||||||
commandId: ArduinoCommands.TOGGLE_COMPILE_FOR_DEBUG.id,
|
commandId: ArduinoCommands.TOGGLE_COMPILE_FOR_DEBUG.id,
|
||||||
label: 'Optimize for Debugging',
|
label: nls.localize(
|
||||||
|
'arduino/debug/optimizeForDebugging',
|
||||||
|
'Optimize for Debugging'
|
||||||
|
),
|
||||||
order: '4',
|
order: '4',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -490,11 +510,16 @@ export class ArduinoFrontendContribution
|
|||||||
}
|
}
|
||||||
await this.ensureOpened(mainFileUri, true);
|
await this.ensureOpened(mainFileUri, true);
|
||||||
if (mainFileUri.endsWith('.pde')) {
|
if (mainFileUri.endsWith('.pde')) {
|
||||||
const message = `The '${sketch.name}' still uses the old \`.pde\` format. Do you want to switch to the new \`.ino\` extension?`;
|
const message = nls.localize(
|
||||||
|
'arduino/common/oldFormat',
|
||||||
|
"The '{0}' still uses the old `.pde` format. Do you want to switch to the new `.ino` extension?",
|
||||||
|
sketch.name
|
||||||
|
);
|
||||||
|
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
|
||||||
this.messageService
|
this.messageService
|
||||||
.info(message, 'Later', 'Yes')
|
.info(message, nls.localize('arduino/common/later', 'Later'), yes)
|
||||||
.then(async (answer) => {
|
.then(async (answer) => {
|
||||||
if (answer === 'Yes') {
|
if (answer === yes) {
|
||||||
this.commandRegistry.executeCommand(
|
this.commandRegistry.executeCommand(
|
||||||
SaveAsSketch.Commands.SAVE_AS_SKETCH.id,
|
SaveAsSketch.Commands.SAVE_AS_SKETCH.id,
|
||||||
{
|
{
|
||||||
|
@ -253,6 +253,7 @@ import {
|
|||||||
UploadCertificateDialogProps,
|
UploadCertificateDialogProps,
|
||||||
UploadCertificateDialogWidget,
|
UploadCertificateDialogWidget,
|
||||||
} from './dialogs/certificate-uploader/certificate-uploader-dialog';
|
} from './dialogs/certificate-uploader/certificate-uploader-dialog';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
||||||
|
|
||||||
@ -371,7 +372,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
bind(BoardsConfigDialogWidget).toSelf().inSingletonScope();
|
bind(BoardsConfigDialogWidget).toSelf().inSingletonScope();
|
||||||
bind(BoardsConfigDialog).toSelf().inSingletonScope();
|
bind(BoardsConfigDialog).toSelf().inSingletonScope();
|
||||||
bind(BoardsConfigDialogProps).toConstantValue({
|
bind(BoardsConfigDialogProps).toConstantValue({
|
||||||
title: 'Select Board',
|
title: nls.localize('arduino/common/selectBoard', 'Select Board'),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Core service
|
// Core service
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
PreferenceContribution,
|
PreferenceContribution,
|
||||||
PreferenceSchema,
|
PreferenceSchema,
|
||||||
} from '@theia/core/lib/browser/preferences';
|
} from '@theia/core/lib/browser/preferences';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import { CompilerWarningLiterals, CompilerWarnings } from '../common/protocol';
|
import { CompilerWarningLiterals, CompilerWarnings } from '../common/protocol';
|
||||||
|
|
||||||
export const ArduinoConfigSchema: PreferenceSchema = {
|
export const ArduinoConfigSchema: PreferenceSchema = {
|
||||||
@ -13,24 +14,34 @@ export const ArduinoConfigSchema: PreferenceSchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
'arduino.language.log': {
|
'arduino.language.log': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
"True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default.",
|
'arduino/preferences/language.log',
|
||||||
|
"True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default."
|
||||||
|
),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
'arduino.compile.verbose': {
|
'arduino.compile.verbose': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: 'True for verbose compile output. False by default',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/compile.verbose',
|
||||||
|
'True for verbose compile output. False by default'
|
||||||
|
),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
'arduino.compile.warnings': {
|
'arduino.compile.warnings': {
|
||||||
enum: [...CompilerWarningLiterals],
|
enum: [...CompilerWarningLiterals],
|
||||||
description:
|
description: nls.localize(
|
||||||
"Tells gcc which warning level to use. It's 'None' by default",
|
'arduino/preferences/compile.warnings',
|
||||||
|
"Tells gcc which warning level to use. It's 'None' by default"
|
||||||
|
),
|
||||||
default: 'None',
|
default: 'None',
|
||||||
},
|
},
|
||||||
'arduino.upload.verbose': {
|
'arduino.upload.verbose': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: 'True for verbose upload output. False by default.',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/upload.verbose',
|
||||||
|
'True for verbose upload output. False by default.'
|
||||||
|
),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
'arduino.upload.verify': {
|
'arduino.upload.verify': {
|
||||||
@ -39,81 +50,114 @@ export const ArduinoConfigSchema: PreferenceSchema = {
|
|||||||
},
|
},
|
||||||
'arduino.window.autoScale': {
|
'arduino.window.autoScale': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True if the user interface automatically scales with the font size.',
|
'arduino/preferences/window.autoScale',
|
||||||
|
'True if the user interface automatically scales with the font size.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.window.zoomLevel': {
|
'arduino.window.zoomLevel': {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description:
|
description: nls.localize(
|
||||||
'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.',
|
'arduino/preferences/window.zoomLevel',
|
||||||
|
'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.'
|
||||||
|
),
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
'arduino.ide.autoUpdate': {
|
'arduino.ide.autoUpdate': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True to enable automatic update checks. The IDE will check for updates automatically and periodically.',
|
'arduino/preferences/ide.autoUpdate',
|
||||||
|
'True to enable automatic update checks. The IDE will check for updates automatically and periodically.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.board.certificates': {
|
'arduino.board.certificates': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'List of certificates that can be uploaded to boards',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/board.certificates',
|
||||||
|
'List of certificates that can be uploaded to boards'
|
||||||
|
),
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
'arduino.sketchbook.showAllFiles': {
|
'arduino.sketchbook.showAllFiles': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True to show all sketch files inside the sketch. It is false by default.',
|
'arduino/preferences/sketchbook.showAllFiles',
|
||||||
|
'True to show all sketch files inside the sketch. It is false by default.'
|
||||||
|
),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
'arduino.cloud.enabled': {
|
'arduino.cloud.enabled': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True if the sketch sync functions are enabled. Defaults to true.',
|
'arduino/preferences/cloud.enabled',
|
||||||
|
'True if the sketch sync functions are enabled. Defaults to true.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.cloud.pull.warn': {
|
'arduino.cloud.pull.warn': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True if users should be warned before pulling a cloud sketch. Defaults to true.',
|
'arduino/preferences/cloud.pull.warn',
|
||||||
|
'True if users should be warned before pulling a cloud sketch. Defaults to true.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.cloud.push.warn': {
|
'arduino.cloud.push.warn': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True if users should be warned before pushing a cloud sketch. Defaults to true.',
|
'arduino/preferences/cloud.push.warn',
|
||||||
|
'True if users should be warned before pushing a cloud sketch. Defaults to true.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.cloud.pushpublic.warn': {
|
'arduino.cloud.pushpublic.warn': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description: nls.localize(
|
||||||
'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.',
|
'arduino/preferences/cloud.pushpublic.warn',
|
||||||
|
'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.'
|
||||||
|
),
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
'arduino.cloud.sketchSyncEnpoint': {
|
'arduino.cloud.sketchSyncEnpoint': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description:
|
description: nls.localize(
|
||||||
'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.',
|
'arduino/preferences/cloud.sketchSyncEnpoint',
|
||||||
|
'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.'
|
||||||
|
),
|
||||||
default: 'https://api2.arduino.cc/create',
|
default: 'https://api2.arduino.cc/create',
|
||||||
},
|
},
|
||||||
'arduino.auth.clientID': {
|
'arduino.auth.clientID': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The OAuth2 client ID.',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/auth.clientID',
|
||||||
|
'The OAuth2 client ID.'
|
||||||
|
),
|
||||||
default: 'C34Ya6ex77jTNxyKWj01lCe1vAHIaPIo',
|
default: 'C34Ya6ex77jTNxyKWj01lCe1vAHIaPIo',
|
||||||
},
|
},
|
||||||
'arduino.auth.domain': {
|
'arduino.auth.domain': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The OAuth2 domain.',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/auth.domain',
|
||||||
|
'The OAuth2 domain.'
|
||||||
|
),
|
||||||
default: 'login.arduino.cc',
|
default: 'login.arduino.cc',
|
||||||
},
|
},
|
||||||
'arduino.auth.audience': {
|
'arduino.auth.audience': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The 0Auth2 audience.',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/auth.audience',
|
||||||
|
'The OAuth2 audience.'
|
||||||
|
),
|
||||||
default: 'https://api.arduino.cc',
|
default: 'https://api.arduino.cc',
|
||||||
},
|
},
|
||||||
'arduino.auth.registerUri': {
|
'arduino.auth.registerUri': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The URI used to register a new user.',
|
description: nls.localize(
|
||||||
|
'arduino/preferences/auth.registerUri',
|
||||||
|
'The URI used to register a new user.'
|
||||||
|
),
|
||||||
default: 'https://auth.arduino.cc/login#/register',
|
default: 'https://auth.arduino.cc/login#/register',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
import { Command } from '@theia/core/lib/common/command';
|
import { Command } from '@theia/core/lib/common/command';
|
||||||
|
|
||||||
export namespace CloudUserCommands {
|
export namespace CloudUserCommands {
|
||||||
export const LOGIN: Command = {
|
export const LOGIN = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud--login',
|
id: 'arduino-cloud--login',
|
||||||
label: 'Sign in',
|
label: 'Sign in',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/signIn'
|
||||||
|
);
|
||||||
|
|
||||||
export const LOGOUT: Command = {
|
export const LOGOUT = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud--logout',
|
id: 'arduino-cloud--logout',
|
||||||
label: 'Sign Out',
|
label: 'Sign Out',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/signOut'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
|
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
|
||||||
id: 'arduino-cloud-sketchbook--open-profile-menu',
|
id: 'arduino-cloud-sketchbook--open-profile-menu',
|
||||||
|
@ -10,6 +10,7 @@ import { BoardsServiceProvider } from './boards-service-provider';
|
|||||||
import { BoardsConfig } from './boards-config';
|
import { BoardsConfig } from './boards-config';
|
||||||
import { Installable, ResponseServiceArduino } from '../../common/protocol';
|
import { Installable, ResponseServiceArduino } from '../../common/protocol';
|
||||||
import { BoardsListWidgetFrontendContribution } from './boards-widget-frontend-contribution';
|
import { BoardsListWidgetFrontendContribution } from './boards-widget-frontend-contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens on `BoardsConfig.Config` changes, if a board is selected which does not
|
* Listens on `BoardsConfig.Config` changes, if a board is selected which does not
|
||||||
@ -81,12 +82,23 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
|
|||||||
const version = candidate.availableVersions[0]
|
const version = candidate.availableVersions[0]
|
||||||
? `[v ${candidate.availableVersions[0]}]`
|
? `[v ${candidate.availableVersions[0]}]`
|
||||||
: '';
|
: '';
|
||||||
|
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
|
||||||
|
const manualInstall = nls.localize(
|
||||||
|
'arduino/board/installManually',
|
||||||
|
'Install Manually'
|
||||||
|
);
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
this.messageService
|
this.messageService
|
||||||
.info(
|
.info(
|
||||||
`The \`"${candidate.name} ${version}"\` core has to be installed for the currently selected \`"${selectedBoard.name}"\` board. Do you want to install it now?`,
|
nls.localize(
|
||||||
'Install Manually',
|
'arduino/board/installNow',
|
||||||
'Yes'
|
'The "{0} {1}" core has to be installed for the currently selected "{2}" board. Do you want to install it now?',
|
||||||
|
candidate.name,
|
||||||
|
version,
|
||||||
|
selectedBoard.name
|
||||||
|
),
|
||||||
|
manualInstall,
|
||||||
|
yes
|
||||||
)
|
)
|
||||||
.then(async (answer) => {
|
.then(async (answer) => {
|
||||||
const index = this.notifications.findIndex((board) =>
|
const index = this.notifications.findIndex((board) =>
|
||||||
@ -95,7 +107,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
|
|||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.notifications.splice(index, 1);
|
this.notifications.splice(index, 1);
|
||||||
}
|
}
|
||||||
if (answer === 'Yes') {
|
if (answer === yes) {
|
||||||
await Installable.installWithProgress({
|
await Installable.installWithProgress({
|
||||||
installable: this.boardsService,
|
installable: this.boardsService,
|
||||||
item: candidate,
|
item: candidate,
|
||||||
@ -105,7 +117,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (answer === 'Install Manually') {
|
if (answer === manualInstall) {
|
||||||
this.boardsManagerFrontendContribution
|
this.boardsManagerFrontendContribution
|
||||||
.openView({ reveal: true })
|
.openView({ reveal: true })
|
||||||
.then((widget) =>
|
.then((widget) =>
|
||||||
|
@ -6,6 +6,7 @@ import { BoardsConfig } from './boards-config';
|
|||||||
import { BoardsService } from '../../common/protocol/boards-service';
|
import { BoardsService } from '../../common/protocol/boards-service';
|
||||||
import { BoardsServiceProvider } from './boards-service-provider';
|
import { BoardsServiceProvider } from './boards-service-provider';
|
||||||
import { BoardsConfigDialogWidget } from './boards-config-dialog-widget';
|
import { BoardsConfigDialogWidget } from './boards-config-dialog-widget';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BoardsConfigDialogProps extends DialogProps {}
|
export class BoardsConfigDialogProps extends DialogProps {}
|
||||||
@ -32,8 +33,10 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
|
|||||||
this.contentNode.classList.add('select-board-dialog');
|
this.contentNode.classList.add('select-board-dialog');
|
||||||
this.contentNode.appendChild(this.createDescription());
|
this.contentNode.appendChild(this.createDescription());
|
||||||
|
|
||||||
this.appendCloseButton('CANCEL');
|
this.appendCloseButton(
|
||||||
this.appendAcceptButton('OK');
|
nls.localize('vscode/issueMainService/cancel', 'Cancel')
|
||||||
|
);
|
||||||
|
this.appendAcceptButton(nls.localize('vscode/issueMainService/ok', 'OK'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@postConstruct()
|
@postConstruct()
|
||||||
@ -63,7 +66,10 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
|
|||||||
head.classList.add('head');
|
head.classList.add('head');
|
||||||
|
|
||||||
const title = document.createElement('div');
|
const title = document.createElement('div');
|
||||||
title.textContent = 'Select Other Board & Port';
|
title.textContent = nls.localize(
|
||||||
|
'arduino/board/configDialogTitle',
|
||||||
|
'Select Other Board & Port'
|
||||||
|
);
|
||||||
title.classList.add('title');
|
title.classList.add('title');
|
||||||
head.appendChild(title);
|
head.appendChild(title);
|
||||||
|
|
||||||
@ -72,8 +78,14 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
|
|||||||
head.appendChild(text);
|
head.appendChild(text);
|
||||||
|
|
||||||
for (const paragraph of [
|
for (const paragraph of [
|
||||||
'Select both a Board and a Port if you want to upload a sketch.',
|
nls.localize(
|
||||||
'If you only select a Board you will be able just to compile, but not to upload your sketch.',
|
'arduino/board/configDialog1',
|
||||||
|
'Select both a Board and a Port if you want to upload a sketch.'
|
||||||
|
),
|
||||||
|
nls.localize(
|
||||||
|
'arduino/board/configDialog2',
|
||||||
|
'If you only select a Board you will be able just to compile, but not to upload your sketch.'
|
||||||
|
),
|
||||||
]) {
|
]) {
|
||||||
const p = document.createElement('div');
|
const p = document.createElement('div');
|
||||||
p.textContent = paragraph;
|
p.textContent = paragraph;
|
||||||
@ -117,7 +129,10 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
|
|||||||
protected isValid(value: BoardsConfig.Config): DialogError {
|
protected isValid(value: BoardsConfig.Config): DialogError {
|
||||||
if (!value.selectedBoard) {
|
if (!value.selectedBoard) {
|
||||||
if (value.selectedPort) {
|
if (value.selectedPort) {
|
||||||
return 'Please pick a board connected to the port you have selected.';
|
return nls.localize(
|
||||||
|
'arduino/board/pleasePickBoard',
|
||||||
|
'Please pick a board connected to the port you have selected.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
} from '../../common/protocol/boards-service';
|
} from '../../common/protocol/boards-service';
|
||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
import { BoardsServiceProvider } from './boards-service-provider';
|
import { BoardsServiceProvider } from './boards-service-provider';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export namespace BoardsConfig {
|
export namespace BoardsConfig {
|
||||||
export interface Config {
|
export interface Config {
|
||||||
@ -302,7 +303,12 @@ export class BoardsConfig extends React.Component<
|
|||||||
protected renderPortsFooter(): React.ReactNode {
|
protected renderPortsFooter(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<div className="noselect">
|
<div className="noselect">
|
||||||
<label title="Shows all available ports when enabled">
|
<label
|
||||||
|
title={nls.localize(
|
||||||
|
'arduino/board/showAllAvailablePorts',
|
||||||
|
'Shows all available ports when enabled'
|
||||||
|
)}
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
defaultChecked={this.state.showAllPorts}
|
defaultChecked={this.state.showAllPorts}
|
||||||
|
@ -12,6 +12,7 @@ import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|||||||
import { BoardsDataStore } from './boards-data-store';
|
import { BoardsDataStore } from './boards-data-store';
|
||||||
import { MainMenuManager } from '../../common/main-menu-manager';
|
import { MainMenuManager } from '../../common/main-menu-manager';
|
||||||
import { ArduinoMenus, unregisterSubmenu } from '../menu/arduino-menus';
|
import { ArduinoMenus, unregisterSubmenu } from '../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
|
export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
|
||||||
@ -115,9 +116,13 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
|
|||||||
...ArduinoMenus.TOOLS__BOARD_SETTINGS_GROUP,
|
...ArduinoMenus.TOOLS__BOARD_SETTINGS_GROUP,
|
||||||
'z02_programmers',
|
'z02_programmers',
|
||||||
];
|
];
|
||||||
|
const programmerNls = nls.localize(
|
||||||
|
'arduino/board/programmer',
|
||||||
|
'Programmer'
|
||||||
|
);
|
||||||
const label = selectedProgrammer
|
const label = selectedProgrammer
|
||||||
? `Programmer: "${selectedProgrammer.name}"`
|
? `${programmerNls}: "${selectedProgrammer.name}"`
|
||||||
: 'Programmer';
|
: programmerNls;
|
||||||
this.menuRegistry.registerSubmenu(programmersMenuPath, label);
|
this.menuRegistry.registerSubmenu(programmersMenuPath, label);
|
||||||
this.toDisposeOnBoardChange.push(
|
this.toDisposeOnBoardChange.push(
|
||||||
Disposable.create(() =>
|
Disposable.create(() =>
|
||||||
|
@ -5,11 +5,12 @@ import {
|
|||||||
} from '../../common/protocol/boards-service';
|
} from '../../common/protocol/boards-service';
|
||||||
import { ListWidget } from '../widgets/component-list/list-widget';
|
import { ListWidget } from '../widgets/component-list/list-widget';
|
||||||
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
|
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BoardsListWidget extends ListWidget<BoardsPackage> {
|
export class BoardsListWidget extends ListWidget<BoardsPackage> {
|
||||||
static WIDGET_ID = 'boards-list-widget';
|
static WIDGET_ID = 'boards-list-widget';
|
||||||
static WIDGET_LABEL = 'Boards Manager';
|
static WIDGET_LABEL = nls.localize('arduino/boardsManager', 'Boards Manager');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(BoardsService) protected service: BoardsService,
|
@inject(BoardsService) protected service: BoardsService,
|
||||||
@ -52,7 +53,12 @@ export class BoardsListWidget extends ListWidget<BoardsPackage> {
|
|||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
await super.install({ item, progressId, version });
|
await super.install({ item, progressId, version });
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Successfully installed platform ${item.name}:${version}`,
|
nls.localize(
|
||||||
|
'arduino/board/succesfullyInstalledPlatform',
|
||||||
|
'Successfully installed platform {0}:{1}',
|
||||||
|
item.name,
|
||||||
|
version
|
||||||
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -66,7 +72,12 @@ export class BoardsListWidget extends ListWidget<BoardsPackage> {
|
|||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
await super.uninstall({ item, progressId });
|
await super.uninstall({ item, progressId });
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Successfully uninstalled platform ${item.name}:${item.installedVersion}`,
|
nls.localize(
|
||||||
|
'arduino/board/succesfullyUninstalledPlatform',
|
||||||
|
'Successfully uninstalled platform {0}:{1}',
|
||||||
|
item.name,
|
||||||
|
item.installedVersion!
|
||||||
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import { naturalCompare } from '../../common/utils';
|
|||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
import { ArduinoCommands } from '../arduino-commands';
|
import { ArduinoCommands } from '../arduino-commands';
|
||||||
import { StorageWrapper } from '../storage-wrapper';
|
import { StorageWrapper } from '../storage-wrapper';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BoardsServiceProvider implements FrontendApplicationContribution {
|
export class BoardsServiceProvider implements FrontendApplicationContribution {
|
||||||
@ -134,14 +135,20 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
|
|||||||
selectedBoard.packageId === event.item.id &&
|
selectedBoard.packageId === event.item.id &&
|
||||||
!installedBoard
|
!installedBoard
|
||||||
) {
|
) {
|
||||||
|
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
|
||||||
this.messageService
|
this.messageService
|
||||||
.warn(
|
.warn(
|
||||||
`Could not find previously selected board '${selectedBoard.name}' in installed platform '${event.item.name}'. Please manually reselect the board you want to use. Do you want to reselect it now?`,
|
nls.localize(
|
||||||
'Reselect later',
|
'arduino/board/couldNotFindPreviouslySelected',
|
||||||
'Yes'
|
"Could not find previously selected board '{0}' in installed platform '{1}'. Please manually reselect the board you want to use. Do you want to reselect it now?",
|
||||||
|
selectedBoard.name,
|
||||||
|
event.item.name
|
||||||
|
),
|
||||||
|
nls.localize('arduino/board/reselectLater', 'Reselect later'),
|
||||||
|
yes
|
||||||
)
|
)
|
||||||
.then(async (answer) => {
|
.then(async (answer) => {
|
||||||
if (answer === 'Yes') {
|
if (answer === yes) {
|
||||||
this.commandService.executeCommand(
|
this.commandService.executeCommand(
|
||||||
ArduinoCommands.OPEN_BOARDS_DIALOG.id,
|
ArduinoCommands.OPEN_BOARDS_DIALOG.id,
|
||||||
selectedBoard.name
|
selectedBoard.name
|
||||||
@ -277,9 +284,12 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
|
|||||||
|
|
||||||
if (!config.selectedBoard) {
|
if (!config.selectedBoard) {
|
||||||
if (!options.silent) {
|
if (!options.silent) {
|
||||||
this.messageService.warn('No boards selected.', {
|
this.messageService.warn(
|
||||||
|
nls.localize('arduino/board/noneSelected', 'No boards selected.'),
|
||||||
|
{
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -301,9 +311,16 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
|
|||||||
const { name } = config.selectedBoard;
|
const { name } = config.selectedBoard;
|
||||||
if (!config.selectedPort) {
|
if (!config.selectedPort) {
|
||||||
if (!options.silent) {
|
if (!options.silent) {
|
||||||
this.messageService.warn(`No ports selected for board: '${name}'.`, {
|
this.messageService.warn(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/board/noPortsSelected',
|
||||||
|
"No ports selected for board: '{0}'.",
|
||||||
|
name
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -311,7 +328,11 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
|
|||||||
if (!config.selectedBoard.fqbn) {
|
if (!config.selectedBoard.fqbn) {
|
||||||
if (!options.silent) {
|
if (!options.silent) {
|
||||||
this.messageService.warn(
|
this.messageService.warn(
|
||||||
`The FQBN is not available for the selected board ${name}. Do you have the corresponding core installed?`,
|
nls.localize(
|
||||||
|
'arduino/board/noFQBN',
|
||||||
|
'The FQBN is not available for the selected board "{0}". Do you have the corresponding core installed?',
|
||||||
|
name
|
||||||
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -407,7 +428,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
|
|||||||
}
|
}
|
||||||
if (!board) {
|
if (!board) {
|
||||||
availableBoards.push({
|
availableBoards.push({
|
||||||
name: 'Unknown',
|
name: nls.localize('arduino/common/unknown', 'Unknown'),
|
||||||
port: boardPort,
|
port: boardPort,
|
||||||
state,
|
state,
|
||||||
});
|
});
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
BoardsServiceProvider,
|
BoardsServiceProvider,
|
||||||
AvailableBoard,
|
AvailableBoard,
|
||||||
} from './boards-service-provider';
|
} from './boards-service-provider';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export interface BoardsDropDownListCoords {
|
export interface BoardsDropDownListCoords {
|
||||||
readonly top: number;
|
readonly top: number;
|
||||||
@ -152,7 +153,10 @@ export class BoardsToolBarItem extends React.Component<
|
|||||||
const { coords, availableBoards } = this.state;
|
const { coords, availableBoards } = this.state;
|
||||||
const boardsConfig = this.props.boardsServiceClient.boardsConfig;
|
const boardsConfig = this.props.boardsServiceClient.boardsConfig;
|
||||||
const title = BoardsConfig.Config.toString(boardsConfig, {
|
const title = BoardsConfig.Config.toString(boardsConfig, {
|
||||||
default: 'no board selected',
|
default: nls.localize(
|
||||||
|
'arduino/common/noBoardSelected',
|
||||||
|
'No board selected'
|
||||||
|
),
|
||||||
});
|
});
|
||||||
const decorator = (() => {
|
const decorator = (() => {
|
||||||
const selectedBoard = availableBoards.find(({ selected }) => selected);
|
const selectedBoard = availableBoards.find(({ selected }) => selected);
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { ConfigService } from '../../common/protocol';
|
import { ConfigService } from '../../common/protocol';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class About extends Contribution {
|
export class About extends Contribution {
|
||||||
@ -30,7 +31,11 @@ export class About extends Contribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.HELP__ABOUT_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.HELP__ABOUT_GROUP, {
|
||||||
commandId: About.Commands.ABOUT_APP.id,
|
commandId: About.Commands.ABOUT_APP.id,
|
||||||
label: `About ${this.applicationName}`,
|
label: nls.localize(
|
||||||
|
'arduino/about/label',
|
||||||
|
'About {0}',
|
||||||
|
this.applicationName
|
||||||
|
),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -42,16 +47,24 @@ export class About extends Contribution {
|
|||||||
status: cliStatus,
|
status: cliStatus,
|
||||||
} = await this.configService.getVersion();
|
} = await this.configService.getVersion();
|
||||||
const buildDate = this.buildDate;
|
const buildDate = this.buildDate;
|
||||||
const detail = (showAll: boolean) => `Version: ${remote.app.getVersion()}
|
const detail = (showAll: boolean) =>
|
||||||
Date: ${buildDate ? buildDate : 'dev build'}${
|
nls.localize(
|
||||||
buildDate && showAll ? ` (${this.ago(buildDate)})` : ''
|
'arduino/about/detail',
|
||||||
}
|
'Version: {0}\nDate: {1}{2}\nCLI Version: {3}{4} [{5}]\n\n{6}',
|
||||||
CLI Version: ${version}${cliStatus ? ` ${cliStatus}` : ''} [${commit}]
|
remote.app.getVersion(),
|
||||||
|
buildDate ? buildDate : nls.localize('', 'dev build'),
|
||||||
${showAll ? `Copyright © ${new Date().getFullYear()} Arduino SA` : ''}
|
buildDate && showAll ? ` (${this.ago(buildDate)})` : '',
|
||||||
`;
|
version,
|
||||||
const ok = 'OK';
|
cliStatus ? ` ${cliStatus}` : '',
|
||||||
const copy = 'Copy';
|
commit,
|
||||||
|
nls.localize(
|
||||||
|
'arduino/about/copyright',
|
||||||
|
'Copyright © {0} Arduino SA',
|
||||||
|
new Date().getFullYear().toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const ok = nls.localize('vscode/issueMainService/ok', 'OK');
|
||||||
|
const copy = nls.localize('vscode/textInputActions/copy', 'Copy');
|
||||||
const buttons = !isWindows && !isOSX ? [copy, ok] : [ok, copy];
|
const buttons = !isWindows && !isOSX ? [copy, ok] : [ok, copy];
|
||||||
const { response } = await remote.dialog.showMessageBox(
|
const { response } = await remote.dialog.showMessageBox(
|
||||||
remote.getCurrentWindow(),
|
remote.getCurrentWindow(),
|
||||||
@ -85,26 +98,86 @@ ${showAll ? `Copyright © ${new Date().getFullYear()} Arduino SA` : ''}
|
|||||||
const other = moment(isoTime);
|
const other = moment(isoTime);
|
||||||
let result = now.diff(other, 'minute');
|
let result = now.diff(other, 'minute');
|
||||||
if (result < 60) {
|
if (result < 60) {
|
||||||
return result === 1 ? `${result} minute ago` : `${result} minute ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.minutes.singular.ago',
|
||||||
|
'{0} minute ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.minutes.plural.ago',
|
||||||
|
'{0} minutes ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result = now.diff(other, 'hour');
|
result = now.diff(other, 'hour');
|
||||||
if (result < 25) {
|
if (result < 25) {
|
||||||
return result === 1 ? `${result} hour ago` : `${result} hours ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.hours.singular.ago',
|
||||||
|
'{0} hour ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.hours.plural.ago',
|
||||||
|
'{0} hours ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result = now.diff(other, 'day');
|
result = now.diff(other, 'day');
|
||||||
if (result < 8) {
|
if (result < 8) {
|
||||||
return result === 1 ? `${result} day ago` : `${result} days ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.days.singular.ago',
|
||||||
|
'{0} day ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.days.plural.ago',
|
||||||
|
'{0} days ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result = now.diff(other, 'week');
|
result = now.diff(other, 'week');
|
||||||
if (result < 5) {
|
if (result < 5) {
|
||||||
return result === 1 ? `${result} week ago` : `${result} weeks ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.weeks.singular.ago',
|
||||||
|
'{0} week ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.weeks.plural.ago',
|
||||||
|
'{0} weeks ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result = now.diff(other, 'month');
|
result = now.diff(other, 'month');
|
||||||
if (result < 13) {
|
if (result < 13) {
|
||||||
return result === 1 ? `${result} month ago` : `${result} months ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.months.singular.ago',
|
||||||
|
'{0} month ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.months.plural.ago',
|
||||||
|
'{0} months ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result = now.diff(other, 'year');
|
result = now.diff(other, 'year');
|
||||||
return result === 1 ? `${result} year ago` : `${result} years ago`;
|
return result === 1
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/date/date.fromNow.years.singular.ago',
|
||||||
|
'{0} year ago',
|
||||||
|
result.toString()
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/date/date.fromNow.years.plural.ago',
|
||||||
|
'{0} years ago',
|
||||||
|
result.toString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
URI,
|
URI,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { FileDialogService } from '@theia/filesystem/lib/browser';
|
import { FileDialogService } from '@theia/filesystem/lib/browser';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class AddFile extends SketchContribution {
|
export class AddFile extends SketchContribution {
|
||||||
@ -24,7 +25,7 @@ export class AddFile extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__UTILS_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__UTILS_GROUP, {
|
||||||
commandId: AddFile.Commands.ADD_FILE.id,
|
commandId: AddFile.Commands.ADD_FILE.id,
|
||||||
label: 'Add File...',
|
label: nls.localize('arduino/contributions/addFile', 'Add File') + '...',
|
||||||
order: '2',
|
order: '2',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -35,7 +36,7 @@ export class AddFile extends SketchContribution {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const toAddUri = await this.fileDialogService.showOpenDialog({
|
const toAddUri = await this.fileDialogService.showOpenDialog({
|
||||||
title: 'Add File',
|
title: nls.localize('arduino/contributions/addFile', 'Add File'),
|
||||||
canSelectFiles: true,
|
canSelectFiles: true,
|
||||||
canSelectFolders: false,
|
canSelectFolders: false,
|
||||||
canSelectMany: false,
|
canSelectMany: false,
|
||||||
@ -50,9 +51,16 @@ export class AddFile extends SketchContribution {
|
|||||||
if (exists) {
|
if (exists) {
|
||||||
const { response } = await remote.dialog.showMessageBox({
|
const { response } = await remote.dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: 'Replace',
|
title: nls.localize('arduino/contributions/replaceTitle', 'Replace'),
|
||||||
buttons: ['Cancel', 'OK'],
|
buttons: [
|
||||||
message: `Replace the existing version of ${filename}?`,
|
nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
|
nls.localize('vscode/issueMainService/ok', 'OK'),
|
||||||
|
],
|
||||||
|
message: nls.localize(
|
||||||
|
'arduino/replaceMsg',
|
||||||
|
'Replace the existing version of {0}?',
|
||||||
|
filename
|
||||||
|
),
|
||||||
});
|
});
|
||||||
if (response === 0) {
|
if (response === 0) {
|
||||||
// Cancel
|
// Cancel
|
||||||
@ -60,9 +68,15 @@ export class AddFile extends SketchContribution {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.fileService.copy(toAddUri, targetUri, { overwrite: true });
|
await this.fileService.copy(toAddUri, targetUri, { overwrite: true });
|
||||||
this.messageService.info('One file added to the sketch.', {
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/contributions/fileAdded',
|
||||||
|
'One file added to the sketch.'
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
MenuModelRegistry,
|
MenuModelRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class AddZipLibrary extends SketchContribution {
|
export class AddZipLibrary extends SketchContribution {
|
||||||
@ -44,7 +45,7 @@ export class AddZipLibrary extends SketchContribution {
|
|||||||
});
|
});
|
||||||
registry.registerMenuAction([...includeLibMenuPath, '1_install'], {
|
registry.registerMenuAction([...includeLibMenuPath, '1_install'], {
|
||||||
commandId: AddZipLibrary.Commands.ADD_ZIP_LIBRARY.id,
|
commandId: AddZipLibrary.Commands.ADD_ZIP_LIBRARY.id,
|
||||||
label: 'Add .ZIP Library...',
|
label: nls.localize('arduino/library/addZip', 'Add .ZIP Library...'),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -53,12 +54,15 @@ export class AddZipLibrary extends SketchContribution {
|
|||||||
const homeUri = await this.envVariableServer.getHomeDirUri();
|
const homeUri = await this.envVariableServer.getHomeDirUri();
|
||||||
const defaultPath = await this.fileService.fsPath(new URI(homeUri));
|
const defaultPath = await this.fileService.fsPath(new URI(homeUri));
|
||||||
const { canceled, filePaths } = await remote.dialog.showOpenDialog({
|
const { canceled, filePaths } = await remote.dialog.showOpenDialog({
|
||||||
title: "Select a zip file containing the library you'd like to add",
|
title: nls.localize(
|
||||||
|
'arduino/selectZip',
|
||||||
|
"Select a zip file containing the library you'd like to add"
|
||||||
|
),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
properties: ['openFile'],
|
properties: ['openFile'],
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
name: 'Library',
|
name: nls.localize('arduino/library/zipLibrary', 'Library'),
|
||||||
extensions: ['zip'],
|
extensions: ['zip'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -71,9 +75,12 @@ export class AddZipLibrary extends SketchContribution {
|
|||||||
if (error instanceof AlreadyInstalledError) {
|
if (error instanceof AlreadyInstalledError) {
|
||||||
const result = await new ConfirmDialog({
|
const result = await new ConfirmDialog({
|
||||||
msg: error.message,
|
msg: error.message,
|
||||||
title: 'Do you want to overwrite the existing library?',
|
title: nls.localize(
|
||||||
ok: 'Yes',
|
'arduino/library/overwriteExistingLibrary',
|
||||||
cancel: 'No',
|
'Do you want to overwrite the existing library?'
|
||||||
|
),
|
||||||
|
ok: nls.localize('vscode/extensionsUtils/yes', 'Yes'),
|
||||||
|
cancel: nls.localize('vscode/extensionsUtils/no', 'No'),
|
||||||
}).open();
|
}).open();
|
||||||
if (result) {
|
if (result) {
|
||||||
await this.doInstall(zipUri, true);
|
await this.doInstall(zipUri, true);
|
||||||
@ -87,14 +94,18 @@ export class AddZipLibrary extends SketchContribution {
|
|||||||
try {
|
try {
|
||||||
await Installable.doWithProgress({
|
await Installable.doWithProgress({
|
||||||
messageService: this.messageService,
|
messageService: this.messageService,
|
||||||
progressText: `Processing ${new URI(zipUri).path.base}`,
|
progressText:
|
||||||
|
nls.localize('arduino/common/processing', 'Processing') +
|
||||||
|
` ${new URI(zipUri).path.base}`,
|
||||||
responseService: this.responseService,
|
responseService: this.responseService,
|
||||||
run: () => this.libraryService.installZip({ zipUri, overwrite }),
|
run: () => this.libraryService.installZip({ zipUri, overwrite }),
|
||||||
});
|
});
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Successfully installed library from ${
|
nls.localize(
|
||||||
|
'arduino/library/successfullyInstalledZipLibrary',
|
||||||
|
'Successfully installed library from {0} archive',
|
||||||
new URI(zipUri).path.base
|
new URI(zipUri).path.base
|
||||||
} archive`,
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -104,12 +115,19 @@ export class AddZipLibrary extends SketchContribution {
|
|||||||
const name = match[1].trim();
|
const name = match[1].trim();
|
||||||
if (name) {
|
if (name) {
|
||||||
throw new AlreadyInstalledError(
|
throw new AlreadyInstalledError(
|
||||||
`A library folder named ${name} already exists. Do you want to overwrite it?`,
|
nls.localize(
|
||||||
|
'arduino/library/namedLibraryAlreadyExists',
|
||||||
|
'A library folder named {0} already exists. Do you want to overwrite it?',
|
||||||
|
name
|
||||||
|
),
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new AlreadyInstalledError(
|
throw new AlreadyInstalledError(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/library/libraryAlreadyExists',
|
||||||
'A library already exists. Do you want to overwrite it?'
|
'A library already exists. Do you want to overwrite it?'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
MenuModelRegistry,
|
MenuModelRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ArchiveSketch extends SketchContribution {
|
export class ArchiveSketch extends SketchContribution {
|
||||||
@ -21,7 +22,7 @@ export class ArchiveSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
||||||
commandId: ArchiveSketch.Commands.ARCHIVE_SKETCH.id,
|
commandId: ArchiveSketch.Commands.ARCHIVE_SKETCH.id,
|
||||||
label: 'Archive Sketch',
|
label: nls.localize('arduino/sketch/archiveSketch', 'Archive Sketch'),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -42,7 +43,10 @@ export class ArchiveSketch extends SketchContribution {
|
|||||||
new URI(config.sketchDirUri).resolve(archiveBasename)
|
new URI(config.sketchDirUri).resolve(archiveBasename)
|
||||||
);
|
);
|
||||||
const { filePath, canceled } = await remote.dialog.showSaveDialog({
|
const { filePath, canceled } = await remote.dialog.showSaveDialog({
|
||||||
title: 'Save sketch folder as...',
|
title: nls.localize(
|
||||||
|
'arduino/sketch/saveSketchAs',
|
||||||
|
'Save sketch folder as...'
|
||||||
|
),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
});
|
});
|
||||||
if (!filePath || canceled) {
|
if (!filePath || canceled) {
|
||||||
@ -53,9 +57,16 @@ export class ArchiveSketch extends SketchContribution {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.sketchService.archive(sketch, destinationUri.toString());
|
await this.sketchService.archive(sketch, destinationUri.toString());
|
||||||
this.messageService.info(`Created archive '${archiveBasename}'.`, {
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/sketch/createdArchive',
|
||||||
|
"Created archive '{0}'.",
|
||||||
|
archiveBasename
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import {
|
|||||||
Port,
|
Port,
|
||||||
} from '../../common/protocol';
|
} from '../../common/protocol';
|
||||||
import { SketchContribution, Command, CommandRegistry } from './contribution';
|
import { SketchContribution, Command, CommandRegistry } from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BoardSelection extends SketchContribution {
|
export class BoardSelection extends SketchContribution {
|
||||||
@ -53,19 +54,29 @@ export class BoardSelection extends SketchContribution {
|
|||||||
this.boardsServiceProvider.boardsConfig;
|
this.boardsServiceProvider.boardsConfig;
|
||||||
if (!selectedBoard) {
|
if (!selectedBoard) {
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/board/selectBoardForInfo',
|
||||||
'Please select a board to obtain board info.'
|
'Please select a board to obtain board info.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!selectedBoard.fqbn) {
|
if (!selectedBoard.fqbn) {
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`The platform for the selected '${selectedBoard.name}' board is not installed.`
|
nls.localize(
|
||||||
|
'arduino/board/platformMissing',
|
||||||
|
"The platform for the selected '{0}' board is not installed.",
|
||||||
|
selectedBoard.name
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!selectedPort) {
|
if (!selectedPort) {
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/board/selectPortForInfo',
|
||||||
'Please select a port to obtain board info.'
|
'Please select a port to obtain board info.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,11 +89,11 @@ export class BoardSelection extends SketchContribution {
|
|||||||
VID: ${VID}
|
VID: ${VID}
|
||||||
PID: ${PID}`;
|
PID: ${PID}`;
|
||||||
await remote.dialog.showMessageBox(remote.getCurrentWindow(), {
|
await remote.dialog.showMessageBox(remote.getCurrentWindow(), {
|
||||||
message: 'Board Info',
|
message: nls.localize('arduino/board/boardInfo', 'Board Info'),
|
||||||
title: 'Board Info',
|
title: nls.localize('arduino/board/boardInfo', 'Board Info'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
detail,
|
detail,
|
||||||
buttons: ['OK'],
|
buttons: [nls.localize('vscode/issueMainService/ok', 'OK')],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -127,7 +138,9 @@ PID: ${PID}`;
|
|||||||
// The board specific items, and the rest, have order with `z`. We needed something between `0` and `z` with natural-order.
|
// The board specific items, and the rest, have order with `z`. We needed something between `0` and `z` with natural-order.
|
||||||
this.menuModelRegistry.registerSubmenu(
|
this.menuModelRegistry.registerSubmenu(
|
||||||
boardsSubmenuPath,
|
boardsSubmenuPath,
|
||||||
`Board${!!boardsSubmenuLabel ? `: "${boardsSubmenuLabel}"` : ''}`,
|
nls.localize('arduino/board/board', 'Board') + !!boardsSubmenuLabel
|
||||||
|
? `: "${boardsSubmenuLabel}"`
|
||||||
|
: '',
|
||||||
{ order: '100' }
|
{ order: '100' }
|
||||||
);
|
);
|
||||||
this.toDisposeBeforeMenuRebuild.push(
|
this.toDisposeBeforeMenuRebuild.push(
|
||||||
@ -144,7 +157,9 @@ PID: ${PID}`;
|
|||||||
const portsSubmenuLabel = config.selectedPort?.address;
|
const portsSubmenuLabel = config.selectedPort?.address;
|
||||||
this.menuModelRegistry.registerSubmenu(
|
this.menuModelRegistry.registerSubmenu(
|
||||||
portsSubmenuPath,
|
portsSubmenuPath,
|
||||||
`Port${!!portsSubmenuLabel ? `: "${portsSubmenuLabel}"` : ''}`,
|
nls.localize('arduino/board/port', 'Port') + portsSubmenuLabel
|
||||||
|
? `: "${portsSubmenuLabel}"`
|
||||||
|
: '',
|
||||||
{ order: '101' }
|
{ order: '101' }
|
||||||
);
|
);
|
||||||
this.toDisposeBeforeMenuRebuild.push(
|
this.toDisposeBeforeMenuRebuild.push(
|
||||||
@ -155,7 +170,7 @@ PID: ${PID}`;
|
|||||||
|
|
||||||
const getBoardInfo = {
|
const getBoardInfo = {
|
||||||
commandId: BoardSelection.Commands.GET_BOARD_INFO.id,
|
commandId: BoardSelection.Commands.GET_BOARD_INFO.id,
|
||||||
label: 'Get Board Info',
|
label: nls.localize('arduino/board/getBoardInfo', 'Get Board Info'),
|
||||||
order: '103',
|
order: '103',
|
||||||
};
|
};
|
||||||
this.menuModelRegistry.registerMenuAction(
|
this.menuModelRegistry.registerMenuAction(
|
||||||
@ -173,7 +188,7 @@ PID: ${PID}`;
|
|||||||
|
|
||||||
this.menuModelRegistry.registerMenuAction(boardsManagerGroup, {
|
this.menuModelRegistry.registerMenuAction(boardsManagerGroup, {
|
||||||
commandId: `${BoardsListWidget.WIDGET_ID}:toggle`,
|
commandId: `${BoardsListWidget.WIDGET_ID}:toggle`,
|
||||||
label: 'Boards Manager...',
|
label: `${BoardsListWidget.WIDGET_LABEL}...`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Installed boards
|
// Installed boards
|
||||||
@ -181,7 +196,12 @@ PID: ${PID}`;
|
|||||||
const { packageId, packageName, fqbn, name, manuallyInstalled } = board;
|
const { packageId, packageName, fqbn, name, manuallyInstalled } = board;
|
||||||
|
|
||||||
const packageLabel =
|
const packageLabel =
|
||||||
packageName + `${manuallyInstalled ? ' (in Sketchbook)' : ''}`;
|
packageName +
|
||||||
|
`${
|
||||||
|
manuallyInstalled
|
||||||
|
? nls.localize('arduino/board/inSketchbook', ' (in Sketchbook)')
|
||||||
|
: ''
|
||||||
|
}`;
|
||||||
// Platform submenu
|
// Platform submenu
|
||||||
const platformMenuPath = [...boardsPackagesGroup, packageId];
|
const platformMenuPath = [...boardsPackagesGroup, packageId];
|
||||||
// Note: Registering the same submenu twice is a noop. No need to group the boards per platform.
|
// Note: Registering the same submenu twice is a noop. No need to group the boards per platform.
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
MenuModelRegistry,
|
MenuModelRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class BurnBootloader extends SketchContribution {
|
export class BurnBootloader extends SketchContribution {
|
||||||
@ -38,7 +39,10 @@ export class BurnBootloader extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.TOOLS__BOARD_SETTINGS_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.TOOLS__BOARD_SETTINGS_GROUP, {
|
||||||
commandId: BurnBootloader.Commands.BURN_BOOTLOADER.id,
|
commandId: BurnBootloader.Commands.BURN_BOOTLOADER.id,
|
||||||
label: 'Burn Bootloader',
|
label: nls.localize(
|
||||||
|
'arduino/bootloader/burnBootloader',
|
||||||
|
'Burn Bootloader'
|
||||||
|
),
|
||||||
order: 'z99',
|
order: 'z99',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,9 +72,15 @@ export class BurnBootloader extends SketchContribution {
|
|||||||
verify,
|
verify,
|
||||||
verbose,
|
verbose,
|
||||||
});
|
});
|
||||||
this.messageService.info('Done burning bootloader.', {
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/bootloader/doneBurningBootloader',
|
||||||
|
'Done burning bootloader.'
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.messageService.error(e.toString());
|
this.messageService.error(e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
URI,
|
URI,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the `current` closeable editor, or any closeable current widget from the main area, or the current sketch window.
|
* Closes the `current` closeable editor, or any closeable current widget from the main area, or the current sketch window.
|
||||||
@ -64,10 +65,25 @@ export class Close extends SketchContribution {
|
|||||||
if (isTemp && (await this.wasTouched(uri))) {
|
if (isTemp && (await this.wasTouched(uri))) {
|
||||||
const { response } = await remote.dialog.showMessageBox({
|
const { response } = await remote.dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ["Don't Save", 'Cancel', 'Save'],
|
buttons: [
|
||||||
message:
|
nls.localize(
|
||||||
'Do you want to save changes to this sketch before closing?',
|
'vscode/abstractTaskService/saveBeforeRun.dontSave',
|
||||||
detail: "If you don't save, your changes will be lost.",
|
"Don't Save"
|
||||||
|
),
|
||||||
|
nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
|
nls.localize(
|
||||||
|
'vscode/abstractTaskService/saveBeforeRun.save',
|
||||||
|
'Save'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
message: nls.localize(
|
||||||
|
'arduino/common/saveChangesToSketch',
|
||||||
|
'Do you want to save changes to this sketch before closing?'
|
||||||
|
),
|
||||||
|
detail: nls.localize(
|
||||||
|
'arduino/common/loseChanges',
|
||||||
|
"If you don't save, your changes will be lost."
|
||||||
|
),
|
||||||
});
|
});
|
||||||
if (response === 1) {
|
if (response === 1) {
|
||||||
// Cancel
|
// Cancel
|
||||||
@ -93,7 +109,7 @@ export class Close extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
||||||
commandId: Close.Commands.CLOSE.id,
|
commandId: Close.Commands.CLOSE.id,
|
||||||
label: 'Close',
|
label: nls.localize('vscode/editor.contribution/close', 'Close'),
|
||||||
order: '5',
|
order: '5',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
SketchContribution,
|
SketchContribution,
|
||||||
TabBarToolbarRegistry,
|
TabBarToolbarRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class Debug extends SketchContribution {
|
export class Debug extends SketchContribution {
|
||||||
@ -33,7 +34,10 @@ export class Debug extends SketchContribution {
|
|||||||
/**
|
/**
|
||||||
* If `undefined`, debugging is enabled. Otherwise, the reason why it's disabled.
|
* If `undefined`, debugging is enabled. Otherwise, the reason why it's disabled.
|
||||||
*/
|
*/
|
||||||
protected _disabledMessages?: string = 'No board selected'; // Initial pessimism.
|
protected _disabledMessages?: string = nls.localize(
|
||||||
|
'arduino/common/noBoardSelected',
|
||||||
|
'No board selected'
|
||||||
|
); // Initial pessimism.
|
||||||
protected disabledMessageDidChangeEmitter = new Emitter<string | undefined>();
|
protected disabledMessageDidChangeEmitter = new Emitter<string | undefined>();
|
||||||
protected onDisabledMessageDidChange =
|
protected onDisabledMessageDidChange =
|
||||||
this.disabledMessageDidChangeEmitter.event;
|
this.disabledMessageDidChangeEmitter.event;
|
||||||
@ -51,8 +55,12 @@ export class Debug extends SketchContribution {
|
|||||||
command: Debug.Commands.START_DEBUGGING.id,
|
command: Debug.Commands.START_DEBUGGING.id,
|
||||||
tooltip: `${
|
tooltip: `${
|
||||||
this.disabledMessage
|
this.disabledMessage
|
||||||
? `Debug - ${this.disabledMessage}`
|
? nls.localize(
|
||||||
: 'Start Debugging'
|
'arduino/debug/debugWithMessage',
|
||||||
|
'Debug - {0}',
|
||||||
|
this.disabledMessage
|
||||||
|
)
|
||||||
|
: Debug.Commands.START_DEBUGGING.label
|
||||||
}`,
|
}`,
|
||||||
priority: 3,
|
priority: 3,
|
||||||
onDidChange: this.onDisabledMessageDidChange as Event<void>,
|
onDidChange: this.onDisabledMessageDidChange as Event<void>,
|
||||||
@ -63,8 +71,12 @@ export class Debug extends SketchContribution {
|
|||||||
() =>
|
() =>
|
||||||
(this.debugToolbarItem.tooltip = `${
|
(this.debugToolbarItem.tooltip = `${
|
||||||
this.disabledMessage
|
this.disabledMessage
|
||||||
? `Debug - ${this.disabledMessage}`
|
? nls.localize(
|
||||||
: 'Start Debugging'
|
'arduino/debug/debugWithMessage',
|
||||||
|
'Debug - {0}',
|
||||||
|
this.disabledMessage
|
||||||
|
)
|
||||||
|
: Debug.Commands.START_DEBUGGING.label
|
||||||
}`)
|
}`)
|
||||||
);
|
);
|
||||||
const refreshState = async (
|
const refreshState = async (
|
||||||
@ -72,22 +84,37 @@ export class Debug extends SketchContribution {
|
|||||||
.selectedBoard
|
.selectedBoard
|
||||||
) => {
|
) => {
|
||||||
if (!board) {
|
if (!board) {
|
||||||
this.disabledMessage = 'No board selected';
|
this.disabledMessage = nls.localize(
|
||||||
|
'arduino/common/noBoardSelected',
|
||||||
|
'No board selected'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fqbn = board.fqbn;
|
const fqbn = board.fqbn;
|
||||||
if (!fqbn) {
|
if (!fqbn) {
|
||||||
this.disabledMessage = `Platform is not installed for '${board.name}'`;
|
this.disabledMessage = nls.localize(
|
||||||
|
'arduino/debug/noPlatformInstalledFor',
|
||||||
|
"Platform is not installed for '{0}'",
|
||||||
|
board.name
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const details = await this.boardService.getBoardDetails({ fqbn });
|
const details = await this.boardService.getBoardDetails({ fqbn });
|
||||||
if (!details) {
|
if (!details) {
|
||||||
this.disabledMessage = `Platform is not installed for '${board.name}'`;
|
this.disabledMessage = nls.localize(
|
||||||
|
'arduino/debug/noPlatformInstalledFor',
|
||||||
|
"Platform is not installed for '{0}'",
|
||||||
|
board.name
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { debuggingSupported } = details;
|
const { debuggingSupported } = details;
|
||||||
if (!debuggingSupported) {
|
if (!debuggingSupported) {
|
||||||
this.disabledMessage = `Debugging is not supported by '${board.name}'`;
|
this.disabledMessage = nls.localize(
|
||||||
|
'arduino/debug/debuggingNotSupported',
|
||||||
|
"Debugging is not supported by '{0}'",
|
||||||
|
board.name
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.disabledMessage = undefined;
|
this.disabledMessage = undefined;
|
||||||
}
|
}
|
||||||
@ -155,10 +182,13 @@ export class Debug extends SketchContribution {
|
|||||||
|
|
||||||
export namespace Debug {
|
export namespace Debug {
|
||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const START_DEBUGGING: Command = {
|
export const START_DEBUGGING = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-start-debug',
|
id: 'arduino-start-debug',
|
||||||
label: 'Start Debugging',
|
label: 'Start Debugging',
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
},
|
||||||
|
'vscode/debug.contribution/startDebuggingHelp'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
// TODO: [macOS]: to remove `Start Dictation...` and `Emoji & Symbol` see this thread: https://github.com/electron/electron/issues/8283#issuecomment-269522072
|
// TODO: [macOS]: to remove `Start Dictation...` and `Emoji & Symbol` see this thread: https://github.com/electron/electron/issues/8283#issuecomment-269522072
|
||||||
// Depends on https://github.com/eclipse-theia/theia/pull/7964
|
// Depends on https://github.com/eclipse-theia/theia/pull/7964
|
||||||
@ -101,7 +102,10 @@ ${value}
|
|||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.COPY_FOR_FORUM.id,
|
commandId: EditContributions.Commands.COPY_FOR_FORUM.id,
|
||||||
label: 'Copy for Forum (Markdown)',
|
label: nls.localize(
|
||||||
|
'arduino/editor/copyForForum',
|
||||||
|
'Copy for Forum (Markdown)'
|
||||||
|
),
|
||||||
order: '2',
|
order: '2',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
||||||
@ -114,62 +118,83 @@ ${value}
|
|||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.GO_TO_LINE.id,
|
commandId: EditContributions.Commands.GO_TO_LINE.id,
|
||||||
label: 'Go to Line...',
|
label: nls.localize(
|
||||||
|
'vscode/standaloneStrings/gotoLineActionLabel',
|
||||||
|
'Go to Line...'
|
||||||
|
),
|
||||||
order: '5',
|
order: '5',
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.TOGGLE_COMMENT.id,
|
commandId: EditContributions.Commands.TOGGLE_COMMENT.id,
|
||||||
label: 'Comment/Uncomment',
|
label: nls.localize(
|
||||||
|
'arduino/editor/commentUncomment',
|
||||||
|
'Comment/Uncomment'
|
||||||
|
),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.INDENT_LINES.id,
|
commandId: EditContributions.Commands.INDENT_LINES.id,
|
||||||
label: 'Increase Indent',
|
label: nls.localize('arduino/editor/increaseIndent', 'Increase Indent'),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.OUTDENT_LINES.id,
|
commandId: EditContributions.Commands.OUTDENT_LINES.id,
|
||||||
label: 'Decrease Indent',
|
label: nls.localize('arduino/editor/decreaseIndent', 'Decrease Indent'),
|
||||||
order: '2',
|
order: '2',
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.INCREASE_FONT_SIZE.id,
|
commandId: EditContributions.Commands.INCREASE_FONT_SIZE.id,
|
||||||
label: 'Increase Font Size',
|
label: nls.localize(
|
||||||
|
'arduino/editor/increaseFontSize',
|
||||||
|
'Increase Font Size'
|
||||||
|
),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, {
|
||||||
commandId: EditContributions.Commands.DECREASE_FONT_SIZE.id,
|
commandId: EditContributions.Commands.DECREASE_FONT_SIZE.id,
|
||||||
label: 'Decrease Font Size',
|
label: nls.localize(
|
||||||
|
'arduino/editor/decreaseFontSize',
|
||||||
|
'Decrease Font Size'
|
||||||
|
),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
||||||
commandId: EditContributions.Commands.FIND.id,
|
commandId: EditContributions.Commands.FIND.id,
|
||||||
label: 'Find',
|
label: nls.localize('vscode/findController/startFindAction', 'Find'),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
||||||
commandId: EditContributions.Commands.FIND_NEXT.id,
|
commandId: EditContributions.Commands.FIND_NEXT.id,
|
||||||
label: 'Find Next',
|
label: nls.localize(
|
||||||
|
'vscode/findController/findNextMatchAction',
|
||||||
|
'Find Next'
|
||||||
|
),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
||||||
commandId: EditContributions.Commands.FIND_PREVIOUS.id,
|
commandId: EditContributions.Commands.FIND_PREVIOUS.id,
|
||||||
label: 'Find Previous',
|
label: nls.localize(
|
||||||
|
'vscode/findController/findPreviousMatchAction',
|
||||||
|
'Find Previous'
|
||||||
|
),
|
||||||
order: '2',
|
order: '2',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.EDIT__FIND_GROUP, {
|
||||||
commandId: EditContributions.Commands.USE_FOR_FIND.id,
|
commandId: EditContributions.Commands.USE_FOR_FIND.id,
|
||||||
label: 'Use Selection for Find', // XXX: The Java IDE uses `Use Selection For Find`.
|
label: nls.localize(
|
||||||
|
'vscode/findController/startFindWithSelectionAction',
|
||||||
|
'Use Selection for Find'
|
||||||
|
), // XXX: The Java IDE uses `Use Selection For Find`.
|
||||||
order: '3',
|
order: '3',
|
||||||
});
|
});
|
||||||
|
|
||||||
// `Tools`
|
// `Tools`
|
||||||
registry.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
||||||
commandId: EditContributions.Commands.AUTO_FORMAT.id,
|
commandId: EditContributions.Commands.AUTO_FORMAT.id,
|
||||||
label: 'Auto Format', // XXX: The Java IDE uses `Use Selection For Find`.
|
label: nls.localize('arduino/editor/autoFormat', 'Auto Format'), // XXX: The Java IDE uses `Use Selection For Find`.
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import {
|
|||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
import { Board, Sketch, SketchContainer } from '../../common/protocol';
|
import { Board, Sketch, SketchContainer } from '../../common/protocol';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export abstract class Examples extends SketchContribution {
|
export abstract class Examples extends SketchContribution {
|
||||||
@ -69,9 +70,13 @@ export abstract class Examples extends SketchContribution {
|
|||||||
}
|
}
|
||||||
// Registering the same submenu multiple times has no side-effect.
|
// Registering the same submenu multiple times has no side-effect.
|
||||||
// TODO: unregister submenu? https://github.com/eclipse-theia/theia/issues/7300
|
// TODO: unregister submenu? https://github.com/eclipse-theia/theia/issues/7300
|
||||||
registry.registerSubmenu(ArduinoMenus.FILE__EXAMPLES_SUBMENU, 'Examples', {
|
registry.registerSubmenu(
|
||||||
|
ArduinoMenus.FILE__EXAMPLES_SUBMENU,
|
||||||
|
nls.localize('arduino/examples/menu', 'Examples'),
|
||||||
|
{
|
||||||
order: '4',
|
order: '4',
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerRecursively(
|
registerRecursively(
|
||||||
@ -166,11 +171,19 @@ export class BuiltInExamples extends Examples {
|
|||||||
sketchContainers = await this.examplesService.builtIns();
|
sketchContainers = await this.examplesService.builtIns();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Could not initialize built-in examples.', e);
|
console.error('Could not initialize built-in examples.', e);
|
||||||
this.messageService.error('Could not initialize built-in examples.');
|
this.messageService.error(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/examples/couldNotInitializeExamples',
|
||||||
|
'Could not initialize built-in examples.'
|
||||||
|
)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.toDispose.dispose();
|
this.toDispose.dispose();
|
||||||
for (const container of ['Built-in examples', ...sketchContainers]) {
|
for (const container of [
|
||||||
|
nls.localize('arduino/examples/builtInExamples', 'Built-in examples'),
|
||||||
|
...sketchContainers,
|
||||||
|
]) {
|
||||||
this.registerRecursively(
|
this.registerRecursively(
|
||||||
container,
|
container,
|
||||||
ArduinoMenus.EXAMPLES__BUILT_IN_GROUP,
|
ArduinoMenus.EXAMPLES__BUILT_IN_GROUP,
|
||||||
@ -211,13 +224,22 @@ export class LibraryExamples extends Examples {
|
|||||||
fqbn,
|
fqbn,
|
||||||
});
|
});
|
||||||
if (user.length) {
|
if (user.length) {
|
||||||
(user as any).unshift('Examples from Custom Libraries');
|
(user as any).unshift(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/examples/customLibrary',
|
||||||
|
'Examples from Custom Libraries'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (name && fqbn && current.length) {
|
if (name && fqbn && current.length) {
|
||||||
(current as any).unshift(`Examples for ${name}`);
|
(current as any).unshift(
|
||||||
|
nls.localize('arduino/examples/for', 'Examples for {0}', name)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (any.length) {
|
if (any.length) {
|
||||||
(any as any).unshift('Examples for any board');
|
(any as any).unshift(
|
||||||
|
nls.localize('arduino/examples/forAny', 'Examples for any board')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
for (const container of user) {
|
for (const container of user) {
|
||||||
this.registerRecursively(
|
this.registerRecursively(
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class Help extends Contribution {
|
export class Help extends Contribution {
|
||||||
@ -61,8 +62,8 @@ export class Help extends Contribution {
|
|||||||
}
|
}
|
||||||
if (!searchFor) {
|
if (!searchFor) {
|
||||||
searchFor = await this.quickInputService.input({
|
searchFor = await this.quickInputService.input({
|
||||||
prompt: 'Search on Arduino.cc',
|
prompt: nls.localize('arduino/help/search', 'Search on Arduino.cc'),
|
||||||
placeHolder: 'Type a keyword',
|
placeHolder: nls.localize('arduino/help/keyword', 'Type a keyword'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (searchFor) {
|
if (searchFor) {
|
||||||
@ -128,37 +129,37 @@ export namespace Help {
|
|||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const GETTING_STARTED: Command = {
|
export const GETTING_STARTED: Command = {
|
||||||
id: 'arduino-getting-started',
|
id: 'arduino-getting-started',
|
||||||
label: 'Getting Started',
|
label: nls.localize('arduino/help/gettingStarted', 'Getting Started'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const ENVIRONMENT: Command = {
|
export const ENVIRONMENT: Command = {
|
||||||
id: 'arduino-environment',
|
id: 'arduino-environment',
|
||||||
label: 'Environment',
|
label: nls.localize('arduino/help/environment', 'Environment'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const TROUBLESHOOTING: Command = {
|
export const TROUBLESHOOTING: Command = {
|
||||||
id: 'arduino-troubleshooting',
|
id: 'arduino-troubleshooting',
|
||||||
label: 'Troubleshooting',
|
label: nls.localize('arduino/help/troubleshooting', 'Troubleshooting'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const REFERENCE: Command = {
|
export const REFERENCE: Command = {
|
||||||
id: 'arduino-reference',
|
id: 'arduino-reference',
|
||||||
label: 'Reference',
|
label: nls.localize('arduino/help/reference', 'Reference'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const FIND_IN_REFERENCE: Command = {
|
export const FIND_IN_REFERENCE: Command = {
|
||||||
id: 'arduino-find-in-reference',
|
id: 'arduino-find-in-reference',
|
||||||
label: 'Find in Reference',
|
label: nls.localize('arduino/help/findInReference', 'Find in Reference'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const FAQ: Command = {
|
export const FAQ: Command = {
|
||||||
id: 'arduino-faq',
|
id: 'arduino-faq',
|
||||||
label: 'Frequently Asked Questions',
|
label: nls.localize('arduino/help/faq', 'Frequently Asked Questions'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
export const VISIT_ARDUINO: Command = {
|
export const VISIT_ARDUINO: Command = {
|
||||||
id: 'arduino-visit-arduino',
|
id: 'arduino-visit-arduino',
|
||||||
label: 'Visit Arduino.cc',
|
label: nls.localize('arduino/help/visit', 'Visit Arduino.cc'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import { LibraryListWidget } from '../library/library-list-widget';
|
|||||||
import { BoardsServiceProvider } from '../boards/boards-service-provider';
|
import { BoardsServiceProvider } from '../boards/boards-service-provider';
|
||||||
import { SketchContribution, Command, CommandRegistry } from './contribution';
|
import { SketchContribution, Command, CommandRegistry } from './contribution';
|
||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class IncludeLibrary extends SketchContribution {
|
export class IncludeLibrary extends SketchContribution {
|
||||||
@ -59,13 +60,20 @@ export class IncludeLibrary extends SketchContribution {
|
|||||||
...ArduinoMenus.SKETCH__UTILS_GROUP,
|
...ArduinoMenus.SKETCH__UTILS_GROUP,
|
||||||
'0_include',
|
'0_include',
|
||||||
];
|
];
|
||||||
registry.registerSubmenu(includeLibMenuPath, 'Include Library', {
|
registry.registerSubmenu(
|
||||||
|
includeLibMenuPath,
|
||||||
|
nls.localize('arduino/library/include', 'Include Library'),
|
||||||
|
{
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
}
|
||||||
|
);
|
||||||
// `Manage Libraries...` group.
|
// `Manage Libraries...` group.
|
||||||
registry.registerMenuAction([...includeLibMenuPath, '0_manage'], {
|
registry.registerMenuAction([...includeLibMenuPath, '0_manage'], {
|
||||||
commandId: `${LibraryListWidget.WIDGET_ID}:toggle`,
|
commandId: `${LibraryListWidget.WIDGET_ID}:toggle`,
|
||||||
label: 'Manage Libraries...',
|
label: nls.localize(
|
||||||
|
'arduino/library/manageLibraries',
|
||||||
|
'Manage Libraries...'
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,10 +109,17 @@ export class IncludeLibrary extends SketchContribution {
|
|||||||
const userMenuPath = [...includeLibMenuPath, '3_contributed'];
|
const userMenuPath = [...includeLibMenuPath, '3_contributed'];
|
||||||
const { user, rest } = LibraryPackage.groupByLocation(libraries);
|
const { user, rest } = LibraryPackage.groupByLocation(libraries);
|
||||||
if (rest.length) {
|
if (rest.length) {
|
||||||
(rest as any).unshift('Arduino libraries');
|
(rest as any).unshift(
|
||||||
|
nls.localize('arduino/library/arduinoLibraries', 'Arduino libraries')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (user.length) {
|
if (user.length) {
|
||||||
(user as any).unshift('Contributed libraries');
|
(user as any).unshift(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/library/contributedLibraries',
|
||||||
|
'Contributed libraries'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const library of user) {
|
for (const library of user) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import { injectable } from 'inversify';
|
import { injectable } from 'inversify';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
||||||
@ -27,7 +28,7 @@ export class NewSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
||||||
commandId: NewSketch.Commands.NEW_SKETCH.id,
|
commandId: NewSketch.Commands.NEW_SKETCH.id,
|
||||||
label: 'New',
|
label: nls.localize('arduino/sketch/new', 'New'),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -43,7 +44,7 @@ export class NewSketch extends SketchContribution {
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: NewSketch.Commands.NEW_SKETCH__TOOLBAR.id,
|
id: NewSketch.Commands.NEW_SKETCH__TOOLBAR.id,
|
||||||
command: NewSketch.Commands.NEW_SKETCH__TOOLBAR.id,
|
command: NewSketch.Commands.NEW_SKETCH__TOOLBAR.id,
|
||||||
tooltip: 'New',
|
tooltip: nls.localize('arduino/sketch/new', 'New'),
|
||||||
priority: 3,
|
priority: 3,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import { ArduinoMenus } from '../menu/arduino-menus';
|
|||||||
import { MainMenuManager } from '../../common/main-menu-manager';
|
import { MainMenuManager } from '../../common/main-menu-manager';
|
||||||
import { OpenSketch } from './open-sketch';
|
import { OpenSketch } from './open-sketch';
|
||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class OpenRecentSketch extends SketchContribution {
|
export class OpenRecentSketch extends SketchContribution {
|
||||||
@ -48,7 +49,7 @@ export class OpenRecentSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerSubmenu(
|
registry.registerSubmenu(
|
||||||
ArduinoMenus.FILE__OPEN_RECENT_SUBMENU,
|
ArduinoMenus.FILE__OPEN_RECENT_SUBMENU,
|
||||||
'Open Recent',
|
nls.localize('arduino/sketch/openRecent', 'Open Recent'),
|
||||||
{ order: '2' }
|
{ order: '2' }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
MenuModelRegistry,
|
MenuModelRegistry,
|
||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class OpenSketchExternal extends SketchContribution {
|
export class OpenSketchExternal extends SketchContribution {
|
||||||
@ -21,7 +22,7 @@ export class OpenSketchExternal extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__UTILS_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__UTILS_GROUP, {
|
||||||
commandId: OpenSketchExternal.Commands.OPEN_EXTERNAL.id,
|
commandId: OpenSketchExternal.Commands.OPEN_EXTERNAL.id,
|
||||||
label: 'Show Sketch Folder',
|
label: nls.localize('arduino/sketch/showFolder', 'Show Sketch Folder'),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -36,7 +37,7 @@ export class OpenSketchExternal extends SketchContribution {
|
|||||||
protected async openExternal(): Promise<void> {
|
protected async openExternal(): Promise<void> {
|
||||||
const uri = await this.sketchServiceClient.currentSketchFile();
|
const uri = await this.sketchServiceClient.currentSketchFile();
|
||||||
if (uri) {
|
if (uri) {
|
||||||
const exists = this.fileService.exists(new URI(uri));
|
const exists = await this.fileService.exists(new URI(uri));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
const fsPath = await this.fileService.fsPath(new URI(uri));
|
const fsPath = await this.fileService.fsPath(new URI(uri));
|
||||||
if (fsPath) {
|
if (fsPath) {
|
||||||
|
@ -22,6 +22,7 @@ import { ExamplesService } from '../../common/protocol/examples-service';
|
|||||||
import { BuiltInExamples } from './examples';
|
import { BuiltInExamples } from './examples';
|
||||||
import { Sketchbook } from './sketchbook';
|
import { Sketchbook } from './sketchbook';
|
||||||
import { SketchContainer } from '../../common/protocol';
|
import { SketchContainer } from '../../common/protocol';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class OpenSketch extends SketchContribution {
|
export class OpenSketch extends SketchContribution {
|
||||||
@ -70,7 +71,10 @@ export class OpenSketch extends SketchContribution {
|
|||||||
ArduinoMenus.OPEN_SKETCH__CONTEXT__OPEN_GROUP,
|
ArduinoMenus.OPEN_SKETCH__CONTEXT__OPEN_GROUP,
|
||||||
{
|
{
|
||||||
commandId: OpenSketch.Commands.OPEN_SKETCH.id,
|
commandId: OpenSketch.Commands.OPEN_SKETCH.id,
|
||||||
label: 'Open...',
|
label: nls.localize(
|
||||||
|
'vscode/workspaceActions/openFileFolder',
|
||||||
|
'Open...'
|
||||||
|
),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.toDispose.push(
|
this.toDispose.push(
|
||||||
@ -115,7 +119,7 @@ export class OpenSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
||||||
commandId: OpenSketch.Commands.OPEN_SKETCH.id,
|
commandId: OpenSketch.Commands.OPEN_SKETCH.id,
|
||||||
label: 'Open...',
|
label: nls.localize('vscode/workspaceActions/openFileFolder', 'Open...'),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -131,7 +135,7 @@ export class OpenSketch extends SketchContribution {
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: OpenSketch.Commands.OPEN_SKETCH__TOOLBAR.id,
|
id: OpenSketch.Commands.OPEN_SKETCH__TOOLBAR.id,
|
||||||
command: OpenSketch.Commands.OPEN_SKETCH__TOOLBAR.id,
|
command: OpenSketch.Commands.OPEN_SKETCH__TOOLBAR.id,
|
||||||
tooltip: 'Open',
|
tooltip: nls.localize('vscode/dialogMainService/open', 'Open'),
|
||||||
priority: 4,
|
priority: 4,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -155,7 +159,7 @@ export class OpenSketch extends SketchContribution {
|
|||||||
properties: ['createDirectory', 'openFile'],
|
properties: ['createDirectory', 'openFile'],
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
name: 'Sketch',
|
name: nls.localize('arduino/sketch/sketch', 'Sketch'),
|
||||||
extensions: ['ino', 'pde'],
|
extensions: ['ino', 'pde'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -178,10 +182,18 @@ export class OpenSketch extends SketchContribution {
|
|||||||
const name = new URI(sketchFileUri).path.name;
|
const name = new URI(sketchFileUri).path.name;
|
||||||
const nameWithExt = this.labelProvider.getName(new URI(sketchFileUri));
|
const nameWithExt = this.labelProvider.getName(new URI(sketchFileUri));
|
||||||
const { response } = await remote.dialog.showMessageBox({
|
const { response } = await remote.dialog.showMessageBox({
|
||||||
title: 'Moving',
|
title: nls.localize('arduino/sketch/moving', 'Moving'),
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Cancel', 'OK'],
|
buttons: [
|
||||||
message: `The file "${nameWithExt}" needs to be inside a sketch folder named as "${name}".\nCreate this folder, move the file, and continue?`,
|
nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
|
nls.localize('vscode/issueMainService/ok', 'OK'),
|
||||||
|
],
|
||||||
|
message: nls.localize(
|
||||||
|
'arduino/sketch/movingMsg',
|
||||||
|
'The file "{0}" needs to be inside a sketch folder named as "{1}".\nCreate this folder, move the file, and continue?',
|
||||||
|
nameWithExt,
|
||||||
|
name
|
||||||
|
),
|
||||||
});
|
});
|
||||||
if (response === 1) {
|
if (response === 1) {
|
||||||
// OK
|
// OK
|
||||||
@ -190,8 +202,12 @@ export class OpenSketch extends SketchContribution {
|
|||||||
if (exists) {
|
if (exists) {
|
||||||
await remote.dialog.showMessageBox({
|
await remote.dialog.showMessageBox({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Error',
|
title: nls.localize('vscode/dialog/dialogErrorMessage', 'Error'),
|
||||||
message: `A folder named "${name}" already exists. Can't open sketch.`,
|
message: nls.localize(
|
||||||
|
'arduino/sketch/cantOpen',
|
||||||
|
'A folder named "{0}" already exists. Can\'t open sketch.',
|
||||||
|
name
|
||||||
|
),
|
||||||
});
|
});
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class QuitApp extends Contribution {
|
export class QuitApp extends Contribution {
|
||||||
@ -25,7 +26,7 @@ export class QuitApp extends Contribution {
|
|||||||
if (!isOSX) {
|
if (!isOSX) {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__QUIT_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__QUIT_GROUP, {
|
||||||
commandId: QuitApp.Commands.QUIT_APP.id,
|
commandId: QuitApp.Commands.QUIT_APP.id,
|
||||||
label: 'Quit',
|
label: nls.localize('vscode/bulkEditService/quit', 'Quit'),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
MenuModelRegistry,
|
MenuModelRegistry,
|
||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SaveAsSketch extends SketchContribution {
|
export class SaveAsSketch extends SketchContribution {
|
||||||
@ -22,7 +23,7 @@ export class SaveAsSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
||||||
commandId: SaveAsSketch.Commands.SAVE_AS_SKETCH.id,
|
commandId: SaveAsSketch.Commands.SAVE_AS_SKETCH.id,
|
||||||
label: 'Save As...',
|
label: nls.localize('vscode/fileCommands/saveAs', 'Save As...'),
|
||||||
order: '7',
|
order: '7',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -73,7 +74,10 @@ export class SaveAsSketch extends SketchContribution {
|
|||||||
: sketchDirUri.resolve(sketch.name);
|
: sketchDirUri.resolve(sketch.name);
|
||||||
const defaultPath = await this.fileService.fsPath(defaultUri);
|
const defaultPath = await this.fileService.fsPath(defaultUri);
|
||||||
const { filePath, canceled } = await remote.dialog.showSaveDialog({
|
const { filePath, canceled } = await remote.dialog.showSaveDialog({
|
||||||
title: 'Save sketch folder as...',
|
title: nls.localize(
|
||||||
|
'arduino/sketch/saveFolderAs',
|
||||||
|
'Save sketch folder as...'
|
||||||
|
),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
});
|
});
|
||||||
if (!filePath || canceled) {
|
if (!filePath || canceled) {
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
TabBarToolbarRegistry,
|
TabBarToolbarRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SaveSketch extends SketchContribution {
|
export class SaveSketch extends SketchContribution {
|
||||||
@ -28,7 +29,7 @@ export class SaveSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__SKETCH_GROUP, {
|
||||||
commandId: SaveSketch.Commands.SAVE_SKETCH.id,
|
commandId: SaveSketch.Commands.SAVE_SKETCH.id,
|
||||||
label: 'Save',
|
label: nls.localize('vscode/fileCommands/save', 'Save'),
|
||||||
order: '6',
|
order: '6',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -44,7 +45,7 @@ export class SaveSketch extends SketchContribution {
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: SaveSketch.Commands.SAVE_SKETCH__TOOLBAR.id,
|
id: SaveSketch.Commands.SAVE_SKETCH__TOOLBAR.id,
|
||||||
command: SaveSketch.Commands.SAVE_SKETCH__TOOLBAR.id,
|
command: SaveSketch.Commands.SAVE_SKETCH__TOOLBAR.id,
|
||||||
tooltip: 'Save',
|
tooltip: nls.localize('vscode/fileCommands/save', 'Save'),
|
||||||
priority: 5,
|
priority: 5,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { Settings as Preferences, SettingsDialog } from '../settings';
|
import { Settings as Preferences, SettingsDialog } from '../settings';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class Settings extends SketchContribution {
|
export class Settings extends SketchContribution {
|
||||||
@ -40,7 +41,11 @@ export class Settings extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.FILE__PREFERENCES_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.FILE__PREFERENCES_GROUP, {
|
||||||
commandId: Settings.Commands.OPEN.id,
|
commandId: Settings.Commands.OPEN.id,
|
||||||
label: 'Preferences...',
|
label:
|
||||||
|
nls.localize(
|
||||||
|
'vscode/preferences.contribution/preferences',
|
||||||
|
'Preferences'
|
||||||
|
) + '...',
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
registry.registerSubmenu(ArduinoMenus.FILE__ADVANCED_SUBMENU, 'Advanced');
|
registry.registerSubmenu(ArduinoMenus.FILE__ADVANCED_SUBMENU, 'Advanced');
|
||||||
@ -58,7 +63,11 @@ export namespace Settings {
|
|||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const OPEN: Command = {
|
export const OPEN: Command = {
|
||||||
id: 'arduino-settings-open',
|
id: 'arduino-settings-open',
|
||||||
label: 'Open Preferences...',
|
label:
|
||||||
|
nls.localize(
|
||||||
|
'vscode/preferences.contribution/openSettings2',
|
||||||
|
'Open Preferences'
|
||||||
|
) + '...',
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import { ArduinoMenus, PlaceholderMenuNode } from '../menu/arduino-menus';
|
|||||||
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
|
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
|
||||||
import { SketchesServiceClientImpl } from '../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../common/protocol/sketches-service-client-impl';
|
||||||
import { LocalCacheFsProvider } from '../local-cache/local-cache-fs-provider';
|
import { LocalCacheFsProvider } from '../local-cache/local-cache-fs-provider';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SketchControl extends SketchContribution {
|
export class SketchControl extends SketchContribution {
|
||||||
@ -93,7 +94,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
{
|
{
|
||||||
commandId: WorkspaceCommands.FILE_RENAME.id,
|
commandId: WorkspaceCommands.FILE_RENAME.id,
|
||||||
label: 'Rename',
|
label: nls.localize('vscode/fileActions/rename', 'Rename'),
|
||||||
order: '1',
|
order: '1',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -107,7 +108,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
} else {
|
} else {
|
||||||
const renamePlaceholder = new PlaceholderMenuNode(
|
const renamePlaceholder = new PlaceholderMenuNode(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
'Rename'
|
nls.localize('vscode/fileActions/rename', 'Rename')
|
||||||
);
|
);
|
||||||
this.menuRegistry.registerMenuNode(
|
this.menuRegistry.registerMenuNode(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
@ -130,7 +131,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
{
|
{
|
||||||
commandId: WorkspaceCommands.FILE_DELETE.id, // TODO: customize delete. Wipe sketch if deleting main file. Close window.
|
commandId: WorkspaceCommands.FILE_DELETE.id, // TODO: customize delete. Wipe sketch if deleting main file. Close window.
|
||||||
label: 'Delete',
|
label: nls.localize('vscode/fileActions/delete', 'Delete'),
|
||||||
order: '2',
|
order: '2',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -144,7 +145,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
} else {
|
} else {
|
||||||
const deletePlaceholder = new PlaceholderMenuNode(
|
const deletePlaceholder = new PlaceholderMenuNode(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
'Delete'
|
nls.localize('vscode/fileActions/delete', 'Delete')
|
||||||
);
|
);
|
||||||
this.menuRegistry.registerMenuNode(
|
this.menuRegistry.registerMenuNode(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
@ -204,7 +205,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
{
|
{
|
||||||
commandId: WorkspaceCommands.NEW_FILE.id,
|
commandId: WorkspaceCommands.NEW_FILE.id,
|
||||||
label: 'New Tab',
|
label: nls.localize('vscode/menubar/mNewTab', 'New Tab'),
|
||||||
order: '0',
|
order: '0',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -213,7 +214,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__NAVIGATION_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__NAVIGATION_GROUP,
|
||||||
{
|
{
|
||||||
commandId: CommonCommands.PREVIOUS_TAB.id,
|
commandId: CommonCommands.PREVIOUS_TAB.id,
|
||||||
label: 'Previous Tab',
|
label: nls.localize('vscode/menubar/mShowPreviousTab', 'Previous Tab'),
|
||||||
order: '0',
|
order: '0',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -221,7 +222,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__NAVIGATION_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__NAVIGATION_GROUP,
|
||||||
{
|
{
|
||||||
commandId: CommonCommands.NEXT_TAB.id,
|
commandId: CommonCommands.NEXT_TAB.id,
|
||||||
label: 'Next Tab',
|
label: nls.localize('vscode/menubar/mShowNextTab', 'Next Tab'),
|
||||||
order: '0',
|
order: '0',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,7 @@ import { NotificationCenter } from '../notification-center';
|
|||||||
import { Examples } from './examples';
|
import { Examples } from './examples';
|
||||||
import { SketchContainer } from '../../common/protocol';
|
import { SketchContainer } from '../../common/protocol';
|
||||||
import { OpenSketch } from './open-sketch';
|
import { OpenSketch } from './open-sketch';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class Sketchbook extends Examples {
|
export class Sketchbook extends Examples {
|
||||||
@ -38,7 +39,7 @@ export class Sketchbook extends Examples {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerSubmenu(
|
registry.registerSubmenu(
|
||||||
ArduinoMenus.FILE__SKETCHBOOK_SUBMENU,
|
ArduinoMenus.FILE__SKETCHBOOK_SUBMENU,
|
||||||
'Sketchbook',
|
nls.localize('arduino/sketch/sketchbook', 'Sketchbook'),
|
||||||
{ order: '3' }
|
{ order: '3' }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
certificateList,
|
certificateList,
|
||||||
} from '../dialogs/certificate-uploader/utils';
|
} from '../dialogs/certificate-uploader/utils';
|
||||||
import { ArduinoFirmwareUploader } from '../../common/protocol/arduino-firmware-uploader';
|
import { ArduinoFirmwareUploader } from '../../common/protocol/arduino-firmware-uploader';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class UploadCertificate extends Contribution {
|
export class UploadCertificate extends Contribution {
|
||||||
@ -111,25 +112,28 @@ export namespace UploadCertificate {
|
|||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const OPEN: Command = {
|
export const OPEN: Command = {
|
||||||
id: 'arduino-upload-certificate-open',
|
id: 'arduino-upload-certificate-open',
|
||||||
label: 'Upload SSL Root Certificates',
|
label: nls.localize(
|
||||||
|
'arduino/certificate/uploadRootCertificates',
|
||||||
|
'Upload SSL Root Certificates'
|
||||||
|
),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const OPEN_CERT_CONTEXT: Command = {
|
export const OPEN_CERT_CONTEXT: Command = {
|
||||||
id: 'arduino-certificate-open-context',
|
id: 'arduino-certificate-open-context',
|
||||||
label: 'Open context',
|
label: nls.localize('arduino/certificate/openContext', 'Open context'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const REMOVE_CERT: Command = {
|
export const REMOVE_CERT: Command = {
|
||||||
id: 'arduino-certificate-remove',
|
id: 'arduino-certificate-remove',
|
||||||
label: 'Remove',
|
label: nls.localize('arduino/certificate/remove', 'Remove'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UPLOAD_CERT: Command = {
|
export const UPLOAD_CERT: Command = {
|
||||||
id: 'arduino-certificate-upload',
|
id: 'arduino-certificate-upload',
|
||||||
label: 'Upload',
|
label: nls.localize('arduino/certificate/upload', 'Upload'),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
} from './contribution';
|
} from './contribution';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { UploadFirmwareDialog } from '../dialogs/firmware-uploader/firmware-uploader-dialog';
|
import { UploadFirmwareDialog } from '../dialogs/firmware-uploader/firmware-uploader-dialog';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class UploadFirmware extends Contribution {
|
export class UploadFirmware extends Contribution {
|
||||||
@ -42,7 +43,10 @@ export namespace UploadFirmware {
|
|||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const OPEN: Command = {
|
export const OPEN: Command = {
|
||||||
id: 'arduino-upload-firmware-open',
|
id: 'arduino-upload-firmware-open',
|
||||||
label: 'WiFi101 / WiFiNINA Firmware Updater',
|
label: nls.localize(
|
||||||
|
'arduino/firmware/updater',
|
||||||
|
'WiFi101 / WiFiNINA Firmware Updater'
|
||||||
|
),
|
||||||
category: 'Arduino',
|
category: 'Arduino',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
TabBarToolbarRegistry,
|
TabBarToolbarRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class UploadSketch extends SketchContribution {
|
export class UploadSketch extends SketchContribution {
|
||||||
@ -59,12 +60,15 @@ export class UploadSketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
||||||
commandId: UploadSketch.Commands.UPLOAD_SKETCH.id,
|
commandId: UploadSketch.Commands.UPLOAD_SKETCH.id,
|
||||||
label: 'Upload',
|
label: nls.localize('arduino/sketch/upload', 'Upload'),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
||||||
commandId: UploadSketch.Commands.UPLOAD_SKETCH_USING_PROGRAMMER.id,
|
commandId: UploadSketch.Commands.UPLOAD_SKETCH_USING_PROGRAMMER.id,
|
||||||
label: 'Upload Using Programmer',
|
label: nls.localize(
|
||||||
|
'arduino/sketch/uploadUsingProgrammer',
|
||||||
|
'Upload Using Programmer'
|
||||||
|
),
|
||||||
order: '2',
|
order: '2',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -84,7 +88,7 @@ export class UploadSketch extends SketchContribution {
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: UploadSketch.Commands.UPLOAD_SKETCH_TOOLBAR.id,
|
id: UploadSketch.Commands.UPLOAD_SKETCH_TOOLBAR.id,
|
||||||
command: UploadSketch.Commands.UPLOAD_SKETCH_TOOLBAR.id,
|
command: UploadSketch.Commands.UPLOAD_SKETCH_TOOLBAR.id,
|
||||||
tooltip: 'Upload',
|
tooltip: nls.localize('arduino/sketch/upload', 'Upload'),
|
||||||
priority: 1,
|
priority: 1,
|
||||||
onDidChange: this.onDidChange,
|
onDidChange: this.onDidChange,
|
||||||
});
|
});
|
||||||
@ -161,7 +165,10 @@ export class UploadSketch extends SketchContribution {
|
|||||||
} else {
|
} else {
|
||||||
await this.coreService.upload(options);
|
await this.coreService.upload(options);
|
||||||
}
|
}
|
||||||
this.messageService.info('Done uploading.', { timeout: 3000 });
|
this.messageService.info(
|
||||||
|
nls.localize('arduino/sketch/doneUploading', 'Done uploading.'),
|
||||||
|
{ timeout: 3000 }
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.messageService.error(e.toString());
|
this.messageService.error(e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
@ -183,7 +190,11 @@ export class UploadSketch extends SketchContribution {
|
|||||||
}
|
}
|
||||||
} catch (waitError) {
|
} catch (waitError) {
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
`Could not reconnect to serial monitor. ${waitError.toString()}`
|
nls.localize(
|
||||||
|
'arduino/sketch/couldNotConnectToMonitor',
|
||||||
|
'Could not reconnect to serial monitor. {0}',
|
||||||
|
waitError.toString()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
KeybindingRegistry,
|
KeybindingRegistry,
|
||||||
TabBarToolbarRegistry,
|
TabBarToolbarRegistry,
|
||||||
} from './contribution';
|
} from './contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class VerifySketch extends SketchContribution {
|
export class VerifySketch extends SketchContribution {
|
||||||
@ -52,12 +53,15 @@ export class VerifySketch extends SketchContribution {
|
|||||||
registerMenus(registry: MenuModelRegistry): void {
|
registerMenus(registry: MenuModelRegistry): void {
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
||||||
commandId: VerifySketch.Commands.VERIFY_SKETCH.id,
|
commandId: VerifySketch.Commands.VERIFY_SKETCH.id,
|
||||||
label: 'Verify/Compile',
|
label: nls.localize('arduino/sketch/verifyOrCompile', 'Verify/Compile'),
|
||||||
order: '0',
|
order: '0',
|
||||||
});
|
});
|
||||||
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
|
||||||
commandId: VerifySketch.Commands.EXPORT_BINARIES.id,
|
commandId: VerifySketch.Commands.EXPORT_BINARIES.id,
|
||||||
label: 'Export Compiled Binary',
|
label: nls.localize(
|
||||||
|
'arduino/sketch/exportBinary',
|
||||||
|
'Export Compiled Binary'
|
||||||
|
),
|
||||||
order: '3',
|
order: '3',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -77,7 +81,7 @@ export class VerifySketch extends SketchContribution {
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: VerifySketch.Commands.VERIFY_SKETCH_TOOLBAR.id,
|
id: VerifySketch.Commands.VERIFY_SKETCH_TOOLBAR.id,
|
||||||
command: VerifySketch.Commands.VERIFY_SKETCH_TOOLBAR.id,
|
command: VerifySketch.Commands.VERIFY_SKETCH_TOOLBAR.id,
|
||||||
tooltip: 'Verify',
|
tooltip: nls.localize('arduino/sketch/verify', 'Verify'),
|
||||||
priority: 0,
|
priority: 0,
|
||||||
onDidChange: this.onDidChange,
|
onDidChange: this.onDidChange,
|
||||||
});
|
});
|
||||||
@ -118,7 +122,10 @@ export class VerifySketch extends SketchContribution {
|
|||||||
sourceOverride,
|
sourceOverride,
|
||||||
compilerWarnings,
|
compilerWarnings,
|
||||||
});
|
});
|
||||||
this.messageService.info('Done compiling.', { timeout: 3000 });
|
this.messageService.info(
|
||||||
|
nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'),
|
||||||
|
{ timeout: 3000 }
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.messageService.error(e.toString());
|
this.messageService.error(e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export const CertificateAddComponent = ({
|
export const CertificateAddComponent = ({
|
||||||
@ -22,10 +23,18 @@ export const CertificateAddComponent = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<label>
|
<label>
|
||||||
<div>Add URL to fetch SSL certificate</div>
|
<div>
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/certificate/addURL',
|
||||||
|
'Add URL to fetch SSL certificate'
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<input
|
<input
|
||||||
className="theia-input"
|
className="theia-input"
|
||||||
placeholder="Enter URL"
|
placeholder={nls.localize(
|
||||||
|
'arduino/certificate/enterURL',
|
||||||
|
'Enter URL'
|
||||||
|
)}
|
||||||
type="text"
|
type="text"
|
||||||
name="add"
|
name="add"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
@ -4,6 +4,7 @@ import { AvailableBoard } from '../../boards/boards-service-provider';
|
|||||||
import { CertificateListComponent } from './certificate-list';
|
import { CertificateListComponent } from './certificate-list';
|
||||||
import { SelectBoardComponent } from './select-board-components';
|
import { SelectBoardComponent } from './select-board-components';
|
||||||
import { CertificateAddComponent } from './certificate-add-new';
|
import { CertificateAddComponent } from './certificate-add-new';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export const CertificateUploaderComponent = ({
|
export const CertificateUploaderComponent = ({
|
||||||
availableBoards,
|
availableBoards,
|
||||||
@ -71,7 +72,12 @@ export const CertificateUploaderComponent = ({
|
|||||||
<>
|
<>
|
||||||
<div className="dialogSection">
|
<div className="dialogSection">
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<strong className="fl1">1. Select certificate to upload</strong>
|
<strong className="fl1">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/certificate/selectCertificateToUpload',
|
||||||
|
'1. Select certificate to upload'
|
||||||
|
)}
|
||||||
|
</strong>
|
||||||
<Tippy
|
<Tippy
|
||||||
content={
|
content={
|
||||||
<CertificateAddComponent
|
<CertificateAddComponent
|
||||||
@ -93,7 +99,8 @@ export const CertificateUploaderComponent = ({
|
|||||||
showAdd ? setShowAdd(false) : setShowAdd(true);
|
showAdd ? setShowAdd(false) : setShowAdd(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Add New <span className="fa fa-caret-down caret"></span>
|
{nls.localize('arduino/certificate/addNew', 'Add New')}{' '}
|
||||||
|
<span className="fa fa-caret-down caret"></span>
|
||||||
</button>
|
</button>
|
||||||
</Tippy>
|
</Tippy>
|
||||||
</div>
|
</div>
|
||||||
@ -108,7 +115,12 @@ export const CertificateUploaderComponent = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="dialogSection">
|
<div className="dialogSection">
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<strong>2. Select destination board and upload certificate</strong>
|
<strong>
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/certificate/selectDestinationBoardToUpload',
|
||||||
|
'2. Select destination board and upload certificate'
|
||||||
|
)}
|
||||||
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<div className="fl1">
|
<div className="fl1">
|
||||||
@ -126,19 +138,28 @@ export const CertificateUploaderComponent = ({
|
|||||||
{installFeedback === 'installing' && (
|
{installFeedback === 'installing' && (
|
||||||
<div className="success">
|
<div className="success">
|
||||||
<div className="spinner" />
|
<div className="spinner" />
|
||||||
Uploading certificates.
|
{nls.localize(
|
||||||
|
'arduino/certificate/uploadingCertificates',
|
||||||
|
'Uploading certificates.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{installFeedback === 'ok' && (
|
{installFeedback === 'ok' && (
|
||||||
<div className="success">
|
<div className="success">
|
||||||
<i className="fa fa-info status-icon" />
|
<i className="fa fa-info status-icon" />
|
||||||
Cetificates uploaded.
|
{nls.localize(
|
||||||
|
'arduino/certificate/certificatesUploaded',
|
||||||
|
'Certificates uploaded.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{installFeedback === 'fail' && (
|
{installFeedback === 'fail' && (
|
||||||
<div className="warn">
|
<div className="warn">
|
||||||
<i className="fa fa-exclamation status-icon" />
|
<i className="fa fa-exclamation status-icon" />
|
||||||
Upload failed. Please try again.
|
{nls.localize(
|
||||||
|
'arduino/certificate/uploadFailed',
|
||||||
|
'Upload failed. Please try again.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -148,7 +169,7 @@ export const CertificateUploaderComponent = ({
|
|||||||
onClick={installCertificates}
|
onClick={installCertificates}
|
||||||
disabled={selectedCerts.length === 0 || !selectedBoard}
|
disabled={selectedCerts.length === 0 || !selectedBoard}
|
||||||
>
|
>
|
||||||
Upload
|
{nls.localize('arduino/certificate/upload', 'Upload')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
import { CommandRegistry } from '@theia/core/lib/common/command';
|
import { CommandRegistry } from '@theia/core/lib/common/command';
|
||||||
import { certificateList, sanifyCertString } from './utils';
|
import { certificateList, sanifyCertString } from './utils';
|
||||||
import { ArduinoFirmwareUploader } from '../../../common/protocol/arduino-firmware-uploader';
|
import { ArduinoFirmwareUploader } from '../../../common/protocol/arduino-firmware-uploader';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class UploadCertificateDialogWidget extends ReactWidget {
|
export class UploadCertificateDialogWidget extends ReactWidget {
|
||||||
@ -140,7 +141,12 @@ export class UploadCertificateDialog extends AbstractDialog<void> {
|
|||||||
@inject(UploadCertificateDialogProps)
|
@inject(UploadCertificateDialogProps)
|
||||||
protected readonly props: UploadCertificateDialogProps
|
protected readonly props: UploadCertificateDialogProps
|
||||||
) {
|
) {
|
||||||
super({ title: 'Upload SSL Root Certificates' });
|
super({
|
||||||
|
title: nls.localize(
|
||||||
|
'arduino/certificate/uploadRootCertificates',
|
||||||
|
'Upload SSL Root Certificates'
|
||||||
|
),
|
||||||
|
});
|
||||||
this.contentNode.classList.add('certificate-uploader-dialog');
|
this.contentNode.classList.add('certificate-uploader-dialog');
|
||||||
this.acceptButton = undefined;
|
this.acceptButton = undefined;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { AvailableBoard } from '../../boards/boards-service-provider';
|
import { AvailableBoard } from '../../boards/boards-service-provider';
|
||||||
import { ArduinoSelect } from '../../widgets/arduino-select';
|
import { ArduinoSelect } from '../../widgets/arduino-select';
|
||||||
@ -39,7 +40,10 @@ export const SelectBoardComponent = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let placeholderTxt = 'Select a board...';
|
let placeholderTxt = nls.localize(
|
||||||
|
'arduino/certificate/selectBoard',
|
||||||
|
'Select a board...'
|
||||||
|
);
|
||||||
let selBoard = -1;
|
let selBoard = -1;
|
||||||
const updatableBoards = availableBoards.filter(
|
const updatableBoards = availableBoards.filter(
|
||||||
(board) => board.port && board.fqbn && updatableFqbns.includes(board.fqbn)
|
(board) => board.port && board.fqbn && updatableFqbns.includes(board.fqbn)
|
||||||
@ -49,13 +53,21 @@ export const SelectBoardComponent = ({
|
|||||||
selBoard = i;
|
selBoard = i;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
label: `${board.name} at ${board.port?.address}`,
|
label: nls.localize(
|
||||||
|
'arduino/certificate/boardAtPort',
|
||||||
|
'{0} at {1}',
|
||||||
|
board.name,
|
||||||
|
board.port?.address ?? ''
|
||||||
|
),
|
||||||
value: board.fqbn || '',
|
value: board.fqbn || '',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (boardsList.length === 0) {
|
if (boardsList.length === 0) {
|
||||||
placeholderTxt = 'No supported board connected';
|
placeholderTxt = nls.localize(
|
||||||
|
'arduino/certificate/noSupportedBoardConnected',
|
||||||
|
'No supported board connected'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectBoardPlaceholder(placeholderTxt);
|
setSelectBoardPlaceholder(placeholderTxt);
|
||||||
@ -80,7 +92,12 @@ export const SelectBoardComponent = ({
|
|||||||
value={
|
value={
|
||||||
(selectedBoard && {
|
(selectedBoard && {
|
||||||
value: selectedBoard.fqbn,
|
value: selectedBoard.fqbn,
|
||||||
label: `${selectedBoard.name} at ${selectedBoard.port?.address}`,
|
label: nls.localize(
|
||||||
|
'arduino/certificate/boardAtPort',
|
||||||
|
'{0} at {1}',
|
||||||
|
selectedBoard.name,
|
||||||
|
selectedBoard.port?.address ?? ''
|
||||||
|
),
|
||||||
}) ||
|
}) ||
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { clipboard } from 'electron';
|
|||||||
import { ReactWidget, DialogProps } from '@theia/core/lib/browser';
|
import { ReactWidget, DialogProps } from '@theia/core/lib/browser';
|
||||||
import { AbstractDialog } from '../theia/dialogs/dialogs';
|
import { AbstractDialog } from '../theia/dialogs/dialogs';
|
||||||
import { CreateApi } from '../create/create-api';
|
import { CreateApi } from '../create/create-api';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const RadioButton = (props: {
|
const RadioButton = (props: {
|
||||||
id: string;
|
id: string;
|
||||||
@ -59,12 +60,20 @@ export const ShareSketchComponent = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="widget-container arduino-sharesketch-dialog">
|
<div id="widget-container arduino-sharesketch-dialog">
|
||||||
<p>Choose visibility of your Sketch:</p>
|
<p>
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/cloud/chooseSketchVisibility',
|
||||||
|
'Choose visibility of your Sketch:'
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
changed={radioChangeHandler}
|
changed={radioChangeHandler}
|
||||||
id="1"
|
id="1"
|
||||||
isSelected={treeNode.isPublic === false}
|
isSelected={treeNode.isPublic === false}
|
||||||
label="Private. Only you can view the Sketch."
|
label={nls.localize(
|
||||||
|
'arduino/cloud/privateVisibility',
|
||||||
|
'Private. Only you can view the Sketch.'
|
||||||
|
)}
|
||||||
value="private"
|
value="private"
|
||||||
isDisabled={loading}
|
isDisabled={loading}
|
||||||
/>
|
/>
|
||||||
@ -72,14 +81,17 @@ export const ShareSketchComponent = ({
|
|||||||
changed={radioChangeHandler}
|
changed={radioChangeHandler}
|
||||||
id="2"
|
id="2"
|
||||||
isSelected={treeNode.isPublic === true}
|
isSelected={treeNode.isPublic === true}
|
||||||
label="Public. Anyone with the link can view the Sketch."
|
label={nls.localize(
|
||||||
|
'arduino/cloud/publicVisibility',
|
||||||
|
'Public. Anyone with the link can view the Sketch.'
|
||||||
|
)}
|
||||||
value="public"
|
value="public"
|
||||||
isDisabled={loading}
|
isDisabled={loading}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{treeNode.isPublic && (
|
{treeNode.isPublic && (
|
||||||
<div>
|
<div>
|
||||||
<p>Link:</p>
|
<p>{nls.localize('arduino/cloud/link', 'Link:')}</p>
|
||||||
<div className="sketch-link">
|
<div className="sketch-link">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -92,10 +104,10 @@ export const ShareSketchComponent = ({
|
|||||||
value="copy"
|
value="copy"
|
||||||
className="theia-button secondary"
|
className="theia-button secondary"
|
||||||
>
|
>
|
||||||
Copy
|
{nls.localize('vscode/textInputActions/copy', 'Copy')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p>Embed:</p>
|
<p>{nls.localize('arduino/cloud/embed', 'Embed:')}</p>
|
||||||
<div className="sketch-link-embed">
|
<div className="sketch-link-embed">
|
||||||
<textarea
|
<textarea
|
||||||
readOnly
|
readOnly
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
ConfirmDialogProps,
|
ConfirmDialogProps,
|
||||||
DialogError,
|
DialogError,
|
||||||
} from '@theia/core/lib/browser/dialogs';
|
} from '@theia/core/lib/browser/dialogs';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class DoNotAskAgainDialogProps extends ConfirmDialogProps {
|
export class DoNotAskAgainDialogProps extends ConfirmDialogProps {
|
||||||
@ -31,7 +32,10 @@ export class DoNotAskAgainConfirmDialog extends ConfirmDialog {
|
|||||||
const doNotAskAgainLabel = document.createElement('label');
|
const doNotAskAgainLabel = document.createElement('label');
|
||||||
doNotAskAgainLabel.classList.add('flex-line');
|
doNotAskAgainLabel.classList.add('flex-line');
|
||||||
doNotAskAgainNode.appendChild(doNotAskAgainLabel);
|
doNotAskAgainNode.appendChild(doNotAskAgainLabel);
|
||||||
doNotAskAgainLabel.textContent = "Don't ask again";
|
doNotAskAgainLabel.textContent = nls.localize(
|
||||||
|
'arduino/dialog/dontAskAgain',
|
||||||
|
"Don't ask again"
|
||||||
|
);
|
||||||
this.doNotAskAgainCheckbox = document.createElement('input');
|
this.doNotAskAgainCheckbox = document.createElement('input');
|
||||||
this.doNotAskAgainCheckbox.setAttribute('align-self', 'center');
|
this.doNotAskAgainCheckbox.setAttribute('align-self', 'center');
|
||||||
doNotAskAgainLabel.appendChild(this.doNotAskAgainCheckbox);
|
doNotAskAgainLabel.appendChild(this.doNotAskAgainCheckbox);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
ArduinoFirmwareUploader,
|
ArduinoFirmwareUploader,
|
||||||
@ -106,7 +107,9 @@ export const FirmwareUploaderComponent = ({
|
|||||||
<>
|
<>
|
||||||
<div className="dialogSection">
|
<div className="dialogSection">
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<label htmlFor="board-select">Select board</label>
|
<label htmlFor="board-select">
|
||||||
|
{nls.localize('arduino/firmware/selectBoard', 'Select Board')}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<div className="fl1">
|
<div className="fl1">
|
||||||
@ -128,7 +131,7 @@ export const FirmwareUploaderComponent = ({
|
|||||||
}
|
}
|
||||||
onClick={fetchFirmwares}
|
onClick={fetchFirmwares}
|
||||||
>
|
>
|
||||||
Check Updates
|
{nls.localize('arduino/firmware/checkUpdates', 'Check Updates')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -137,7 +140,10 @@ export const FirmwareUploaderComponent = ({
|
|||||||
<div className="dialogSection">
|
<div className="dialogSection">
|
||||||
<div className="dialogRow">
|
<div className="dialogRow">
|
||||||
<label htmlFor="firmware-select" className="fl1">
|
<label htmlFor="firmware-select" className="fl1">
|
||||||
Select firmware version
|
{nls.localize(
|
||||||
|
'arduino/firmware/selectVersion',
|
||||||
|
'Select firmware version'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<ArduinoSelect
|
<ArduinoSelect
|
||||||
id="firmware-select"
|
id="firmware-select"
|
||||||
@ -167,7 +173,7 @@ export const FirmwareUploaderComponent = ({
|
|||||||
}
|
}
|
||||||
onClick={installFirmware}
|
onClick={installFirmware}
|
||||||
>
|
>
|
||||||
Install
|
{nls.localize('arduino/firmware/install', 'Install')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -175,25 +181,37 @@ export const FirmwareUploaderComponent = ({
|
|||||||
{installFeedback === null && (
|
{installFeedback === null && (
|
||||||
<div className="dialogRow warn">
|
<div className="dialogRow warn">
|
||||||
<i className="fa fa-exclamation status-icon" />
|
<i className="fa fa-exclamation status-icon" />
|
||||||
Installation will overwrite the Sketch on the board.
|
{nls.localize(
|
||||||
|
'arduino/firmware/overwriteSketch',
|
||||||
|
'Installation will overwrite the Sketch on the board.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{installFeedback === 'installing' && (
|
{installFeedback === 'installing' && (
|
||||||
<div className="dialogRow success">
|
<div className="dialogRow success">
|
||||||
<div className="spinner" />
|
<div className="spinner" />
|
||||||
Installing firmware.
|
{nls.localize(
|
||||||
|
'arduino/firmware/installingFirmware',
|
||||||
|
'Installing firmware.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{installFeedback === 'ok' && (
|
{installFeedback === 'ok' && (
|
||||||
<div className="dialogRow success">
|
<div className="dialogRow success">
|
||||||
<i className="fa fa-info status-icon" />
|
<i className="fa fa-info status-icon" />
|
||||||
Firmware succesfully installed.
|
{nls.localize(
|
||||||
|
'arduino/firmware/successfullyInstalled',
|
||||||
|
'Firmware succesfully installed.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{installFeedback === 'fail' && (
|
{installFeedback === 'fail' && (
|
||||||
<div className="dialogRow warn">
|
<div className="dialogRow warn">
|
||||||
<i className="fa fa-exclamation status-icon" />
|
<i className="fa fa-exclamation status-icon" />
|
||||||
Installation failed. Please try again.
|
{nls.localize(
|
||||||
|
'arduino/firmware/failedInstall',
|
||||||
|
'Installation failed. Please try again.'
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,11 +10,15 @@ import {
|
|||||||
import { ListWidget } from '../widgets/component-list/list-widget';
|
import { ListWidget } from '../widgets/component-list/list-widget';
|
||||||
import { Installable } from '../../common/protocol';
|
import { Installable } from '../../common/protocol';
|
||||||
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
|
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
||||||
static WIDGET_ID = 'library-list-widget';
|
static WIDGET_ID = 'library-list-widget';
|
||||||
static WIDGET_LABEL = 'Library Manager';
|
static WIDGET_LABEL = nls.localize(
|
||||||
|
'arduino/library/title',
|
||||||
|
'Library Manager'
|
||||||
|
);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(LibraryService) protected service: LibraryService,
|
@inject(LibraryService) protected service: LibraryService,
|
||||||
@ -61,11 +65,20 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
|||||||
let installDependencies: boolean | undefined = undefined;
|
let installDependencies: boolean | undefined = undefined;
|
||||||
if (dependencies.length) {
|
if (dependencies.length) {
|
||||||
const message = document.createElement('div');
|
const message = document.createElement('div');
|
||||||
message.innerHTML = `The library <b>${item.name}:${version}</b> needs ${
|
message.innerHTML =
|
||||||
dependencies.length === 1
|
dependencies.length === 1
|
||||||
? 'another dependency'
|
? nls.localize(
|
||||||
: 'some other dependencies'
|
'arduino/library/needsOneDependency',
|
||||||
} currently not installed:`;
|
'The library <b>{0}:{1}</b> needs another dependency currently not installed:',
|
||||||
|
item.name,
|
||||||
|
version
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'arduino/library/needsMultipleDependencies',
|
||||||
|
'The library <b>{0}:{1}</b> needs some other dependencies currently not installed:',
|
||||||
|
item.name,
|
||||||
|
version
|
||||||
|
);
|
||||||
const listContainer = document.createElement('div');
|
const listContainer = document.createElement('div');
|
||||||
listContainer.style.maxHeight = '300px';
|
listContainer.style.maxHeight = '300px';
|
||||||
listContainer.style.overflowY = 'auto';
|
listContainer.style.overflowY = 'auto';
|
||||||
@ -80,16 +93,34 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
|||||||
listContainer.appendChild(list);
|
listContainer.appendChild(list);
|
||||||
message.appendChild(listContainer);
|
message.appendChild(listContainer);
|
||||||
const question = document.createElement('div');
|
const question = document.createElement('div');
|
||||||
question.textContent = `Would you like to install ${
|
question.textContent =
|
||||||
dependencies.length === 1
|
dependencies.length === 1
|
||||||
? 'the missing dependency'
|
? nls.localize(
|
||||||
: 'all the missing dependencies'
|
'arduino/library/installOneMissingDependency',
|
||||||
}?`;
|
'Would you like to install the missing dependency?'
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'arduino/library/installMissingDependencies',
|
||||||
|
'Would you like to install all the missing dependencies?'
|
||||||
|
);
|
||||||
message.appendChild(question);
|
message.appendChild(question);
|
||||||
const result = await new MessageBoxDialog({
|
const result = await new MessageBoxDialog({
|
||||||
title: `Dependencies for library ${item.name}:${version}`,
|
title: nls.localize(
|
||||||
|
'arduino/library/dependenciesForLibrary',
|
||||||
|
'Dependencies for library {0}:{1}',
|
||||||
|
item.name,
|
||||||
|
version
|
||||||
|
),
|
||||||
message,
|
message,
|
||||||
buttons: ['Install all', `Install ${item.name} only`, 'Cancel'],
|
buttons: [
|
||||||
|
nls.localize('arduino/library/installAll', 'Install all'),
|
||||||
|
nls.localize(
|
||||||
|
'arduino/library/installOnly',
|
||||||
|
'Install {0} only',
|
||||||
|
item.name
|
||||||
|
),
|
||||||
|
nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
|
],
|
||||||
maxWidth: 740, // Aligned with `settings-dialog.css`.
|
maxWidth: 740, // Aligned with `settings-dialog.css`.
|
||||||
}).open();
|
}).open();
|
||||||
|
|
||||||
@ -116,7 +147,12 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
|||||||
installDependencies,
|
installDependencies,
|
||||||
});
|
});
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Successfully installed library ${item.name}:${version}`,
|
nls.localize(
|
||||||
|
'arduino/library/installedSuccessfully',
|
||||||
|
'Successfully installed library {0}:{1}',
|
||||||
|
item.name,
|
||||||
|
version
|
||||||
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -131,7 +167,12 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
|
|||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
await super.uninstall({ item, progressId });
|
await super.uninstall({ item, progressId });
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Successfully uninstalled library ${item.name}:${item.installedVersion}`,
|
nls.localize(
|
||||||
|
'arduino/library/uninstalledSuccessfully',
|
||||||
|
'Successfully uninstalled library {0}:{1}',
|
||||||
|
item.name,
|
||||||
|
item.installedVersion!
|
||||||
|
),
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -143,7 +184,9 @@ class MessageBoxDialog extends AbstractDialog<MessageBoxDialog.Result> {
|
|||||||
constructor(protected readonly options: MessageBoxDialog.Options) {
|
constructor(protected readonly options: MessageBoxDialog.Options) {
|
||||||
super(options);
|
super(options);
|
||||||
this.contentNode.appendChild(this.createMessageNode(this.options.message));
|
this.contentNode.appendChild(this.createMessageNode(this.options.message));
|
||||||
(options.buttons || ['OK']).forEach((text, index) => {
|
(
|
||||||
|
options.buttons || [nls.localize('vscode/issueMainService/ok', 'OK')]
|
||||||
|
).forEach((text, index) => {
|
||||||
const button = this.createButton(text);
|
const button = this.createButton(text);
|
||||||
button.classList.add(index === 0 ? 'main' : 'secondary');
|
button.classList.add(index === 0 ? 'main' : 'secondary');
|
||||||
this.controlPanel.appendChild(button);
|
this.controlPanel.appendChild(button);
|
||||||
|
@ -4,6 +4,7 @@ import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-con
|
|||||||
import { MenuModelRegistry } from '@theia/core';
|
import { MenuModelRegistry } from '@theia/core';
|
||||||
import { LibraryListWidget } from './library-list-widget';
|
import { LibraryListWidget } from './library-list-widget';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class LibraryListWidgetFrontendContribution
|
export class LibraryListWidgetFrontendContribution
|
||||||
@ -31,7 +32,10 @@ export class LibraryListWidgetFrontendContribution
|
|||||||
if (this.toggleCommand) {
|
if (this.toggleCommand) {
|
||||||
menus.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
menus.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
||||||
commandId: this.toggleCommand.id,
|
commandId: this.toggleCommand.id,
|
||||||
label: 'Manage Libraries...',
|
label: nls.localize(
|
||||||
|
'arduino/library/manageLibraries',
|
||||||
|
'Manage Libraries...'
|
||||||
|
),
|
||||||
order: '3',
|
order: '3',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import {
|
|||||||
import { BoardsConfig } from '../boards/boards-config';
|
import { BoardsConfig } from '../boards/boards-config';
|
||||||
import { MonitorModel } from './monitor-model';
|
import { MonitorModel } from './monitor-model';
|
||||||
import { NotificationCenter } from '../notification-center';
|
import { NotificationCenter } from '../notification-center';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class MonitorConnection {
|
export class MonitorConnection {
|
||||||
@ -145,7 +146,11 @@ export class MonitorConnection {
|
|||||||
}
|
}
|
||||||
case MonitorError.ErrorCodes.DEVICE_BUSY: {
|
case MonitorError.ErrorCodes.DEVICE_BUSY: {
|
||||||
this.messageService.warn(
|
this.messageService.warn(
|
||||||
`Connection failed. Serial port is busy: ${Port.toString(port)}.`,
|
nls.localize(
|
||||||
|
'arduino/monitor/connectionBusy',
|
||||||
|
'Connection failed. Serial port is busy: {0}',
|
||||||
|
Port.toString(port)
|
||||||
|
),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
shouldReconnect = this.autoConnect;
|
shouldReconnect = this.autoConnect;
|
||||||
@ -154,18 +159,26 @@ export class MonitorConnection {
|
|||||||
}
|
}
|
||||||
case MonitorError.ErrorCodes.DEVICE_NOT_CONFIGURED: {
|
case MonitorError.ErrorCodes.DEVICE_NOT_CONFIGURED: {
|
||||||
this.messageService.info(
|
this.messageService.info(
|
||||||
`Disconnected ${Board.toString(board, {
|
nls.localize(
|
||||||
|
'arduino/monitor/disconnected',
|
||||||
|
'Disconnected {0} from {1}.',
|
||||||
|
Board.toString(board, {
|
||||||
useFqbn: false,
|
useFqbn: false,
|
||||||
})} from ${Port.toString(port)}.`,
|
}),
|
||||||
|
Port.toString(port)
|
||||||
|
),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case undefined: {
|
case undefined: {
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
`Unexpected error. Reconnecting ${Board.toString(
|
nls.localize(
|
||||||
board
|
'arduino/monitor/unexpectedError',
|
||||||
)} on port ${Port.toString(port)}.`,
|
'Unexpected error. Reconnecting {0} on port {1}.',
|
||||||
|
Board.toString(board),
|
||||||
|
Port.toString(port)
|
||||||
|
),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
console.error(JSON.stringify(error));
|
console.error(JSON.stringify(error));
|
||||||
@ -179,11 +192,14 @@ export class MonitorConnection {
|
|||||||
if (shouldReconnect) {
|
if (shouldReconnect) {
|
||||||
if (this.monitorErrors.length >= 10) {
|
if (this.monitorErrors.length >= 10) {
|
||||||
this.messageService.warn(
|
this.messageService.warn(
|
||||||
`Failed to reconnect ${Board.toString(board, {
|
nls.localize(
|
||||||
|
'arduino/monitor/failedReconnect',
|
||||||
|
'Failed to reconnect {0} to the the serial-monitor after 10 consecutive attempts. The {1} serial port is busy.',
|
||||||
|
Board.toString(board, {
|
||||||
useFqbn: false,
|
useFqbn: false,
|
||||||
})} to the the serial-monitor after 10 consecutive attempts. The ${Port.toString(
|
}),
|
||||||
port
|
Port.toString(port)
|
||||||
)} serial port is busy. after 10 consecutive attempts.`
|
)
|
||||||
);
|
);
|
||||||
this.monitorErrors.length = 0;
|
this.monitorErrors.length = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -194,9 +210,15 @@ export class MonitorConnection {
|
|||||||
}
|
}
|
||||||
const timeout = attempts * 1000;
|
const timeout = attempts * 1000;
|
||||||
this.messageService.warn(
|
this.messageService.warn(
|
||||||
`Reconnecting ${Board.toString(board, {
|
nls.localize(
|
||||||
|
'arduino/monitor/reconnect',
|
||||||
|
'Reconnecting {0} to {1} in {2] seconds...',
|
||||||
|
Board.toString(board, {
|
||||||
useFqbn: false,
|
useFqbn: false,
|
||||||
})} to ${Port.toString(port)} in ${attempts} seconds...`,
|
}),
|
||||||
|
Port.toString(port),
|
||||||
|
attempts.toString()
|
||||||
|
),
|
||||||
{ timeout }
|
{ timeout }
|
||||||
);
|
);
|
||||||
this.reconnectTimeout = window.setTimeout(
|
this.reconnectTimeout = window.setTimeout(
|
||||||
|
@ -10,22 +10,32 @@ import {
|
|||||||
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
||||||
import { MonitorModel } from './monitor-model';
|
import { MonitorModel } from './monitor-model';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export namespace SerialMonitor {
|
export namespace SerialMonitor {
|
||||||
export namespace Commands {
|
export namespace Commands {
|
||||||
export const AUTOSCROLL: Command = {
|
export const AUTOSCROLL = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'serial-monitor-autoscroll',
|
id: 'serial-monitor-autoscroll',
|
||||||
label: 'Autoscroll',
|
label: 'Autoscroll',
|
||||||
};
|
},
|
||||||
export const TIMESTAMP: Command = {
|
'arduino/monitor/autoscroll'
|
||||||
|
);
|
||||||
|
export const TIMESTAMP = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'serial-monitor-timestamp',
|
id: 'serial-monitor-timestamp',
|
||||||
label: 'Timestamp',
|
label: 'Timestamp',
|
||||||
};
|
},
|
||||||
export const CLEAR_OUTPUT: Command = {
|
'arduino/monitor/timestamp'
|
||||||
|
);
|
||||||
|
export const CLEAR_OUTPUT = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'serial-monitor-clear-output',
|
id: 'serial-monitor-clear-output',
|
||||||
label: 'Clear Output',
|
label: 'Clear Output',
|
||||||
iconClass: 'clear-all',
|
iconClass: 'clear-all',
|
||||||
};
|
},
|
||||||
|
'vscode/output.contribution/clearOutput.label'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +53,7 @@ export class MonitorViewContribution
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
widgetId: MonitorWidget.ID,
|
widgetId: MonitorWidget.ID,
|
||||||
widgetName: 'Serial Monitor',
|
widgetName: MonitorWidget.LABEL,
|
||||||
defaultWidgetOptions: {
|
defaultWidgetOptions: {
|
||||||
area: 'bottom',
|
area: 'bottom',
|
||||||
},
|
},
|
||||||
@ -56,7 +66,7 @@ export class MonitorViewContribution
|
|||||||
if (this.toggleCommand) {
|
if (this.toggleCommand) {
|
||||||
menus.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
menus.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
|
||||||
commandId: this.toggleCommand.id,
|
commandId: this.toggleCommand.id,
|
||||||
label: 'Serial Monitor',
|
label: MonitorWidget.LABEL,
|
||||||
order: '5',
|
order: '5',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -78,7 +88,10 @@ export class MonitorViewContribution
|
|||||||
registry.registerItem({
|
registry.registerItem({
|
||||||
id: SerialMonitor.Commands.CLEAR_OUTPUT.id,
|
id: SerialMonitor.Commands.CLEAR_OUTPUT.id,
|
||||||
command: SerialMonitor.Commands.CLEAR_OUTPUT.id,
|
command: SerialMonitor.Commands.CLEAR_OUTPUT.id,
|
||||||
tooltip: 'Clear Output',
|
tooltip: nls.localize(
|
||||||
|
'vscode/output.contribution/clearOutput.label',
|
||||||
|
'Clear Output'
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +133,10 @@ export class MonitorViewContribution
|
|||||||
return (
|
return (
|
||||||
<React.Fragment key="autoscroll-toolbar-item">
|
<React.Fragment key="autoscroll-toolbar-item">
|
||||||
<div
|
<div
|
||||||
title="Toggle Autoscroll"
|
title={nls.localize(
|
||||||
|
'vscode/output.contribution/toggleAutoScroll',
|
||||||
|
'Toggle Autoscroll'
|
||||||
|
)}
|
||||||
className={`item enabled fa fa-angle-double-down arduino-monitor ${
|
className={`item enabled fa fa-angle-double-down arduino-monitor ${
|
||||||
this.model.autoscroll ? 'toggled' : ''
|
this.model.autoscroll ? 'toggled' : ''
|
||||||
}`}
|
}`}
|
||||||
@ -139,7 +155,10 @@ export class MonitorViewContribution
|
|||||||
return (
|
return (
|
||||||
<React.Fragment key="line-ending-toolbar-item">
|
<React.Fragment key="line-ending-toolbar-item">
|
||||||
<div
|
<div
|
||||||
title="Toggle Timestamp"
|
title={nls.localize(
|
||||||
|
'arduino/monitor/toggleTimestamp',
|
||||||
|
'Toggle Timestamp'
|
||||||
|
)}
|
||||||
className={`item enabled fa fa-clock-o arduino-monitor ${
|
className={`item enabled fa fa-clock-o arduino-monitor ${
|
||||||
this.model.timestamp ? 'toggled' : ''
|
this.model.timestamp ? 'toggled' : ''
|
||||||
}`}
|
}`}
|
||||||
|
@ -15,9 +15,14 @@ import { MonitorModel } from './monitor-model';
|
|||||||
import { MonitorConnection } from './monitor-connection';
|
import { MonitorConnection } from './monitor-connection';
|
||||||
import { SerialMonitorSendInput } from './serial-monitor-send-input';
|
import { SerialMonitorSendInput } from './serial-monitor-send-input';
|
||||||
import { SerialMonitorOutput } from './serial-monitor-send-output';
|
import { SerialMonitorOutput } from './serial-monitor-send-output';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class MonitorWidget extends ReactWidget {
|
export class MonitorWidget extends ReactWidget {
|
||||||
|
static readonly LABEL = nls.localize(
|
||||||
|
'arduino/monitor/title',
|
||||||
|
'Serial Monitor'
|
||||||
|
);
|
||||||
static readonly ID = 'serial-monitor';
|
static readonly ID = 'serial-monitor';
|
||||||
|
|
||||||
@inject(MonitorModel)
|
@inject(MonitorModel)
|
||||||
@ -42,7 +47,7 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.id = MonitorWidget.ID;
|
this.id = MonitorWidget.ID;
|
||||||
this.title.label = 'Serial Monitor';
|
this.title.label = MonitorWidget.LABEL;
|
||||||
this.title.iconClass = 'monitor-tab-icon';
|
this.title.iconClass = 'monitor-tab-icon';
|
||||||
this.title.closable = true;
|
this.title.closable = true;
|
||||||
this.scrollOptions = undefined;
|
this.scrollOptions = undefined;
|
||||||
@ -118,19 +123,25 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
> {
|
> {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'No Line Ending',
|
label: nls.localize('arduino/monitor/noLineEndings', 'No Line Ending'),
|
||||||
value: '',
|
value: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'New Line',
|
label: nls.localize('arduino/monitor/newLine', 'New Line'),
|
||||||
value: '\n',
|
value: '\n',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Carriage Return',
|
label: nls.localize(
|
||||||
|
'arduino/monitor/carriageReturn',
|
||||||
|
'Carriage Return'
|
||||||
|
),
|
||||||
value: '\r',
|
value: '\r',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Both NL & CR',
|
label: nls.localize(
|
||||||
|
'arduino/monitor/newLineCarriageReturn',
|
||||||
|
'Both NL & CR'
|
||||||
|
),
|
||||||
value: '\r\n',
|
value: '\r\n',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -3,6 +3,7 @@ import { Key, KeyCode } from '@theia/core/lib/browser/keys';
|
|||||||
import { Board, Port } from '../../common/protocol/boards-service';
|
import { Board, Port } from '../../common/protocol/boards-service';
|
||||||
import { MonitorConfig } from '../../common/protocol/monitor-service';
|
import { MonitorConfig } from '../../common/protocol/monitor-service';
|
||||||
import { isOSX } from '@theia/core/lib/common/os';
|
import { isOSX } from '@theia/core/lib/common/os';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export namespace SerialMonitorSendInput {
|
export namespace SerialMonitorSendInput {
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -44,14 +45,21 @@ export class SerialMonitorSendInput extends React.Component<
|
|||||||
protected get placeholder(): string {
|
protected get placeholder(): string {
|
||||||
const { monitorConfig } = this.props;
|
const { monitorConfig } = this.props;
|
||||||
if (!monitorConfig) {
|
if (!monitorConfig) {
|
||||||
return 'Not connected. Select a board and a port to connect automatically.';
|
return nls.localize(
|
||||||
|
'arduino/monitor/notConnected',
|
||||||
|
'Not connected. Select a board and a port to connect automatically.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const { board, port } = monitorConfig;
|
const { board, port } = monitorConfig;
|
||||||
return `Message (${
|
return nls.localize(
|
||||||
isOSX ? '⌘' : 'Ctrl'
|
'arduino/monitor/message',
|
||||||
}+Enter to send message to '${Board.toString(board, {
|
"Message ({0} + Enter to send message to '{1}' on '{2}'",
|
||||||
|
isOSX ? '⌘' : nls.localize('vscode/keybindingLabels/ctrlKey', 'Ctrl'),
|
||||||
|
Board.toString(board, {
|
||||||
useFqbn: false,
|
useFqbn: false,
|
||||||
})}' on '${Port.toString(port)}')`;
|
}),
|
||||||
|
Port.toString(port)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected setRef = (element: HTMLElement | null) => {
|
protected setRef = (element: HTMLElement | null) => {
|
||||||
|
@ -33,6 +33,7 @@ import {
|
|||||||
ProxySettings,
|
ProxySettings,
|
||||||
} from '../common/protocol';
|
} from '../common/protocol';
|
||||||
import { AbstractDialog } from './theia/dialogs/dialogs';
|
import { AbstractDialog } from './theia/dialogs/dialogs';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const EDITOR_SETTING = 'editor';
|
const EDITOR_SETTING = 'editor';
|
||||||
const FONT_SIZE_SETTING = `${EDITOR_SETTING}.fontSize`;
|
const FONT_SIZE_SETTING = `${EDITOR_SETTING}.fontSize`;
|
||||||
@ -203,17 +204,27 @@ export class SettingsService {
|
|||||||
const { sketchbookPath, editorFontSize, themeId } = await settings;
|
const { sketchbookPath, editorFontSize, themeId } = await settings;
|
||||||
const sketchbookDir = await this.fileSystemExt.getUri(sketchbookPath);
|
const sketchbookDir = await this.fileSystemExt.getUri(sketchbookPath);
|
||||||
if (!(await this.fileService.exists(new URI(sketchbookDir)))) {
|
if (!(await this.fileService.exists(new URI(sketchbookDir)))) {
|
||||||
return `Invalid sketchbook location: ${sketchbookPath}`;
|
return nls.localize(
|
||||||
|
'arduino/preferences/invalid.sketchbook.location',
|
||||||
|
'Invalid sketchbook location: {0}',
|
||||||
|
sketchbookPath
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (editorFontSize <= 0) {
|
if (editorFontSize <= 0) {
|
||||||
return 'Invalid editor font size. It must be a positive integer.';
|
return nls.localize(
|
||||||
|
'arduino/preferences/invalid.editorFontSize',
|
||||||
|
'Invalid editor font size. It must be a positive integer.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!ThemeService.get()
|
!ThemeService.get()
|
||||||
.getThemes()
|
.getThemes()
|
||||||
.find(({ id }) => id === themeId)
|
.find(({ id }) => id === themeId)
|
||||||
) {
|
) {
|
||||||
return 'Invalid theme.';
|
return nls.localize(
|
||||||
|
'arduino/preferences/invalid.theme',
|
||||||
|
'Invalid theme.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -366,8 +377,8 @@ export class SettingsComponent extends React.Component<
|
|||||||
return (
|
return (
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<TabList>
|
<TabList>
|
||||||
<Tab>Settings</Tab>
|
<Tab>{nls.localize('vscode/settingsTree/settings', 'Settings')}</Tab>
|
||||||
<Tab>Network</Tab>
|
<Tab>{nls.localize('arduino/preferences/network', 'Network')}</Tab>
|
||||||
</TabList>
|
</TabList>
|
||||||
<TabPanel>{this.renderSettings()}</TabPanel>
|
<TabPanel>{this.renderSettings()}</TabPanel>
|
||||||
<TabPanel>{this.renderNetwork()}</TabPanel>
|
<TabPanel>{this.renderNetwork()}</TabPanel>
|
||||||
@ -378,7 +389,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
protected renderSettings(): React.ReactNode {
|
protected renderSettings(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<div className="content noselect">
|
<div className="content noselect">
|
||||||
Sketchbook location:
|
{nls.localize(
|
||||||
|
'arduino/preferences/sketchbook.location',
|
||||||
|
'Sketchbook location'
|
||||||
|
) + ':'}
|
||||||
<div className="flex-line">
|
<div className="flex-line">
|
||||||
<input
|
<input
|
||||||
className="theia-input stretch"
|
className="theia-input stretch"
|
||||||
@ -390,7 +404,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
className="theia-button shrink"
|
className="theia-button shrink"
|
||||||
onClick={this.browseSketchbookDidClick}
|
onClick={this.browseSketchbookDidClick}
|
||||||
>
|
>
|
||||||
Browse
|
{nls.localize('arduino/preferences/browse', 'Browse')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
@ -399,15 +413,43 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.sketchbookShowAllFiles === true}
|
checked={this.state.sketchbookShowAllFiles === true}
|
||||||
onChange={this.sketchbookShowAllFilesDidChange}
|
onChange={this.sketchbookShowAllFilesDidChange}
|
||||||
/>
|
/>
|
||||||
Show files inside Sketches
|
{nls.localize(
|
||||||
|
'arduino/preferences/files.inside.sketches',
|
||||||
|
'Show files inside Sketches'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<div className="flex-line">
|
<div className="flex-line">
|
||||||
<div className="column">
|
<div className="column">
|
||||||
<div className="flex-line">Editor font size:</div>
|
<div className="flex-line">
|
||||||
<div className="flex-line">Interface scale:</div>
|
{nls.localize(
|
||||||
<div className="flex-line">Theme:</div>
|
'arduino/preferences/editorFontSize',
|
||||||
<div className="flex-line">Show verbose output during:</div>
|
'Editor font size'
|
||||||
<div className="flex-line">Compiler warnings:</div>
|
) + ':'}
|
||||||
|
</div>
|
||||||
|
<div className="flex-line">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/preferences/interfaceScale',
|
||||||
|
'Interface scale'
|
||||||
|
) + ':'}
|
||||||
|
</div>
|
||||||
|
<div className="flex-line">
|
||||||
|
{nls.localize(
|
||||||
|
'vscode/themes.contribution/selectTheme.label',
|
||||||
|
'Theme'
|
||||||
|
) + ':'}
|
||||||
|
</div>
|
||||||
|
<div className="flex-line">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/preferences/showVerbose',
|
||||||
|
'Show verbose output during'
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="flex-line">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/preferences/compilerWarnings',
|
||||||
|
'Compiler warnings'
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="column">
|
<div className="column">
|
||||||
<div className="flex-line">
|
<div className="flex-line">
|
||||||
@ -428,7 +470,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.autoScaleInterface}
|
checked={this.state.autoScaleInterface}
|
||||||
onChange={this.autoScaleInterfaceDidChange}
|
onChange={this.autoScaleInterfaceDidChange}
|
||||||
/>
|
/>
|
||||||
Automatic
|
{nls.localize('arduino/preferences/automatic', 'Automatic')}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
className="theia-input small with-margin"
|
className="theia-input small with-margin"
|
||||||
@ -448,7 +490,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
ThemeService.get()
|
ThemeService.get()
|
||||||
.getThemes()
|
.getThemes()
|
||||||
.find(({ id }) => id === this.state.themeId)?.label ||
|
.find(({ id }) => id === this.state.themeId)?.label ||
|
||||||
'Unknown'
|
nls.localize('arduino/common/unknown', 'Unknown')
|
||||||
}
|
}
|
||||||
onChange={this.themeDidChange}
|
onChange={this.themeDidChange}
|
||||||
>
|
>
|
||||||
@ -468,7 +510,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.verboseOnCompile}
|
checked={this.state.verboseOnCompile}
|
||||||
onChange={this.verboseOnCompileDidChange}
|
onChange={this.verboseOnCompileDidChange}
|
||||||
/>
|
/>
|
||||||
compile
|
{nls.localize('arduino/preferences/compile', 'compile')}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -476,7 +518,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.verboseOnUpload}
|
checked={this.state.verboseOnUpload}
|
||||||
onChange={this.verboseOnUploadDidChange}
|
onChange={this.verboseOnUploadDidChange}
|
||||||
/>
|
/>
|
||||||
upload
|
{nls.localize('arduino/preferences/upload', 'upload')}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-line">
|
<div className="flex-line">
|
||||||
@ -500,7 +542,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.verifyAfterUpload}
|
checked={this.state.verifyAfterUpload}
|
||||||
onChange={this.verifyAfterUploadDidChange}
|
onChange={this.verifyAfterUploadDidChange}
|
||||||
/>
|
/>
|
||||||
Verify code after upload
|
{nls.localize(
|
||||||
|
'arduino/preferences/verifyAfterUpload',
|
||||||
|
'Verify code after upload'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -509,7 +554,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
onChange={this.checkForUpdatesDidChange}
|
onChange={this.checkForUpdatesDidChange}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
Check for updates on startup
|
{nls.localize(
|
||||||
|
'arduino/preferences/checkForUpdates',
|
||||||
|
'Check for updates on startup'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -517,7 +565,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.autoSave === 'on'}
|
checked={this.state.autoSave === 'on'}
|
||||||
onChange={this.autoSaveDidChange}
|
onChange={this.autoSaveDidChange}
|
||||||
/>
|
/>
|
||||||
Auto save
|
{nls.localize(
|
||||||
|
'vscode/fileActions.contribution/miAutoSave',
|
||||||
|
'Auto save'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -525,7 +576,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.quickSuggestions.other === true}
|
checked={this.state.quickSuggestions.other === true}
|
||||||
onChange={this.quickSuggestionsOtherDidChange}
|
onChange={this.quickSuggestionsOtherDidChange}
|
||||||
/>
|
/>
|
||||||
Editor Quick Suggestions
|
{nls.localize(
|
||||||
|
'arduino/preferences/editorQuickSuggestions',
|
||||||
|
'Editor Quick Suggestions'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -533,10 +587,16 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.enableLsLogs}
|
checked={this.state.enableLsLogs}
|
||||||
onChange={this.enableLsLogsDidChange}
|
onChange={this.enableLsLogsDidChange}
|
||||||
/>
|
/>
|
||||||
Enable language server logging
|
{nls.localize(
|
||||||
|
'arduino/preferences/languageServerLogging',
|
||||||
|
'Enable language server logging'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
<div className="flex-line">
|
<div className="flex-line">
|
||||||
Additional boards manager URLs:
|
{nls.localize(
|
||||||
|
'arduino/preferences/additionalManagerURLs',
|
||||||
|
'Additional boards manager URLs'
|
||||||
|
) + ':'}
|
||||||
<input
|
<input
|
||||||
className="theia-input stretch with-margin"
|
className="theia-input stretch with-margin"
|
||||||
type="text"
|
type="text"
|
||||||
@ -562,7 +622,7 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.network === 'none'}
|
checked={this.state.network === 'none'}
|
||||||
onChange={this.noProxyDidChange}
|
onChange={this.noProxyDidChange}
|
||||||
/>
|
/>
|
||||||
No proxy
|
{nls.localize('arduino/preferences/noProxy', 'No proxy')}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex-line">
|
<label className="flex-line">
|
||||||
<input
|
<input
|
||||||
@ -570,7 +630,10 @@ export class SettingsComponent extends React.Component<
|
|||||||
checked={this.state.network !== 'none'}
|
checked={this.state.network !== 'none'}
|
||||||
onChange={this.manualProxyDidChange}
|
onChange={this.manualProxyDidChange}
|
||||||
/>
|
/>
|
||||||
Manual proxy configuration
|
{nls.localize(
|
||||||
|
'arduino/preferences/manualProxy',
|
||||||
|
'Manual proxy configuration'
|
||||||
|
)}
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
{this.renderProxySettings()}
|
{this.renderProxySettings()}
|
||||||
@ -703,8 +766,11 @@ export class SettingsComponent extends React.Component<
|
|||||||
|
|
||||||
protected browseSketchbookDidClick = async () => {
|
protected browseSketchbookDidClick = async () => {
|
||||||
const uri = await this.props.fileDialogService.showOpenDialog({
|
const uri = await this.props.fileDialogService.showOpenDialog({
|
||||||
title: 'Select new sketchbook location',
|
title: nls.localize(
|
||||||
openLabel: 'Choose',
|
'arduino/preferences/newSketchbookLocation',
|
||||||
|
'Select new sketchbook location'
|
||||||
|
),
|
||||||
|
openLabel: nls.localize('arduino/preferences/choose', 'Choose'),
|
||||||
canSelectFiles: false,
|
canSelectFiles: false,
|
||||||
canSelectMany: false,
|
canSelectMany: false,
|
||||||
canSelectFolders: true,
|
canSelectFolders: true,
|
||||||
@ -985,8 +1051,10 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
|
|||||||
) {
|
) {
|
||||||
super(props);
|
super(props);
|
||||||
this.contentNode.classList.add('arduino-settings-dialog');
|
this.contentNode.classList.add('arduino-settings-dialog');
|
||||||
this.appendCloseButton('CANCEL');
|
this.appendCloseButton(
|
||||||
this.appendAcceptButton('OK');
|
nls.localize('vscode/issueMainService/cancel', 'Cancel')
|
||||||
|
);
|
||||||
|
this.appendAcceptButton(nls.localize('vscode/issueMainService/ok', 'OK'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@postConstruct()
|
@postConstruct()
|
||||||
@ -1040,12 +1108,20 @@ export class AdditionalUrlsDialog extends AbstractDialog<string[]> {
|
|||||||
protected readonly textArea: HTMLTextAreaElement;
|
protected readonly textArea: HTMLTextAreaElement;
|
||||||
|
|
||||||
constructor(urls: string[], windowService: WindowService) {
|
constructor(urls: string[], windowService: WindowService) {
|
||||||
super({ title: 'Additional Boards Manager URLs' });
|
super({
|
||||||
|
title: nls.localize(
|
||||||
|
'arduino/preferences/additionalManagerURLs',
|
||||||
|
'Additional Boards Manager URLs'
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
this.contentNode.classList.add('additional-urls-dialog');
|
this.contentNode.classList.add('additional-urls-dialog');
|
||||||
|
|
||||||
const description = document.createElement('div');
|
const description = document.createElement('div');
|
||||||
description.textContent = 'Enter additional URLs, one for each row';
|
description.textContent = nls.localize(
|
||||||
|
'arduino/preferences/enterAdditionalURLs',
|
||||||
|
'Enter additional URLs, one for each row'
|
||||||
|
);
|
||||||
description.style.marginBottom = '5px';
|
description.style.marginBottom = '5px';
|
||||||
this.contentNode.appendChild(description);
|
this.contentNode.appendChild(description);
|
||||||
|
|
||||||
@ -1063,7 +1139,10 @@ export class AdditionalUrlsDialog extends AbstractDialog<string[]> {
|
|||||||
|
|
||||||
const anchor = document.createElement('div');
|
const anchor = document.createElement('div');
|
||||||
anchor.classList.add('link');
|
anchor.classList.add('link');
|
||||||
anchor.textContent = 'Click for a list of unofficial board support URLs';
|
anchor.textContent = nls.localize(
|
||||||
|
'arduino/preferences/unofficialBoardSupport',
|
||||||
|
'Click for a list of unofficial board support URLs'
|
||||||
|
);
|
||||||
anchor.style.marginTop = '5px';
|
anchor.style.marginTop = '5px';
|
||||||
anchor.style.cursor = 'pointer';
|
anchor.style.cursor = 'pointer';
|
||||||
this.addEventListener(anchor, 'click', () =>
|
this.addEventListener(anchor, 'click', () =>
|
||||||
@ -1074,8 +1153,10 @@ export class AdditionalUrlsDialog extends AbstractDialog<string[]> {
|
|||||||
);
|
);
|
||||||
this.contentNode.appendChild(anchor);
|
this.contentNode.appendChild(anchor);
|
||||||
|
|
||||||
this.appendAcceptButton('OK');
|
this.appendAcceptButton(nls.localize('vscode/issueMainService/ok', 'OK'));
|
||||||
this.appendCloseButton('Cancel');
|
this.appendCloseButton(
|
||||||
|
nls.localize('vscode/issueMainService/cancel', 'Cancel')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get value(): string[] {
|
get value(): string[] {
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
import { Sketch } from '../../../common/protocol';
|
import { Sketch } from '../../../common/protocol';
|
||||||
import { SaveAsSketch } from '../../contributions/save-as-sketch';
|
import { SaveAsSketch } from '../../contributions/save-as-sketch';
|
||||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ApplicationShell extends TheiaApplicationShell {
|
export class ApplicationShell extends TheiaApplicationShell {
|
||||||
@ -85,7 +86,10 @@ export class ApplicationShell extends TheiaApplicationShell {
|
|||||||
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE
|
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE
|
||||||
) {
|
) {
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
|
nls.localize(
|
||||||
|
'theia/core/couldNotSave',
|
||||||
'Could not save the sketch. Please copy your unsaved work into your favorite text editor, and restart the IDE.'
|
'Could not save the sketch. Please copy your unsaved work into your favorite text editor, and restart the IDE.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return; // Theia does not reject on failed save: https://github.com/eclipse-theia/theia/pull/8803
|
return; // Theia does not reject on failed save: https://github.com/eclipse-theia/theia/pull/8803
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
} from '@theia/core/lib/browser/connection-status-service';
|
} from '@theia/core/lib/browser/connection-status-service';
|
||||||
import { ArduinoDaemon } from '../../../common/protocol';
|
import { ArduinoDaemon } from '../../../common/protocol';
|
||||||
import { NotificationCenter } from '../../notification-center';
|
import { NotificationCenter } from '../../notification-center';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class FrontendConnectionStatusService extends TheiaFrontendConnectionStatusService {
|
export class FrontendConnectionStatusService extends TheiaFrontendConnectionStatusService {
|
||||||
@ -63,10 +64,19 @@ export class ApplicationConnectionStatusContribution extends TheiaApplicationCon
|
|||||||
protected handleOffline(): void {
|
protected handleOffline(): void {
|
||||||
this.statusBar.setElement('connection-status', {
|
this.statusBar.setElement('connection-status', {
|
||||||
alignment: StatusBarAlignment.LEFT,
|
alignment: StatusBarAlignment.LEFT,
|
||||||
text: this.isRunning ? 'Offline' : '$(bolt) CLI Daemon Offline',
|
text: this.isRunning
|
||||||
|
? nls.localize('theia/core/offline', 'Offline')
|
||||||
|
: '$(bolt) ' +
|
||||||
|
nls.localize('theia/core/daemonOffline', 'CLI Daemon Offline'),
|
||||||
tooltip: this.isRunning
|
tooltip: this.isRunning
|
||||||
? 'Cannot connect to the backend.'
|
? nls.localize(
|
||||||
: 'Cannot connect to the CLI daemon.',
|
'theia/core/cannotConnectBackend',
|
||||||
|
'Cannot connect to the backend.'
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'theia/core/cannotConnectDaemon',
|
||||||
|
'Cannot connect to the CLI daemon.'
|
||||||
|
),
|
||||||
priority: 5000,
|
priority: 5000,
|
||||||
});
|
});
|
||||||
this.toDisposeOnOnline.push(
|
this.toDisposeOnOnline.push(
|
||||||
|
@ -3,11 +3,15 @@ import { DebugError } from '@theia/debug/lib/common/debug-service';
|
|||||||
import { DebugSession } from '@theia/debug/lib/browser/debug-session';
|
import { DebugSession } from '@theia/debug/lib/browser/debug-session';
|
||||||
import { DebugSessionOptions } from '@theia/debug/lib/browser/debug-session-options';
|
import { DebugSessionOptions } from '@theia/debug/lib/browser/debug-session-options';
|
||||||
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
|
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class DebugSessionManager extends TheiaDebugSessionManager {
|
export class DebugSessionManager extends TheiaDebugSessionManager {
|
||||||
async start(options: DebugSessionOptions): Promise<DebugSession | undefined> {
|
async start(options: DebugSessionOptions): Promise<DebugSession | undefined> {
|
||||||
return this.progressService.withProgress('Start...', 'debug', async () => {
|
return this.progressService.withProgress(
|
||||||
|
nls.localize('theia/debug/start', 'Start...'),
|
||||||
|
'debug',
|
||||||
|
async () => {
|
||||||
try {
|
try {
|
||||||
// Only save when dirty. To avoid saving temporary sketches.
|
// Only save when dirty. To avoid saving temporary sketches.
|
||||||
// This is a quick fix for not saving the editor when there are no dirty editors.
|
// This is a quick fix for not saving the editor when there are no dirty editors.
|
||||||
@ -37,17 +41,25 @@ export class DebugSessionManager extends TheiaDebugSessionManager {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DebugError.NotFound.is(e)) {
|
if (DebugError.NotFound.is(e)) {
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
`The debug session type "${e.data.type}" is not supported.`
|
nls.localize(
|
||||||
|
'theia/debug/typeNotSupported',
|
||||||
|
'The debug session type "{0}" is not supported.',
|
||||||
|
e.data.type
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
|
nls.localize(
|
||||||
|
'theia/debug/startError',
|
||||||
'There was an error starting the debug session, check the logs for more details.'
|
'There was an error starting the debug session, check the logs for more details.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
console.error('Error starting the debug session', e);
|
console.error('Error starting the debug session', e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import { LabelProvider } from '@theia/core/lib/browser';
|
|||||||
import { EditorWidgetFactory as TheiaEditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
|
import { EditorWidgetFactory as TheiaEditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
|
||||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||||
import { SketchesService, Sketch } from '../../../common/protocol';
|
import { SketchesService, Sketch } from '../../../common/protocol';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class EditorWidgetFactory extends TheiaEditorWidgetFactory {
|
export class EditorWidgetFactory extends TheiaEditorWidgetFactory {
|
||||||
@ -30,7 +31,11 @@ export class EditorWidgetFactory extends TheiaEditorWidgetFactory {
|
|||||||
if (sketch && Sketch.isInSketch(uri, sketch)) {
|
if (sketch && Sketch.isInSketch(uri, sketch)) {
|
||||||
const isTemp = await this.sketchesService.isTemp(sketch);
|
const isTemp = await this.sketchesService.isTemp(sketch);
|
||||||
if (isTemp) {
|
if (isTemp) {
|
||||||
widget.title.caption = `Unsaved – ${this.labelProvider.getName(uri)}`;
|
widget.title.caption = nls.localize(
|
||||||
|
'theia/editor/unsavedTitle',
|
||||||
|
'Unsaved – {0}',
|
||||||
|
this.labelProvider.getName(uri)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return widget;
|
return widget;
|
||||||
|
@ -5,13 +5,17 @@ import {
|
|||||||
KeymapsCommands,
|
KeymapsCommands,
|
||||||
} from '@theia/keymaps/lib/browser/keymaps-frontend-contribution';
|
} from '@theia/keymaps/lib/browser/keymaps-frontend-contribution';
|
||||||
import { ArduinoMenus } from '../../menu/arduino-menus';
|
import { ArduinoMenus } from '../../menu/arduino-menus';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class KeymapsFrontendContribution extends TheiaKeymapsFrontendContribution {
|
export class KeymapsFrontendContribution extends TheiaKeymapsFrontendContribution {
|
||||||
registerMenus(menus: MenuModelRegistry): void {
|
registerMenus(menus: MenuModelRegistry): void {
|
||||||
menus.registerMenuAction(ArduinoMenus.FILE__ADVANCED_SUBMENU, {
|
menus.registerMenuAction(ArduinoMenus.FILE__ADVANCED_SUBMENU, {
|
||||||
commandId: KeymapsCommands.OPEN_KEYMAPS.id,
|
commandId: KeymapsCommands.OPEN_KEYMAPS.id,
|
||||||
label: 'Keyboard Shortcuts',
|
label: nls.localize(
|
||||||
|
'vscode/helpActions/miKeyboardShortcuts',
|
||||||
|
'Keyboard Shortcuts'
|
||||||
|
),
|
||||||
order: '1',
|
order: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { NotificationComponent } from './notification-component';
|
import { NotificationComponent } from './notification-component';
|
||||||
import { NotificationCenterComponent as TheiaNotificationCenterComponent } from '@theia/messages/lib/browser/notification-center-component';
|
import { NotificationCenterComponent as TheiaNotificationCenterComponent } from '@theia/messages/lib/browser/notification-center-component';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const PerfectScrollbar = require('react-perfect-scrollbar');
|
const PerfectScrollbar = require('react-perfect-scrollbar');
|
||||||
|
|
||||||
export class NotificationCenterComponent extends TheiaNotificationCenterComponent {
|
export class NotificationCenterComponent extends TheiaNotificationCenterComponent {
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
const empty = this.state.notifications.length === 0;
|
const empty = this.state.notifications.length === 0;
|
||||||
const title = empty ? 'NO NEW NOTIFICATIONS' : 'NOTIFICATIONS';
|
const title = empty
|
||||||
|
? nls.localize(
|
||||||
|
'vscode/notificationsCenter/notificationsEmpty',
|
||||||
|
'NO NEW NOTIFICATIONS'
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'vscode/notificationsCenter/notifications',
|
||||||
|
'NOTIFICATIONS'
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`theia-notifications-container theia-notification-center ${
|
className={`theia-notifications-container theia-notification-center ${
|
||||||
@ -20,12 +29,18 @@ export class NotificationCenterComponent extends TheiaNotificationCenterComponen
|
|||||||
<ul className="theia-notification-actions">
|
<ul className="theia-notification-actions">
|
||||||
<li
|
<li
|
||||||
className="collapse"
|
className="collapse"
|
||||||
title="Hide Notification Center"
|
title={nls.localize(
|
||||||
|
'vscode/notificationsStatus/hideNotifications',
|
||||||
|
'Hide Notification Center'
|
||||||
|
)}
|
||||||
onClick={this.onHide}
|
onClick={this.onHide}
|
||||||
/>
|
/>
|
||||||
<li
|
<li
|
||||||
className="clear-all"
|
className="clear-all"
|
||||||
title="Clear All"
|
title={nls.localize(
|
||||||
|
'vscode/notificationsCommands/clearAllNotifications',
|
||||||
|
'Clear All'
|
||||||
|
)}
|
||||||
onClick={this.onClearAll}
|
onClick={this.onClearAll}
|
||||||
/>
|
/>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { NotificationComponent as TheiaNotificationComponent } from '@theia/messages/lib/browser/notification-component';
|
import { NotificationComponent as TheiaNotificationComponent } from '@theia/messages/lib/browser/notification-component';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export class NotificationComponent extends TheiaNotificationComponent {
|
export class NotificationComponent extends TheiaNotificationComponent {
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
@ -26,7 +27,11 @@ export class NotificationComponent extends TheiaNotificationComponent {
|
|||||||
{expandable && (
|
{expandable && (
|
||||||
<li
|
<li
|
||||||
className={collapsed ? 'expand' : 'collapse'}
|
className={collapsed ? 'expand' : 'collapse'}
|
||||||
title={collapsed ? 'Expand' : 'Collapse'}
|
title={
|
||||||
|
collapsed
|
||||||
|
? nls.localize('theia/messages/expand', 'Expand')
|
||||||
|
: nls.localize('theia/messages/collapse', 'Collapse')
|
||||||
|
}
|
||||||
data-message-id={messageId}
|
data-message-id={messageId}
|
||||||
onClick={this.onToggleExpansion}
|
onClick={this.onToggleExpansion}
|
||||||
/>
|
/>
|
||||||
@ -34,7 +39,7 @@ export class NotificationComponent extends TheiaNotificationComponent {
|
|||||||
{!this.isProgress && (
|
{!this.isProgress && (
|
||||||
<li
|
<li
|
||||||
className="clear"
|
className="clear"
|
||||||
title="Clear"
|
title={nls.localize('vscode/abstractTree/clear', 'Clear')}
|
||||||
data-message-id={messageId}
|
data-message-id={messageId}
|
||||||
onClick={this.onClear}
|
onClick={this.onClear}
|
||||||
/>
|
/>
|
||||||
|
@ -15,6 +15,7 @@ import { WorkspaceInputDialog } from './workspace-input-dialog';
|
|||||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||||
import { SaveAsSketch } from '../../contributions/save-as-sketch';
|
import { SaveAsSketch } from '../../contributions/save-as-sketch';
|
||||||
import { SingleTextInputDialog } from '@theia/core/lib/browser';
|
import { SingleTextInputDialog } from '@theia/core/lib/browser';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribution {
|
export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribution {
|
||||||
@ -57,7 +58,7 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
|
|||||||
const parentUri = parent.resource;
|
const parentUri = parent.resource;
|
||||||
const dialog = new WorkspaceInputDialog(
|
const dialog = new WorkspaceInputDialog(
|
||||||
{
|
{
|
||||||
title: 'Name for new file',
|
title: nls.localize('theia/workspace/fileNewName', 'Name for new file'),
|
||||||
parentUri,
|
parentUri,
|
||||||
validate: (name) => this.validateFileName(name, parent, true),
|
validate: (name) => this.validateFileName(name, parent, true),
|
||||||
},
|
},
|
||||||
@ -93,10 +94,17 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
|
|||||||
}
|
}
|
||||||
const extension = nameWithExt.split('.').pop();
|
const extension = nameWithExt.split('.').pop();
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
return 'Invalid filename.'; // XXX: this should not happen as we forcefully append `.ino` if it's not there.
|
return nls.localize(
|
||||||
|
'theia/workspace/invalidFilename',
|
||||||
|
'Invalid filename.'
|
||||||
|
); // XXX: this should not happen as we forcefully append `.ino` if it's not there.
|
||||||
}
|
}
|
||||||
if (Sketch.Extensions.ALL.indexOf(`.${extension}`) === -1) {
|
if (Sketch.Extensions.ALL.indexOf(`.${extension}`) === -1) {
|
||||||
return `.${extension} is not a valid extension.`;
|
return nls.localize(
|
||||||
|
'theia/workspace/invalidExtension',
|
||||||
|
'.{0} is not a valid extension',
|
||||||
|
extension
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -151,7 +159,7 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
|
|||||||
}
|
}
|
||||||
const initialValue = uri.path.base;
|
const initialValue = uri.path.base;
|
||||||
const dialog = new SingleTextInputDialog({
|
const dialog = new SingleTextInputDialog({
|
||||||
title: 'New name for file',
|
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
|
||||||
initialValue,
|
initialValue,
|
||||||
initialSelectionRange: {
|
initialSelectionRange: {
|
||||||
start: 0,
|
start: 0,
|
||||||
|
@ -3,6 +3,7 @@ import { remote } from 'electron';
|
|||||||
import URI from '@theia/core/lib/common/uri';
|
import URI from '@theia/core/lib/common/uri';
|
||||||
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
|
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
|
||||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class WorkspaceDeleteHandler extends TheiaWorkspaceDeleteHandler {
|
export class WorkspaceDeleteHandler extends TheiaWorkspaceDeleteHandler {
|
||||||
@ -21,10 +22,16 @@ export class WorkspaceDeleteHandler extends TheiaWorkspaceDeleteHandler {
|
|||||||
.some((uri) => uri === sketch.mainFileUri)
|
.some((uri) => uri === sketch.mainFileUri)
|
||||||
) {
|
) {
|
||||||
const { response } = await remote.dialog.showMessageBox({
|
const { response } = await remote.dialog.showMessageBox({
|
||||||
title: 'Delete',
|
title: nls.localize('vscode/fileActions/delete', 'Delete'),
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Cancel', 'OK'],
|
buttons: [
|
||||||
message: 'Do you want to delete the current sketch?',
|
nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
|
nls.localize('vscode/issueMainService/ok', 'OK'),
|
||||||
|
],
|
||||||
|
message: nls.localize(
|
||||||
|
'theia/workspace/deleteCurrentSketch',
|
||||||
|
'Do you want to delete the current sketch?'
|
||||||
|
),
|
||||||
});
|
});
|
||||||
if (response === 1) {
|
if (response === 1) {
|
||||||
// OK
|
// OK
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
WorkspaceInputDialog as TheiaWorkspaceInputDialog,
|
WorkspaceInputDialog as TheiaWorkspaceInputDialog,
|
||||||
WorkspaceInputDialogProps,
|
WorkspaceInputDialogProps,
|
||||||
} from '@theia/workspace/lib/browser/workspace-input-dialog';
|
} from '@theia/workspace/lib/browser/workspace-input-dialog';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
|
export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
|
||||||
protected wasTouched = false;
|
protected wasTouched = false;
|
||||||
@ -16,7 +17,9 @@ export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
|
|||||||
@inject(LabelProvider) protected readonly labelProvider: LabelProvider
|
@inject(LabelProvider) protected readonly labelProvider: LabelProvider
|
||||||
) {
|
) {
|
||||||
super(props, labelProvider);
|
super(props, labelProvider);
|
||||||
this.appendCloseButton('Cancel');
|
this.appendCloseButton(
|
||||||
|
nls.localize('vscode/issueMainService/cancel', 'Cancel')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected appendParentPath(): void {
|
protected appendParentPath(): void {
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
|
import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
|
||||||
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
|
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
|
||||||
import { BoardsConfig } from '../../boards/boards-config';
|
import { BoardsConfig } from '../../boards/boards-config';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class WorkspaceService extends TheiaWorkspaceService {
|
export class WorkspaceService extends TheiaWorkspaceService {
|
||||||
@ -89,9 +90,10 @@ export class WorkspaceService extends TheiaWorkspaceService {
|
|||||||
.then(() => this.application.shell.update());
|
.then(() => this.application.shell.update());
|
||||||
this.logger.fatal(`Failed to determine the sketch directory: ${err}`);
|
this.logger.fatal(`Failed to determine the sketch directory: ${err}`);
|
||||||
this.messageService.error(
|
this.messageService.error(
|
||||||
'There was an error creating the sketch directory. ' +
|
nls.localize(
|
||||||
'See the log for more details. ' +
|
'theia/workspace/sketchDirectoryError',
|
||||||
'The application will probably not work as expected.'
|
'There was an error creating the sketch directory. See the log for more details. The application will probably not work as expected.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return super.getDefaultWorkspaceUri();
|
return super.getDefaultWorkspaceUri();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import { UserStatus } from './cloud-user-status';
|
|||||||
import { CloudSketchbookTreeWidget } from './cloud-sketchbook-tree-widget';
|
import { CloudSketchbookTreeWidget } from './cloud-sketchbook-tree-widget';
|
||||||
import { AuthenticationClientService } from '../../auth/authentication-client-service';
|
import { AuthenticationClientService } from '../../auth/authentication-client-service';
|
||||||
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';
|
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class CloudSketchbookCompositeWidget extends BaseWidget {
|
export class CloudSketchbookCompositeWidget extends BaseWidget {
|
||||||
@ -29,7 +30,10 @@ export class CloudSketchbookCompositeWidget extends BaseWidget {
|
|||||||
this.cloudUserStatusNode.classList.add('cloud-status-node');
|
this.cloudUserStatusNode.classList.add('cloud-status-node');
|
||||||
this.compositeNode.appendChild(this.cloudUserStatusNode);
|
this.compositeNode.appendChild(this.cloudUserStatusNode);
|
||||||
this.node.appendChild(this.compositeNode);
|
this.node.appendChild(this.compositeNode);
|
||||||
this.title.caption = 'Cloud Sketchbook';
|
this.title.caption = nls.localize(
|
||||||
|
'arduino/cloud/cloudSketchbook',
|
||||||
|
'Cloud Sketchbook'
|
||||||
|
);
|
||||||
this.title.iconClass = 'cloud-sketchbook-tree-icon';
|
this.title.iconClass = 'cloud-sketchbook-tree-icon';
|
||||||
this.title.closable = false;
|
this.title.closable = false;
|
||||||
this.id = 'cloud-sketchbook-composite-widget';
|
this.id = 'cloud-sketchbook-composite-widget';
|
||||||
|
@ -27,6 +27,7 @@ import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-ser
|
|||||||
import { Contribution } from '../../contributions/contribution';
|
import { Contribution } from '../../contributions/contribution';
|
||||||
import { ArduinoPreferences } from '../../arduino-preferences';
|
import { ArduinoPreferences } from '../../arduino-preferences';
|
||||||
import { MainMenuManager } from '../../../common/main-menu-manager';
|
import { MainMenuManager } from '../../../common/main-menu-manager';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export const SKETCHBOOKSYNC__CONTEXT = ['arduino-sketchbook-sync--context'];
|
export const SKETCHBOOKSYNC__CONTEXT = ['arduino-sketchbook-sync--context'];
|
||||||
|
|
||||||
@ -60,38 +61,56 @@ export namespace CloudSketchbookCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TOGGLE_CLOUD_SKETCHBOOK: Command = {
|
export const TOGGLE_CLOUD_SKETCHBOOK = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud-sketchbook--disable',
|
id: 'arduino-cloud-sketchbook--disable',
|
||||||
label: 'Show/Hide Remote Sketchbook',
|
label: 'Show/Hide Remote Sketchbook',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/showHideRemoveSketchbook'
|
||||||
|
);
|
||||||
|
|
||||||
export const PULL_SKETCH: Command = {
|
export const PULL_SKETCH = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud-sketchbook--pull-sketch',
|
id: 'arduino-cloud-sketchbook--pull-sketch',
|
||||||
label: 'Pull Sketch',
|
label: 'Pull Sketch',
|
||||||
iconClass: 'pull-sketch-icon',
|
iconClass: 'pull-sketch-icon',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/pullSketch'
|
||||||
|
);
|
||||||
|
|
||||||
export const PUSH_SKETCH: Command = {
|
export const PUSH_SKETCH = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud-sketchbook--push-sketch',
|
id: 'arduino-cloud-sketchbook--push-sketch',
|
||||||
label: 'Push Sketch',
|
label: 'Push Sketch',
|
||||||
iconClass: 'push-sketch-icon',
|
iconClass: 'push-sketch-icon',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/pullSketch'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_IN_CLOUD_EDITOR: Command = {
|
export const OPEN_IN_CLOUD_EDITOR = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud-sketchbook--open-in-cloud-editor',
|
id: 'arduino-cloud-sketchbook--open-in-cloud-editor',
|
||||||
label: 'Open in Cloud Editor',
|
label: 'Open in Cloud Editor',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/openInCloudEditor'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_SKETCHBOOKSYNC_CONTEXT_MENU: Command = {
|
export const OPEN_SKETCHBOOKSYNC_CONTEXT_MENU = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-sketchbook-sync--open-sketch-context-menu',
|
id: 'arduino-sketchbook-sync--open-sketch-context-menu',
|
||||||
label: 'Options...',
|
label: 'Options...',
|
||||||
iconClass: 'sketchbook-tree__opts',
|
iconClass: 'sketchbook-tree__opts',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/options'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_SKETCH_SHARE_DIALOG: Command = {
|
export const OPEN_SKETCH_SHARE_DIALOG = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-cloud-sketchbook--share-modal',
|
id: 'arduino-cloud-sketchbook--share-modal',
|
||||||
label: 'Share...',
|
label: 'Share...',
|
||||||
};
|
},
|
||||||
|
'arduino/cloud/share'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
|
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
|
||||||
id: 'arduino-cloud-sketchbook--open-profile-menu',
|
id: 'arduino-cloud-sketchbook--open-profile-menu',
|
||||||
@ -192,7 +211,7 @@ export class CloudSketchbookContribution extends Contribution {
|
|||||||
execute: (arg) => {
|
execute: (arg) => {
|
||||||
new ShareSketchDialog({
|
new ShareSketchDialog({
|
||||||
node: arg.node,
|
node: arg.node,
|
||||||
title: 'Share Sketch',
|
title: nls.localize('arduino/cloud/shareSketch', 'Share Sketch'),
|
||||||
createApi: this.createApi,
|
createApi: this.createApi,
|
||||||
}).open();
|
}).open();
|
||||||
},
|
},
|
||||||
|
@ -14,6 +14,7 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|||||||
import URI from '@theia/core/lib/common/uri';
|
import URI from '@theia/core/lib/common/uri';
|
||||||
import { SketchCache } from './cloud-sketch-cache';
|
import { SketchCache } from './cloud-sketch-cache';
|
||||||
import { Create } from '../../create/typings';
|
import { Create } from '../../create/typings';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export function sketchBaseDir(sketch: Create.Sketch): FileStat {
|
export function sketchBaseDir(sketch: Create.Sketch): FileStat {
|
||||||
// extract the sketch path
|
// extract the sketch path
|
||||||
@ -91,7 +92,9 @@ export class CloudSketchbookTreeModel extends SketchbookTreeModel {
|
|||||||
const sketches = await this.createApi.sketches();
|
const sketches = await this.createApi.sketches();
|
||||||
const rootFileStats = sketchesToFileStats(sketches);
|
const rootFileStats = sketchesToFileStats(sketches);
|
||||||
if (this.workspaceService.opened) {
|
if (this.workspaceService.opened) {
|
||||||
const workspaceNode = WorkspaceNode.createRoot('Remote');
|
const workspaceNode = WorkspaceNode.createRoot(
|
||||||
|
nls.localize('arduino/cloud/remote', 'Remote')
|
||||||
|
);
|
||||||
for await (const stat of rootFileStats) {
|
for await (const stat of rootFileStats) {
|
||||||
workspaceNode.children.push(
|
workspaceNode.children.push(
|
||||||
await this.tree.createWorkspaceRoot(stat, workspaceNode)
|
await this.tree.createWorkspaceRoot(stat, workspaceNode)
|
||||||
|
@ -11,6 +11,7 @@ import { TreeNode } from '@theia/core/lib/browser/tree';
|
|||||||
import { CompositeTreeNode } from '@theia/core/lib/browser';
|
import { CompositeTreeNode } from '@theia/core/lib/browser';
|
||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
import { SketchbookTreeWidget } from '../sketchbook/sketchbook-tree-widget';
|
import { SketchbookTreeWidget } from '../sketchbook/sketchbook-tree-widget';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const LEARN_MORE_URL =
|
const LEARN_MORE_URL =
|
||||||
'https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-cloud-sketch-sync';
|
'https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-cloud-sketch-sync';
|
||||||
@ -44,16 +45,26 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
|
|||||||
<div className="center item">
|
<div className="center item">
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
<b>Your Sketchbook is empty</b>
|
<b>
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/cloud/emptySketchbook',
|
||||||
|
'Your Sketchbook is empty'
|
||||||
|
)}
|
||||||
|
</b>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/cloud/visitArduinoCloud',
|
||||||
|
'Visit Arduino Cloud to create Cloud Sketches.'
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p>Visit Arduino Cloud to create Cloud Sketches.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className="theia-button"
|
className="theia-button"
|
||||||
onClick={() => shell.openExternal('https://create.arduino.cc/editor')}
|
onClick={() => shell.openExternal('https://create.arduino.cc/editor')}
|
||||||
>
|
>
|
||||||
GO TO CLOUD
|
{nls.localize('cloud/GoToCloud', 'GO TO CLOUD')}
|
||||||
</button>
|
</button>
|
||||||
<div className="center item"></div>
|
<div className="center item"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -102,9 +113,17 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
|
|||||||
<div className="cloud-sketchbook-welcome center">
|
<div className="cloud-sketchbook-welcome center">
|
||||||
<div className="center item">
|
<div className="center item">
|
||||||
<div>
|
<div>
|
||||||
<p className="sign-in-title">Sign in to Arduino Cloud</p>
|
<p className="sign-in-title">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/cloud/signInToCloud',
|
||||||
|
'Sign in to Arduino Cloud'
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
<p className="sign-in-desc">
|
<p className="sign-in-desc">
|
||||||
Sync and edit your Arduino Cloud Sketches
|
{nls.localize(
|
||||||
|
'arduino/cloud/syncEditSketches',
|
||||||
|
'Sync and edit your Arduino Cloud Sketches'
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -114,7 +133,7 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
|
|||||||
this.commandRegistry.executeCommand(CloudUserCommands.LOGIN.id)
|
this.commandRegistry.executeCommand(CloudUserCommands.LOGIN.id)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
SIGN IN
|
{nls.localize('arduino/cloud/signIn', 'SIGN IN')}
|
||||||
</button>
|
</button>
|
||||||
<div className="center item">
|
<div className="center item">
|
||||||
<div
|
<div
|
||||||
@ -125,7 +144,7 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Learn more
|
{nls.localize('arduino/cloud/learnMore', 'Learn more')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,6 +34,7 @@ import { FileStat } from '@theia/filesystem/lib/common/files';
|
|||||||
import { WorkspaceNode } from '@theia/navigator/lib/browser/navigator-tree';
|
import { WorkspaceNode } from '@theia/navigator/lib/browser/navigator-tree';
|
||||||
import { posix, splitSketchPath } from '../../create/create-paths';
|
import { posix, splitSketchPath } from '../../create/create-paths';
|
||||||
import { Create } from '../../create/typings';
|
import { Create } from '../../create/typings';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
const MESSAGE_TIMEOUT = 5 * 1000;
|
const MESSAGE_TIMEOUT = 5 * 1000;
|
||||||
const deepmerge = require('deepmerge').default;
|
const deepmerge = require('deepmerge').default;
|
||||||
@ -77,10 +78,13 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
|
|
||||||
if (warn) {
|
if (warn) {
|
||||||
const ok = await new DoNotAskAgainConfirmDialog({
|
const ok = await new DoNotAskAgainConfirmDialog({
|
||||||
ok: 'Continue',
|
ok: nls.localize('arduino/cloud/continue', 'Continue'),
|
||||||
cancel: 'Cancel',
|
cancel: nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
title: 'Push Sketch',
|
title: nls.localize('arduino/cloud/pushSketch', 'Push Sketch'),
|
||||||
msg: 'This is a Public Sketch. Before pushing, make sure any sensitive information is defined in arduino_secrets.h files. You can make a Sketch private from the Share panel.',
|
msg: nls.localize(
|
||||||
|
'arduino/cloud/pushSketchMsg',
|
||||||
|
'This is a Public Sketch. Before pushing, make sure any sensitive information is defined in arduino_secrets.h files. You can make a Sketch private from the Share panel.'
|
||||||
|
),
|
||||||
maxWidth: 400,
|
maxWidth: 400,
|
||||||
onAccept: () =>
|
onAccept: () =>
|
||||||
this.preferenceService.set(
|
this.preferenceService.set(
|
||||||
@ -113,10 +117,13 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
|
|
||||||
if (warn) {
|
if (warn) {
|
||||||
const ok = await new DoNotAskAgainConfirmDialog({
|
const ok = await new DoNotAskAgainConfirmDialog({
|
||||||
ok: 'Pull',
|
ok: nls.localize('arduino/cloud/pull', 'Pull'),
|
||||||
cancel: 'Cancel',
|
cancel: nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
title: 'Pull Sketch',
|
title: nls.localize('arduino/cloud/pullSketch', 'Pull Sketch'),
|
||||||
msg: 'Pulling this Sketch from the Cloud will overwrite its local version. Are you sure you want to continue?',
|
msg: nls.localize(
|
||||||
|
'arduino/cloud/pullSketchMsg',
|
||||||
|
'Pulling this Sketch from the Cloud will overwrite its local version. Are you sure you want to continue?'
|
||||||
|
),
|
||||||
maxWidth: 400,
|
maxWidth: 400,
|
||||||
onAccept: () =>
|
onAccept: () =>
|
||||||
this.preferenceService.set(
|
this.preferenceService.set(
|
||||||
@ -141,15 +148,27 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
this.sketchCache.purgeByPath(node.remoteUri.path.toString());
|
this.sketchCache.purgeByPath(node.remoteUri.path.toString());
|
||||||
|
|
||||||
node.commands = commandsCopy;
|
node.commands = commandsCopy;
|
||||||
this.messageService.info(`Done pulling ‘${node.fileStat.name}’.`, {
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/cloud/donePulling',
|
||||||
|
'Done pulling ‘{0}’.',
|
||||||
|
node.fileStat.name
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: MESSAGE_TIMEOUT,
|
timeout: MESSAGE_TIMEOUT,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async push(node: CloudSketchbookTree.CloudSketchDirNode): Promise<void> {
|
async push(node: CloudSketchbookTree.CloudSketchDirNode): Promise<void> {
|
||||||
if (!CloudSketchbookTree.CloudSketchTreeNode.isSynced(node)) {
|
if (!CloudSketchbookTree.CloudSketchTreeNode.isSynced(node)) {
|
||||||
throw new Error('Cannot push to Cloud. It is not yet pulled.');
|
throw new Error(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/cloud/notYetPulled',
|
||||||
|
'Cannot push to Cloud. It is not yet pulled.'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pushPublic = await this.pushPublicWarn(node);
|
const pushPublic = await this.pushPublicWarn(node);
|
||||||
@ -161,9 +180,9 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
|
|
||||||
if (warn) {
|
if (warn) {
|
||||||
const ok = await new DoNotAskAgainConfirmDialog({
|
const ok = await new DoNotAskAgainConfirmDialog({
|
||||||
ok: 'Push',
|
ok: nls.localize('arduino/cloud/push', 'Push'),
|
||||||
cancel: 'Cancel',
|
cancel: nls.localize('vscode/issueMainService/cancel', 'Cancel'),
|
||||||
title: 'Push Sketch',
|
title: nls.localize('arduino/cloud/pushSketch', 'Push Sketch'),
|
||||||
msg: 'Pushing this Sketch will overwrite its Cloud version. Are you sure you want to continue?',
|
msg: 'Pushing this Sketch will overwrite its Cloud version. Are you sure you want to continue?',
|
||||||
maxWidth: 400,
|
maxWidth: 400,
|
||||||
onAccept: () =>
|
onAccept: () =>
|
||||||
@ -180,7 +199,10 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
this.runWithState(node, 'pushing', async (node) => {
|
this.runWithState(node, 'pushing', async (node) => {
|
||||||
if (!CloudSketchbookTree.CloudSketchTreeNode.isSynced(node)) {
|
if (!CloudSketchbookTree.CloudSketchTreeNode.isSynced(node)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/cloud/pullFirst',
|
||||||
'You have to pull first to be able to push to the Cloud.'
|
'You have to pull first to be able to push to the Cloud.'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const commandsCopy = node.commands;
|
const commandsCopy = node.commands;
|
||||||
@ -194,9 +216,16 @@ export class CloudSketchbookTree extends SketchbookTree {
|
|||||||
this.sketchCache.purgeByPath(node.remoteUri.path.toString());
|
this.sketchCache.purgeByPath(node.remoteUri.path.toString());
|
||||||
|
|
||||||
node.commands = commandsCopy;
|
node.commands = commandsCopy;
|
||||||
this.messageService.info(`Done pushing ‘${node.fileStat.name}’.`, {
|
this.messageService.info(
|
||||||
|
nls.localize(
|
||||||
|
'arduino/cloud/donePushing',
|
||||||
|
'Done pushing ‘{0}’.',
|
||||||
|
node.fileStat.name
|
||||||
|
),
|
||||||
|
{
|
||||||
timeout: MESSAGE_TIMEOUT,
|
timeout: MESSAGE_TIMEOUT,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import {
|
|||||||
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';
|
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';
|
||||||
import { AuthenticationClientService } from '../../auth/authentication-client-service';
|
import { AuthenticationClientService } from '../../auth/authentication-client-service';
|
||||||
import { CloudUserCommands } from '../../auth/cloud-user-commands';
|
import { CloudUserCommands } from '../../auth/cloud-user-commands';
|
||||||
import { firstToUpperCase } from '../../../common/utils';
|
|
||||||
import { AuthenticationSessionAccountInformation } from '../../../common/protocol/authentication-service';
|
import { AuthenticationSessionAccountInformation } from '../../../common/protocol/authentication-service';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export class UserStatus extends React.Component<
|
export class UserStatus extends React.Component<
|
||||||
UserStatus.Props,
|
UserStatus.Props,
|
||||||
@ -59,7 +59,9 @@ export class UserStatus extends React.Component<
|
|||||||
: 'offline-status-icon'
|
: 'offline-status-icon'
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
{firstToUpperCase(this.state.status)}
|
{this.state.status === 'connected'
|
||||||
|
? nls.localize('arduino/cloud/connected', 'Connected')
|
||||||
|
: nls.localize('arduino/cloud/offline', 'Offline')}
|
||||||
</div>
|
</div>
|
||||||
<div className="actions item flex-line">
|
<div className="actions item flex-line">
|
||||||
<div
|
<div
|
||||||
@ -89,7 +91,10 @@ export class UserStatus extends React.Component<
|
|||||||
{this.state.accountInfo?.picture && (
|
{this.state.accountInfo?.picture && (
|
||||||
<img
|
<img
|
||||||
src={this.state.accountInfo?.picture}
|
src={this.state.accountInfo?.picture}
|
||||||
alt="Profile picture"
|
alt={nls.localize(
|
||||||
|
'arduino/cloud/profilePicture',
|
||||||
|
'Profile picture'
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,7 @@ import { ListWidget } from './list-widget';
|
|||||||
import { ComponentList } from './component-list';
|
import { ComponentList } from './component-list';
|
||||||
import { ListItemRenderer } from './list-item-renderer';
|
import { ListItemRenderer } from './list-item-renderer';
|
||||||
import { ResponseServiceArduino } from '../../../common/protocol';
|
import { ResponseServiceArduino } from '../../../common/protocol';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
export class FilterableListContainer<
|
export class FilterableListContainer<
|
||||||
T extends ArduinoComponent
|
T extends ArduinoComponent
|
||||||
@ -112,7 +113,9 @@ export class FilterableListContainer<
|
|||||||
const { install, searchable } = this.props;
|
const { install, searchable } = this.props;
|
||||||
await Installable.doWithProgress({
|
await Installable.doWithProgress({
|
||||||
...this.props,
|
...this.props,
|
||||||
progressText: `Processing ${item.name}:${version}`,
|
progressText:
|
||||||
|
nls.localize('arduino/common/processing', 'Processing') +
|
||||||
|
` ${item.name}:${version}`,
|
||||||
run: ({ progressId }) => install({ item, progressId, version }),
|
run: ({ progressId }) => install({ item, progressId, version }),
|
||||||
});
|
});
|
||||||
const items = await searchable.search({ query: this.state.filterText });
|
const items = await searchable.search({ query: this.state.filterText });
|
||||||
@ -121,10 +124,14 @@ export class FilterableListContainer<
|
|||||||
|
|
||||||
protected async uninstall(item: T): Promise<void> {
|
protected async uninstall(item: T): Promise<void> {
|
||||||
const ok = await new ConfirmDialog({
|
const ok = await new ConfirmDialog({
|
||||||
title: 'Uninstall',
|
title: nls.localize('arduino/component/uninstall', 'Uninstall'),
|
||||||
msg: `Do you want to uninstall ${item.name}?`,
|
msg: nls.localize(
|
||||||
ok: 'Yes',
|
'arduino/component/uninstallMsg',
|
||||||
cancel: 'No',
|
'Do you want to uninstall {0}?',
|
||||||
|
item.name
|
||||||
|
),
|
||||||
|
ok: nls.localize('vscode/extensionsUtils/yes', 'Yes'),
|
||||||
|
cancel: nls.localize('vscode/extensionsUtils/no', 'No'),
|
||||||
}).open();
|
}).open();
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
@ -132,7 +139,9 @@ export class FilterableListContainer<
|
|||||||
const { uninstall, searchable } = this.props;
|
const { uninstall, searchable } = this.props;
|
||||||
await Installable.doWithProgress({
|
await Installable.doWithProgress({
|
||||||
...this.props,
|
...this.props,
|
||||||
progressText: `Processing ${item.name}${
|
progressText:
|
||||||
|
nls.localize('arduino/common/processing', 'Processing') +
|
||||||
|
` ${item.name}${
|
||||||
item.installedVersion ? `:${item.installedVersion}` : ''
|
item.installedVersion ? `:${item.installedVersion}` : ''
|
||||||
}`,
|
}`,
|
||||||
run: ({ progressId }) => uninstall({ item, progressId }),
|
run: ({ progressId }) => uninstall({ item, progressId }),
|
||||||
|
@ -4,6 +4,7 @@ import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|||||||
import { Installable } from '../../../common/protocol/installable';
|
import { Installable } from '../../../common/protocol/installable';
|
||||||
import { ArduinoComponent } from '../../../common/protocol/arduino-component';
|
import { ArduinoComponent } from '../../../common/protocol/arduino-component';
|
||||||
import { ComponentListItem } from './component-list-item';
|
import { ComponentListItem } from './component-list-item';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ListItemRenderer<T extends ArduinoComponent> {
|
export class ListItemRenderer<T extends ArduinoComponent> {
|
||||||
@ -33,7 +34,7 @@ export class ListItemRenderer<T extends ArduinoComponent> {
|
|||||||
const author = <span className="author">{item.author}</span>;
|
const author = <span className="author">{item.author}</span>;
|
||||||
nameAndAuthor = (
|
nameAndAuthor = (
|
||||||
<span>
|
<span>
|
||||||
{name} by {author}
|
{name} {nls.localize('arduino/component/by', 'by')} {author}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else if (item.name) {
|
} else if (item.name) {
|
||||||
@ -41,12 +42,22 @@ export class ListItemRenderer<T extends ArduinoComponent> {
|
|||||||
} else if ((item as any).id) {
|
} else if ((item as any).id) {
|
||||||
nameAndAuthor = <span className="name">{(item as any).id}</span>;
|
nameAndAuthor = <span className="name">{(item as any).id}</span>;
|
||||||
} else {
|
} else {
|
||||||
nameAndAuthor = <span className="name">Unknown</span>;
|
nameAndAuthor = (
|
||||||
|
<span className="name">
|
||||||
|
{nls.localize('arduino/common/unknown', 'Unknown')}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const onClickUninstall = () => uninstall(item);
|
const onClickUninstall = () => uninstall(item);
|
||||||
const installedVersion = !!item.installedVersion && (
|
const installedVersion = !!item.installedVersion && (
|
||||||
<div className="version-info">
|
<div className="version-info">
|
||||||
<span className="version">Version {item.installedVersion}</span>
|
<span className="version">
|
||||||
|
{nls.localize(
|
||||||
|
'arduino/component/version',
|
||||||
|
'Version {0}',
|
||||||
|
item.installedVersion
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
<span className="installed" onClick={onClickUninstall} />
|
<span className="installed" onClick={onClickUninstall} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -56,13 +67,13 @@ export class ListItemRenderer<T extends ArduinoComponent> {
|
|||||||
|
|
||||||
const moreInfo = !!item.moreInfoLink && (
|
const moreInfo = !!item.moreInfoLink && (
|
||||||
<a href={item.moreInfoLink} onClick={this.onMoreInfoClick}>
|
<a href={item.moreInfoLink} onClick={this.onMoreInfoClick}>
|
||||||
More info
|
{nls.localize('arduino/component/moreInfo', 'More info')}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
const onClickInstall = () => install(item);
|
const onClickInstall = () => install(item);
|
||||||
const installButton = item.installable && (
|
const installButton = item.installable && (
|
||||||
<button className="theia-button install" onClick={onClickInstall}>
|
<button className="theia-button install" onClick={onClickInstall}>
|
||||||
INSTALL
|
{nls.localize('arduino/component/install', 'INSTALL')}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export class SearchBar extends React.Component<SearchBar.Props> {
|
export class SearchBar extends React.Component<SearchBar.Props> {
|
||||||
@ -12,7 +13,10 @@ export class SearchBar extends React.Component<SearchBar.Props> {
|
|||||||
ref={this.setRef}
|
ref={this.setRef}
|
||||||
className={`theia-input ${SearchBar.Styles.SEARCH_BAR_CLASS}`}
|
className={`theia-input ${SearchBar.Styles.SEARCH_BAR_CLASS}`}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Filter your search..."
|
placeholder={nls.localize(
|
||||||
|
'arduino/component/filterSearch',
|
||||||
|
'Filter your search...'
|
||||||
|
)}
|
||||||
size={1}
|
size={1}
|
||||||
value={this.props.filterText}
|
value={this.props.filterText}
|
||||||
onChange={this.handleFilterTextChange}
|
onChange={this.handleFilterTextChange}
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
import { Command } from '@theia/core/lib/common/command';
|
import { Command } from '@theia/core/lib/common/command';
|
||||||
|
|
||||||
export namespace SketchbookCommands {
|
export namespace SketchbookCommands {
|
||||||
export const OPEN_NEW_WINDOW: Command = {
|
export const OPEN_NEW_WINDOW = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-sketchbook--open-sketch-new-window',
|
id: 'arduino-sketchbook--open-sketch-new-window',
|
||||||
label: 'Open Sketch in New Window',
|
label: 'Open Sketch in New Window',
|
||||||
};
|
},
|
||||||
|
'arduino/sketch/openSketchInNewWindow'
|
||||||
|
);
|
||||||
|
|
||||||
export const REVEAL_IN_FINDER: Command = {
|
export const REVEAL_IN_FINDER = Command.toLocalizedCommand(
|
||||||
|
{
|
||||||
id: 'arduino-sketchbook--reveal-in-finder',
|
id: 'arduino-sketchbook--reveal-in-finder',
|
||||||
label: 'Open Folder',
|
label: 'Open Folder',
|
||||||
};
|
},
|
||||||
|
'arduino/sketch/openFolder'
|
||||||
|
);
|
||||||
|
|
||||||
export const OPEN_SKETCHBOOK_CONTEXT_MENU: Command = {
|
export const OPEN_SKETCHBOOK_CONTEXT_MENU: Command = {
|
||||||
id: 'arduino-sketchbook--open-sketch-context-menu',
|
id: 'arduino-sketchbook--open-sketch-context-menu',
|
||||||
|
@ -17,6 +17,7 @@ import { ArduinoPreferences } from '../../arduino-preferences';
|
|||||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||||
import { SelectableTreeNode } from '@theia/core/lib/browser/tree/tree-selection';
|
import { SelectableTreeNode } from '@theia/core/lib/browser/tree/tree-selection';
|
||||||
import { Sketch } from '../../contributions/contribution';
|
import { Sketch } from '../../contributions/contribution';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SketchbookTreeWidget extends FileTreeWidget {
|
export class SketchbookTreeWidget extends FileTreeWidget {
|
||||||
@ -41,7 +42,10 @@ export class SketchbookTreeWidget extends FileTreeWidget {
|
|||||||
super(props, model, contextMenuRenderer);
|
super(props, model, contextMenuRenderer);
|
||||||
this.id = 'arduino-sketchbook-tree-widget';
|
this.id = 'arduino-sketchbook-tree-widget';
|
||||||
this.title.iconClass = 'sketchbook-tree-icon';
|
this.title.iconClass = 'sketchbook-tree-icon';
|
||||||
this.title.caption = 'Local Sketchbook';
|
this.title.caption = nls.localize(
|
||||||
|
'arduino/sketch/titleLocalSketchbook',
|
||||||
|
'Local Sketchbook'
|
||||||
|
);
|
||||||
this.title.closable = false;
|
this.title.closable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ export class SketchbookWidgetContribution
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
widgetId: 'arduino-sketchbook-widget',
|
widgetId: 'arduino-sketchbook-widget',
|
||||||
widgetName: 'Sketchbook',
|
widgetName: SketchbookWidget.LABEL,
|
||||||
defaultWidgetOptions: {
|
defaultWidgetOptions: {
|
||||||
area: 'left',
|
area: 'left',
|
||||||
rank: 1,
|
rank: 1,
|
||||||
|
@ -6,9 +6,12 @@ import { Message, MessageLoop } from '@phosphor/messaging';
|
|||||||
import { Disposable } from '@theia/core/lib/common/disposable';
|
import { Disposable } from '@theia/core/lib/common/disposable';
|
||||||
import { BaseWidget } from '@theia/core/lib/browser/widgets/widget';
|
import { BaseWidget } from '@theia/core/lib/browser/widgets/widget';
|
||||||
import { SketchbookTreeWidget } from './sketchbook-tree-widget';
|
import { SketchbookTreeWidget } from './sketchbook-tree-widget';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SketchbookWidget extends BaseWidget {
|
export class SketchbookWidget extends BaseWidget {
|
||||||
|
static LABEL = nls.localize('arduino/sketch/titleSketchbook', 'Sketchbook');
|
||||||
|
|
||||||
@inject(SketchbookTreeWidget)
|
@inject(SketchbookTreeWidget)
|
||||||
protected readonly localSketchbookTreeWidget: SketchbookTreeWidget;
|
protected readonly localSketchbookTreeWidget: SketchbookTreeWidget;
|
||||||
|
|
||||||
@ -17,8 +20,8 @@ export class SketchbookWidget extends BaseWidget {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.id = 'arduino-sketchbook-widget';
|
this.id = 'arduino-sketchbook-widget';
|
||||||
this.title.caption = 'Sketchbook';
|
this.title.caption = SketchbookWidget.LABEL;
|
||||||
this.title.label = 'Sketchbook';
|
this.title.label = SketchbookWidget.LABEL;
|
||||||
this.title.iconClass = 'fa fa-arduino-folder';
|
this.title.iconClass = 'fa fa-arduino-folder';
|
||||||
this.title.closable = true;
|
this.title.closable = true;
|
||||||
this.node.tabIndex = 0;
|
this.node.tabIndex = 0;
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
} from '@theia/core/lib/browser/connection-status-service';
|
} from '@theia/core/lib/browser/connection-status-service';
|
||||||
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
|
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
|
||||||
import { SplashService } from '../electron-common/splash-service';
|
import { SplashService } from '../electron-common/splash-service';
|
||||||
|
import { nls } from '@theia/core/lib/browser/nls';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ElectronWindowService extends TheiaElectronWindowService {
|
export class ElectronWindowService extends TheiaElectronWindowService {
|
||||||
@ -30,14 +31,26 @@ export class ElectronWindowService extends TheiaElectronWindowService {
|
|||||||
const offline =
|
const offline =
|
||||||
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE;
|
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE;
|
||||||
const detail = offline
|
const detail = offline
|
||||||
? 'Could not save the sketch. Please copy your unsaved work into your favorite text editor, and restart the IDE.'
|
? nls.localize(
|
||||||
: 'Any unsaved changes will not be saved.';
|
'arduino/electron/couldNotSave',
|
||||||
|
'Could not save the sketch. Please copy your unsaved work into your favorite text editor, and restart the IDE.'
|
||||||
|
)
|
||||||
|
: nls.localize(
|
||||||
|
'arduino/electron/unsavedChanges',
|
||||||
|
'Any unsaved changes will not be saved.'
|
||||||
|
);
|
||||||
const electronWindow = remote.getCurrentWindow();
|
const electronWindow = remote.getCurrentWindow();
|
||||||
const response = remote.dialog.showMessageBoxSync(electronWindow, {
|
const response = remote.dialog.showMessageBoxSync(electronWindow, {
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Yes', 'No'],
|
buttons: [
|
||||||
title: 'Confirm',
|
nls.localize('vscode/extensionsUtils/yes', 'Yes'),
|
||||||
message: 'Are you sure you want to close the sketch?',
|
nls.localize('vscode/extensionsUtils/no', 'No'),
|
||||||
|
],
|
||||||
|
title: nls.localize('vscode/Default/ConfirmTitle', 'Confirm'),
|
||||||
|
message: nls.localize(
|
||||||
|
'arduino/sketch/close',
|
||||||
|
'Are you sure you want to close the sketch?'
|
||||||
|
),
|
||||||
detail,
|
detail,
|
||||||
});
|
});
|
||||||
return response === 0; // 'Yes', close the window.
|
return response === 0; // 'Yes', close the window.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user