Search in sources :

Example 21 with RuntimeInfo

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;
}
Also used : IRuntimeInfoCatalog(org.erlide.runtime.runtimeinfo.IRuntimeInfoCatalog) RuntimeInfoCatalog(org.erlide.runtime.runtimeinfo.RuntimeInfoCatalog) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) RuntimeInfoCatalogData(org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData)

Example 22 with RuntimeInfo

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()]);
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) ArrayList(java.util.ArrayList)

Example 23 with RuntimeInfo

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;
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) BackendData(org.erlide.backend.api.BackendData) IBackend(org.erlide.backend.api.IBackend) RpcException(org.erlide.runtime.rpc.RpcException)

Example 24 with RuntimeInfo

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();
}
Also used : BackendData(org.erlide.backend.api.BackendData) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IBackend(org.erlide.backend.api.IBackend)

Example 25 with RuntimeInfo

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;
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) BackendData(org.erlide.backend.api.BackendData)

Aggregations

RuntimeInfo (org.erlide.runtime.runtimeinfo.RuntimeInfo)29 ArrayList (java.util.ArrayList)5 BackendData (org.erlide.backend.api.BackendData)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IBackend (org.erlide.backend.api.IBackend)4 CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 RuntimeInfoCatalogData (org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData)3 Viewer (org.eclipse.jface.viewers.Viewer)2 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Text (org.eclipse.swt.widgets.Text)2 List (java.util.List)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1