use of com.intellij.ide.IdeView in project android by JetBrains.
the class CreateResourceActionBase method actionPerformed.
@Override
public final void actionPerformed(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return;
}
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}
// This is where we differ from CreateElementActionBase:
// Rather than asking for a directory here, we just allow
// *any* directory
final PsiElement[] createdElements = invokeDialog(project, dataContext);
for (PsiElement createdElement : createdElements) {
view.selectElement(createdElement);
}
}
use of com.intellij.ide.IdeView in project android by JetBrains.
the class CreateResourceActionBase method isAvailable.
protected boolean isAvailable(final DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return false;
}
if (DumbService.getInstance(project).isDumb() && !isDumbAware()) {
return false;
}
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null || view.getDirectories().length == 0) {
return false;
}
return true;
}
Aggregations