[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r7459 - trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Sat, 31 Oct 2009 00:44:58 +0100

> -----Original Message-----
> From: Sander Rijken [mailto:sr_at_d-90.nl]
> Sent: donderdag 29 oktober 2009 11:13
> To: commits_at_ankhsvn.open.collab.net
> Subject: svn commit: r7459 -
> trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs
>
> Author: sander
> Date: 2009-10-29 15:12:55-0700
> New Revision: 7459
>
> Modified:
> trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs
>
> Log:
> Simplify OnUpdate code slightly, clean up usings
>
>
> Modified: trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs
> Url:
> http://ankhsvn.open.collab.net/source/browse/ankhsvn/trunk/src/Ankh.UI/
> MergeWizard/Commands/Merge.cs?view=diff&pathrev=7459&r1=7458&r2=7459
> =======================================================================
> =======
> --- trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs (original)
> +++ trunk/src/Ankh.UI/MergeWizard/Commands/Merge.cs 2009-10-29
> 15:12:55-0700
> @@ -16,14 +16,10 @@
>
> using System;
> using System.Collections.Generic;
> -using System.Text;
>
> using Ankh.Commands;
>
> -using WizardFramework;
> using System.Windows.Forms;
> -using System.Windows.Forms.Design;
> -using System.ComponentModel;
> using Ankh.Scc;
> using Ankh.VS;
> using Ankh.Selection;
> @@ -40,7 +36,6 @@
> {
> IFileStatusCache statusCache;
> int n = 0;
> - bool ok = true;
> switch (e.Command)
> {
> case AnkhCommand.ItemMerge:
> @@ -98,10 +93,7 @@
> throw new InvalidOperationException();
> }
>
> - if (!ok || n == 0 || n > 1)
> - e.Enabled = false;
> - else
> - e.Enabled = true;
> + e.Enabled = n == 1;
> }

Not really part of this change and probably not really important in this
specific case, but normally you should only change .Enabled to false and
never to true.

When there are multiple handlers of the OnUpdate event everybody must be
able to disable the event from reaching the .OnExecute().

The right fix would be to remove the 'else e.Enabled = true;' and fix the if
block.. not switch to a one line if.

(The same rule of never enabling applies for the TCG signal framework).

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2413154
Received on 2009-10-31 00:45:19 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.