use of com.intellij.ui.treeStructure.SimpleTree in project intellij-community by JetBrains.
the class IntersectingLocalChangesPanel method createTree.
@NotNull
private SimpleTree createTree() {
SimpleTree tree = new SimpleTree(TreeModelBuilder.buildFromFilePaths(myProject, true, myFiles)) {
@Override
protected void configureUiHelper(@NotNull TreeUIHelper helper) {
super.configureUiHelper(helper);
helper.installEditSourceOnDoubleClick(this);
helper.installEditSourceOnEnterKeyHandler(this);
}
};
tree.setRootVisible(false);
tree.setShowsRootHandles(false);
tree.setCellRenderer(new ChangesBrowserNodeRenderer(myProject, BooleanGetter.TRUE, false));
return tree;
}
use of com.intellij.ui.treeStructure.SimpleTree in project intellij-community by JetBrains.
the class ExternalProjectsViewImpl method initTree.
private void initTree() {
myTree = new SimpleTree();
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
final ActionManager actionManager = ActionManager.getInstance();
ActionToolbar actionToolbar = actionManager.createActionToolbar(myExternalSystemId.getReadableName() + " View Toolbar", (DefaultActionGroup) actionManager.getAction("ExternalSystemView.ActionsToolbar"), true);
actionToolbar.setTargetComponent(myTree);
setToolbar(actionToolbar.getComponent());
setContent(ScrollPaneFactory.createScrollPane(myTree));
myTree.addMouseListener(new PopupHandler() {
public void invokePopup(final Component comp, final int x, final int y) {
final String id = getMenuId(getSelectedNodes(ExternalSystemNode.class));
if (id != null) {
final ActionGroup actionGroup = (ActionGroup) actionManager.getAction(id);
if (actionGroup != null) {
actionManager.createActionPopupMenu("", actionGroup).getComponent().show(comp, x, y);
}
}
}
@Nullable
private String getMenuId(Collection<? extends ExternalSystemNode> nodes) {
String id = null;
for (ExternalSystemNode node : nodes) {
String menuId = node.getMenuId();
if (menuId == null) {
return null;
}
if (id == null) {
id = menuId;
} else if (!id.equals(menuId)) {
return null;
}
}
return id;
}
});
}
use of com.intellij.ui.treeStructure.SimpleTree in project azure-tools-for-java by Microsoft.
the class AzureSdkTreePanel method initTree.
private Tree initTree() {
final DefaultMutableTreeNode root = new DefaultMutableTreeNode("Azure SDK Libraries");
this.model = new DefaultTreeModel(root);
final SimpleTree tree = new SimpleTree(model);
tree.putClientProperty(RenderingUtil.ALWAYS_PAINT_SELECTION_AS_FOCUSED, true);
tree.setCellRenderer(new NodeRenderer());
tree.setRootVisible(false);
tree.setShowsRootHandles(true);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
TreeUtil.installActions(tree);
RelativeFont.BOLD.install(tree);
return tree;
}
use of com.intellij.ui.treeStructure.SimpleTree in project intellij-community by JetBrains.
the class MavenProjectsNavigator method initTree.
private void initTree() {
myTree = new SimpleTree() {
private final JLabel myLabel = new JLabel(ProjectBundle.message("maven.navigator.nothing.to.display", MavenUtil.formatHtmlImage(ADD_ICON_URL), MavenUtil.formatHtmlImage(SYNC_ICON_URL)));
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (myProjectsManager.hasProjects())
return;
myLabel.setFont(getFont());
myLabel.setBackground(getBackground());
myLabel.setForeground(getForeground());
Rectangle bounds = getBounds();
Dimension size = myLabel.getPreferredSize();
myLabel.setBounds(0, 0, size.width, size.height);
int x = (bounds.width - size.width) / 2;
Graphics g2 = g.create(bounds.x + x, bounds.y + 20, bounds.width, bounds.height);
try {
myLabel.paint(g2);
} finally {
g2.dispose();
}
}
};
myTree.getEmptyText().clear();
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
Aggregations