public override void Initialize(OptionsDialog dialog, object dataObject)
        {
            if (dataObject is SolutionItem)
            {
                OldChangeLogData.Migrate((SolutionItem)dataObject);
            }
            else if (dataObject is Solution)
            {
                OldChangeLogData.Migrate(((Solution)dataObject).RootFolder);
            }

            base.Initialize(dialog, dataObject);
        }
예제 #2
0
        public override void Initialize(OptionsDialog dialog, object dataObject)
        {
            var solutionItem = dataObject as SolutionItem;

            if (solutionItem != null)
            {
                OldChangeLogData.Migrate(solutionItem);
            }
            else
            {
                var solution = dataObject as Solution;
                if (solution != null)
                {
                    OldChangeLogData.Migrate(solution.RootFolder);
                }
            }
            base.Initialize(dialog, dataObject);
        }
 static ChangeLogPolicy GetPolicy(SolutionItem item)
 {
     OldChangeLogData.Migrate(item);
     return(item.Policies.Get <ChangeLogPolicy> ());
 }
        public static void Migrate(SolutionItem entry)
        {
            if (entry.ParentFolder != null)
            {
                Migrate(entry.ParentFolder);
            }

            OldChangeLogData data = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as OldChangeLogData;

            if (data == null)
            {
                return;
            }

            entry.ExtendedProperties.Remove("MonoDevelop.ChangeLogAddIn.ChangeLogInfo");

            if (entry.Policies.DirectGet <ChangeLogPolicy> () != null)
            {
                return;
            }

            ChangeLogPolicyEnum policy = data.policy;

            if ((entry is SolutionFolder) && ((SolutionFolder)entry).IsRoot)
            {
                if (policy == ChangeLogPolicyEnum.UseParentPolicy)
                {
                    policy = ChangeLogPolicyEnum.UpdateNearestChangeLog;
                }
            }

            ChangeLogUpdateMode mode;
            VcsIntegration      intEnabled = VcsIntegration.Enabled;

            switch (policy)
            {
            case ChangeLogPolicyEnum.UseParentPolicy:
                return;

            case ChangeLogPolicyEnum.NoChangeLog:
                mode       = ChangeLogUpdateMode.None;
                intEnabled = VcsIntegration.None;
                break;

            case ChangeLogPolicyEnum.OneChangeLogInEachDirectory:
                mode = ChangeLogUpdateMode.Directory;
                break;

            case ChangeLogPolicyEnum.OneChangeLogInProjectRootDirectory:
                mode = ChangeLogUpdateMode.ProjectRoot;
                break;

            case ChangeLogPolicyEnum.UpdateNearestChangeLog:
                mode = ChangeLogUpdateMode.Nearest;
                break;

            default:
                throw new InvalidOperationException("Unknown value '" + policy + "'");
            }

            entry.Policies.Set(new ChangeLogPolicy(mode, intEnabled, null));
        }