private void nameComboBox_SelectedValueChanged(object sender, EventArgs e) { PropertyEditControl selectedItem = (PropertyEditControl)this.nameComboBox.SelectedItem; // is the selection a special svn: keyword? if (selectedItem != null) { SetNewEditor(selectedItem); } }
/// <summary> /// Adds the property editor if it allows the current SvnItem's node kind /// </summary> /// <param name="propEditor">IPropertyEditor</param> private void AddPropertyEditor(PropertyEditControl propEditor) { if (!propEditor.AllowNodeKind(_currentNodeKind)) { return; } // TODO: Perhaps allow applying file properties recursively on a folder string key = propEditor.ToString(); this.keyPropEditor.Add(key, propEditor); }
private void SetNewEditor(PropertyEditControl editor) { if (this._currentEditor != null) { //Unsubscribe the current editor from the Changed event. this._currentEditor.Changed -= new EventHandler( this.currentEditor_Changed); } //Clear the editor panel and add the new editor. this.editorPanel.Controls.Clear(); this.editorPanel.Controls.Add((Control)editor); ((Control)editor).Dock = DockStyle.Fill; //Sets the current editor to match the selected item. this._currentEditor = editor; UpdateButtons(); // allow new peoperty editor to determine the initial button states this._currentEditor.Changed += new EventHandler( this.currentEditor_Changed); }
/// <remarks> /// If the typed name is a built-in svn property, sets combo selection to the editor. /// If the typed name is a custom property, create a new <code>PlainPropertyEditor</code> /// </remarks> private void nameComboBox_TextChanged(object sender, EventArgs e) { string typedName = this.nameComboBox.Text; if (this.keyPropEditor.ContainsKey(typedName)) { PropertyEditControl propEditor = this.keyPropEditor[typedName]; this.nameComboBox.SelectedItem = propEditor; } else { if (this._currentEditor == null || !(this._currentEditor is PlainPropertyEditor)) { this.SetNewEditor(new PlainPropertyEditor()); } } if (this._currentEditor != null) { this._currentEditor.PropertyName = this.nameComboBox.Text; } }
/// <summary> /// Adds the property editor if it allows the current SvnItem's node kind /// </summary> /// <param name="propEditor">IPropertyEditor</param> private void AddPropertyEditor(PropertyEditControl propEditor) { if (!propEditor.AllowNodeKind(_currentNodeKind)) return; // TODO: Perhaps allow applying file properties recursively on a folder string key = propEditor.ToString(); this.keyPropEditor.Add(key, propEditor); }