/// <summary> /// Attach the Manager model and ManagerView to this presenter. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view to attach</param> /// <param name="presenter">The explorer presenter being used</param> public void Attach(object model, object view, ExplorerPresenter presenter) { manager = model as Manager; managerView = view as IManagerView; explorerPresenter = presenter; intellisense = new IntellisensePresenter(managerView as ViewBase); intellisense.ItemSelected += OnIntellisenseItemSelected; scriptModel = manager.Children.FirstOrDefault(); // See if manager script has a description attribute on it's class. if (scriptModel != null) { DescriptionAttribute descriptionName = ReflectionUtilities.GetAttribute(scriptModel.GetType(), typeof(DescriptionAttribute), false) as DescriptionAttribute; if (descriptionName != null) { explorerPresenter.ShowDescriptionInRightHandPanel(descriptionName.ToString()); } } propertyPresenter.Attach(scriptModel, managerView.GridView, presenter); managerView.Editor.Mode = EditorType.ManagerScript; managerView.Editor.Text = manager.Code; managerView.Editor.ContextItemsNeeded += OnNeedVariableNames; managerView.Editor.LeaveEditor += OnEditorLeave; managerView.Editor.AddContextSeparator(); managerView.Editor.AddContextActionWithAccel("Test compile", OnDoCompile, "Ctrl+T"); managerView.Editor.AddContextActionWithAccel("Reformat", OnDoReformat, "Ctrl+R"); managerView.Editor.Location = manager.Location; managerView.TabIndex = manager.ActiveTabIndex; presenter.CommandHistory.ModelChanged += CommandHistory_ModelChanged; }
/// <summary> /// Attach the Manager model and ManagerView to this presenter. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view to attach</param> /// <param name="presenter">The explorer presenter being used</param> public void Attach(object model, object view, ExplorerPresenter presenter) { manager = model as Manager; managerView = view as IManagerView; explorerPresenter = presenter; intellisense = new IntellisensePresenter(managerView as ViewBase); intellisense.ItemSelected += OnIntellisenseItemSelected; scriptModel = manager.Children.FirstOrDefault(); // See if manager script has a description attribute on it's class. if (scriptModel != null) { DescriptionAttribute descriptionName = ReflectionUtilities.GetAttribute(scriptModel.GetType(), typeof(DescriptionAttribute), false) as DescriptionAttribute; if (descriptionName != null) { explorerPresenter.ShowDescriptionInRightHandPanel(descriptionName.ToString()); } } if (Configuration.Settings.UseNewPropertyPresenter) { propertyPresenter = new SimplePropertyPresenter(); } else { propertyPresenter = new PropertyPresenter(); } try { propertyPresenter.Attach(scriptModel, managerView.PropertyEditor, presenter); } catch (Exception err) { explorerPresenter.MainPresenter.ShowError(err); } managerView.Editor.Mode = EditorType.ManagerScript; managerView.Editor.Text = manager.Code; #if NETFRAMEWORK // In gtk3 builds, the gtksourceview completion infrastructure // handles all of the completion functionality internally. managerView.Editor.ContextItemsNeeded += OnNeedVariableNames; #endif managerView.Editor.LeaveEditor += OnEditorLeave; managerView.Editor.AddContextSeparator(); managerView.Editor.AddContextActionWithAccel("Test compile", OnDoCompile, "Ctrl+T"); managerView.Editor.AddContextActionWithAccel("Reformat", OnDoReformat, "Ctrl+R"); managerView.Editor.Location = manager.Location; managerView.TabIndex = manager.ActiveTabIndex; presenter.CommandHistory.ModelChanged += CommandHistory_ModelChanged; }