private void RenderUnstageButtons() { bool noneSelected = (stagedFileViewer.GetSelectedPaths().Count == 0); bool noFiles = (stagedFiles.Count == 0); EditorGUILayout.BeginHorizontal(); //UNSTAGE SELECTED EditorGUI.BeginDisabledGroup(noneSelected); if (GUILayout.Button("Unstage Selected", GUILayout.ExpandWidth(false))) { GitCore.UnstagePaths(stagedFileViewer.GetSelectedPaths(), null); Scan(); } EditorGUI.EndDisabledGroup(); //UNSTAGE ALL EditorGUI.BeginDisabledGroup(noFiles); if (GUILayout.Button("Unstage All", GUILayout.ExpandWidth(false))) { GitCore.UnstagePaths(GitFile.GetPaths(stagedFiles), null); Scan(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); }
public override List <string> GetSelectedPaths() { if (selectedFiles == null) { return(new List <string>()); } return(GitFile.GetPaths(selectedFiles)); }
public override void Render(List <GitFile> files) { if (files == null) { return; } scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUIStyle.none, GUI.skin.verticalScrollbar); float statusSize = 20; //Render list of files selectedFiles = SelectableListGUI.RenderList <GitFile>(files, selectedFiles, (file, selected) => { //Render EditorGUILayout.BeginHorizontal(); GUIStyle style = new GUIStyle("Label"); if (selected) { style.normal.textColor = Color.blue; } //Status Icon if (fileStatusIcons.ContainsKey(file.status)) { GUILayout.Label(fileStatusIcons[file.status], GUILayout.Width(statusSize), GUILayout.Height(statusSize)); } else { GUILayout.Label(file.status.ToString(), GUILayout.Width(statusSize), GUILayout.Height(statusSize)); } //Button bool pressed = GUILayout.Button(file.path, style, GUILayout.Height(statusSize)); EditorGUILayout.EndHorizontal(); return(pressed); }, (selectedFiles, mouse) => { //Context click if (mouse == 1) { ContextOption <string> .ShowContextMenu(GitFile.GetPaths(selectedFiles), contextOptions); } }); EditorGUILayout.EndScrollView(); }