/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.uiDesigner.projectView;

import com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane;
import com.intellij.ide.projectView.impl.ClassesTreeStructureProvider;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.projectView.BaseProjectViewTestCase;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiJavaFile;


public class FormMergerTreeStructureProviderTest extends BaseProjectViewTestCase {
  @Override
  protected String getTestDataPath() {
    return PluginPathManager.getPluginHomePath("ui-designer") + "/testData";
  }

  public void testStandardProviders() {
    final AbstractProjectViewPSIPane pane = createPane();
    getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject),
                                           new FormMergerTreeStructureProvider(myProject));

    assertStructureEqual(getPackageDirectory(), "PsiDirectory: package1\n" +
                                                " Form:Form1\n" +
                                                "  PsiClass:Form1\n" +
                                                "  PsiFile(plain text):Form1.form\n" +
                                                " PsiClass:Class1\n" +
                                                " PsiFile(plain text):Form2.form\n" +
                                                " PsiJavaFile:Class2.java\n" +
                                                "  PsiClass:Class2\n" +
                                                "  PsiClass:Class3\n" +
                                                " PsiJavaFile:Class4.java\n");

    PsiClass psiClass = ((PsiJavaFile)getPackageDirectory().findFile("Form1.java")).getClasses()[0];
    checkNavigateFromSourceBehaviour(psiClass, psiClass.getContainingFile().getVirtualFile(), pane);

    PsiFile psiFile = getPackageDirectory().findFile("Form1.form");
    VirtualFile virtualFile = psiFile.getContainingFile().getVirtualFile();
    checkNavigateFromSourceBehaviour(psiFile, virtualFile, pane);
  }

}

@@ -1673,17 +1673,22 @@
   %22 
-Form:Form
+PsiClass:Class
 1%5Cn%22
@@ -1743,24 +1743,32 @@
    %22
- 
  Psi
-Class:Form1
+JavaFile:Class2.java
 %5Cn%22 
@@ -1827,35 +1827,20 @@
  Psi
-File(plain text):Form1.form
+Class:Class2
 %5Cn%22 
@@ -1882,32 +1882,33 @@
                %22
+ 
  PsiClass:Class1
@@ -1898,33 +1898,33 @@
   PsiClass:Class
-1
+3
 %5Cn%22 +%0A          
@@ -1970,35 +1970,28 @@
  Psi
-File(plain text):Form2.form
+JavaFile:Class4.java
 %5Cn%22 
@@ -2045,36 +2045,43 @@
    %22 Psi
-JavaFile:Class2.java
+File(plain text):Form2.form
 %5Cn%22 +%0A  
@@ -2128,32 +2128,26 @@
       %22 
- PsiClass:Class2
+Form:Form1
 %5Cn%22 +%0A  
@@ -2196,38 +2196,37 @@
     %22  PsiClass:
-Class3
+Form1
 %5Cn%22 +%0A          
@@ -2268,32 +2268,40 @@
    %22
+ 
  Psi
-JavaFile:Class4.java
+File(plain text):Form1.form
 %5Cn%22)

Test made FS-independent (test data updated)