B2024-045, B2024-049, B2024-050 crash on paste/replace
This commit is contained in:
parent
35c7b2b0cf
commit
870bba0aa6
@ -1309,8 +1309,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
|
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
|
||||||
{
|
{
|
||||||
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
|
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
|
||||||
TreeNode trn = null;
|
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
|
||||||
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid, trn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the config data for the new enhanced item (procedure, section or step) to point back to the correct source
|
// 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
|
#endregion
|
||||||
#region PasteReplace
|
#region PasteReplace
|
||||||
|
// 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)
|
||||||
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace)
|
|
||||||
{
|
{
|
||||||
bool tmp = false;
|
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
|
// 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;
|
firstTrans = false;
|
||||||
if (!CanDeleteObject())
|
if (!CanDeleteObject())
|
||||||
@ -2565,10 +2563,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Create tree node for copied procedure when no other procedures exist in the working draft (treeNodeReplace)
|
// B2024-045, 049 and 050: if not a single procedure replace, update user interface by using the 'OnNewChild'. Single
|
||||||
VETreeNode tn = null;
|
// procedure's MyParent is null because its parent is a working draft (docversion) since MyParent's type is iteminfo.
|
||||||
tn = new VETreeNode(newItemInfo);
|
// For the single procedure case, the user interface code in vlntreeview will update the tree.
|
||||||
treeNodeReplace.Nodes.Add(tn);
|
if (newItemInfo.MyParent != null)
|
||||||
|
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
|
||||||
}
|
}
|
||||||
return newItemInfo;
|
return newItemInfo;
|
||||||
}
|
}
|
||||||
|
@ -1844,8 +1844,8 @@ namespace Volian.Controls.Library
|
|||||||
bool gotoFirstTrans = false;
|
bool gotoFirstTrans = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TreeNode treeNodeReplace = null;
|
// B2024-045, 049 and 050: do not pass in a tree node to Item.PasteReplace
|
||||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), treeNodeReplace, ref gotoFirstTrans);
|
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
|
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
|
||||||
{
|
{
|
||||||
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
|
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
|
||||||
|
@ -2408,7 +2408,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
VETreeNode tn = SelectedNode as VETreeNode;
|
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;
|
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)
|
// Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section)
|
||||||
if (dvi != null)
|
if (dvi != null)
|
||||||
@ -2445,11 +2444,27 @@ namespace Volian.Controls.Library
|
|||||||
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
|
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
|
||||||
else if (p.IndexOf("Replace") > -1)
|
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
|
else // paste as child
|
||||||
PasteAsChild(tn, iiClipboard.ItemID);
|
PasteAsChild(tn, iiClipboard.ItemID);
|
||||||
|
|
||||||
|
|
||||||
//if (p.IndexOf("Replace") <= -1)
|
//if (p.IndexOf("Replace") <= -1)
|
||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
@ -2541,18 +2556,19 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
|
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 prevtn = (VETreeNode) tn.PrevNode;
|
||||||
VETreeNode partn = (VETreeNode) tn.Parent;
|
VETreeNode partn = (VETreeNode) tn.Parent;
|
||||||
ItemInfo ii = tn.VEObject as ItemInfo;
|
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
|
// 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.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true);
|
||||||
|
ItemInfo replItemInfo = null;
|
||||||
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
|
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
|
||||||
{
|
{
|
||||||
// first, check if a changeid is required.
|
// first, check if a changeid is required.
|
||||||
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
|
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;
|
StepConfig replItemConfig = ii.MyConfig as StepConfig;
|
||||||
if (replItemInfo != null)
|
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)
|
// 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;
|
SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode;
|
||||||
|
return replItemInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
|
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user