提交 f7e23582 编写于 作者: B Benjamin Pasero

💄 method visibility

上级 eecfb293
......@@ -83,7 +83,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
/**
* Called to create the editor in the parent builder.
*/
public abstract createEditor(parent: Builder): void;
protected abstract createEditor(parent: Builder): void;
/**
* Overload this function to allow for passing in a position argument.
......@@ -99,7 +99,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
return promise;
}
public setEditorVisible(visible: boolean, position: Position = null): void {
protected setEditorVisible(visible: boolean, position: Position = null): void {
this._position = position;
}
......
......@@ -59,7 +59,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
return this.input ? this.input.getName() : nls.localize('binaryDiffEditor', "Binary Diff Viewer");
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
// Left Container for Binary
const leftBinaryContainerElement = document.createElement('div');
......
......@@ -44,7 +44,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
return this.input ? this.input.getName() : nls.localize('binaryEditor', "Binary Viewer");
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
// Container for Binary
const binaryContainerElement = document.createElement('div');
......
......@@ -39,7 +39,7 @@ export class SideBySideEditor extends BaseEditor {
super(SideBySideEditor.ID, telemetryService);
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
const parentElement = parent.getHTMLElement();
DOM.addClass(parentElement, 'side-by-side-editor');
this.createSash(parentElement);
......@@ -51,7 +51,7 @@ export class SideBySideEditor extends BaseEditor {
.then(() => this.updateInput(oldInput, newInput, options));
}
public setEditorVisible(visible: boolean, position: Position): void {
protected setEditorVisible(visible: boolean, position: Position): void {
if (this.masterEditor) {
this.masterEditor.setVisible(visible, position);
}
......
......@@ -109,7 +109,7 @@ export abstract class BaseTextEditor extends BaseEditor {
};
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
// Editor for Text
this._editorContainer = parent;
......@@ -125,6 +125,16 @@ export abstract class BaseTextEditor extends BaseEditor {
this.applyConfiguration(this.configurationService.getConfiguration<IEditorConfiguration>());
}
/**
* This method creates and returns the text editor control to be used. Subclasses can override to
* provide their own editor control that should be used (e.g. a DiffEditor).
*/
protected createEditorControl(parent: Builder): IEditor {
// Use a getter for the instantiation service since some subclasses might use scoped instantiation services
return this.instantiationService.createInstance(CodeEditor, parent.getHTMLElement(), this.getCodeEditorOptions());
}
private onEditorFocusLost(): void {
if (this.pendingAutoSave) {
return; // save is already triggered
......@@ -158,23 +168,13 @@ export abstract class BaseTextEditor extends BaseEditor {
});
}
/**
* This method creates and returns the text editor control to be used. Subclasses can override to
* provide their own editor control that should be used (e.g. a DiffEditor).
*/
public createEditorControl(parent: Builder): IEditor {
// Use a getter for the instantiation service since some subclasses might use scoped instantiation services
return this.instantiationService.createInstance(CodeEditor, parent.getHTMLElement(), this.getCodeEditorOptions());
}
public setInput(input: EditorInput, options?: EditorOptions): TPromise<void> {
return super.setInput(input, options).then(() => {
this.editorControl.updateOptions(this.getCodeEditorOptions()); // support input specific editor options
});
}
public setEditorVisible(visible: boolean, position: Position = null): void {
protected setEditorVisible(visible: boolean, position: Position = null): void {
// Pass on to Editor
if (visible) {
......
......@@ -72,7 +72,7 @@ export class HtmlPreviewPart extends BaseEditor {
super.dispose();
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
this._container = document.createElement('div');
this._container.style.paddingLeft = '20px';
parent.getHTMLElement().appendChild(this._container);
......@@ -101,7 +101,7 @@ export class HtmlPreviewPart extends BaseEditor {
super.changePosition(position);
}
public setEditorVisible(visible: boolean, position?: Position): void {
protected setEditorVisible(visible: boolean, position?: Position): void {
this._doSetVisible(visible);
super.setEditorVisible(visible, position);
}
......
......@@ -96,7 +96,7 @@ export class OutputPanel extends TextResourceEditor {
return super.setInput(input, options).then(() => this.revealLastLine());
}
public createEditor(parent: Builder): void {
protected createEditor(parent: Builder): void {
// First create the scoped instantation service and only then construct the editor using the scoped service
const scopedContextKeyService = this.contextKeyService.createScoped(parent.getHTMLElement());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册