Skip to content

Commit

Permalink
feat(plugin): Use product applicationName to return the value to plug…
Browse files Browse the repository at this point in the history
…ins env.appName.

Thus branding is applied everywhere.

Change-Id: Ifdda9b5cd64ea34de8292bd16703b87d81700c39
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Apr 23, 2020
1 parent f6937b2 commit 66dd2bc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [plugin-ext] fixed custom Icon Themes & plugin Icons [#7583](https://github.com/eclipse-theia/theia/pull/7583)
- [task] fixed presentation.reveal & focus for detected tasks [#7548](https://github.com/eclipse-theia/theia/pull/7548)
- [output] added optional argument `severity` to `OutputChannel.appendLine` method for coloring.
- [plugin] env.appName is now reusing the value from `applicationName` defined in package.json under `theia/frontend/config/applicatioName` for example. It allows to customize the value with a single change.

Breaking changes:

Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface EnvInit {
queryParams: QueryParameters;
language: string;
shell: string;
appName: string;
}

export interface PluginAPI {
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-ext/src/hosted/browser/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import URI from '@theia/core/lib/common/uri';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';

export type PluginHost = 'frontend' | string;
export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker';
Expand Down Expand Up @@ -452,7 +453,8 @@ export class HostedPluginSupport {
env: {
queryParams: getQueryParameters(),
language: navigator.language,
shell: defaultShell
shell: defaultShell,
appName: FrontendApplicationConfigProvider.get().applicationName
},
extApi,
webview: {
Expand Down
9 changes: 6 additions & 3 deletions packages/plugin-ext/src/plugin/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ export abstract class EnvExtImpl {
private proxy: EnvMain;
private queryParameters: QueryParameters;
private lang: string;
private applicationName: string;
private defaultShell: string;
private envMachineId: string;
private envSessionId: string;

public static readonly APP_NAME = 'Eclipse Theia';

constructor(rpc: RPCProtocol) {
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN);
this.envSessionId = v4();
Expand Down Expand Up @@ -57,6 +56,10 @@ export abstract class EnvExtImpl {
this.queryParameters = queryParams;
}

setApplicationName(applicationName: string): void {
this.applicationName = applicationName;
}

setLanguage(lang: string): void {
this.lang = lang;
}
Expand All @@ -70,7 +73,7 @@ export abstract class EnvExtImpl {
}

get appName(): string {
return EnvExtImpl.APP_NAME;
return this.applicationName;
}

abstract get appRoot(): string;
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/plugin/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
this.envExt.setQueryParameters(params.env.queryParams);
this.envExt.setLanguage(params.env.language);
this.envExt.setShell(params.env.shell);
this.envExt.setApplicationName(params.env.appName);

this.preferencesManager.init(params.preferences);

Expand Down

0 comments on commit 66dd2bc

Please sign in to comment.