Index: /CKEditor/trunk/_source/core/command.js
===================================================================
--- /CKEditor/trunk/_source/core/command.js	(revision 3056)
+++ /CKEditor/trunk/_source/core/command.js	(revision 3057)
@@ -6,5 +6,5 @@
 CKEDITOR.command = function( editor, commandDefinition )
 {
-	this.state = CKEDITOR.TRISTATE_OFF;
+	this.state = ( 'state' in commandDefinition ) ? commandDefinition.state : CKEDITOR.TRISTATE_OFF;
 
 	this.exec = function()
@@ -19,3 +19,22 @@
 };
 
+CKEDITOR.command.prototype =
+{
+	setState : function( newState )
+	{
+		// Do nothing if there is no state change.
+		if ( this.state == newState )
+			return false;
+
+		// Set the new state.
+		this.state = newState;
+
+		// Fire the "state" event, so other parts of the code can react to the
+		// change.
+		this.fire( 'state' );
+
+		return true;
+	}
+}
+
 CKEDITOR.event.implementOn( CKEDITOR.command.prototype );
Index: /CKEditor/trunk/_source/plugins/basicstyles/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/basicstyles/plugin.js	(revision 3056)
+++ /CKEditor/trunk/_source/plugins/basicstyles/plugin.js	(revision 3057)
@@ -18,7 +18,5 @@
 			editor.attachStyleStateChange( style, function( state )
 				{
-					var command = editor.getCommand( commandName );
-					command.state = state;
-					command.fire( 'state' );
+					editor.getCommand( commandName ).setState( state );
 				});
 
Index: /CKEditor/trunk/_source/plugins/indent/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/indent/plugin.js	(revision 3056)
+++ /CKEditor/trunk/_source/plugins/indent/plugin.js	(revision 3057)
@@ -14,7 +14,5 @@
 	function setState( editor, state )
 	{
-		var command = editor.getCommand( this.name );
-		command.state = state;
-		command.fire( 'state' );
+		editor.getCommand( this.name ).setState( state );
 	}
 
Index: /CKEditor/trunk/_source/plugins/link/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/plugin.js	(revision 3056)
+++ /CKEditor/trunk/_source/plugins/link/plugin.js	(revision 3057)
@@ -61,8 +61,7 @@
 					element = evt.data.path.lastElement.getAscendant( 'a', true );
 				if ( element && element.getName() == 'a' && element.getAttribute( 'href' ) )
-					command.state = CKEDITOR.TRISTATE_OFF;
+					command.setState( CKEDITOR.TRISTATE_OFF );
 				else
-					command.state = CKEDITOR.TRISTATE_DISABLED;
-				command.fire( 'state' );
+					command.setState( CKEDITOR.TRISTATE_DISABLED );
 			} );
 
Index: /CKEditor/trunk/_source/plugins/list/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/list/plugin.js	(revision 3056)
+++ /CKEditor/trunk/_source/plugins/list/plugin.js	(revision 3057)
@@ -169,7 +169,5 @@
 	function setState( editor, state )
 	{
-		var command = editor.getCommand( this.name );
-		command.state = state;
-		command.fire( 'state' );
+		editor.getCommand( this.name ).setState( state );
 	}
 
Index: /CKEditor/trunk/_source/plugins/sourcearea/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/sourcearea/plugin.js	(revision 3056)
+++ /CKEditor/trunk/_source/plugins/sourcearea/plugin.js	(revision 3057)
@@ -114,7 +114,8 @@
 		editor.on( 'mode', function()
 			{
-				var command = editor.getCommand( 'source' );
-				command.state = ( editor.mode == 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
-				command.fire( 'state' );
+				editor.getCommand( 'source' ).setState( 
+					editor.mode == 'source' ? 
+						CKEDITOR.TRISTATE_ON : 
+						CKEDITOR.TRISTATE_OFF );
 			});
 	}
