public void AddSourceHandler(object sender, EventArgs args) { SourceText sourceText = (SourceText)acceptor.getFactory().createSourceText(); sourceText.Name = "<SourceText " + (Item.SourceTexts.Count + 1) + ">"; Item.appendSourceTexts(sourceText); }
/// <summary> /// Accepts the drop event /// </summary> /// <param name="translationTreeNode"></param> /// <param name="sourceNode"></param> public static void AcceptDropForTranslation(TranslationTreeNode translationTreeNode, BaseTreeNode sourceNode) { if (sourceNode is SourceTextTreeNode) { SourceTextTreeNode text = sourceNode as SourceTextTreeNode; SourceText otherText = (SourceText)text.Item.Duplicate(); translationTreeNode.Item.appendSourceTexts(otherText); text.Delete(); } else if (sourceNode is StepTreeNode) { StepTreeNode step = sourceNode as StepTreeNode; if (string.IsNullOrEmpty(step.Item.getDescription())) { MessageBox.Show(@"Step has no description and cannot be automatically translated", @"No description available", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { translationTreeNode.Item.appendSourceTexts(step.Item.CreateSourceText()); } } }
/// <summary> /// Creates a new translation based on a step /// </summary> /// <param name="step"></param> private void createTranslation(DataDictionary.Tests.Step step) { DataDictionary.Tests.Translations.Translation translation = (DataDictionary.Tests.Translations.Translation)DataDictionary.Generated.acceptor.getFactory().createTranslation(); DataDictionary.Tests.Translations.SourceText sourceText = (DataDictionary.Tests.Translations.SourceText)DataDictionary.Generated.acceptor.getFactory().createSourceText(); sourceText.Name = step.getDescription(); translation.appendSourceTexts(sourceText); createTranslation(translation); }
/// <summary> /// Creates a new source text /// </summary> /// <param name="name"></param> /// <returns></returns> public SourceTextTreeNode createSourceText(DataDictionary.Tests.Translations.SourceText sourceText) { SourceTextTreeNode retVal; Item.appendSourceTexts(sourceText); retVal = new SourceTextTreeNode(sourceText); Nodes.Add(retVal); SortSubNodes(); return(retVal); }
/// <summary> /// Creates the source text which corresponds to this step /// </summary> /// <returns></returns> public SourceText CreateSourceText() { SourceText retVal = (SourceText)acceptor.getFactory().createSourceText(); retVal.Name = getDescription(); if (!string.IsNullOrEmpty(Comment) && Comment.Trim() != "-") { SourceTextComment comment = (SourceTextComment)acceptor.getFactory().createSourceTextComment(); comment.Name = Comment; retVal.appendComments(comment); } return(retVal); }
public void AddHandler(object sender, EventArgs args) { DataDictionary.Tests.Translations.SourceText sourceText = (DataDictionary.Tests.Translations.SourceText)DataDictionary.Generated.acceptor.getFactory().createSourceText(); sourceText.Name = "<SourceText " + (Item.SourceTexts.Count + 1) + ">"; createSourceText(sourceText); }