Beispiel #1
0
        void GlobalSetup()
        {
            //FIXME: should we remove these when finalizing?
            try {
                ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                {
                    // We can only attempt to quit safely if all windows are GTK windows and not modal
                    if (!IsModalDialogRunning())
                    {
                        e.UserCancelled = !IdeApp.Exit();
                        e.Handled       = true;
                        return;
                    }

                    // When a modal dialog is running, things are much harder. We can't just shut down MD behind the
                    // dialog, and aborting the dialog may not be appropriate.
                    //
                    // There's NSTerminateLater but I'm not sure how to access it from carbon, maybe
                    // we need to swizzle methods into the app's NSApplicationDelegate.
                    // Also, it stops the main CFRunLoop and enters a special runloop mode, not sure how that would
                    // interact with GTK+.

                    // For now, just bounce
                    NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest);
                    // and abort the quit.
                    e.UserCancelled = true;
                    e.Handled       = true;
                };

                ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e) {
                    if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null)
                    {
                        IdeApp.Workbench.RootWindow.Deiconify();
                        IdeApp.Workbench.RootWindow.Visible = true;

                        IdeApp.Workbench.RootWindow.Present();
                        e.Handled = true;
                    }
                };

                ApplicationEvents.OpenDocuments += delegate(object sender, ApplicationDocumentEventArgs e) {
                    //OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
                    GLib.Timeout.Add(10, delegate {
                        IdeApp.OpenFiles(e.Documents.Select(doc =>
                                                            new FileOpenInformation(doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
                        return(false);
                    });
                    e.Handled = true;
                };

                //if not running inside an app bundle (at dev time), need to do some additional setup
                if (NSBundle.MainBundle.InfoDictionary ["CFBundleIdentifier"] == null)
                {
                    SetupWithoutBundle();
                }
            } catch (Exception ex) {
                LoggingService.LogError("Could not install app event handlers", ex);
                setupFail = true;
            }
        }
 public void SetUp()
 {
     if (!IdeApp.IsInitialized)
     {
         IdeApp.Initialize(new ProgressMonitor());
     }
 }
Beispiel #3
0
        static void ShowVoiceOverNotice()
        {
            var alert = new NSAlert();

            alert.MessageText     = GettextCatalog.GetString("Assistive Technology Detected");
            alert.InformativeText = GettextCatalog.GetString("{0} has detected an assistive technology (such as VoiceOver) is running. Do you want to restart {0} and enable the accessibility features?", BrandingService.ApplicationName);
            alert.AddButton(GettextCatalog.GetString("Restart and enable"));
            alert.AddButton(GettextCatalog.GetString("No"));

            var result = alert.RunModal();

            switch (result)
            {
            case 1000:
                NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;
                defaults.SetBool(true, EnabledKey);
                defaults.Synchronize();

                IdeApp.Restart();
                break;

            default:
                break;
            }
        }
        protected override void Run()
        {
            var item = IdeApp.ProjectOperations.CurrentSelectedProject;

            IdeApp.OpenFiles(new [] {
                new FileOpenInformation(item.Files[0].FilePath, item.Files[0].Project)
            });


            //var userp = item.UserProperties;
            //var pp = item.ProjectProperties.GetProperties();

            //var pol = item.Policies.DirectGetAll ();

            //foreach (var po in pol)
            //{
            //	if (po.PolicyType == typeof(TextStylePolicy))
            //	{
            //		var scope = po.Scope;
            //		var tsp = po.Policy as TextStylePolicy;

            //		if (tsp.TabsToSpaces)
            //		{
            //			Console.WriteLine("TABS TO SPACES");
            //		}
            //	}
            //}
            //foreach (var p in pp)
            //{
            //	Console.WriteLine(p.Name + " : " + p.Value);


            //}
            //Console.WriteLine(pp);
        }
        public ProjectTemplateTest(string basename, string templateId)
        {
            if (templatingService == null)
            {
                templatingService = new TemplatingService();
            }

            if (!IdeApp.IsInitialized)
            {
                IdeApp.Initialize(Util.GetMonitor());
            }

            this.templateId = templateId;

            SolutionDirectory = Util.CreateTmpDir(basename);
            CreateNuGetConfigFile(SolutionDirectory);
            ProjectName = GetProjectName(templateId);

            Config = new NewProjectConfiguration {
                CreateSolution = true,
                CreateProjectDirectoryInsideSolutionDirectory = true,
                CreateGitIgnoreFile = false,
                UseGit       = false,
                Location     = SolutionDirectory,
                ProjectName  = ProjectName,
                SolutionName = ProjectName
            };

            Directory.CreateDirectory(Config.ProjectLocation);
        }
Beispiel #6
0
        public async Task TestToggle_Visible()
        {
            IdeApp.Initialize(new Core.ProgressMonitor());
            //This dummyEditor is just so we can reuse CreateTextEditor code
            //to resolve offset for us
            var dummyEditor = CreateTextEditor(@"class Foo
{
	void Bar ()
	{
		//$test
	}
}");
            //We need to create full document and not just editor
            //so extensions are initialized which set custom C#
            //tagger based syntax highligthing
            var document = IdeApp.Workbench.NewDocument("a.cs", "text/x-csharp", dummyEditor.Text);

            document.Editor.CaretOffset = dummyEditor.CaretOffset;
            //Call UpdateParseDocument so AdHock Roslyn Workspace is created for file
            await document.UpdateParseDocument();

            var info = new Components.Commands.CommandInfo();

            //Finnaly call command Update so it sets values which we assert
            GetExtension(document.Editor).OnUpdateToggleComment(info);
            await document.Close();

            Assert.AreEqual(true, info.Visible);
            Assert.AreEqual(true, info.Enabled);
        }
 public void SetUp()
 {
     //Initialize IdeApp so IdeApp.Workspace is not null, comment tasks listen to root workspace events.
     if (!IdeApp.IsInitialized)
     {
         IdeApp.Initialize(new ProgressMonitor());
     }
 }
 protected override void InternalSetup(string rootDir)
 {
     base.InternalSetup(rootDir);
     if (!IdeApp.IsInitialized)
     {
         IdeApp.Initialize(new ProgressMonitor());
     }
 }
Beispiel #9
0
 public void ExitApp()
 {
     try {
         IdeApp.Exit();
     } catch (Exception e) {
         Console.WriteLine(e);
     }
 }
        protected override void Run()
        {
            var item = IdeApp.ProjectOperations.CurrentSelectedProject;

            IdeApp.OpenFiles(new [] {
                new FileOpenInformation(item.Files[0].FilePath, item.Files[0].Project)
            });
        }
 public void SetUp()
 {
     DesktopService.Initialize();
     if (!IdeApp.IsInitialized)
     {
         IdeApp.Initialize(new ProgressMonitor());
     }
 }
Beispiel #12
0
        async void OnDragDataReceived(object o, Gtk.DragDataReceivedArgs args)
        {
            if (args.Info != (uint)TargetList.UriList)
            {
                return;
            }
            string fullData = System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);

            var loadWorkspaceItems = !IsInsideTabStrip(args.X, args.Y);
            var files = new List <Ide.Gui.FileOpenInformation> ();

            foreach (string individualFile in fullData.Split('\n'))
            {
                string file = individualFile.Trim();
                if (file.StartsWith("file://"))
                {
                    var filePath = new FilePath(file);
                    if (filePath.IsDirectory)
                    {
                        if (!loadWorkspaceItems)                         // skip directories when not loading solutions
                        {
                            continue;
                        }
                        filePath = Directory.EnumerateFiles(filePath).FirstOrDefault(p => Services.ProjectService.IsWorkspaceItemFile(p));
                    }
                    if (!filePath.IsNullOrEmpty)                     // skip empty paths
                    {
                        files.Add(new Ide.Gui.FileOpenInformation(filePath, null, 0, 0, Ide.Gui.OpenDocumentOptions.DefaultInternal)
                        {
                            DockNotebook = this
                        });
                    }
                }
            }

            if (files.Count > 0)
            {
                if (loadWorkspaceItems)
                {
                    try {
                        IdeApp.OpenFiles(files);
                    } catch (Exception e) {
                        LoggingService.LogError($"Failed to open dropped files", e);
                    }
                }
                else                     // open workspace items as files
                {
                    foreach (var file in files)
                    {
                        try {
                            await IdeApp.Workbench.OpenDocument(file).ConfigureAwait(false);
                        } catch (Exception e) {
                            LoggingService.LogError($"unable to open file {file}", e);
                        }
                    }
                }
            }
        }
Beispiel #13
0
		public void ExitApp ()
		{
			Sync (delegate {
				IdeApp.Exit ().ContinueWith ((arg) => {
					if (arg.IsFaulted)
						Console.WriteLine (arg.Exception);
				});
				return true;
			});
		}
Beispiel #14
0
 public void ExitApp()
 {
     Sync(delegate {
         try {
             IdeApp.Exit();
         } catch (Exception e) {
             Console.WriteLine(e);
         }
         return(true);
     });
 }
        void RestartButtonClicked(object sender, EventArgs e)
        {
            ApplyChanges();

            IdeApp.Restart(true).Ignore();

            // The following does not work. The dialog is always null.
            var dialog = (widget?.Toplevel as Gtk.Dialog);

            dialog?.Respond(Gtk.ResponseType.Ok);
        }
Beispiel #16
0
        internal async Task <bool> Close()
        {
            if (!IdeApp.OnExit())
            {
                return(false);
            }

            IdeApp.Workspace.SavePreferences();

            bool showDirtyDialog = false;

            foreach (var doc in Documents)
            {
                if (doc.IsDirty)
                {
                    showDirtyDialog = true;
                    break;
                }
            }

            if (showDirtyDialog)
            {
                using (var dlg = new DirtyFilesDialog()) {
                    dlg.Modal = true;
                    if (MessageService.ShowCustomDialog(dlg, workbench) != (int)Gtk.ResponseType.Ok)
                    {
                        return(false);
                    }
                }
            }

            if (!await IdeApp.Workspace.Close(false, false))
            {
                return(false);
            }

            var tasks = new List <Task> ();

            foreach (var doc in Documents.ToList())
            {
                tasks.Add(doc.Close(true));
            }
            await Task.WhenAll(tasks);

            workbench.Close();

            IdeApp.Workspace.SavePreferences();

            IdeApp.OnExited();

            IdeApp.CommandService.Dispose();

            return(true);
        }
Beispiel #17
0
        static void GlobalSetup()
        {
            if (initedGlobal || setupFail)
            {
                return;
            }
            initedGlobal = true;

            //FIXME: should we remove these when finalizing?
            try {
                ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e) {
                    if (!IdeApp.Exit())
                    {
                        e.UserCancelled = true;
                    }
                    e.Handled = true;
                };

                ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e) {
                    if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null)
                    {
                        IdeApp.Workbench.RootWindow.Deiconify();
                        IdeApp.Workbench.RootWindow.Visible = true;
                        e.Handled = true;
                    }
                };

                ApplicationEvents.OpenDocuments += delegate(object sender, ApplicationDocumentEventArgs e) {
                    //OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
                    GLib.Timeout.Add(10, delegate {
                        IdeApp.OpenFiles(e.Documents.Select(doc =>
                                                            new FileOpenInformation(doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
                        return(false);
                    });
                    e.Handled = true;
                };

                //if not running inside an app bundle, assume usual MD build layout and load the app icon
                FilePath exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
                if (!exePath.ToString().Contains("MonoDevelop.app"))
                {
                    var mdSrcMain = exePath.ParentDirectory.ParentDirectory.ParentDirectory;
                    var icons     = mdSrcMain.Combine("theme-icons", "Mac", "monodevelop.icns");
                    if (File.Exists(icons))
                    {
                        NSApplication.SharedApplication.ApplicationIconImage = new NSImage(icons);
                    }
                }
            } catch (Exception ex) {
                MonoDevelop.Core.LoggingService.LogError("Could not install app event handlers", ex);
                setupFail = true;
            }
        }
Beispiel #18
0
        public SdkLocationWidget(SdkLocationPanel panel) : base(false, 12)
        {
            this.panel = panel;

            this.PackStart(new Label()
            {
                Markup = "<b>" + GLib.Markup.EscapeText(panel.Label) + "</b>",
                Xalign = 0f,
            });
            var alignment = new Alignment(0f, 0f, 1f, 1f)
            {
                LeftPadding = 24
            };

            this.PackStart(alignment);
            var vbox        = new VBox(false, 6);
            var locationBox = new HBox(false, 6);
            var messageBox  = new HBox(false, 6);

            alignment.Add(vbox);
            vbox.PackStart(messageBox, false, false, 0);
            vbox.PackStart(locationBox, false, false, 0);
            locationBox.PackStart(new Label(GettextCatalog.GetString("Location:")), false, false, 0);
            locationBox.PackStart(locationEntry, true, true, 0);
            messageBox.PackStart(messageIcon, false, false, 0);
            messageBox.PackStart(messageLabel, true, true, 0);
            messageLabel.Xalign = 0f;

            string location = panel.LoadSdkLocationSetting();

            locationEntry.Path = location ?? "";

            locationEntry.PathChanged += delegate {
                Validate();
            };
            Validate();

            if (panel.RequiresRestart)
            {
                PackStart(new HSeparator(), false, false, 0);

                var tableRestart = new RestartPanel();
                tableRestart.RestartRequested += (sender, e) => {
                    ApplyChanges();
                    IdeApp.Restart(true).Ignore();
                };

                PackStart(tableRestart, false, false, 0);
            }

            ShowAll();
        }
Beispiel #19
0
        protected override void OnRun()
        {
            if (IdeApp.ProjectOperations.CurrentSelectedItem is ProjectFolder currentFolder)
            {
                try {
                    var documentFilePath = new FilePath(Path.Combine(currentFolder.Path.FullPath, FigmaBundle.DocumentFileName));

                    IdeApp.OpenFiles(new[] { new Ide.Gui.FileOpenInformation(documentFilePath) });
                } catch (Exception ex) {
                    LoggingService.LogInternalError(ex);
                }
            }
        }
        Task <bool> ShowLicenseAcceptanceDialog(IEnumerable <NuGetPackageLicense> licenses)
        {
            var res = new TaskCompletionSource <bool> ();

            IdeApp.RunWhenIdle(() => {
                Xwt.Toolkit.NativeEngine.Invoke(delegate {
                    using (LicenseAcceptanceDialog dialog = CreateLicenseAcceptanceDialog(licenses)) {
                        res.SetResult(dialog.Run(Xwt.MessageDialog.RootWindow));
                    }
                });
            });
            return(res.Task);
        }
        public void SetUp()
        {
            string runTests = Environment.GetEnvironmentVariable("DOTNETCORE_IGNORE_PROJECT_TEMPLATE_TESTS");

            if (!string.IsNullOrEmpty(runTests))
            {
                Assert.Ignore("Ignoring DotNetCoreProjectTemplateTests");
            }

            templatingService = new TemplatingService();

            if (!IdeApp.IsInitialized)
            {
                IdeApp.Initialize(Util.GetMonitor());
            }
        }
Beispiel #22
0
        public void SetUp()
        {
            string runTests = Environment.GetEnvironmentVariable("DOTNETCORE_IGNORE_PROJECT_TEMPLATE_TESTS");

            if (!string.IsNullOrEmpty(runTests))
            {
                Assert.Ignore("Ignoring DotNetCoreProjectTemplateTests");
            }

            templatingService = new TemplatingService();

            if (!firstRun)
            {
                firstRun = true;
                Xwt.Application.Initialize(Xwt.ToolkitType.Gtk);
                DesktopService.Initialize();
                IdeApp.Initialize(Util.GetMonitor());
            }
        }
        protected override Task <Response> HandleOpenFile(OpenFileRequest request)
        {
            DispatchToGuiThread(() =>
            {
                var fileOpenInfo = new FileOpenInformation(new FilePath(request.File),
                                                           project: null /* autodetect */,
                                                           line: request.Line ?? 0,
                                                           column: request.Column ?? 0,
                                                           options: OpenDocumentOptions.Default
                                                           );

                IdeApp.OpenFiles(new[] { fileOpenInfo });

                // Make the Ide window grab focus
                IdeApp.Workbench.Present();
            });

            return(Task.FromResult <Response>(new OpenFileResponse {
                Status = MessageStatus.Ok
            }));
        }
        static void GlobalSetup()
        {
            if (initedGlobal || setupFail)
            {
                return;
            }
            initedGlobal = true;

            //FIXME: should we remove these when finalizing?
            try {
                ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e) {
                    if (!IdeApp.Exit())
                    {
                        e.UserCancelled = true;
                    }
                    e.Handled = true;
                };

                ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e) {
                    if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null)
                    {
                        IdeApp.Workbench.RootWindow.Deiconify();
                        IdeApp.Workbench.RootWindow.Visible = true;
                        e.Handled = true;
                    }
                };

                ApplicationEvents.OpenDocuments += delegate(object sender, ApplicationDocumentEventArgs e) {
                    //OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
                    GLib.Timeout.Add(10, delegate {
                        IdeApp.OpenFiles(e.Documents.Select(doc => new FileOpenInformation(doc.Key, doc.Value, 1, true)));
                        return(false);
                    });
                    e.Handled = true;
                };
            } catch (Exception ex) {
                MonoDevelop.Core.LoggingService.LogError("Could not install app event handlers", ex);
                setupFail = true;
            }
        }
Beispiel #25
0
            public override void HandleException(string message, Exception e)
            {
                base.HandleException(message, e);

                if (e is IOException)
                {
                    return;
                }

                if (!IdeApp.IsInitialized)
                {
                    Console.WriteLine(e);
                    return;
                }

                var text          = GettextCatalog.GetString("There was a problem loading one or more extensions and {0} needs to be restarted.", BrandingService.ApplicationName);
                var quitButton    = new AlertButton(Strings.Quit);
                var restartButton = new AlertButton(Strings.Restart);

                var result = MessageService.GenericAlert(
                    IdeServices.DesktopService.GetFocusedTopLevelWindow(),
                    Gui.Stock.Error,
                    text,
                    secondaryText: null,
                    defaultButton: 1,
                    quitButton,
                    restartButton
                    );

                if (result == restartButton)
                {
                    IdeApp.Restart(false).Ignore();
                }
                else
                {
                    IdeApp.Exit().Ignore();
                }
            }
Beispiel #26
0
        public async Task MetadataReferencesToFrameworkAssembliesAreProperlyFound()
        {
            if (!IdeApp.IsInitialized)
            {
                IdeApp.Initialize(new ProgressMonitor());
            }

            FilePath projFile = Util.GetSampleProject("workspace-metadata-references", "workspace-metadata-references.sln");

            using (var sol = (MonoDevelop.Projects.Solution) await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), projFile)) {
                using (var ws = await TypeSystemServiceTestExtensions.LoadSolution(sol)) {
                    DotNetProject mainProject = null, libraryProject = null, libraryProject461 = null;
                    foreach (var project in sol.GetAllProjects())
                    {
                        if (project.Name == "workspace-metadata-references")
                        {
                            mainProject = (DotNetProject)project;
                        }
                        else if (project.Name == "library-project")
                        {
                            libraryProject = (DotNetProject)project;
                        }
                        else if (project.Name == "library-project-net461")
                        {
                            libraryProject461 = (DotNetProject)project;
                        }
                    }

                    Assert.IsNotNull(mainProject);
                    Assert.IsNotNull(libraryProject);

                    // Also, add test for net461 to net47.
                    await AddAssemblyReference(ws, libraryProject, mainProject, "System.Messaging");
                    await AddAssemblyReference(ws, libraryProject461, mainProject, "System.ServiceModel");
                }
            }
        }
Beispiel #27
0
 protected override void Run()
 {
     IdeApp.Exit().Ignore();
 }
Beispiel #28
0
        void GlobalSetup()
        {
            //FIXME: should we remove these when finalizing?
            try {
                ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                {
                    // We can only attempt to quit safely if all windows are GTK windows and not modal
                    if (!IsModalDialogRunning())
                    {
                        e.UserCancelled = !IdeApp.Exit();
                        e.Handled       = true;
                        return;
                    }

                    // When a modal dialog is running, things are much harder. We can't just shut down MD behind the
                    // dialog, and aborting the dialog may not be appropriate.
                    //
                    // There's NSTerminateLater but I'm not sure how to access it from carbon, maybe
                    // we need to swizzle methods into the app's NSApplicationDelegate.
                    // Also, it stops the main CFRunLoop and enters a special runloop mode, not sure how that would
                    // interact with GTK+.

                    // For now, just bounce
                    NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest);
                    // and abort the quit.
                    e.UserCancelled = true;
                    e.Handled       = true;
                };

                ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e) {
                    if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null)
                    {
                        IdeApp.Workbench.RootWindow.Deiconify();
                        IdeApp.Workbench.RootWindow.Visible = true;

                        IdeApp.Workbench.RootWindow.Present();
                        e.Handled = true;
                    }
                };

                ApplicationEvents.OpenDocuments += delegate(object sender, ApplicationDocumentEventArgs e) {
                    //OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
                    GLib.Timeout.Add(10, delegate {
                        IdeApp.OpenFiles(e.Documents.Select(doc =>
                                                            new FileOpenInformation(doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
                        return(false);
                    });
                    e.Handled = true;
                };

                ApplicationEvents.OpenUrls += delegate(object sender, ApplicationUrlEventArgs e) {
                    GLib.Timeout.Add(10, delegate {
                        // Open files via the monodevelop:// URI scheme, compatible with the
                        // common TextMate scheme: http://blog.macromates.com/2007/the-textmate-url-scheme/
                        IdeApp.OpenFiles(e.Urls.Select(url => {
                            try {
                                var uri = new Uri(url);
                                if (uri.Host != "open")
                                {
                                    return(null);
                                }

                                var qs      = System.Web.HttpUtility.ParseQueryString(uri.Query);
                                var fileUri = new Uri(qs ["file"]);

                                int line, column;
                                if (!Int32.TryParse(qs ["line"], out line))
                                {
                                    line = 1;
                                }
                                if (!Int32.TryParse(qs ["column"], out column))
                                {
                                    column = 1;
                                }

                                return(new FileOpenInformation(fileUri.AbsolutePath,
                                                               line, column, OpenDocumentOptions.Default));
                            } catch (Exception ex) {
                                LoggingService.LogError("Invalid TextMate URI: " + url, ex);
                                return(null);
                            }
                        }).Where(foi => foi != null));
                        return(false);
                    });
                };

                //if not running inside an app bundle (at dev time), need to do some additional setup
                if (NSBundle.MainBundle.InfoDictionary ["CFBundleIdentifier"] == null)
                {
                    SetupWithoutBundle();
                }
            } catch (Exception ex) {
                LoggingService.LogError("Could not install app event handlers", ex);
                setupFail = true;
            }
        }
 void RestartClicked(object sender, System.EventArgs e)
 {
     Store();
     IdeApp.Restart(true);
 }
Beispiel #30
0
        public SdkLocationWidget(SdkLocationPanel panel) : base(false, 12)
        {
            this.panel = panel;

            this.PackStart(new Label()
            {
                Markup = "<b>" + GLib.Markup.EscapeText(panel.Label) + "</b>",
                Xalign = 0f,
            });
            var alignment = new Alignment(0f, 0f, 1f, 1f)
            {
                LeftPadding = 24
            };

            this.PackStart(alignment);
            var vbox        = new VBox(false, 6);
            var locationBox = new HBox(false, 6);
            var messageBox  = new HBox(false, 6);

            alignment.Add(vbox);
            vbox.PackStart(messageBox, false, false, 0);
            vbox.PackStart(locationBox, false, false, 0);
            locationBox.PackStart(new Label(GettextCatalog.GetString("Location:")), false, false, 0);
            locationBox.PackStart(locationEntry, true, true, 0);
            messageBox.PackStart(messageIcon, false, false, 0);
            messageBox.PackStart(messageLabel, true, true, 0);
            messageLabel.Xalign = 0f;

            string location = panel.LoadSdkLocationSetting();

            locationEntry.Path = location ?? "";

            locationEntry.PathChanged += delegate {
                Validate();
            };
            Validate();

            if (panel.RequiresRestart)
            {
                PackStart(new HSeparator(), false, false, 0);

                var tableRestart = new Table(2, 3, false)
                {
                    RowSpacing = 6, ColumnSpacing = 6
                };

                var btnRestart = new Button()
                {
                    Label    = GettextCatalog.GetString("Restart {0}", BrandingService.ApplicationName),
                    CanFocus = true, UseUnderline = true
                };
                tableRestart.Attach(btnRestart, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                var imageRestart = new ImageView("md-information", IconSize.Menu);
                tableRestart.Attach(imageRestart, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                var labelRestart = new Label(GettextCatalog.GetString("These preferences will take effect next time you start {0}", BrandingService.ApplicationName));
                tableRestart.Attach(labelRestart, 1, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                PackStart(tableRestart, false, false, 0);

                btnRestart.Clicked += (sender, e) => {
                    ApplyChanges();
                    IdeApp.Restart(true);
                };
            }

            ShowAll();
        }