• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StructureViewComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ide.structureView.newStructureView.StructureViewComponent的典型用法代码示例。如果您正苦于以下问题:Java StructureViewComponent类的具体用法?Java StructureViewComponent怎么用?Java StructureViewComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StructureViewComponent类属于com.intellij.ide.structureView.newStructureView包,在下文中一共展示了StructureViewComponent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testVisibilitySorter

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
public void testVisibilitySorter() throws Exception {
  dotest(new CheckAction() {
    @Override
    public void testClassStructure(StructureViewComponent structureViewComponent) {
      structureViewComponent.setActionActive(JavaInheritedMembersNodeProvider.ID, false);

      IdeaTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" +
                                                               " -Class2\n" +
                                                               "  __myPrivateFiield: int\n" +
                                                               "  _myProtectedField: int\n" +
                                                               "  myPublicField: int\n");

      structureViewComponent.setActionActive(VisibilitySorter.ID, true);

      IdeaTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" +
                                                               " -Class2\n" +
                                                               "  myPublicField: int\n" +
                                                               "  _myProtectedField: int\n" +
                                                               "  __myPrivateFiield: int\n");
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaTreeStructureTest.java


示例2: testMembersOrder

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
public void testMembersOrder() throws Exception {
  dotest(new CheckAction() {
    @Override
    public void testClassStructure(StructureViewComponent structureViewComponent) {
      structureViewComponent.setActionActive(JavaInheritedMembersNodeProvider.ID, false);

      IdeaTestUtil.assertTreeEqual(structureViewComponent.getTree(), "-Class2.java\n" +
                                                               " -Class2\n" +
                                                               "  Class2()\n" +
                                                               "  af(): void\n" +
                                                               "  zf(): void\n" +
                                                               "  ab: int\n" +
                                                               "  z: int\n"
      );
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaTreeStructureTest.java


示例3: dotest

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void dotest(CheckAction checkAction) throws Exception {
  final PsiClass psiClass = JavaDirectoryService.getInstance().getClasses(getPackageDirectory("com/package1"))[0];
  final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
  final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
  FileEditor[] fileEditors = fileEditorManager.openFile(virtualFile, false);
  final FileEditor fileEditor = fileEditors[0];
  try {
    final StructureViewComponent structureViewComponent =
      (StructureViewComponent)fileEditor.getStructureViewBuilder().createStructureView(fileEditor, myProject);

    checkAction.testClassStructure(structureViewComponent);
    Disposer.dispose(structureViewComponent);

  }
  finally {
    fileEditorManager.closeFile(virtualFile);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaTreeStructureTest.java


示例4: updateAfterPsiChange

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void updateAfterPsiChange() {
  if (myProject.isDisposed()) return;
  if (myBaseStructureViewDescriptor != null && ((StructureViewComponent)myBaseStructureViewDescriptor.structureView).getTree() == null) return;
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override
    public void run() {
      if (!myVirtualFile.isValid() || getViewProvider() == null) return;

      StructureViewWrapper structureViewWrapper = StructureViewFactoryEx.getInstanceEx(myProject).getStructureViewWrapper();
      if (structureViewWrapper == null) return;

      Language baseLanguage = getTemplateDataLanguage();
      if (baseLanguage == myTemplateDataLanguage
          && (myBaseStructureViewDescriptor == null || isPsiValid(myBaseStructureViewDescriptor))) {
        updateBaseLanguageView();
      }
      else {
        myTemplateDataLanguage = baseLanguage;
        ((StructureViewWrapperImpl)structureViewWrapper).rebuild();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TemplateLanguageStructureViewBuilder.java


示例5: isPsiValid

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private static boolean isPsiValid(@NotNull StructureViewComposite.StructureViewDescriptor baseStructureViewDescriptor) {
  final StructureViewComponent view = (StructureViewComponent)baseStructureViewDescriptor.structureView;
  if (view.isDisposed()) return false;

  final Object root = view.getTreeStructure().getRootElement();
  if (root instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)root).getValue();
    if (value instanceof StructureViewTreeElement) {
      final Object psi = ((StructureViewTreeElement)value).getValue();
      if (psi instanceof PsiElement) {
        return ((PsiElement)psi).isValid();
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TemplateLanguageStructureViewBuilder.java


示例6: createStructureView

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) {
  return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true) {
    @Override
    public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element) {
      if (element instanceof XmlElement && ((XmlElement)element).isValid()) {
        final XmlElement xmlElement = (XmlElement)element;
        XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
        while (tag != null) {
          final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
          if (domElement != null) {
            for (DomElement curElement = domElement; curElement != null; curElement = curElement.getParent()) {
              if (myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW) {
                return super.expandPathToElement(curElement.getXmlElement());
              }
            }
          }
          tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
        }

      }
      return super.expandPathToElement(element);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DomStructureViewBuilder.java


示例7: testStructureView

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Override
public void testStructureView(Consumer<StructureViewComponent> consumer) {
  assert myFile != null : "configure first";

  final VirtualFile vFile = myFile.getVirtualFile();
  assert vFile != null : "no virtual file for " + myFile;

  final FileEditor fileEditor = FileEditorManager.getInstance(getProject()).getSelectedEditor(vFile);
  assert fileEditor != null : "editor not opened for " + vFile;

  final StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(myFile);
  assert builder != null : "no builder for " + myFile;

  StructureViewComponent component = null;
  try {
    component = (StructureViewComponent)builder.createStructureView(fileEditor, myProjectFixture.getProject());
    consumer.consume(component);
  }
  finally {
    if (component != null) Disposer.dispose(component);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:CodeInsightTestFixtureImpl.java


示例8: updateAfterPsiChange

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void updateAfterPsiChange() {
  if (myProject.isDisposed()) return;
  if (myBaseStructureViewDescriptor != null && ((StructureViewComponent)myBaseStructureViewDescriptor.structureView).getTree() == null) return;
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override
    public void run() {
      if (!myVirtualFile.isValid()) return;

      final TemplateLanguageFileViewProvider provider = getViewProvider();
      if (provider == null) return;

      StructureViewWrapper structureViewWrapper = StructureViewFactoryEx.getInstanceEx(myProject).getStructureViewWrapper();
      if (structureViewWrapper == null) return;

      Language baseLanguage = provider.getTemplateDataLanguage();
      if (baseLanguage == myTemplateDataLanguage
          && (myBaseStructureViewDescriptor == null || isPsiValid(myBaseStructureViewDescriptor))) {
        updateBaseLanguageView();
      }
      else {
        myTemplateDataLanguage = baseLanguage;
        ((StructureViewWrapperImpl)structureViewWrapper).rebuild();
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:TemplateLanguageStructureViewBuilder.java


示例9: createStructureView

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
  return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project) {
    @Override
    public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element) {
      if (element instanceof XmlElement) {
        final XmlElement xmlElement = (XmlElement)element;
        XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
        while (tag != null) {
          final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
          if (domElement != null) {
            for (DomElement curElement = domElement; curElement != null; curElement = curElement.getParent()) {
              if (myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW) {
                return super.expandPathToElement(curElement.getXmlElement());
              }
            }
          }
          tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
        }

      }
      return super.expandPathToElement(element);
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:DomStructureViewBuilder.java


示例10: createStructureViewBuilder

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
/**
 * construct view builder
 *
 * @param xmlFile xml file
 * @return structure view builder
 */
@Nullable public StructureViewBuilder createStructureViewBuilder(@NotNull final XmlFile xmlFile) {
    final DomFileElement fileElement = getFileElement(xmlFile);
    if (fileElement == null) {
        return null;
    }
    return new TreeBasedStructureViewBuilder() {
        @NotNull
        public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
            return new StructureViewComponent(fileEditor, createStructureViewModel(), project);
        }

        @NotNull
        public StructureViewModel createStructureViewModel() {
            return new SqlMapConfigStructureViewTreeModel(xmlFile, fileElement.getRootElement());
        }
    };
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:24,代码来源:SqlMapConfigStructureViewBuilderProvider.java


示例11: createStructureViewBuilder

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
/**
 * construct view builder
 *
 * @param xmlFile xml file
 * @return structure view builder
 */
@Nullable public StructureViewBuilder createStructureViewBuilder(@NotNull final XmlFile xmlFile) {
    final DomFileElement fileElement = getFileElement(xmlFile);
    if (fileElement == null) {
        return null;
    }
    return new TreeBasedStructureViewBuilder() {
        @NotNull
        public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
            return new StructureViewComponent(fileEditor, createStructureViewModel(), project);
        }

        @NotNull
        public StructureViewModel createStructureViewModel() {
            return new SqlMapStructureViewTreeModel(xmlFile, fileElement.getRootElement());
        }
    };
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:24,代码来源:SqlMapStructureViewBuilderProvider.java


示例12: isPsiValid

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private static boolean isPsiValid(@Nonnull StructureViewComposite.StructureViewDescriptor baseStructureViewDescriptor) {
  final StructureViewComponent view = (StructureViewComponent)baseStructureViewDescriptor.structureView;
  if (view.isDisposed()) return false;

  final Object root = view.getTreeStructure().getRootElement();
  if (root instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)root).getValue();
    if (value instanceof StructureViewTreeElement) {
      final Object psi = ((StructureViewTreeElement)value).getValue();
      if (psi instanceof PsiElement) {
        return ((PsiElement)psi).isValid();
      }
    }
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:TemplateLanguageStructureViewBuilder.java


示例13: createStructureView

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) {
    final StructureView structureView = super.createStructureView(fileEditor, project);
    if (structureView instanceof StructureViewComponent) {
        ((StructureViewComponent) structureView).getTree().setRootVisible(false);
    }
    return structureView;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:10,代码来源:TSStructureViewBuilder.java


示例14: testExpandElementWithExitingName

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
public void testExpandElementWithExitingName() throws InterruptedException {

    final VirtualFile xmlVirtualFile = getContentRoot().findFileByRelativePath("test.xml");
    final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
    FileEditor[] fileEditors = fileEditorManager.openFile(xmlVirtualFile, false);
    final FileEditor fileEditor = fileEditors[0];
    try {
      final StructureViewComponent structureViewComponent =
        (StructureViewComponent)fileEditor.getStructureViewBuilder().createStructureView(fileEditor, myProject);

      final JTree tree = structureViewComponent.getTree();
      PlatformTestUtil.assertTreeEqual(tree, "-test.xml\n" +
                                             " -test\n" +
                                             "  +level1\n" +
                                             "  +level1\n" +
                                             "  +level1\n" +
                                             "  +level1\n");

      tree.expandPath(tree.getPathForRow(3));

      PlatformTestUtil.waitForAlarm(600);


      PlatformTestUtil.assertTreeEqual(tree,
                                       "-test.xml\n" +
                                       " -test\n" +
                                       "  +level1\n" +
                                       "  -level1\n" +
                                       "   +level2\n" +
                                       "  +level1\n" +
                                       "  +level1\n");

      Disposer.dispose(structureViewComponent);
    }
    finally {
      fileEditorManager.closeFile(xmlVirtualFile);
    }

  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:StructureViewUpdatingTest.java


示例15: createStructureView

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@NotNull
@Override
public StructureView createStructureView(final FileEditor fileEditor,
                                         @NotNull StructureViewModel treeModel,
                                         @NotNull Project project,
                                         final boolean showRootNode) {
  return new StructureViewComponent(fileEditor, treeModel, project, showRootNode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:StructureViewFactoryImpl.java


示例16: getPsi

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Nullable
private PsiElement getPsi(FilteringTreeStructure.FilteringNode n) {
  final Object delegate = n.getDelegate();
  if (delegate instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)delegate).getValue();
    if (value instanceof StructureViewTreeElement) {
      final Object element = ((StructureViewTreeElement)value).getValue();
      if (element instanceof PsiElement) {
        return (PsiElement)element;
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FileStructurePopup.java


示例17: getSpeedSearchText

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
@Nullable
public static String getSpeedSearchText(final Object userObject) {
  String text = String.valueOf(userObject);
  if (text != null) {
    if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
      final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue();
      if (value instanceof PsiTreeElementBase && ((PsiTreeElementBase)value).isSearchInLocationString()) {
        final String locationString = ((PsiTreeElementBase)value).getLocationString();
        if (!StringUtil.isEmpty(locationString)) {
          String locationPrefix = null;
          String locationSuffix = null;
          if (value instanceof LocationPresentation) {
            locationPrefix = ((LocationPresentation)value).getLocationPrefix();
            locationSuffix = ((LocationPresentation)value).getLocationSuffix();
          }

          return text +
                 StringUtil.notNullize(locationPrefix, LocationPresentation.DEFAULT_LOCATION_PREFIX) +
                 locationString +
                 StringUtil.notNullize(locationSuffix, LocationPresentation.DEFAULT_LOCATION_SUFFIX);
        }
      }
    }
    return text;
  }

  if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Nullable
      @Override
      public String compute() {
        final ItemPresentation presentation =
          ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue().getPresentation();
        return presentation.getPresentableText();
      }
    });
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:FileStructurePopup.java


示例18: updateHeaderActions

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void updateHeaderActions(StructureView structureView) {
  AnAction[] titleActions = AnAction.EMPTY_ARRAY;
  if (structureView instanceof StructureViewComponent) {
    JTree tree = ((StructureViewComponent)structureView).getTree();
    titleActions = new AnAction[]{
      CommonActionsManager.getInstance().createExpandAllHeaderAction(tree),
      CommonActionsManager.getInstance().createCollapseAllHeaderAction(tree)};
  }
  myToolWindow.setTitleActions(titleActions);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:StructureViewWrapperImpl.java


示例19: doTest

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void doTest(final String expected, final boolean inherited) {
  myFixture.testStructureView(new Consumer<StructureViewComponent>() {
    @Override
    public void consume(StructureViewComponent component) {
      component.setActionActive("SHOW_INHERITED", !inherited);
      assertTreeEqual(component.getTree(), expected);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PyStructureViewTest.java


示例20: updateHeaderActions

import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入依赖的package包/类
private void updateHeaderActions(StructureView structureView) {
  ActionGroup gearActions = null;
  AnAction[] titleActions = AnAction.EMPTY_ARRAY;
  if (structureView instanceof StructureViewComponent) {
    gearActions = ((StructureViewComponent)structureView).getGearActions();
    titleActions = ((StructureViewComponent)structureView).getTitleActions();
  }
  myToolWindow.setAdditionalGearActions(gearActions);
  myToolWindow.setTitleActions(titleActions);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:StructureViewWrapperImpl.java



注:本文中的com.intellij.ide.structureView.newStructureView.StructureViewComponent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UserDirectoryService类代码示例发布时间:2022-05-23
下一篇:
Java DamageSource类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap