Updated to include passing teh selected tree node parent for cases where the only procedure in a folder is being replaced. otherwise i pass null for that as its not really used.
This commit is contained in:
parent
c92b888ec2
commit
629fe1b615
@ -1309,7 +1309,8 @@ 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);
|
||||||
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
|
TreeNode trn = null;
|
||||||
|
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
|
||||||
@ -2497,13 +2498,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region PasteReplace
|
#region PasteReplace
|
||||||
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, ref tmp);
|
return PasteReplace(itemInfo, copyStartID, chgid, treeNodeReplace, 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, ref bool firstTrans)
|
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace, ref bool firstTrans)
|
||||||
{
|
{
|
||||||
firstTrans = false;
|
firstTrans = false;
|
||||||
if (!CanDeleteObject())
|
if (!CanDeleteObject())
|
||||||
@ -2560,7 +2564,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
|
//Create tree node for copied procedure when no other procedures exist in the folder
|
||||||
|
VETreeNode vtn = treeNodeReplace as VETreeNode;
|
||||||
|
DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
|
||||||
|
|
||||||
|
ItemInfo newProc = dvi.PasteChild(copyStartID);
|
||||||
|
VETreeNode tn1 = new VETreeNode(newProc);
|
||||||
|
treeNodeReplace.Nodes.Add(tn1); // add tree node to end of list.
|
||||||
|
treeNodeReplace = tn1;
|
||||||
}
|
}
|
||||||
return newItemInfo;
|
return newItemInfo;
|
||||||
}
|
}
|
||||||
|
@ -1836,7 +1836,8 @@ namespace Volian.Controls.Library
|
|||||||
bool gotoFirstTrans = false;
|
bool gotoFirstTrans = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans);
|
TreeNode treeNodeReplace = null;
|
||||||
|
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), treeNodeReplace, 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);
|
||||||
|
@ -2035,7 +2035,8 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
if (ovewriteEx == DialogResult.Cancel) break;
|
if (ovewriteEx == DialogResult.Cancel) break;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
TreeNode treenodeDirectory = SelectedNode.Parent;
|
||||||
tv_NodePaste(mi.Text);
|
tv_NodePaste(mi.Text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2407,6 +2408,7 @@ 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)
|
||||||
@ -2442,8 +2444,8 @@ namespace Volian.Controls.Library
|
|||||||
else if (p.IndexOf("After") > -1)
|
else if (p.IndexOf("After") > -1)
|
||||||
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);
|
PasteReplace(tn, iiClipboard.ItemID, treeNodeReplace);
|
||||||
}
|
}
|
||||||
else // paste as child
|
else // paste as child
|
||||||
PasteAsChild(tn, iiClipboard.ItemID);
|
PasteAsChild(tn, iiClipboard.ItemID);
|
||||||
@ -2452,7 +2454,7 @@ namespace Volian.Controls.Library
|
|||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PasteAsDocVersionChild(VETreeNode tn, int copyStartID)
|
public void PasteAsDocVersionChild(VETreeNode tn, int copyStartID)
|
||||||
{
|
{
|
||||||
// Only need to handle paste in tree since this will create a new procedure.
|
// Only need to handle paste in tree since this will create a new procedure.
|
||||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||||
@ -2539,7 +2541,7 @@ 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)
|
private void PasteReplace(VETreeNode tn, int copyStartID, TreeNode treeNodeReplace)
|
||||||
{
|
{
|
||||||
VETreeNode prevtn = (VETreeNode) tn.PrevNode;
|
VETreeNode prevtn = (VETreeNode) tn.PrevNode;
|
||||||
VETreeNode partn = (VETreeNode) tn.Parent;
|
VETreeNode partn = (VETreeNode) tn.Parent;
|
||||||
@ -2550,7 +2552,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
// 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);
|
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId, treeNodeReplace);
|
||||||
|
|
||||||
StepConfig replItemConfig = ii.MyConfig as StepConfig;
|
StepConfig replItemConfig = ii.MyConfig as StepConfig;
|
||||||
if (replItemInfo != null)
|
if (replItemInfo != null)
|
||||||
@ -2563,12 +2565,30 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void tv_NodeCopy()
|
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
|
||||||
{
|
{
|
||||||
if (SelectedNode==null)return;
|
// Only need to handle paste in tree since this will create a new procedure.
|
||||||
VETreeNode tn = SelectedNode as VETreeNode;
|
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||||
OnNodeCopy(this, new vlnTreeEventArgs(tn));
|
if (dvi.DocVersionAssociationCount == 0)
|
||||||
|
{
|
||||||
|
// Set docversionassociation to the copied docversion association
|
||||||
|
// so that the rofst for ro's can be found. (if there is no association set)
|
||||||
|
ROFstInfo rfi = GetAssociationRofstId(copyStartID);
|
||||||
|
Association myAs = Association.MakeAssociation(dvi.Get(), rfi.GetJustROFst(), "");
|
||||||
|
dvi.RefreshDocVersionAssociations();
|
||||||
|
}
|
||||||
|
ItemInfo newProc = dvi.PasteChild(copyStartID);
|
||||||
|
VETreeNode tn1 = new VETreeNode(newProc);
|
||||||
|
SelectedNode.Nodes.Add(tn1); // add tree node to end of list.
|
||||||
|
SelectedNode = tn1;
|
||||||
}
|
}
|
||||||
|
private void tv_NodeCopy()
|
||||||
|
{
|
||||||
|
if (SelectedNode == null) return;
|
||||||
|
VETreeNode tn = SelectedNode as VETreeNode;
|
||||||
|
OnNodeCopy(this, new vlnTreeEventArgs(tn));
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region PropertyPagesInterface
|
#region PropertyPagesInterface
|
||||||
private void SetupNodeProperties()
|
private void SetupNodeProperties()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user