Пример #1
0
        static void DoSearchField(ViewSwitcher viewSwitcher)
        {
            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.PendingChanges))
            {
                viewSwitcher.PendingChangesTab.DrawSearchFieldForPendingChangesTab();
            }

            else if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.Changesets))
            {
                viewSwitcher.ChangesetsTab.DrawSearchFieldForChangesetsTab();
            }
            else if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.History))
            {
                viewSwitcher.HistoryTab.DrawSearchFieldForHistoryTab();
            }
        }
Пример #2
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();
            }
            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.Branches))
            {
                viewSwitcher.BranchesTab.DrawDateFilter();
            }

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

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

            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.PendingChanges))
            {
                Texture2D icon    = Images.GetImage(Images.Name.IconUndo);
                string    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)
            {
                string label = PlasticLocalization.GetString(PlasticLocalization.Name.ConfigureGluon);
                if (DrawActionButton.For(label))
                {
                    LaunchTool.OpenWorkspaceConfiguration(wkInfo, isGluonMode);
                }
            }
            else
            {
                Texture2D icon    = Images.GetImage(Images.Name.IconBranch);
                string    tooltip = PlasticLocalization.GetString(PlasticLocalization.Name.Branches);
                if (DrawLaunchButton(icon, tooltip))
                {
                    ShowBranchesContextMenu(
                        wkInfo,
                        viewSwitcher,
                        isGluonMode);
                }
            }

            //TODO: Add settings button tooltip localization
            if (DrawLaunchButton(Images.GetSettingsIcon(), string.Empty))
            {
                ShowSettingsContextMenu(
                    wkInfo,
                    isGluonMode);
            }
        }
Пример #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();
            }
        }