提交 9d9614e3 编写于 作者: J Johannes Rieken

don't fire event when nothing changed

上级 cee125e6
......@@ -38,14 +38,17 @@ export class KeybindingContext {
this._value['_contextId'] = id;
}
public setValue(key: string, value: any): void {
public setValue(key: string, value: any): boolean {
// console.log('SET ' + key + ' = ' + value + ' ON ' + this._id);
this._value[key] = value;
if (this._value[key] !== value) {
this._value[key] = value;
return true;
}
}
public removeValue(key: string): void {
public removeValue(key: string): boolean {
// console.log('REMOVE ' + key + ' FROM ' + this._id);
delete this._value[key];
return delete this._value[key];
}
public fillInContext(bucket: any): void {
......@@ -175,13 +178,15 @@ export abstract class AbstractKeybindingService {
}
public setContext(key: string, value: any): void {
this.getContext(this._myContextId).setValue(key, value);
this._onDidChangeContextKey.fire(key);
if(this.getContext(this._myContextId).setValue(key, value)) {
this._onDidChangeContextKey.fire(key);
}
}
public removeContext(key: string): void {
this.getContext(this._myContextId).removeValue(key);
this._onDidChangeContextKey.fire(key);
if(this.getContext(this._myContextId).removeValue(key)) {
this._onDidChangeContextKey.fire(key);
}
}
public hasCommand(commandId: string): boolean {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册