Clones the specified item. The item.
(ContentItem item)
| 872 | /// </summary> |
| 873 | /// <param name="item">The item.</param> |
| 874 | public void Duplicate(ContentItem item) |
| 875 | { |
| 876 | // Skip null |
| 877 | if (item == null) |
| 878 | return; |
| 879 | |
| 880 | // TODO: don't allow to duplicate items without ParentFolder - like root items (Content, Source, Engine and Editor dirs) |
| 881 | |
| 882 | // Clone item |
| 883 | var targetPath = GetClonedAssetPath(item); |
| 884 | Editor.ContentDatabase.Copy(item, targetPath); |
| 885 | |
| 886 | // Refresh this folder now and try to find duplicated item |
| 887 | Editor.ContentDatabase.RefreshFolder(item.ParentFolder, true); |
| 888 | RefreshView(); |
| 889 | RefreshTreeItems(); |
| 890 | var targetItem = item.ParentFolder.FindChild(targetPath); |
| 891 | |
| 892 | // Start renaming it |
| 893 | if (targetItem != null) |
| 894 | { |
| 895 | Select(targetItem); |
| 896 | Rename(targetItem); |
| 897 | } |
| 898 | } |
| 899 | |
| 900 | /// <summary> |
| 901 | /// Duplicates the specified items. |
no test coverage detected