public void OnUserSettingsChanged() { ThreadHelper.ThrowIfNotOnUIThread(); GeneralSettingsPageGrid settings = EditorUtils.GetGeneralSettings(); LayoutWindow win = EditorUtils.GetLayoutWindow(false); ApplyUserSettingsToWindow(win, settings); }
private void ApplyUserSettingsToWindow(LayoutWindow window, GeneralSettingsPageGrid settings) { if (window == null || settings == null) { return; } window.SetGridNumberBase(settings.OptionViewerGridBase); }
static public void FocusWindow(LayoutWindow window) { ThreadHelper.ThrowIfNotOnUIThread(); if (window != null) { window.ProxyShow(); } }
public async System.Threading.Tasks.Task ParseAtCurrentLocationAsync() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputLog.Clear(); EditorUtils.SaveActiveDocument(); DocumentLocation location = GetCurrentLocation(); if (location == null) { string msg = "Unable to retrieve current document position."; OutputLog.Error(msg); ParseMessageWindow.Display(new ParseMessageContent(msg)); } ProjectProperties properties = GetProjectData(); if (properties == null) { string msg = "Unable to retrieve the project configuration"; OutputLog.Error(msg); ParseMessageWindow.Display(new ParseMessageContent(msg)); return; } GeneralSettingsPageGrid settings = EditorUtils.GetGeneralSettings(); parser.PrintCommandLine = settings.OptionParserShowCommandLine; //TODO ~ ramonv ~ add parsing queue to avoid multiple queries at the same time LayoutWindow prewin = EditorUtils.GetLayoutWindow(false); if (prewin != null) { prewin.SetProcessing(); } ParseResult result = await parser.ParseAsync(properties, location); //Only create or focus the window if we have a valid result LayoutWindow win = EditorUtils.GetLayoutWindow(result.Status == ParseResult.StatusCode.Found); if (win != null) { win.SetResult(result); if (result.Status == ParseResult.StatusCode.Found) { EditorUtils.FocusWindow(win); } } DisplayResult(result); }
/// <summary> /// Shows the tool window when the menu item is clicked. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); LayoutWindow win = EditorUtils.GetLayoutWindow(true); if (win != null) { EditorUtils.FocusWindow(win); } }
static public LayoutWindow GetLayoutWindow(bool create = true) { ThreadHelper.ThrowIfNotOnUIThread(); // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. LayoutWindow window = Package.FindToolWindow(typeof(LayoutWindow), 0, create) as LayoutWindow; if ((null == window) || (null == window.GetFrame())) { return(null); } return(window); }