Package org.erlide.backend.api

Examples of org.erlide.backend.api.IBackend


    }

    public IBackend getBackend() {
        final IStructuredSelection sel = (IStructuredSelection) backends.getSelection();
        if (sel.getFirstElement() != null) {
            final IBackend b = (IBackend) sel.getFirstElement();
            return b;
        }
        return BackendCore.getBackendManager().getIdeBackend();
    }
View Full Code Here


        }

        final List<IBackend> backends = new ArrayList<IBackend>();
        final IBackendManager backendManager = BackendCore.getBackendManager();
        final Set<IBackend> ignored = new HashSet<IBackend>();
        IBackend backend;

        if ((backend = backendManager.getIdeBackend()) != null) {
            ignored.add(backend);
        }
        if ((backend = TraceBackend.getInstance().getBackend(false)) != null) {
View Full Code Here

        }
        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);
        }
View Full Code Here

        return null;
    }

    @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();
    }
View Full Code Here

    }

    public ConsoleRemoveLaunchAction(final ErlangConsole console) {
        this();
        fConsole = console;
        final IBackend backend = console.getBackend();
        fLaunch = backend.getData().getLaunch();
        update();
    }
View Full Code Here

        // else get dynamically, as this action was created via plug-in XML view
        // contribution
        final IConsole console = fConsoleView.getConsole();
        if (console instanceof ErlangConsole) {
            final ErlangConsole pconsole = (ErlangConsole) console;
            final IBackend backend = pconsole.getBackend();
            return backend.getData().getLaunch();
        }
        return null;
    }
View Full Code Here

        update();
    }

    @Override
    public void update() {
        final IBackend backend = fConsole.getBackend();
        setEnabled(backend.isRunning()
                && backend != BackendCore.getBackendManager().getIdeBackend());
    }
View Full Code Here

    }

    @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);
        }
    }
View Full Code Here

            return;
        }
        if (erlProject == null) {
            return;
        }
        final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                erlProject);
        if (backend == null) {
            final String message = "No backend with the required "
                    + "version could be found. Can't build.";
            MarkerUtils.createProblemMarker(project, null, message, 0,
                    IMarker.SEVERITY_ERROR);
            throw new BackendException(message);
        }
        final IErlModel model = ErlangEngine.getInstance().getModel();
        backend.addProjectPath(model.findProject(project));

        final Map<RpcFuture, IResource> results = new HashMap<RpcFuture, IResource>();
        for (final BuildResource bres : resourcesToBuild) {
            notifier.checkCancel();
            final IResource resource = bres.getResource();
            MarkerUtils.deleteMarkers(resource);
            if ("erl".equals(resource.getFileExtension())) {
                final String outputDir = erlProject.getProperties().getOutputDir()
                        .toString();
                final RpcFuture f = helper.startCompileErl(project, bres, outputDir,
                        backend.getOtpRpc(), compilerOptions, kind == BuildKind.FULL);
                if (f != null) {
                    results.put(f, resource);
                }
            } else if ("yrl".equals(resource.getFileExtension())) {
                final RpcFuture f = helper.startCompileYrl(project, resource,
                        backend.getOtpRpc(), compilerOptions);
                if (f != null) {
                    results.put(f, resource);
                }
            } else {
                ErlLogger.warn("Don't know how to compile: %s", resource.getName());
            }
        }

        final List<Entry<RpcFuture, IResource>> done = Lists.newArrayList();
        final List<Entry<RpcFuture, IResource>> waiting = Lists.newArrayList(results
                .entrySet());

        // TODO should use some kind of notification!
        while (!waiting.isEmpty()) {
            for (final Entry<RpcFuture, IResource> result : waiting) {
                notifier.checkCancel();
                OtpErlangObject r;
                try {
                    r = result.getKey().get(100, TimeUnit.MILLISECONDS);
                } catch (final Exception e) {
                    r = null;
                }
                if (r != null) {
                    final IResource resource = result.getValue();

                    helper.completeCompile(project, resource, r, backend.getOtpRpc(),
                            compilerOptions);
                    // notifier.compiled(resource.getLocation().toPortableString());

                    done.add(result);
                }
            }
            waiting.removeAll(done);
            done.clear();
        }
        helper.refreshOutputDir(project);

        try {
            helper.checkForClashes(backend.getOtpRpc(), project);
        } catch (final Exception e) {
        }
        backend.removeProjectPath(model.findProject(project));

    }
View Full Code Here

            final IErlProject eproject = ErlangEngine.getInstance().getModel()
                    .findProject(project);
            if (eproject == null) {
                return;
            }
            final IBackend backend = BackendCore.getBackendManager().getBuildBackend(
                    eproject);
            backend.getOtpRpc().call("erlide_builder", "compile_app_src", "ssla", appSrc,
                    destPath, modules);
        } catch (final Exception e) {
            ErlLogger.error(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.erlide.backend.api.IBackend

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.