Example #1
0
 void NotifySdkChanged()
 {
     if (ParentProject != null)
     {
         ParentProject.NotifySdkChanged();
     }
 }
Example #2
0
        public void SetValue(string value, bool preserveCase = false, bool mergeToMainGroup = false)
        {
            AssertCanModify();
            MergeToMainGroup   = mergeToMainGroup;
            this.preserverCase = preserveCase;
            valueType          = preserveCase ? MSBuildValueType.Default : MSBuildValueType.DefaultPreserveCase;

            if (value == null)
            {
                value = String.Empty;
            }

            if (preserveCase)
            {
                var current = GetPropertyValue();
                if (current != null)
                {
                    if (current.Equals(value, preserveCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture))
                    {
                        return;
                    }
                }
            }
            SetPropertyValue(value);
            if (ParentProject != null && NotifyChanges)
            {
                ParentProject.NotifyChanged();
            }
        }
Example #3
0
 void NotifyImportChanged()
 {
     if (ParentProject != null)
     {
         ParentProject.NotifyImportChanged();
     }
 }
Example #4
0
        internal virtual void SetPropertyValue(string newValue)
        {
            if (this.value == null || !valueType.Equals(this.value, newValue))
            {
                // If the property has an initial evaluated value, then set the EvaluatedValueModified flag
                if (!Modified && this.value != null && (flags & LinkedPropertyFlags.DefinedMultipleTimes) != 0)
                {
                    EvaluatedValueModified = true;
                }

                // If the value is the same as the one that was originally evaluated, then reset the EvaluatedValueModified flag.
                // The case is: load a default value, change to non-default, save. At this point EvaluatedValueModified=true
                // because we set a value different from the evaluated one. Now we set default value again. Since value is same
                // as the one evaluated, EvaluatedValueModified should now be brought back to false.
                if (originalEvaluatedValue != null && newValue != null && valueType.Equals(originalEvaluatedValue, newValue))
                {
                    EvaluatedValueModified = false;
                }

                Modified              = true;
                this.value            = newValue;
                this.unevaluatedValue = newValue;
                this.rawValue         = null;
                this.textValue        = null;
                StartInnerWhitespace  = null;
                EndInnerWhitespace    = null;
                if (ParentProject != null && NotifyChanges)
                {
                    ParentProject.NotifyChanged();
                }
            }
        }
Example #5
0
 public void AddItem(MSBuildItem item)
 {
     AssertCanModify();
     item.ParentNode = this;
     ChildNodes      = ChildNodes.Add(item);
     item.ResetIndent(false);
     if (ParentProject != null)
     {
         ParentProject.NotifyChanged();
     }
 }
        public IEnumerable <IParameter> GetParameters(IParameter parameter, bool sameReferenceGroup)
        {
            ParameterLocation pl = ParentProject.GetParameterLocation(parameter);
            IParameter        p;

            for (int s = 0; s < Spectra.Count; s++)
            {
                pl.specId = s;
                if ((p = ParentProject.GetParameter(pl)).ReferenceGroup == parameter.ReferenceGroup || !sameReferenceGroup)
                {
                    yield return(p);
                }
            }
        }
Example #7
0
 internal virtual void SetPropertyValue(string value)
 {
     if (this.value != value)
     {
         this.value            = value;
         this.unevaluatedValue = value;
         this.rawValue         = null;
         this.textValue        = null;
         StartInnerWhitespace  = null;
         EndInnerWhitespace    = null;
         if (ParentProject != null && NotifyChanges)
         {
             ParentProject.NotifyChanged();
         }
     }
 }
Example #8
0
        public string ToQueryString()
        {
            string returnString = "(";

            returnString += "'" + ParentId.ToString() + "', ";                                  // 1
            returnString += "'" + Title + "', ";                                                // 2
            returnString += "'" + ShortDescription + "', ";                                     // 3
            returnString += "'" + DetailedDescription + "', ";                                  // 4
            returnString += "'" + ParentProject.ToString() + "', ";                             // 5
            returnString += "'" + DateCreated.ToShortDateString() + "', ";                      // 6
            returnString += "'" + CreatedBy.ToString() + "', ";                                 // 7
            returnString += "'" + DateCompleted.ToShortDateString() + "', ";                    // 8
            returnString += "'" + CompletedBy.ToString() + "', ";                               // 9
            returnString += "'" + DeadLine.ToShortDateString() + "', ";                         //10
            returnString += "'" + Status + "'";                                                 //11

            return(returnString += ")");
        }         // End of ToQueryString()
Example #9
0
        public void SetValue(FilePath value, bool relativeToProject = true, FilePath relativeToPath = default(FilePath), bool mergeToMainGroup = false)
        {
            AssertCanModify();
            MergeToMainGroup   = mergeToMainGroup;
            this.preserverCase = false;
            valueType          = MSBuildValueType.Path;

            string baseDir = null;

            if (relativeToPath != null)
            {
                baseDir = relativeToPath;
            }
            else if (relativeToProject)
            {
                if (ParentProject == null)
                {
                    // The project has not been set, so we can't calculate the relative path.
                    // Store the full path for now, and set the property type to UnresolvedPath.
                    // When the property gets a value, the relative path will be calculated
                    valueType = MSBuildValueType.UnresolvedPath;
                    SetPropertyValue(value.ToString());
                    return;
                }
                baseDir = ParentProject.BaseDirectory;
            }

            // If the path is normalized in the property, keep the value
            if (!string.IsNullOrEmpty(Value) && new FilePath(MSBuildProjectService.FromMSBuildPath(baseDir, Value)).CanonicalPath == value.CanonicalPath)
            {
                return;
            }

            SetPropertyValue(MSBuildProjectService.ToMSBuildPath(baseDir, value, false));
            if (ParentProject != null && NotifyChanges)
            {
                ParentProject.NotifyChanged();
            }
        }
Example #10
0
        public void AddItem(MSBuildItem item, MSBuildItem beforeItem)
        {
            AssertCanModify();
            item.ParentNode = this;

            int i;

            if (beforeItem != null && (i = ChildNodes.IndexOf(beforeItem)) != -1)
            {
                ChildNodes = ChildNodes.Insert(i, item);
            }
            else
            {
                ChildNodes = ChildNodes.Add(item);
            }

            item.ResetIndent(false);
            if (ParentProject != null)
            {
                ParentProject.NotifyChanged();
            }
        }
Example #11
0
        internal virtual void SetPropertyValue(string value)
        {
            if (this.value == null || !valueType.Equals(this.value, value))
            {
                // If the property has an initial evaluated value, then set the EvaluatedValueModified flag
                if (!Modified && this.value != null)
                {
                    EvaluatedValueModified = true;
                }

                Modified              = true;
                this.value            = value;
                this.unevaluatedValue = value;
                this.rawValue         = null;
                this.textValue        = null;
                StartInnerWhitespace  = null;
                EndInnerWhitespace    = null;
                if (ParentProject != null && NotifyChanges)
                {
                    ParentProject.NotifyChanged();
                }
            }
        }
 void NotifyChange()
 {
     ParentProject?.NotifyModified("CompilerParameters");
 }
Example #13
0
        public override void UpdateIncludesAndImports(string filename, GeneroAst ast)
        {
            if (/*_shouldAnalyzeDir &&*/ VSGeneroPackage.Instance.ProgramFileProvider != null)
            {
                var fglAst = ast as Genero4glAst;
                if (fglAst != null)
                {
                    // first do imports
                    if (_lastImportedModules == null)
                    {
                        _lastImportedModules = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                    }
                    var modules = fglAst.GetImportedModules().ToList();
                    HashSet <string> currentlyImportedModules = new HashSet <string>(_lastImportedModules, StringComparer.OrdinalIgnoreCase);
                    foreach (var mod in modules.Select(x => VSGeneroPackage.Instance.ProgramFileProvider.GetImportModuleFilename(x, FilePath)).Where(y => y != null))
                    {
                        if (!_lastImportedModules.Contains(mod))
                        {
                            var impProj = ParentProject.AddImportedModule(mod, this);
                            if (impProj != null)
                            {
                                _lastImportedModules.Add(mod);
                                try
                                {
                                    if (!impProj.ReferencingProjectEntries.Contains(this))
                                    {
                                        // TODO: for some reason a NRE got thrown here, but nothing was apparently wrong
                                        //if (impProj.ReferencedProjects.ContainsKey(Path.GetDirectoryName(this.FilePath)))
                                        //    errorSink.Add(string.Format("Circular dependency detected between import modules {0} and {1}", impProj.Directory, this.FilePath), ast._lineLocations, 1, 2, ErrorCodes.SyntaxError, Severity.Error);
                                        //else
                                        impProj.ReferencingProjectEntries.Add(this);
                                    }
                                }
                                catch (Exception)
                                {
                                    int i = 0;
                                }
                            }
                        }
                        else
                        {
                            currentlyImportedModules.Remove(mod);
                        }
                    }

                    // delete the leftovers
                    foreach (var mod in currentlyImportedModules)
                    {
                        ParentProject.RemoveImportedModule(mod);
                        _lastImportedModules.Remove(mod);
                    }

                    // next do includes
                    var includes = fglAst.GetIncludedFiles();
                    HashSet <string> currentlyIncludedFiles = new HashSet <string>(VSGeneroPackage.Instance.DefaultAnalyzer.GetIncludedFiles(this).Select(x => x.FilePath), StringComparer.OrdinalIgnoreCase);
                    foreach (var incl in includes.Select(x => VSGeneroPackage.Instance.ProgramFileProvider.GetIncludeFile(x, FilePath)).Where(y => y != null))
                    {
                        if (!VSGeneroPackage.Instance.DefaultAnalyzer.IsIncludeFileIncludedByProjectEntry(incl, this))
                        {
                            VSGeneroPackage.Instance.DefaultAnalyzer.AddIncludedFile(incl, this);
                        }
                        else
                        {
                            currentlyIncludedFiles.Remove(incl);
                        }
                    }

                    // delete the leftovers
                    foreach (var include in currentlyIncludedFiles)
                    {
                        VSGeneroPackage.Instance.DefaultAnalyzer.RemoveIncludedFile(include, this);
                    }
                }
            }
        }