Esempio n. 1
0
        void DoCheckinAreaHeader(
            WorkspaceInfo workspaceInfo,
            bool isGluonMode,
            IRefreshableView refreshableView,
            EditorWindow editorWindow)
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            string checkinHeader = string.Format(
                "Checkin {0} of {1} item(s)",
                mPendingChangesTreeView.GetSelectedItemCount(),
                mPendingChangesTreeView.GetTotalItemCount());

            GUILayout.Label(checkinHeader, UnityStyles.PendingChangesTab.HeaderLabel);
            GUILayout.FlexibleSpace();

            DoSearchField(
                mSearchField,
                mPendingChangesTreeView,
                UnityConstants.SEARCH_FIELD_WIDTH);

            if (GUILayout.Button(PlasticLocalization.GetString(
                                     PlasticLocalization.Name.Options),
                                 EditorStyles.toolbarButton,
                                 GUILayout.Width(UnityConstants.REGULAR_BUTTON_WIDTH)))
            {
                PendingChangesOptionsDialog.ChangeOptions(
                    workspaceInfo, isGluonMode, refreshableView, this, editorWindow);
                GUIUtility.ExitGUI();
            }

            EditorGUILayout.EndHorizontal();
        }
Esempio n. 2
0
        void DoActionsToolbar(
            WorkspaceInfo workspaceInfo,
            bool isGluonMode,
            IRefreshableView refreshableView,
            ProgressControlsForViews progressControls,
            EditorWindow editorWindow)
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            string checkinHeader = string.Format(
                PlasticLocalization.GetString(PlasticLocalization.Name.CheckinHeader),
                mPendingChangesTreeView.GetSelectedItemCount(),
                mPendingChangesTreeView.GetTotalItemCount());

            GUILayout.Label(checkinHeader, UnityStyles.PendingChangesTab.HeaderLabel);

            if (progressControls.IsOperationRunning())
            {
                DrawProgressForViews.ForIndeterminateProgress(
                    progressControls.ProgressData);
            }

            GUILayout.FlexibleSpace();

            DrawSearchField.For(
                mSearchField,
                mPendingChangesTreeView,
                UnityConstants.SEARCH_FIELD_WIDTH);

            if (GUILayout.Button(PlasticLocalization.GetString(
                                     PlasticLocalization.Name.Options),
                                 EditorStyles.toolbarButton,
                                 GUILayout.Width(UnityConstants.REGULAR_BUTTON_WIDTH)))
            {
                PendingChangesOptionsDialog.ChangeOptions(
                    workspaceInfo, refreshableView, this, editorWindow);
                GUIUtility.ExitGUI();
            }

            DoRefreshButton(
                refreshableView,
                progressControls.IsOperationRunning());

            EditorGUILayout.EndHorizontal();
        }
Esempio n. 3
0
        static void DoLaunchButtons(
            bool isPlasticExeAvailable,
            WorkspaceInfo wkInfo,
            ViewSwitcher viewSwitcher,
            bool isGluonMode)
        {
            //TODO: Codice - beta: hide the diff button until the behavior is implemented

            /*GUILayout.Button(PlasticLocalization.GetString(
             *  PlasticLocalization.Name.DiffWindowMenuItemDiff),
             *  EditorStyles.toolbarButton,
             *  GUILayout.Width(UnityConstants.REGULAR_BUTTON_WIDTH));*/

            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.Changesets))
            {
                viewSwitcher.ChangesetsTab.DrawDateFilter();
            }

            var refreshIcon        = Images.GetRefreshIcon();
            var refreshIconTooltip = PlasticLocalization.GetString(
                PlasticLocalization.Name.RefreshButton);

            if (DrawLaunchButton(refreshIcon, refreshIconTooltip))
            {
                viewSwitcher.RefreshSelectedView();
            }

            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.PendingChanges))
            {
                var icon    = Images.GetImage(Images.Name.IconUndo);
                var tooltip = PlasticLocalization.GetString(
                    PlasticLocalization.Name.UndoSelectedChanges);

                if (DrawLaunchButton(icon, tooltip))
                {
                    TrackFeatureUseEvent.For(
                        PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
                        TrackFeatureUseEvent.Features.UndoIconButton);

                    viewSwitcher.PendingChangesTab.UndoForMode(wkInfo, isGluonMode);
                }
            }

            if (isGluonMode)
            {
                var label = PlasticLocalization.GetString(PlasticLocalization.Name.ConfigureGluon);
                if (DrawActionButton.For(label))
                {
                    LaunchTool.OpenWorkspaceConfiguration(wkInfo, isGluonMode);
                }
            }
            else
            {
                var icon    = Images.GetImage(Images.Name.IconBranch);
                var tooltip = PlasticLocalization.GetString(PlasticLocalization.Name.BranchExplorerMenu);
                if (DrawLaunchButton(icon, tooltip))
                {
                    LaunchTool.OpenBranchExplorer(wkInfo, isGluonMode);
                }
            }

            //TODO: Add settings button tooltip localization
            if (DrawLaunchButton(Images.GetSettingsIcon(), string.Empty))
            {
                GenericMenu menu = new GenericMenu();

                string openToolText = isGluonMode ?
                                      PlasticLocalization.GetString(PlasticLocalization.Name.LaunchGluonButton) :
                                      PlasticLocalization.GetString(PlasticLocalization.Name.LaunchPlasticButton);

                menu.AddItem(
                    new GUIContent(openToolText),
                    false,
                    () => LaunchTool.OpenGUIForMode(wkInfo, isGluonMode));

                var plasticWindow = EditorWindow.GetWindow <PlasticWindow>();

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.InviteMembers)),
                    false,
                    InviteMemberButton_clicked,
                    null);

                menu.AddSeparator("");

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.Options)),
                    false,
                    () => PendingChangesOptionsDialog.ChangeOptions(wkInfo, PlasticAssetsProcessor.mPendingChangesTab, plasticWindow));

                // If the user has the simplified UI key of type .txt in the Assets folder
                // TODO: Remove when Simplified UI is complete
                if (AssetDatabase.FindAssets("simplifieduikey t:textasset", new[] { "Assets" }).Any())
                {
                    menu.AddItem(new GUIContent("Try Simplified UI"),
                                 false,
                                 TrySimplifiedUIButton_Clicked,
                                 null);
                }

                //TODO: Localization
                menu.AddItem(
                    new GUIContent(processor.AssetModificationProcessor.ForceCheckout ?
                                   PlasticLocalization.GetString(PlasticLocalization.Name.DisableForcedCheckout) :
                                   PlasticLocalization.GetString(PlasticLocalization.Name.EnableForcedCheckout)),
                    false,
                    ForceCheckout_Clicked,
                    null);

                menu.AddSeparator("");

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.TurnOffPlasticSCM)),
                    false,
                    TurnOffPlasticButton_Clicked,
                    null);

                menu.ShowAsContext();
            }
        }
Esempio n. 4
0
        static void ShowSettingsContextMenu(
            WorkspaceInfo wkInfo,
            bool isGluonMode)
        {
            GenericMenu menu = new GenericMenu();

            string openToolText = isGluonMode ?
                                  PlasticLocalization.GetString(PlasticLocalization.Name.LaunchGluonButton) :
                                  PlasticLocalization.GetString(PlasticLocalization.Name.LaunchPlasticButton);

            menu.AddItem(
                new GUIContent(openToolText),
                false,
                () => LaunchTool.OpenGUIForMode(wkInfo, isGluonMode));

            PlasticWindow plasticWindow = EditorWindow.GetWindow <PlasticWindow>();

            menu.AddItem(
                new GUIContent(
                    PlasticLocalization.GetString(
                        PlasticLocalization.Name.InviteMembers)),
                false,
                InviteMemberButton_clicked,
                null);

            menu.AddSeparator("");

            menu.AddItem(
                new GUIContent(
                    PlasticLocalization.GetString(
                        PlasticLocalization.Name.Options)),
                false,
                () => PendingChangesOptionsDialog.ChangeOptions(wkInfo, PlasticAssetsProcessor.mPendingChangesTab, plasticWindow));

            // If the user has the simplified UI key of type .txt in the Assets folder
            // TODO: Remove when Simplified UI is complete
            if (AssetDatabase.FindAssets("simplifieduikey t:textasset", new[] { "Assets" }).Any())
            {
                menu.AddItem(new GUIContent("Try Simplified UI"),
                             false,
                             TrySimplifiedUIButton_Clicked,
                             null);
            }

            //TODO: Localization
            menu.AddItem(
                new GUIContent(processor.AssetModificationProcessor.ForceCheckout ?
                               PlasticLocalization.GetString(PlasticLocalization.Name.DisableForcedCheckout) :
                               PlasticLocalization.GetString(PlasticLocalization.Name.EnableForcedCheckout)),
                false,
                ForceCheckout_Clicked,
                null);

            menu.AddSeparator("");

            menu.AddItem(
                new GUIContent(
                    PlasticLocalization.GetString(
                        PlasticLocalization.Name.TurnOffPlasticSCM)),
                false,
                TurnOffPlasticButton_Clicked,
                null);

            menu.ShowAsContext();
        }
Esempio n. 5
0
        static void DoLaunchButtons(
            bool isPlasticExeAvailable,
            WorkspaceInfo wkInfo,
            bool isGluonMode)
        {
            //TODO: Codice - beta: hide the diff button until the behavior is implemented

            /*GUILayout.Button(PlasticLocalization.GetString(
             *  PlasticLocalization.Name.DiffWindowMenuItemDiff),
             *  EditorStyles.toolbarButton,
             *  GUILayout.Width(UnityConstants.REGULAR_BUTTON_WIDTH));*/

            if (isGluonMode)
            {
                var label = PlasticLocalization.GetString(PlasticLocalization.Name.ConfigureGluon);
                if (DrawActionButton.For(label))
                {
                    LaunchTool.OpenWorkspaceConfiguration(wkInfo, isGluonMode);
                }
            }
            else
            {
                var label = PlasticLocalization.GetString(PlasticLocalization.Name.LaunchBranchExplorer);
                if (DrawActionButton.For(label))
                {
                    LaunchTool.OpenBranchExplorer(wkInfo, isGluonMode);
                }
            }

            if (GUILayout.Button(new GUIContent(
                                     EditorGUIUtility.IconContent("settings")), EditorStyles.toolbarButton))
            {
                GenericMenu menu = new GenericMenu();

                string openToolText = isGluonMode ?
                                      PlasticLocalization.GetString(PlasticLocalization.Name.LaunchGluonButton) :
                                      PlasticLocalization.GetString(PlasticLocalization.Name.LaunchPlasticButton);

                menu.AddItem(
                    new GUIContent(openToolText),
                    false,
                    () => LaunchTool.OpenGUIForMode(wkInfo, isGluonMode));

                var plasticWindow = EditorWindow.GetWindow <PlasticWindow>();

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.Options)),
                    false,
                    () => PendingChangesOptionsDialog.ChangeOptions(wkInfo, PlasticAssetsProcessor.mPendingChangesTab, plasticWindow));

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.InviteMembers)),
                    false,
                    InviteMemberButton_clicked,
                    null);

                // If the user has the simplified UI key of type .txt in the Assets folder
                // TODO: Remove when Simplified UI is complete
                if (AssetDatabase.FindAssets("simplifieduikey t:textasset", new[] { "Assets" }).Any())
                {
                    menu.AddItem(new GUIContent("Try Simplified UI"),
                                 false,
                                 TrySimplifiedUIButton_Clicked,
                                 null);
                }

                menu.AddSeparator("");

                menu.AddItem(
                    new GUIContent(
                        PlasticLocalization.GetString(
                            PlasticLocalization.Name.TurnOffPlasticSCM)),
                    false,
                    TurnOffPlasticButton_Clicked,
                    null);

                menu.ShowAsContext();
            }
        }