예제 #1
0
        public void populateDefaultVSComObjects()
        {
            VisualStudio_2010.Package           = this;
            VisualStudio_2010.ErrorListProvider = new ErrorListProvider(this);
            VisualStudio_2010.IVsUIShell        = this.getService <IVsUIShell>();
            VisualStudio_2010.DTE2 = this.getService <EnvDTE.DTE, EnvDTE80.DTE2>();
            VisualStudio_2010.OleMenuCommandService = this.getService <OleMenuCommandService>();

            Events = VisualStudio_2010.DTE2.Events;

            BuildEvents         = Events.BuildEvents;
            CommandEvents       = Events.CommandEvents;
            DebuggerEvents      = Events.DebuggerEvents;
            DocumentEvents      = Events.DocumentEvents;
            DTEEvents           = Events.DTEEvents;
            FindEvents          = Events.FindEvents;
            MiscFilesEvents     = Events.MiscFilesEvents;
            OutputWindowEvents  = Events.OutputWindowEvents;
            SelectionEvents     = Events.SelectionEvents;
            SolutionEvents      = Events.SolutionEvents;
            SolutionItemsEvents = Events.SolutionItemsEvents;
            TaskListEvents      = Events.TaskListEvents;
            TextEditorEvents    = Events.TextEditorEvents;
            WindowEvents        = Events.WindowEvents;



            BuildEvents.OnBuildBegin += (scope, action) => VisualStudio_2010.On_BuildBegin.invoke();
            BuildEvents.OnBuildDone  += (scope, action) => VisualStudio_2010.On_BuildDone.invoke();

            BuildEvents.OnBuildProjConfigDone +=
                (Project, ProjectConfig, Platform, SolutionConfig, Success) =>
            {
                //@"On OnBuildProjConfigDone: project: {0} , ProjectConfig: {1} , Platform: {2},  SolutionConfig: {3} , Success: {4}".debug(Project,ProjectConfig, Platform, SolutionConfig,Success);
                if (Success)
                {
                    VisualStudio_2010.On_ProjectBuild_OK.invoke(Project);
                }
                else
                {
                    VisualStudio_2010.On_ProjectBuild_Failed.invoke(Project);
                }
            };

            SolutionEvents.Opened += () => VisualStudio_2010.On_SolutionOpened.invoke();

            DocumentEvents.DocumentOpened  += (document) => VisualStudio_2010.on_DocumentOpened.invoke(document);
            DocumentEvents.DocumentClosing += (document) => VisualStudio_2010.on_DocumentClosing.invoke(document);
            DocumentEvents.DocumentSaved   += (document) => VisualStudio_2010.on_DocumentSaved.invoke(document);
            DocumentEvents.DocumentOpening += (documentPath, readOnly) => VisualStudio_2010.on_DocumentOpening.invoke(documentPath, readOnly);
            TextEditorEvents.LineChanged   += (startPoint, endPoint, hInt) => VisualStudio_2010.on_LineChanged.invoke(startPoint, endPoint);

            WindowEvents.WindowActivated += (windowGotFocus, windowLostFocus) => {
                if (windowGotFocus.Document.notNull())
                {
                    VisualStudio_2010.on_ActiveDocumentChange.invoke(windowGotFocus.Document);
                }
            };
        }
예제 #2
0
 public void attachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after)
 {
     cmdEvents = env.Events.CommandEvents;
     lock (_lock) {
         cmdEvents.BeforeExecute -= before;
         cmdEvents.BeforeExecute += before;
         cmdEvents.AfterExecute  -= after;
         cmdEvents.AfterExecute  += after;
     }
 }
예제 #3
0
 public void attachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after)
 {
     cmdEvents = env.Events.CommandEvents;
     lock(_lock) {
         cmdEvents.BeforeExecute -= before;
         cmdEvents.BeforeExecute += before;
         cmdEvents.AfterExecute  -= after;
         cmdEvents.AfterExecute  += after;
     }
 }
예제 #4
0
        public CommandTableExplorerControl(CommandTableExplorerDTO dto)
        {
            _dto        = dto;
            _cmdEvents  = dto.DTE.Events.CommandEvents;
            Commands    = _dto.DteCommands;
            DataContext = this;
            Loaded     += OnLoaded;

            InitializeComponent();
            CommandTreeItem.ItemSelected += CommandTreeItem_ItemSelected;
        }
예제 #5
0
        protected void attachCommandEvents()
        {
            if (Environment.Events == null)
            {
                Log.Info("Context of build action: uses a limited types.");
                return; //this can be for emulated DTE2 context
            }

            cmdEvents = Environment.Events.CommandEvents; // protection from garbage collector
            lock (_lock) {
                detachCommandEvents();
                cmdEvents.BeforeExecute += onCmdBeforeExecute;
                cmdEvents.AfterExecute  += onCmdAfterExecute;
            }
        }
        protected void attachCommandEvents()
        {
            if (!IsAvaialbleCommandEvent || env.Events.CommandEvents == null)
            {
                Log.Info("CommandEvents: aren't available for current context.");
                return; //this can be for emulated DTE2 context
            }

            cmdEvents = env.Events.CommandEvents;
            lock (_lock) {
                detachCommandEvents();
                cmdEvents.BeforeExecute += commandEventBefore;
                cmdEvents.AfterExecute  += commandEventAfter;
            }
        }
예제 #7
0
        public void attachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after)
        {
            cmdEvents = Env.Events?.CommandEvents;
            if (cmdEvents == null)
            {
                return;
            }

            lock (_lock) {
                cmdEvents.BeforeExecute -= before;
                cmdEvents.BeforeExecute += before;
                cmdEvents.AfterExecute  -= after;
                cmdEvents.AfterExecute  += after;
            }
        }
예제 #8
0
        private void AttachCommandEvents()
        {
            if (!IsAvaialbleDteCmd || env.Events.CommandEvents == null)
            {
                Log.Info("CommandEvents: aren't available for current context.");
                return; //this can be for emulated DTE2 context
            }

            cmdEvents = env.Events.CommandEvents;

            lock (sync)
            {
                DetachCommandEvents();
                cmdEvents.BeforeExecute += OnCommandEventBefore;
                cmdEvents.AfterExecute  += OnCommandEventAfter;
            }
        }
        public void TextViewCreated(IWpfTextView textView)
        {
            _view = textView;

            if (_dte == null)
            {
                _dte=ServiceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
                if (_dte != null)
                {
                    _commandEvents = _dte.Events.CommandEvents;
                    _commandEvents.AfterExecute += _commandEvents_AfterExecute;

                    EnvDTE.Command cmd = _dte.Commands.Item("Edit.Find");
                    guidFind = cmd.Guid;
                    idFind=cmd.ID;
                }
            }          
        }
예제 #10
0
        private void SubscripeToEvents()
        {
            var events = MasterObjekt.Events;

            buildEvents    = events.BuildEvents;
            commandEvents  = events.CommandEvents;
            documentEvents = events.DocumentEvents;
            solutionEvents = events.SolutionEvents;

            buildEvents.OnBuildBegin      += new EnvDTE._dispBuildEvents_OnBuildBeginEventHandler(BuildEvents_OnBuildBegin);
            buildEvents.OnBuildDone       += new EnvDTE._dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
            commandEvents.AfterExecute    += new EnvDTE._dispCommandEvents_AfterExecuteEventHandler(CommandEvents_AfterExecute);
            documentEvents.DocumentSaved  += new EnvDTE._dispDocumentEvents_DocumentSavedEventHandler(DocumentEvents_DocumentSaved);
            solutionEvents.Opened         += new EnvDTE._dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.ProjectAdded   += new EnvDTE._dispSolutionEvents_ProjectAddedEventHandler(SolutionEvents_ProjectAdded);
            solutionEvents.ProjectRemoved += new EnvDTE._dispSolutionEvents_ProjectRemovedEventHandler(SolutionEvents_ProjectRemoved);
            solutionEvents.ProjectRenamed += new EnvDTE._dispSolutionEvents_ProjectRenamedEventHandler(SolutionEvents_ProjectRenamed);
            solutionEvents.Renamed        += new EnvDTE._dispSolutionEvents_RenamedEventHandler(SolutionEvents_Renamed);
            solutionEvents.AfterClosing   += new EnvDTE._dispSolutionEvents_AfterClosingEventHandler(SolutionEvents_AfterClosing);
        }
예제 #11
0
파일: Binder.cs 프로젝트: 3F/vsCommandEvent
        protected void attachCommandEvents()
        {
            if(Environment.Events == null) {
                Log.Info("Context of build action: uses a limited types.");
                return; //this can be for emulated DTE2 context
            }

            cmdEvents = Environment.Events.CommandEvents; // protection from garbage collector
            lock(_lock) {
                detachCommandEvents();
                cmdEvents.BeforeExecute += onCmdBeforeExecute;
                cmdEvents.AfterExecute  += onCmdAfterExecute;
            }
        }
예제 #12
0
        protected void attachCommandEvents()
        {
            if(!IsAvaialbleCommandEvent) {
                Log.Info("CommandEvents: aren't available for current context.");
                return; //this can be for emulated DTE2 context
            }

            cmdEvents = env.Events.CommandEvents;
            lock(_lock) {
                cmdEvents.BeforeExecute -= commandEventBefore;
                cmdEvents.BeforeExecute += commandEventBefore;
                cmdEvents.AfterExecute  -= commandEventAfter;
                cmdEvents.AfterExecute  += commandEventAfter;
            }
        }
예제 #13
0
        private void SubscripeToEvents()
        {
            var events = GetDTE2().Events;
            buildEvents = events.BuildEvents;
            commandEvents = events.CommandEvents;
            documentEvents = events.DocumentEvents;
            solutionEvents = events.SolutionEvents;

            buildEvents.OnBuildDone += new EnvDTE._dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
            commandEvents.AfterExecute += new EnvDTE._dispCommandEvents_AfterExecuteEventHandler(CommandEvents_AfterExecute);
            documentEvents.DocumentSaved += new EnvDTE._dispDocumentEvents_DocumentSavedEventHandler(DocumentEvents_DocumentSaved);
            solutionEvents.Opened += new EnvDTE._dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.ProjectAdded += new EnvDTE._dispSolutionEvents_ProjectAddedEventHandler(SolutionEvents_ProjectAdded);
            solutionEvents.ProjectRemoved += new EnvDTE._dispSolutionEvents_ProjectRemovedEventHandler(SolutionEvents_ProjectRemoved);
            solutionEvents.ProjectRenamed += new EnvDTE._dispSolutionEvents_ProjectRenamedEventHandler(SolutionEvents_ProjectRenamed);
            solutionEvents.Renamed += new EnvDTE._dispSolutionEvents_RenamedEventHandler(SolutionEvents_Renamed);
            solutionEvents.AfterClosing += new EnvDTE._dispSolutionEvents_AfterClosingEventHandler(SolutionEvents_AfterClosing);
        }