Inheritance: DocumentNode, IVsTextBufferProvider
        /// <summary>
        /// Handle any of the static commands
        /// </summary>
        /// <param name="commandId"></param>
        /// <returns></returns>
        private bool HandleStaticCommand(int commandId)
        {
            switch ((uint)commandId)
            {
            case PkgCmdIDList.cmdCreateTable:
            case PkgCmdIDList.cmdidGlobalCreateTable:
                TableNode.CreateNew(DataViewHierarchyAccessor);
                return(true);

            case PkgCmdIDList.cmdCreateProcedure:
            case PkgCmdIDList.cmdidGlobalCreateProcedure:
                StoredProcedureNode.CreateNew(DataViewHierarchyAccessor, false);
                return(true);

            case PkgCmdIDList.cmdCreateFunction:
            case PkgCmdIDList.cmdidGlobalCreateFunction:
                StoredProcedureNode.CreateNew(DataViewHierarchyAccessor, true);
                return(true);

            case PkgCmdIDList.cmdCreateView:
            case PkgCmdIDList.cmdidGlobalCreateView:
                ViewNode.CreateNew(DataViewHierarchyAccessor);
                return(true);

            case PkgCmdIDList.cmdCreateUDF:
            case PkgCmdIDList.cmdidGlobalCreateUDF:
                UDFNode.CreateNew(DataViewHierarchyAccessor);
                return(true);
            }
            return(false);
        }
        private BaseNode MakeNewNode(int id)
        {
            string nodeId = DataViewHierarchyAccessor.GetNodeId(id);

            nodeId = nodeId.ToLowerInvariant();

            BaseNode newNode = null;

            switch (nodeId)
            {
            case "table":
                newNode = new TableNode(DataViewHierarchyAccessor, id);
                break;

            case "storedprocedure":
                newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, false);
                break;

            case "storedfunction":
                newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, true);
                break;

            case "view":
                newNode = new ViewNode(DataViewHierarchyAccessor, id);
                break;

            case "udf":
                newNode = new UDFNode(DataViewHierarchyAccessor, id);
                break;

            case "trigger":
                newNode = new TriggerNode(DataViewHierarchyAccessor, id);
                break;

            default:
                throw new NotSupportedException("Node type not supported");
            }
            Debug.Assert(newNode != null);
            return(newNode);
        }
示例#3
0
 public static void CreateNew(DataViewHierarchyAccessor HierarchyAccessor, bool isFunc)
 {
   StoredProcedureNode node = new StoredProcedureNode(HierarchyAccessor, 0, isFunc);
   RegisterNode( node );
   node.Edit();
 }
    private BaseNode MakeNewNode(int id)
    {
      string nodeId = DataViewHierarchyAccessor.GetNodeId(id);
      nodeId = nodeId.ToLowerInvariant();

      BaseNode newNode = null;
      switch (nodeId)
      {
        case "table":
          newNode = new TableNode(DataViewHierarchyAccessor, id);
          break;
        case "storedprocedure":
          newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, false);
          break;
        case "storedfunction":
          newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, true);
          break;
        case "view":
          newNode = new ViewNode(DataViewHierarchyAccessor, id);
          break;
        case "udf":
          newNode = new UDFNode(DataViewHierarchyAccessor, id);
          break;
        case "trigger":
          newNode = new TriggerNode(DataViewHierarchyAccessor, id);
          break;
        default:
          throw new NotSupportedException("Node type not supported");
      }
      Debug.Assert(newNode != null);
      return newNode;
    }
示例#5
0
        public static void CreateNew(DataViewHierarchyAccessor HierarchyAccessor, bool isFunc)
        {
            StoredProcedureNode node = new StoredProcedureNode(HierarchyAccessor, 0, isFunc);

            node.Edit();
        }