Index: CKEditor/trunk/CHANGES.html
===================================================================
--- CKEditor/trunk/CHANGES.html	(revision 6793)
+++ CKEditor/trunk/CHANGES.html	(revision 6799)
@@ -52,4 +52,5 @@
 		<li><a href="http://dev.ckeditor.com/ticket/5788">#5788</a> : Html parser trims empty spaces following &lt;br&gt; elements.</li>
 		<li><a href="http://dev.ckeditor.com/ticket/7513">#7513</a> : Invalid markup could lead the editor to hang.</li>
+		<li><a href="http://dev.ckeditor.com/ticket/6109">#6109</a> : Paste and Paste as Plain Text dialog windows now use the standart <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#commitContent">commitContent</a> and <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#setupContent">setupContent</a> methods.</li>
 	</ul>
 	<h3>
Index: CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js
===================================================================
--- CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js	(revision 6793)
+++ CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js	(revision 6799)
@@ -67,83 +67,5 @@
 			this.parts.dialog.$.offsetHeight;
 
-			var htmlToLoad =
-				'<html dir="' + editor.config.contentsLangDirection + '"' +
-				' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' +
-					'<head><style>body { margin: 3px; height: 95%; } </style></head><body>' +
-					'<script id="cke_actscrpt" type="text/javascript">' +
-					'window.parent.CKEDITOR.tools.callFunction( ' + CKEDITOR.tools.addFunction( onPasteFrameLoad, this ) + ', this );' +
-					'</script></body>' +
-				'</html>';
-
-			var src =
-				CKEDITOR.env.air ?
-					'javascript:void(0)' :
-				isCustomDomain ?
-					'javascript:void((function(){' +
-						'document.open();' +
-						'document.domain=\'' + document.domain + '\';' +
-						'document.close();' +
-						'})())"'
-				:
-					'';
-
-			var iframe = CKEDITOR.dom.element.createFromHtml(
-						'<iframe' +
-						' class="cke_pasteframe"' +
-						' frameborder="0" ' +
-						' allowTransparency="true"' +
-						' src="' + src + '"' +
-						' role="region"' +
-						' aria-label="' + lang.pasteArea + '"' +
-						' aria-describedby="' + this.getContentElement( 'general', 'pasteMsg' ).domId + '"' +
-						' aria-multiple="true"' +
-						'></iframe>' );
-
-			iframe.on( 'load', function( e )
-				{
-					e.removeListener();
-
-					var doc = iframe.getFrameDocument();
-					doc.write( htmlToLoad );
-
-					if ( CKEDITOR.env.air )
-						onPasteFrameLoad.call( this, doc.getWindow().$ );
-				},
-				this );
-
-			iframe.setCustomData( 'dialog', this );
-
-			var field = this.getContentElement( 'general', 'editing_area' ),
-				container = field.getElement();
-			container.setHtml( '' );
-			container.append( iframe );
-
-			// IE need a redirect on focus to make
-			// the cursor blinking inside iframe. (#5461)
-			if ( CKEDITOR.env.ie )
-			{
-				var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' );
-				focusGrabber.on( 'focus', function()
-				{
-					iframe.$.contentWindow.focus();
-				});
-				container.append( focusGrabber );
-
-				// Override focus handler on field.
-				field.focus = function()
-				{
-					focusGrabber.focus();
-					this.fire( 'focus' );
-				};
-			}
-
-			field.getInputElement = function(){ return iframe; };
-
-			// Force container to scale in IE.
-			if ( CKEDITOR.env.ie )
-			{
-				container.setStyle( 'display', 'block' );
-				container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
-			}
+			this.setupContent();
 		},
 
@@ -162,18 +84,5 @@
 		onOk : function()
 		{
-			var container = this.getContentElement( 'general', 'editing_area' ).getElement(),
-				iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ),
-				editor = this.getParentEditor(),
-				body = iframe.getFrameDocument().getBody(),
-				bogus = body.getBogus(),
-				html;
-			bogus && bogus.remove();
-			// Saving the contents in variable so changes until paste is complete will not take place (#7500)
-			html = body.getHtml();
-
-			setTimeout( function(){
-				editor.fire( 'paste', { 'html' : html } );
-			}, 0 );
-
+			this.commitContent();
 		},
 
@@ -209,4 +118,101 @@
 								win.focus();
 							}, 500 );
+						},
+						setup : function()
+						{
+							var dialog = this.getDialog();
+							var htmlToLoad = 
+								'<html dir="' + editor.config.contentsLangDirection + '"' +
+								' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' +
+								'<head><style>body { margin: 3px; height: 95%; } </style></head><body>' +
+								'<script id="cke_actscrpt" type="text/javascript">' +
+								'window.parent.CKEDITOR.tools.callFunction( ' + CKEDITOR.tools.addFunction( onPasteFrameLoad, dialog ) + ', this );' +
+								'</script></body>' +
+								'</html>';
+
+							var src =
+								CKEDITOR.env.air ?
+									'javascript:void(0)' :
+								isCustomDomain ?
+									'javascript:void((function(){' +
+										'document.open();' +
+										'document.domain=\'' + document.domain + '\';' +
+										'document.close();' +
+									'})())"'
+								:
+									'';
+
+							var iframe = CKEDITOR.dom.element.createFromHtml(
+								'<iframe' +
+									' class="cke_pasteframe"' +
+									' frameborder="0" ' +
+									' allowTransparency="true"' +
+									' src="' + src + '"' +
+									' role="region"' +
+									' aria-label="' + lang.pasteArea + '"' +
+									' aria-describedby="' + dialog.getContentElement( 'general', 'pasteMsg' ).domId + '"' +
+									' aria-multiple="true"' +
+									'></iframe>' );
+
+							iframe.on( 'load', function( e )
+							{
+								e.removeListener();
+
+								var doc = iframe.getFrameDocument();
+								doc.write( htmlToLoad );
+
+								if ( CKEDITOR.env.air )
+									onPasteFrameLoad.call( this, doc.getWindow().$ );
+							}, dialog );
+
+							iframe.setCustomData( 'dialog', dialog );
+
+							var container = this.getElement();
+							container.setHtml( '' );
+							container.append( iframe );
+
+							// IE need a redirect on focus to make
+							// the cursor blinking inside iframe. (#5461)
+							if ( CKEDITOR.env.ie )
+							{
+								var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' );
+								focusGrabber.on( 'focus', function()
+								{
+									iframe.$.contentWindow.focus();
+								});
+								container.append( focusGrabber );
+
+								// Override focus handler on field.
+								this.focus = function()
+								{
+									focusGrabber.focus();
+									this.fire( 'focus' );
+								};
+							}
+
+							this.getInputElement = function(){ return iframe; };
+
+							// Force container to scale in IE.
+							if ( CKEDITOR.env.ie )
+							{
+								container.setStyle( 'display', 'block' );
+								container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
+							}
+						},
+						commit : function( data )
+						{
+							var container = this.getElement(),
+								editor = this.getDialog().getParentEditor(),
+								body = this.getInputElement().getFrameDocument().getBody(),
+								bogus = body.getBogus(),
+								html;
+							bogus && bogus.remove();
+
+							// Saving the contents so changes until paste is complete will not take place (#7500) 
+							html = body.getHtml();
+
+							setTimeout( function(){
+								editor.fire( 'paste', { 'html' : html } );
+							}, 0 );
 						}
 					}
Index: CKEditor/trunk/_source/plugins/dialog/dialogDefinition.js
===================================================================
--- CKEditor/trunk/_source/plugins/dialog/dialogDefinition.js	(revision 6793)
+++ CKEditor/trunk/_source/plugins/dialog/dialogDefinition.js	(revision 6799)
@@ -283,4 +283,22 @@
  * Function to execute whenever the UI element's parent dialog is closed.
  * @name CKEDITOR.dialog.definition.uiElement.prototype.onHide
+ * @field
+ * @type Function
+ * @example
+ */
+
+/**
+ * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.setupContent} method is executed.
+ * It usually takes care of the respective UI element as a standalone element.
+ * @name CKEDITOR.dialog.definition.uiElement.prototype.setup
+ * @field
+ * @type Function
+ * @example
+ */
+
+/**
+ * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.commitContent} method is executed.
+ * It usually takes care of the respective UI element as a standalone element.
+ * @name CKEDITOR.dialog.definition.uiElement.prototype.commit
  * @field
  * @type Function
Index: CKEditor/trunk/_source/plugins/dialog/plugin.js
===================================================================
--- CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 6793)
+++ CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 6799)
@@ -860,4 +860,14 @@
 		})(),
 
+
+		/**
+		 * Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it.
+		 * It is usually being called when the dialog is opened, to put the initial value inside the field.
+		 * @example
+		 * dialogObj.setupContent();
+		 * @example
+		 * var timestamp = ( new Date() ).valueOf();
+		 * dialogObj.setupContent( timestamp );
+		 */
 		setupContent : function()
 		{
@@ -870,4 +880,13 @@
 		},
 
+		/**
+		 * Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it.
+		 * It is usually being called when the user confirms the dialog, to process the values.
+		 * @example
+		 * dialogObj.commitContent();
+		 * @example
+		 * var timestamp = ( new Date() ).valueOf();
+		 * dialogObj.commitContent( timestamp );
+		 */
 		commitContent : function()
 		{
Index: CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js
===================================================================
--- CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js	(revision 6793)
+++ CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js	(revision 6799)
@@ -14,21 +14,6 @@
 				minHeight : 240,
 
-				onShow : function()
-				{
-					// Reset the textarea value.
-					this.getContentElement( 'general', 'content' ).getInputElement().setValue( '' );
-				},
-
-				onOk : function()
-				{
-					// Get the textarea value.
-					var text = this.getContentElement( 'general', 'content' ).getInputElement().getValue(),
-						editor = this.getParentEditor();
-
-					setTimeout( function()
-					{
-						editor.fire( 'paste', { 'text' : text } );
-					}, 0 );
-				},
+				onShow : function(){ this.setupContent(); },
+				onOk : function(){ this.commitContent(); },
 
 				contents :
@@ -61,4 +46,16 @@
 								{
 									this.getElement().focus();
+								},
+								setup : function()
+								{
+									this.setValue( '' );
+								},
+								commit : function()
+								{
+									var value = this.getValue();
+									setTimeout( function()
+									{
+										editor.fire( 'paste', { 'text' : value } );
+									}, 0 );
 								}
 							}
