/** * 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; } // }}}
// {{{ updateModel() method public void updateModel() { final Set<String> savedChecked = new HashSet<String>(); final Set<String> savedSelection = new HashSet<String>(); pluginModel.saveSelection(savedChecked, savedSelection); pluginModel.clear(); infoBox.setText(jEdit.getProperty("plugin-manager.list-download")); ThreadUtilities.runInDispatchThread( new Runnable() { @Override public void run() { infoBox.setText(null); pluginModel.update(); pluginModel.restoreSelection(savedChecked, savedSelection); } }); } // }}}
@Override public void filter(final List<IdeaPluginDescriptor> filtered) { view.clear(); for (IdeaPluginDescriptor descriptor : filtered) { view.add(descriptor); } super.filter(filtered); }
// {{{ handleMessage() method @Override public void handleMessage(EBMessage message) { if (message.getSource() == PluginManager.getInstance()) { chooseButton.path = jEdit.getProperty(PluginManager.PROPERTY_PLUGINSET, ""); if (chooseButton.path.length() > 0) { loadPluginSet(chooseButton.path); pluginModel.restoreSelection(new HashSet<String>(), new HashSet<String>()); chooseButton.updateUI(); } } } // }}}