public String[] getOriginalSourceRoots () { String[] fs1 = cp1.getOriginalSourceRoots (); String[] fs2 = cp2.getOriginalSourceRoots (); String[] fs = new String [fs1.length + fs2.length]; System.arraycopy (fs1, 0, fs, 0, fs1.length); System.arraycopy (fs2, 0, fs, fs1.length, fs2.length); return fs; }
/** * Returns set of original source roots. * * @return set of original source roots */ public String[] getOriginalSourceRoots () { return getContext ().getOriginalSourceRoots (); }
private void initSourcePaths () { Properties properties = Properties.getDefault (). getProperties ("debugger").getProperties ("sources"); Set originalSourceRoots = new HashSet (Arrays.asList ( sourcePathProvider.getOriginalSourceRoots () )); Set sourceRoots = new HashSet (Arrays.asList ( sourcePathProvider.getSourceRoots () )); Iterator enabledSourceRoots = properties.getProperties ("source_roots"). getCollection ("enabled", Collections.EMPTY_SET).iterator (); while (enabledSourceRoots.hasNext ()) { String root = (String) enabledSourceRoots.next (); if (originalSourceRoots.contains (root)) sourceRoots.add (root); } Iterator disabledSourceRoots = properties.getProperties ("source_roots"). getCollection ("disabled", Collections.EMPTY_SET).iterator (); while (disabledSourceRoots.hasNext ()) { String root = (String) disabledSourceRoots.next (); sourceRoots.remove (root); } String[] ss = new String [sourceRoots.size ()]; sourcePathProvider.setSourceRoots ((String[]) sourceRoots.toArray (ss)); }
private JavaSource getJavaSource(SourcePathProvider sp) { String[] roots = sp.getOriginalSourceRoots(); List<FileObject> sourcePathFiles = new ArrayList<FileObject>(); for (String root : roots) { FileObject fo = FileUtil.toFileObject (new java.io.File(root)); if (fo != null && FileUtil.isArchiveFile (fo)) { fo = FileUtil.getArchiveRoot (fo); } sourcePathFiles.add(fo); } ClassPath bootPath = ClassPathSupport.createClassPath(new FileObject[] {}); ClassPath classPath = ClassPathSupport.createClassPath(new FileObject[] {}); ClassPath sourcePath = ClassPathSupport.createClassPath(sourcePathFiles.toArray(new FileObject[] {})); return JavaSource.create(ClasspathInfo.create(bootPath, classPath, sourcePath), new FileObject[] {}); }