use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class RuntimeCore method getRuntimeInfoCatalog.
public static final synchronized IRuntimeInfoCatalog getRuntimeInfoCatalog(final IRuntimeInfoSerializer serializer) {
if (RuntimeCore.runtimeInfoCatalog == null) {
final RuntimeInfoCatalogData data = serializer.load();
RuntimeCore.runtimeInfoCatalog = new RuntimeInfoCatalog();
RuntimeCore.runtimeInfoCatalog.setRuntimes(data.runtimes, data.defaultRuntimeName, data.erlideRuntimeName);
final RuntimeInfo runtime = RuntimeCore.runtimeInfoCatalog.getErlideRuntime();
if (!HostnameChecker.getInstance().detectHostNames(runtime.getOtpHome())) {
// XXX show troubleshooting page and re-detect
ErlLogger.error("no matching hostnames found!! Edit ~/.erlide.hosts");
}
}
return RuntimeCore.runtimeInfoCatalog;
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class RuntimeData method getCmdLine.
public String[] getCmdLine() {
final RuntimeInfo r = getRuntimeInfo();
final List<String> result = new ArrayList<>();
if (hasDetachedConsole() && !isInternal()) {
if (SystemConfiguration.getInstance().isOnWindows()) {
result.add("cmd.exe");
result.add("/c");
result.add("start");
} else {
final String command = System.getenv().get("TERM");
result.add(command);
result.add("-e");
}
}
String erl = r.getOtpHome() + "/bin/erl";
if (erl.indexOf(' ') >= 0) {
erl = "\"" + erl + "\"";
}
result.add(erl);
for (final String path : r.getCodePath()) {
if (!Strings.isNullOrEmpty(path)) {
result.add("-pa");
result.add(path);
}
}
if (!useStartShell()) {
result.add("-noshell");
}
if (!"".equals(getNodeName())) {
final String nameTag = hasLongName() ? "-name" : "-sname";
String nameOption = getNodeName();
if (!nameOption.contains("@")) {
nameOption += "@" + HostnameChecker.getInstance().getErlangHostName(hasLongName());
}
result.add(nameTag);
result.add(nameOption);
final String cky = getCookie();
if (!Strings.isNullOrEmpty(cky)) {
result.add("-setcookie");
result.add(cky);
}
}
final String gotArgs = r.getArgs();
if (!Strings.isNullOrEmpty(gotArgs)) {
result.addAll(splitQuoted(gotArgs));
}
return result.toArray(new String[result.size()]);
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class TraceBackend method createBackend.
private IBackend createBackend() {
final RuntimeInfo erlideRuntime = BackendCore.getRuntimeInfoCatalog().getErlideRuntime();
if (erlideRuntime == null) {
return null;
}
final RuntimeInfo info = new RuntimeInfo(erlideRuntime);
try {
final BackendData data = getBackendData(info);
data.setUseStartShell(true);
final IBackend b = BackendCore.getBackendManager().createExecutionBackend(data);
return b;
} catch (final Exception e) {
ErlLogger.error(e);
}
return null;
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class BackendLabelProvider method getText.
@Override
public String getText(final Object element) {
final IBackend b = (IBackend) element;
final BackendData data = b.getData();
final RuntimeInfo info = data.getRuntimeInfo();
final String s = info != null ? info.getName() : "<none>";
return s + ": " + data.getNodeName();
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class BackendFactory method getBuildBackendData.
private BackendData getBuildBackendData(@NonNull final RuntimeInfo info) {
final RuntimeInfo myinfo = new RuntimeInfo(info);
final BackendData result = new BackendData(myinfo);
result.setNodeName(info.getVersion().asMajor().toString() + "_" + BackendUtils.getErlideNodeNameTag());
result.setCookie("erlide");
result.setRestartable(true);
result.setDebug(false);
result.setManaged(true);
result.setConsole(false);
result.setLongName(HostnameChecker.getInstance().canUseLongNames());
result.setInternal(true);
result.setReportErrors(true);
result.setContext(CodeContext.IDE);
return result;
}
Aggregations