use of com.intellij.ide.OccurenceNavigatorSupport in project intellij-community by JetBrains.
the class TreeView method createPanel.
private JPanel createPanel() {
createModel();
myTree = new MyTree();
myTree.setLineStyleAngled();
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.updateUI();
myTree.setLargeModel(true);
myTree.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false);
}
}
});
myTree.addMouseListener(new PopupHandler() {
public void invokePopup(Component comp, int x, int y) {
popupInvoked(comp, x, y);
}
});
EditSourceOnDoubleClickHandler.install(myTree);
myAutoScrollToSourceHandler.install(myTree);
myOccurenceNavigatorSupport = new OccurenceNavigatorSupport(myTree) {
protected Navigatable createDescriptorForNode(DefaultMutableTreeNode node) {
if (!(node instanceof MessageNode)) {
return null;
}
MessageNode messageNode = (MessageNode) node;
AntBuildMessageView.MessageType type = messageNode.getType();
if (type != AntBuildMessageView.MessageType.MESSAGE && type != AntBuildMessageView.MessageType.ERROR) {
return null;
}
if (!isValid(messageNode.getFile())) {
return null;
}
return new OpenFileDescriptor(myProject, messageNode.getFile(), messageNode.getOffset());
}
@Nullable
public String getNextOccurenceActionName() {
return AntBundle.message("ant.execution.next.error.warning.action.name");
}
@Nullable
public String getPreviousOccurenceActionName() {
return AntBundle.message("ant.execution.previous.error.warning.action.name");
}
};
return JBUI.Panels.simplePanel(MessageTreeRenderer.install(myTree));
}
Aggregations