mbien commented on PR #9303:
URL: https://github.com/apache/netbeans/pull/9303#issuecomment-4172877465

   thanks, will rebase and merge. then continue with the other two startup perf 
PRs. Cache loading first (https://github.com/apache/netbeans/pull/9307, 
https://github.com/apache/netbeans/pull/9308).
   
   the gh action queue is full atm. Will wait until CI runs again.
   
   > Removing the code in here would be more than the comment though -
   
   as previously mentioned: already done, here the stash for anyone wanting to 
do anything with it:
   
   <details>
   
   ```diff
   diff --git a/platform/core.startup/src/org/netbeans/core/startup/Splash.java 
b/platform/core.startup/src/org/netbeans/core/startup/Splash.java
   index 416381f..3c80726 100644
   --- a/platform/core.startup/src/org/netbeans/core/startup/Splash.java
   +++ b/platform/core.startup/src/org/netbeans/core/startup/Splash.java
   @@ -32,15 +32,11 @@
    import java.awt.Image;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
   -import java.awt.SplashScreen;
    import java.awt.Toolkit;
    import java.awt.Window;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
   -import java.awt.image.BufferedImage;
   -import java.io.DataOutputStream;
   -import java.io.IOException;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Locale;
   @@ -51,7 +47,6 @@
    import java.util.StringTokenizer;
    import java.util.logging.Level;
    import java.util.logging.Logger;
   -import javax.imageio.ImageIO;
    import javax.swing.Icon;
    import javax.swing.JComponent;
    import javax.swing.JDialog;
   @@ -62,7 +57,6 @@
    import javax.swing.SwingConstants;
    import javax.swing.SwingUtilities;
    import javax.swing.WindowConstants;
   -import org.netbeans.Stamps;
    import org.netbeans.Util;
    import org.openide.util.ImageUtilities;
    import org.openide.util.NbBundle;
   @@ -74,18 +68,21 @@
    /** A class that encapsulates all the splash screen things.
    */
    @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject")
   -public final class Splash implements Stamps.Updater {
   +public final class Splash {
    
        private static volatile Splash splash;
    
   -    private volatile SplashPainter painter;
        private JFrame frame;
   -    private SplashComponent comp;
   +    private volatile SplashComponent comp;
        private final Progress progress;
    
        /** is there progress bar in splash or not */
        private static final boolean noBar = 
Boolean.getBoolean("netbeans.splash.nobar") ||
                !Boolean.parseBoolean(NbBundle.getMessage(Splash.class, 
"SplashShowProgressBar"));
   +    
   +    private Splash() {
   +        this.progress = new Progress();
   +    }
    
        public static Splash getInstance() {
            if (splash != null) {
   @@ -115,36 +112,7 @@
                    
ImageUtilities.loadImage("org/netbeans/core/startup/frame1024.png", true)) // 
NOI18N
            );
        }
   -    /**
   -     * Indicate if we should try to take advantage of java's "-splash" 
parameter, which allows
   -     * the splash screen to be displayed at an earlier stage in the app 
startup sequence. See the
   -     * original Buzilla RFE at 
https://netbeans.org/bugzilla/show_bug.cgi?id=60142 . This requires
   -     * splash screen image(s) to be written to the cache directory the 
first time NetBeans starts,
   -     * to be available during subsequent NetBeans startups. Despite
   -     * https://bugs.openjdk.java.net/browse/JDK-8145173 and
   -     * https://bugs.openjdk.java.net/browse/JDK-8151787 , as of OpenJDK 
10.0.2 and OpenJDK 12.0.1
   -     * I have found no way to make this work properly with HiDPI screens on 
Windows. HiDPI filenames
   -     * attempted include "[email protected]", "[email protected]", 
"splash.scale-200.png", and
   -     * "splash.java-scale200.png". In all of these cases, the regular 
"splash.png" file is used
   -     * instead of one of the 2x-scaled ones (for a system DPI scaling of 
200%), and the splash
   -     * screen becomes half the expected size. Thus, to we disable this 
feature for now, in favor of
   -     * a slightly delayed splash screen that appears with the correct size 
and resolution on HiDPI
   -     * screens.
   -     *
   -     * <p>See also https://issues.apache.org/jira/browse/NETBEANS-67 .
   -     */
   -    private static final boolean USE_LAUNCHER_SPLASH = false;
   -    
   -    private Splash() {
   -        this.progress = new Progress();
   -        Stamps s = Stamps.getModulesJARs();
   -        if (!CLIOptions.isNoSplash() && !GraphicsEnvironment.isHeadless()) {
   -            if (USE_LAUNCHER_SPLASH && !s.exists("splash.png")) {
   -                s.scheduleSave(this, "splash.png", false);
   -            }
   -        }
   -    }
   -    
   +
        int getMaxSteps() {
            return progress.maxSteps;
        }
   @@ -162,22 +130,8 @@
            }
            if (show) {
                onEDT(() -> {
   -                if (painter == null) {
   -                    try {
   -                        SplashScreen splashScreen = 
SplashScreen.getSplashScreen();
   -                        if (splashScreen != null) {
   -                            painter = new SplashPainter(progress, 
splashScreen.createGraphics(), null, false);
   -                        }
   -                    } catch (IllegalStateException splashAlreadyClosed) {}
   -                    if (painter == null) {
   -                        comp = new SplashComponent(progress, false);
   -                        painter = comp.painter;
   -                    }
   -                    if (comp == null) {
   -                        return;
   -                    }
   -                }
                    if (frame == null) {
   +                    comp = new SplashComponent(progress, false);
                        frame = new JFrame(NbBundle.getMessage(Splash.class, 
"LBL_splash_window_title")); // e.g. for window tray display
                        initFrameIcons(frame); // again, only for possible 
window tray display
                        frame.setUndecorated(true);
   @@ -201,6 +155,7 @@
                        frame.setVisible(false);
                        frame.dispose();
                        frame = null;
   +                    comp = null;
                    }
                });
            }
   @@ -215,7 +170,7 @@
            if (noBar || CLIOptions.isNoSplash()) {
                return;
            }
   -        progress.increment(painter, steps);
   +        progress.increment(comp != null ? comp.painter : null, steps);
        }
        
        public Component getComponent() {
   @@ -228,7 +183,7 @@
            if (CLIOptions.isNoSplash()) {
                return;
            }
   -        progress.setText(painter, text);
   +        progress.setText(comp != null ? comp.painter : null, text);
        }
    
        /** Adds specified numbers of steps to a progress
   @@ -274,15 +229,6 @@
                    Integer.parseInt(NbBundle.getMessage(Splash.class, 
"SPLASH_WIDTH")),
                    Integer.parseInt(NbBundle.getMessage(Splash.class, 
"SPLASH_HEIGHT")));
        }
   -
   -    @Override
   -    public void flushCaches(DataOutputStream os) throws IOException {
   -        ImageIO.write((BufferedImage)loadContent(false), "png", os);
   -    }
   -
   -    @Override
   -    public void cacheReady() {
   -    }
        
        private static void onEDT(Runnable edtAction) {
            if (SwingUtilities.isEventDispatchThread()) {
   @@ -553,12 +499,6 @@
                } else {
                    if (next < System.currentTimeMillis()) {
                        paint();
   -                    try {
   -                        SplashScreen ss = SplashScreen.getSplashScreen();
   -                        if (ss != null) {
   -                            ss.update();
   -                        }
   -                    } catch (IllegalStateException splashAlreadyClosed) {}
                        next = System.currentTimeMillis() + 200;
                    }
                }
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to