/// <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> /// Accepts the drop event /// </summary> /// <param name="sourceTextTreeNode"></param> /// <param name="sourceNode"></param> public static void AcceptDropForSourceText(SourceTextTreeNode sourceTextTreeNode, BaseTreeNode sourceNode) { if (sourceNode is SourceTextCommentTreeNode) { SourceTextCommentTreeNode comment = sourceNode as SourceTextCommentTreeNode; SourceTextComment otherText = (SourceTextComment)comment.Item.Duplicate(); sourceTextTreeNode.Item.appendComments(otherText); comment.Delete(); } }
/// <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> /// Handles drop event /// </summary> /// <param name="sourceNode"></param> public override void AcceptDrop(BaseTreeNode sourceNode) { base.AcceptDrop(sourceNode); SourceTextTreeNode sourceTextTreeNode = Parent as SourceTextTreeNode; SourceTextCommentTreeNode comment = sourceNode as SourceTextCommentTreeNode; if (comment != null && sourceTextTreeNode != null) { SourceTextComment otherText = (SourceTextComment)comment.Item.Duplicate(); sourceTextTreeNode.Item.appendComments(otherText); comment.Delete(); } }
/// <summary> /// Handles drop event /// </summary> /// <param name="SourceNode"></param> public override void AcceptDrop(BaseTreeNode SourceNode) { base.AcceptDrop(SourceNode); if (SourceNode is SourceTextTreeNode) { SourceTextTreeNode text = SourceNode as SourceTextTreeNode; DataDictionary.Tests.Translations.SourceText otherText = (DataDictionary.Tests.Translations.SourceText)DataDictionary.Generated.acceptor.getFactory().createSourceText(); text.Item.copyTo(otherText); createSourceText(otherText); text.Delete(); } else if (SourceNode is TestRunnerView.StepTreeNode) { TestRunnerView.StepTreeNode step = SourceNode as TestRunnerView.StepTreeNode; DataDictionary.Tests.Translations.SourceText sourceText = (DataDictionary.Tests.Translations.SourceText)DataDictionary.Generated.acceptor.getFactory().createSourceText(); sourceText.Name = step.Item.getDescription(); Item.appendSourceTexts(sourceText); createSourceText(sourceText); } }