// (null, Session.class);
Map properties = contextProvider.lookupFirst(null, Map.class);
// sourcesHelper = contextProvider.lookupFirst(null, SourcesHelper.class);
ClassPath cljClassPath = null;
try {
//??cljClassPath = (ClassPath) RT.var("org.enclojure.platform.pathutils", "get-classpath-for-clojure-files").invoke();
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
// 2) get default allSourceRoots of source roots used for stepping
if (properties != null) {
smartSteppingSourcePath = (ClassPath) properties.get("sourcepath");
ClassPath jdkCP = (ClassPath) properties.get("jdksources");
if ((jdkCP == null) && (JavaPlatform.getDefault() != null)) {
jdkCP = JavaPlatform.getDefault().getSourceFolders();
}
originalSourcePath = jdkCP == null ? smartSteppingSourcePath : ClassPathSupport.createProxyClassPath(
new ClassPath[]{
jdkCP,
smartSteppingSourcePath
});
projectSourceRoots = getSourceRoots(originalSourcePath);
Set<FileObject> preferredRoots = new HashSet<FileObject>();
preferredRoots.addAll(Arrays.asList(originalSourcePath.getRoots()));
Set<FileObject> globalRoots = new TreeSet<FileObject>(new FileObjectComparator());
globalRoots.addAll(GlobalPathRegistry.getDefault().getSourceRoots());
globalRoots.removeAll(preferredRoots);
ClassPath globalCP = ClassPathSupport.createClassPath(globalRoots.toArray(new FileObject[0]));
originalSourcePath = ClassPathSupport.createProxyClassPath(
new ClassPath[]{
cljClassPath
, originalSourcePath
, globalCP
});
} else {
pathRegistryListener = new PathRegistryListener();
GlobalPathRegistry.getDefault().addGlobalPathRegistryListener(
WeakListeners.create(GlobalPathRegistryListener.class,
pathRegistryListener,
GlobalPathRegistry.getDefault()));
JavaPlatformManager.getDefault().addPropertyChangeListener(
WeakListeners.propertyChange(pathRegistryListener,
JavaPlatformManager.getDefault()));
List<FileObject> allSourceRoots = new ArrayList<FileObject>();
Set<FileObject> preferredRoots = new HashSet<FileObject>();
Set<FileObject> addedBinaryRoots = new HashSet<FileObject>();
Project mainProject = OpenProjects.getDefault().getMainProject();
if (mainProject != null) {
SourceGroup[] sgs = ProjectUtils.getSources(mainProject).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
for (SourceGroup sg : sgs) {
ClassPath ecp = ClassPath.getClassPath(sg.getRootFolder(), ClassPath.SOURCE);
if (ecp == null) {
ecp = ClassPath.getClassPath(sg.getRootFolder(), ClassPath.EXECUTE);
}
if (ecp != null) {
FileObject[] binaryRoots = ecp.getRoots();
for (FileObject fo : binaryRoots) {
if (addedBinaryRoots.contains(fo)) {
continue;
}
addedBinaryRoots.add(fo);