use of com.intellij.openapi.ui.JBCheckboxMenuItem in project intellij-community by JetBrains.
the class DaemonEditorPopup method invokePopup.
@Override
public void invokePopup(final Component comp, final int x, final int y) {
if (ApplicationManager.getApplication() == null)
return;
final JRadioButtonMenuItem errorsFirst = createRadioButtonMenuItem(EditorBundle.message("errors.panel.go.to.errors.first.radio"));
errorsFirst.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DaemonCodeAnalyzerSettings.getInstance().NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = errorsFirst.isSelected();
}
});
final JPopupMenu popupMenu = new JBPopupMenu();
popupMenu.add(errorsFirst);
final JRadioButtonMenuItem next = createRadioButtonMenuItem(EditorBundle.message("errors.panel.go.to.next.error.warning.radio"));
next.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DaemonCodeAnalyzerSettings.getInstance().NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = !next.isSelected();
}
});
popupMenu.add(next);
ButtonGroup group = new ButtonGroup();
group.add(errorsFirst);
group.add(next);
popupMenu.addSeparator();
final JMenuItem hLevel = new JBMenuItem(EditorBundle.message("customize.highlighting.level.menu.item"));
popupMenu.add(hLevel);
final boolean isErrorsFirst = DaemonCodeAnalyzerSettings.getInstance().NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST;
errorsFirst.setSelected(isErrorsFirst);
next.setSelected(!isErrorsFirst);
hLevel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final PsiFile psiFile = myPsiFile;
if (psiFile == null)
return;
final HectorComponent component = new HectorComponent(psiFile);
final Dimension dimension = component.getPreferredSize();
Point point = new Point(x, y);
component.showComponent(new RelativePoint(comp, new Point(point.x - dimension.width, point.y)));
}
});
final JBCheckboxMenuItem previewCheckbox = new JBCheckboxMenuItem(IdeBundle.message("checkbox.show.editor.preview.popup"), UISettings.getInstance().getShowEditorToolTip());
popupMenu.addSeparator();
popupMenu.add(previewCheckbox);
previewCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UISettings.getInstance().setShowToolWindowsNumbers(previewCheckbox.isSelected());
UISettings.getInstance().fireUISettingsChanged();
}
});
PsiFile file = myPsiFile;
if (file != null && DaemonCodeAnalyzer.getInstance(myPsiFile.getProject()).isHighlightingAvailable(file)) {
popupMenu.show(comp, x, y);
}
}
Aggregations