Hello, I have recently started with SharpDevelop. I am very impressed with the extensibility of the IDE..
I have created an AddIn using the F# example. I found that I was not able to drap & drop the projects to different folders in the Project Browser.
I found that SolutionFolderNode.DragDropEffects & DoDragDrop test for ProjectNode, but cannot test for a Node derived from ProjectNode as in the F# example. I used a bit of reflection to check for a derived type.
I changed the source as follows and it works. Not sure if it could be an idea for something you might consider including, or I am overlooking a simpler solution!
private Type GetType(IDataObject dataObject)
{
string[ formats = dataObject.GetFormats();
string typeName = formats[0];
if (typeName == "WindowsForms10PersistentObject")
typeName = formats[1];
var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => a.FullName.Split('.')[0] == typeName.Split('.')[0]);
Type t = null;
foreach (Assembly currentassembly in assemblies)
{
t = currentassembly.GetType(typeName, false, true);
if (t != null)
break;
}
return t;
}
public override DragDropEffects GetDragDropEffect(IDataObject dataObject, DragDropEffects proposedEffect)
{
Type t = GetType(dataObject);
if (t == typeof(SolutionFolderNode)) {
SolutionFolderNode folderNode = (SolutionFolderNode)dataObject.GetData(t);
if (!folderNode.Folder.IsAncestorOf(this.folder)) {
return DragDropEffects.Move;
}
}
if (t == typeof(SolutionItemNode) || t.BaseType == typeof(SolutionItemNode)) {
SolutionItemNode solutionItemNode = (SolutionItemNode)dataObject.GetData(t);
if (solutionItemNode.Parent != this) {
return DragDropEffects.Move;
}
}
if (t == typeof(ProjectNode) || t.BaseType == typeof(ProjectNode)) {
ProjectNode projectNode = (ProjectNode)dataObject.GetData(t);
if (projectNode.Parent != this) {
return DragDropEffects.Move;
}
}
return DragDropEffects.None;
}