// private NodeIdMapper nodeMapper; /* private NodeIdMapper NodeMapper * { * get * { * if (nodeMapper == null) * nodeMapper = new NodeIdMapper(DataViewHierarchyAccessor); * return nodeMapper; * } * }*/ /// <summary> /// This method supplies information about a command's status. At this point all /// commands are supported and visible. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="textType"> /// The OleCommandTextType object instance for the specified command. /// </param> /// <param name="status"> /// The OleCommandStatus object instance for the specified command. /// </param> /// <returns> /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// /// </returns> public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command == null) { throw new ArgumentNullException("command"); } if (status == null) { throw new ArgumentNullException("status"); } OleCommandStatus result = new OleCommandStatus(); /* string[] selTypes = DataViewHierarchyAccessor.GetChildSelectionTypes(itemIds[0]); * string type = DataViewHierarchyAccessor.GetObjectType(itemIds[0]); * string[] staticNodes = DataViewHierarchyAccessor.GetChildStaticNodeIds(itemIds[0]); * string path = DataViewHierarchyAccessor.GetNodePath(itemIds[0]); * object[] identifier = DataViewHierarchyAccessor.GetObjectIdentifier(itemIds[0]); * * object v1 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_IsHiddenItem); * object v2 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_Parent); */ //BaseNode node = NodeMapper[itemIds[0]]; result.Enabled = true; result.Visible = true; result.Supported = true; return(result); /* // Get command handler instance * ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); * if (commandHandler == null) * return base.GetCommandStatus(itemIds, command, textType, status); * result.Supported = true; * * // Determine visibility * if (!commandHandler.GetIsVisible(Hierarchy, itemIds)) * { * result.Visible = false; * return result; * } * result.Visible = true; * result.Enabled = true; * * // TODO: Find out why this doesn't work at all! * // Localize text if possible * string localizedText = commandHandler.GetText(Hierarchy, itemIds); * if (!String.IsNullOrEmpty(localizedText)) * result.Text = localizedText; * * return result;*/ }
// private NodeIdMapper nodeMapper; /* private NodeIdMapper NodeMapper { get { if (nodeMapper == null) nodeMapper = new NodeIdMapper(DataViewHierarchyAccessor); return nodeMapper; } }*/ /// <summary> /// This method supplies information about a command's status. At this point all /// commands are supported and visible. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="textType"> /// The OleCommandTextType object instance for the specified command. /// </param> /// <param name="status"> /// The OleCommandStatus object instance for the specified command. /// </param> /// <returns> /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// /// </returns> public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command == null) throw new ArgumentNullException("command"); if (status == null) throw new ArgumentNullException("status"); OleCommandStatus result = new OleCommandStatus(); /* string[] selTypes = DataViewHierarchyAccessor.GetChildSelectionTypes(itemIds[0]); string type = DataViewHierarchyAccessor.GetObjectType(itemIds[0]); string[] staticNodes = DataViewHierarchyAccessor.GetChildStaticNodeIds(itemIds[0]); string path = DataViewHierarchyAccessor.GetNodePath(itemIds[0]); object[] identifier = DataViewHierarchyAccessor.GetObjectIdentifier(itemIds[0]); object v1 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_IsHiddenItem); object v2 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_Parent); */ //BaseNode node = NodeMapper[itemIds[0]]; result.Enabled = true; result.Visible = true; result.Supported = true; if (command.CommandId == PkgCmdIDList.cmdDebugProcedure) result.Visible = DataViewHierarchyAccessor.GetNodeId(itemIds[0]).Equals("StoredProcedure", StringComparison.OrdinalIgnoreCase); return result; /* // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) return base.GetCommandStatus(itemIds, command, textType, status); result.Supported = true; // Determine visibility if (!commandHandler.GetIsVisible(Hierarchy, itemIds)) { result.Visible = false; return result; } result.Visible = true; result.Enabled = true; // TODO: Find out why this doesn't work at all! // Localize text if possible string localizedText = commandHandler.GetText(Hierarchy, itemIds); if (!String.IsNullOrEmpty(localizedText)) result.Text = localizedText; return result;*/ }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object[] ExecuteCommand(int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { if (command == null) { throw new ArgumentNullException("command"); } if (!HandleStaticCommand(command.CommandId)) { BaseNode node = MakeNewNode(itemIds[0]); node.ExecuteCommand(command.CommandId); } return(null); }
public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command.GroupGuid == guidSQLiteCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.CreateTable: case cmdid.Vacuum: case cmdid.Rekey: status.Supported = true; status.Visible = true; status.Enabled = true; return(status); } } else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97) { switch ((VSConstants.VSStd97CmdID)command.CommandId) { case VSConstants.VSStd97CmdID.Delete: status.Supported = true; status.Visible = true; status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false); return(status); } } else if (command.GroupGuid == guidDataCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.Alter: status.Supported = true; status.Visible = true; status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false); return(status); case cmdid.CreateTable: case cmdid.CreateView: status.Supported = true; status.Visible = true; status.Enabled = true; return(status); } } base.GetCommandStatus(itemIds, command, textType, status); return(status); }
public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command.GroupGuid == guidSQLiteCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.CreateTable: case cmdid.Vacuum: case cmdid.Rekey: status.Supported = true; status.Visible = true; status.Enabled = true; return status; } } else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97) { switch ((VSConstants.VSStd97CmdID)command.CommandId) { case VSConstants.VSStd97CmdID.Delete: status.Supported = true; status.Visible = true; status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false); return status; } } else if (command.GroupGuid == guidDataCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.Alter: status.Supported = true; status.Visible = true; status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false); return status; case cmdid.CreateTable: case cmdid.CreateView: status.Supported = true; status.Visible = true; status.Enabled = true; return status; } } base.GetCommandStatus(itemIds, command, textType, status); return status; }
/// <summary> /// This method supplies information about a command's status. At this point all /// commands are supported and visible. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="textType"> /// The OleCommandTextType object instance for the specified command. /// </param> /// <param name="status"> /// The OleCommandStatus object instance for the specified command. /// </param> /// <returns> /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// /// </returns> public override OleCommandStatus GetCommandStatus( int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command == null) { throw new ArgumentNullException("command"); } if (status == null) { throw new ArgumentNullException("status"); } OleCommandStatus result = new OleCommandStatus(); // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) { return(base.GetCommandStatus(itemIds, command, textType, status)); } result.Supported = true; // Determine visibility if (!commandHandler.GetIsVisible(Hierarchy, itemIds)) { result.Visible = false; return(result); } result.Visible = true; result.Enabled = true; // TODO: Find out why this doesn't work at all! // Localize text if possible string localizedText = commandHandler.GetText(Hierarchy, itemIds); if (!String.IsNullOrEmpty(localizedText)) { result.Text = localizedText; } return(result); }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object[] ExecuteCommand( int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { if (command == null) { throw new ArgumentNullException("command"); } // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) { return(base.ExecuteCommand(itemIds, command, executionOption, arguments)); } // Executes command return(commandHandler.Execute(Hierarchy, itemIds)); }
/// <summary> /// This method supplies information about a command's status. At this point all /// commands are supported and visible. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="textType"> /// The OleCommandTextType object instance for the specified command. /// </param> /// <param name="status"> /// The OleCommandStatus object instance for the specified command. /// </param> /// <returns> /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// /// </returns> public override OleCommandStatus GetCommandStatus( int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command == null) throw new ArgumentNullException("command"); if (status == null) throw new ArgumentNullException("status"); OleCommandStatus result = new OleCommandStatus(); // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) return base.GetCommandStatus(itemIds, command, textType, status); result.Supported = true; // Determine visibility if (!commandHandler.GetIsVisible(Hierarchy, itemIds)) { result.Visible = false; return result; } result.Visible = true; result.Enabled = true; // TODO: Find out why this doesn't work at all! // Localize text if possible string localizedText = commandHandler.GetText(Hierarchy, itemIds); if (!String.IsNullOrEmpty(localizedText)) result.Text = localizedText; return result; }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemId"> /// Identifier of hierarchy item for which command should be executed. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { return ExecuteCommand(new int[] { itemId }, command, executionOption, arguments); }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object[] ExecuteCommand( int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { if (command == null) throw new ArgumentNullException("command"); // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) return base.ExecuteCommand(itemIds, command, executionOption, arguments); // Executes command return commandHandler.Execute(Hierarchy, itemIds); }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object[] ExecuteCommand(int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { if (command == null) throw new ArgumentNullException("command"); if (!HandleStaticCommand(command.CommandId)) { BaseNode node = MakeNewNode(itemIds[0]); node.ExecuteCommand(command.CommandId); } return null; }
/// <summary> /// This method executes a specified command, potentially based /// on parameters passed in from the data view support XML. /// </summary> public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { object returnValue = null; object[] args = arguments as object[]; if (command.GroupGuid == guidSQLiteCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.Vacuum: Vacuum(); break; case cmdid.Rekey: ChangePassword(itemId); break; default: returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments); break; } } else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97) { switch ((VSConstants.VSStd97CmdID)command.CommandId) { case VSConstants.VSStd97CmdID.Delete: switch ((string)args[0]) { case "Table": DropSelectedTables(); break; case "Index": DropSelectedIndexes(); break; case "View": DropSelectedViews(); break; } break; } } else if (command.GroupGuid == guidDataCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.CreateTable: DesignTable(itemId, null); break; case cmdid.CreateView: DesignView(itemId, null); break; case cmdid.Alter: switch ((string)args[0]) { case "Table": { object[] parts; int[] items = DataViewHierarchyAccessor.GetSelectedItems(); parts = DataViewHierarchyAccessor.GetObjectIdentifier(items[0]); DesignTable(itemId, parts[2].ToString()); } break; case "Index": break; case "View": { object[] parts; int[] items = DataViewHierarchyAccessor.GetSelectedItems(); parts = DataViewHierarchyAccessor.GetObjectIdentifier(items[0]); DesignView(itemId, parts[2].ToString()); } break; } break; } } else { returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments); } return returnValue; }
public override object[] ExecuteCommand(int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { return base.ExecuteCommand(itemIds, command, executionOption, arguments); }
/// <summary> /// This method executes a specified command, potentially based /// on parameters passed in from the data view support XML. /// </summary> public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { object returnValue = null; object[] args = arguments as object[]; if (command.GroupGuid == guidSQLiteCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.Vacuum: Vacuum(); break; case cmdid.Rekey: ChangePassword(itemId); break; default: returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments); break; } } else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97) { switch ((VSConstants.VSStd97CmdID)command.CommandId) { case VSConstants.VSStd97CmdID.Delete: switch ((string)args[0]) { case "Table": DropSelectedTables(); break; case "Index": DropSelectedIndexes(); break; case "View": DropSelectedViews(); break; } break; } } else if (command.GroupGuid == guidDataCmdSet) { switch ((cmdid)command.CommandId) { case cmdid.CreateTable: DesignTable(itemId, null); break; case cmdid.CreateView: DesignView(itemId, null); break; case cmdid.Alter: switch ((string)args[0]) { case "Table": { object[] parts; int[] items = DataViewHierarchyAccessor.GetSelectedItems(); parts = DataViewHierarchyAccessor.GetObjectIdentifier(items[0]); DesignTable(itemId, parts[2].ToString()); } break; case "Index": break; case "View": { object[] parts; int[] items = DataViewHierarchyAccessor.GetSelectedItems(); parts = DataViewHierarchyAccessor.GetObjectIdentifier(items[0]); DesignView(itemId, parts[2].ToString()); } break; } break; } } else { returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments); } return(returnValue); }
public override object[] ExecuteCommand(int[] itemIds, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { return(base.ExecuteCommand(itemIds, command, executionOption, arguments)); }
/// <summary> /// Executes a specified command, potentially based on parameters passed in /// from the data view support XML. /// </summary> /// <param name="itemId"> /// Identifier of hierarchy item for which command should be executed. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="executionOption"> /// Any OleCommandExecutionOption object instance representing options on the /// invoked command. /// NOT USED. /// </param> /// <param name="arguments"> /// An object representing arguments to the command. /// NOT USED. /// </param> /// <returns> /// Returns an object instance representing the value returned by the specified /// command, which is typically nothing. /// </returns> public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments) { return(ExecuteCommand(new int[] { itemId }, command, executionOption, arguments)); }