private void GenerateContextMenu ( Event current, Rect rowRect, string fullPath, IErrorDetails error, string projectRelativePath, ErrorTypeGUI errorTypeGUI ) { var menuOpenClick = current.type == EventType.ContextClick || current.type == EventType.MouseDown; if (menuOpenClick && rowRect.Contains(current.mousePosition)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent($"Reveal in {GUIUtil.FileManagerName}"), false, ShowInFileManager, fullPath); menu.AddItem(new GUIContent("Highlight in project"), false, HighlightInEditor, projectRelativePath); menu.AddItem(new GUIContent("Copy path to clipboard/Repository relative"), false, CopyFilenameToClipboard, error.FilePosixPath); menu.AddItem(new GUIContent("Copy path to clipboard/Project relative"), false, CopyFilenameToClipboard, projectRelativePath); menu.AddItem(new GUIContent("Copy path to clipboard/Full"), false, CopyFilenameToClipboard, fullPath); menu.AddItem(new GUIContent($"How to fix..."), false, LearnMoreAboutError, errorTypeGUI.HelpUri); menu.ShowAsContext(); current.Use(); } }
public IndieBackendError(int statusCode, string error, string message, IErrorDetails details = null) { StatusCode = statusCode; Error = error; Message = message; Details = details; }
//Public Methods public Boolean IsValid(DataRow record, ref IErrorDetails[] errors) { //Check whether the record is null if (record == null) { errors = new IErrorDetails[] { new ErrorDetails(record, null, "The given record is null!") }; return(false); } //Loop through every check and invoke them List <IErrorDetails> myErrors = null; IErrorDetails myError = null; foreach (EntityValidationRule myRule in GetRules(record.Table.TableName)) { if (myRule.IsValid(record, ref myError)) { if (myErrors == null) { myErrors = new List <IErrorDetails>(); } myErrors.Add(myError); } } //Return true if there are no errors if (myErrors == null) { return(true); } //Otherwise assign them as result and return false errors = myErrors.ToArray(); return(false); }
/// <inheritdoc /> public void Publish(IErrorDetails details) { Guard.ArgumentNotNull(details, nameof(details)); _logger.Debug($"Received {details}"); _subject.OnNext(details); }
public ErrorTypeGUI FindForError(IErrorDetails error) { var errorPattern = new ErrorPattern(error.ErrorType, error.FileStatus); if (_guisByType.ContainsKey(errorPattern)) { return(_guisByType[errorPattern]); } return(null); }
public void Reset ( string basePath, string projectPath, IErrorDetails initialError ) { _basePath = basePath; _projectPath = projectPath; if (initialError != null) { _prevErrorProjectPath = GetProjectPathForError(initialError); } else { _prevErrorProjectPath = null; } }
//Public Methods public Boolean IsValid(DataRow record, ref IErrorDetails errorDetails) { if (record == null) { throw new InvalidOperationException("Programming error in Validator.cs"); } if (!Validator.IdentifyerComparer.Equals(record.Table.TableName, TableName)) { throw new InvalidOperationException("Programming error in Validator.cs"); } String myError = GetErrorMessageIfInvalid(record); if (myError == null) { return(true); } errorDetails = CreateErrorDetails(record, myError); return(false); }
public void Generate ( IErrorDetails error, ErrorTypeGUI errorTypeGUI, bool isOdd ) { var backgroundStyle = isOdd ? _oddStyle.Get : _evenStyle.Get; EditorGUILayout.BeginHorizontal(backgroundStyle); var fullPath = GetFullPathForError(error); var projectRelativePath = GetProjectPathForError(error, fullPath); GeneratePathGUI(projectRelativePath, _prevErrorProjectPath); GUILayout.FlexibleSpace(); errorTypeGUI.Generate(); EditorGUILayout.EndHorizontal(); var rowRect = GUILayoutUtility.GetLastRect(); var currentEvent = Event.current; GenerateHoverHighlight(currentEvent, rowRect); GenerateContextMenu( currentEvent, rowRect, fullPath, error, projectRelativePath, errorTypeGUI ); _prevErrorProjectPath = projectRelativePath; }
private string GetProjectPathForError(IErrorDetails error) { return(GetProjectPathForError(error, GetFullPathForError(error))); }
private string GetProjectPathForError(IErrorDetails error, string fullPath) { return(PathHelpers.MakeRelativePath(_projectPath, fullPath)); }
private string GetFullPathForError(IErrorDetails error) { return(Path.Combine(_basePath, error.FilePosixPath)); }