2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.uiDesigner
.projectView
;
18 import com
.intellij
.ide
.projectView
.impl
.AbstractProjectViewPSIPane
;
19 import com
.intellij
.ide
.projectView
.impl
.ClassesTreeStructureProvider
;
20 import com
.intellij
.openapi
.application
.PluginPathManager
;
21 import com
.intellij
.openapi
.vfs
.VirtualFile
;
22 import com
.intellij
.projectView
.BaseProjectViewTestCase
;
23 import com
.intellij
.psi
.PsiClass
;
24 import com
.intellij
.psi
.PsiFile
;
25 import com
.intellij
.psi
.PsiJavaFile
;
28 public class FormMergerTreeStructureProviderTest
extends BaseProjectViewTestCase
{
30 protected String
getTestDataPath() {
31 return PluginPathManager
.getPluginHomePath("ui-designer") + "/testData";
34 public void testStandardProviders() {
35 final AbstractProjectViewPSIPane pane
= createPane();
36 getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject
),
37 new FormMergerTreeStructureProvider(myProject
));
39 assertStructureEqual(getPackageDirectory(), "PsiDirectory: package1\n" +
42 " PsiFile(plain text):Form1.form\n" +
43 " PsiClass:Class1\n" +
44 " PsiFile(plain text):Form2.form\n" +
45 " PsiJavaFile:Class2.java\n" +
46 " PsiClass:Class2\n" +
47 " PsiClass:Class3\n" +
48 " PsiJavaFile:Class4.java\n");
50 PsiClass psiClass
= ((PsiJavaFile
)getPackageDirectory().findFile("Form1.java")).getClasses()[0];
51 checkNavigateFromSourceBehaviour(psiClass
, psiClass
.getContainingFile().getVirtualFile(), pane
);
53 PsiFile psiFile
= getPackageDirectory().findFile("Form1.form");
54 VirtualFile virtualFile
= psiFile
.getContainingFile().getVirtualFile();
55 checkNavigateFromSourceBehaviour(psiFile
, virtualFile
, pane
);