コード例 #1
0
 // {{{ dispose() method
 @Override
 public void dispose() {
   instance = null;
   EditBus.removeFromBus(this);
   EditBus.removeFromBus(installer);
   super.dispose();
 } // }}}
コード例 #2
0
ファイル: EditPane.java プロジェクト: RoDaniel/featurehouse
  public void setBuffer(final Buffer buffer, boolean requestFocus) {
    if (buffer == null) throw new NullPointerException();

    if (this.buffer == buffer) return;

    if (bufferSet.indexOf(buffer) == -1) {
      jEdit.getBufferSetManager().addBuffer(this, buffer);
    }

    EditBus.send(new BufferChanging(this, buffer));
    if (bufferSet.indexOf(this.buffer) != -1) {

      recentBuffer = this.buffer;
    }
    if (recentBuffer != null) saveCaretInfo();
    this.buffer = buffer;

    textArea.setBuffer(buffer);

    if (!init) {
      view.updateTitle();

      if (bufferSwitcher != null) {
        if (bufferSwitcher.getSelectedItem() != buffer) bufferSwitcher.setSelectedItem(buffer);
        bufferSwitcher.setToolTipText(buffer.getPath());
      }

      EditBus.send(new EditPaneUpdate(this, EditPaneUpdate.BUFFER_CHANGED));
    }

    if (requestFocus) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {

              if (view.getEditPane() == EditPane.this
                  && (bufferSwitcher == null || !bufferSwitcher.isPopupVisible())) {
                textArea.requestFocus();
              }
            }
          });
    }

    Runnable runnable =
        new Runnable() {
          public void run() {

            if (buffer == getBuffer()) loadCaretInfo();
          }
        };

    if (buffer.isPerformingIO()) VFSManager.runInAWTThread(runnable);
    else runnable.run();
  }
コード例 #3
0
  // {{{ init() method
  private void init() {
    EditBus.addToBus(this);

    /* Setup panes */
    JPanel content = new JPanel(new BorderLayout(12, 12));
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    tabPane = new JTabbedPane();
    tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this));
    tabPane.addTab(
        jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true));
    tabPane.addTab(
        jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false));
    EditBus.addToBus(installer);
    content.add(BorderLayout.CENTER, tabPane);

    tabPane.addChangeListener(new ListUpdater());

    /* Create the buttons */
    Box buttons = new Box(BoxLayout.X_AXIS);

    ActionListener al = new ActionHandler();
    mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options"));
    mgrOptions.addActionListener(al);
    pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options"));
    pluginOptions.addActionListener(al);
    done = new JButton(jEdit.getProperty("plugin-manager.done"));
    done.addActionListener(al);

    buttons.add(Box.createGlue());
    buttons.add(mgrOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(pluginOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(done);
    buttons.add(Box.createGlue());

    getRootPane().setDefaultButton(done);

    content.add(BorderLayout.SOUTH, buttons);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setIconImage(GUIUtilities.getPluginIcon());

    pack();
    GUIUtilities.loadGeometry(this, parent, "plugin-manager");
    GUIUtilities.addSizeSaver(this, parent, "plugin-manager");
    setVisible(true);
  } // }}}
コード例 #4
0
  /**
   * Sets the state of the auto wrap around flag.
   *
   * @param wrap If true, the 'continue search from start' dialog will not be displayed
   * @since jEdit 3.2pre2
   */
  public static void setAutoWrapAround(boolean wrap) {
    if (wrap == SearchAndReplace.wrap) return;

    SearchAndReplace.wrap = wrap;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #5
0
  /**
   * Sets the current replacement string.
   *
   * @param replace The new replacement string
   */
  public static void setReplaceString(String replace) {
    if (replace.equals(SearchAndReplace.replace)) return;

    SearchAndReplace.replace = replace;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #6
0
  /**
   * Determines whether a reverse search will conducted from the current position to the beginning
   * of a buffer. Note that reverse search and regular expression search is mutually exclusive;
   * enabling one will disable the other.
   *
   * @param reverse True if searches should go backwards, false otherwise
   */
  public static void setReverseSearch(boolean reverse) {
    if (reverse == SearchAndReplace.reverse) return;

    SearchAndReplace.reverse = reverse;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #7
0
  /**
   * Sets the state of the BeanShell replace flag.
   *
   * @param beanshell True if the replace string is a BeanShell expression
   * @since jEdit 3.2pre2
   */
  public static void setBeanShellReplace(boolean beanshell) {
    if (beanshell == SearchAndReplace.beanshell) return;

    SearchAndReplace.beanshell = beanshell;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #8
0
  /**
   * Sets the current search string.
   *
   * @param search The new search string
   */
  public static void setSearchString(String search) {
    if (search.equals(SearchAndReplace.search)) return;

    SearchAndReplace.search = search;
    matcher = null;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #9
0
  /**
   * Sets the ignore case flag.
   *
   * @param ignoreCase True if searches should be case insensitive, false otherwise
   */
  public static void setIgnoreCase(boolean ignoreCase) {
    if (ignoreCase == SearchAndReplace.ignoreCase) return;

    SearchAndReplace.ignoreCase = ignoreCase;
    matcher = null;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #10
0
  /**
   * Sets the whole word flag.
   *
   * @param wholeWord True if only whole words should be searched, false otherwise
   * @since 4.5pre1
   */
  public static void setWholeWord(boolean wholeWord) {
    if (wholeWord == SearchAndReplace.wholeWord) return;

    SearchAndReplace.wholeWord = wholeWord;
    matcher = null;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #11
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
 // {{{ addNotify() method
 @Override
 public void addNotify() {
   super.addNotify();
   EditBus.addToBus(this);
   multiStatus = jEdit.getBooleanProperty("hypersearch-results.multi");
   updateHighlightStatus();
   updateMultiStatus();
 } // }}}
コード例 #12
0
  /**
   * Sets the state of the regular expression flag.
   *
   * @param regexp True if regular expression searches should be performed
   */
  public static void setRegexp(boolean regexp) {
    if (regexp == SearchAndReplace.regexp) return;

    SearchAndReplace.regexp = regexp;
    if (regexp && reverse) reverse = false;

    matcher = null;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #13
0
ファイル: VFSManager.java プロジェクト: RoDaniel/featurehouse
    public void run() {
      synchronized (vfsUpdateLock) {
        Collections.sort(vfsUpdates, new MiscUtilities.StringCompare());
        for (int i = 0; i < vfsUpdates.size(); i++) {
          EditBus.send((VFSUpdate) vfsUpdates.get(i));
        }

        vfsUpdates.clear();
      }
    }
コード例 #14
0
ファイル: VFS.java プロジェクト: jthuggins/jeditide
 // {{{ Class initializer
 static {
   EditBus.addToBus(
       new EBComponent() {
         public void handleMessage(EBMessage msg) {
           if (msg instanceof PropertiesChanged) {
             synchronized (lock) {
               colors = null;
             }
           }
         }
       });
 } // }}}
コード例 #15
0
  /**
   * Finds the next instance of the search string in the specified buffer.
   *
   * @param view The view
   * @param buffer The buffer
   * @param start Location where to start the search
   * @param firstTime See {@link
   *     SearchMatcher#nextMatch(CharSequence,boolean,boolean,boolean,boolean)}.
   * @since jEdit 4.1pre7
   */
  public static boolean find(
      View view, Buffer buffer, int start, boolean firstTime, boolean reverse) throws Exception {

    EditBus.send(new PositionChanging(view.getEditPane()));

    SearchMatcher matcher = getSearchMatcher();
    if (matcher == null) {
      view.getToolkit().beep();
      return false;
    }

    CharSequence text;
    boolean startOfLine;
    boolean endOfLine;
    if (reverse) {
      text = new ReverseCharSequence(buffer.getSegment(0, start));
      startOfLine = true;
      endOfLine = (buffer.getLineEndOffset(buffer.getLineOfOffset(start)) - 1 == start);
    } else {
      text = buffer.getSegment(start, buffer.getLength() - start);
      startOfLine = (buffer.getLineStartOffset(buffer.getLineOfOffset(start)) == start);
      endOfLine = true;
    }

    String noWordSep = buffer.getStringProperty("noWordSep");
    matcher.setNoWordSep(noWordSep);
    SearchMatcher.Match match = matcher.nextMatch(text, startOfLine, endOfLine, firstTime, reverse);
    if (match != null) {
      jEdit.commitTemporary(buffer);
      view.setBuffer(buffer, true);
      JEditTextArea textArea = view.getTextArea();

      if (reverse) {
        textArea.setSelection(new Selection.Range(start - match.end, start - match.start));
        // make sure end of match is visible
        textArea.scrollTo(start - match.start, false);
        textArea.moveCaretPosition(start - match.end);
      } else {
        textArea.setSelection(new Selection.Range(start + match.start, start + match.end));
        textArea.moveCaretPosition(start + match.end);
        // make sure start of match is visible
        textArea.scrollTo(start + match.start, false);
      }

      return true;
    } else return false;
  } // }}}
コード例 #16
0
  /** Loads search and replace state from the properties. */
  public static void load() {
    search = jEdit.getProperty("search.find.value");
    replace = jEdit.getProperty("search.replace.value");
    wholeWord = jEdit.getBooleanProperty("search.wholeWord.toggle");
    ignoreCase = jEdit.getBooleanProperty("search.ignoreCase.toggle");
    regexp = jEdit.getBooleanProperty("search.regexp.toggle");
    beanshell = jEdit.getBooleanProperty("search.beanshell.toggle");
    wrap = jEdit.getBooleanProperty("search.wrap.toggle");

    fileset = new CurrentBufferSet();

    // Tags plugin likes to call this method at times other than
    // startup; so we need to fire a SearchSettingsChanged to
    // notify the search bar and so on.
    matcher = null;
    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #17
0
ファイル: EditPane.java プロジェクト: RoDaniel/featurehouse
  EditPane(View view, BufferSet bufferSetSource, Buffer buffer) {
    super(new BorderLayout());
    bufferSet = new BufferSet(bufferSetSource);
    init = true;

    this.view = view;

    textArea = new JEditTextArea(view);
    bufferSet.addBufferSetListener(this);
    textArea.getPainter().setAntiAlias(new AntiAlias(jEdit.getProperty("view.antiAlias")));
    textArea.setMouseHandler(new MouseHandler(textArea));
    textArea.setTransferHandler(new TextAreaTransferHandler());
    markerHighlight = new MarkerHighlight();
    Gutter gutter = textArea.getGutter();
    gutter.setGutterEnabled(GutterOptionPane.isGutterEnabled());
    gutter.setMinLineNumberDigitCount(GutterOptionPane.getMinLineNumberDigits());
    gutter.setSelectionAreaEnabled(GutterOptionPane.isSelectionAreaEnabled());
    gutter.addExtension(markerHighlight);
    gutter.setSelectionPopupHandler(
        new GutterPopupHandler() {
          public void handlePopup(int x, int y, int line) {
            Buffer buffer = getBuffer();
            buffer.addOrRemoveMarker('\0', buffer.getLineStartOffset(line));
          }
        });

    textArea.addStatusListener(new StatusHandler());
    add(BorderLayout.CENTER, textArea);

    propertiesChanged();
    setBuffer(buffer);

    if (bufferSet.indexOf(buffer) == -1) bufferSet.addBuffer(buffer);

    loadBufferSwitcher();

    init = false;
    EditBus.addToBus(this);
  }
コード例 #18
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
 // {{{ removeNotify() method
 @Override
 public void removeNotify() {
   super.removeNotify();
   EditBus.removeFromBus(this);
   jEdit.setBooleanProperty("hypersearch-results.multi", multiStatus);
 } // }}}
コード例 #19
0
 // {{{ notifyChange() method
 private static void notifyChange() {
   EditBus.send(new DynamicMenuChanged("recent-files"));
 } // }}}
コード例 #20
0
ファイル: h4Jmf.java プロジェクト: jkoppel/javaparser-to-hs
 /** **if using these without call to super,view empty! no cnsl, no cpc */
 public void addNotify() {
   logger.info("");
   super.addNotify();
   EditBus.addToBus(this);
 }
コード例 #21
0
ファイル: h4Jmf.java プロジェクト: jkoppel/javaparser-to-hs
 public void removeNotify() {
   logger.info("");
   super.removeNotify();
   EditBus.removeFromBus(this);
 }
コード例 #22
0
ファイル: EditPane.java プロジェクト: RoDaniel/featurehouse
 void close() {
   saveCaretInfo();
   EditBus.send(new EditPaneUpdate(this, EditPaneUpdate.DESTROYED));
   EditBus.removeFromBus(this);
   textArea.dispose();
 }
コード例 #23
0
  /**
   * Sets a custom search string matcher. Note that calling {@link #setSearchString(String)}, {@link
   * #setWholeWord(boolean)}, {@link #setIgnoreCase(boolean)}, or {@link #setRegexp(boolean)} will
   * reset the matcher to the default.
   */
  public static void setSearchMatcher(SearchMatcher matcher) {
    SearchAndReplace.matcher = matcher;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}
コード例 #24
0
  /**
   * Sets the current search file set.
   *
   * @param fileset The file set to perform searches in
   * @see AllBufferSet
   * @see CurrentBufferSet
   * @see DirectoryListSet
   */
  public static void setSearchFileSet(SearchFileSet fileset) {
    SearchAndReplace.fileset = fileset;

    EditBus.send(new SearchSettingsChanged(null));
  } // }}}