示例#1
0
 public TriggerNode(DataViewHierarchyAccessor hierarchyAccessor, int id) :
   base(hierarchyAccessor, id)
 {
   NodeId = "Trigger";
   NameIndex = 2;
   editor = new VSCodeEditor((IOleServiceProvider)hierarchyAccessor.ServiceProvider);
 }
示例#2
0
        public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
        {
            services   = sb;
            coreEditor = new VSCodeEditor(parent.Handle, services);

            //Create window
            IVsCodeWindow win = coreEditor.CodeWindow;

            cmdTarget = win as IOleCommandTarget;

            IVsTextView textView;
            int         hr = win.GetPrimaryView(out textView);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            // assign the window handle
            IntPtr commandHwnd = textView.GetWindowHandle();

            AssignHandle(commandHwnd);

            //Register priority command target
            hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
                0, (IOleCommandTarget)this, out cmdTargetCookie);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            //Add message filter
            Application.AddMessageFilter((System.Windows.Forms.IMessageFilter) this);
        }
示例#3
0
        public void Dispose()
        {
            //Remove message filter
            Application.RemoveMessageFilter((System.Windows.Forms.IMessageFilter) this);

            if (services != null)
            {
                // Remove this object from the list of the priority command targets.
                if (cmdTargetCookie != 0)
                {
                    IVsRegisterPriorityCommandTarget register =
                        services.VsRegisterPriorityCommandTarget;
                    if (null != register)
                    {
                        int hr = register.UnregisterPriorityCommandTarget(cmdTargetCookie);
                        if (hr != VSConstants.S_OK)
                        {
                            Marshal.ThrowExceptionForHR(hr);
                        }
                    }
                    cmdTargetCookie = 0;
                }
                services = null;
            }
            if (coreEditor != null)
            {
                IVsCodeWindow win = coreEditor.CodeWindow;
                win.Close();
                coreEditor = null;
            }
        }
        public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
        {
            services = sb;
            coreEditor = new VSCodeEditor(parent.Handle, services);

            //Create window            
            IVsCodeWindow win = coreEditor.CodeWindow;
            cmdTarget = win as IOleCommandTarget;

            IVsTextView textView;
            int hr = win.GetPrimaryView(out textView);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            // assign the window handle
            IntPtr commandHwnd = textView.GetWindowHandle();
            AssignHandle(commandHwnd);

            //Register priority command target
            hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
                0, (IOleCommandTarget)this, out cmdTargetCookie);

            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            //Add message filter
            Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
        }
示例#5
0
 public StoredProcedureNode(DataViewHierarchyAccessor hierarchyAccessor, int id, bool isFunc) :
   base(hierarchyAccessor, id)
 {
   NodeId = isFunc ? "StoredFunction" : "StoredProcedure";
   isFunction = isFunc;
   NameIndex = 3;
   editor = new VSCodeEditor((IOleServiceProvider)hierarchyAccessor.ServiceProvider);
 }
 public StoredProcedureNode(DataViewHierarchyAccessor hierarchyAccessor, int id, bool isFunc) :
   base(hierarchyAccessor, id)
 {
   NodeId = isFunc ? "StoredFunction" : "StoredProcedure";
   isFunction = isFunc;
   NameIndex = 3;
   editor = new VSCodeEditor((IOleServiceProvider)hierarchyAccessor.ServiceProvider);
   Dte = (EnvDTE.DTE)hierarchyAccessor.ServiceProvider.GetService(typeof(EnvDTE.DTE));
   RegisterNode(this);
 }
示例#7
0
        public VSCodeEditorWindow(ServiceBroker sb, VSCodeEditorUserControl parent)
        {
            Parent     = parent;
            services   = sb;
            coreEditor = new VSCodeEditor(Parent, services);

            //Create window
            IVsCodeWindow win = coreEditor.CodeWindow;

            cmdTarget = win as IOleCommandTarget;

            IVsTextView textView;
            int         hr = win.GetPrimaryView(out textView);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            // assign the window handle
            IntPtr commandHwnd = textView.GetWindowHandle();

            AssignHandle(commandHwnd);

            //// Register priority command target, this dispatches mappable keys like Enter, Backspace, Arrows, etc.
            //hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
            //    0, (IOleCommandTarget)CommandBroker.Broker, out cmdTargetCookie);

            //if (hr != VSConstants.S_OK)
            //  Marshal.ThrowExceptionForHR(hr);

            lock (typeof(EditorBroker))
            {
                if (EditorBroker.Broker == null)
                {
                    EditorBroker.CreateSingleton(services);
                }
                EditorBroker.RegisterEditor(this);
            }
            //Add message filter
            //Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
        }
 public ViewNode(DataViewHierarchyAccessor hierarchyAccessor, int id) :
   base(hierarchyAccessor, id)
 {
   NodeId = "View";
   editor = new VSCodeEditor((IOleServiceProvider)hierarchyAccessor.ServiceProvider);
 }
 public void Dispose()
 {
   //Remove message filter
   //Application.RemoveMessageFilter((System.Windows.Forms.IMessageFilter)this);
   EditorBroker.UnregisterEditor(this);
   if (services != null)
   {
     // Remove this object from the list of the priority command targets.
     if (cmdTargetCookie != 0)
     {
       IVsRegisterPriorityCommandTarget register =
           services.VsRegisterPriorityCommandTarget;
       if (null != register)
       {
         int hr = register.UnregisterPriorityCommandTarget(cmdTargetCookie);
         if (hr != VSConstants.S_OK)
           Marshal.ThrowExceptionForHR(hr);
       }
       cmdTargetCookie = 0;
     }
     services = null;
   }
   if (coreEditor != null)
   {
     IVsCodeWindow win = coreEditor.CodeWindow;
     win.Close();
     coreEditor = null;
   }
 }
    public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
    {
      Parent = (VSCodeEditorUserControl)parent;
      services = sb;
      coreEditor = new VSCodeEditor(parent.Handle, services);

      //Create window            
      IVsCodeWindow win = coreEditor.CodeWindow;
      cmdTarget = win as IOleCommandTarget;

      IVsTextView textView;
      int hr = win.GetPrimaryView(out textView);
      if (hr != VSConstants.S_OK)
        Marshal.ThrowExceptionForHR(hr);

      // assign the window handle
      IntPtr commandHwnd = textView.GetWindowHandle();
      AssignHandle(commandHwnd);

      //// Register priority command target, this dispatches mappable keys like Enter, Backspace, Arrows, etc.
      //hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
      //    0, (IOleCommandTarget)CommandBroker.Broker, out cmdTargetCookie);

      //if (hr != VSConstants.S_OK)
      //  Marshal.ThrowExceptionForHR(hr);

      lock (typeof(EditorBroker))
      {
        if (EditorBroker.Broker == null) 
        {
          EditorBroker.CreateSingleton(services);
        }
        EditorBroker.RegisterEditor(this);
      }
      //Add message filter
      //Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
    }