Package ccw.repl

Examples of ccw.repl.REPLView


          return;
        }
       
        final String sourcePath = computeSourcePath(editor, editorFile, filePath);

        final REPLView repl = REPLView.activeREPL.get();
        if (repl != null && !repl.isDisposed())  {
          try {
            evaluateFileText(repl, editor.getDocument().get(), filePath, sourcePath, fileName);
            //  FIXME: normal that we switch in namespace if start (if no repl), and not if not start ... ?
          } catch (Exception e) {
            CCWPlugin.logError("Could not start a REPL for loading file " + filePath, e);
          }
        } else if (editorFile != null) {
        CCWPlugin.getTracer().trace(TraceOptions.LAUNCHER, "No active REPL found (",
            (repl == null) ? "active repl is null" : "active repl is disposed",
            "), so launching a new one");
          final IProject project = editorFile.getProject();
          new ClojureLaunchShortcut().launchProject(project, mode,
              forceLeinLaunchWhenPossible,
              new IWithREPLView() {
            @Override
            public void run(final REPLView repl) {
                  if (repl != null && !repl.isDisposed()) {
                    try {
                      evaluateFileText(repl, editor.getDocument().get(), filePath, sourcePath, fileName);
                    } catch(Exception e) {
                      CCWPlugin.logError("Could not start a REPL for loading file " + filePath, e);
                    }
View Full Code Here


   
    if (selectedText==null || selectedText.trim().equals("")) {
      selectedText = editor.getCurrentTopLevelSExpression();
    }

    REPLView repl = REPLView.activeREPL.get();
    if (repl != null && !repl.isDisposed()) {
      String textToEvaluate = selectedText;
      String editorNamespace = editor.findDeclaringNamespace();
      String replNamespace = repl.getCurrentNamespace();
      if (editorNamespace != null && !editorNamespace.equals(replNamespace)) {
        textToEvaluate = "(in-ns '" + editorNamespace + ")\n" + textToEvaluate + "\n(in-ns '" + replNamespace + ")";
      }
     
      EvaluateTextUtil.evaluateText(repl, textToEvaluate, true);
View Full Code Here

      }
        private void syncConnectRepl(final String replURL, final IWithREPLView withREPLView) {
          DisplayUtil.syncExec(new Runnable() {
        @Override public void run() {
          try {
            REPLView replView = REPLView.connect(replURL, lastConsoleOpened, launch, makeActiveREPL);
            String startingNamespace = REPLURLOpener.this.launch.getLaunchConfiguration().getAttribute(LaunchUtils.ATTR_NS_TO_START_IN, "user");
                    replView.setCurrentNamespace(startingNamespace);
                    if (withREPLView != null) {
                      withREPLView.run(replView);
                    }
                    replView.setFocus();
          } catch (Exception e) {
            throw new RuntimeException("Could not connect REPL to local launch", e);
                  }
        }
          });
View Full Code Here

       
        return null;
    }
   
    public SafeConnection getProjectREPLSafeConnection (IProject project) {
        REPLView repl = getProjectREPL(project);
        return repl == null ? null : repl.getSafeToolingConnection();
    }
View Full Code Here

        // We will probably have to refactor stuff to separate things a little bit more, but for the time
        // being, as an experiment and hopefully a temporary patch for the problem, I'll just add a little bit
        // delay in the build:
       
        // TODO see if we can do something more clever than having to use the UI thread and get a View object ...
        REPLView repl = CCWPlugin.getDefault().getProjectREPL(project);
        if (repl == null) {
          // Another chance, to fight with a hack, temporarily at least, the race condition
          try {
          Thread.sleep(500);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
        repl = CCWPlugin.getDefault().getProjectREPL(project);
        }
        if (repl == null || repl.isDisposed() || !ClojureLaunchDelegate.isAutoReloadEnabled(repl.getLaunch())) {
//          System.out.println("REPL not found, or disposed, or autoReloadEnabled not found on launch configuration");
          return;
        }
       
        deleteMarkers(project);
       
       
        ClojureVisitor visitor = new ClojureVisitor(repl.getSafeToolingConnection());
        visitor.visit(getSrcFolders(project));
       
        getClassesFolder(project).refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 0));
    }
View Full Code Here

        this.editor = editor;
        setEnabled(true);
    }

    public void run() {
        REPLView repl = REPLView.activeREPL.get();
        run(repl, editor, true);
    }
View Full Code Here

    }
    @Override
    public void run() {
        try {
            String lib = editor.findDeclaringNamespace();
            REPLView replView = editor.getCorrespondingREPL();
            SafeConnection replConnection = replView.getSafeToolingConnection();
            Response compilationResult = replConnection.send(15000, "op", "eval", "code", CompileLibAction.compileLibCommand(lib));
            refreshCompilationResults();
            if (new Long(0).equals(((Map)compilationResult.values().get(0)).get("response-type"))) {
                runTests(lib, replConnection);
            } else {
View Full Code Here

     *  TODO Still 1 more case to handle:
     *  - when a LIBRARY does not have source file in its classpath, then search attached source files folder/archive
     */
    public static void openInEditor(String searchedNS, String searchedFileName, int line) {
    try {
        REPLView replView = REPLView.activeREPL.get();
        if (replView != null) {
          String projectName = replView.getLaunch().getLaunchConfiguration().getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
            openInEditor(searchedNS, searchedFileName, line, projectName, false);
        }
    } catch (CoreException e) {
      CCWPlugin.logError("error while trying to obtain project's name from configuration, while trying to show source file of a symbol", e);
    }
View Full Code Here

TOP

Related Classes of ccw.repl.REPLView

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.