use of com.intellij.openapi.ui.DialogBuilder in project freeline by alibaba.
the class FreelineUtil method checkInstall.
/**
* 检查是否需要载入Freeline
*
* @param project
* @return
*/
public static boolean checkInstall(@NotNull final Project project) {
final FreelineStatus status = getFreelineStatus(project);
if (GradleUtil.isSyncInProgress(project)) {
NotificationUtils.errorMsgDialog("Waiting for sync project to complete");
return false;
}
if (status.hasInitFreeline()) {
return true;
}
if (status.getGradleBuildFiles().size() < 1) {
NotificationUtils.errorMsgDialog("It's not an Android Gradle project Currently?");
return false;
}
if (status.isExistClasspath() && status.isExistPlugin() && !status.isExistFreelineCore()) {
NotificationUtils.errorNotification("Execute task initFreeline and download freeline dependencies...");
initFreeline(project);
return false;
}
if (DialogUtil.createDialog("Detected that you did not installFreeline Freeline, Whether installFreeline Automatically?", "Install Freeline Automatically", "Cancel")) {
Module[] modules = ModuleManager.getInstance(project).getModules();
List<Pair<Module, PsiFile>> selectModulesList = new ArrayList<Pair<Module, PsiFile>>();
for (Module module : modules) {
GradleBuildFile file = GradleBuildFile.get(module);
if (file != null && !GradleUtil.isLibrary(file)) {
selectModulesList.add(Pair.create(module, file.getPsiFile()));
}
}
// 多个app模块的情况
if (selectModulesList.size() > 1) {
final DialogBuilder builder = new DialogBuilder();
builder.setTitle("Install Freeline");
builder.resizable(false);
builder.setCenterPanel(new JLabel("There are multiple application modules, Please select the module to be installed Freeline.", Messages.getInformationIcon(), SwingConstants.CENTER));
builder.addOkAction().setText("Cancel");
for (final Pair<Module, PsiFile> pair : selectModulesList) {
builder.addAction(new AbstractAction(":" + pair.first.getName()) {
@Override
public void actionPerformed(ActionEvent e) {
builder.getDialogWrapper().close(DialogWrapper.CANCEL_EXIT_CODE);
installFreeline(project, status, pair.getSecond());
}
});
}
if (builder.show() > -1) {
return false;
}
} else if (selectModulesList.size() == 1) {
installFreeline(project, status, selectModulesList.get(0).getSecond());
} else {
NotificationUtils.errorMsgDialog("Can not found Application Module! Please Sync Project.");
return false;
}
}
return false;
}
use of com.intellij.openapi.ui.DialogBuilder in project freeline by alibaba.
the class UsingReportAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent event) {
final Project project = event.getProject();
Module[] modules = ModuleManager.getInstance(project).getModules();
List<Pair<Module, PsiFile>> selectModulesList = new ArrayList<Pair<Module, PsiFile>>();
for (Module module : modules) {
GradleBuildFile file = GradleBuildFile.get(module);
if (file != null && !GradleUtil.isLibrary(file)) {
selectModulesList.add(Pair.create(module, file.getPsiFile()));
}
}
if (selectModulesList.size() > 1) {
final DialogBuilder builder = new DialogBuilder();
builder.setTitle("Freeline Reporter");
builder.resizable(false);
builder.setCenterPanel(new JLabel("There are multiple application modules, Please select the exact one.", Messages.getInformationIcon(), SwingConstants.CENTER));
builder.addOkAction().setText("Cancel");
for (final Pair<Module, PsiFile> pair : selectModulesList) {
builder.addAction(new AbstractAction(":" + pair.first.getName()) {
@Override
public void actionPerformed(ActionEvent e) {
builder.getDialogWrapper().close(DialogWrapper.CANCEL_EXIT_CODE);
report(project, pair.getSecond());
}
});
}
if (builder.show() > -1) {
//return false;
}
} else if (selectModulesList.size() == 1) {
report(project, selectModulesList.get(0).getSecond());
}
}
use of com.intellij.openapi.ui.DialogBuilder in project intellij-community by JetBrains.
the class GroupList method showDialog.
public static String showDialog(PsiClass[] classes, JComponent component) {
GroupList groupList = new GroupList(classes);
DialogBuilder builder = new DialogBuilder(component);
builder.setCenterPanel(groupList);
builder.setPreferredFocusComponent(groupList.list);
builder.setTitle("Choose Test Group");
return builder.show() != 0 ? null : groupList.getSelected();
}
use of com.intellij.openapi.ui.DialogBuilder in project intellij-community by JetBrains.
the class CCChangeCourseInfo method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
CCNewProjectPanel panel = new CCNewProjectPanel(course.getName(), Course.getAuthorsString(course.getAuthors()), course.getDescription());
setupLanguageLevels(course, panel);
DialogBuilder builder = createChangeInfoDialog(project, panel);
if (builder.showAndGet()) {
course.setAuthorsAsString(panel.getAuthors());
course.setName(panel.getName());
course.setDescription(panel.getDescription());
setVersion(course, panel);
ProjectView.getInstance(project).refresh();
ProjectInspectionProfileManager.getInstance(project).fireProfileChanged();
}
}
use of com.intellij.openapi.ui.DialogBuilder in project intellij-community by JetBrains.
the class QuickMergeInteractionImpl method selectMergeVariant.
@NotNull
@Override
public QuickMergeContentsVariants selectMergeVariant() {
QuickMergeWayOptionsPanel panel = new QuickMergeWayOptionsPanel();
DialogBuilder builder = new DialogBuilder(myProject);
builder.title("Select Merge Variant").centerPanel(panel.getMainPanel()).removeAllActions();
panel.setWrapper(builder.getDialogWrapper());
builder.show();
return panel.getVariant();
}
Aggregations