Added the Sketchbook menu with FS event tracking

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2020-12-16 18:14:00 +01:00
committed by Akos Kitta
parent 1b6d9eccdc
commit db2967084f
10 changed files with 235 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ import { JsonRpcProxy } from '@theia/core/lib/common/messaging/proxy-factory';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
import { NotificationServiceClient, NotificationServiceServer } from '../common/protocol/notification-service';
import { AttachedBoardsChangeEvent, BoardsPackage, LibraryPackage, Config } from '../common/protocol';
import { AttachedBoardsChangeEvent, BoardsPackage, LibraryPackage, Config, Sketch } from '../common/protocol';
@injectable()
export class NotificationCenter implements NotificationServiceClient, FrontendApplicationContribution {
@@ -21,6 +21,7 @@ export class NotificationCenter implements NotificationServiceClient, FrontendAp
protected readonly libraryInstalledEmitter = new Emitter<{ item: LibraryPackage }>();
protected readonly libraryUninstalledEmitter = new Emitter<{ item: LibraryPackage }>();
protected readonly attachedBoardsChangedEmitter = new Emitter<AttachedBoardsChangeEvent>();
protected readonly sketchbookChangedEmitter = new Emitter<{ created: Sketch[], removed: Sketch[] }>();
protected readonly toDispose = new DisposableCollection(
this.indexUpdatedEmitter,
@@ -31,7 +32,8 @@ export class NotificationCenter implements NotificationServiceClient, FrontendAp
this.platformUninstalledEmitter,
this.libraryInstalledEmitter,
this.libraryUninstalledEmitter,
this.attachedBoardsChangedEmitter
this.attachedBoardsChangedEmitter,
this.sketchbookChangedEmitter
);
readonly onIndexUpdated = this.indexUpdatedEmitter.event;
@@ -43,6 +45,7 @@ export class NotificationCenter implements NotificationServiceClient, FrontendAp
readonly onLibraryInstalled = this.libraryInstalledEmitter.event;
readonly onLibraryUninstalled = this.libraryUninstalledEmitter.event;
readonly onAttachedBoardsChanged = this.attachedBoardsChangedEmitter.event;
readonly onSketchbookChanged = this.sketchbookChangedEmitter.event;
@postConstruct()
protected init(): void {
@@ -89,4 +92,8 @@ export class NotificationCenter implements NotificationServiceClient, FrontendAp
this.attachedBoardsChangedEmitter.fire(event);
}
notifySketchbookChanged(event: { created: Sketch[], removed: Sketch[] }): void {
this.sketchbookChangedEmitter.fire(event);
}
}