Esempio n. 1
0
        private void DoActionbarGUI()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                if (hasRemote)
                {
                    EditorGUI.BeginDisabledGroup(currentRemoteName == null);
                    {
                        // Fetch button
                        var fetchClicked = GUILayout.Button(fetchButtonContent, Styles.ToolbarButtonStyle);
                        if (fetchClicked)
                        {
                            Fetch();
                        }

                        // Pull button
                        var pullButtonText = statusBehind > 0 ? new GUIContent(String.Format(Localization.PullButtonCount, statusBehind)) : pullButtonContent;
                        var pullClicked    = GUILayout.Button(pullButtonText, Styles.ToolbarButtonStyle);

                        if (pullClicked &&
                            EditorUtility.DisplayDialog(Localization.PullConfirmTitle,
                                                        String.Format(Localization.PullConfirmDescription, currentRemoteName),
                                                        Localization.PullConfirmYes,
                                                        Localization.Cancel)
                            )
                        {
                            Pull();
                        }
                    }
                    EditorGUI.EndDisabledGroup();

                    // Push button
                    EditorGUI.BeginDisabledGroup(currentRemoteName == null || isTrackingRemoteBranch && statusAhead == 0);
                    {
                        var pushButtonText = statusAhead > 0 ? new GUIContent(String.Format(Localization.PushButtonCount, statusAhead)) : pushButtonContent;
                        var pushClicked    = GUILayout.Button(pushButtonText, Styles.ToolbarButtonStyle);

                        if (pushClicked &&
                            EditorUtility.DisplayDialog(Localization.PushConfirmTitle,
                                                        String.Format(Localization.PushConfirmDescription, currentRemoteName),
                                                        Localization.PushConfirmYes,
                                                        Localization.Cancel)
                            )
                        {
                            Push();
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                }
                else
                {
                    // Publishing a repo
                    if (GUILayout.Button(Localization.PublishButton, Styles.ToolbarButtonStyle))
                    {
                        PopupWindow.OpenWindow(PopupWindow.PopupViewType.PublishView);
                    }
                }

                if (GUILayout.Button(refreshButtonContent, Styles.ToolbarButtonStyle))
                {
                    Refresh();
                }

                GUILayout.FlexibleSpace();

                //if (!connections.Any())
                //{
                //    if (GUILayout.Button("Sign in", EditorStyles.toolbarButton))
                //        SignIn(null);
                //}
                //else
                //{
                //    var connection = connections.First();
                //    if (GUILayout.Button(connection.Username, EditorStyles.toolbarDropDown))
                //    {
                //        DoAccountDropdown();
                //    }
                //}
            }
            EditorGUILayout.EndHorizontal();
        }
Esempio n. 2
0
 private void SignIn(object obj)
 {
     PopupWindow.OpenWindow(PopupWindow.PopupViewType.AuthenticationView);
 }