Пример #1
0
  /** {@inheritDoc} */
  public void install(AbstractPluggableGUIApplication app) {

    MacroManager.get().addPropertyChangeListener(MacroManager.PROPERTY_MACROS, this);

    // Add a new menu for selecting macros
    RText rtext = (RText) app;
    MenuBar mb = (org.fife.ui.app.MenuBar) rtext.getJMenuBar();
    macrosMenu = new JMenu(getString("Plugin.Name"));
    Action a = rtext.getAction(MacroPlugin.NEW_MACRO_ACTION);
    macrosMenu.add(createMenuItem(a)); // createMenuItem(a));
    a = rtext.getAction(MacroPlugin.EDIT_MACROS_ACTION);
    macrosMenu.add(createMenuItem(a)); // createMenuItem(a));
    macrosMenu.addSeparator();
    mb.addExtraMenu(macrosMenu);
    mb.revalidate();

    loadMacros(); // Do after menu has been added
  }
Пример #2
0
  public void savePreferences() {

    saveMacros();

    MacroPrefs prefs = new MacroPrefs();

    StandardAction a = (StandardAction) app.getAction(NEW_MACRO_ACTION);
    prefs.newMacroAccelerator = a.getAccelerator();
    a = (StandardAction) app.getAction(EDIT_MACROS_ACTION);
    prefs.editMacrosAccelerator = a.getAccelerator();

    File prefsFile = getPrefsFile();
    try {
      prefs.save(prefsFile);
    } catch (IOException ioe) {
      app.displayException(ioe);
    }
  }
Пример #3
0
  protected void findInFilesFromSelectedDir() {

    File dir = getSelectedFile();
    Object sel = getLastSelectedPathComponent();

    if (dir != null && dir.isDirectory()) {
      RText rtext = plugin.getRText();
      rtext.getMainView().getFindInFilesDialog().setSearchIn(dir);
      // Note the ActionEvent isn't actually used; we're just doing
      // this for completeness.
      ActionEvent ae = new ActionEvent(this, 0, "ignored");
      rtext.getAction(RTextActionInfo.FIND_IN_FILES_ACTION).actionPerformed(ae);
    } else if (dir != null && !dir.exists() && sel instanceof FileProjectEntryTreeNode) {
      // Directory was deleted out from under us
      FileProjectEntryTreeNode fpetn = (FileProjectEntryTreeNode) sel;
      promptForRemoval(fpetn);
    } else { // Directory changed to a file out from under us?
      UIManager.getLookAndFeel().provideErrorFeedback(this);
    }
  }