public String[] getSourceRoots () { String[] fs1 = cp1.getSourceRoots (); String[] fs2 = cp2.getSourceRoots (); 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 array of source roots. */ public String[] getSourceRoots () { return getContext ().getSourceRoots (); }
private Set<FileObject> computeModuleRoots() { Set<FileObject> projectDirectories = new LinkedHashSet<>(); String[] sourceRoots = sourcePath.getSourceRoots(); for (String src : sourceRoots) { FileObject fo = getFileObject(src); if (fo == null) { continue; } Project p = getProject(fo); if (p == null) { continue; } projectDirectories.add(p.getProjectDirectory()); } return projectDirectories; }
private Set<FileObject> getSourceRootsFO(SourcePathProvider sp) { if (sp instanceof SourcePathProviderImpl) { return ((SourcePathProviderImpl) sp).getSourceRootsFO(); } else { String[] sourceRoots = sp.getSourceRoots(); Set<FileObject> fos = new HashSet<FileObject>(); for (String root : sourceRoots) { FileObject fo; int jarIndex = root.indexOf("!/"); if (jarIndex > 0) { fo = FileUtil.toFileObject(new java.io.File(root.substring(0, jarIndex))); fo = fo.getFileObject(root.substring(jarIndex + 2)); } else { fo = FileUtil.toFileObject(new java.io.File(root)); } if (fo != null) { fos.add(fo); } } return fos; } }
private Set<FileObject> getSourceRootsFO(SourcePathProvider sp) { if (sp instanceof SourcePathProviderImpl) { return ((SourcePathProviderImpl) sp).getSourceRootsFO(); } else { String[] sourceRoots = sp.getSourceRoots(); Set<FileObject> fos = new HashSet<FileObject>(); for (String root : sourceRoots) { FileObject fo; int jarIndex = root.indexOf("!/"); if (jarIndex > 0) { fo = FileUtil.toFileObject(new java.io.File(root.substring(0, jarIndex))); fo = fo.getFileObject(root.substring(jarIndex + 2)); } else { fo = FileUtil.toFileObject(new java.io.File(root)); } if (fo != null) { fos.add(fo); } } return fos; } }
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)); }