提交 380a5024 编写于 作者: B Benjamin Pasero

💄

上级 39d87d6d
......@@ -310,7 +310,7 @@ export class DropdownMenuActionItem extends BaseActionItem {
options.actionProvider = this.menuActionsOrProvider;
}
this.dropdownMenu = new DropdownMenu(container, options);
this.dropdownMenu = this._register(new DropdownMenu(container, options));
this.dropdownMenu.menuOptions = {
actionItemProvider: this.actionItemProvider,
......@@ -333,10 +333,4 @@ export class DropdownMenuActionItem extends BaseActionItem {
this.dropdownMenu.show();
}
}
dispose(): void {
this.dropdownMenu.dispose();
super.dispose();
}
}
\ No newline at end of file
......@@ -54,6 +54,8 @@ export interface IActionChangeEvent {
export class Action implements IAction {
protected _onDidChange = new Emitter<IActionChangeEvent>();
get onDidChange(): Event<IActionChangeEvent> { return this._onDidChange.event; }
protected _id: string;
protected _label: string;
protected _tooltip: string;
......@@ -71,23 +73,15 @@ export class Action implements IAction {
this._actionCallback = actionCallback;
}
public dispose() {
this._onDidChange.dispose();
}
public get onDidChange(): Event<IActionChangeEvent> {
return this._onDidChange.event;
}
public get id(): string {
get id(): string {
return this._id;
}
public get label(): string {
get label(): string {
return this._label;
}
public set label(value: string) {
set label(value: string) {
this._setLabel(value);
}
......@@ -98,11 +92,11 @@ export class Action implements IAction {
}
}
public get tooltip(): string {
get tooltip(): string {
return this._tooltip;
}
public set tooltip(value: string) {
set tooltip(value: string) {
this._setTooltip(value);
}
......@@ -113,11 +107,11 @@ export class Action implements IAction {
}
}
public get class(): string {
get class(): string {
return this._cssClass;
}
public set class(value: string) {
set class(value: string) {
this._setClass(value);
}
......@@ -128,11 +122,11 @@ export class Action implements IAction {
}
}
public get enabled(): boolean {
get enabled(): boolean {
return this._enabled;
}
public set enabled(value: boolean) {
set enabled(value: boolean) {
this._setEnabled(value);
}
......@@ -143,19 +137,19 @@ export class Action implements IAction {
}
}
public get checked(): boolean {
get checked(): boolean {
return this._checked;
}
public set checked(value: boolean) {
set checked(value: boolean) {
this._setChecked(value);
}
public get radio(): boolean {
get radio(): boolean {
return this._radio;
}
public set radio(value: boolean) {
set radio(value: boolean) {
this._setRadio(value);
}
......@@ -173,12 +167,17 @@ export class Action implements IAction {
}
}
public run(event?: any, data?: ITelemetryData): TPromise<any> {
run(event?: any, data?: ITelemetryData): TPromise<any> {
if (this._actionCallback !== void 0) {
return this._actionCallback(event);
}
return TPromise.as(true);
}
dispose() {
this._onDidChange.dispose();
}
}
export interface IRunEvent {
......@@ -190,12 +189,12 @@ export interface IRunEvent {
export class ActionRunner extends Disposable implements IActionRunner {
private _onDidBeforeRun = this._register(new Emitter<IRunEvent>());
public get onDidBeforeRun(): Event<IRunEvent> { return this._onDidBeforeRun.event; }
get onDidBeforeRun(): Event<IRunEvent> { return this._onDidBeforeRun.event; }
private _onDidRun = this._register(new Emitter<IRunEvent>());
public get onDidRun(): Event<IRunEvent> { return this._onDidRun.event; }
get onDidRun(): Event<IRunEvent> { return this._onDidRun.event; }
public run(action: IAction, context?: any): TPromise<any> {
run(action: IAction, context?: any): TPromise<any> {
if (!action.enabled) {
return TPromise.as(null);
}
......@@ -220,12 +219,12 @@ export class ActionRunner extends Disposable implements IActionRunner {
}
}
export class RadioGroup {
private _disposable: IDisposable;
export class RadioGroup extends Disposable {
constructor(readonly actions: Action[]) {
this._disposable = combinedDisposable(actions.map(action => {
super();
this._register(combinedDisposable(actions.map(action => {
return action.onDidChange(e => {
if (e.checked && action.checked) {
for (const candidate of actions) {
......@@ -235,10 +234,6 @@ export class RadioGroup {
}
}
});
}));
}
dispose(): void {
this._disposable.dispose();
})));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册