public SetOfCIViewModel(ManifestEditorViewModel m, DescriptorProperty pd, Entry entry) : base(m, pd, entry)
        {
            var entryProperty = GetEntryProperty();
            var ciSet = (entryProperty == null ? new HashSet<string>() : entryProperty.GetSetOfCI());

            CiRefs = new ObservableCollection<string>(ciSet);
            if (CiRefs.Count == 0) { CiRefs.Add(NO_CIS); }
        }
        public ListOfCIViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
            :base(manifestEditor, propertyDescriptor, entry)
        {
            var entryProperty = GetEntryProperty();
            var ciSet = (entryProperty == null ? new List<string>{ SetOfCIViewModel.NO_CIS } : entryProperty.GetListOfCI());

            CiRefs = new ObservableCollection<string>(ciSet);
            SelectedCIIndex = -1;
        }
		public ListOrSetOfStringEditorViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
			: base(manifestEditor, propertyDescriptor, entry)
		{
			var property = GetEntryProperty();
		    if (property == null) return;

		    var items = property.GetListofStringValue();
		    if (items.Count > 0)
		    {
		        Value = string.Join(Environment.NewLine, items);
		    }
		}
		public IntegerPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
			: base(manifestEditor, propertyDescriptor, entry)
		{
			var property = GetEntryProperty();
		    if (property == null) { return; }

		    var intValue = property.GetIntValue();
		    if (intValue.HasValue)
		    {
		        _stringValue = intValue.Value.ToString(CultureInfo.InvariantCulture);
		    }
		}
		private PropertyEntryEditorViewModel GetPropertyEditor(DescriptorProperty propertyDescriptor)
		{
			if (propertyDescriptor.Name == "placeholders")
			{
				return null;
			}

			if (propertyDescriptor.AsContainment)
			{
				return null;
			}
			if (propertyDescriptor.IsStringEnum)
			{
				return new EnumPropertyEntryEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
			}
		    if (propertyDescriptor.IsString)
		    {
		        return new StringPropertyEntryEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsSetOrListOfString)
		    {
		        return new ListOrSetOfStringEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsBoolean)
		    {
		        return new BooleanPropertyEntryEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsMapStringString)
		    {
		        return new MapStringStringEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsInteger)
		    {
		        return new IntegerPropertyEntryEditorViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsSetOfCi)
		    {
		        return new SetOfCIViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsListOfCi)
		    {
		        return new ListOfCIViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }
		    if (propertyDescriptor.IsCiReference)
		    {
		        return new CIReferenceViewModel(_manifestEditor, propertyDescriptor, Entry);
		    }

            throw new InvalidOperationException("Unhandled property type: " + propertyDescriptor.Kind);
		}
 public BooleanPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor,
                                            DescriptorProperty propertyDescriptor, Entry entry)
     : base(manifestEditor, propertyDescriptor, entry)
 {
     AvailableValues = new List<KeyValuePair<string, bool?>>
         {
             new KeyValuePair<string, bool?>(Resources.PROPERTY_BOOL_TRUE, true),
             new KeyValuePair<string, bool?>(Resources.PROPERTY_BOOL_FALSE, false),
             new KeyValuePair<string, bool?>(Resources.PROPERTY_BOOL_ND, null)
         };
     EntryProperty property = GetEntryProperty();
     if (property != null)
     {
         Value = property.GetBoolValue();
     }
 }
		public StringPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
			: base(manifestEditor, propertyDescriptor, entry)
		{

			var property = GetEntryProperty();

			if (property != null)
			{
				Value = property.GetStringValue() ?? string.Empty;
			}
			else
			{
				if (propertyDescriptor != null && propertyDescriptor.DefaultValue != null)
				{
					Value = propertyDescriptor.DefaultValue;
				}
			}
		}
        public EnumPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor,
                                                DescriptorProperty propertyDescriptor, Entry entry)
            : base(manifestEditor, propertyDescriptor, entry)
        {
            var values = new List<KeyValuePair<string, string>>
                {
                    new KeyValuePair<string, string>(Resources.PROPERTY_ENUM_ND, null)
                };

            values.AddRange(propertyDescriptor.EnumValues.Select(_ => new KeyValuePair<string, string>(_, _)));

            AvailableValues = values;

            EntryProperty property = GetEntryProperty();
            if (property != null)
            {
                Value = property.GetEnumValue();
            }
        }
	    /// <summary>
	    /// Initializes a new instance of the PropertyItemViewModel class.
	    /// </summary>
	    public PropertyItemViewModel(DescriptorProperty descriptorProperty, EntryItemViewModel parent,
	        ManifestEditorViewModel editor)
	        : base(parent)
	    {
	        if (descriptorProperty == null)
	            throw new ArgumentNullException("descriptorProperty", "descriptorProperty is null.");
	        if (parent == null)
	            throw new ArgumentNullException("parent", "parent is null.");
	        if (editor == null)
	            throw new ArgumentNullException("editor", "editor is null.");

	        var referencedType = descriptorProperty.ReferencedType;
	        if (!descriptorProperty.AsContainment || string.IsNullOrWhiteSpace(referencedType))
	        {
	            throw new ArgumentException("Invalid descriptor property");
	        }

	        _descriptorProperty = descriptorProperty;
	        _editor = editor;
	        TreeItemLabel = descriptorProperty.Label;

	        var childDescriptors = new List<Descriptor>(
	            _editor.AllDescriptors.Values.Where(
	                d => !d.IsVirtual && (
	                    d.Type == referencedType
	                    || d.Supertypes.Contains(referencedType)
	                    || d.Interfaces.Contains(referencedType))));

	        _entryProperty = parent.Entry.GetPropertyAndCreateIfN(descriptorProperty.Name);

	        IsExpanded = true;

	        MenuItems = new List<MenuItemViewModel>
	        {
	            new MenuItemViewModel(Properties.Resources.EDITOR_NEW_CI, null, new List<MenuItemViewModel>(
	                from descriptor in childDescriptors
	                select new MenuItemViewModel(descriptor.Type, new DelegateCommand(() => DoAdd(descriptor)), null)
	                ))
	        };
	    }
		public MapStringStringEditorViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
			: base(manifestEditor, propertyDescriptor, entry)
		{
			Items = new ObservableCollection<MapStringOfStringItemViewModel>();
		}
		protected PropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
		{
			ManifestEditor = manifestEditor;
			PropertyDescriptor = propertyDescriptor;
			Entry = entry;
		}
 public CIReferenceViewModel(ManifestEditorViewModel manifestEditor, DescriptorProperty propertyDescriptor, Entry entry)
     : base(manifestEditor, propertyDescriptor, entry)
 {
     var entryProperty = GetEntryProperty();
     ReferencedCI = entryProperty == null ? "" : entryProperty.GetCIReferenceValue();
 }