package com.dci.intellij.dbn.browser.action;
import com.dci.intellij.dbn.browser.DatabaseBrowserManager;
import com.dci.intellij.dbn.browser.ui.DatabaseBrowserTree;
import com.dci.intellij.dbn.common.Icons;
import com.dci.intellij.dbn.common.util.ActionUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
public class ExpandTreeAction extends DumbAwareAction {
public ExpandTreeAction() {
super("Expand all", null, Icons.ACTION_EXPAND_ALL);
}
public void actionPerformed(AnActionEvent e) {
Project project = ActionUtil.getProject(e);
if (project != null) {
DatabaseBrowserManager browserManager = DatabaseBrowserManager.getInstance(project);
DatabaseBrowserTree activeBrowserTree = browserManager.getActiveBrowserTree();
if (activeBrowserTree != null) {
activeBrowserTree.expandAll();
}
}
}
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setText("Expand all");
}
}