B2024-045, B2024-049, B2024-050 crash on paste/replace #370
@ -1309,8 +1309,7 @@ namespace VEPROMS.CSLA.Library
|
||||
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
|
||||
{
|
||||
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
|
||||
TreeNode trn = null;
|
||||
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid, trn);
|
||||
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
|
||||
}
|
||||
|
||||
// update the config data for the new enhanced item (procedure, section or step) to point back to the correct source
|
||||
@ -2498,16 +2497,15 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region PasteReplace
|
||||
|
||||
|
||||
|
||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace)
|
||||
// B2024-045, 049 and 050: remove the treenode that was passed in - adjust tree from user interface code, not in item extension
|
||||
// code (the 2 PasteReplace methods here had a treenode passed in)
|
||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid)
|
||||
{
|
||||
bool tmp = false;
|
||||
return PasteReplace(itemInfo, copyStartID, chgid, treeNodeReplace, ref tmp);
|
||||
return PasteReplace(itemInfo, copyStartID, chgid, ref tmp);
|
||||
}
|
||||
// B2017-179 return a bool (firstTrans) if we could not replace the step but the user wants to position to the first transition that needs resolved
|
||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace, ref bool firstTrans)
|
||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, ref bool firstTrans)
|
||||
{
|
||||
firstTrans = false;
|
||||
if (!CanDeleteObject())
|
||||
@ -2565,10 +2563,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create tree node for copied procedure when no other procedures exist in the working draft (treeNodeReplace)
|
||||
VETreeNode tn = null;
|
||||
tn = new VETreeNode(newItemInfo);
|
||||
treeNodeReplace.Nodes.Add(tn);
|
||||
// B2024-045, 049 and 050: if not a single procedure replace, update user interface by using the 'OnNewChild'. Single
|
||||
// procedure's MyParent is null because its parent is a working draft (docversion) since MyParent's type is iteminfo.
|
||||
// For the single procedure case, the user interface code in vlntreeview will update the tree.
|
||||
if (newItemInfo.MyParent != null)
|
||||
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
|
||||
}
|
||||
return newItemInfo;
|
||||
}
|
||||
|
@ -1844,8 +1844,8 @@ namespace Volian.Controls.Library
|
||||
bool gotoFirstTrans = false;
|
||||
try
|
||||
{
|
||||
TreeNode treeNodeReplace = null;
|
||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), treeNodeReplace, ref gotoFirstTrans);
|
||||
// B2024-045, 049 and 050: do not pass in a tree node to Item.PasteReplace
|
||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans);
|
||||
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
|
||||
{
|
||||
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
|
||||
|
@ -2408,7 +2408,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
VETreeNode tn = SelectedNode as VETreeNode;
|
||||
TreeNode treeNodeReplace = SelectedNode.Parent; //Get Tree Node of Parent we are proc we are placing into.
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
// Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section)
|
||||
if (dvi != null)
|
||||
@ -2445,11 +2444,27 @@ namespace Volian.Controls.Library
|
||||
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
|
||||
else if (p.IndexOf("Replace") > -1)
|
||||
{
|
||||
PasteReplace(tn, iiClipboard.ItemID, treeNodeReplace);
|
||||
bool OnlyProc = iiPaste.IsProcedure && iiPaste.MyPrevious == null && (iiPaste.NextItems == null || iiPaste.NextItems.Count == 0);
|
||||
VETreeNode tmp = null;
|
||||
if (OnlyProc)
|
||||
{
|
||||
VETreeNode tnp = SelectedNode as VETreeNode;
|
||||
tmp = tnp == null ? null : tnp.Parent as VETreeNode;
|
||||
}
|
||||
ItemInfo repitem = PasteReplace(tn, iiClipboard.ItemID);
|
||||
// B2024-045, 049 and 050: The treenode was passed into the business object's replace but sometimes it was null. And this
|
||||
// wasn't working if it was a single procedure in a working Draft. Adjust the tree here if single procedure in working draft.
|
||||
if (OnlyProc && repitem != null && tmp != null)
|
||||
{
|
||||
VETreeNode tn1 = new VETreeNode(repitem);
|
||||
tmp.Nodes.Add(tn1);
|
||||
SelectedNode = tn1;
|
||||
}
|
||||
}
|
||||
else // paste as child
|
||||
PasteAsChild(tn, iiClipboard.ItemID);
|
||||
|
||||
|
||||
//if (p.IndexOf("Replace") <= -1)
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
@ -2541,18 +2556,19 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
|
||||
}
|
||||
private void PasteReplace(VETreeNode tn, int copyStartID, TreeNode treeNodeReplace)
|
||||
private ItemInfo PasteReplace(VETreeNode tn, int copyStartID)
|
||||
{
|
||||
VETreeNode prevtn = (VETreeNode) tn.PrevNode;
|
||||
VETreeNode partn = (VETreeNode) tn.Parent;
|
||||
ItemInfo ii = tn.VEObject as ItemInfo;
|
||||
// F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format
|
||||
ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true);
|
||||
ItemInfo replItemInfo = null;
|
||||
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
|
||||
{
|
||||
// first, check if a changeid is required.
|
||||
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
|
||||
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId, treeNodeReplace);
|
||||
replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
|
||||
|
||||
StepConfig replItemConfig = ii.MyConfig as StepConfig;
|
||||
if (replItemInfo != null)
|
||||
@ -2562,8 +2578,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
// B2018-047: was crashing on the following line (before change it was casting the result to a VETreeNote when the partn.FirstNode was just a TreeNode)
|
||||
SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode;
|
||||
|
||||
|
||||
return replItemInfo;
|
||||
}
|
||||
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user