Package org.eclipse.wb.internal.core.nls

Examples of org.eclipse.wb.internal.core.nls.NlsSupport


            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "    rootPanel.setTitle('My title');",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    assertEquals(0, support.getSources().length);
  }
View Full Code Here


            "  }",
            "  private String getMyText(String s) {",
            "    return s;",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    assertEquals(0, support.getSources().length);
  }
View Full Code Here

            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "    rootPanel.setTitle(new Object().toString());",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    assertEquals(0, support.getSources().length);
  }
View Full Code Here

            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "    rootPanel.setTitle(CONSTANTS.rootPanel_title());",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    // check that we have GWTSource
    GwtSource source;
    {
      AbstractSource[] sources = support.getSources();
      assertEquals(1, sources.length);
      source = (GwtSource) sources[0];
    }
    // check getBundleComment()
    assertEquals(
View Full Code Here

            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    IEditableSupport editableSupport = support.getEditable();
    //
    List<IEditableSource> editableSources = editableSupport.getEditableSources();
    assertThat(editableSources).hasSize(1);
    IEditableSource editableSource = editableSources.get(0);
    assertEquals(
View Full Code Here

            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    IEditableSupport editableSupport = support.getEditable();
    //
    List<IEditableSource> editableSources = editableSupport.getEditableSources();
    assertThat(editableSources).hasSize(1);
    IEditableSource editableSource = editableSources.get(0);
    assertEquals(
View Full Code Here

            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    IEditableSupport editableSupport = support.getEditable();
    //
    List<IEditableSource> editableSources = editableSupport.getEditableSources();
    assertThat(editableSources).hasSize(1);
    IEditableSource editableSource = editableSources.get(0);
    assertEquals(
View Full Code Here

            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    IEditableSupport editableSupport = support.getEditable();
    //
    List<IEditableSource> editableSources = editableSupport.getEditableSources();
    assertThat(editableSources).hasSize(1);
    IEditableSource editableSource = editableSources.get(0);
    assertEquals(
View Full Code Here

            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    //
    // STAGE #1: add locale
    //
    {
      IEditableSupport editableSupport = support.getEditable();
      IEditableSource editableSource = editableSupport.getEditableSources().get(0);
      // check initial locales
      {
        LocaleInfo[] locales = editableSource.getLocales();
        assertEquals(1, locales.length);
        assertEquals("(default)", locales[0].getTitle());
      }
      // add locales
      {
        editableSource.addLocale(new LocaleInfo(new Locale("it")), LocaleInfo.DEFAULT);
        editableSource.addLocale(new LocaleInfo(new Locale("fr")), null);
      }
      // check new locales
      {
        LocaleInfo[] locales = editableSource.getLocales();
        assertEquals(3, locales.length);
        assertEquals("(default)", locales[0].getTitle());
        assertEquals("fr", locales[1].getTitle());
        assertEquals("it", locales[2].getTitle());
      }
      // apply commands
      support.applyEditable(editableSupport);
      // checks
      {
        // *.properties: default
        {
          String newProperties = getFileContentSrc("test/client/MyConstants.properties");
          assertTrue(newProperties.contains("rootPanel_title=My title"));
        }
        // *.properties: fr
        {
          String newProperties = getFileContentSrc("test/client/MyConstants_fr.properties");
          assertFalse(newProperties.contains("rootPanel_title=My title"));
        }
        // *.properties: it
        {
          String newProperties = getFileContentSrc("test/client/MyConstants_it.properties");
          assertTrue(newProperties.contains("rootPanel_title=My title"));
        }
        // module
        {
          String module = getFileContentSrc("test/Module.gwt.xml");
          assertTrue(module.contains("<extend-property name=\"locale\" values=\"fr,it\"/>"));
        }
      }
    }
    //
    // STAGE #2: remove locale
    //
    {
      IEditableSupport editableSupport = support.getEditable();
      IEditableSource editableSource = editableSupport.getEditableSources().get(0);
      // remove locales
      {
        editableSource.removeLocale(new LocaleInfo(new Locale("it")));
        editableSource.removeLocale(new LocaleInfo(new Locale("fr")));
        support.applyEditable(editableSupport);
      }
      // check new locales
      {
        LocaleInfo[] locales = editableSource.getLocales();
        assertEquals(1, locales.length);
View Full Code Here

            "    RootPanel rootPanel = RootPanel.get();",
            "    rootPanel.setTitle('My title');",
            "    rootPanel.setStyleName('My style');",
            "  }",
            "}");
    NlsSupport support = NlsSupport.get(frame);
    IEditableSupport editableSupport = support.getEditable();
    // prepare possible source
    IEditableSource editableSource;
    {
      List<IEditableSource> editableSources = editableSupport.getEditableSources();
      assertEquals(1, editableSources.size());
      editableSource = editableSources.get(0);
    }
    // do externalize
    {
      StringPropertyInfo propertyInfo;
      // text
      propertyInfo = new StringPropertyInfo((GenericProperty) frame.getPropertyByTitle("title"));
      editableSupport.externalizeProperty(propertyInfo, editableSource, true);
      // title
      propertyInfo =
          new StringPropertyInfo((GenericProperty) frame.getPropertyByTitle("styleName"));
      editableSupport.externalizeProperty(propertyInfo, editableSource, true);
    }
    // apply commands
    support.applyEditable(editableSupport);
    // check
    assertEditor(
        "public class Test implements EntryPoint {",
        "  private static final MyConstants CONSTANTS = GWT.create(MyConstants.class);",
        "  public void onModuleLoad() {",
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.nls.NlsSupport

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.