예제 #1
0
 public void ConflictOccurred(IConflict conflict)
 {
     foreach (IMergeEventListener listener in _listeners)
     {
         listener.ConflictOccurred(conflict);
     }
 }
예제 #2
0
 public ConflictPresenter(IXmlChangeReport report, IRetrieveFileVersionsFromRepository fileRetriever)
 {
     _fileRetriever = fileRetriever;
     _report = report;// as XmlAdditionChangeReport;
     if (_report == null)
     {
         _conflict = new UnreadableConflict(report.ChildNode);
     }
     else
     {
         if (_report.ChildNode.Name == "conflict") // old style situation, only on Tok Pisin before Oct 2009
         {
             _conflict = Conflict.CreateFromConflictElement(_report.ChildNode);
         }
         else
         {
             var conflictNode = _report.ChildNode.SelectSingleNode("data/conflict");
             if (conflictNode != null)
             {
                 _conflict = Conflict.CreateFromConflictElement(conflictNode);
             }
             else
             {
                 _conflict = new UnreadableConflict(_report.ChildNode);
             }
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Add conflict. If RecordContextInConflict fails to set a context, and nodeToFindGeneratorFrom is non-null,
        /// attempt to add a context based on the argument.
        /// </summary>
        public static void AddConflictToListener(IMergeEventListener listener, IConflict conflict, XmlNode oursContext,
												 XmlNode theirsContext, XmlNode ancestorContext,
												 IGenerateHtmlContext htmlContextGenerator, XmlMerger merger, XmlNode nodeToFindGeneratorFrom)
        {
            // NB: All these steps are crucially ordered.
            listener.RecordContextInConflict(conflict);
            if ((conflict.Context == null || conflict.Context is NullContextDescriptor) && nodeToFindGeneratorFrom != null)
            {
                // We are too far up the stack for the listener to have been told a context.
                // Make one out of the current node.
                conflict.Context = merger.GetContext(nodeToFindGeneratorFrom);
            }
            conflict.MakeHtmlDetails(oursContext, theirsContext, ancestorContext, htmlContextGenerator);
            listener.ConflictOccurred(conflict);
        }
		private static string MakeHtmlForIncompatibleMove(IConflict conflict, string oldGuid, string elementGuid, XElement element)
		{
			var doc = new XmlDocument();
			doc.LoadXml(element.ToString());
			var sb = new StringBuilder("<head><style type='text/css'>");
			sb.Append(FieldWorkObjectContextGenerator.DefaultHtmlContextStyles(doc.DocumentElement));
			sb.Append("</style></head><body><div class='description'>");
			sb.Append(conflict.GetFullHumanReadableDescription());
			string className = element.Name.LocalName;
			var classAttr = element.Attribute("class");
			if (classAttr != null)
				className = classAttr.Value;
			sb.Append(String.Format("</div><div> The object that was copied is a {0}:", className));
			sb.Append("</div><div class=\"description\">");
			sb.Append(new FwGenericHtmlGenerator().MakeHtml(doc.DocumentElement));
			sb.Append("</div><div>The original is ");
			MakeSilfwLink(oldGuid, sb);
			sb.Append("</div><div>The copy is ");
			MakeSilfwLink(elementGuid, sb);
			sb.Append("</div></body>");
			return sb.ToString();
		}
예제 #5
0
 /// methods
 public void AddConflict(IConflict conflict)
 {
     _conflictList.Add(conflict);
 }
예제 #6
0
        /// <summary>
        /// Add conflict.
        /// </summary>
        public static void AddConflictToListener(IMergeEventListener listener, IConflict conflict, XmlNode oursContext,
												 XmlNode theirsContext, XmlNode ancestorContext,
												 IGenerateHtmlContext htmlContextGenerator)
        {
            AddConflictToListener(listener, conflict, oursContext, theirsContext, ancestorContext, htmlContextGenerator, null, null);
        }
예제 #7
0
 /// <summary>
 /// Add conflict.
 /// </summary>
 public static void AddConflictToListener(IMergeEventListener listener, IConflict conflict)
 {
     AddConflictToListener(listener, conflict, null, null, null);
 }
 public void ConflictOccurred(IConflict conflict)
 {
     conflict.WriteAsChorusNotesAnnotation(_writer);
 }
예제 #9
0
 public void WarningOccurred(IConflict conflict)
 {
 }
예제 #10
0
 public void WarningOccurred(IConflict warning)
 {
     _stream.WriteLine("warning: "+warning.GetFullHumanReadableDescription());
 }
예제 #11
0
 public void ConflictOccurred(IConflict conflict)
 {
     _stream.WriteLine(conflict.GetFullHumanReadableDescription());
 }
예제 #12
0
        /// <summary>
        /// Add warning.
        /// </summary>
        public static void AddWarningToListener(IMergeEventListener listener, IConflict warning, XmlNode oursContext,
												XmlNode theirsContext, XmlNode ancestorContext,
												IGenerateHtmlContext htmlContextGenerator)
        {
            // NB: All three of these are crucially ordered.
            listener.RecordContextInConflict(warning);
            warning.MakeHtmlDetails(oursContext, theirsContext, ancestorContext, htmlContextGenerator);
            listener.WarningOccurred(warning);
        }
예제 #13
0
 /// <summary>
 /// Add warning.
 /// </summary>
 public static void AddWarningToListener(IMergeEventListener listener, IConflict warning)
 {
     AddWarningToListener(listener, warning, null, null, null);
 }
예제 #14
0
        internal void WarningOccurred(IConflict warning)
        {
            if (_htmlContextGenerator == null)
                _htmlContextGenerator = new SimpleHtmlGenerator();

            XmlMergeService.AddWarningToListener(
                EventListener,
                warning,
                _oursContext,
                _theirsContext,
                _ancestorContext,
                _htmlContextGenerator);
        }
예제 #15
0
        internal void ConflictOccurred(IConflict conflict, XmlNode nodeToFindGeneratorFrom)
        {
            var contextDescriptorGenerator = GetContextDescriptorGenerator(nodeToFindGeneratorFrom);
            _htmlContextGenerator = (contextDescriptorGenerator as IGenerateHtmlContext) ?? new SimpleHtmlGenerator();

            XmlMergeService.AddConflictToListener(
                EventListener,
                conflict,
                _oursContext,
                _theirsContext,
                _ancestorContext,
                _htmlContextGenerator,
                this,
                nodeToFindGeneratorFrom);
        }
예제 #16
0
        internal void ConflictOccurred(IConflict conflict)
        {
            if (_htmlContextGenerator == null)
                _htmlContextGenerator = new SimpleHtmlGenerator();

            XmlMergeService.AddConflictToListener(
                EventListener,
                conflict,
                _oursContext,
                _theirsContext,
                _ancestorContext,
                _htmlContextGenerator);
        }
 public void RecordContextInConflict(IConflict conflict)
 {
     Guard.AgainstNull(_context, "_context");
     conflict.Context = _context;
 }
예제 #18
0
 public void RecordContextInConflict(IConflict conflict)
 {
     // Only the last listener which actually does something will take effect, but usually only one does, anyway.
     foreach (IMergeEventListener listener in _listeners)
     {
         listener.RecordContextInConflict(conflict);
     }
 }
예제 #19
0
        /// <summary>
        /// Add warning.
        /// </summary>
        public static void AddWarningToListener(IMergeEventListener listener, IConflict warning, XmlNode oursContext,
												 XmlNode theirsContext, XmlNode ancestorContext)
        {
            AddWarningToListener(listener, warning, oursContext, theirsContext, ancestorContext, new SimpleHtmlGenerator());
        }
 public void ConflictOccurred(IConflict conflict)
 {
     Conflicts.Add(conflict);
 }
예제 #21
0
        public static string WriteConflictAnnotation(IConflict conflict)
        {
            var stringBuilder = new StringBuilder();

            using (var stringWriter = new StringWriter(stringBuilder))
            using (var textWriter = new XmlTextWriter(stringWriter))
            {
                conflict.WriteAsChorusNotesAnnotation(textWriter);
            }
            return stringBuilder.ToString();
        }
 public void WarningOccurred(IConflict warning)
 {
     Warnings.Add(warning);
 }
예제 #23
0
 /// <summary>
 /// Historically, this class's implementation of ConflictOccurred (before it was split into two
 /// interface members) did not push any context.
 /// To keep the behavior the same, RecordContextInConflict does nothing.
 /// </summary>
 /// <param name="conflict"></param>
 public void RecordContextInConflict(IConflict conflict)
 {
 }
 public void RecordContextInConflict(IConflict conflict)
 {
     conflict.Context = _context;
 }
 public void WarningOccurred(IConflict warning)
 {
     warning.Context = _context;
     warning.WriteAsChorusNotesAnnotation(_writer);
 }
예제 #26
0
 public void ConflictOccurred(IConflict conflict)
 {
 }