Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sketchbook sidebar state #1102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
AlbyIanna merged 13 commits into main from sketchbook-sidebar-state
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
requested changes
  • Loading branch information
Alberto Iannaccone committed Jun 23, 2022
commit a6d762a758920aa93a31b820abe67dc8d78f7a6f
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ import { CommandContribution, CommandRegistry } from '@theia/core';
import { ApplicationShell } from '@theia/core/lib/browser';
import { CloudSketchbookCommands } from './cloud-sketchbook-contributions';
import { EditorManager } from '@theia/editor/lib/browser';
import { SketchbookWidgetContribution } from '../sketchbook/sketchbook-widget-contribution';

@injectable()
export class CloudSketchbookWidget
extends SketchbookWidget
implements CommandContribution
{
@inject(CloudSketchbookCompositeWidget)
protected readonly cloudSketchbookCompositeWidget: CloudSketchbookCompositeWidget;
private readonly cloudSketchbookCompositeWidget: CloudSketchbookCompositeWidget;

@inject(ArduinoPreferences)
protected readonly arduinoPreferences: ArduinoPreferences;
private readonly arduinoPreferences: ArduinoPreferences;

@inject(ApplicationShell)
protected readonly shell: ApplicationShell;
private readonly shell: ApplicationShell;

@inject(SketchbookWidgetContribution)
private readonly sketchbookWidgetContribution: SketchbookWidgetContribution;

@inject(EditorManager)
protected readonly editorManager: EditorManager;
private readonly editorManager: EditorManager;

@postConstruct()
protected override init(): void {
Expand Down Expand Up @@ -94,8 +98,9 @@ export class CloudSketchbookWidget
if (widget instanceof CloudSketchbookWidget) {
widget.activateTreeWidget(this.cloudSketchbookCompositeWidget.id);
}
if (this.editorManager.currentEditor)
this.shell.activateWidget(this.editorManager.currentEditor.id);
this.sketchbookWidgetContribution.selectWidgetFileNode(
this.editorManager.currentEditor
);
});
}
}
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class SketchbookWidgetContribution
override registerCommands(registry: CommandRegistry): void {
super.registerCommands(registry);
registry.registerCommand(SketchbookCommands.SHOW_SKETCHBOOK_WIDGET, {
execute: () => this.showSketchbookWidget(),
execute: () => this.showLocalSketchbookWidget(),
});
registry.registerCommand(SketchbookCommands.OPEN_NEW_WINDOW, {
execute: (arg) => this.openSketchInNewWindow(arg),
Expand Down Expand Up @@ -262,14 +262,13 @@ export class SketchbookWidgetContribution
this.selectWidgetFileNode(this.shell.currentWidget);
}

protected async showSketchbookWidget(): Promise<void> {
protected async showLocalSketchbookWidget(): Promise<void> {
this.widget
.then((widget) => this.shell.activateWidget(widget.id))
.then((widget) => {
if (widget instanceof SketchbookWidget) {
widget.activateTreeWidget(widget.getTreeWidget().id);
if (this.editorManager.currentEditor)
this.shell.activateWidget(this.editorManager.currentEditor.id);
this.selectWidgetFileNode(this.editorManager.currentEditor);
}
});
}
Expand All @@ -281,10 +280,9 @@ export class SketchbookWidgetContribution

const commands = JSON.parse(decodeURIComponent(encoded));

if (commands && Array.isArray(commands)) {
if (Array.isArray(commands)) {
commands.forEach((c: Command) => {
if (this.commandRegistry.commandIds.includes(c.id))
this.commandRegistry.executeCommand(c.id);
this.commandRegistry.executeCommand(c.id);
});
}
}
Expand Down

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