Ejemplo n.º 1
0
    public ProjectEdit(ProjectTracker.Library.ProjectEdit project)
    {
      InitializeComponent();

      // store object reference
      _project = project;
    }
Ejemplo n.º 2
0
        private void StartTracking()
        {
            // don't track again if already tracking
            if (IsTracking)
            {
                return;
            }

            // don't do anything if user explicitly disables source control integration
            if (_vsSettings != null &&
                SourceControlUtility.IsSourceControlDisabled(_vsSettings))
            {
                return;
            }

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                uint cookie;
                if (ProjectTracker.AdviseTrackProjectDocumentsEvents(_projectDocumentListener, out cookie) == VSConstants.S_OK)
                {
                    _trackingCookie = cookie;
                }
            });
        }
Ejemplo n.º 3
0
    public ResourceEdit(ProjectTracker.Library.ResourceEdit resource)
    {
      InitializeComponent();

      // store object reference
      _resource = resource;
    }
        public override EnvDTE.FileCodeModel GetFileCodeModel(DocumentId documentId)
        {
            if (documentId == null)
            {
                throw new ArgumentNullException(nameof(documentId));
            }

            var project = ProjectTracker.GetProject(documentId.ProjectId);

            if (project == null)
            {
                throw new ArgumentException(ServicesVSResources.DocumentIdNotFromWorkspace, nameof(documentId));
            }

            var document = project.GetDocumentOrAdditionalDocument(documentId);

            if (document == null)
            {
                throw new ArgumentException(ServicesVSResources.DocumentIdNotFromWorkspace, nameof(documentId));
            }

            var provider = project as IProjectCodeModelProvider;

            if (provider != null)
            {
                var projectCodeModel = provider.ProjectCodeModel;
                if (projectCodeModel.CanCreateFileCodeModelThroughProject(document.FilePath))
                {
                    return((EnvDTE.FileCodeModel)projectCodeModel.CreateFileCodeModelThroughProject(document.FilePath));
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
 public void Start()
 {
     issueLoader    = GameObject.FindObjectOfType <IssuesLoader>();
     projectTracker = GameObject.FindObjectOfType <ProjectTracker>();
     Setup(new List <DataSource>()
     {
         DataSource.GITHUB, DataSource.REQUIREMENTS_BAZAAR
     });
 }
Ejemplo n.º 6
0
        private void StopTracking()
        {
            if (!IsTracking)
            {
                return;
            }

            ProjectTracker.UnadviseTrackProjectDocumentsEvents((uint)_trackingCookie);
            _trackingCookie = null;
        }
 public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
 {
     if ((dictionary != null))
     {
         var projectTracker = new ProjectTracker();
         projectTracker.Id   = dictionary.GetValue <int>(RedmineKeys.ID);
         projectTracker.Name = dictionary.GetValue <string>(RedmineKeys.NAME);
         return(projectTracker);
     }
     return(null);
 }
Ejemplo n.º 8
0
 public void Start()
 {
     //Get the edit menu from the project tracker and the UIs
     projectTracker      = GameObject.FindObjectOfType <ProjectTracker>();
     editMenu            = projectTracker.editIssueMenu;
     requirementBazaarUI = editMenu.requirementBazaar_UI;
     gitHubUI            = editMenu.gitHub_UI;
     Setup(new List <DataSource>()
     {
         DataSource.GITHUB, DataSource.REQUIREMENTS_BAZAAR
     });
 }
        public async Task <IActionResult> Post([FromBody] ProjectTracker parameters)
        {
            try
            {
                var data = await _service.AddOrUpdate(parameters).ConfigureAwait(false);

                return(Ok(data));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 10
0
        public void OnExecute(CommandEventArgs e)
        {
            if (_commandService == null)
                _commandService = e.GetService<IVisualGitCommandService>();
            if (_projectTracker == null)
                _projectTracker = e.GetService<ProjectTracker>(typeof(IVisualGitProjectDocumentTracker));
            if(_sccProvider == null)
                _sccProvider = e.GetService<VisualGitSccProvider>(typeof(IVisualGitSccService));

            _commandService.TockCommand(e.Command);

            _projectTracker.OnSccCleanup(e);
            _sccProvider.OnSccCleanup(e);
        }
Ejemplo n.º 11
0
        public void SetIntellisenseBuildResult(bool succeeded, string reason)
        {
            // set intellisense related info
            _intellisenseBuildSucceeded     = succeeded;
            _intellisenseBuildFailureReason = string.IsNullOrWhiteSpace(reason) ? null : reason.Trim();

            UpdateHostDiagnostics(succeeded, reason);

            if (_pushingChangesToWorkspaceHosts)
            {
                // set workspace reference info
                ProjectTracker.NotifyWorkspaceHosts(host => (host as IVisualStudioWorkspaceHost2)?.OnHasAllInformation(Id, succeeded));
            }
        }
Ejemplo n.º 12
0
        private void StopTracking()
        {
            if (!IsTracking)
            {
                return;
            }

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                var hr = ProjectTracker.UnadviseTrackProjectDocumentsEvents(_trackingCookie.Value);
                ErrorHandler.ThrowOnFailure(hr);
            });

            _trackingCookie = null;
        }
Ejemplo n.º 13
0
        public override object Deserialize(
            IDictionary <string, object> dictionary,
            Type type,
            JavaScriptSerializer serializer)
        {
            if ((dictionary == null))
            {
                return(null);
            }
            var projectTracker = new ProjectTracker
            {
                Id   = dictionary.GetValue <int>("id"),
                Name = dictionary.GetValue <string>("name")
            };

            return(projectTracker);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Called if the GameObject is enabled
 /// Registers for the IssueEdited and IssueDeleted Events
 /// </summary>
 private void OnEnable()
 {
     //Get the edit menu from the project tracker
     issueDataDisplay = GetComponent <IssueDataDisplay>();
     if (issueDataDisplay == null)
     {
         SpecialDebugMessages.LogComponentNotFoundError(this, nameof(IssueDataDisplay), gameObject);
     }
     projectTracker = GameObject.FindObjectOfType <ProjectTracker>();
     editMenu       = projectTracker.editIssueMenu;
     if (editMenu != null)
     {
         editMenu.IssueEdited += OnIssueEdited;
     }
     if (projectTracker != null)
     {
         projectTracker.IssueDeleted += OnIssueDeleted;
     }
 }
Ejemplo n.º 15
0
        private void StartTracking()
        {
            // don't track again if already tracking
            if (IsTracking)
            {
                return;
            }

            // don't do anything if user explicitly disables source control integration
            if (_vsSettings != null &&
                SourceControlUtility.IsSourceControlDisabled(_vsSettings))
            {
                return;
            }

            uint cookie;

            ProjectTracker.AdviseTrackProjectDocumentsEvents(_projectDocumentListener, out cookie);
            _trackingCookie = cookie;
        }
Ejemplo n.º 16
0
        public void OnExecute(CommandEventArgs e)
        {
            if (_commandService == null)
            {
                _commandService = e.GetService <IAnkhCommandService>();
            }
            if (_projectTracker == null)
            {
                _projectTracker = e.GetService <ProjectTracker>();
            }
            if (_sccProvider == null)
            {
                _sccProvider = e.GetService <SvnSccProvider>(typeof(IAnkhSccService));
            }

            _commandService.TockCommand(e.Command);

            _projectTracker.OnSccCleanup(e);
            _sccProvider.OnSccCleanup(e);
        }
Ejemplo n.º 17
0
    public void Start()
    {
        //Disable the Create Button and enable the back plate
        gameObject.GetComponent <Interactable>().IsEnabled = false;
        if (backPlate != null)
        {
            backPlate.SetActive(true);
        }
        //Subscribe to Login and Project events
        ServiceManager.GetService <LearningLayersOidcService>().LoginCompleted       += LoginCompleted_RequirementBazaar;
        ServiceManager.GetService <LearningLayersOidcService>().LogoutCompleted      += LogoutCompleted_RequirementBazaar;
        GameObject.FindObjectOfType <ShelfConfigurationMenu>().ReqBazProjectChanged  += ProjectChanged_RequirementBazaar;
        GameObject.FindObjectOfType <ShelfConfigurationMenu>().ReqBazCategoryChanged += CategoryChanged_RequirementBazaar;

        ServiceManager.GetService <GitHubOidcService>().LoginCompleted              += LoginCompleted_GitHub;
        ServiceManager.GetService <GitHubOidcService>().LogoutCompleted             += LogoutCompleted_GitHub;
        GameObject.FindObjectOfType <ShelfConfigurationMenu>().GitHubProjectChanged += ProjectChanged_GitHub;

        GameObject.FindObjectOfType <ShelfConfigurationMenu>().SourceChanged += SourceChanged;

        projectTracker = GameObject.FindObjectOfType <ProjectTracker>();
    }
Ejemplo n.º 18
0
        public async Task <ProjectTracker> AddOrUpdate(ProjectTracker data)
        {
            await using var transaction = await _context.Database
                                          .BeginTransactionAsync()
                                          .ConfigureAwait(false);

            try
            {
                var result = _context.ProjectTracker.Update(data);
                await _context.SaveChangesAsync().ConfigureAwait(false);

                await transaction.CommitAsync().ConfigureAwait(false);

                return(result.Entity);
            }
            catch (Exception e)
            {
                await transaction.RollbackAsync().ConfigureAwait(false);

                throw new Exception(e.Message);
            }
        }
        internal override bool RenameFileCodeModelInstance(DocumentId documentId, string newFilePath)
        {
            if (documentId == null)
            {
                return(false);
            }

            var project = ProjectTracker.GetProject(documentId.ProjectId);

            if (project == null)
            {
                return(false);
            }

            var document = project.GetDocumentOrAdditionalDocument(documentId);

            if (document == null)
            {
                return(false);
            }

            var codeModelProvider = project as IProjectCodeModelProvider;

            if (codeModelProvider == null)
            {
                return(false);
            }

            var codeModelCache = codeModelProvider.ProjectCodeModel.GetCodeModelCache();

            if (codeModelCache == null)
            {
                return(false);
            }

            codeModelCache.OnSourceFileRenaming(document.FilePath, newFilePath);

            return(true);
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> Create(
            CancellationToken cancellationToken,
            [FromBody] CreateProjectBinding binding,
            [FromServices] IProjectRepository projectRepository,
            [FromServices] ITrackerRepository trackerRepository)
        {
            var project = await projectRepository.Get(binding.Id, cancellationToken);

            if (project != null)
            {
                if (!project.Name.Equals(binding.Name) ||
                    !project.Description.Equals(binding.Description))
                {
                    throw new ApiException(HttpStatusCode.Conflict, ErrorCode.ProjectAlreadyExists,
                                           "Project already exists with other parameters");
                }
            }

            project = new Project(binding.Id, binding.Name, binding.Description, binding.IsPrivate);

            foreach (var trackerId in binding.Trackers)
            {
                var tracker = await trackerRepository.Get(trackerId, cancellationToken);

                if (tracker == null)
                {
                    throw new ApiException(HttpStatusCode.NotFound, ErrorCode.TrackerNotFound, "Tracker not found");
                }

                var projectTracker = new ProjectTracker(binding.Id, tracker.Id);

                project.AddProjectTracker(projectTracker);
            }

            await projectRepository.Save(project);

            return(CreatedAtRoute("GetProjectAdminRoute", new { id = project.Id }, null));
        }
 public void Delete(ProjectTracker.Library.ProjectResource resource)
 {
     this.Project.Resources.Remove(resource);
 }
Ejemplo n.º 22
0
        private void ValidateReferencesCore()
        {
            // can happen when project is unloaded and reloaded or in Venus (aspx) case
            if (ProjectFilePath == null || BinOutputPath == null || ObjOutputPath == null)
            {
                return;
            }

            object property = null;

            if (ErrorHandler.Failed(Hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out property)))
            {
                return;
            }

            var dteProject = property as EnvDTE.Project;

            if (dteProject == null)
            {
                return;
            }

            var vsproject = dteProject.Object as VSProject;

            if (vsproject == null)
            {
                return;
            }

            var noReferenceOutputAssemblies = new List <string>();
            var factory = this.ServiceProvider.GetService(typeof(SVsEnumHierarchyItemsFactory)) as IVsEnumHierarchyItemsFactory;

            IEnumHierarchyItems items;

            if (ErrorHandler.Failed(factory.EnumHierarchyItems(Hierarchy, (uint)__VSEHI.VSEHI_Leaf, (uint)VSConstants.VSITEMID.Root, out items)))
            {
                return;
            }

            uint fetched;

            VSITEMSELECTION[] item = new VSITEMSELECTION[1];
            while (ErrorHandler.Succeeded(items.Next(1, item, out fetched)) && fetched == 1)
            {
                // ignore ReferenceOutputAssembly=false references since those will not be added to us in design time.
                var    storage = Hierarchy as IVsBuildPropertyStorage;
                string value;
                storage.GetItemAttribute(item[0].itemid, "ReferenceOutputAssembly", out value);

                object caption;
                Hierarchy.GetProperty(item[0].itemid, (int)__VSHPROPID.VSHPROPID_Caption, out caption);

                if (string.Equals(value, "false", StringComparison.OrdinalIgnoreCase) ||
                    string.Equals(value, "off", StringComparison.OrdinalIgnoreCase) ||
                    string.Equals(value, "0", StringComparison.OrdinalIgnoreCase))
                {
                    noReferenceOutputAssemblies.Add((string)caption);
                }
            }

            var projectReferences  = GetCurrentProjectReferences();
            var metadataReferences = GetCurrentMetadataReferences();
            var set   = new HashSet <string>(vsproject.References.OfType <Reference>().Select(r => PathUtilities.IsAbsolute(r.Name) ? Path.GetFileNameWithoutExtension(r.Name) : r.Name), StringComparer.OrdinalIgnoreCase);
            var delta = set.Count - noReferenceOutputAssemblies.Count - (projectReferences.Length + metadataReferences.Length);

            if (delta == 0)
            {
                return;
            }

            // okay, two has different set of dlls referenced. check special Microsoft.VisualBasic case.
            if (delta != 1)
            {
                //// Contract.Requires(false, "different set of references!!!");
                return;
            }

            set.ExceptWith(noReferenceOutputAssemblies);
            set.ExceptWith(projectReferences.Select(r => ProjectTracker.GetProject(r.ProjectId).DisplayName));
            set.ExceptWith(metadataReferences.Select(m => Path.GetFileNameWithoutExtension(m.FilePath)));

            //// Contract.Requires(set.Count == 1);

            var reference = set.First();

            if (!string.Equals(reference, "Microsoft.VisualBasic", StringComparison.OrdinalIgnoreCase))
            {
                //// Contract.Requires(false, "unknown new reference " + reference);
                return;
            }

#if DEBUG
            // when we are missing microsoft.visualbasic reference, make sure we have embedded vb core option on.
            Contract.Requires(Debug_VBEmbeddedCoreOptionOn);
#endif
        }
Ejemplo n.º 23
0
 public void Start()
 {
     issueLoader    = GameObject.FindObjectOfType <IssuesLoader>();
     projectTracker = GameObject.FindObjectOfType <ProjectTracker>();
 }
 public void Delete(ProjectTracker.Library.ResourceAssignment assignment)
 {
     this.ProjectResource.Assignments.Remove(assignment);
 }