Ignore:
Timestamp:
2015-02-16T15:40:51+01:00 (9 years ago)
Author:
bastiK
Message:

#11090 - do not load plugins unless dependencies can be loaded
(or are already loaded)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r8030 r8074  
    1212import java.util.ArrayList;
    1313import java.util.Collection;
     14import java.util.HashSet;
     15import java.util.Iterator;
    1416import java.util.LinkedList;
    1517import java.util.List;
     
    5860import org.openstreetmap.josm.plugins.PluginHandler;
    5961import org.openstreetmap.josm.plugins.PluginInformation;
     62import org.openstreetmap.josm.plugins.PluginProxy;
    6063import org.openstreetmap.josm.tools.BugReportExceptionHandler;
    6164import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    384387                        }
    385388                    }
     389                    // check if plugin dependences can also be loaded
     390                    Collection<PluginInformation> allPlugins = new HashSet<>(toLoad);
     391                    for (PluginProxy proxy : PluginHandler.pluginList) {
     392                        allPlugins.add(proxy.getPluginInformation());
     393                    }
     394                    boolean removed;
     395                    do {
     396                        removed = false;
     397                        Iterator<PluginInformation> it = toLoad.iterator();
     398                        while (it.hasNext()) {
     399                            if (!PluginHandler.checkRequiredPluginsPreconditions(null, allPlugins, it.next(), requiresRestart)) {
     400                                it.remove();
     401                                removed = true;
     402                            }
     403                        }
     404                    } while (removed);
     405                   
    386406                    if (!toLoad.isEmpty()) {
    387                         PluginHandler.loadPlugins(PreferenceTabbedPane.this, toLoad, null); // FIXME: progress bar
     407                        PluginHandler.loadPlugins(PreferenceTabbedPane.this, toLoad, null);
    388408                    }
    389409                }
Note: See TracChangeset for help on using the changeset viewer.