public AccountDlg(IParentReference <Account> parentReference, Account sub) { this.Build(); ParentReference = parentReference; UoWGeneric = ParentReference.CreateUoWForItem(sub); ConfigureDlg(); }
internal void SaveParentReference(IProject project, PomElement rootElement) { IParentReference parentReference = project.Parent; if (parentReference == null) { rootElement.RemoveElement("parent"); } else { var parentElement = rootElement.SingleOrCreate("parent"); SaveProjectReference(parentReference, parentElement); parentElement.SetElementValue("relativePath", parentReference.RelativePath); } }
public ValidationResult Validate() { Project project = _projectNode.Project; IParentReference parent = project.Parent; if (parent == null) { return(ValidationResult.Good); } var error = new ValidationError(_projectNode.Project, "Project parent error", ErrorLevel.Warning); if (_externalModules.Contains(parent, true)) { return(ValidationResult.Good); } if (_repository.ContainsProject(parent, true)) { var parentProject = _repository.SelectProjectNodes(parent, true).Single(); string resolvedPathToParent = PathOperations.GetRelativePath(_projectNode.FullPath, parentProject.FullPath); resolvedPathToParent = PathOperations.Normalize(resolvedPathToParent); if (!string.Equals(_projectNode.ParentPath, resolvedPathToParent, StringComparison.OrdinalIgnoreCase)) { error.Details = string.Format("Parent path '{0}' does not point to {1}, should be {2}", _projectNode.ParentPath, parentProject, resolvedPathToParent); error.AddFix(new RelativePathFix(project, resolvedPathToParent)); _validationOutput.AddError(error); } return(ValidationResult.Good); } var potencial = _repository.SelectProjectNodes(parent, false).ToArray(); if (potencial.Length == 0) { error.Details = string.Format("Project {0} rererences unknown parent {1}.", _projectNode, parent); error.AddFix(new AddToExternalFix(_externalModules, parent)); // REVIEW: try to resolve via parent path } else if (potencial.Length == 1) { error.Details = string.Format("Project {0} references does not match actual version {1}.", _projectNode.Project, parent); // TODO: better message error.AddFix(new VersionFix(_projectNode.Project, parent, potencial.Single().Version)); } else { error.Details = string.Format("Project {0} references different plugin version {1}.", _projectNode.Project, parent); foreach (var candicate in potencial) { error.AddFix(new VersionFix(_projectNode.Project, parent, candicate.Version)); } } _validationOutput.AddError(error); return(ValidationResult.Good); }