Beispiel #1
0
 protected override void InternalSetup(string rootDir)
 {
     base.InternalSetup(rootDir);
     Xwt.Application.Initialize(Xwt.ToolkitType.Gtk);
     Gtk.Application.Init();
     DesktopService.Initialize();
 }
Beispiel #2
0
        async Task TestCompletion(string text, Action <Document, ICompletionDataList> action, CompletionTriggerInfo triggerInfo)
        {
            DesktopService.Initialize();

            int endPos = text.IndexOf('$');

            if (endPos >= 0)
            {
                text = text.Substring(0, endPos) + text.Substring(endPos + 1);
            }

            var doc = await SetupDocument(text, cursorPosition : Math.Max(0, endPos));

            var compExt = doc.GetContent <CSharpCompletionTextEditorExtension> ();

            compExt.CurrentCompletionContext = new CodeCompletionContext {
                TriggerOffset     = doc.Editor.CaretOffset,
                TriggerWordLength = 1,
            };

            await doc.UpdateParseDocument();

            var tmp = IdeApp.Preferences.EnableAutoCodeCompletion;

            IdeApp.Preferences.EnableAutoCodeCompletion.Set(false);
            var list = await compExt.HandleCodeCompletionAsync(compExt.CurrentCompletionContext, triggerInfo);

            try {
                action(doc, list);
            } finally {
                IdeApp.Preferences.EnableAutoCodeCompletion.Set(tmp);
            }
        }
 public void SetUp()
 {
     DesktopService.Initialize();
     if (!IdeApp.IsInitialized)
     {
         IdeApp.Initialize(new ProgressMonitor());
     }
 }
 protected virtual void InternalSetup(string rootDir)
 {
     Environment.SetEnvironmentVariable("MONO_ADDINS_REGISTRY", rootDir);
     Environment.SetEnvironmentVariable("XDG_CONFIG_HOME", rootDir);
     Runtime.Initialize(true);
     Gtk.Application.Init();
     DesktopService.Initialize();
     global::MonoDevelop.Projects.Services.ProjectService.DefaultTargetFramework
         = Runtime.SystemAssemblyService.GetTargetFramework(TargetFrameworkMoniker.NET_4_0);
 }
Beispiel #5
0
 static void InternalSetup(string rootDir)
 {
     Util.ClearTmpDir();
     Environment.SetEnvironmentVariable("MONO_ADDINS_REGISTRY", rootDir);
     Environment.SetEnvironmentVariable("XDG_CONFIG_HOME", rootDir);
     Runtime.Initialize(true);
     Gtk.Application.Init();
     ProjectDomService.TrackFileChanges = true;
     DesktopService.Initialize();
     MonoDevelop.Projects.Services.ProjectService.DefaultTargetFramework = Runtime.SystemAssemblyService.GetTargetFramework("2.0");
 }
Beispiel #6
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());
            }
        }
Beispiel #7
0
        public async Task <int> Run(string[] arguments)
        {
            DesktopService.Initialize();

            Console.WriteLine(BrandingService.BrandApplicationName("MonoDevelop Gettext Update Tool"));
            foreach (string s in arguments)
            {
                ReadArgument(s);
            }

            if (help)
            {
                Console.WriteLine("gettext-update [options] [project-file]");
                Console.WriteLine("--f --file:FILE   Project or solution file to build.");
                Console.WriteLine("--p --project:PROJECT  Name of the project to build.");
                Console.WriteLine("--sort  Sorts the output po file");
                Console.WriteLine();
                return(0);
            }

            if (file == null)
            {
                var files = Directory.EnumerateFiles(".");
                foreach (string f in files)
                {
                    if (Services.ProjectService.IsWorkspaceItemFile(f))
                    {
                        file = f;
                        break;
                    }
                }
                if (file == null)
                {
                    Console.WriteLine("Solution file not found.");
                    return(1);
                }
            }
            else if (!Services.ProjectService.IsWorkspaceItemFile(file))
            {
                Console.WriteLine("File '{0}' is not a project or solution.", file);
                return(1);
            }

            ConsoleProgressMonitor monitor = new ConsoleProgressMonitor();

            monitor.IgnoreLogMessages = true;

            WorkspaceItem centry = await Services.ProjectService.ReadWorkspaceItem(monitor, file);

            monitor.IgnoreLogMessages = false;

            Solution solution = centry as Solution;

            if (solution == null)
            {
                Console.WriteLine("File is not a solution: " + file);
                return(1);
            }

            if (project != null)
            {
                SolutionItem item = solution.FindProjectByName(project);

                if (item == null)
                {
                    Console.WriteLine("The project '" + project + "' could not be found in " + file);
                    return(1);
                }
                TranslationProject tp = item as TranslationProject;
                if (tp == null)
                {
                    Console.WriteLine("The project '" + item.FileName + "' is not a translation project");
                    return(1);
                }
                tp.UpdateTranslations(monitor, sort);
            }
            else
            {
                foreach (TranslationProject p in solution.GetAllItems <TranslationProject>())
                {
                    p.UpdateTranslations(monitor, sort);
                }
            }

            return(0);
        }
        static async Task TestCompletion(string text, Action <ICompletionDataList> action, CompletionTriggerInfo triggerInfo)
        {
            DesktopService.Initialize();

            int endPos = text.IndexOf('$');

            if (endPos >= 0)
            {
                text = text.Substring(0, endPos) + text.Substring(endPos + 1);
            }

            var project = Ide.Services.ProjectService.CreateDotNetProject("C#");

            project.Name = "test";
            project.References.Add(MonoDevelop.Projects.ProjectReference.CreateAssemblyReference("mscorlib"));
            project.References.Add(MonoDevelop.Projects.ProjectReference.CreateAssemblyReference("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            project.References.Add(MonoDevelop.Projects.ProjectReference.CreateAssemblyReference("System.Core"));

            project.FileName = "test.csproj";
            project.Files.Add(new ProjectFile("/a.cs", BuildAction.Compile));

            var solution = new MonoDevelop.Projects.Solution();

            solution.AddConfiguration("", true);
            solution.DefaultSolutionFolder.AddItem(project);
            using (var monitor = new ProgressMonitor())
                await TypeSystemService.Load(solution, monitor);


            var tww     = new TestWorkbenchWindow();
            var content = new TestViewContent();

            tww.ViewContent       = content;
            content.ContentName   = "/a.cs";
            content.Data.MimeType = "text/x-csharp";
            content.Project       = project;


            content.Text           = text;
            content.CursorPosition = Math.Max(0, endPos);
            var doc = new MonoDevelop.Ide.Gui.Document(tww);

            doc.SetProject(project);

            var compExt = new CSharpCompletionTextEditorExtension();

            compExt.Initialize(doc.Editor, doc);
            compExt.CurrentCompletionContext = new CodeCompletionContext {
                TriggerOffset     = content.CursorPosition,
                TriggerWordLength = 1
            };
            content.Contents.Add(compExt);

            await doc.UpdateParseDocument();

            var tmp = IdeApp.Preferences.EnableAutoCodeCompletion;

            IdeApp.Preferences.EnableAutoCodeCompletion.Set(false);
            var list = await compExt.HandleCodeCompletionAsync(compExt.CurrentCompletionContext, triggerInfo);

            try {
                action(list);
            } finally {
                IdeApp.Preferences.EnableAutoCodeCompletion.Set(tmp);
                project.Dispose();
            }
        }
Beispiel #9
0
 public void Start()
 {
     DesktopService.Initialize();
     IdeApp.Initialize(new ProgressMonitor());
     IdeApp.Workspace.ActiveConfigurationId = "Debug";
 }