Beispiel #1
0
 AnkhAction CreateHandler(AnkhCommand command)
 {
     return(delegate
     {
         Commands.PostExecCommand(command);
     });
 }
Beispiel #2
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context, object argument, bool promptUser, bool dontPromptUser)
     : this(command, context)
 {
     _argument       = argument;
     _promptUser     = promptUser;
     _dontPromptUser = dontPromptUser;
 }
Beispiel #3
0
        /// <summary>
        /// Posts the tick command.
        /// </summary>
        /// <param name="tick">if set to <c>true</c> [tick].</param>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        public bool PostTickCommand(ref bool tick, AnkhCommand command)
        {
            if (IsTickCommand(command))
            {
                _ticks[command - AnkhCommand.TickFirst] = 1;
            }

            if (tick)
            {
                return(false);
            }

            tick = true;
            bool ok = false;

            try
            {
                return(ok = PostExecCommand(command));
            }
            finally
            {
                if (!ok)
                {
                    tick = false;
                }
            }
        }
Beispiel #4
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context, object argument, bool promptUser, bool dontPromptUser)
     : this(command, context)
 {
     _argument = argument;
     _promptUser = promptUser;
     _dontPromptUser = dontPromptUser;
 }
Beispiel #5
0
 public void TockCommand(AnkhCommand ankhCommand)
 {
     if (IsTickCommand(ankhCommand))
     {
         _ticks[ankhCommand - AnkhCommand.TickFirst] = 0;
     }
 }
Beispiel #6
0
 public void PostIdleCommand(AnkhCommand command, object args)
 {
     PostIdleAction(
         delegate()
     {
         DirectlyExecCommand(command, args);
     });
 }
            public static bool TestExecution(AnkhCommand commandEnum, object argument)
            {
                AnkhRuntime runtime = new AnkhRuntime(ServiceProviderHelper.serviceProvider);

                runtime.AddModule(new AnkhModule(runtime));
                runtime.Start();

                return(runtime.CommandMapper.Execute(commandEnum, new CommandEventArgs(commandEnum, runtime.Context, argument, false, false)));
            }
Beispiel #8
0
 public static void ExecuteCommand(IVsPackage package, AnkhCommand command)
 {
     Guid cmdId = AnkhId.CommandSetGuid;
     int hr = ((IOleCommandTarget)package).Exec(ref cmdId, (uint)command, (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, IntPtr.Zero, IntPtr.Zero);
     if (hr == (int)OLEConstants.OLECMDERR_E_DISABLED)
         Assert.Inconclusive("Command is disabled");
     else
         Assert.IsTrue(hr == VSConstants.S_OK);
 }
Beispiel #9
0
        bool IsTickCommand(AnkhCommand c)
        {
            if (c < AnkhCommand.TickFirst || c >= AnkhCommand.TickLast)
            {
                return(false);
            }

            return(true);
        }
Beispiel #10
0
 /// <summary>
 /// Installs a visual studio command handler for the specified control
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="control">The control.</param>
 /// <param name="command">The command.</param>
 /// <param name="handler">The handler.</param>
 public static void Install(IAnkhServiceProvider context, Control control, AnkhCommand command, ICommandHandler handler)
 {
     Install(context, control, command,
             delegate(object sender, CommandEventArgs e)
     {
         handler.OnExecute(e);
     },
             delegate(object sender, CommandUpdateEventArgs e)
     {
         handler.OnUpdate(e);
     });
 }
        static bool IsFolderCommand(AnkhCommand command)
        {
            switch (command)
            {
            case AnkhCommand.FolderUpdateLatest:
            case AnkhCommand.FolderUpdateSpecific:
                return(true);

            default:
                return(false);
            }
        }
        static bool IsSolutionCommand(AnkhCommand command)
        {
            switch (command)
            {
            case AnkhCommand.SolutionUpdateLatest:
            case AnkhCommand.SolutionUpdateSpecific:
            case AnkhCommand.PendingChangesUpdateLatest:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #13
0
        public void SafePostTickCommand(ref bool tick, AnkhCommand command)
        {
            if (tick)
            {
                return;
            }

            tick = true;
            lock (_delayTasks)
            {
                _delayedCommands.Add((int)command);
            }
        }
        static bool IsHeadCommand(AnkhCommand command)
        {
            switch (command)
            {
            case AnkhCommand.SolutionUpdateLatest:
            case AnkhCommand.ProjectUpdateLatest:
            case AnkhCommand.PendingChangesUpdateLatest:
            case AnkhCommand.FolderUpdateLatest:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #15
0
        public static void ExecuteCommand(IVsPackage package, AnkhCommand command)
        {
            Guid cmdId = AnkhId.CommandSetGuid;
            int  hr    = ((IOleCommandTarget)package).Exec(ref cmdId, (uint)command, (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, IntPtr.Zero, IntPtr.Zero);

            if (hr == VSErr.OLECMDERR_E_DISABLED)
            {
                Assert.Inconclusive("Command is disabled");
            }
            else
            {
                Assert.IsTrue(hr == VSErr.S_OK);
            }
        }
Beispiel #16
0
        public CommandResult DirectlyExecCommand(AnkhCommand command, object args, CommandPrompt prompt)
        {
            // TODO: Assert that we are in the UI thread

            CommandMapper mapper = GetService <CommandMapper>();

            if (mapper == null)
            {
                return(new CommandResult(false, null));
            }

            CommandEventArgs e  = new CommandEventArgs(command, AnkhContext, args, prompt == CommandPrompt.Always, prompt == CommandPrompt.Never);
            bool             ok = mapper.Execute(command, e);

            return(new CommandResult(ok, e.Result));
        }
Beispiel #17
0
 internal IEnumerable <AnkhCommand> GetAllCommands()
 {
     if (LastCommand == AnkhCommand.None)
     {
         yield return(Command);
     }
     else if (LastCommand < Command || ((int)LastCommand - (int)Command) > 256)
     {
         throw new InvalidOperationException("Command range larger then 256 on range starting with" + Command.ToString());
     }
     else
     {
         for (AnkhCommand c = Command; c <= LastCommand; c++)
         {
             yield return(c);
         }
     }
 }
Beispiel #18
0
        public bool TryGetParameterList(AnkhCommand command, out string definition)
        {
            EnsureLoaded();

            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                definition = item.ArgumentDefinition;

                return(!string.IsNullOrEmpty(definition));
            }
            else
            {
                definition = null;
            }

            return(false);
        }
Beispiel #19
0
        /// <summary>
        /// Gets the <see cref="CommandMapItem"/> for the specified command
        /// </summary>
        /// <param name="command"></param>
        /// <returns>The <see cref="CommandMapItem"/> or null if the command is not valid</returns>
        public CommandMapItem this[AnkhCommand command]
        {
            get
            {
                CommandMapItem item;

                if (_map.TryGetValue(command, out item))
                {
                    return(item);
                }
                else
                {
                    item = new CommandMapItem(command);

                    _map.Add(command, item);

                    return(item);
                }
            }
        }
Beispiel #20
0
        public bool Execute(AnkhCommand command, CommandEventArgs e)
        {
            EnsureLoaded();
            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                try
                {
                    e.Prepare(item);

                    CommandUpdateEventArgs u = new CommandUpdateEventArgs(command, e.Context);
                    item.OnUpdate(u);
                    if (u.Enabled)
                    {
                        item.OnExecute(e);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    IAnkhErrorHandler eh = GetService <IAnkhErrorHandler>();

                    if (eh != null && eh.IsEnabled(ex))
                    {
                        eh.OnError(ex, e);
                        return(true); // If we return false VS shows another error box!
                    }

                    throw;
                }

                return(item.IsHandled);
            }

            return(false);
        }
Beispiel #21
0
 AnkhAction CreateHandler(AnkhCommand command)
 {
     return delegate
     {
         Commands.PostExecCommand(command);
     };
 }
Beispiel #22
0
 public CommandResult ExecCommand(AnkhCommand command, bool verifyEnabled)
 {
     // The commandhandler in the package always checks enabled; no need to do it here
     return ExecCommand(new CommandID(AnkhId.CommandSetGuid, (int)command), verifyEnabled);
 }
Beispiel #23
0
 public CommandResult ExecCommand(AnkhCommand command, bool verifyEnabled, object argument)
 {
     return(ExecCommand(new CommandID(AnkhId.CommandSetGuid, (int)command), verifyEnabled, argument));
 }
Beispiel #24
0
 public CommandResult ExecCommand(AnkhCommand command)
 {
     // The commandhandler in the package always checks enabled; no need to do it here
     return(ExecCommand(command, false));
 }
Beispiel #25
0
 public void PostIdleCommand(AnkhCommand command)
 {
     PostIdleCommand(command, null);
 }
Beispiel #26
0
 public CommandResult DirectlyExecCommand(AnkhCommand command, object args)
 {
     return DirectlyExecCommand(command, args, CommandPrompt.DoDefault);
 }
Beispiel #27
0
        public bool TryGetParameterList(AnkhCommand command, out string definition)
        {
            EnsureLoaded();

            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                definition = item.ArgumentDefinition;

                return !string.IsNullOrEmpty(definition);
            }
            else
                definition = null;

            return false;
        }
Beispiel #28
0
        /// <summary>
        /// Posts the tick command.
        /// </summary>
        /// <param name="tick">if set to <c>true</c> [tick].</param>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        public bool PostTickCommand(ref bool tick, AnkhCommand command)
        {
            if (IsTickCommand(command))
                _ticks[command - AnkhCommand.TickFirst] = 1;

            if (tick)
                return false;

            tick = true;
            bool ok = false;
            try
            {
                return ok = PostExecCommand(command);
            }
            finally
            {
                if (!ok)
                    tick = false;
            }
        }
Beispiel #29
0
 public void PostIdleCommand(AnkhCommand command, object args)
 {
     PostIdleAction(
         delegate()
         {
             DirectlyExecCommand(command, args);
         });
 }
Beispiel #30
0
 public void PostIdleCommand(AnkhCommand command)
 {
     PostIdleCommand(command, null);
 }
Beispiel #31
0
 public bool PostExecCommand(AnkhCommand command, object args, CommandPrompt prompt)
 {
     return PostExecCommand(new CommandID(AnkhId.CommandSetGuid, (int)command), args, prompt);
 }
Beispiel #32
0
 public bool PostExecCommand(AnkhCommand command, object args)
 {
     return PostExecCommand(command, args, CommandPrompt.DoDefault);
 }
Beispiel #33
0
 public bool PostExecCommand(AnkhCommand command)
 {
     return PostExecCommand(command, null, CommandPrompt.DoDefault);
 }
Beispiel #34
0
 public int ScheduleAt(DateTime time, AnkhCommand command)
 {
     return ScheduleAt(time, CreateHandler(command));
 }
Beispiel #35
0
        public bool Execute(AnkhCommand command, CommandEventArgs e)
        {
            EnsureLoaded();
            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                try
                {
                    e.Prepare(item);

                    CommandUpdateEventArgs u = new CommandUpdateEventArgs(command, e.Context);
                    item.OnUpdate(u);
                    if (u.Enabled)
                    {
                        item.OnExecute(e);
                    }
                    else
                        return false;
                }
                catch (Exception ex)
                {
                    IAnkhErrorHandler eh = GetService<IAnkhErrorHandler>();

                    if (eh != null && eh.IsEnabled(ex))
                    {
                        eh.OnError(ex, e);
                        return true; // If we return false VS shows another error box!
                    }

                    throw;

                }

                return item.IsHandled;
            }

            return false;
        }
Beispiel #36
0
        public void SafePostTickCommand(ref bool tick, AnkhCommand command)
        {
            if (tick)
                return;

            tick = true;
            lock (_delayTasks)
            {
                _delayedCommands.Add((int)command);
            }
        }
Beispiel #37
0
 public CommandResult DirectlyExecCommand(AnkhCommand command)
 {
     return DirectlyExecCommand(command, null, CommandPrompt.DoDefault);
 }
Beispiel #38
0
 public void TockCommand(AnkhCommand ankhCommand)
 {
     if (IsTickCommand(ankhCommand))
         _ticks[ankhCommand - AnkhCommand.TickFirst] = 0;
 }
Beispiel #39
0
 static bool IsHeadCommand(AnkhCommand command)
 {
     switch (command)
     {
         case AnkhCommand.SolutionUpdateLatest:
         case AnkhCommand.ProjectUpdateLatest:
         case AnkhCommand.PendingChangesUpdateLatest:
         case AnkhCommand.FolderUpdateLatest:
             return true;
         default:
             return false;
     }
 }
Beispiel #40
0
        bool IsTickCommand(AnkhCommand c)
        {
            if (c < AnkhCommand.TickFirst || c >= AnkhCommand.TickLast)
                return false;

            return true;
        }
Beispiel #41
0
 static bool IsFolderCommand(AnkhCommand command)
 {
     switch (command)
     {
         case AnkhCommand.FolderUpdateLatest:
         case AnkhCommand.FolderUpdateSpecific:
             return true;
         default:
             return false;
     }
 }
Beispiel #42
0
        public CommandResult DirectlyExecCommand(AnkhCommand command, object args, CommandPrompt prompt)
        {
            // TODO: Assert that we are in the UI thread

            CommandMapper mapper = GetService<CommandMapper>();

            if (mapper == null)
                return new CommandResult(false, null);

            CommandEventArgs e = new CommandEventArgs(command, AnkhContext, args, prompt == CommandPrompt.Always, prompt == CommandPrompt.Never);
            bool ok = mapper.Execute(command, e);

            return new CommandResult(ok, e.Result);
        }
Beispiel #43
0
 public CommandResult ExecCommand(AnkhCommand command, bool verifyEnabled)
 {
     // The commandhandler in the package always checks enabled; no need to do it here
     return(ExecCommand(new CommandID(AnkhId.CommandSetGuid, (int)command), verifyEnabled));
 }
Beispiel #44
0
        public bool PerformUpdate(AnkhCommand command, CommandUpdateEventArgs e)
        {
            EnsureLoaded();
            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                bool skip;
                if ((item.Availability & CommandAvailability.AlwaysFlag) != 0)
                {
                    skip = false;
                }
                else if (((item.Availability & CommandAvailability.SvnActive) != 0) && States.SccProviderActive)
                {
                    skip = false;
                }
                else if (((item.Availability & CommandAvailability.GitActive) != 0) && States.GitSccProviderActive)
                {
                    skip = false;
                }
                else
                {
                    skip = true;
                }

                if (skip)
                {
                    e.Enabled = false;
                }
                else
                {
                    try
                    {
                        e.Prepare(item);

                        item.OnUpdate(e);
                    }
                    catch (Exception ex)
                    {
                        IAnkhErrorHandler eh = GetService <IAnkhErrorHandler>();

                        if (eh != null && eh.IsEnabled(ex))
                        {
                            eh.OnError(ex, e);
                            return(false);
                        }

                        throw;
                    }
                }

                if (item.HiddenWhenDisabled && !e.Enabled)
                {
                    e.Visible = false;
                }

                if (item.DynamicMenuEnd)
                {
                    e.DynamicMenuEnd = true;
                }

                return(item.IsHandled);
            }
            else if (_defined.Contains(command))
            {
                e.Enabled = e.Visible = false;
                return(true);
            }

            return(false);
        }
Beispiel #45
0
        internal void HandleEvent(AnkhCommand command)
        {
            List <SccProject>         dirtyProjects;
            HybridCollection <string> dirtyCheck;
            HybridCollection <string> maybeAdd;

            SvnSccProvider provider = GetService <SvnSccProvider>();

            lock (_lock)
            {
                _posted = false;
                _onIdle = false;

                if (provider == null)
                {
                    return;
                }

                dirtyProjects  = _dirtyProjects;
                dirtyCheck     = _dirtyCheck;
                maybeAdd       = _maybeAdd;
                _dirtyProjects = null;
                _dirtyCheck    = null;
                _maybeAdd      = null;
            }

            if (dirtyCheck != null)
            {
                foreach (string file in dirtyCheck)
                {
                    DocumentTracker.CheckDirty(file);
                }
            }

            if (dirtyProjects != null)
            {
                foreach (SccProject project in dirtyProjects)
                {
                    if (project.IsSolution)
                    {
                        provider.UpdateSolutionGlyph();
                    }
                    else
                    {
                        project.NotifyGlyphChanged();
                    }
                }
            }

            if (maybeAdd != null)
            {
                using (SvnClient cl = GetService <ISvnClientPool>().GetNoUIClient())
                {
                    foreach (string file in maybeAdd)
                    {
                        SvnItem item = SvnCache[file];
                        // Only add
                        // * files
                        // * that are unversioned
                        // * that are addable
                        // * that are not ignored
                        // * and just to be sure: that are still part of the solution
                        if (item.IsFile && !item.IsVersioned &&
                            item.IsVersionable && !item.IsIgnored &&
                            item.InSolution && !item.IsSccExcluded)
                        {
                            SvnAddArgs aa = new SvnAddArgs();
                            aa.ThrowOnError = false; // Just ignore errors here; make the user add them themselves
                            aa.AddParents   = true;

                            if (cl.Add(item.FullPath, aa))
                            {
                                item.MarkDirty();

                                // Detect if we have a file that Subversion might detect as binary
                                if (item.IsVersioned && !item.IsTextFile)
                                {
                                    // Only check small files, avoid checking big binary files
                                    FileInfo fi = new FileInfo(item.FullPath);
                                    if (fi.Length < 10)
                                    {
                                        // We're sure it's at most 10 bytes here, so just read all
                                        byte[] fileBytes = File.ReadAllBytes(item.FullPath);

                                        // If the file starts with a UTF8 BOM, we're sure enough it's a text file, keep UTF16 & 32 binary
                                        if (StartsWith(fileBytes, new byte[] { 0xEF, 0xBB, 0xBF }))
                                        {
                                            // Delete the mime type property, so it's detected as a text file again
                                            SvnSetPropertyArgs pa = new SvnSetPropertyArgs();
                                            pa.ThrowOnError = false;
                                            cl.DeleteProperty(item.FullPath, SvnPropertyNames.SvnMimeType, pa);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #46
0
 public CommandResult ExecCommand(AnkhCommand command)
 {
     // The commandhandler in the package always checks enabled; no need to do it here
     return ExecCommand(command, false);
 }
Beispiel #47
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context)
     : base(command, context)
 {
 }
Beispiel #48
0
 static bool IsSolutionCommand(AnkhCommand command)
 {
     switch (command)
     {
         case AnkhCommand.SolutionUpdateLatest:
         case AnkhCommand.SolutionUpdateSpecific:
         case AnkhCommand.PendingChangesUpdateLatest:
             return true;
         default:
             return false;
     }
 }
Beispiel #49
0
            public static bool TestExecution(AnkhCommand commandEnum, object argument)
            {
                AnkhRuntime runtime = new AnkhRuntime(ServiceProviderHelper.serviceProvider);
                runtime.AddModule(new AnkhModule(runtime));
                runtime.Start();

                return runtime.CommandMapper.Execute(commandEnum, new CommandEventArgs(commandEnum, runtime.Context, argument, false, false));
            }
Beispiel #50
0
 public bool PostExecCommand(AnkhCommand command)
 {
     return(PostExecCommand(command, null, CommandPrompt.DoDefault));
 }
Beispiel #51
0
        internal void HandleEvent(AnkhCommand command)
        {
            List<SvnProject> dirtyProjects;
            HybridCollection<string> dirtyCheck;
            HybridCollection<string> maybeAdd;

            AnkhSccProvider provider = Context.GetService<AnkhSccProvider>();

            lock (_lock)
            {
                _posted = false;
                _onIdle = false;

                if (provider == null)
                    return;

                dirtyProjects = _dirtyProjects;
                dirtyCheck = _dirtyCheck;
                maybeAdd = _maybeAdd;
                _dirtyProjects = null;
                _dirtyCheck = null;
                _maybeAdd = null;
            }

            if (dirtyCheck != null)
                foreach (string file in dirtyCheck)
                {
                    DocumentTracker.CheckDirty(file);
                }

            if (dirtyProjects != null)
            {
                foreach (SvnProject project in dirtyProjects)
                {
                    if (project.RawHandle == null)
                    {
                        if (project.IsSolution)
                            provider.UpdateSolutionGlyph();

                        continue; // All IVsSccProjects have a RawHandle
                    }

                    try
                    {
                        project.RawHandle.SccGlyphChanged(0, null, null, null);
                    }
                    catch { }
                }
            }

            if (maybeAdd != null)
                using (SvnClient cl = GetService<ISvnClientPool>().GetNoUIClient())
                {
                    foreach (string file in maybeAdd)
                    {
                        SvnItem item = Cache[file];
                        // Only add
                        // * files
                        // * that are unversioned
                        // * that are addable
                        // * that are not ignored
                        // * and just to be sure: that are still part of the solution
                        if (item.IsFile && !item.IsVersioned &&
                            item.IsVersionable && !item.IsIgnored &&
                            item.InSolution)
                        {
                            SvnAddArgs aa = new SvnAddArgs();
                            aa.ThrowOnError = false; // Just ignore errors here; make the user add them themselves
                            aa.AddParents = true;

                            cl.Add(item.FullPath, aa);
                        }
                    }
                }
        }
Beispiel #52
0
 public bool PostExecCommand(AnkhCommand command, object args)
 {
     return(PostExecCommand(command, args, CommandPrompt.DoDefault));
 }
Beispiel #53
0
 public int Schedule(TimeSpan timeSpan, AnkhCommand command)
 {
     return ScheduleAt(DateTime.Now + timeSpan, CreateHandler(command));
 }
Beispiel #54
0
 public bool PostExecCommand(AnkhCommand command, object args, CommandPrompt prompt)
 {
     return(PostExecCommand(new CommandID(AnkhId.CommandSetGuid, (int)command), args, prompt));
 }
Beispiel #55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandMapItem"/> class.
 /// </summary>
 /// <param name="command">The command.</param>
 public CommandMapItem(AnkhCommand command)
 {
     _command = command;
 }
Beispiel #56
0
 public CommandResult DirectlyExecCommand(AnkhCommand command)
 {
     return(DirectlyExecCommand(command, null, CommandPrompt.DoDefault));
 }
Beispiel #57
0
        public bool PerformUpdate(AnkhCommand command, CommandUpdateEventArgs e)
        {
            EnsureLoaded();
            CommandMapItem item;

            if (_map.TryGetValue(command, out item))
            {
                if (!item.AlwaysAvailable && !e.State.SccProviderActive)
                    e.Enabled = false;
                else
                    try
                    {
                        e.Prepare(item);

                        item.OnUpdate(e);
                    }
                    catch (Exception ex)
                    {
                        IAnkhErrorHandler eh = GetService<IAnkhErrorHandler>();

                        if (eh != null && eh.IsEnabled(ex))
                        {
                            eh.OnError(ex, e);
                            return false;
                        }

                        throw;
                    }

                if (item.HiddenWhenDisabled && !e.Enabled)
                    e.Visible = false;

                if (item.DynamicMenuEnd)
                    e.DynamicMenuEnd = true;

                return item.IsHandled;
            }
            else if (_defined.Contains(command))
            {
                e.Enabled = e.Visible = false;
                return true;
            }

            return false;
        }
Beispiel #58
0
 public CommandResult DirectlyExecCommand(AnkhCommand command, object args)
 {
     return(DirectlyExecCommand(command, args, CommandPrompt.DoDefault));
 }
Beispiel #59
0
        /// <summary>
        /// Gets the <see cref="CommandMapItem"/> for the specified command
        /// </summary>
        /// <param name="command"></param>
        /// <returns>The <see cref="CommandMapItem"/> or null if the command is not valid</returns>
        public CommandMapItem this[AnkhCommand command]
        {
            get
            {
                CommandMapItem item;

                if (_map.TryGetValue(command, out item))
                    return item;
                else
                {
                    item = new CommandMapItem(command);

                    _map.Add(command, item);

                    return item;
                }
            }
        }
Beispiel #60
0
 /// <summary>
 /// Installs a visual studio command handler for the specified control
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="control">The control.</param>
 /// <param name="command">The command.</param>
 /// <param name="handler">The handler.</param>
 public static void Install(IAnkhServiceProvider context, Control control, AnkhCommand command, EventHandler <CommandEventArgs> handler)
 {
     Install(context, control, command, handler, null);
 }