/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using JetBrains.Omea.OpenAPI; using JetBrains.Omea.OpenApiEx; namespace JetBrains.Omea.CoreServicesEx.ProgressManager { /// /// Hands out various Progress Manager data. /// internal class ProgressManagerData : IProgressManagerData { /// /// Stores the lazy-init singleton instance. /// protected static IProgressManagerData _instance = null; /// /// Non-public singleton ctor. /// protected ProgressManagerData() { } /// /// Name of the resource type for Progress Item resources. /// The use of the corresponding integer Resource Type ID is preferred in most cases. /// internal static readonly string _sProgressItemResourceTypeName = "ProgressManager.Item"; /// /// Lazy-init backup for the corresponding Resource ID property. /// protected int _nProgressItemResourceType = 0; /// /// Name of the resource type for Folder resources. /// The use of the corresponding integer Resource Type ID is preferred in most cases. /// internal static readonly string _sFolderResourceTypeName = "Folder"; // TODO: use the common “Folder” restype, when common infrastructure gets avail protected int _nFolderResourceType = 0; internal static readonly string _sMultiParentLinkName = "MultiParent"; // TODO: use the common “Multiparent” restype protected int _nMultiParentLink = 0; /// /// Gets the singleton instance of the object. /// public static IProgressManagerData Instance { get { return _instance ?? (_instance = new ProgressManagerData()); } } /// /// Gets the name of the resource type for Progress Item resources. /// The use of the corresponding integer Resource Type ID is preferred in most cases. /// public string ProgressItemResourceTypeName { get { return _sProgressItemResourceTypeName; } } /// /// ID of the resource type for Progress Item resources. /// You should use this ID rather than string resource name, wherever possible. /// It's unsafe to access this property on startup. /// public int ProgressItemResourceType { get { if(_nProgressItemResourceType == 0) _nProgressItemResourceType = OpenAPI.Core.ResourceStore.ResourceTypes[_sProgressItemResourceTypeName].Id; return _nProgressItemResourceType; } } /// /// Gets the name of the resource type for Folder resources. /// The use of the corresponding integer Resource Type ID is preferred in most cases. /// public string FolderResourceTypeName { get { return _sFolderResourceTypeName; } } /// /// ID of the resource type for Folder resources. /// You should use this ID rather than string resource name, wherever possible. /// It's unsafe to access this property on startup. /// public int FolderResourceType { get { if(_nFolderResourceType == 0) _nFolderResourceType = OpenAPI.Core.ResourceStore.ResourceTypes[_sFolderResourceTypeName].Id; return _nFolderResourceType; } } /// /// Gets the link type name for the Multiple Parent link. /// The use of the corresponding integer ID is preferred in most cases. /// public string MultiParentLinkName { get { return _sMultiParentLinkName; } } /// /// Gets the link type ID for the Multiple Parent link. /// You should use this ID rather than string name, wherever possible. /// It's unsafe to access this property on startup. /// public int MultiParentLink { get { if(_nMultiParentLink == 0) _nMultiParentLink = OpenAPI.Core.ResourceStore.PropTypes[_sMultiParentLinkName].Id; return _nMultiParentLink; } } /// /// Gets the root resource for all the progress infratructure. /// public IResource RootResource { get { return OpenAPI.Core.ResourceTreeManager.GetRootForType(_sProgressItemResourceTypeName); } } } }