Skip to content
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

Update getting-started 'open' commands for compatibility #3444

Merged
merged 1 commit into from
Nov 8, 2018
Merged
Changes from all commits
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
24 changes: 13 additions & 11 deletions packages/getting-started/src/browser/getting-started-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as React from 'react';
import URI from '@theia/core/lib/common/uri';
import { injectable, inject, postConstruct } from 'inversify';
import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget';
import { CommandRegistry } from '@theia/core/lib/common';
import { CommandRegistry, isOSX, environment } from '@theia/core/lib/common';
import { WorkspaceCommands, WorkspaceService } from '@theia/workspace/lib/browser';
import { FileStat, FileSystem } from '@theia/filesystem/lib/common/filesystem';
import { FileSystemUtils } from '@theia/filesystem/lib/common/filesystem-utils';
Expand Down Expand Up @@ -109,17 +109,17 @@ export class GettingStartedWidget extends ReactWidget {
}

protected renderOpen(): React.ReactNode {
const requireSingleOpen = isOSX || !environment.electron.is();
const open = (requireSingleOpen) ? <div className='gs-action-container'><a href='#' onClick={this.doOpen}>Open</a></div> : '';
const openFile = (!requireSingleOpen) ? <div className='gs-action-container'><a href='#' onClick={this.doOpenFile}>Open File</a></div> : '';
const openFolder = (!requireSingleOpen) ? <div className='gs-action-container'><a href='#' onClick={this.doOpenFolder}>Open Folder</a></div> : '';
const openWorkspace = <a href='#' onClick={this.doOpenWorkspace}>Open Workspace</a>;
return <div className='gs-section'>
<h3 className='gs-section-header'>
<i className='fa fa-folder-open'></i>
Open
</h3>
<div className='gs-action-container'>
<a href='#' onClick={this.doOpen}>Open</a>
</div>
<div className='gs-action-container'>
<a href='#' onClick={this.doOpenWorkspace}>Open Workspace</a>
</div>
<h3 className='gs-section-header'><i className='fa fa-folder-open'></i>Open</h3>
{open}
{openFile}
{openFolder}
{openWorkspace}
</div>;
}

Expand Down Expand Up @@ -200,6 +200,8 @@ export class GettingStartedWidget extends ReactWidget {
}

protected doOpen = () => this.commandRegistry.executeCommand(WorkspaceCommands.OPEN.id);
protected doOpenFile = () => this.commandRegistry.executeCommand(WorkspaceCommands.OPEN_FILE.id);
protected doOpenFolder = () => this.commandRegistry.executeCommand(WorkspaceCommands.OPEN_FOLDER.id);
protected doOpenWorkspace = () => this.commandRegistry.executeCommand(WorkspaceCommands.OPEN_WORKSPACE.id);
protected doOpenRecentWorkspace = () => this.commandRegistry.executeCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE.id);
protected doOpenPreferences = () => this.commandRegistry.executeCommand(CommonCommands.OPEN_PREFERENCES.id);
Expand Down