use of org.erlide.backend.api.IBackendManager in project erlide_eclipse by erlang.
the class BackendFactory method createBackend.
@Override
public synchronized IBackend createBackend(final BackendData data) {
ErlLogger.debug("Create backend " + data.getNodeName());
final IBackend b;
final IOtpNodeProxy runtime = createNodeProxy(data);
final IBackendManager backendManager = BackendCore.getBackendManager();
b = data.isInternal() ? new Backend(data, runtime, backendManager) : new ExternalBackend(data, runtime, backendManager);
b.initialize(data.getContext(), backendManager.getCodeBundles());
runtime.ensureRunning();
return b;
}
use of org.erlide.backend.api.IBackendManager in project erlide_eclipse by erlang.
the class BuilderHelper method loadModule.
public static void loadModule(@NonNull final IProject project, final String module) {
try {
final IBackendManager backendManager = BackendCore.getBackendManager();
for (final IBackend b : backendManager.getExecutionBackends(project)) {
ErlLogger.debug(":: loading %s in %s", module, b.getName());
final IErlProject erlProject = ErlangEngine.getInstance().getModel().findProject(project);
final IPath path = project.getLocation().append(erlProject.getProperties().getOutputDir()).append(module + ".beam");
boolean ok = false;
final OtpErlangBinary bin = BeamUtil.getBeamBinary(module, path);
if (bin != null) {
ok = BeamLoader.loadBeam(b.getOtpRpc(), module, bin);
}
if (!ok) {
ErlLogger.error("Could not load %s", module);
}
backendManager.moduleLoaded(b, project, module);
}
} catch (final Exception e) {
ErlLogger.debug(e);
}
}
use of org.erlide.backend.api.IBackendManager in project erlide_eclipse by erlang.
the class SendToConsoleAction method getConsole.
private IErlangConsole getConsole(@NonNull final IProject aproject) {
final IBackendManager backendManager = BackendCore.getBackendManager();
final Set<IBackend> executionBackends = backendManager.getExecutionBackends(aproject);
final ErlConsoleManager erlConsoleManager = ErlideUIPlugin.getDefault().getErlConsoleManager();
IErlangConsole result = null;
for (final IBackend backend : executionBackends) {
result = erlConsoleManager.getConsole(backend);
if (result != null) {
break;
}
}
return result;
}
use of org.erlide.backend.api.IBackendManager in project erlide_eclipse by erlang.
the class NodeHelper method getBackends.
/**
* Returns backends managed by erlide. Depending on argument nodes irrelevant
* from user's point of view (tracing and ide backends) can be omitted in
* resulting list.
*
* @param ignore
* if nodes should be omitted
* @return list of backends
*/
public static Collection<? extends @NonNull IBackend> getBackends(final boolean ignore) {
if (!ignore) {
return BackendCore.getBackendManager().getAllBackends();
}
final List<@NonNull IBackend> backends = new ArrayList<>();
final IBackendManager backendManager = BackendCore.getBackendManager();
final Set<IBackend> ignored = new HashSet<>();
IBackend backend;
if ((backend = backendManager.getIdeBackend()) != null) {
ignored.add(backend);
}
if ((backend = TraceBackend.getInstance().getBackend(false)) != null) {
ignored.add(backend);
}
for (final IBackend erlideBackend : BackendCore.getBackendManager().getAllBackends()) {
if (!ignored.contains(erlideBackend)) {
backends.add(erlideBackend);
}
}
return backends;
}
use of org.erlide.backend.api.IBackendManager in project erlide_eclipse by erlang.
the class ConsoleTerminateAction method run.
@Override
public void run() {
try {
final IBackend backend = fConsole.getBackend();
final ILaunch launch = backend.getData().getLaunch();
if (launch != null) {
terminate(launch);
final Collection<IProject> projects = Lists.newArrayList(backend.getData().getProjects());
final IBackendManager backendManager = BackendCore.getBackendManager();
for (final IProject project : projects) {
backendManager.removeExecutionBackend(project, backend);
}
setEnabled(false);
fConsole.stop();
}
if (!backend.equals(BackendCore.getBackendManager().getIdeBackend())) {
backend.dispose();
}
} catch (final DebugException e) {
ErlLogger.error(e);
}
}
Aggregations