Browse Source

Select related property in propertyPad when error selected from activity context menu.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2372 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Russell Wilkins 19 years ago
parent
commit
cc4cebd3bb
  1. 14
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/EventPropertyDescriptor.cs
  2. 56
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs

14
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/EventPropertyDescriptor.cs

@ -181,21 +181,15 @@ namespace WorkflowDesigner @@ -181,21 +181,15 @@ namespace WorkflowDesigner
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
string[] methodNames = null;
ICollection compatibleMethods = null;;
if (context != null) {
IEventBindingService eventBindingService = context.GetService(typeof(IEventBindingService)) as IEventBindingService;
ICollection compatibleMethods = eventBindingService.GetCompatibleMethods(eventPropertyDescriptor.eventDescriptor);
methodNames = new string[compatibleMethods.Count];
int i =0;
foreach (string methodName in compatibleMethods) {
methodNames[i++] = methodName;
}
if (eventBindingService != null)
compatibleMethods = eventBindingService.GetCompatibleMethods(eventPropertyDescriptor.eventDescriptor);
}
return new StandardValuesCollection(methodNames);
return new StandardValuesCollection(compatibleMethods);
}

56
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs

@ -34,18 +34,22 @@ namespace WorkflowDesigner @@ -34,18 +34,22 @@ namespace WorkflowDesigner
LoggingService.Debug("ShowContextMenu");
if (menuID == WorkflowMenuCommands.DesignerActionsMenu)
{
if (menuID == WorkflowMenuCommands.DesignerActionsMenu) {
ContextMenuStrip contextMenu = new ContextMenuStrip();
Guid DesignerActionGuid = new Guid("3bd4a275-fccd-49f0-b617-765ce63b4340");
ICollection collection = this.GetCommandList(menuID.Guid);
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection)
{
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) {
// Only interested in the errors.
if (menuCommand.CommandID.ID == 8342)
{
if (menuCommand.CommandID.ID == 8342) {
foreach (object o in menuCommand.Properties.Keys)
LoggingService.DebugFormatted("{0} {1}", o.GetType(), o.ToString());
foreach (object o in menuCommand.Properties.Values)
LoggingService.DebugFormatted("{0} {1}", o.GetType(), o.ToString());
ToolStripMenuItem menuItem = new ToolStripMenuItem(menuCommand.Properties["Text"].ToString());
menuItem.Click += ClickHandler;
menuItem.Click += new EventHandler(ClickHandler);
menuItem.Tag = menuCommand.Properties[DesignerActionGuid];
contextMenu.Items.Add(menuItem);
}
}
@ -58,8 +62,42 @@ namespace WorkflowDesigner @@ -58,8 +62,42 @@ namespace WorkflowDesigner
void ClickHandler(object sender, EventArgs e)
{
// TODO: Move focus to the property in the property pad.
throw new NotImplementedException();
DesignerAction designerAction = ((ToolStripMenuItem)sender).Tag as DesignerAction;
if (designerAction == null)
return;
designerAction.Invoke(); // Will change the selectedObject in the designer
if (!string.IsNullOrEmpty( designerAction.PropertyName))
{
// No easy way to search for a grid item so
// find the root item in the grid, and search for items for the property.
GridItem item = PropertyPad.Grid.SelectedGridItem;
while (item.Parent != null) {
item = item.Parent;
}
GridItem item2 = FindGridItem(item, designerAction.PropertyName);
if (item2 != null) {
PropertyPad.Grid.SelectedGridItem = item2;
PropertyPad.Grid.Focus();
}
}
}
static GridItem FindGridItem(GridItem gridItem, string name)
{
foreach (GridItem item in gridItem.GridItems){
if (item.Label == name)
return item;
GridItem item2 = FindGridItem(item, name);
if (item2 != null)
return item2;
}
return null;
}
}

Loading…
Cancel
Save