| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package fuchsia.developer.plugin.fidl; |
| |
| import com.intellij.ide.structureView.StructureViewModel; |
| import com.intellij.ide.structureView.StructureViewModelBase; |
| import com.intellij.ide.structureView.StructureViewTreeElement; |
| import com.intellij.ide.util.treeView.smartTree.Sorter; |
| import com.intellij.psi.PsiFile; |
| import fuchsia.developer.plugin.fidl.psi.File; |
| import org.jetbrains.annotations.NotNull; |
| |
| public class FidlStructureViewModel extends StructureViewModelBase |
| implements StructureViewModel.ElementInfoProvider { |
| public FidlStructureViewModel(PsiFile psiFile) { |
| super(psiFile, new FidlStructureViewElement(psiFile)); |
| } |
| |
| @NotNull |
| public Sorter[] getSorters() { |
| return new Sorter[] {Sorter.ALPHA_SORTER}; |
| } |
| |
| @Override |
| public boolean isAlwaysShowsPlus(StructureViewTreeElement element) { |
| return false; |
| } |
| |
| @Override |
| public boolean isAlwaysLeaf(StructureViewTreeElement element) { |
| return element instanceof File; |
| } |
| } |