Skip to content

Commit

Permalink
change order in popup menu: show suggestions directly after the error…
Browse files Browse the repository at this point in the history
… message
  • Loading branch information
danielnaber committed Dec 23, 2013
1 parent 4875a5f commit 7f19f43
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ private void showPopup(MouseEvent event) {
int offset = this.textComponent.viewToModel(event.getPoint());
final Span span = getSpan(offset);
JPopupMenu popup = new JPopupMenu("Grammar Menu");
if(span != null) {
if (span != null) {
JLabel msgItem = new JLabel("<html>"
+ span.msg.replace("<suggestion>", "<b>").replace("</suggestion>", "</b>")
+ "</html>");
Expand All @@ -428,6 +428,14 @@ private void showPopup(MouseEvent event) {

popup.add(new JSeparator());

for (String r : span.replacement) {
ReplaceMenuItem item = new ReplaceMenuItem(r, span);
popup.add(item);
item.addActionListener(actionListener);
}

popup.add(new JSeparator());

JMenuItem moreItem = new JMenuItem(messages.getString("guiMore"));
moreItem.addActionListener(new ActionListener() {
@Override
Expand Down Expand Up @@ -473,14 +481,8 @@ public void actionPerformed(ActionEvent e) {
popup.add(activateRuleItem);
}
}
popup.add(new JSeparator());

if(span != null) {
for (String r : span.replacement) {
ReplaceMenuItem item = new ReplaceMenuItem(r, span);
popup.add(item);
item.addActionListener(actionListener);
}
if (span != null) {
textComponent.setCaretPosition(span.start);
textComponent.moveCaretPosition(span.end);
}
Expand Down

0 comments on commit 7f19f43

Please sign in to comment.