/// <summary>
 /// Assign a display order property to items that have previously been preordered
 /// or other (hidden) items under the project root that are not folders
 /// </summary>
 /// <param name="propertyContext">context for the tree item being evaluated</param>
 /// <param name="propertyValues">mutable properties that can be changed to affect display order etc</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues is IProjectTreeCustomizablePropertyValues2 propertyValues2)
     {
         // assign display order to folders and items that appear in order map
         if (_displayOrderMap.TryGetValue(propertyContext.ItemName, out var index) ||
             (propertyContext.Metadata.TryGetValue(FullPathProperty, out var fullPath) &&
              _rootedOrderMap.TryGetValue(fullPath, out index)))
         {
             // sometimes these items temporarily have null item type. Ignore these cases
             if (propertyContext.ItemType != null)
             {
                 propertyValues2.DisplayOrder = index;
             }
         }
         else if (!propertyContext.IsFolder)
         {
             // move unordered non-folder items to the end
             // (this will typically be hidden items visible on "Show All Files")
             propertyValues2.DisplayOrder = int.MaxValue;
         }
     }
 }
Example #2
0
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon = XSharpImagesMonikers.ProjectTreeIcon.ToProjectSystemType();
     }
 }
Example #3
0
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext,
                                     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType();
     }
     else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk))
     {
         string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant();
         if (ext == ".r")
         {
             propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType();
         }
         else if (ext == ".rdata" || ext == ".rhistory")
         {
             propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType();
         }
         else if (ext == ".md" || ext == ".rmd")
         {
             propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType();
         }
         else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension))
         {
             propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType();
         }
         else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension))
         {
             propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType();
         }
     }
 }
Example #4
0
        /// <summary>
        /// Calculates new property values for each node in the project tree.
        /// </summary>
        /// <param name="propertyContext">Context information that can be used for the calculation.</param>
        /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
        public void CalculatePropertyValues(
            IProjectTreeCustomizablePropertyContext propertyContext,
            IProjectTreeCustomizablePropertyValues propertyValues)
        {
            // Only set the icon for the root project node.  We could choose to set different icons for nodes based
            // on various criteria, not just Capabilities, if we wished.
            if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
            {
                propertyValues.Icon = ImageMonikers.ProjectIconImageMoniker.ToProjectSystemType();
            }

            switch (propertyContext.ItemType)
            {
            case "DisassAnn":
                propertyValues.Icon = ImageMonikers.DisassAnnIconImageMoniker.ToProjectSystemType();
                break;

            case "Z80Asm":
                propertyValues.Icon = ImageMonikers.Z80AsmIconImageMoniker.ToProjectSystemType();
                break;

            case "Rom":
                propertyValues.Icon = ImageMonikers.RomIconImageMoniker.ToProjectSystemType();
                break;

            case "Tzx":
                propertyValues.Icon = ImageMonikers.TzxIconImageMoniker.ToProjectSystemType();
                break;

            case "Tap":
                propertyValues.Icon = ImageMonikers.TapIconImageMoniker.ToProjectSystemType();
                break;

            case "VmState":
                propertyValues.Icon = ImageMonikers.VmStateIconImageMoniker.ToProjectSystemType();
                break;

            case "SpConf":
                propertyValues.Icon = ImageMonikers.SpConfIconImageMoniker.ToProjectSystemType();
                break;

            case "Z80Test":
                propertyValues.Icon = ImageMonikers.Z80TestIconImageMoniker.ToProjectSystemType();
                break;
                // --- Temporarily removed - I need nicer folder icons
                //case "Folder":
                //    if (propertyContext.ItemName == "TapeFiles")
                //    {
                //        propertyValues.Icon = ImageMonikers.TapeFolderImageMoniker.ToProjectSystemType();
                //        propertyValues.ExpandedIcon = ImageMonikers.TapeFolderImageMoniker.ToProjectSystemType();
                //    } else if (propertyContext.ItemName == "Z80CodeFiles")
                //    {
                //        propertyValues.Icon = ImageMonikers.Z80FolderImageMoniker.ToProjectSystemType();
                //        propertyValues.ExpandedIcon = ImageMonikers.Z80FolderImageMoniker.ToProjectSystemType();
                //    }
                //    break;
            }
        }
 private void ApplyProjectTreePropertiesCustomization(
     IProjectTreeCustomizablePropertyContext context,
     ReferencesProjectTreeCustomizablePropertyValues values)
 {
     foreach (var provider in ProjectTreePropertiesProviders.ExtensionValues())
     {
         provider.CalculatePropertyValues(context, values);
     }
 }
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues != null)
     {
         if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
         {
             propertyValues.Icon = KnownMonikers.NuGet.ToProjectSystemType();
         }
     }
 }
Example #7
0
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         //propertyValues.Icon = CosmosImagesMonikers.ProjectRootIcon.ToProjectSystemType();
         propertyValues.Icon = KnownMonikers.FeedbackSmile.ToProjectSystemType();
     }
 }
 /// <summary>
 /// Calculates new property values for each node in the project tree.
 /// </summary>
 /// <param name="propertyContext">Context information that can be used for the calculation.</param>
 /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     // Only set the icon for the root project node.  We could choose to set different icons for nodes based
     // on various criteria, not just Capabilities, if we wished.
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon = ImageMonikers.ProjectIconImageMoniker.ToProjectSystemType();
     }
 }
Example #9
0
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
 {
     // Package content items always come in as linked items, so to reduce
     // the number of items we look at, we limit ourselves to them
     if (propertyValues.Flags.Contains(ProjectTreeFlags.LinkedItem) &&
         propertyContext.Metadata != null &&
         propertyContext.Metadata.TryGetValue(None.NuGetPackageIdProperty, out string packageId) && packageId.Length > 0)
     {
         propertyValues.Flags |= ProjectTreeFlags.UserReadOnly;
     }
 }
        protected sealed override bool IsCandidateSpecialFolder(IProjectTreeCustomizablePropertyContext propertyContext, ProjectTreeFlags flags)
        {
            if (propertyContext.ParentNodeFlags.IsProjectRoot() && flags.IsFolder() && flags.IsIncludedInProject())
            {
                string folderName = propertyContext.ProjectTreeSettings[AppDesigner.FolderNameProperty];

                return(StringComparers.Paths.Equals(folderName, propertyContext.ItemName));
            }

            return(false);
        }
 /// <summary>
 /// Calculates new property values for each node in the project tree.
 /// </summary>
 /// <param name="propertyContext">Context information that can be used for the calculation.</param>
 /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     // set the icon for the root project node
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon         = NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
         propertyValues.ExpandedIcon = NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
     }
 }
Example #12
0
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues != null)
     {
         if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
         {
             // Set the icon
             // propertyValues.Icon = KnownMonikers.NuGet.ToProjectSystemType();
         }
     }
 }
        public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
        {
            if (!propertyValues.Flags.Contains(ProjectTreeFlags.Common.Folder))
            {
                if (!propertyValues.Flags.Contains(ProjectTreeFlags.Common.SourceFile | ProjectTreeFlags.Common.FileSystemEntity))
                {
                    return;
                }

                propertyValues.Icon = GetIconForItem(propertyContext.ItemName);
            }
        }
        private bool IsCandidateSpecialFolderItem(IProjectTreeCustomizablePropertyContext propertyContext, ProjectTreeFlags flags)
        {
            // We're a special folder item if our parent is the special folder. We rely on
            // the fact that "VisibleOnlyInShowAllFiles" is transitive; that is, if a parent
            // is marked with it, its children are also implicitly marked with it.
            if (propertyContext.ParentNodeFlags.Contains(FolderFlags))
            {
                return(flags.IsIncludedInProject());
            }

            return(false);
        }
 /// <summary>
 /// Calculates new property values for each node in the project tree.
 /// </summary>
 /// <param name="propertyContext">Context information that can be used for the calculation.</param>
 /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon = customIconsMonikers.ProjectIconImageMoniker.ToProjectSystemType();
     }
     else if (propertyContext.ItemType != null ? propertyContext.ItemType.Equals(ITEM_TYPE) : false)
     {
         propertyValues.Icon = customIconsMonikers.ItemIconImageMoniker.ToProjectSystemType();
     }
 }
        private bool TryGetDisplayOrder(IProjectTreeCustomizablePropertyContext propertyContext, out int displayOrder)
        {
            displayOrder = 0;

            if (propertyContext.IsFolder)
            {
                // Due to the lack of metadata/info in property context, we can only look up
                //     a physical/virtual folder by its name alone.
                return(_orderedMap.TryGetValue(propertyContext.ItemName, out displayOrder));
            }

            return(propertyContext.Metadata.TryGetValue(FullPathProperty, out string fullPath) &&
                   _orderedMap.TryGetValue(fullPath, out displayOrder));
        }
Example #17
0
        public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
        {
            Requires.NotNull(propertyContext, nameof(propertyContext));
            Requires.NotNull(propertyValues, nameof(propertyValues));

            if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
            {
                SetImage(propertyValues, IsSharedProject ? ProjectImageKey.SharedProjectRoot : ProjectImageKey.ProjectRoot);
            }
            else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.SharedItemsImportFile))
            {
                SetImage(propertyValues, ProjectImageKey.SharedItemsImportFile);
            }
        }
Example #18
0
        /// <summary>
        /// Calculates new property values for each node in the project tree.
        /// </summary>
        /// <param name="propertyContext">Context information that can be used for the calculation.</param>
        /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
        public void CalculatePropertyValues(
            IProjectTreeCustomizablePropertyContext propertyContext,
            IProjectTreeCustomizablePropertyValues propertyValues)
        {
            // Only set the icon for the root project node.  We could choose to set different icons for nodes based
            // on various criteria, not just Capabilities, if we wished.
            if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
            {
                propertyValues.Icon = ImageMonikers.ProjectIconImageMoniker.ToProjectSystemType();
            }

            switch (propertyContext.ItemType)
            {
            case "DisassAnn":
                propertyValues.Icon = ImageMonikers.DisassAnnIconImageMoniker.ToProjectSystemType();
                break;

            case "Z80Asm":
                propertyValues.Icon = ImageMonikers.Z80AsmIconImageMoniker.ToProjectSystemType();
                break;

            case "Rom":
                propertyValues.Icon = ImageMonikers.RomIconImageMoniker.ToProjectSystemType();
                break;

            case "Tzx":
                propertyValues.Icon = ImageMonikers.TzxIconImageMoniker.ToProjectSystemType();
                break;

            case "Tap":
                propertyValues.Icon = ImageMonikers.TapIconImageMoniker.ToProjectSystemType();
                break;

            case "VmState":
                propertyValues.Icon = ImageMonikers.VmStateIconImageMoniker.ToProjectSystemType();
                break;

            case "SpConf":
                propertyValues.Icon = ImageMonikers.SpConfIconImageMoniker.ToProjectSystemType();
                break;

            case "Z80Test":
                propertyValues.Icon = ImageMonikers.Z80TestIconImageMoniker.ToProjectSystemType();
                break;

            case "Vfdd":
                propertyValues.Icon = ImageMonikers.FloppyIconImageMoniker.ToProjectSystemType();
                break;
            }
        }
        public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
        {
            Requires.NotNull(propertyContext, nameof(propertyContext));
            Requires.NotNull(propertyValues, nameof(propertyValues));

            if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
            {
                ProjectImageMoniker icon = _imageProvider.GetProjectImage(ProjectImageKey.ProjectRoot);
                if (icon == null)
                {
                    return;
                }

                propertyValues.Icon = icon;
            }
        }
        public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
        {
            if (propertyValues.Flags.Contains(ProjectTreeFlags.ProjectRoot))
            {
                propertyValues.Icon = XSharpImagesMonikers.ProjectImage.ToProjectSystemType();
            }
            if (!propertyValues.Flags.Contains(ProjectTreeFlags.Common.Folder))
            {
                if (!propertyValues.Flags.Contains(ProjectTreeFlags.Common.SourceFile | ProjectTreeFlags.Common.FileSystemEntity))
                {
                    return;
                }

                propertyValues.Icon = GetIconForItem(propertyContext.ItemName);
            }
        }
Example #21
0
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         propertyValues.Icon = ProjectTreeIcons.GetProjectIcon();
     }
     else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk))
     {
         string name = propertyContext.ItemName.ToLowerInvariant();
         ProjectImageMoniker icon = ProjectTreeIcons.GetChildIcon(name);
         if (icon != null)
         {
             propertyValues.Icon = icon;
         }
     }
 }
Example #22
0
 /// <summary>
 /// Calculates new property values for each node in the project tree.
 /// </summary>
 /// <param name="propertyContext">Context information that can be used for the calculation.</param>
 /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk))
     {
         // icons for file items:
         var ext = Path.GetExtension(propertyContext.ItemName);
         if (ext != null && s_iconsByExtension.TryGetValue(ext, out var moniker))
         {
             propertyValues.Icon = moniker;
         }
     }
     else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
     {
         // project node icon:
         propertyValues.Icon = ImageCatalog.ProjectIcon.ToProjectSystemType();
     }
 }
 public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext,
                                     IProjectTreeCustomizablePropertyValues propertyValues) {
     if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot)) {
         propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType();
     } else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk)) {
         string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant();
         if (ext == ".r") {
             propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType();
         } else if (ext == ".rdata" || ext == ".rhistory") {
             propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType();
         } else if (ext == ".md" || ext == ".rmd") {
             propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType();
         } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension)) {
             propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType();
         } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension)) {
             propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType();
         }
     }
 }
        public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
        {
            Requires.NotNull(propertyContext, nameof(propertyContext));
            Requires.NotNull(propertyValues, nameof(propertyValues));

            if (!IsSupported)
            {
                return;
            }

            if (IsCandidateSpecialFolder(propertyContext, propertyValues.Flags))
            {
                ApplySpecialFolderProperties(propertyValues);
                return;
            }

            if (AreContentsVisibleOnlyInShowAllFiles(propertyContext.ProjectTreeSettings) && IsCandidateSpecialFolderItem(propertyContext, propertyValues.Flags))
            {
                ApplySpecialFolderItemProperties(propertyValues);
                return;
            }
        }
 /// <summary>
 /// Assign a display order property to items that have previously been preordered
 /// or other (hidden) items under the project root that are not folders
 /// </summary>
 /// <param name="propertyContext">context for the tree item being evaluated</param>
 /// <param name="propertyValues">mutable properties that can be changed to affect display order etc</param>
 public void CalculatePropertyValues(
     IProjectTreeCustomizablePropertyContext propertyContext,
     IProjectTreeCustomizablePropertyValues propertyValues)
 {
     if (propertyValues is IProjectTreeCustomizablePropertyValues2 propertyValues2)
     {
         // assign display order to folders and items that appear in order map
         if (TryGetDisplayOrder(propertyContext, out int displayOrder))
         {
             // sometimes these items temporarily have null item type. Ignore these cases
             if (propertyContext.ItemType != null)
             {
                 propertyValues2.DisplayOrder = displayOrder;
             }
         }
         else if (!propertyContext.IsFolder)
         {
             // move unordered non-folder items to the end
             // (this will typically be hidden items visible on "Show All Files")
             propertyValues2.DisplayOrder = int.MaxValue;
         }
     }
 }
 /// <summary>
 ///     Returns a value indicating whether the specified property context represents the candidate special folder.
 /// </summary>
 protected abstract bool IsCandidateSpecialFolder(IProjectTreeCustomizablePropertyContext propertyContext, ProjectTreeFlags flags);