use of org.python.pydev.navigator.elements.PythonSourceFolder in project Pydev by fabioz.
the class PythonModelProvider method doWrapPossibleSourceFolder.
/**
* Try to wrap a folder or project as a source folder...
* @param natureToSourcePathSet
*/
private PythonSourceFolder doWrapPossibleSourceFolder(Object parent, IContainer container, Map<PythonNature, Set<String>> natureToSourcePathSet) {
IProject project;
if (!(container instanceof IProject)) {
project = ((IContainer) parent).getProject();
} else {
project = (IProject) container;
}
PythonNature nature = PythonNature.getPythonNature(project);
if (nature != null) {
// check for source folder
Set<String> sourcePathSet = this.getSourcePathSet(natureToSourcePathSet, nature);
PythonSourceFolder newSourceFolder = tryWrapSourceFolder(parent, container, sourcePathSet);
if (newSourceFolder != null) {
return newSourceFolder;
}
}
return null;
}
use of org.python.pydev.navigator.elements.PythonSourceFolder in project Pydev by fabioz.
the class PythonModelProvider method tryWrapSourceFolder.
/**
* This method checks if the given folder can be wrapped as a source-folder, and if that's possible, creates and returns
* it
* @return a created source folder or null if it couldn't be created.
*/
private PythonSourceFolder tryWrapSourceFolder(Object parent, IContainer container, Set<String> sourcePathSet) {
IPath fullPath = container.getFullPath();
if (sourcePathSet.contains(fullPath.toString())) {
PythonSourceFolder sourceFolder;
if (container instanceof IFolder) {
sourceFolder = new PythonSourceFolder(parent, (IFolder) container);
} else if (container instanceof IProject) {
sourceFolder = new PythonProjectSourceFolder(parent, (IProject) container);
} else {
// some other container we don't know how to treat!
return null;
}
// System.out.println("Created source folder: "+ret[i]+" - "+folder.getProject()+" - "+folder.getProjectRelativePath());
Set<PythonSourceFolder> sourceFolders = getProjectSourceFolders(container.getProject());
sourceFolders.add(sourceFolder);
return sourceFolder;
}
return null;
}
Aggregations