提交 f8b5b080 编写于 作者: J Joao Moreno

create active scm provider context key

上级 c93537dc
......@@ -35,7 +35,8 @@
"scm/title": [
{
"command": "git.refresh",
"group": "navigation"
"group": "navigation",
"when": "scm.provider == git"
}
]
},
......
......@@ -29,8 +29,9 @@ export interface ISCMResourceGroup {
}
export interface ISCMProvider extends IDisposable {
onChange: Event<void>;
resourceGroups: ISCMResourceGroup[];
readonly id: string;
readonly onChange: Event<void>;
readonly resourceGroups: ISCMResourceGroup[];
commit(message: string): TPromise<void>;
open(uri: ISCMResource): TPromise<void>;
......
......@@ -8,19 +8,31 @@
import { TPromise } from 'vs/base/common/winjs.base';
import URI from 'vs/base/common/uri';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ISCMService, IBaselineResourceProvider, ISCMProvider } from './scm';
export class SCMService implements ISCMService {
_serviceBrand;
private activeProviderContextKey: IContextKey<string | undefined>;
private providers: IBaselineResourceProvider[] = [];
private _activeProvider: ISCMProvider;
constructor() {
constructor(
@IContextKeyService private contextKeyService: IContextKeyService
) {
this.activeProviderContextKey = contextKeyService.createKey<string | undefined>('scm.provider', void 0);
}
get activeProvider(): ISCMProvider {
return this._activeProvider;
}
activeProvider: ISCMProvider;
set activeProvider(provider: ISCMProvider) {
this._activeProvider = provider;
this.activeProviderContextKey.set(provider.id);
}
getBaselineResource(resource: URI): TPromise<URI> {
const promises = this.providers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册