本文整理汇总了Java中com.intellij.ide.util.treeView.AbstractTreeBuilder类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTreeBuilder类的具体用法?Java AbstractTreeBuilder怎么用?Java AbstractTreeBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTreeBuilder类属于com.intellij.ide.util.treeView包,在下文中一共展示了AbstractTreeBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAntTreeBuilder
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
@Nullable
private static AbstractTreeBuilder getAntTreeBuilder(final AntExplorer antExplorer) {
final JTree tree = UIUtil.findComponentOfType(antExplorer, JTree.class);
if (tree == null) {
LOG.info("Cannot get tree object from AntExplorer");
return null;
}
final AbstractTreeBuilder antTreeBuilder = AbstractTreeBuilder.getBuilderFor(tree);
if (antTreeBuilder == null) {
LOG.info("Cannot get Ant tree builder");
return null;
}
if (antTreeBuilder.isDisposed()) {
LOG.info("Ant tree builder is disposed");
return null;
}
return antTreeBuilder;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:AntTreeUpdatingHack.java
示例2: apply
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public void apply(final AbstractProjectViewPane viewPane) {
if (viewPane == null) {
return;
}
AbstractTreeBuilder treeBuilder = viewPane.getTreeBuilder();
JTree tree = viewPane.myTree;
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel();
List<TreePath> paths = new ArrayList<TreePath>(myElements.length);
for (final Object element : myElements) {
DefaultMutableTreeNode node = treeBuilder.getNodeForElement(element);
if (node == null) {
treeBuilder.buildNodeForElement(element);
node = treeBuilder.getNodeForElement(element);
}
if (node != null) {
paths.add(new TreePath(treeModel.getPathToRoot(node)));
}
}
if (!paths.isEmpty()) {
tree.setSelectionPaths(paths.toArray(new TreePath[paths.size()]));
}
}
示例3: dissociate
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public static void dissociate(final Collection<ResourceBundle> resourceBundles, final Project project) {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
final Set<PsiFileSystemItem> toUpdateInProjectView = new HashSet<PsiFileSystemItem>();
for (ResourceBundle resourceBundle : resourceBundles) {
fileEditorManager.closeFile(new ResourceBundleAsVirtualFile(resourceBundle));
for (final PropertiesFile propertiesFile : resourceBundle.getPropertiesFiles()) {
fileEditorManager.closeFile(propertiesFile.getVirtualFile());
PsiDirectory containingDirectory = propertiesFile.getContainingFile().getContainingDirectory();
if (containingDirectory != null) {
toUpdateInProjectView.add(containingDirectory);
}
}
ResourceBundleManager.getInstance(project).dissociateResourceBundle(resourceBundle);
}
AbstractProjectViewPane currentProjectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane();
if (currentProjectViewPane == null) {
return;
}
AbstractTreeBuilder treeBuilder = currentProjectViewPane.getTreeBuilder();
if (treeBuilder != null) {
for (PsiFileSystemItem item : toUpdateInProjectView) {
treeBuilder.queueUpdateFrom(item, false);
}
}
}
示例4: actionPerformed
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final List<AntBuildGroupNodeDescriptor> groupNodeDescriptors =
TreeUtil.collectSelectedObjectsOfType(myTree, AntBuildGroupNodeDescriptor.class);
if(groupNodeDescriptors.isEmpty()) {
return;
}
final AntBuildFileGroupManager groupManager = AntBuildFileGroupManager.getInstance(e.getProject());
for (AntBuildGroupNodeDescriptor descriptor : groupNodeDescriptors) {
groupManager.removeGroup(descriptor.getElement());
}
final AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(myTree);
if(builder != null) {
builder.queueUpdate();
}
}
示例5: scrollToVisible
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
private static void scrollToVisible(JTree tree, TreePath path, Rectangle bounds, int offset, long expected, Runnable done,
AbstractTreeBuilder builder, int attempt) {
Runnable scroll = () -> {
Rectangle pathBounds = attempt <= 0 ? null : tree.getPathBounds(path);
if (pathBounds != null) {
Object property = tree.getClientProperty(TREE_UTIL_SCROLL_TIME_STAMP);
long stamp = property instanceof Long ? (Long)property : Long.MAX_VALUE;
LOG.debug("tree scroll ", attempt, stamp == expected ? ": try again: " : ": ignore: ", path);
if (stamp == expected) {
bounds.y = pathBounds.y - offset; // restore bounds according to the current row
Rectangle visible = tree.getVisibleRect();
if (bounds.y < visible.y || bounds.y > visible.y + Math.max(0, visible.height - bounds.height)) {
tree.scrollRectToVisible(bounds);
scrollToVisible(tree, path, bounds, offset, expected, done, builder, attempt - 1);
return; // try to scroll again
}
}
}
done.run();
};
//noinspection SSBasedInspection
SwingUtilities.invokeLater(builder == null ? scroll : () -> builder.getReady(TreeUtil.class).doWhenDone(scroll));
}
示例6: apply
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public void apply(final AbstractProjectViewPane viewPane) {
if (viewPane == null) {
return;
}
AbstractTreeBuilder treeBuilder = viewPane.getTreeBuilder();
JTree tree = viewPane.myTree;
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel();
List<TreePath> paths = new ArrayList<>(myElements.length);
for (final Object element : myElements) {
DefaultMutableTreeNode node = treeBuilder.getNodeForElement(element);
if (node == null) {
treeBuilder.buildNodeForElement(element);
node = treeBuilder.getNodeForElement(element);
}
if (node != null) {
paths.add(new TreePath(treeModel.getPathToRoot(node)));
}
}
if (!paths.isEmpty()) {
tree.setSelectionPaths(paths.toArray(new TreePath[paths.size()]));
}
}
示例7: accept
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public boolean accept(AbstractTreeBuilder builder, final SimpleNodeVisitor visitor) {
return builder.accept(SimpleNode.class, new TreeVisitor<SimpleNode>() {
public boolean visit(@NotNull SimpleNode node) {
return visitor.accept(node);
}
}) != null;
}
示例8: select
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public boolean select(AbstractTreeBuilder aBuilder, final SimpleNodeVisitor aVisitor, boolean shouldExpand) {
return aBuilder.select(SimpleNode.class, new TreeVisitor<SimpleNode>() {
public boolean visit(@NotNull SimpleNode node) {
return aVisitor.accept(node);
}
}, null, false);
}
示例9: debugTree
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
private void debugTree(AbstractTreeBuilder aBuilder) {
TreeUtil.traverseDepth((TreeNode)aBuilder.getTree().getModel().getRoot(), new TreeUtil.Traverse() {
public boolean accept(Object node) {
System.out.println("Node: " + node);
return true;
}
});
}
示例10: createTreeBuilder
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
private static AbstractTreeBuilder createTreeBuilder(@NotNull Project project, @NotNull SimpleNode root, @NotNull Tree tree) {
final DefaultTreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(root));
tree.setModel(treeModel);
tree.setRootVisible(false);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
final AbstractTreeBuilder treeBuilder = new AbstractTreeBuilder(tree, treeModel, new SimpleTreeStructure.Impl(root), null);
Disposer.register(project, treeBuilder);
return treeBuilder;
}
示例11: CapturesToolWindow
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public CapturesToolWindow(@NotNull final Project project) {
myProject = project;
DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode());
myTree = new SimpleTree(model);
myTree.setRootVisible(false);
myStructure = new CapturesTreeStructure(myProject);
myBuilder = new AbstractTreeBuilder(myTree, model, myStructure, null);
Disposer.register(this, myBuilder);
Disposer.register(project, this);
myBuilder.initRootNode();
myBuilder.getInitialized().doWhenDone(new Runnable() {
@Override
public void run() {
myBuilder.getUi().expandAll(null);
}
});
myTree.addHierarchyListener(this);
CaptureService.getInstance(myProject).addListener(this);
CaptureService.getInstance(myProject).update();
myStructure.update();
myTree.setPopupGroup(getPopupActions(), "Context");
myTree.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, this);
}
示例12: actionPerformed
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final AntBuildFile buildFile = findBuildFile(myTree);
AntBuildFileGroupManager.getInstance(e.getProject()).moveToGroup(buildFile, myGroup);
final AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(myTree);
if(builder != null) {
builder.queueUpdate();
}
}
示例13: accept
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public boolean accept(AbstractTreeBuilder builder, final SimpleNodeVisitor visitor) {
return builder.accept(SimpleNode.class, new TreeVisitor<SimpleNode>() {
public boolean visit(@Nonnull SimpleNode node) {
return visitor.accept(node);
}
}) != null;
}
示例14: select
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
public boolean select(AbstractTreeBuilder aBuilder, final SimpleNodeVisitor aVisitor, boolean shouldExpand) {
return aBuilder.select(SimpleNode.class, new TreeVisitor<SimpleNode>() {
public boolean visit(@Nonnull SimpleNode node) {
return aVisitor.accept(node);
}
}, null, false);
}
示例15: createTreeBuilder
import com.intellij.ide.util.treeView.AbstractTreeBuilder; //导入依赖的package包/类
protected AbstractTreeBuilder createTreeBuilder(final JTree tree,
DefaultTreeModel treeModel,
final AbstractTreeStructure treeStructure,
final Comparator<NodeDescriptor> comparator,
FileChooserDescriptor descriptor,
@Nullable final Runnable onInitialized) {
return new FileTreeBuilder(tree, treeModel, treeStructure, comparator, descriptor, onInitialized);
}