-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3893fde
commit e8b5605
Showing
46 changed files
with
2,398 additions
and
448 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
24 changes: 24 additions & 0 deletions
24
examples/api-samples/src/electron-common/ipc/electron-test-connection.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,24 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2022 TypeFox and others. | ||
// | ||
// 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 WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { serviceIdentifier } from "@theia/core/lib/common"; | ||
|
||
export const TEST_CONNECTION_PATH = '/services/test-connection'; | ||
|
||
export const TestConnection = serviceIdentifier<TestConnection>('TestConnection'); | ||
export interface TestConnection { | ||
runTest(): Promise<string[]> | ||
} |
27 changes: 27 additions & 0 deletions
27
examples/api-samples/src/electron-main/ipc/electron-test-connection.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,27 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2022 TypeFox and others. | ||
// | ||
// 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 WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { BrowserWindow } from '@theia/electron/shared/electron'; | ||
import { injectable } from 'inversify'; | ||
import { TestConnection } from '../../electron-common/ipc/electron-test-connection'; | ||
|
||
@injectable() | ||
export class TestConnectionImpl implements TestConnection { | ||
|
||
async runTest(): Promise<string[]> { | ||
return BrowserWindow.getAllWindows().map(browserWindow => browserWindow.getTitle()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
examples/api-samples/src/electron-main/ipc/sample-ipc-module.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,33 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2022 Ericsson// ***************************************************************************** | ||
// Copyright (C) 2020 TypeFox and others. | ||
// | ||
// 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 WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { ServiceContribution } from '@theia/core/lib/common'; | ||
import { ElectronMainAndBackend } from '@theia/core/lib/electron-common'; | ||
import { ContainerModule } from '@theia/core/shared/inversify'; | ||
import { TestConnection } from '../../electron-common/ipc/electron-test-connection'; | ||
import { TEST_CONNECTION_PATH } from '../../electron-common/ipc/electron-test-connection'; | ||
import { TestConnectionImpl } from './electron-test-connection'; | ||
|
||
export default new ContainerModule(bind => { | ||
bind(TestConnection).to(TestConnectionImpl).inSingletonScope(); | ||
bind(ServiceContribution) | ||
.toDynamicValue(ctx => ({ | ||
[TEST_CONNECTION_PATH]: () => ctx.container.get(TestConnection) | ||
})) | ||
.inSingletonScope() | ||
.whenTargetNamed(ElectronMainAndBackend); | ||
}); |
26 changes: 26 additions & 0 deletions
26
examples/api-samples/src/electron-node/ipc/electron-backend-connection-module.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,26 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2022 TypeFox and others. | ||
// | ||
// 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 WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { ProxyProvider } from '@theia/core'; | ||
import { ElectronMainAndBackend } from '@theia/core/lib/electron-common'; | ||
import { ContainerModule } from '@theia/core/shared/inversify'; | ||
import { TestConnection, TEST_CONNECTION_PATH } from '../../electron-common/ipc/electron-test-connection'; | ||
|
||
export default new ContainerModule(bind => { | ||
bind(TestConnection) | ||
.toDynamicValue(ctx => ctx.container.getNamed(ProxyProvider, ElectronMainAndBackend).getProxy(TEST_CONNECTION_PATH)) | ||
.inSingletonScope(); | ||
}); |
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.