Changeset 1234


Ignore:
Timestamp:
Jul 21, 2011, 12:17:59 AM (6 years ago)
Author:
stefan
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sce/codehelper/CodeHelperPane.java

    r1233 r1234  
    55
    66import javax.swing.*;
     7import javax.swing.event.PopupMenuEvent;
     8import javax.swing.event.PopupMenuListener;
    79import java.awt.*;
    810import java.awt.event.KeyEvent;
     
    2022 * @author Stefan Endrullis
    2123 */
    22 public class CodeHelperPane extends JScrollPane implements KeyListener, SCEDocumentListener, MouseListener {
     24public class CodeHelperPane extends JScrollPane implements KeyListener, SCEDocumentListener, MouseListener, PopupMenuListener {
    2325  // the source code pane
    2426  protected SCEPane pane = null;
     
    8688    popup.add(this);
    8789    popup.setFocusable(false);
     90    popup.addPopupMenuListener(this);
    8891
    8992    // add listeners
     
    386389      if (replacement != null) {
    387390        if (wordPos.word.equals(replacement)) {
    388           level = Math.min(level + 1, 3);
     391          if (popup.isVisible()) {
     392            level = Math.min(level + 1, 3);
     393            updatePrefix(level);
     394          }
    389395        } else {
    390396          replace(wordPos, replacement);
     
    479485  }
    480486
    481 
    482   // inner classes
     487  @Override
     488  public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
     489  }
     490
     491  @Override
     492  public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
     493    level = 1;
     494  }
     495
     496  @Override
     497  public void popupMenuCanceled(PopupMenuEvent e) {
     498    level = 1;
     499  }
     500
     501
     502  // inner classes
    483503
    484504  public static class SCEListCellRenderer extends DefaultListCellRenderer {
Note: See TracChangeset for help on using the changeset viewer.