forked from eclipse-theia/theia
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
dd74bab
commit 6e9691b
Showing
3 changed files
with
112 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
packages/ai-core/src/browser/ai-settings-view-contribution.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,30 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 EclipseSource GmbH. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
import { AbstractViewContribution } from '@theia/core/lib/browser'; | ||
import { AISettingsWidget } from './ai-settings-widget'; | ||
|
||
export class AISettingsViewContribution extends AbstractViewContribution<AISettingsWidget> { | ||
|
||
constructor() { | ||
super({ | ||
widgetId: AISettingsWidget.ID, | ||
widgetName: AISettingsWidget.LABEL, | ||
defaultWidgetOptions: { | ||
area: 'right', | ||
} | ||
}); | ||
} | ||
} |
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,67 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 EclipseSource GmbH. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { ContributionProvider, nls } from '@theia/core'; | ||
import { codicon, Panel, ReactWidget, StatefulWidget } from '@theia/core/lib/browser'; | ||
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; | ||
import { Agent } from '../common/'; | ||
import * as React from '@theia/core/shared/react'; | ||
|
||
@injectable() | ||
export class AISettingsWidget extends ReactWidget implements StatefulWidget { | ||
|
||
static readonly ID = 'ai_settings_widget'; | ||
static readonly LABEL = nls.localizeByDefault('AI Settings'); | ||
|
||
protected readonly settingsWidget: Panel; | ||
|
||
@inject(ContributionProvider) @named(Agent) | ||
protected readonly agents: ContributionProvider<Agent>; | ||
|
||
|
||
@postConstruct() | ||
protected init(): void { | ||
this.id = AISettingsWidget.ID; | ||
this.title.label = AISettingsWidget.LABEL; | ||
this.title.closable = true; | ||
this.addClass('theia-settings-container'); | ||
this.title.iconClass = codicon('hubot'); | ||
|
||
this.update(); | ||
} | ||
|
||
protected render(): React.ReactNode { | ||
return ( | ||
<div> | ||
{this.renderAgentSettings()} | ||
</div > | ||
); | ||
} | ||
|
||
protected renderAgentSettings(): React.ReactNode { | ||
return null; | ||
} | ||
|
||
storeState(): object | undefined { | ||
// Implement the logic to store the state of the widget | ||
return {}; | ||
} | ||
|
||
restoreState(oldState: object): void { | ||
// Implement the logic to restore the state of the widget | ||
} | ||
} | ||
|