use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class BuilderHelper method refreshDirs.
private void refreshDirs(final IProject project, final OtpErlangObject element) {
final OtpErlangList list = (OtpErlangList) element;
final Map<IPath, String> paths = Maps.newHashMap();
for (final OtpErlangObject ebeam : list) {
final OtpErlangString beam = (OtpErlangString) ebeam;
final String sbeam = beam.stringValue();
IPath p = new Path(sbeam);
p = p.removeLastSegments(1);
p = p.removeFirstSegments(project.getLocation().segmentCount());
p = p.setDevice(null);
paths.put(p, sbeam);
}
for (final Entry<IPath, String> p : paths.entrySet()) {
final IPath pp = p.getKey();
IResource dir = project.findMember(pp);
if (dir == null) {
try {
final IResource[] top = project.members();
if (top.length == 1 && top[0] instanceof IContainer) {
final IResource[] ds = ((IContainer) top[0]).members();
for (final IResource r : ds) {
if (r.getLocation().toPortableString().equals(p.getValue())) {
dir = r;
break;
}
}
}
} catch (final CoreException e) {
e.printStackTrace();
}
}
if (dir != null) {
try {
dir.refreshLocal(IResource.DEPTH_ONE, null);
} catch (final CoreException e) {
}
}
}
}
Aggregations