Пример #1
0
 public static void Create()
 {
     if (instance == null)
     {
         instance              = CreateInstance <BranchWindow>();
         instance.minSize      = new Vector2(220, 140);
         instance.titleContent = new GUIContent(Terminology.branch);
         instance.ShowUtility();
     }
 }
Пример #2
0
 private void OnEnable()
 {
     instance    = this;
     searchField = new SearchField();
     if (string.IsNullOrEmpty(branchpath))
     {
         branchpath = VCCommands.Instance.GetBranchDefaultPath();
     }
     if (string.IsNullOrEmpty(trunkpath))
     {
         trunkpath = VCCommands.Instance.GetTrunkPath();
     }
     branchColumnList = new BranchMulticolumnList();
     VCCommands.Instance.OperationCompleted += InstanceOnOperationCompleted;
     Refresh();
 }
Пример #3
0
        private void DrawToolbar()
        {
            GUILayoutOption[] buttonLayout = { GUILayout.MaxWidth(50) };
            {
                // Buttons at top
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

                using (new PushState <bool>(GUI.enabled, VCCommands.Instance.Ready && !refreshInProgress, v => GUI.enabled = v))
                {
                    if (GUILayout.Button(Terminology.status, EditorStyles.toolbarButton, buttonLayout))
                    {
                        RefreshStatus();
                    }
                    if (GUILayout.Button(Terminology.update, EditorStyles.toolbarButton, buttonLayout))
                    {
                        updateInProgress = true;
                        EditorUtility.DisplayProgressBar(VCSettings.VersionControlBackend + " Updating", "", 0.0f);
                        VCCommands.Instance.UpdateTask();
                    }
                    if (GUILayout.Button(Terminology.revert, EditorStyles.toolbarButton, buttonLayout))
                    {
                        VCCommands.Instance.Revert(GetSelectedAssets().ToArray());
                    }
                    if (GUILayout.Button(Terminology.delete, EditorStyles.toolbarButton, buttonLayout))
                    {
                        VCCommands.Instance.Delete(GetSelectedAssets().ToArray());
                    }
                    if (GUILayout.Button(Terminology.unlock, EditorStyles.toolbarButton, buttonLayout))
                    {
                        VCCommands.Instance.ReleaseLock(GetSelectedAssets().ToArray());
                    }
                    if (GUILayout.Button(Terminology.add, EditorStyles.toolbarButton, buttonLayout))
                    {
                        VCCommands.Instance.AddTask(GetSelectedAssets().ToArray());
                    }
                    if (GUILayout.Button(Terminology.commit, EditorStyles.toolbarButton, buttonLayout))
                    {
                        VCCommands.Instance.CommitDialog(GetSelectedAssets().ToList(), true);
                    }
                }
                GUILayout.Space(7);
                GUILayout.Label(currentBranch, EditorStyles.toolbarTextField, GUILayout.MinWidth(80), GUILayout.ExpandWidth(true));

                if (GUILayout.Button(Terminology.branch, EditorStyles.toolbarButton, buttonLayout))
                {
                    BranchWindow.Create();
                }
                GUILayout.FlexibleSpace();


                string newSearchString = searchField.OnToolbarGUI(searchString);
                if (newSearchString != searchString)
                {
                    searchString = newSearchString;
                    UpdateFilteringOfKeys();
                }

                bool newShowModifiedProjectSettings = GUILayout.Toggle(showProjectSetting, "Project Settings", EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(95) });
                if (newShowModifiedProjectSettings != showProjectSetting)
                {
                    showProjectSetting = newShowModifiedProjectSettings;
                    UpdateFilteringOfKeys();
                }

                bool newShowModifiedNoLock = GUILayout.Toggle(showModifiedNoLock, Terminology.localModified, EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(90) });
                if (newShowModifiedNoLock != showModifiedNoLock)
                {
                    showModifiedNoLock = newShowModifiedNoLock;
                    UpdateFilteringOfKeys();
                }

                bool newShowUnversioned = GUILayout.Toggle(showUnversioned, "Unversioned", EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(80) });
                if (newShowUnversioned != showUnversioned)
                {
                    showUnversioned = newShowUnversioned;
                    UpdateFilteringOfKeys();
                }

                bool newShowMeta = GUILayout.Toggle(showMeta, "Meta", EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(40) });
                if (newShowMeta != showMeta)
                {
                    showMeta = newShowMeta;
                    UpdateFilteringOfKeys();
                }

                GUILayout.Space(7.0f);

                if (GUILayout.Button("Settings", EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(55) }))
                {
                    if (settingsWindow == null)
                    {
                        settingsWindow = CreateInstance <VCSettingsWindow>();
                        settingsWindow.titleContent = new GUIContent("Version Control Settings");
                        settingsWindow.ShowUtility();
                    }
                    else
                    {
                        settingsWindow.Close();
                    }
                }

                GUILayout.Space(7.0f);

                bool vcsOn = VCSettings.VCEnabled;
                using (GUIColor(vcsOn ? Color.green : Color.red))
                {
                    if (GUILayout.Button(new GUIContent(vcsOn ? "On" : "Off", "Toggle Version Control"), EditorStyles.toolbarButton, new[] { GUILayout.MaxWidth(25) }))
                    {
                        commandInProgress    = "";
                        VCSettings.VCEnabled = !VCSettings.VCEnabled;
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
            }
        }
Пример #4
0
 private void OnDisable()
 {
     VCCommands.Instance.OperationCompleted -= InstanceOnOperationCompleted;
     instance = null;
 }