use of org.erlide.core.builder.BuildResource in project erlide_eclipse by erlang.
the class CompileAction method run.
@Override
public void run() {
final AbstractErlangEditor editor = (AbstractErlangEditor) getSite().getPage().getActiveEditor();
final IErlModule module = editor.getModule();
if (module == null) {
return;
}
final IResource resource = module.getResource();
final IProject project = resource.getProject();
if (project == null) {
return;
}
final IErlProject eproject = ErlangEngine.getInstance().getModelUtilService().getProject(module);
if (eproject == null) {
return;
}
final IOtpRpc b = BackendCore.getBuildBackend(eproject);
final BuildResource bres = new BuildResource(resource);
final CompilerOptions prefs = new CompilerOptions(project);
prefs.load();
final OtpErlangList compilerOptions = prefs.export();
final IErlProject erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
if ("erl".equals(resource.getFileExtension())) {
helper.compileErl(project, bres, erlProject.getProperties().getOutputDir().toString(), b, compilerOptions);
}
if ("yrl".equals(resource.getFileExtension())) {
helper.compileYrl(project, bres, b, compilerOptions);
}
final ErlEditorActionBarContributor status = (ErlEditorActionBarContributor) editor.getEditorSite().getActionBarContributor();
status.displayMessage(String.format("File '%s' was compiled.", resource.getName()));
}
Aggregations