Example #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="project">Project.</param>
        /// <param name="dataObject">DataObject.</param>
        public DataObjectNode(Project project, SObjectTypePartial dataObject)
        {
            if (project == null)
                throw new ArgumentNullException("project");
            if (dataObject == null)
                throw new ArgumentNullException("dataObject");

            Project = project;
            DataObject = dataObject;
        }
Example #2
0
        /// <summary>
        /// Show properties window.
        /// </summary>
        public override void Execute()
        {
            object item = GetSelectedItem();

            if (item is SourceFile)
            {
                SourceFile       file = item as SourceFile;
                PropertiesWindow dlg  = new PropertiesWindow();
                dlg.AddProperty("Name", file.Name);

                if (!String.IsNullOrWhiteSpace(file.Id))
                {
                    dlg.AddProperty("Id", file.Id);
                }

                dlg.AddProperty("File", file.FileName);
                dlg.AddProperty("State", file.State.ToString());
                dlg.AddProperty("Changed by", file.ChangedBy == null ? String.Empty : file.ChangedBy.Name);
                dlg.AddProperty("Changed on", file.ChangedOn.ToLocalTime().ToString());
                dlg.AddProperty("Created by", file.CreatedBy == null ? String.Empty : file.CreatedBy.Name);
                dlg.AddProperty("Created on", file.CreatedOn.ToLocalTime().ToString());

                if (!String.IsNullOrWhiteSpace(file.Id) && App.Instance.SalesForceApp.CurrentProject != null)
                {
                    using (SearchIndex searchIndex = new SearchIndex(App.Instance.SalesForceApp.CurrentProject.SearchFolder))
                        dlg.AddProperty("Indexed for search", searchIndex.IsIndexed(file) ? "Yes" : "No");
                }

                if (!String.IsNullOrWhiteSpace(file.Id) &&
                    App.Instance.SalesForceApp.CurrentProject != null &&
                    App.Instance.SalesForceApp.CurrentProject.Client.Checkout.IsEnabled())
                {
                    dlg.AddProperty("Checked out by", file.CheckedOutBy == null ? String.Empty : file.CheckedOutBy.Name);
                }

                App.ShowDialog(dlg);
            }
            else if (item is SObjectTypePartial)
            {
                SObjectTypePartial dataObject = item as SObjectTypePartial;
                PropertiesWindow   dlg        = new PropertiesWindow();
                dlg.AddProperty("Name", dataObject.Name);
                dlg.AddProperty("Label", dataObject.Label);
                dlg.AddProperty("Plural label", dataObject.LabelPlural);

                App.ShowDialog(dlg);
            }
            else if (item is SObjectFieldType)
            {
                SObjectFieldType dataField = item as SObjectFieldType;
                PropertiesWindow dlg       = new PropertiesWindow();
                dlg.AddProperty("Name", dataField.Name);
                dlg.AddProperty("Label", dataField.Label);
                dlg.AddProperty("Type", dataField.FieldType.ToString());
                if (dataField.FieldType == FieldType.Reference && dataField.ReferenceTo != null)
                {
                    foreach (string referenceTo in dataField.ReferenceTo)
                    {
                        dlg.AddProperty("Reference to", referenceTo);
                    }
                }
                if (dataField.Calculated == true)
                {
                    dlg.AddProperty("Formula", dataField.CalculatedFormula);
                }
                dlg.AddProperty("Length", dataField.Length.ToString());

                App.ShowDialog(dlg);
            }
        }