Skip to content

Commit 9bcad09

Browse files
authored
Merge pull request #325 from JohnstonCode/incoming-change-command
feat:Added left click commands to incoming change nodes, fixes #324
2 parents 9b420bc + 28f3801 commit 9bcad09

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/treeView/nodes/incomingChangeNode.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as fs from "fs";
22
import * as path from "path";
33
import { TreeItem, TreeItemCollapsibleState, Uri } from "vscode";
44
import { Repository } from "../../repository";
5+
import { Resource } from "../../resource";
56
import { getIconUri } from "../../uri";
67
import BaseNode from "./baseNode";
78

@@ -31,11 +32,37 @@ export default class IncomingChangeNode implements BaseNode {
3132
light: getIconUri(`status-${this.type}`, "light")
3233
};
3334
item.contextValue = this.contextValue;
35+
item.command = this.getCommand();
3436

3537
return item;
3638
}
3739

3840
public getChildren(): Promise<BaseNode[]> {
3941
return Promise.resolve([]);
4042
}
43+
44+
public getCommand() {
45+
switch (this.type) {
46+
case "modified":
47+
return {
48+
command: "svn.openChangeHead",
49+
title: "Open Changes with HEAD",
50+
arguments: [this.uri]
51+
};
52+
case "deleted":
53+
return {
54+
command: "svn.openFile",
55+
title: "Open File",
56+
arguments: [this.uri]
57+
};
58+
case "added":
59+
return {
60+
command: "svn.openHEADFile",
61+
title: "Open File (HEAD)",
62+
arguments: [
63+
new Resource(this.uri, this.type, undefined, "none", true)
64+
]
65+
};
66+
}
67+
}
4168
}

0 commit comments

Comments
 (0)