Deselect component when removed from DesignContainer

svn path=/trunk/aspeditor/; revision=49338
This commit is contained in:
Michael Hutchinson 2005-09-02 11:20:33 +00:00
Родитель 6665bea629
Коммит 389553f1b2
2 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -179,7 +179,12 @@ namespace AspNetEdit.Editor.ComponentModel
}
//TODO: remove references from referenceManager
//clean up selection service
ISelectionService sel = (ISelectionService) this.GetService (typeof (ISelectionService));
if (sel != null && sel.GetComponentSelected (component))
sel.SetSelectedComponents (new IComponent[] {});
//broadcast completion of removal process
OnComponentRemoved (component);
}

Просмотреть файл

@ -166,7 +166,7 @@ namespace AspNetEdit.Editor.UI
comm.JSCall (GeckoFunctions.InsertFragment, null, host.RootDocument.Serialize (fragment));
}
internal void AddControl(Control control)
internal void AddControl (Control control)
{
if (!active) return;
@ -174,14 +174,14 @@ namespace AspNetEdit.Editor.UI
comm.JSCall (GeckoFunctions.AddControl, null, control.UniqueID, ctext);
}
internal void RemoveControl(Control control)
internal void RemoveControl (Control control)
{
if (!active) return;
comm.JSCall (GeckoFunctions.RemoveControl, null, control.UniqueID);
}
internal void RenameControl(string oldName, string newName)
internal void RenameControl (string oldName, string newName)
{
throw new NotImplementedException ();
}
@ -370,16 +370,18 @@ namespace AspNetEdit.Editor.UI
private string JSRemoveControl (string[] args)
{
if (args.Length != 1)
throw new InvalidJSArgumentException ("ResizeControl", -1);
throw new InvalidJSArgumentException ("RemoveControl", -1);
//look up our component
DesignContainer container = (DesignContainer) host.Container;
IComponent component = container.GetComponent (args[0]);
if (component == null)
throw new InvalidJSArgumentException ("ResizeControl", 0);
throw new InvalidJSArgumentException ("RemoveControl", 0);
//and remove it
System.Diagnostics.Trace.WriteLine ("Removing control: " + args[0]);
container.Remove (component);
component.Dispose ();
return string.Empty;
}