[MonoDevelop] Changing project item position

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Apr 2 03:42:59 UTC 2013


This will be a fair bit of work in MonoDevelop.Core and
MonoDevelop.Ide, unfortunately.

The first part is infrastructural - you would need to make it so that
changes to the order of the items in the project.Items collection is
reflected when serializing the project file. It currently tries to
find existing items and update them, then add any new items into
existing groups
(https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs#L1265).

- CAVEAT - you could probably work around this by removing the items,
saving the project, then re-adding them in the desired order. But this
may have undesired side effects.

The second part is displaying it in the UI. The tree node builders
currently sort all the nodes by name though this is overridable
(https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs#L134).
So I'd suggest adding some kind of project.HasSignificantFileOrder
property, then if this were set, the ProjectFolderNodeBuilder could
sort the items appropriately.

The third part is drag-n-drop. The ProjectFileCommandHandler would
have to override the overload of OnMultipleNodeDrop that takes a
DropPosition to it can accept drops before/after it
(https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeCommandHandler.cs#L250)
- it currently only allows dropping files *onto* it for grouping
(https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs#L258)
and then it would have to alter the order of the files in the project
correspondingly and trigger a save.

On 1 April 2013 17:18, Dave Thomas <kukulcanenator at gmail.com> wrote:
> Hi, I wonder if anyone had and quick pointers on how to manipulate items within the project structure from within the IDE.  Specifically I want to move items up and down within the project pane.
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list



-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list