public void completeCompile( final IProject project, final IResource source, final OtpErlangObject compilationResult, final IBackend backend, final OtpErlangList compilerOptions) { if (compilationResult == null) { MarkerUtils.addProblemMarker( source, null, null, "Could not compile file", 0, IMarker.SEVERITY_ERROR); return; } final OtpErlangTuple t = (OtpErlangTuple) compilationResult; // ErlLogger.debug("** " + t); if ("ok".equals(((OtpErlangAtom) t.elementAt(0)).atomValue())) { final String beamf = source.getFullPath().removeFileExtension().lastSegment(); InternalErlideBuilder.loadModule(project, beamf); refreshDirs(project, t.elementAt(2)); } else { // ErlLogger.debug(">>>> compile error... %s\n %s", // resource.getName(), t); } // process compilation messages if (t.elementAt(1) instanceof OtpErlangList) { final OtpErlangList l = (OtpErlangList) t.elementAt(1); MarkerUtils.addErrorMarkers(source, l); } else { ErlLogger.warn("bad result from builder: %s", t); } completeCompileForYrl(project, source, backend, compilerOptions); }
public void checkForClashes(final IBackend backend, final IProject project) { try { final OtpErlangList res = InternalErlideBuilder.getCodeClashes(backend); for (final OtpErlangObject elem : res) { final OtpErlangTuple t = (OtpErlangTuple) elem; final String f1 = ((OtpErlangString) t.elementAt(0)).stringValue(); final String f2 = ((OtpErlangString) t.elementAt(1)).stringValue(); // add marker only for modules belonging to this project! final IResource r1 = project.findMember(f1); final IResource r2 = project.findMember(f2); if (r1 != null || r2 != null) { MarkerUtils.addMarker( project, null, project, "Code clash between " + f1 + " and " + f2, 0, IMarker.SEVERITY_WARNING, ""); } } } catch (final Exception e) { } try { final IErlProject erlProject = ErlModelManager.getErlangModel().getErlangProject(project); final Collection<IPath> sd = erlProject.getSourceDirs(); final String[] dirList = new String[sd.size()]; int j = 0; for (final IPath sp : sd) { dirList[j++] = project.getLocation().toPortableString() + "/" + sp; } final OtpErlangList res = InternalErlideBuilder.getSourceClashes(backend, dirList); for (int i = 0; i < res.arity(); i++) { final OtpErlangTuple t = (OtpErlangTuple) res.elementAt(i); final String f1 = ((OtpErlangString) t.elementAt(0)).stringValue(); final String f2 = ((OtpErlangString) t.elementAt(1)).stringValue(); MarkerUtils.addMarker( project, null, project, "Duplicated module name in " + f1 + " and " + f2, 0, IMarker.SEVERITY_WARNING, ""); } } catch (final Exception e) { ErlLogger.debug(e); } }
public IRpcFuture startCompileErl( final IProject project, final BuildResource bres, final String outputDir0, final IBackend backend, final OtpErlangList compilerOptions, final boolean force) { final IPath projectPath = project.getLocation(); final IResource res = bres.getResource(); final String s = res.getFileExtension(); if (!"erl".equals(s)) { ErlLogger.warn("trying to compile " + res.getName() + "?!?!"); } MarkerUtils.deleteMarkers(res); String outputDir; outputDir = getRealOutputDir(bres, outputDir0, projectPath); final Collection<IPath> includeDirs = getAllIncludeDirs(project); // delete beam file final IPath beamPath = getBeamForErl(res); final IResource beam = project.findMember(beamPath); try { final boolean shouldCompile = force || shouldCompile(project, res, beam); if (shouldCompile) { if (beam != null) { try { beam.delete(true, null); } catch (final Exception e) { ErlLogger.warn(e); } } if (isDebugging()) { ErlLogger.debug("compiling %s", res.getName()); } createTaskMarkers(project, res); return InternalErlideBuilder.compileErl( backend, res.getLocation(), outputDir, includeDirs, compilerOptions); } else { return null; } } catch (final Exception e) { ErlLogger.warn(e); return null; } }
@Override public void addErrorMarker(IResource resource, String type, MavenProblemInfo problem) { IMarker marker = addMarker( resource, type, problem.getMessage(), problem.getLocation().getLineNumber(), problem.getSeverity()); try { problem.processMarker(marker); } catch (CoreException ex) { log.error(ex.getMessage(), ex); } MarkerUtils.decorateMarker(marker); }
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // param handling and uri generation // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX public String getURI(double lat, double lon, int sizeW, int sizeH, MapMarker... markers) { _validateParams(sizeW, sizeH, ZoomDefault); // generate the URI StringBuilder sb = new StringBuilder(); sb.append(GmapStaticURI); // size key sb.append("?").append(SizeKey).append("=").append(sizeW).append(SizeSeparator).append(sizeH); // markers key sb.append("&").append(MarkerUtils.toString(markers)); // maps key sb.append("&").append(GmapLicenseKey).append("=").append(GmapLicense); return sb.toString(); }
public IRpcFuture startCompileYrl( final IProject project, final IResource resource, final IBackend backend, final OtpErlangList compilerOptions) { // final IPath projectPath = project.getLocation(); // final OldErlangProjectProperties prefs = new // OldErlangProjectProperties(project); MarkerUtils.deleteMarkers(resource); // try { // resource.deleteMarkers(PROBLEM_MARKER, true, // IResource.DEPTH_INFINITE); // } catch (final CoreException e1) { // } final IPath erl = getErlForYrl(resource); final IResource br = project.findMember(erl); // we should check timestamps, but yrl files are rare, so it doesn't // matter much try { if (br != null && br.exists()) { try { br.delete(true, null); } catch (final Exception e) { ErlLogger.warn(e); } } final String input = resource.getLocation().toString(); final String output = resource.getLocation().removeFileExtension().toString(); return InternalErlideBuilder.compileYrl(backend, input, output); } catch (final Exception e) { e.printStackTrace(); return null; } }
public String getURI(double lat, double lon, int sizeW, int sizeH, int zoom) { _validateParams(sizeW, sizeH, zoom); // generate the URI StringBuilder sb = new StringBuilder(); sb.append(GmapStaticURI); // center key sb.append("?").append(CenterKey).append("=").append(lat).append(",").append(lon); // zoom key sb.append("&").append(ZoomKey).append("=").append(zoom); // size key sb.append("&").append(SizeKey).append("=").append(sizeW).append(SizeSeparator).append(sizeH); // markers key sb.append("&").append(MarkerUtils.toString(new MapMarker(lat, lon))); // maps key sb.append("&").append(GmapLicenseKey).append("=").append(GmapLicense); return sb.toString(); }