/**
   * Checks if the first element in the test file is selected in the VPE when the VPE is just
   * loaded.
   *
   * @throws Throwable
   */
  public void testJBIDE4037Test() throws Throwable {
    setException(null);
    IFile ifile = (IFile) TestUtil.getComponentPath(FILE_PATH, JsfAllTests.IMPORT_PROJECT_NAME);
    IEditorInput input = new FileEditorInput(ifile);
    JSPMultiPageEditor part = openEditor(input);

    TestUtil.waitForJobs();
    nsIDOMElement rootElement =
        TestUtil.getVpeController(part).getXulRunnerEditor().getSelectedElement();

    // check if something selected
    assertNotNull(rootElement);
    // check if the selected element is the first element on the page (we know its ID)
    assertEquals(ROOT_ELEMENT_ID, rootElement.getAttribute(HTML.ATTR_ID));

    if (getException() != null) {
      throw getException();
    }
  }
  /**
   * If there are several f:views on the page. Only the last f:view one should be applied on server,
   * but each f:view should have its own locale.
   *
   * @throws Throwable
   */
  public void testSeveralFViewsWithLocales() throws Throwable {

    IFile file =
        (IFile)
            TestUtil.getComponentPath(SEVERAL_FVIEWS_PAGE, JsfAllTests.IMPORT_JSF_20_PROJECT_NAME);
    assertNotNull(
        "Could not open specified file." //$NON-NLS-1$
            + " componentPage = "
            + SEVERAL_FVIEWS_PAGE //$NON-NLS-1$
            + ";projectName = "
            + JsfAllTests.IMPORT_JSF_20_PROJECT_NAME,
        file); //$NON-NLS-1$
    IEditorInput input = new FileEditorInput(file);
    assertNotNull("Editor input is null", input); // $NON-NLS-1$
    /*
     * open and get the editor
     */
    JSPMultiPageEditor part = openEditor(input);
    VpeController controller = TestUtil.getVpeController(part);

    javaSources = EclipseResourceUtil.getJavaProjectSrcLocations(file.getProject());
    nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
    nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT0_ID);
    String localizedText = getLocalizedText(localeText);
    checkLocaleStrings(file, "en", localizedText); // $NON-NLS-1$

    localeText = doc.getElementById(LOCALE_TEXT1_ID);
    localizedText = getLocalizedText(localeText);
    checkLocaleStrings(file, "de", localizedText); // $NON-NLS-1$

    localeText = doc.getElementById(LOCALE_TEXT2_ID);
    localizedText = getLocalizedText(localeText);
    /*
     * f:view will use default locale if nothing is specified.
     */
    checkLocaleStrings(file, "en_US", localizedText); // $NON-NLS-1$

    localeText = doc.getElementById(LOCALE_TEXT_ID);
    localizedText = getLocalizedText(localeText);
    checkLocaleStrings(file, "en_GB", localizedText); // $NON-NLS-1$

    closeEditors();
  }