コード例 #1
0
		public CompilerPanel (Properties customizationObject)
		{
			this.Build ();
			
			project = customizationObject.Get<CProject> ("Project");
			
			compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers");
			
			foreach (ICompiler compiler in compilers) {
				compilerComboBox.AppendText (compiler.Name);
			}
			
			int active = 0;
			Gtk.TreeIter iter;
			Gtk.ListStore store = (Gtk.ListStore)compilerComboBox.Model;
			store.GetIterFirst (out iter);
			while (store.IterIsValid (iter)) {
				if ((string)store.GetValue (iter, 0) == project.Compiler.Name) {
					break;
				}
				store.IterNext (ref iter);
				active++;
			}

			compilerComboBox.Active = active;
			
			useCcacheCheckBox.Active = ((CProjectConfiguration)project.ActiveConfiguration).UseCcache;
			
			Update ();
		}
コード例 #2
0
		public Project CreateSingleFileProject (string sourceFile)
		{
			ProjectCreateInformation info = new ProjectCreateInformation ();
			info.ProjectName = Path.GetFileNameWithoutExtension (sourceFile);
			info.CombinePath = Path.GetDirectoryName (sourceFile);
			info.ProjectBasePath = Path.GetDirectoryName (sourceFile);
			
			string language = string.Empty;
			
			switch (Path.GetExtension (sourceFile))
			{
			case ".c":
				language = "C";
				break;
			case ".cpp":
				language = "CPP";
				break;
			case ".cxx":
				language = "CPP";
				break;
			}
			
			if (language.Length > 0) {
				Project project =  new CProject (info, null, language);
				project.ProjectFiles.Add (new ProjectFile (sourceFile));
				return project;
			}
			
			return null;
		}
コード例 #3
0
        private CompletionDataList GetMembersOfItem(string itemFullName)
        {
            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation info = ProjectInformationManager.Instance.Get(project);
            CompletionDataList list = new CompletionDataList();

            LanguageItem container = null;

            string currentFileName = Document.FileName;
            bool   in_project      = false;

            foreach (LanguageItem li in info.Containers())
            {
                if (itemFullName == li.FullName)
                {
                    container  = li;
                    in_project = true;
                }
            }

            if (!in_project && info.IncludedFiles.ContainsKey(currentFileName))
            {
                foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    foreach (LanguageItem li in fi.Containers())
                    {
                        if (itemFullName == li.FullName)
                        {
                            container = li;
                        }
                    }
                }
            }

            if (container == null)
            {
                return(null);
            }

            if (in_project)
            {
                AddItemsWithParent(list, info.AllItems(), container);
            }
            else
            {
                foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    AddItemsWithParent(list, fi.AllItems(), container);
                }
            }

            return(list);
        }
コード例 #4
0
ファイル: Package.cs プロジェクト: Kalnor/monodevelop
		public Package (CProject project)
		{
			name = project.Name;
			file = Path.Combine (project.BaseDirectory, name + ".md.pc");
			is_project = true;
			
			ParsePackageEssentials ();
		}
コード例 #5
0
        public Package(CProject project)
        {
            name       = project.Name;
            file       = Path.Combine(project.BaseDirectory, name + ".md.pc");
            is_project = true;

            ParsePackageEssentials();
        }
        protected override void Clean(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
        {
            base.Clean(monitor, entry, configuration);

            CProject project           = (CProject)entry;
            CProjectConfiguration conf = (CProjectConfiguration)project.GetConfiguration(configuration);

            project.Compiler.Clean(project.Files, conf, monitor);
        }
コード例 #7
0
 public SymbolDatabaseMediator(CProject proj, CLangManager manager)
 {
     ContainingProject = proj;
     Manager           = manager;
     ContainingProject.FileAddedToProject     += HandleAddition;
     ContainingProject.FileRemovedFromProject += HandleRemoval;
     ContainingProject.FileChangedInProject   += HandleSave;
     ContainingProject.FileRenamedInProject   += HandleRename;
     ContainingProject.Disposing += HandleDispose;
 }
コード例 #8
0
ファイル: CProjectBinding.cs プロジェクト: Kalnor/monodevelop
		public Project CreateSingleFileProject (string sourceFile)
		{
			var info = new ProjectCreateInformation () {
				ProjectName = Path.GetFileNameWithoutExtension (sourceFile),
				SolutionPath = Path.GetDirectoryName (sourceFile),
				ProjectBasePath = Path.GetDirectoryName (sourceFile),
			};
			
			Project project = new CProject (info, null, GetLanguage (sourceFile));
			project.Files.Add (new ProjectFile (sourceFile));
			return project;
		}
        protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
        {
            CProject project           = (CProject)entry;
            CProjectConfiguration conf = (CProjectConfiguration)project.GetConfiguration(configuration);

            if (conf.CompileTarget != CompileTarget.Bin)
            {
                project.WriteMDPkgPackage(configuration);
            }

            return(base.Build(monitor, entry, configuration));
        }
コード例 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="proj">
 /// A <see cref="CProject"/> reference: project which the manager manages
 /// </param>
 public CLangManager(CProject proj)
 {
     project          = proj;
     index            = clang.createIndex(0, 0);
     SerManager       = new SerializationManager(project, this, index);
     translationUnits = new Dictionary <string, CXTranslationUnit> ();
     Loaded           = new Dictionary <string, bool> ();
     project.DefaultConfigurationChanged += HandleDefaultConfigurationChange;
     project.FileAddedToProject          += HandleAddition;
     project.FileChangedInProject        += HandleChange;
     project.FileRemovedFromProject      += HandleRemoval;
     project.FileRenamedInProject        += HandleRename;
 }
コード例 #11
0
        private LanguageItem GetLanguageItemAt(DocumentLocation location)
        {
            CProject project = Document.Project as CProject;
            string   token   = GetTokenAt(location);

            if (project != null && !string.IsNullOrEmpty(token))
            {
                ProjectInformation info = ProjectInformationManager.Instance.Get(project);
                return(info.AllItems().FirstOrDefault(i => i.Name.Equals(token, StringComparison.Ordinal)));
            }

            return(null);
        }
コード例 #12
0
 public RenameHandlerDialog(CProject proj, Document doc)
 {
     project          = proj;
     cursorReferenced = project.ClangManager.GetCursorReferenced(
         project.ClangManager.GetCursor(
             doc.FileName,
             doc.Editor.CaretLocation
             )
         );
     UsrReferenced = project.ClangManager.GetCursorUsrString(cursorReferenced);
     spelling      = project.ClangManager.GetCursorSpelling(cursorReferenced);
     document      = doc;
 }
コード例 #13
0
        private static void OnEntryAddedToCombine(object sender, SolutionItemEventArgs e)
        {
            CProject p = e.SolutionItem as CProject;

            if (p == null)
            {
                return;
            }

            foreach (ProjectFile f in p.Files)
            {
                TagDatabaseManager.Instance.UpdateFileTags(p, f.Name);
            }
        }
コード例 #14
0
        public Project CreateSingleFileProject(string sourceFile)
        {
            var info = new ProjectCreateInformation()
            {
                ProjectName     = Path.GetFileNameWithoutExtension(sourceFile),
                SolutionPath    = Path.GetDirectoryName(sourceFile),
                ProjectBasePath = Path.GetDirectoryName(sourceFile),
            };

            Project project = new CProject(info, null, GetLanguage(sourceFile));

            project.Files.Add(new ProjectFile(sourceFile));
            return(project);
        }
コード例 #15
0
        /// <summary>
        /// Finds the corresponding source or header file
        /// </summary>
        /// <param name="sourceFile">
        /// The name of the file to be matched
        /// <see cref="System.String"/>
        /// </param>
        /// <returns>
        /// The corresponding file, or null if not found
        /// <see cref="System.String"/>
        /// </returns>
        public string MatchingFile(string sourceFile)
        {
            string filenameStub = Path.GetFileNameWithoutExtension(sourceFile);
            bool   wantHeader   = !CProject.IsHeaderFile(sourceFile);

            foreach (ProjectFile file in this.Files)
            {
                if (filenameStub == Path.GetFileNameWithoutExtension(file.Name) &&
                    (wantHeader == IsHeaderFile(file.Name)))
                {
                    return(file.Name);
                }
            }

            return(null);
        }
コード例 #16
0
        private bool PrecompileHeaders(ProjectFileCollection projectFiles,
                                       CProjectConfiguration configuration,
                                       string args,
                                       ProgressMonitor monitor,
                                       CompilerResults cr)
        {
            monitor.BeginTask(GettextCatalog.GetString("Precompiling headers"), 1);
            bool success = true;

            foreach (ProjectFile file in projectFiles)
            {
                if (file.Subtype == Subtype.Code && CProject.IsHeaderFile(file.Name))
                {
                    string precomp = Path.Combine(configuration.IntermediateOutputDirectory, "prec");
                    precomp = Path.Combine(precomp, configuration.Id);
                    precomp = Path.Combine(precomp, Path.GetFileName(file.Name) + ".ghc");
                    if (file.BuildAction == BuildAction.Compile)
                    {
                        if (!File.Exists(precomp) || configuration.UseCcache || File.GetLastWriteTime(file.Name) > File.GetLastWriteTime(precomp))
                        {
                            if (DoPrecompileHeader(file, precomp, args, monitor, cr) == false)
                            {
                                success = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        //remove old files or they'll interfere with the build
                        if (File.Exists(precomp))
                        {
                            File.Delete(precomp);
                        }
                    }
                }
            }
            if (success)
            {
                monitor.Step(1);
            }
            monitor.EndTask();
            return(success);
        }
コード例 #17
0
        /// <summary>
        /// Finds references and renames them.
        /// </summary>
        /// <param name="project">Project.</param>
        /// <param name="cursor">Cursor.</param>
        public async void FindRefsAndRename(CProject project, CXCursor cursor)
        {
            try {
                lock (project.ClangManager.SyncRoot)
                    project.ClangManager.FindReferences(this);

                references.Sort();
                int diff    = newSpelling.Length - spelling.Length;
                var offsets = new Dictionary <string, int>();
                var tmp     = new Dictionary <string, StringBuilder>();

                foreach (var reference in references)
                {
                    try {
                        //FIXME: do we actually need to open the documents?
                        var doc = await IdeApp.Workbench.OpenDocument(reference.FileName, project, false);

                        if (!offsets.ContainsKey(reference.FileName))
                        {
                            offsets.Add(reference.FileName, 0);
                            tmp.Add(reference.FileName, new StringBuilder(doc.Editor.Text));
                        }
                        int i = offsets[reference.FileName];
                        tmp[reference.FileName].Remove(reference.Offset + i * diff, reference.Length);
                        tmp[reference.FileName].Insert(reference.Offset + i * diff, newSpelling);
                        offsets[reference.FileName] = ++i;
                    } catch (Exception) {}
                }

                foreach (var content in tmp)
                {
                    IdeApp.Workbench.GetDocument(content.Key).Editor.ReplaceText(
                        new TextSegment(
                            0,
                            IdeApp.Workbench.GetDocument(content.Key).Editor.Text.Length
                            ),
                        content.Value.ToString()
                        );
                }
            } catch (Exception ex) {
                LoggingService.LogError("Error renaming references", ex);
            }
        }
コード例 #18
0
        private ProjectPackageCollection ProjectPackages(Project project)
        {
            ProjectPackageCollection packages = new ProjectPackageCollection();

            foreach (CombineEntry c in project.ParentCombine.Entries)
            {
                if (c is CProject)
                {
                    CProject cproj             = (CProject)c;
                    CProjectConfiguration conf = (CProjectConfiguration)cproj.ActiveConfiguration;
                    if (conf.CompileTarget != CBinding.CompileTarget.Bin)
                    {
                        cproj.WriteMDPkgPackage();
                        packages.Add(new ProjectPackage(cproj));
                    }
                }
            }

            return(packages);
        }
コード例 #19
0
        public override ICompilerResult Build(IProgressMonitor monitor, CombineEntry entry)
        {
            CProject project = entry as CProject;

            if (project == null)
            {
                return(base.Build(monitor, entry));
            }

            foreach (CProject p in project.DependedOnProjects())
            {
                p.Build(monitor, true);
            }

            if (((CProjectConfiguration)project.ActiveConfiguration).CompileTarget != CompileTarget.Bin)
            {
                project.WriteMDPkgPackage();
            }

            return(base.Build(monitor, entry));
        }
コード例 #20
0
        private List <Package> GetPackagesOfProjects(Project project)
        {
            List <Package> packages = new List <Package>();
            Package        package;

            foreach (SolutionFolderItem c in project.ParentFolder.Items)
            {
                if (null != c && c is CProject)
                {
                    CProject cproj             = (CProject)c;
                    CProjectConfiguration conf = (CProjectConfiguration)cproj.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
                    if (conf.CompileTarget != CompileTarget.Exe)
                    {
                        cproj.WriteMDPkgPackage(conf.Selector);
                        package = new Package(cproj);
                        packages.Add(package);
                    }
                }
            }

            return(packages);
        }
コード例 #21
0
        public override IParameterDataProvider HandleParameterCompletion(
            CodeCompletionContext completionContext, char completionChar)
        {
            if (completionChar != '(')
            {
                return(null);
            }

            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation info = ProjectInformationManager.Instance.Get(project);

            int line, column;

            Editor.GetLineColumnFromPosition(Editor.CursorPosition, out line, out column);
            int    position = Editor.GetPositionFromLineColumn(line, 1);
            string lineText = Editor.GetText(position, Editor.CursorPosition - 1).TrimEnd();

            int nameStart = lineText.LastIndexOfAny(allowedChars);

            nameStart++;

            string functionName = lineText.Substring(nameStart).Trim();

            if (string.IsNullOrEmpty(functionName))
            {
                return(null);
            }

            return(new ParameterDataProvider(Document, info, functionName));
        }
コード例 #22
0
        public override MonoDevelop.Ide.CodeCompletion.ParameterDataProvider HandleParameterCompletion(
            CodeCompletionContext completionContext, char completionChar)
        {
            if (completionChar != '(')
            {
                return(null);
            }

            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation info     = ProjectInformationManager.Instance.Get(project);
            string             lineText = Editor.GetLineText(Editor.Caret.Line).TrimEnd();

            if (lineText.EndsWith(completionChar.ToString(), StringComparison.Ordinal))
            {
                lineText = lineText.Remove(lineText.Length - 1).TrimEnd();
            }

            int nameStart = lineText.LastIndexOfAny(allowedChars);

            nameStart++;

            string functionName = lineText.Substring(nameStart).Trim();

            if (string.IsNullOrEmpty(functionName))
            {
                return(null);
            }

            return(new ParameterDataProvider(nameStart, Document, info, functionName));
        }
コード例 #23
0
		public ProjectPackageEventArgs(CProject project, ProjectPackage package)
		{
			this.project = project;
			this.package = package;
		}
コード例 #24
0
        private ICompletionDataList GlobalComplete()
        {
            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation info = ProjectInformationManager.Instance.Get(project);

            CompletionDataList list = new CompletionDataList();

            list.AutoSelect = false;

            foreach (LanguageItem li in info.Containers())
            {
                if (li.Parent == null)
                {
                    list.Add(new CompletionData(li));
                }
            }

            foreach (Function f in info.Functions)
            {
                if (f.Parent == null)
                {
                    list.Add(new CompletionData(f));
                }
            }

            foreach (Enumerator e in info.Enumerators)
            {
                list.Add(new CompletionData(e));
            }

            foreach (Macro m in info.Macros)
            {
                list.Add(new CompletionData(m));
            }

            string currentFileName = Document.FileName;

            if (info.IncludedFiles.ContainsKey(currentFileName))
            {
                foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    foreach (LanguageItem li in fi.Containers())
                    {
                        if (li.Parent == null)
                        {
                            list.Add(new CompletionData(li));
                        }
                    }

                    foreach (Function f in fi.Functions)
                    {
                        if (f.Parent == null)
                        {
                            list.Add(new CompletionData(f));
                        }
                    }

                    foreach (Enumerator e in fi.Enumerators)
                    {
                        list.Add(new CompletionData(e));
                    }

                    foreach (Macro m in fi.Macros)
                    {
                        list.Add(new CompletionData(m));
                    }
                }
            }

            return(list);
        }
コード例 #25
0
        public override BuildResult Compile(
            Project project,
            ProjectFileCollection projectFiles,
            ProjectPackageCollection packages,
            CProjectConfiguration configuration,
            ProgressMonitor monitor)
        {
            if (!appsChecked)
            {
                appsChecked   = true;
                compilerFound = CheckApp(compilerCommand);
                linkerFound   = CheckApp(linkerCommand);
            }

            if (!compilerFound)
            {
                BuildResult cres = new BuildResult();
                cres.AddError("Compiler not found: " + compilerCommand);
                return(cres);
            }

            if (!linkerFound)
            {
                BuildResult cres = new BuildResult();
                cres.AddError("Linker not found: " + linkerCommand);
                return(cres);
            }

            CompilerResults cr           = new CompilerResults(new TempFileCollection());
            bool            success      = true;
            string          compilerArgs = GetCompilerFlags(project, configuration) + " " + GeneratePkgCompilerArgs(packages);

            string outputName = Path.Combine(configuration.OutputDirectory,
                                             configuration.CompiledOutputName);

            // Precompile header files and place them in prec/<config_name>/
            if (configuration.PrecompileHeaders)
            {
                string precDir       = Path.Combine(configuration.IntermediateOutputDirectory, "prec");
                string precConfigDir = Path.Combine(precDir, configuration.Id);
                if (!Directory.Exists(precDir))
                {
                    Directory.CreateDirectory(precDir);
                }
                if (!Directory.Exists(precConfigDir))
                {
                    Directory.CreateDirectory(precConfigDir);
                }

                if (!PrecompileHeaders(projectFiles, configuration, compilerArgs, monitor, cr))
                {
                    success = false;
                }
            }
            else
            {
                //old headers could interfere with the build
                CleanPrecompiledHeaders(configuration);
            }

            //compile source to object files
            monitor.BeginTask(GettextCatalog.GetString("Compiling source to object files"), 1);
            foreach (ProjectFile f in projectFiles)
            {
                if (!success)
                {
                    break;
                }
                if (f.Subtype == Subtype.Directory || f.BuildAction != BuildAction.Compile || CProject.IsHeaderFile(f.FilePath))
                {
                    continue;
                }

                if (configuration.UseCcache || NeedsCompiling(f, configuration))
                {
                    success = DoCompilation(f, configuration, compilerArgs, monitor, cr, configuration.UseCcache);
                }
            }
            if (success)
            {
                monitor.Step(1);
            }
            monitor.EndTask();

            if (success)
            {
                switch (configuration.CompileTarget)
                {
                case CBinding.CompileTarget.Bin:
                    MakeBin(project, projectFiles, configuration, packages, cr, monitor, outputName);
                    break;

                case CBinding.CompileTarget.StaticLibrary:
                    MakeStaticLibrary(project, projectFiles, configuration, packages, cr, monitor, outputName);
                    break;

                case CBinding.CompileTarget.SharedLibrary:
                    MakeSharedLibrary(project, projectFiles, configuration, packages, cr, monitor, outputName);
                    break;
                }
            }

            return(new BuildResult(cr, ""));
        }
コード例 #26
0
        /// <summary>
        /// Gets completion data for a given instance
        /// </summary>
        /// <param name="instanceName">
        /// The identifier of the instance
        /// <see cref="System.String"/>
        /// </param>
        /// <param name="isPointer">
        /// Whether the instance in question is a pointer
        /// <see cref="System.Boolean"/>
        /// </param>
        /// <returns>
        /// Completion data for the instance
        /// <see cref="CompletionDataList"/>
        /// </returns>
        private CompletionDataList GetMembersOfInstance(string instanceName, bool isPointer)
        {
            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation info = ProjectInformationManager.Instance.Get(project);
            CompletionDataList list = new CompletionDataList();

            list.AutoSelect = false;

            string container = null;

            string currentFileName = Document.FileName;
            bool   in_project      = false;

            // Find the typename of the instance
            foreach (Member li in info.Members)
            {
                if (instanceName == li.Name && li.IsPointer == isPointer)
                {
                    container  = li.InstanceType;
                    in_project = true;
                    break;
                }
            }

            // Search included files
            if (!in_project && info.IncludedFiles.ContainsKey(currentFileName))
            {
                foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    foreach (Member li in fi.Members)
                    {
                        if (instanceName == li.Name && li.IsPointer == isPointer)
                        {
                            container = li.InstanceType;
                            break;
                        }
                    }
                }
            }

            if (null == container)
            {
                // Search locals
                foreach (Local li in info.Locals)
                {
                    if (instanceName == li.Name && li.IsPointer == isPointer && currentFileName == li.File)
                    {
                        container  = li.InstanceType;
                        in_project = true;
                        break;
                    }
                }
            }

            // Not found
            if (container == null)
            {
                return(null);
            }

            // Get the LanguageItem corresponding to the typename
            // and populate completion data accordingly
            if (in_project)
            {
                AddMembersWithParent(list, info.InstanceMembers(), container);
            }
            else
            {
                foreach (CBinding.Parser.FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    AddMembersWithParent(list, fi.InstanceMembers(), container);
                }
            }

            return(list);
        }
コード例 #27
0
        public EditPackagesDialog(CProject project)
        {
            this.Build();

            this.project = project;

            selectedPackages.Project = project;
            selectedPackages.AddRange(project.Packages);

            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

            CellRendererImage pixbufRenderer = new CellRendererImage();

            pixbufRenderer.StockId = "md-package";

            normalPackageListStore.DefaultSortFunc   = NormalPackageCompareNodes;
            projectPackageListStore.DefaultSortFunc  = ProjectPackageCompareNodes;
            selectedPackageListStore.DefaultSortFunc = SelectedPackageCompareNodes;

            normalPackageListStore.SetSortColumnId(NormalPackageNameID, Gtk.SortType.Ascending);
            projectPackageListStore.SetSortColumnId(ProjectPackageNameID, Gtk.SortType.Ascending);
            selectedPackageListStore.SetSortColumnId(SelectedPackageNameID, Gtk.SortType.Ascending);

            normalPackageTreeView.SearchColumn   = NormalPackageNameID;
            projectPackageTreeView.SearchColumn  = ProjectPackageNameID;
            selectedPackageTreeView.SearchColumn = SelectedPackageNameID;

            // <!-- Normal packages -->

            Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle();
            normalPackageToggleRenderer.Activatable = true;
            normalPackageToggleRenderer.Toggled    += OnNormalPackageToggled;
            normalPackageToggleRenderer.Xalign      = 0;

            Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn();
            normalPackageColumn.Title = "Package";
            normalPackageColumn.PackStart(pixbufRenderer, false);
            normalPackageColumn.PackStart(textRenderer, true);
            normalPackageColumn.AddAttribute(textRenderer, "text", NormalPackageNameID);

            normalPackageTreeView.Model          = normalPackageListStore;
            normalPackageTreeView.HeadersVisible = true;
            normalPackageTreeView.AppendColumn("", normalPackageToggleRenderer, "active", NormalPackageToggleID);
            normalPackageTreeView.AppendColumn(normalPackageColumn);
            normalPackageTreeView.AppendColumn("Version", textRenderer, "text", NormalPackageVersionID);

            // <!-- Project packages -->

            Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle();
            projectPackageToggleRenderer.Activatable = true;
            projectPackageToggleRenderer.Toggled    += OnProjectPackageToggled;
            projectPackageToggleRenderer.Xalign      = 0;

            Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn();
            projectPackageColumn.Title = "Package";
            projectPackageColumn.PackStart(pixbufRenderer, false);
            projectPackageColumn.PackStart(textRenderer, true);
            projectPackageColumn.AddAttribute(textRenderer, "text", ProjectPackageNameID);

            projectPackageTreeView.Model          = projectPackageListStore;
            projectPackageTreeView.HeadersVisible = true;
            projectPackageTreeView.AppendColumn("", projectPackageToggleRenderer, "active", ProjectPackageToggleID);
            projectPackageTreeView.AppendColumn(projectPackageColumn);
            projectPackageTreeView.AppendColumn("Version", textRenderer, "text", ProjectPackageVersionID);


            // <!-- Selected packages -->

            Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn();
            selectedPackageColumn.Title = "Package";
            selectedPackageColumn.PackStart(pixbufRenderer, false);
            selectedPackageColumn.PackStart(textRenderer, true);
            selectedPackageColumn.AddAttribute(textRenderer, "text", SelectedPackageNameID);

            selectedPackageTreeView.Model          = selectedPackageListStore;
            selectedPackageTreeView.HeadersVisible = true;
            selectedPackageTreeView.AppendColumn(selectedPackageColumn);
            selectedPackageTreeView.AppendColumn("Version", textRenderer, "text", SelectedPackageVersionID);

            // Fill up the project tree view
            packagesOfProjects = GetPackagesOfProjects(project);

            foreach (Package p in packagesOfProjects)
            {
                if (p.Name == project.Name)
                {
                    continue;
                }

                packages.Add(p);
                string version   = p.Version;
                bool   inProject = selectedPackages.Contains(p);

                if (!IsPackageInStore(projectPackageListStore, p.Name, version, ProjectPackageNameID, ProjectPackageVersionID))
                {
                    projectPackageListStore.AppendValues(inProject, p.Name, version);

                    if (inProject)
                    {
                        selectedPackageListStore.AppendValues(p.Name, version);
                    }
                }
            }

            // Fill up the normal tree view
            foreach (string dir in ScanDirs())
            {
                if (Directory.Exists(dir))
                {
                    DirectoryInfo di = new DirectoryInfo(dir);
                    FileInfo[]    availablePackages = di.GetFiles("*.pc");

                    foreach (FileInfo f in availablePackages)
                    {
                        if (!IsValidPackage(f.FullName))
                        {
                            continue;
                        }

                        Package package = new Package(f.FullName);

                        packages.Add(package);

                        string name      = package.Name;
                        string version   = package.Version;
                        bool   inProject = selectedPackages.Contains(package);

                        if (!IsPackageInStore(normalPackageListStore, name, version, NormalPackageNameID, NormalPackageVersionID))
                        {
                            normalPackageListStore.AppendValues(inProject, name, version);

                            if (inProject)
                            {
                                selectedPackageListStore.AppendValues(name, version);
                            }
                        }
                    }
                }
            }
        }
コード例 #28
0
 public SerializationManager(CProject proj, CLangManager man, CXIndex ind)
 {
     Manager = man;
     project = proj;
     Index   = ind;
 }
コード例 #29
0
		public EditPackagesDialog(CProject project)
		{
			this.Build();
			
			this.project = project;
			
			selectedPackages.Project = project;
			selectedPackages.AddRange (project.Packages);
			
			Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
			
			CellRendererImage pixbufRenderer = new CellRendererImage ();
			pixbufRenderer.StockId = "md-package";
			
			normalPackageListStore.DefaultSortFunc = NormalPackageCompareNodes;
			projectPackageListStore.DefaultSortFunc = ProjectPackageCompareNodes;
			selectedPackageListStore.DefaultSortFunc = SelectedPackageCompareNodes;
			
			normalPackageListStore.SetSortColumnId (NormalPackageNameID, Gtk.SortType.Ascending);
			projectPackageListStore.SetSortColumnId (ProjectPackageNameID, Gtk.SortType.Ascending);
			selectedPackageListStore.SetSortColumnId (SelectedPackageNameID, Gtk.SortType.Ascending);
			
			normalPackageTreeView.SearchColumn = NormalPackageNameID;
			projectPackageTreeView.SearchColumn = ProjectPackageNameID;
			selectedPackageTreeView.SearchColumn = SelectedPackageNameID;
			
			// <!-- Normal packages -->
			
			Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle ();
			normalPackageToggleRenderer.Activatable = true;
			normalPackageToggleRenderer.Toggled += OnNormalPackageToggled;
			normalPackageToggleRenderer.Xalign = 0;
			
			Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn ();
			normalPackageColumn.Title = "Package";
			normalPackageColumn.PackStart (pixbufRenderer, false);
			normalPackageColumn.PackStart (textRenderer, true);
			normalPackageColumn.AddAttribute (textRenderer, "text", NormalPackageNameID);
			
			normalPackageTreeView.Model = normalPackageListStore;
			normalPackageTreeView.HeadersVisible = true;
			normalPackageTreeView.AppendColumn ("", normalPackageToggleRenderer, "active", NormalPackageToggleID);
			normalPackageTreeView.AppendColumn (normalPackageColumn);
			normalPackageTreeView.AppendColumn ("Version", textRenderer, "text", NormalPackageVersionID);
			
			// <!-- Project packages -->
			
			Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle ();
			projectPackageToggleRenderer.Activatable = true;
			projectPackageToggleRenderer.Toggled += OnProjectPackageToggled;
			projectPackageToggleRenderer.Xalign = 0;
			
			Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn ();
			projectPackageColumn.Title = "Package";
			projectPackageColumn.PackStart (pixbufRenderer, false);
			projectPackageColumn.PackStart (textRenderer, true);
			projectPackageColumn.AddAttribute (textRenderer, "text", ProjectPackageNameID);
			
			projectPackageTreeView.Model = projectPackageListStore;
			projectPackageTreeView.HeadersVisible = true;
			projectPackageTreeView.AppendColumn ("", projectPackageToggleRenderer, "active", ProjectPackageToggleID);
			projectPackageTreeView.AppendColumn (projectPackageColumn);
			projectPackageTreeView.AppendColumn ("Version", textRenderer, "text", ProjectPackageVersionID);
			
			
			// <!-- Selected packages -->
			
			Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn ();
			selectedPackageColumn.Title = "Package";
			selectedPackageColumn.PackStart (pixbufRenderer, false);
			selectedPackageColumn.PackStart (textRenderer, true);
			selectedPackageColumn.AddAttribute (textRenderer, "text", SelectedPackageNameID);
			
			selectedPackageTreeView.Model = selectedPackageListStore;
			selectedPackageTreeView.HeadersVisible = true;
			selectedPackageTreeView.AppendColumn (selectedPackageColumn);
			selectedPackageTreeView.AppendColumn ("Version", textRenderer, "text", SelectedPackageVersionID);
			
			// Fill up the project tree view
			packagesOfProjects = GetPackagesOfProjects (project);
			
			foreach (Package p in packagesOfProjects) {
				if (p.Name == project.Name) continue;
				
				packages.Add (p);
				string version = p.Version;
				bool inProject = selectedPackages.Contains (p);

				if (!IsPackageInStore (projectPackageListStore, p.Name, version, ProjectPackageNameID, ProjectPackageVersionID)) {
				    projectPackageListStore.AppendValues (inProject, p.Name, version);
				
					if (inProject)
						selectedPackageListStore.AppendValues (p.Name, version);
				}
			}
			
			// Fill up the normal tree view
			foreach (string dir in ScanDirs ()) {
				if (Directory.Exists (dir)) {	
					DirectoryInfo di = new DirectoryInfo (dir);
					FileInfo[] availablePackages = di.GetFiles ("*.pc");
					
					foreach (FileInfo f in availablePackages) {
						if (!IsValidPackage (f.FullName)) { 
							continue;
						}
						
						Package package = new Package (f.FullName);
						
						packages.Add (package);
						
						string name = package.Name;
						string version = package.Version;
						bool inProject = selectedPackages.Contains (package);
						
						if (!IsPackageInStore (normalPackageListStore, name, version, NormalPackageNameID, NormalPackageVersionID)) {
							normalPackageListStore.AppendValues (inProject, name, version);
						
							if (inProject)
								selectedPackageListStore.AppendValues (name, version);
						}
					}
				}
			}
		}
コード例 #30
0
        public EditPackagesDialog(CProject project)
        {
            this.Build();

            this.project = project;

            selectedPackages.AddRange(project.Packages);

            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

            Gtk.CellRendererPixbuf pixbufRenderer = new Gtk.CellRendererPixbuf();
            pixbufRenderer.StockId = "md-package";

            // <!-- Normal packages -->

            Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle();
            normalPackageToggleRenderer.Activatable = true;
            normalPackageToggleRenderer.Toggled    += OnNormalPackageToggled;
            normalPackageToggleRenderer.Xalign      = 0;

            Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn();
            normalPackageColumn.Title = "Package";
            normalPackageColumn.PackStart(pixbufRenderer, false);
            normalPackageColumn.PackStart(textRenderer, true);
            normalPackageColumn.AddAttribute(textRenderer, "text", 1);

            normalPackageTreeView.Model          = normalPackageListStore;
            normalPackageTreeView.HeadersVisible = true;
            normalPackageTreeView.AppendColumn("", normalPackageToggleRenderer, "active", 0);
            normalPackageTreeView.AppendColumn(normalPackageColumn);
            normalPackageTreeView.AppendColumn("Version", textRenderer, "text", 2);

            // <!-- Project packages -->

            Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle();
            projectPackageToggleRenderer.Activatable = true;
            projectPackageToggleRenderer.Toggled    += OnProjectPackageToggled;
            projectPackageToggleRenderer.Xalign      = 0;

            Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn();
            projectPackageColumn.Title = "Package";
            projectPackageColumn.PackStart(pixbufRenderer, false);
            projectPackageColumn.PackStart(textRenderer, true);
            projectPackageColumn.AddAttribute(textRenderer, "text", 1);

            projectPackageTreeView.Model          = projectPackageListStore;
            projectPackageTreeView.HeadersVisible = true;
            projectPackageTreeView.AppendColumn("", projectPackageToggleRenderer, "active", 0);
            projectPackageTreeView.AppendColumn(projectPackageColumn);
            projectPackageTreeView.AppendColumn("Version", textRenderer, "text", 2);


            // <!-- Selected packages -->

            Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn();
            selectedPackageColumn.Title = "Package";
            selectedPackageColumn.PackStart(pixbufRenderer, false);
            selectedPackageColumn.PackStart(textRenderer, true);
            selectedPackageColumn.AddAttribute(textRenderer, "text", 0);

            selectedPackagesTreeView.Model          = selectedPackagesListStore;
            selectedPackagesTreeView.HeadersVisible = true;
            selectedPackagesTreeView.AppendColumn(selectedPackageColumn);
            selectedPackagesTreeView.AppendColumn("Version", textRenderer, "text", 1);

            // Fill up the project tree view
            projectPackages = ProjectPackages(project);

            foreach (ProjectPackage p in projectPackages)
            {
                if (p.Name == project.Name)
                {
                    continue;
                }
                string version   = GetPackageVersion(p.File);
                bool   inProject = IsInProject(p.File);
                projectPackageListStore.AppendValues(inProject, p.Name, version);

                if (inProject)
                {
                    selectedPackagesListStore.AppendValues(p.Name, version);
                }
            }

            // Fill up the normal tree view
            foreach (string dir in ScanDirs())
            {
                if (Directory.Exists(dir))
                {
                    DirectoryInfo di = new DirectoryInfo(dir);
                    FileInfo[]    availablePackages = di.GetFiles("*.pc");

                    foreach (FileInfo f in availablePackages)
                    {
                        if (!IsValidPackage(f.FullName))
                        {
                            continue;
                        }
                        string name      = f.Name.Substring(0, f.Name.LastIndexOf('.'));
                        string version   = GetPackageVersion(f.FullName);
                        bool   inProject = IsInProject(name);
                        normalPackageListStore.AppendValues(inProject, name, version);

                        if (inProject)
                        {
                            selectedPackagesListStore.AppendValues(name, version);
                        }
                    }
                }
            }
        }
コード例 #31
0
		public ProjectPackage (CProject project)
		{
			name = project.Name;
			file = Path.Combine (project.BaseDirectory, name + ".md.pc");
			is_project = true;
		}
コード例 #32
0
 public ProjectPackage(CProject project)
 {
     name       = project.Name;
     file       = Path.Combine(project.BaseDirectory, name + ".md.pc");
     is_project = true;
 }
コード例 #33
0
 public ProjectPackageEventArgs(CProject project, ProjectPackage package)
 {
     this.project = project;
     this.package = package;
 }
コード例 #34
0
        private CompletionDataProvider GetMembersOfItem(string itemFullName)
        {
            CProject project = Document.Project as CProject;

            if (project == null)
            {
                return(null);
            }

            ProjectInformation     info     = ProjectInformationManager.Instance.Get(project);
            CompletionDataProvider provider = new CompletionDataProvider();

            LanguageItem container = null;

            string currentFileName = Document.FileName;
            bool   in_project      = false;

            foreach (LanguageItem li in info.Containers())
            {
                if (itemFullName == li.FullName)
                {
                    container  = li;
                    in_project = true;
                }
            }

            if (!in_project && info.IncludedFiles.ContainsKey(currentFileName))
            {
                foreach (FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    foreach (LanguageItem li in fi.Containers())
                    {
                        if (itemFullName == li.FullName)
                        {
                            container = li;
                        }
                    }
                }
            }

            if (container == null)
            {
                return(null);
            }

            if (in_project)
            {
                foreach (LanguageItem li in info.AllItems())
                {
                    if (li.Parent != null && li.Parent.Equals(container))
                    {
                        provider.AddCompletionData(new CompletionData(li));
                    }
                }
            }
            else
            {
                foreach (FileInformation fi in info.IncludedFiles[currentFileName])
                {
                    foreach (LanguageItem li in fi.AllItems())
                    {
                        if (li.Parent != null && li.Parent.Equals(container))
                        {
                            provider.AddCompletionData(new CompletionData(li));
                        }
                    }
                }
            }

            return(provider);
        }
コード例 #35
0
		public EditPackagesDialog(CProject project)
		{
			this.Build();
			
			this.project = project;
			
			selectedPackages.AddRange (project.Packages);
			
			Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
			
			Gtk.CellRendererPixbuf pixbufRenderer = new Gtk.CellRendererPixbuf ();
			pixbufRenderer.StockId = "md-package";
			
			// <!-- Normal packages -->
			
			Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle ();
			normalPackageToggleRenderer.Activatable = true;
			normalPackageToggleRenderer.Toggled += OnNormalPackageToggled;
			normalPackageToggleRenderer.Xalign = 0;
			
			Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn ();
			normalPackageColumn.Title = "Package";
			normalPackageColumn.PackStart (pixbufRenderer, false);
			normalPackageColumn.PackStart (textRenderer, true);
			normalPackageColumn.AddAttribute (textRenderer, "text", 1);
			
			normalPackageTreeView.Model = normalPackageListStore;
			normalPackageTreeView.HeadersVisible = true;
			normalPackageTreeView.AppendColumn ("", normalPackageToggleRenderer, "active", 0);
			normalPackageTreeView.AppendColumn (normalPackageColumn);
			normalPackageTreeView.AppendColumn ("Version", textRenderer, "text", 2);
			
			// <!-- Project packages -->
			
			Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle ();
			projectPackageToggleRenderer.Activatable = true;
			projectPackageToggleRenderer.Toggled += OnProjectPackageToggled;
			projectPackageToggleRenderer.Xalign = 0;
			
			Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn ();
			projectPackageColumn.Title = "Package";
			projectPackageColumn.PackStart (pixbufRenderer, false);
			projectPackageColumn.PackStart (textRenderer, true);
			projectPackageColumn.AddAttribute (textRenderer, "text", 1);
			
			projectPackageTreeView.Model = projectPackageListStore;
			projectPackageTreeView.HeadersVisible = true;
			projectPackageTreeView.AppendColumn ("", projectPackageToggleRenderer, "active", 0);
			projectPackageTreeView.AppendColumn (projectPackageColumn);
			projectPackageTreeView.AppendColumn ("Version", textRenderer, "text", 2);
			
			
			// <!-- Selected packages -->
			
			Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn ();
			selectedPackageColumn.Title = "Package";
			selectedPackageColumn.PackStart (pixbufRenderer, false);
			selectedPackageColumn.PackStart (textRenderer, true);
			selectedPackageColumn.AddAttribute (textRenderer, "text", 0);
			
			selectedPackagesTreeView.Model = selectedPackagesListStore;
			selectedPackagesTreeView.HeadersVisible = true;
			selectedPackagesTreeView.AppendColumn (selectedPackageColumn);
			selectedPackagesTreeView.AppendColumn ("Version", textRenderer, "text", 1);
			
			// Fill up the project tree view
			projectPackages = ProjectPackages (project);
			
			foreach (ProjectPackage p in projectPackages) {
				if (p.Name == project.Name) continue;
				string version = GetPackageVersion (p.File);
				bool inProject = IsInProject (p.File);
				projectPackageListStore.AppendValues (inProject, p.Name, version);
				
				if (inProject)
					selectedPackagesListStore.AppendValues (p.Name, version);
			}
			
			// Fill up the normal tree view
			foreach (string dir in ScanDirs ()) {
				if (Directory.Exists (dir)) {	
					DirectoryInfo di = new DirectoryInfo (dir);
					FileInfo[] availablePackages = di.GetFiles ("*.pc");
					
					foreach (FileInfo f in availablePackages) {
						if (!IsValidPackage (f.FullName)) { 
							continue;
						}
						string name = f.Name.Substring (0, f.Name.LastIndexOf ('.'));
						string version = GetPackageVersion (f.FullName);
						bool inProject = IsInProject (name);
						normalPackageListStore.AppendValues (inProject, name, version);
						
						if (inProject)
							selectedPackagesListStore.AppendValues (name, version);
					}
				}
			}
		}