Exemple #1
0
 void loadBufferSwitcher() {
   if (jEdit.getBooleanProperty("view.showBufferSwitcher")) {
     if (bufferSwitcher == null) {
       bufferSwitcher = new BufferSwitcher(this);
       add(BorderLayout.NORTH, bufferSwitcher);
       bufferSwitcher.updateBufferList();
       revalidate();
     }
   } else if (bufferSwitcher != null) {
     remove(bufferSwitcher);
     revalidate();
     bufferSwitcher = null;
   }
 }
Exemple #2
0
  @EBHandler
  public void handleBufferUpdate(BufferUpdate msg) {
    Buffer _buffer = msg.getBuffer();
    if (msg.getWhat() == BufferUpdate.CREATED) {
      if (bufferSwitcher != null) bufferSwitcher.updateBufferList();

      if (buffer.isClosed()) {

        recentBuffer = null;
      }
    } else if (msg.getWhat() == BufferUpdate.CLOSED) {
      if (bufferSwitcher != null) bufferSwitcher.updateBufferList();

      if (_buffer == buffer) {

        Buffer newBuffer = recentBuffer != null ? recentBuffer : _buffer.getPrev();

        if (newBuffer != null && !newBuffer.isClosed()) {
          setBuffer(newBuffer);
          recentBuffer = newBuffer.getPrev();
        }
      } else if (_buffer == recentBuffer) recentBuffer = null;

      Buffer closedBuffer = msg.getBuffer();
      if (closedBuffer.isUntitled()) {

        caretsForPath.remove(closedBuffer.getPath());
      }
    } else if (msg.getWhat() == BufferUpdate.LOAD_STARTED) {
      if (_buffer == buffer) {
        textArea.setCaretPosition(0);
        textArea.getPainter().repaint();
      }
    } else if (msg.getWhat() == BufferUpdate.LOADED) {
      if (_buffer == buffer) {
        textArea.repaint();
        if (bufferSwitcher != null) bufferSwitcher.updateBufferList();

        if (view.getEditPane() == this) {
          StatusBar status = view.getStatus();
          status.updateCaretStatus();
          status.updateBufferStatus();
          status.updateMiscStatus();
        }

        loadCaretInfo();
      }

    } else if (msg.getWhat() == BufferUpdate.DIRTY_CHANGED) {
      if (_buffer == buffer && bufferSwitcher != null) {
        if (buffer.isDirty()) bufferSwitcher.repaint();
        else bufferSwitcher.updateBufferList();
      }
    } else if (msg.getWhat() == BufferUpdate.MARKERS_CHANGED) {
      if (_buffer == buffer) textArea.getGutter().repaint();
    } else if (msg.getWhat() == BufferUpdate.PROPERTIES_CHANGED) {
      if (_buffer == buffer && buffer.isLoaded()) {
        textArea.propertiesChanged();
        if (view.getEditPane() == this) view.getStatus().updateBufferStatus();
      }
    } else if (msg.getWhat() == BufferUpdate.SAVED && _buffer == buffer) {
      textArea.propertiesChanged();
    }
  }
Exemple #3
0
  private void propertiesChanged() {
    TextAreaPainter painter = textArea.getPainter();

    initPainter(painter);
    Gutter gutter = textArea.getGutter();
    gutter.setExpanded(jEdit.getBooleanProperty("view.gutter.lineNumbers"));
    int interval = jEdit.getIntegerProperty("view.gutter.highlightInterval", 5);
    gutter.setHighlightInterval(interval);
    gutter.setCurrentLineHighlightEnabled(
        jEdit.getBooleanProperty("view.gutter.highlightCurrentLine"));
    gutter.setStructureHighlightEnabled(jEdit.getBooleanProperty("view.gutter.structureHighlight"));
    gutter.setStructureHighlightColor(
        jEdit.getColorProperty("view.gutter.structureHighlightColor"));
    gutter.setBackground(jEdit.getColorProperty("view.gutter.bgColor"));
    gutter.setForeground(jEdit.getColorProperty("view.gutter.fgColor"));
    gutter.setHighlightedForeground(jEdit.getColorProperty("view.gutter.highlightColor"));
    gutter.setFoldColor(jEdit.getColorProperty("view.gutter.foldColor"));
    markerHighlight.setMarkerHighlightColor(jEdit.getColorProperty("view.gutter.markerColor"));
    markerHighlight.setMarkerHighlightEnabled(
        jEdit.getBooleanProperty("view.gutter.markerHighlight"));
    gutter.setCurrentLineForeground(jEdit.getColorProperty("view.gutter.currentLineColor"));
    String alignment = jEdit.getProperty("view.gutter.numberAlignment");
    if ("right".equals(alignment)) {
      gutter.setLineNumberAlignment(Gutter.RIGHT);
    } else if ("center".equals(alignment)) {
      gutter.setLineNumberAlignment(Gutter.CENTER);
    } else {
      gutter.setLineNumberAlignment(Gutter.LEFT);
    }

    gutter.setFont(jEdit.getFontProperty("view.gutter.font"));
    gutter.setGutterEnabled(GutterOptionPane.isGutterEnabled());
    gutter.setMinLineNumberDigitCount(GutterOptionPane.getMinLineNumberDigits());
    gutter.setSelectionAreaEnabled(GutterOptionPane.isSelectionAreaEnabled());
    gutter.setSelectionAreaBackground(GutterOptionPane.getSelectionAreaBackground());
    gutter.setSelectionAreaWidth(GutterOptionPane.getSelectionAreaWidth());

    int width = jEdit.getIntegerProperty("view.gutter.borderWidth", 3);
    gutter.setBorder(
        width,
        jEdit.getColorProperty("view.gutter.focusBorderColor"),
        jEdit.getColorProperty("view.gutter.noFocusBorderColor"),
        textArea.getPainter().getBackground());
    gutter.setFoldPainter(textArea.getFoldPainter());

    textArea.setCaretBlinkEnabled(jEdit.getBooleanProperty("view.caretBlink"));

    textArea.setElectricScroll(jEdit.getIntegerProperty("view.electricBorders", 0));

    textArea.createPopupMenu(null);

    textArea.setQuickCopyEnabled(jEdit.getBooleanProperty("view.middleMousePaste"));

    textArea.setDragEnabled(jEdit.getBooleanProperty("view.dragAndDrop"));

    textArea.setJoinNonWordChars(jEdit.getBooleanProperty("view.joinNonWordChars"));

    textArea.setCtrlForRectangularSelection(
        jEdit.getBooleanProperty("view.ctrlForRectangularSelection"));

    textArea.propertiesChanged();

    if (bufferSwitcher != null) {
      bufferSwitcher.setMaximumRowCount(jEdit.getIntegerProperty("bufferSwitcher.maxRowCount", 10));
    }
  }