Package com.google.devtools.moe.client.editors

Examples of com.google.devtools.moe.client.editors.Translator


    }
    ImmutableMap<String, Editor> editors = editorsBuilder.build();

    ImmutableMap.Builder<TranslatorPath, Translator> translatorsBuilder = ImmutableMap.builder();
    for (TranslatorConfig tc : config.getTranslators()) {
      Translator t = makeTranslatorFromConfig(tc, config);
      TranslatorPath tPath = new TranslatorPath(tc.getFromProjectSpace(), tc.getToProjectSpace());
      translatorsBuilder.put(tPath, t);
    }
    ImmutableMap<TranslatorPath, Translator> translators = translatorsBuilder.build();
View Full Code Here


  public Codebase createCodebase(ProjectContext context) throws CodebaseCreationError {
    Codebase codebaseToTranslate = exToTranslate.createCodebase(context);
    String toProjectSpace = translateOp.term.identifier;
    TranslatorPath path = new TranslatorPath(
        codebaseToTranslate.getProjectSpace(), toProjectSpace);
    Translator translator = context.translators.get(path);
    if (translator == null) {
      throw new CodebaseCreationError(
          String.format("Could not find translator from project space \"%s\" to \"%s\"",
                        codebaseToTranslate.getProjectSpace(), toProjectSpace));
    }

    Ui.Task translateTask = AppContext.RUN.ui.pushTask(
        "translate",
        String.format(
            "Translating %s from project space \"%s\" to \"%s\"",
            codebaseToTranslate.getPath(), codebaseToTranslate.getProjectSpace(), toProjectSpace));

    Codebase translatedCodebase =
        translator.translate(codebaseToTranslate, translateOp.term.options, context);

    // Don't mark the translated codebase for persistence if it wasn't allocated by the Translator.
    if (translatedCodebase.equals(codebaseToTranslate)) {
      AppContext.RUN.ui.popTask(translateTask, translatedCodebase.getPath() + " (unmodified)");
    } else {
View Full Code Here

    File firstDir = new File("/first");
    File secondDir = new File("/second");
    File finalDir = new File("/final");

    TranslatorPath tPath = new TranslatorPath("foo", "public");
    Translator t = new ForwardTranslator(ImmutableList.<TranslatorStep>of(
        new TranslatorStep("quux", translatorEditor)));
   
    ProjectContext context = ProjectContext.builder()
        .withRepositories(ImmutableMap.of("foo", new Repository("foo", null, cc, null)))
        .withTranslators(ImmutableMap.of(tPath, t))
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.editors.Translator

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.