-
-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update package index on 3rd party URLs change.
- Loading branch information
Akos Kitta
committed
Jul 4, 2022
1 parent
9538598
commit fd4625c
Showing
43 changed files
with
998 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { nls } from '@theia/core'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { ArduinoDaemon } from '../../common/protocol'; | ||
import { Contribution, Command, CommandRegistry } from './contribution'; | ||
|
||
@injectable() | ||
export class Daemon extends Contribution { | ||
@inject(ArduinoDaemon) | ||
private readonly daemon: ArduinoDaemon; | ||
|
||
override registerCommands(registry: CommandRegistry): void { | ||
registry.registerCommand(Daemon.Commands.START_DAEMON, { | ||
execute: () => this.daemon.start(), | ||
}); | ||
registry.registerCommand(Daemon.Commands.STOP_DAEMON, { | ||
execute: () => this.daemon.stop(), | ||
}); | ||
registry.registerCommand(Daemon.Commands.RESTART_DAEMON, { | ||
execute: () => this.daemon.restart(), | ||
}); | ||
} | ||
} | ||
export namespace Daemon { | ||
export namespace Commands { | ||
export const START_DAEMON: Command = { | ||
id: 'arduino-start-daemon', | ||
label: nls.localize('arduino/daemon/start', 'Start Daemon'), | ||
category: 'Arduino', | ||
}; | ||
export const STOP_DAEMON: Command = { | ||
id: 'arduino-stop-daemon', | ||
label: nls.localize('arduino/daemon/stop', 'Stop Daemon'), | ||
category: 'Arduino', | ||
}; | ||
export const RESTART_DAEMON: Command = { | ||
id: 'arduino-restart-daemon', | ||
label: nls.localize('arduino/daemon/restart', 'Restart Daemon'), | ||
category: 'Arduino', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
arduino-ide-extension/src/browser/contributions/indexes-update-progress.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Progress } from '@theia/core/lib/common/message-service-protocol'; | ||
import { ProgressService } from '@theia/core/lib/common/progress-service'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { ProgressMessage } from '../../common/protocol'; | ||
import { NotificationCenter } from '../notification-center'; | ||
import { Contribution } from './contribution'; | ||
|
||
@injectable() | ||
export class IndexesUpdateProgress extends Contribution { | ||
@inject(NotificationCenter) | ||
private readonly notificationCenter: NotificationCenter; | ||
@inject(ProgressService) | ||
private readonly progressService: ProgressService; | ||
private currentProgress: | ||
| (Progress & Readonly<{ progressId: string }>) | ||
| undefined; | ||
|
||
override onStart(): void { | ||
this.notificationCenter.onIndexWillUpdate((progressId) => | ||
this.getOrCreateProgress(progressId) | ||
); | ||
this.notificationCenter.onIndexUpdateDidProgress((progress) => { | ||
this.getOrCreateProgress(progress).then((delegate) => | ||
delegate.report(progress) | ||
); | ||
}); | ||
this.notificationCenter.onIndexDidUpdate((progressId) => { | ||
this.cancelProgress(progressId); | ||
}); | ||
this.notificationCenter.onIndexUpdateDidFail(({ progressId, message }) => { | ||
this.cancelProgress(progressId); | ||
this.messageService.error(message); | ||
}); | ||
} | ||
|
||
private async getOrCreateProgress( | ||
progressOrId: ProgressMessage | string | ||
): Promise<Progress & { progressId: string }> { | ||
const progressId = ProgressMessage.is(progressOrId) | ||
? progressOrId.progressId | ||
: progressOrId; | ||
if ( | ||
this.currentProgress && | ||
this.currentProgress.progressId === progressId | ||
) { | ||
return this.currentProgress; | ||
} | ||
if (this.currentProgress) { | ||
this.currentProgress.cancel(); | ||
} | ||
this.currentProgress = undefined; | ||
const progress = await this.progressService.showProgress({ | ||
text: '', | ||
options: { location: 'notification' }, | ||
}); | ||
if (ProgressMessage.is(progressOrId)) { | ||
progress.report(progressOrId); | ||
} | ||
this.currentProgress = { ...progress, progressId }; | ||
return this.currentProgress; | ||
} | ||
|
||
private cancelProgress(progressId: string) { | ||
if (this.currentProgress) { | ||
if (this.currentProgress.progressId !== progressId) { | ||
console.warn( | ||
`Mismatching progress IDs. Expected ${progressId}, got ${this.currentProgress.progressId}. Canceling anyway.` | ||
); | ||
} | ||
this.currentProgress.cancel(); | ||
this.currentProgress = undefined; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.