/// <summary> /// Handles the Apply event of the cpCreateContract control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="ea">The <see cref="DevExpress.CodeRush.Core.ApplyContentEventArgs"/> instance containing the event data.</param> private void Apply(object sender, ApplyContentEventArgs ea) { // Must have cached instance of interface and interface declaration. if (this.activeInterface == null) { return; } if (ea.TextDocument == null) { return; } if (string.IsNullOrEmpty(this.interfaceFilePath)) { return; } if (this.interfaceSourceFile == null) { return; } if (this.codeRushProxy == null) { return; } if (this.cpCreateContract == null) { return; } if (string.IsNullOrEmpty(this.interfaceName)) { return; } var interfaceUpdater = new InterfaceUpdater( ea.TextDocument, this.activeInterface, this.interfaceSourceFile, this.interfaceFilePath, this.interfaceName); var contractClassBuilder = new ContractClassBuilder(interfaceUpdater, this.codeRushProxy); using (this.codeRushProxy.TextBuffers.NewMultiFileCompoundAction(this.cpCreateContract.ActionHintText)) { this.codeRushProxy.Markers.Drop(MarkerStyle.Standard); interfaceUpdater.UpdateInterface(); contractClassBuilder.CreateContractClassFile(); } }