return new MongoResultPanel(project, mongoDocumentOperations);
}
public void installResultPanelActions() {
DefaultActionGroup actionResultGroup = new DefaultActionGroup("MongoResultGroup", true);
if (ApplicationManager.getApplication() != null) {
actionResultGroup.add(new ExecuteQuery(this));
actionResultGroup.add(new OpenFindAction(this));
actionResultGroup.add(new CopyResultAction(resultPanel));
}
final TreeExpander treeExpander = new TreeExpander() {
@Override
public void expandAll() {
resultPanel.expandAll();
}
@Override
public boolean canExpand() {
return true;
}
@Override
public void collapseAll() {
resultPanel.collapseAll();
}
@Override
public boolean canCollapse() {
return true;
}
};
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
final AnAction expandAllAction = actionsManager.createExpandAllAction(treeExpander, resultPanel);
final AnAction collapseAllAction = actionsManager.createCollapseAllAction(treeExpander, resultPanel);
Disposer.register(this, new Disposable() {
@Override
public void dispose() {
collapseAllAction.unregisterCustomShortcutSet(resultPanel);
expandAllAction.unregisterCustomShortcutSet(resultPanel);
}
});
actionResultGroup.add(expandAllAction);
actionResultGroup.add(collapseAllAction);
GuiUtils.installActionGroupInToolBar(actionResultGroup, resultPanel.getToolbar(), ActionManager.getInstance(), "MongoGroupActions", false);
}