💄 method visibility

This commit is contained in:
Benjamin Pasero
2017-01-10 12:01:09 +01:00
parent eecfb293f7
commit f7e235827d
7 changed files with 21 additions and 21 deletions

View File

@@ -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;
}

View File

@@ -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');

View File

@@ -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');

View File

@@ -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);
}

View File

@@ -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) {