spring structure view
[fedora-idea.git] / source / com / intellij / ide / structureView / impl / xml / XmlStructureViewTreeModel.java
blob7a699fea938e926cb41f0dda30f982aacefdd2f1
1 /*
2 * Copyright (c) 2004 JetBrains s.r.o. All Rights Reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
8 * -Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * -Redistribution in binary form must reproduct the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the distribution.
15 * Neither the name of JetBrains or IntelliJ IDEA
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * This software is provided "AS IS," without a warranty of any kind. ALL
20 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
21 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
22 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT
23 * BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
24 * OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
25 * DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST
26 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
27 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
28 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
29 * IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 package com.intellij.ide.structureView.impl.xml;
34 import com.intellij.ide.structureView.StructureViewTreeElement;
35 import com.intellij.ide.structureView.TextEditorBasedStructureViewModel;
36 import com.intellij.ide.util.treeView.smartTree.Filter;
37 import com.intellij.ide.util.treeView.smartTree.Grouper;
38 import com.intellij.ide.util.treeView.smartTree.Sorter;
39 import com.intellij.lang.StdLanguages;
40 import com.intellij.openapi.extensions.Extensions;
41 import com.intellij.psi.PsiFile;
42 import com.intellij.psi.xml.*;
43 import org.jetbrains.annotations.NotNull;
45 public class XmlStructureViewTreeModel extends TextEditorBasedStructureViewModel{
46 private final XmlFile myFile;
47 private static final Class[] myClasses = new Class[]{XmlTag.class, XmlFile.class, XmlEntityDecl.class, XmlElementDecl.class, XmlAttlistDecl.class, XmlConditionalSection.class};
49 public XmlStructureViewTreeModel(XmlFile file) {
50 super(file);
51 myFile = file;
54 @NotNull
55 public StructureViewTreeElement getRoot() {
56 if (myFile.getLanguage() == StdLanguages.DTD) return new DtdFileTreeElement(myFile);
57 return new XmlFileTreeElement(myFile);
60 @NotNull
61 public Grouper[] getGroupers() {
62 return Grouper.EMPTY_ARRAY;
65 private static XmlStructureViewElementProvider[] getProviders() {
66 return (XmlStructureViewElementProvider[])Extensions.getExtensions(XmlStructureViewElementProvider.EXTENSION_POINT_NAME);
69 @NotNull
70 public Sorter[] getSorters() {
71 return Sorter.EMPTY_ARRAY;
74 @NotNull
75 public Filter[] getFilters() {
76 return Filter.EMPTY_ARRAY;
79 protected PsiFile getPsiFile() {
80 return myFile;
83 @NotNull
84 protected Class[] getSuitableClasses() {
85 return myClasses;