Package javarepl.rendering

Examples of javarepl.rendering.ExpressionTemplate


    @GET
    @Path("template")
    @Produces(MediaType.APPLICATION_JSON)
    public Model template(@QueryParam("expression") String expr) {
        ExpressionTemplate template = console.template(expr);
        return model()
                .add("template", template.template())
                .add("token", template.token());
    }
View Full Code Here


        console.shutdown();
    }

    @Test
    public void returnsTemplateForSpecifiedExpression() throws Exception {
        ExpressionTemplate template = client.template("void method(){}");

        assertThat(template.token(), is(EXPRESSION_TOKEN));
        assertThat(template.template(), containsString(template.token()));
    }
View Full Code Here

        }
    }

    public void updateCodeCompletion() {
        try {
            ExpressionTemplate template = replClient.template(myEditorDocument.getText());
            PsiFile contextFile = PsiFileFactory.getInstance(myProject).createFileFromText(randomIdentifier("Template") + ".java", JavaLanguage.INSTANCE, template.template());
            PsiCodeFragment consoleFile = JavaCodeFragmentFactory.getInstance(myProject).createCodeBlockCodeFragment(myEditorDocument.getText(), contextFile.findElementAt(contextFile.getText().indexOf(template.token())), false);

            myVirtualFile = (LightVirtualFile) consoleFile.getViewProvider().getVirtualFile();
            myFile = ObjectUtils.assertNotNull(PsiManager.getInstance(myProject).findFile(myVirtualFile));
            PsiDocumentManagerImpl.cachePsi(myEditorDocument, myFile);
        } catch (Exception e) {
View Full Code Here

    public ExpressionTemplate template(String expression) {
        Evaluator evaluator = context.get(Evaluator.class);
        Expression parsedExpression = evaluator.parseExpression(expression).right();

        return new ExpressionTemplate(renderExpressionClass(evaluator.context(), randomIdentifier("Evaluation"), parsedExpression), EXPRESSION_TOKEN);
    }
View Full Code Here

        this.client = new ClientHttpHandler();
    }

    public synchronized ExpressionTemplate template(String expression) throws Exception {
        Model model = parse(client.handle(get(url("template")).query("expression", expression).build()).entity().toString());
        return new ExpressionTemplate(model.get("template", String.class), model.get("token", String.class));
    }
View Full Code Here

TOP

Related Classes of javarepl.rendering.ExpressionTemplate

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.