Add terminal actions to panel

Focus previous/next are temporary until tabs are visualized in the UI
This commit is contained in:
Daniel Imms 2016-06-14 13:21:01 -07:00
parent 7df6fd5ce7
commit 6b932e3124
15 changed files with 95 additions and 2 deletions

View file

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#424242"/></svg>

After

Width:  |  Height:  |  Size: 147 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#C5C5C5"/></svg>

After

Width:  |  Height:  |  Size: 147 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<path fill="#424242" d="M1,4h7L5,1h3l4,4L8,9H5l3-3H1V4z"/>
</svg>

After

Width:  |  Height:  |  Size: 290 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<path fill="#C5C5C5" d="M1,4h7L5,1h3l4,4L8,9H5l3-3H1V4z"/>
</svg>

After

Width:  |  Height:  |  Size: 290 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<polygon fill="#424242" points="13,4 6,4 9,1 6,1 2,5 6,9 9,9 6,6 13,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 305 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<polygon fill="#C5C5C5" points="13,4 6,4 9,1 6,1 2,5 6,9 9,9 6,6 13,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 305 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<path fill="#C5C5C5" d="M1,4h7L5,1h3l4,4L8,9H5l3-3H1V4z"/>
</svg>

After

Width:  |  Height:  |  Size: 295 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<path fill="#424242" d="M1,4h7L5,1h3l4,4L8,9H5l3-3H1V4z"/>
</svg>

After

Width:  |  Height:  |  Size: 295 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<polygon fill="#C5C5C5" points="13,4 6,4 9,1 6,1 2,5 6,9 9,9 6,6 13,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 310 B

View file

@ -0,0 +1,5 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="16px" height="16px" viewBox="-1 -3 16 16" enable-background="new -1 -3 16 16" xml:space="preserve">
<polygon fill="#424242" points="13,4 6,4 9,1 6,1 2,5 6,9 9,9 6,6 13,6 "/>
</svg>

After

Width:  |  Height:  |  Size: 310 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#C5C5C5"/></svg>

After

Width:  |  Height:  |  Size: 147 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#424242"/></svg>

After

Width:  |  Height:  |  Size: 147 B

View file

@ -80,8 +80,31 @@
color: #FFF;
}
/* Terminal actions */
/* Light theme */
.monaco-workbench .terminal-action.close { background: url('close.svg') center center no-repeat; }
.monaco-workbench .terminal-action.focus-next { background: url('focus_next.svg') center center no-repeat; }
.monaco-workbench .terminal-action.focus-previous { background: url('focus_previous.svg') center center no-repeat; }
.monaco-workbench .terminal-action.new { background: url('new.svg') center center no-repeat; }
/* Dark theme */
.vs-dark .monaco-workbench .terminal-action.close { background: url('close_inverse.svg') center center no-repeat; }
.vs-dark .monaco-workbench .terminal-action.focus-next { background: url('focus_next_inverse.svg') center center no-repeat; }
.vs-dark .monaco-workbench .terminal-action.focus-previous { background: url('focus_previous_inverse.svg') center center no-repeat; }
.vs-dark .monaco-workbench .terminal-action.new { background: url('new_inverse.svg') center center no-repeat; }
/* High contrast black theme */
.hc-black .monaco-workbench .terminal-action { background: none; }
.hc-black .monaco-workbench .terminal-action:before {
position: absolute;
top: 12px;
left: 8px;
height: 16px;
width: 16px;
}
.hc-black .monaco-workbench .terminal-action.close:before { content: url('close_inverse.svg'); }
.hc-black .monaco-workbench .terminal-action.focus-next:before { content: url('focus_next_inverse.svg'); }
.hc-black .monaco-workbench .terminal-action.focus-previous:before { content: url('focus_previous_inverse.svg'); }
.hc-black .monaco-workbench .terminal-action.new:before { content: url('new_inverse.svg'); }
/**
* xterm.js: xterm, in the browser

View file

@ -35,6 +35,7 @@ export class CloseTerminalAction extends Action {
@ITerminalService private terminalService: ITerminalService
) {
super(id, label);
this.class = 'terminal-action close';
}
public run(event?: any): TPromise<any> {
@ -52,6 +53,7 @@ export class CreateNewTerminalAction extends Action {
@ITerminalService private terminalService: ITerminalService
) {
super(id, label);
this.class = 'terminal-action new';
}
public run(event?: any): TPromise<any> {
@ -86,6 +88,7 @@ export class FocusNextTerminalAction extends Action {
@ITerminalService private terminalService: ITerminalService
) {
super(id, label);
this.class = 'terminal-action focus-next';
}
public run(event?: any): TPromise<any> {
@ -103,6 +106,7 @@ export class FocusPreviousTerminalAction extends Action {
@ITerminalService private terminalService: ITerminalService
) {
super(id, label);
this.class = 'terminal-action focus-previous';
}
public run(event?: any): TPromise<any> {

View file

@ -6,9 +6,11 @@
import lifecycle = require('vs/base/common/lifecycle');
import platform = require('vs/base/common/platform');
import DOM = require('vs/base/browser/dom');
import {IAction} from 'vs/base/common/actions';
import {TPromise} from 'vs/base/common/winjs.base';
import {Builder, Dimension} from 'vs/base/browser/builder';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
@ -16,20 +18,23 @@ import {ITerminalService, TERMINAL_PANEL_ID} from 'vs/workbench/parts/terminal/e
import {Panel} from 'vs/workbench/browser/panel';
import {TerminalConfigHelper} from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
import {TerminalInstance} from 'vs/workbench/parts/terminal/electron-browser/terminalInstance';
import {CloseTerminalAction, CreateNewTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction} from 'vs/workbench/parts/terminal/electron-browser/terminalActions';
export class TerminalPanel extends Panel {
private toDispose: lifecycle.IDisposable[] = [];
private terminalInstances: TerminalInstance[] = [];
private actions: IAction[];
private parentDomElement: HTMLElement;
private themeStyleElement: HTMLElement;
private configurationHelper: TerminalConfigHelper;
private activeTerminalIndex: number;
constructor(
@IConfigurationService private configurationService: IConfigurationService,
@ITelemetryService telemetryService: ITelemetryService,
@IConfigurationService private configurationService: IConfigurationService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ITerminalService private terminalService: ITerminalService,
@IThemeService private themeService: IThemeService
@ -43,6 +48,23 @@ export class TerminalPanel extends Panel {
}
}
public getActions(): IAction[] {
if (!this.actions) {
this.actions = [
this.instantiationService.createInstance(CreateNewTerminalAction, CreateNewTerminalAction.ID, CreateNewTerminalAction.LABEL),
this.instantiationService.createInstance(CloseTerminalAction, CloseTerminalAction.ID, CloseTerminalAction.LABEL),
this.instantiationService.createInstance(FocusPreviousTerminalAction, FocusPreviousTerminalAction.ID, FocusPreviousTerminalAction.LABEL),
this.instantiationService.createInstance(FocusNextTerminalAction, FocusNextTerminalAction.ID, FocusNextTerminalAction.LABEL)
];
this.actions.forEach(a => {
this.toDispose.push(a);
});
}
return this.actions;
}
public create(parent: Builder): TPromise<void> {
super.create(parent);
this.parentDomElement = parent.getHTMLElement();