Ejemplo n.º 1
0
  /**
   * Forces the action set to be loaded. Plugins and macros should not call this method.
   *
   * @since jEdit 4.2pre1
   */
  public void load() {
    if (loaded) return;

    loaded = true;
    // actions.clear();

    if (uri == null) return;
    try {
      Log.log(Log.DEBUG, this, "Loading actions from " + uri);
      ActionListHandler ah = new ActionListHandler(uri.toString(), this);
      InputStream in = uri.openStream();
      if (in == null) {
        // this happened when calling generateCache() in the context of 'find orphan jars'
        // in org.gjt.sp.jedit.pluginmgr.ManagePanel.FindOrphan.actionPerformed(ActionEvent)
        // because for not loaded plugins, the plugin will not be added to the list of pluginJars
        // so the org.gjt.sp.jedit.proto.jeditresource.PluginResURLConnection will not find the
        // plugin
        // to read the resource from.
        // Better log a small error message than a big stack trace
        Log.log(Log.WARNING, this, "Unable to open: " + uri);
      } else if (XMLUtilities.parseXML(in, ah)) {
        Log.log(Log.ERROR, this, "Unable to parse: " + uri);
      }
    } catch (IOException e) {
      Log.log(Log.ERROR, this, uri, e);
    }
  } // }}}
Ejemplo n.º 2
0
  /**
   * loads a pluginSet xml file and updates the model to reflect certain checked selections
   *
   * @since jEdit 4.3pre10
   * @author Alan Ezust
   */
  boolean loadPluginSet(String path) {
    pluginSet.clear();
    pluginModel.restoreSelection(new HashSet<String>(), new HashSet<String>());

    VFS vfs = VFSManager.getVFSForPath(path);
    Object session = vfs.createVFSSession(path, InstallPanel.this);
    try {
      InputStream is = vfs._createInputStream(session, path, false, InstallPanel.this);
      XMLUtilities.parseXML(is, new StringMapHandler());
    } catch (Exception e) {
      Log.log(Log.WARNING, this, "Loading Pluginset failed:" + e.getMessage());
      return false;
    }
    pluginModel.update();
    return true;
  } // }}}