/// <summary> /// Processes the specified document /// </summary> private void DoProcess(ITabbedDocument document) { switch (this.operationComboBox.SelectedIndex) { case 0: // Format Code { DataEvent de = new DataEvent(EventType.Command, "CodeFormatter.FormatDocument", document); EventManager.DispatchEvent(this, de); break; } case 1: // Organize Imports { OrganizeImports command = new OrganizeImports(); command.SciControl = document.SciControl; command.Execute(); break; } case 2: // Truncate Imports { OrganizeImports command = new OrganizeImports(); command.SciControl = document.SciControl; command.TruncateImports = true; command.Execute(); break; } case 3: // Consistent EOLs { document.SciControl.ConvertEOLs(document.SciControl.EOLMode); break; } } }
/// <summary> /// Invoked when the user selects the "Organize Imports" command /// </summary> private void OrganizeImportsClicked(Object sender, EventArgs e) { try { OrganizeImports command = new OrganizeImports(); command.SeparatePackages = this.settingObject.SeparatePackages; command.Execute(); } catch (Exception ex) { ErrorManager.ShowError(ex); } }
/// <summary> /// Invoked when the user selects the "Truncate Imports" command /// </summary> private void TruncateImportsClicked(Object sender, EventArgs e) { try { OrganizeImports command = new OrganizeImports(); command.SeparatePackages = this.settingObject.SeparatePackages; command.TruncateImports = true; command.Execute(); } catch (Exception ex) { ErrorManager.ShowError(ex); } }