Skip to content

Commit

Permalink
core: fix electron runtime-import-checks
Browse files Browse the repository at this point in the history
The commit fixes issue related to `electron` and `runtime-import-check`
errors. The changes resolve the incompatible runtime imports, and
re-organizes code to be valid.

Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Oct 22, 2021
1 parent c12d1ef commit 0c23cc7
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
- renamed `handleDefault` to `handleElectronDefault`
- renamed `createContextMenu` to `createElectronContextMenu`
- renamed `createMenuBar` to `createElectronMenuBar`
- [core] moved `DEFAULT_WINDOW_HASH` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291)
- [core] moved `NewWindowOptions` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291)

## v1.18.0 - 9/30/2021

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/browser/window/default-window-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { Event, Emitter } from '../../common';
import { CorePreferences } from '../core-preferences';
import { ContributionProvider } from '../../common/contribution-provider';
import { FrontendApplicationContribution, FrontendApplication } from '../frontend-application';
import { DEFAULT_WINDOW_HASH, WindowService } from './window-service';
import { WindowService } from './window-service';
import { DEFAULT_WINDOW_HASH } from '../../common/window';

@injectable()
export class DefaultWindowService implements WindowService, FrontendApplicationContribution {
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/browser/window/window-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@
********************************************************************************/

import { Event } from '../../common/event';

export interface NewWindowOptions {
readonly external?: boolean;
}
import { NewWindowOptions } from '../../common/window';

/**
* Service for opening new browser windows.
*/
export const WindowService = Symbol('WindowService');

/**
* The window hash value that is used to spawn a new default window.
*/
export const DEFAULT_WINDOW_HASH: string = '!empty';

export interface WindowService {

/**
Expand Down
30 changes: 30 additions & 0 deletions packages/core/src/common/window.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/********************************************************************************
* Copyright (C) 2021 Ericsson 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
********************************************************************************/

/**
* The window hash value that is used to spawn a new default window.
*/
export const DEFAULT_WINDOW_HASH: string = '!empty';

/**
* The options for opening new windows.
*/
export interface NewWindowOptions {
/**
* Controls whether the window should be opened externally.
*/
readonly external?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { injectable, inject, postConstruct } from 'inversify';
import { remote } from '../../../shared/electron';
import { NewWindowOptions } from '../../browser/window/window-service';
import { NewWindowOptions } from '../../common/window';
import { DefaultWindowService } from '../../browser/window/default-window-service';
import { ElectronMainWindowService } from '../../electron-common/electron-main-window-service';
import { ElectronWindowPreferences } from './electron-window-preferences';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

// eslint-disable-next-line @theia/runtime-import-check
import { NewWindowOptions } from '../browser/window/window-service';
import { NewWindowOptions } from '../common/window';

export const electronMainWindowServicePath = '/services/electron-window';
export const ElectronMainWindowService = Symbol('ElectronMainWindowService');
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/electron-main/electron-main-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ import { ContributionProvider } from '../common/contribution-provider';
import { ElectronSecurityTokenService } from './electron-security-token-service';
import { ElectronSecurityToken } from '../electron-common/electron-token';
import Storage = require('electron-store');
// eslint-disable-next-line @theia/runtime-import-check
import { DEFAULT_WINDOW_HASH } from '../browser/window/window-service';
import { isOSX, isWindows } from '../common';
import { RequestTitleBarStyle, Restart, TitleBarStyleAtStartup, TitleBarStyleChanged } from '../electron-common/messaging/electron-messages';
import { DEFAULT_WINDOW_HASH } from '../common/window';

const createYargs: (argv?: string[], cwd?: string) => Argv = require('yargs/yargs');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import { shell } from '../../shared/electron';
import { injectable, inject } from 'inversify';
import { ElectronMainWindowService } from '../electron-common/electron-main-window-service';
import { ElectronMainApplication } from './electron-main-application';
// eslint-disable-next-line @theia/runtime-import-check
import { NewWindowOptions } from '../browser/window/window-service';
import { NewWindowOptions } from '../common/window';

@injectable()
export class ElectronMainWindowServiceImpl implements ElectronMainWindowService {
Expand Down
3 changes: 2 additions & 1 deletion packages/workspace/src/browser/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { WorkspaceServer, THEIA_EXT, VSCODE_EXT, getTemporaryWorkspaceFileUri } from '../common';
import { DEFAULT_WINDOW_HASH, WindowService } from '@theia/core/lib/browser/window/window-service';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { DEFAULT_WINDOW_HASH } from '@theia/core/lib/common/window';
import {
FrontendApplicationContribution, PreferenceServiceImpl, PreferenceScope, PreferenceSchemaProvider, LabelProvider
} from '@theia/core/lib/browser';
Expand Down

0 comments on commit 0c23cc7

Please sign in to comment.