// ************************************************************************* // Constructor // ************************************************************************* internal SaveModuleInfo (IOTAModule aModule) { module = aModule; }
/// <summary> /// Validates selection exists. /// </summary> /// <param name="module">Module</param> /// <returns>true if it exists, false if not.</returns> private static bool ValidateSelectionExists(IOTAModule module) { if (module == null || String.IsNullOrEmpty(OtaUtils.GetSelectedText(module))) { ShowWarning("No text is selected !"); return false; } return true; }
// ************************************************************************* // Public // ************************************************************************* internal IOTAModule[] GetModuleToSave() { IOTAModule[] _List = new IOTAModule[chklbModules.CheckedItems.Count]; for (int i = 0; i < chklbModules.CheckedItems.Count; i ++) { SaveModuleInfo _SaveModuleInfo = (SaveModuleInfo) chklbModules.CheckedItems[i]; _List[i] = _SaveModuleInfo.module; } return _List; }
private static bool IsValidForAutoCompletion(IOTAModule aModule, IOTASourceEditor aSourceEditor) { return (aSourceEditor != null) && (String.IsNullOrEmpty(OtaUtils.GetSelectedText(aModule))); }
public TestFixtureModuleCreator(string iCode, IOTAModule iOwner) { fCodeFile = new TestFixtureCodeFile(iCode); fOwner = iOwner; }
/// <summary> /// Gets source editor. /// </summary> /// <param name="module">Module</param> /// <returns>null if null module.</returns> public static IOTASourceEditor GetSourceEditor(IOTAModule module) { if (module == null) { return null; } IOTASourceEditor result; if (GetCurrentEditor(module) != null) { result = GetSourceEditorFromEditor(module, GetCurrentEditor(module)); if (result != null) { return result; } } else { // Find a source Editor IOTAEditor _Editor; for (int i = 0; i < module.ModuleFileCount; i++) { _Editor = module.ModuleFileEditors(i); result = _Editor as IOTASourceEditor; if (result != null) { return result; } } } return null; }
/// <summary> /// Gets source editor from editor. /// </summary> /// <param name="module">Module</param> /// <param name="editor">Editor</param> /// <returns>null if wrong.</returns> public static IOTASourceEditor GetSourceEditorFromEditor(IOTAModule module, IOTAEditor editor) { if (module == null || editor == null) { return null; } IOTASourceEditor result; for (int i = 0; i < module.ModuleFileCount; i++) { IOTAEditor _Editor = module.ModuleFileEditors(i); if (_Editor.FileName == editor.FileName) { result = _Editor as IOTASourceEditor; if (result != null) { return result; } } } return null; }
/* /// <summary> /// Gets form editor. /// </summary> /// <param name="module">Module</param> /// <returns>null if null module.</returns> public static IOTAFormEditor GetFormEditor(IOTAModule module) { return module as IOTAFormEditor; } //*/ /// <summary> /// Gets editor which must have a source editor. /// </summary> /// <param name="module">Module</param> /// <returns>null if null module.</returns> public static IOTAEditor GetEditorWithSourceEditor(IOTAModule module) { if (module == null) { return null; } return GetSourceEditor(module) as IOTAEditor; }
/**************************************************************/ /* Editor /**************************************************************/ /// <summary> /// Gets current editor. /// </summary> /// <param name="module">Module</param> /// <returns></returns> public static IOTAEditor GetCurrentEditor(IOTAModule module) { try { // BUG in the ToolsAPI: The IDE crashes calling IOTAModule.CurrentEditor on the welcome page if (module == null || module.FileName == "default.htm") { return null; } else { return module.CurrentEditor; } } catch { // Bug in the ToolsAPI: if nothing visible return null; } }
/// <summary> /// Gets selected text. /// </summary> /// <param name="module">Module</param> /// <returns>String.Empty if wrong.</returns> public static string GetSelectedText(IOTAModule module) { if (module == null) { return String.Empty; } IOTASourceEditor _SourceEditor = GetSourceEditor(module); if (_SourceEditor != null) { IOTAEditView _EditView = _SourceEditor.GetEditView(0); return _EditView.Buffer.EditBlock.Text; } else { return String.Empty; } }