public static void UpdateDisplayedPropertyGridProperties()
        {
            TreeNode node = GlueState.Self.CurrentTreeNode;

            ///////////////Early Out/////////////////////
            if (node == null)
            {
                return;
            }
            ////////////End Early Out///////////////////

            if (node.IsNamedObjectNode())
            {
                PropertyGridHelper.UpdateNamedObjectDisplay();
            }
            else if (node.IsReferencedFile())
            {
                PropertyGridHelper.UpdateReferencedFileSaveDisplay();
            }
            else if (node.IsEventResponseTreeNode())
            {
                PropertyGridHelper.UpdateEventResponseSaveDisplayer();
            }
            else if (node.IsEntityNode())
            {
                PropertyGridHelper.UpdateEntitySaveDisplay();
            }
            else if (node.IsScreenNode())
            {
                PropertyGridHelper.UpdateScreenSaveDisplay();
            }
            else if (node.IsCustomVariable())
            {
                PropertyGridHelper.UpdateCustomVariableDisplay();
            }
            else if (node.IsStateNode())
            {
                PropertyGridHelper.UpdateStateSaveDisplay();
            }
            else if (node.IsStateCategoryNode())
            {
                PropertyGridHelper.UpdateStateCategorySave();
            }
            else if (node.IsGlobalContentContainerNode() && ProjectManager.GlueProjectSave != null)
            {
                MainGlueWindow.Self.PropertyGrid.SelectedObject = ProjectManager.GlueProjectSave.GlobalContentSettingsSave;
            }
            else if (node.IsRootCustomVariablesNode())
            {
                ElementViewWindow.ShowAllElementVariablesInPropertyGrid();
            }
            else
            {
                MainGlueWindow.Self.PropertyGrid.SelectedObject = null;
            }
        }
예제 #2
0
        public static void AfterSelect()
        {
            // tree node click
            TreeNode node = SelectedNode;

            bool isCode = !string.IsNullOrEmpty(EditorLogic.CurrentCodeFile);

            #region Make translation info on this file if necessary

            if (isCode)
            {
                ProjectManager.GlueProjectSave.CreateTranslatedFileSaveIfNecessary(
                    EditorLogic.CurrentCodeFile);

                MainGlueWindow.Self.PropertyGrid.SelectedObject = ProjectManager.GlueProjectSave.GetTranslatedFileSave(
                    EditorLogic.CurrentCodeFile);
            }

            #endregion

            PropertyGridHelper.UpdateDisplayedPropertyGridProperties();

            #region Show the appropriate preview

            if (isCode)
            {
                if (FileManager.FileExists(EditorLogic.CurrentCodeFile))
                {
                    MainGlueWindow.Self.CodePreviewTextBox.Text = FileManager.FromFileText(EditorLogic.CurrentCodeFile);
                }
                else
                {
                    MessageBox.Show("Could not find the file\n\n" + EditorLogic.CurrentCodeFile);
                    // This file no longer exists, so let's refresh the property grid
                    EditorLogic.CurrentElementTreeNode.UpdateReferencedTreeNodes();
                }
            }
            else
            {
                MainGlueWindow.Self.CodePreviewTextBox.Text = null;
            }

            #endregion


            EditorLogic.TakeSnapshot();

            bool wasFocused = mTreeView?.Focused == true;
            VisibilityManager.ReactivelySetItemViewVisibility();
            if (!SuppressSelectionEvents)
            {
                PluginManager.ReactToItemSelect(node);
            }
            // ReactivelySetItemViewVisibility may add or remove controls, and as a result the
            // list view may lose focus. We dont' want that to happen so we will explicitly put
            // focus on the control:
            if (wasFocused)
            {
                mTreeView.Focus();
            }
        }