1: using System;
2: using System.Drawing.Design;
3: using System.ComponentModel;
4: using System.Windows.Forms;
5: using System.Windows.Forms.Design;
6: using System.Security;
7: using System.Security.Permissions;
8:
9: namespace Primavera.Athena.Models.Entities
10: { 11: /// <summary>
12: /// Implements the ModelDefinitionFile domain attribute property
13: /// editor.
14: /// </summary>
15: public class ModelDefinitionFileTypeEditor : UITypeEditor
16: { 17: #region Public Methods
18:
19: /// <summary>
20: /// Gets the editor style used by the <see cref="M:System.Drawing.Design.UITypeEditor.EditValue(System.IServiceProvider,System.Object)"></see> method.
21: /// </summary>
22: /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information.</param>
23: /// <returns>
24: /// A <see cref="T:System.Drawing.Design.UITypeEditorEditStyle"></see> value that indicates the style of editor used by the <see cref="M:System.Drawing.Design.UITypeEditor.EditValue(System.IServiceProvider,System.Object)"></see> method. If the <see cref="T:System.Drawing.Design.UITypeEditor"></see> does not support this method, then <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> will return <see cref="F:System.Drawing.Design.UITypeEditorEditStyle.None"></see>.
25: /// </returns>
26: [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
27: public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
28: { 29: // Return value
30:
31: if (context != null)
32: { 33: return UITypeEditorEditStyle.Modal;
34: }
35:
36: // Default behavior
37:
38: return base.GetEditStyle(context);
39: }
40:
41: /// <summary>
42: /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method.
43: /// </summary>
44: /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information.</param>
45: /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services.</param>
46: /// <param name="value">The object to edit.</param>
47: /// <returns>
48: /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
49: /// </returns>
50: [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
51: public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
52: { 53: // Default behavior
54:
55: return base.EditValue(context, provider, value);
56: }
57:
58: #endregion
59: }
60: }