use of org.jetbrains.android.actions.NewAndroidComponentDialog in project android by JetBrains.
the class LegacyNewAndroidComponentAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return;
}
final Module module = LangDataKeys.MODULE.getData(dataContext);
if (module == null)
return;
final AndroidFacet facet = AndroidFacet.getInstance(module);
assert facet != null;
final PsiDirectory dir = view.getOrChooseDirectory();
if (dir == null)
return;
NewAndroidComponentDialog dialog = new NewAndroidComponentDialog(module, dir);
dialog.show();
if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return;
}
final PsiElement[] createdElements = dialog.getCreatedElements();
for (PsiElement createdElement : createdElements) {
view.selectElement(createdElement);
}
}
Aggregations