Changeset 16974 in josm for trunk/src/org


Ignore:
Timestamp:
2020-08-29T21:28:44+02:00 (4 years ago)
Author:
simon04
Message:

see #19027, see #19290 - PluginHandler.loadVeryEarlyPlugins for plugins providing a LookAndFeel

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r16961 r16974  
    871871        setupCallbacks();
    872872
     873        if (!skipLoadingPlugins) {
     874            PluginHandler.loadVeryEarlyPlugins();
     875        }
    873876        // Configure Look and feel before showing SplashScreen (#19290)
    874877        setupUIManager();
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r16921 r16974  
    902902
    903903    /**
    904      * Loads plugins from <code>plugins</code> which have the flag {@link PluginInformation#early} set to true.
     904     * Loads plugins from <code>plugins</code> which have the flag {@link PluginInformation#early} set to true
     905     * <i>and</i> a negative {@link PluginInformation#stage} value.
     906     *
     907     * This is meant for plugins that provide additional {@link javax.swing.LookAndFeel}.
     908     */
     909    public static void loadVeryEarlyPlugins() {
     910        List<PluginInformation> veryEarlyPlugins = PluginHandler.buildListOfPluginsToLoad(null, null)
     911                .stream()
     912                .filter(pi -> pi.early && pi.stage < 0)
     913                .collect(Collectors.toList());
     914        loadPlugins(null, veryEarlyPlugins, null);
     915    }
     916
     917    /**
     918     * Loads plugins from <code>plugins</code> which have the flag {@link PluginInformation#early} set to true
     919     * <i>and</i> a non-negative {@link PluginInformation#stage} value.
    905920     *
    906921     * @param parent The parent component to be used for the displayed dialog
     
    909924     */
    910925    public static void loadEarlyPlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {
    911         List<PluginInformation> earlyPlugins = new ArrayList<>(plugins.size());
    912         for (PluginInformation pi: plugins) {
    913             if (pi.early) {
    914                 earlyPlugins.add(pi);
    915             }
    916         }
     926        List<PluginInformation> earlyPlugins = plugins.stream()
     927                .filter(pi -> pi.early && pi.stage >= 0)
     928                .collect(Collectors.toList());
    917929        loadPlugins(parent, earlyPlugins, monitor);
    918930    }
     
    926938     */
    927939    public static void loadLatePlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {
    928         List<PluginInformation> latePlugins = new ArrayList<>(plugins.size());
    929         for (PluginInformation pi: plugins) {
    930             if (!pi.early) {
    931                 latePlugins.add(pi);
    932             }
    933         }
     940        List<PluginInformation> latePlugins = plugins.stream()
     941                .filter(pi -> !pi.early)
     942                .collect(Collectors.toList());
    934943        loadPlugins(parent, latePlugins, monitor);
    935944    }
     
    10231032                }
    10241033            }
    1025             if (!plugins.isEmpty()) {
     1034            if (!plugins.isEmpty() && parent != null) {
    10261035                alertMissingPluginInformation(parent, plugins);
    10271036            }
Note: See TracChangeset for help on using the changeset viewer.