use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.
the class EditSettingsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final InspectionResultsView view = getView(e);
InspectionProfileImpl inspectionProfile = view.getCurrentProfile();
if (view.isSingleInspectionRun()) {
InspectionToolWrapper tool = ObjectUtils.notNull(inspectionProfile.getInspectionTool(ObjectUtils.notNull(inspectionProfile.getSingleTool()), view.getProject()));
JComponent panel = tool.getTool().createOptionsPanel();
if (panel != null) {
final DialogBuilder builder = new DialogBuilder().title(InspectionsBundle.message("inspection.tool.window.inspection.dialog.title", tool.getDisplayName())).centerPanel(panel);
builder.removeAllActions();
builder.addOkAction();
if (view.isRerunAvailable()) {
builder.addActionDescriptor(new DialogBuilder.DialogActionDescriptor(InspectionsBundle.message("inspection.action.rerun"), 'R') {
@Override
protected Action createAction(DialogWrapper dialogWrapper) {
return new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
view.rerun();
dialogWrapper.close(DialogWrapper.OK_EXIT_CODE);
}
};
}
});
}
builder.show();
} else {
Messages.showInfoMessage(view.getProject(), InspectionsBundle.message("inspection.tool.window.dialog.no.options", tool.getDisplayName()), InspectionsBundle.message("inspection.tool.window.dialog.title"));
}
} else {
final InspectionToolWrapper toolWrapper = view.getTree().getSelectedToolWrapper(false);
if (toolWrapper != null) {
//do not search for dead code entry point tool
final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName());
if (key != null) {
if (new EditInspectionToolsSettingsAction(key).editToolSettings(view.getProject(), inspectionProfile)) {
view.updateCurrentProfile();
}
return;
}
}
final String[] path = view.getTree().getSelectedGroupPath();
if (EditInspectionToolsSettingsAction.editSettings(view.getProject(), inspectionProfile, (c) -> {
if (path != null) {
c.selectInspectionGroup(path);
}
})) {
view.updateCurrentProfile();
}
}
}
use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.
the class EntryPointsManagerImpl method createConfigureClassPatternsButton.
public static JButton createConfigureClassPatternsButton() {
final JButton configureClassPatterns = new JButton("Code patterns...");
configureClassPatterns.setHorizontalAlignment(SwingConstants.LEFT);
configureClassPatterns.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final Project project = ProjectUtil.guessCurrentProject(configureClassPatterns);
final EntryPointsManagerBase entryPointsManagerBase = getInstance(project);
final ArrayList<ClassPattern> list = new ArrayList<>();
for (ClassPattern pattern : entryPointsManagerBase.getPatterns()) {
list.add(new ClassPattern(pattern));
}
final ClassPatternsPanel panel = new ClassPatternsPanel(list);
new DialogWrapper(entryPointsManagerBase.myProject) {
{
init();
setTitle("Configure Code Patterns");
}
@Nullable
@Override
protected JComponent createCenterPanel() {
return panel;
}
@Override
protected void doOKAction() {
final String error = panel.getValidationError(project);
if (error != null) {
Messages.showErrorDialog(panel, error);
return;
}
final LinkedHashSet<ClassPattern> patterns = entryPointsManagerBase.getPatterns();
patterns.clear();
patterns.addAll(list);
DaemonCodeAnalyzer.getInstance(entryPointsManagerBase.myProject).restart();
super.doOKAction();
}
}.show();
}
});
return configureClassPatterns;
}
use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.
the class EntryPointsManagerImpl method configureAnnotations.
@Override
public void configureAnnotations() {
final List<String> list = new ArrayList<>(ADDITIONAL_ANNOTATIONS);
final List<String> writeList = new ArrayList<>(myWriteAnnotations);
final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(list, "Mark as entry point if annotated by", true);
Condition<PsiClass> applicableToField = psiClass -> {
Set<PsiAnnotation.TargetType> annotationTargets = AnnotationTargetUtil.getAnnotationTargets(psiClass);
return annotationTargets != null && annotationTargets.contains(PsiAnnotation.TargetType.FIELD);
};
final JPanel writtenAnnotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(writeList, "Mark field as implicitly written if annotated by", false, applicableToField);
new DialogWrapper(myProject) {
{
init();
setTitle("Configure Annotations");
}
@Override
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new VerticalFlowLayout());
panel.add(listPanel);
panel.add(writtenAnnotationsPanel);
return panel;
}
@Override
protected void doOKAction() {
ADDITIONAL_ANNOTATIONS.clear();
ADDITIONAL_ANNOTATIONS.addAll(list);
myWriteAnnotations.clear();
myWriteAnnotations.addAll(writeList);
DaemonCodeAnalyzer.getInstance(myProject).restart();
super.doOKAction();
}
}.show();
}
use of com.intellij.openapi.ui.DialogWrapper in project android by JetBrains.
the class RenameCaptureFileAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
DialogWrapper dialog = new RenameDialog(project, virtualFile);
dialog.show();
}
use of com.intellij.openapi.ui.DialogWrapper in project android by JetBrains.
the class GenerateSignedApkAction method checkFacet.
private static boolean checkFacet(@NotNull AndroidFacet facet) {
final CheckModulePanel panel = new CheckModulePanel();
panel.updateMessages(facet);
final boolean hasError = panel.hasError();
if (hasError || panel.hasWarnings()) {
DialogWrapper dialog = new DialogWrapper(facet.getModule().getProject()) {
{
if (!hasError) {
setOKButtonText("Continue");
}
init();
}
@NotNull
@Override
protected Action[] createActions() {
if (hasError) {
return new Action[] { getOKAction() };
}
return super.createActions();
}
@Override
protected JComponent createCenterPanel() {
return panel;
}
};
dialog.setTitle(hasError ? CommonBundle.getErrorTitle() : CommonBundle.getWarningTitle());
dialog.show();
return !hasError && dialog.isOK();
}
return true;
}
Aggregations