public void testAddScriptFromJavaScriptSourceFile() {

    File file1 =
        TestUtils.createFileFromString("test", ".js", ""); // $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
    File mochiBase =
        TestUtils.createFileFromString(
            "MochiBase", ".js", ""); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    String src =
        "/**\n * @sdoc "
            + file1.getName()
            + "\n*/\nMochiKit.MochiKit.SUBMODULES = [\r\n\""
            + FileUtils.stripExtension(mochiBase.getName())
            + "\"];"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    File file = TestUtils.createFileFromString("base", ".js", src); // $NON-NLS-1$ //$NON-NLS-2$

    String uri = CoreUIUtils.getURI(file);

    String[] sdocs;
    sdocs = ProfilesViewHelper.addScriptFromJavaScriptSource(FileUtils.uriToURL(uri));

    assertEquals("Two sdoc files found", 2, sdocs.length); // $NON-NLS-1$
    assertEquals(CoreUIUtils.getURI(file1), sdocs[0]);
    assertEquals(CoreUIUtils.getURI(mochiBase), sdocs[1]);

    String[] sdocs2 = ProfilesViewHelper.addScriptFromJavaScriptSource(file.getParentFile(), src);

    assertEquals("Two sdoc files found", 2, sdocs2.length); // $NON-NLS-1$
    assertEquals(CoreUIUtils.getURI(file1), sdocs2[0]);
    assertEquals(CoreUIUtils.getURI(mochiBase), sdocs2[1]);
  }
 public void testAddSDocFromJavaScriptSourceFile() {
   File file1 =
       TestUtils.createFileFromString("test", ".js", ""); // $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
   String src = "/**\n * @sdoc " + file1.getName() + "\n*/"; // $NON-NLS-1$ //$NON-NLS-2$
   File file = TestUtils.createFileFromString("base", ".js", src); // $NON-NLS-1$//$NON-NLS-2$
   String uri = CoreUIUtils.getURI(file);
   String[] sdocs = ProfilesViewHelper.addSDocFromJavaScriptSource(FileUtils.uriToURL(uri));
   assertEquals("One sdoc file found", 1, sdocs.length); // $NON-NLS-1$
   assertEquals(CoreUIUtils.getURI(file1), sdocs[0]);
 }
  /** @see com.aptana.ide.editors.unified.ContributedBrowser#displaySource() */
  public void displaySource() {
    if (document != null) {
      nsIDOMSerializer serializer =
          (nsIDOMSerializer)
              Mozilla.getInstance()
                  .getComponentManager()
                  .createInstanceByContractID(
                      "@mozilla.org/xmlextras/xmlserializer;1",
                      null, //$NON-NLS-1$
                      nsIDOMSerializer.NS_IDOMSERIALIZER_IID);
      String source = serializer.serializeToString(document.getDocumentElement());
      try {
        final String newFileName =
            FileUtils.getRandomFileName("source", ".html"); // $NON-NLS-1$ //$NON-NLS-2$
        final File temp = new File(FileUtils.systemTempDir + File.separator + newFileName);
        FileUtils.writeStringToFile(source, temp);
        UIJob openJob =
            new UIJob(Messages.getString("FirefoxBrowser.Open_Source_Editor")) // $NON-NLS-1$
            {

              public IStatus runInUIThread(IProgressMonitor monitor) {
                IEditorInput input = CoreUIUtils.createJavaFileEditorInput(temp);
                try {
                  IDE.openEditor(
                      Activator.getDefault()
                          .getWorkbench()
                          .getActiveWorkbenchWindow()
                          .getActivePage(),
                      input,
                      IDE.getEditorDescriptor(newFileName).getId());
                } catch (PartInitException e) {
                  e.printStackTrace();
                }
                return Status.OK_STATUS;
              }
            };
        openJob.schedule();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }