def doAddFile_(self, fileName, headerToInclude, refreshFile=False):
        """
        Add a source file to the project.
        """
        assert fileName and headerToInclude
        theProjectsManager = project.projectsManagerInstance()
        currentProject = theProjectsManager.getProject(theProjectsManager.getCurrentProjectName())
        myFileTreeItem = FileTreeItem(fileName, headerToInclude)
        myWidgetItem = AnnotationsTreeWidgetItem(myFileTreeItem)
        myWidgetItem.setText(0, fileName)
        myWidgetItem.setCheckState(0, Qt.Unchecked)
        self.projectExplorerTreeWidget.addTopLevelItem(myWidgetItem)
        language = currentProject.getLanguage()
        classes, functions = myFileTreeItem.getParser().getAllClassesAndFunctionsAnnotations(fileName, headerToInclude)

        for funcName, myAnnotationState in functions:
            myCheckedState = getCheckedStateFromAnnotation(myAnnotationState)
            myFunctionTreeItem = FunctionTreeItem(fileName, headerToInclude, funcName)
            myFuncWidgetItem = AnnotationsTreeWidgetItem(myFunctionTreeItem)
            myFuncWidgetItem.setText(0, funcName)
            myFuncWidgetItem.setCheckState(0, myCheckedState)
            myFuncWidgetItem.setIcon(0, QIcon("./images/code-function.ico"))
            myWidgetItem.addChild(myFuncWidgetItem)

        for className, myAnnotationState in classes:
            myCheckedState = getCheckedStateFromAnnotation(myAnnotationState)
            myClassTreeItem = ClassTreeItem(fileName, headerToInclude, className)
            myClassWidgetItem = AnnotationsTreeWidgetItem(myClassTreeItem)
            myClassWidgetItem.setText(0, className)
            myClassWidgetItem.setCheckState(0, myCheckedState)
            myClassWidgetItem.setIcon(0, QIcon("./images/code-class.ico"))
            myWidgetItem.addChild(myClassWidgetItem)

        if refreshFile:
            self.refreshFileContents(fileName)
    def doAddFile_(self, fileName, headerToInclude, refreshFile=False):
        '''
        Add a source file to the project.
        '''
        assert fileName and headerToInclude
        theProjectsManager = project.projectsManagerInstance()
        currentProject = theProjectsManager.getProject(
            theProjectsManager.getCurrentProjectName())
        myFileTreeItem = FileTreeItem(fileName, headerToInclude)
        myWidgetItem = AnnotationsTreeWidgetItem(myFileTreeItem)
        myWidgetItem.setText(0, fileName)
        myWidgetItem.setCheckState(0, Qt.Unchecked)
        self.projectExplorerTreeWidget.addTopLevelItem(myWidgetItem)
        language = currentProject.getLanguage()
        classes, functions = myFileTreeItem.getParser(
        ).getAllClassesAndFunctionsAnnotations(fileName, headerToInclude)

        for funcName, myAnnotationState in functions:
            myCheckedState = getCheckedStateFromAnnotation(myAnnotationState)
            myFunctionTreeItem = FunctionTreeItem(fileName, headerToInclude,
                                                  funcName)
            myFuncWidgetItem = AnnotationsTreeWidgetItem(myFunctionTreeItem)
            myFuncWidgetItem.setText(0, funcName)
            myFuncWidgetItem.setCheckState(0, myCheckedState)
            myFuncWidgetItem.setIcon(0, QIcon("./images/code-function.ico"))
            myWidgetItem.addChild(myFuncWidgetItem)

        for className, myAnnotationState in classes:
            myCheckedState = getCheckedStateFromAnnotation(myAnnotationState)
            myClassTreeItem = ClassTreeItem(fileName, headerToInclude,
                                            className)
            myClassWidgetItem = AnnotationsTreeWidgetItem(myClassTreeItem)
            myClassWidgetItem.setText(0, className)
            myClassWidgetItem.setCheckState(0, myCheckedState)
            myClassWidgetItem.setIcon(0, QIcon("./images/code-class.ico"))
            myWidgetItem.addChild(myClassWidgetItem)

        if refreshFile:
            self.refreshFileContents(fileName)
        def loadFilesIntoTree():
            """
            Load source files in annotations tree.
            """
            self.projectExplorerTreeWidget.clear()
            # TODO GERVA: por ahora solo cargo el main
            # despues guardo el resto de los archivos
            mainFile = self.currentProject.getMainFile()
            mainFunction = self.currentProject.getMainFunction()
            mainFileCaption = "MAIN: " + mainFile

            myFileTreeItem = FileTreeItem(mainFile, headerToInclude="")
            myWidgetItem = AnnotationsTreeWidgetItem(myFileTreeItem, mayAnnotate=False)
            myFont = myWidgetItem.font(0)
            myFont.setBold(True)
            myWidgetItem.setFont(0, myFont)
            myWidgetItem.setText(0, mainFileCaption)
            myWidgetItem.setCheckState(0, Qt.Unchecked)
            self.projectExplorerTreeWidget.addTopLevelItem(myWidgetItem)

            myFunctionTreeItem = FunctionTreeItem(mainFile, "", mainFunction)
            myFuncWidgetItem = AnnotationsTreeWidgetItem(myFunctionTreeItem, mayAnnotate=False)
            myFont = myFuncWidgetItem.font(0)
            myFont.setBold(True)
            myFuncWidgetItem.setFont(0, myFont)
            myFuncWidgetItem.setText(0, mainFunction)
            myFuncWidgetItem.setCheckState(0, Qt.Unchecked)
            myWidgetItem.addChild(myFuncWidgetItem)

            for fileToAnnotate, headerToInclude in self.currentProject.getTreeFiles():
                self.doAddFile_(fileToAnnotate, headerToInclude, refreshFile=False)

            self.refreshFileContents(mainFile)
        def loadFilesIntoTree():
            '''
            Load source files in annotations tree.
            '''
            self.projectExplorerTreeWidget.clear()
            #TODO GERVA: por ahora solo cargo el main
            #despues guardo el resto de los archivos
            mainFile = self.currentProject.getMainFile()
            mainFunction = self.currentProject.getMainFunction()
            mainFileCaption = "MAIN: " + mainFile

            myFileTreeItem = FileTreeItem(mainFile, headerToInclude='')
            myWidgetItem = AnnotationsTreeWidgetItem(myFileTreeItem,
                                                     mayAnnotate=False)
            myFont = myWidgetItem.font(0)
            myFont.setBold(True)
            myWidgetItem.setFont(0, myFont)
            myWidgetItem.setText(0, mainFileCaption)
            myWidgetItem.setCheckState(0, Qt.Unchecked)
            self.projectExplorerTreeWidget.addTopLevelItem(myWidgetItem)

            myFunctionTreeItem = FunctionTreeItem(mainFile, '', mainFunction)
            myFuncWidgetItem = AnnotationsTreeWidgetItem(myFunctionTreeItem,
                                                         mayAnnotate=False)
            myFont = myFuncWidgetItem.font(0)
            myFont.setBold(True)
            myFuncWidgetItem.setFont(0, myFont)
            myFuncWidgetItem.setText(0, mainFunction)
            myFuncWidgetItem.setCheckState(0, Qt.Unchecked)
            myWidgetItem.addChild(myFuncWidgetItem)

            for fileToAnnotate, headerToInclude in self.currentProject.getTreeFiles(
            ):
                self.doAddFile_(fileToAnnotate,
                                headerToInclude,
                                refreshFile=False)

            self.refreshFileContents(mainFile)