com.intellij.ide.structureView.TreeBasedStructureViewBuilder Java Examples
The following examples show how to use
com.intellij.ide.structureView.TreeBasedStructureViewBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewStructureAction.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public static FileStructurePopup createPopup(@Nonnull Project project, @Nonnull FileEditor fileEditor) { PsiDocumentManager.getInstance(project).commitAllDocuments(); StructureViewBuilder builder = fileEditor.getStructureViewBuilder(); if (builder == null) return null; StructureView structureView; StructureViewModel treeModel; if (builder instanceof TreeBasedStructureViewBuilder) { structureView = null; treeModel = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(EditorUtil.getEditorEx(fileEditor)); } else { structureView = builder.createStructureView(fileEditor, project); treeModel = createStructureViewModel(project, fileEditor, structureView); } if (treeModel instanceof PlaceHolder) { //noinspection unchecked ((PlaceHolder)treeModel).setPlace(TreeStructureUtil.PLACE); } FileStructurePopup popup = new FileStructurePopup(project, fileEditor, treeModel); if (structureView != null) Disposer.register(popup, structureView); return popup; }
Example #2
Source File: ProtoStructureViewFactory.java From protobuf-jetbrains-plugin with Apache License 2.0 | 6 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new ProtoStructureViewModel((ProtoPsiFileRoot) psiFile, editor); } @Override public boolean isRootNodeShown() { return false; } }; }
Example #3
Source File: TemplateLanguageStructureViewBuilder.java From consulo with Apache License 2.0 | 6 votes |
@Nullable protected TreeBasedStructureViewBuilder createMainBuilder(@Nonnull PsiFile psi) { //noinspection deprecation StructureViewComposite.StructureViewDescriptor descriptor = createMainView(null, psi); if (descriptor == null) return null; return new TreeBasedStructureViewBuilder() { @Nonnull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { Disposer.register(descriptor.structureModel, descriptor.structureView); return descriptor.structureModel; } @Nonnull @Override public StructureView createStructureView(FileEditor fileEditor, @Nonnull Project project) { return descriptor.structureView; } }; }
Example #4
Source File: TemplateLanguageStructureViewBuilder.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static TemplateLanguageStructureViewBuilder create(@Nonnull PsiFile psiFile, @Nullable PairFunction<? super PsiFile, ? super Editor, ? extends StructureViewModel> modelFactory) { return new TemplateLanguageStructureViewBuilder(psiFile) { @Override protected TreeBasedStructureViewBuilder createMainBuilder(@Nonnull PsiFile psi) { return modelFactory == null ? null : new TreeBasedStructureViewBuilder() { @Override public boolean isRootNodeShown() { return false; } @Nonnull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return modelFactory.fun(psi, editor); } }; } }; }
Example #5
Source File: HaxeStructureViewFactory.java From intellij-haxe with Apache License 2.0 | 6 votes |
@Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { if (!(psiFile instanceof HaxeFile)) { return null; } return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new HaxeStructureViewModel(psiFile, editor); } @Override public boolean isRootNodeShown() { return false; } }; }
Example #6
Source File: CSharpStructureViewFactory.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { if(psiFile instanceof CSharpFileImpl) { return new TreeBasedStructureViewBuilder() { @Nonnull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new CSharpStructureViewModel(psiFile, editor); } }; } else { return null; } }
Example #7
Source File: CppLanguage.java From CppTools with Apache License 2.0 | 5 votes |
@Nullable public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return createStructureViewModel(); // todo, new api Idea 14.1 } public StructureViewModel createStructureViewModel() { return new CppStructureViewBuilder(psiFile); } }; }
Example #8
Source File: StructureViewFactory.java From reasonml-idea-plugin with MIT License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public com.intellij.ide.structureView.StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new StructureViewModel(psiFile); } }; }
Example #9
Source File: Bookmark.java From consulo with Apache License 2.0 | 5 votes |
public String getQualifiedName() { String presentableUrl = myFile.getPresentableUrl(); if (myFile.isDirectory()) return presentableUrl; PsiDocumentManager.getInstance(myProject).commitAllDocuments(); final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile); if (psiFile == null) return presentableUrl; StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(psiFile); if (builder instanceof TreeBasedStructureViewBuilder) { StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(null); Object element; try { element = model.getCurrentEditorElement(); } finally { model.dispose(); } if (element instanceof NavigationItem) { ItemPresentation presentation = ((NavigationItem)element).getPresentation(); if (presentation != null) { presentableUrl = ((NavigationItem)element).getName() + " " + presentation.getLocationString(); } } } return IdeBundle.message("bookmark.file.X.line.Y", presentableUrl, getLine() + 1); }
Example #10
Source File: TemplateLanguageStructureViewBuilder.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { List<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<>(); PsiFile psiFile = ObjectUtils.notNull(PsiManager.getInstance(myProject).findFile(myVirtualFile)); for (Language language : getLanguages(psiFile)) { StructureViewBuilder builder = getBuilder(psiFile, language); if (!(builder instanceof TreeBasedStructureViewBuilder)) continue; StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(editor); String title = language.getDisplayName(); Image icon = ObjectUtils.notNull(LanguageUtil.getLanguageFileType(language), UnknownFileType.INSTANCE).getIcon(); viewDescriptors.add(new StructureViewComposite.StructureViewDescriptor(title, model, icon)); } return new StructureViewCompositeModel(psiFile, editor, viewDescriptors); }
Example #11
Source File: MethodUpDownUtil.java From consulo with Apache License 2.0 | 5 votes |
private static void addNavigationElements(Collection<PsiElement> array, PsiFile element) { StructureViewBuilder structureViewBuilder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(element); if (structureViewBuilder instanceof TreeBasedStructureViewBuilder) { TreeBasedStructureViewBuilder builder = (TreeBasedStructureViewBuilder) structureViewBuilder; StructureViewModel model = builder.createStructureViewModel(null); try { addStructureViewElements(model.getRoot(), array, element); } finally { model.dispose(); } } }
Example #12
Source File: ThriftStructureViewFactory.java From intellij-thrift with Apache License 2.0 | 5 votes |
@Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new ThriftStructureViewModel(psiFile); } @Override public boolean isRootNodeShown() { return false; } }; }
Example #13
Source File: BuckStructureViewFactory.java From buck with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new BuckStructureViewModel(psiFile); } }; }
Example #14
Source File: ANTLRv4StructureViewFactory.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { VirtualFile grammarFile = psiFile.getVirtualFile(); if ( grammarFile==null || !grammarFile.getName().endsWith(".g4") ) { return new StructureViewModelBase(psiFile, new DummyViewTreeElement(psiFile)); } return new ANTLRv4StructureViewModel((ANTLRv4FileRoot)psiFile); } }; }
Example #15
Source File: XQueryStructureViewFactory.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public com.intellij.ide.structureView.StructureViewModel createStructureViewModel(Editor editor) { return new XQueryStructureViewModel(psiFile).withSuitableClasses( XQueryFunctionDecl.class, XQueryVarDecl.class, XQueryQueryBody.class ); } }; }
Example #16
Source File: GLSLStructureViewFactory.java From glsl4idea with GNU Lesser General Public License v3.0 | 5 votes |
public StructureViewBuilder getStructureViewBuilder(@NotNull final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(Editor editor) { return new GLSLStructureViewModel(psiFile); } }; }
Example #17
Source File: LatteStructureViewFactory.java From intellij-latte with MIT License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new LatteStructureViewModel(psiFile); } }; }
Example #18
Source File: HaskellStructureViewFactory.java From intellij-haskforce with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new HaskellStructureViewModel(psiFile); } }; }
Example #19
Source File: SimpleStructureViewFactory.java From intellij-sdk-docs with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(@NotNull final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new SimpleStructureViewModel(psiFile); } }; }
Example #20
Source File: SampleStructureViewFactory.java From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new SampleStructureViewModel((SamplePSIFileRoot)psiFile); } }; }
Example #21
Source File: JSGraphQLEndpointPsiStructureViewFactory.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new JSGraphQLEndpointStructureViewModel(psiFile, editor); } public boolean isRootNodeShown() { return false; } }; }
Example #22
Source File: GraphQLPsiStructureViewFactory.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new GraphQLStructureViewModel(psiFile, editor); } public boolean isRootNodeShown() { return false; } }; }
Example #23
Source File: BuildStructureViewFactory.java From intellij with Apache License 2.0 | 5 votes |
@Override @Nullable public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { if (!(psiFile instanceof BuildFile)) { return null; } return new TreeBasedStructureViewBuilder() { @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new BuildStructureViewModel((BuildFile) psiFile, editor); } }; }
Example #24
Source File: ElmStructureViewFactory.java From elm-plugin with MIT License | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(PsiFile psiFile) { ElmFile elmFile = (ElmFile) psiFile; return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new ElmStructureViewModel(elmFile); } }; }
Example #25
Source File: FusionStructureViewBuilderFactory.java From intellij-neos with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { final FusionFile fusionFile = (FusionFile) psiFile; return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new FusionStructureViewModel(editor, fusionFile); } }; }
Example #26
Source File: WeaveStructureViewBuilderFactory.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new WeaveStructureViewModel(psiFile, editor, new WeaveDocumentStructureView((WeaveFile) psiFile)); } }; }
Example #27
Source File: CsvStructureViewFactory.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Nullable @Override public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new CsvStructureViewModel(psiFile); } }; }
Example #28
Source File: ShowContainerInfoAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected boolean isValidForFile(@Nonnull Project project, @Nonnull Editor editor, @Nonnull final PsiFile file) { return LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(file) instanceof TreeBasedStructureViewBuilder; }
Example #29
Source File: MethodUpAction.java From consulo with Apache License 2.0 | 4 votes |
static boolean checkValidForFile(final PsiFile file) { final StructureViewBuilder structureViewBuilder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(file); return structureViewBuilder instanceof TreeBasedStructureViewBuilder || structureViewBuilder instanceof TemplateLanguageStructureViewBuilder; }
Example #30
Source File: FileStructureDialog.java From consulo with Apache License 2.0 | 4 votes |
protected boolean isShowRoot(final PsiFile psiFile) { StructureViewBuilder viewBuilder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(psiFile); return viewBuilder instanceof TreeBasedStructureViewBuilder && ((TreeBasedStructureViewBuilder)viewBuilder).isRootNodeShown(); }