This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 3f5ea2b [NETBEANS-1402] Added nb.laf.norestart system property to
prevent restart on LaF changes
3f5ea2b is described below
commit 3f5ea2b646bb17dfcd34eb7061dcf067da9f89a8
Author: Laszlo Kishalmi <[email protected]>
AuthorDate: Sat Feb 9 20:29:11 2019 -0800
[NETBEANS-1402] Added nb.laf.norestart system property to prevent restart
on LaF changes
---
.../src/org/netbeans/core/windows/options/LafPanel.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git
a/platform/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
b/platform/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
index abf2d21..91e1b10 100644
--- a/platform/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
+++ b/platform/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
@@ -39,6 +39,7 @@ import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
+import javax.swing.UnsupportedLookAndFeelException;
import org.netbeans.api.options.OptionsDisplayer;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.LifecycleManager;
@@ -48,6 +49,7 @@ import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
+import org.openide.windows.WindowManager;
@OptionsPanelController.Keywords(keywords={"#KW_LafOptions"},
location="Appearance", tabTitle="#Laf_DisplayName")
public class LafPanel extends javax.swing.JPanel {
@@ -57,7 +59,7 @@ public class LafPanel extends javax.swing.JPanel {
private final Preferences prefs = NbPreferences.forModule(LafPanel.class);
private final boolean isAquaLaF =
"Aqua".equals(UIManager.getLookAndFeel().getID()); //NOI18N
-
+ private static final boolean NO_RESTART_ON_LAF_CHANGE =
Boolean.getBoolean("nb.laf.norestart"); //NOI18N
private int defaultLookAndFeelIndex;
private final ArrayList<LookAndFeelInfo> lafs = new
ArrayList<LookAndFeelInfo>( 10 );
@@ -73,6 +75,7 @@ public class LafPanel extends javax.swing.JPanel {
}
});
initLookAndFeel();
+ lblRestart.setVisible(!NO_RESTART_ON_LAF_CHANGE);
DefaultComboBoxModel model = new DefaultComboBoxModel();
for( LookAndFeelInfo li : lafs ) {
model.addElement( li.getName() );
@@ -165,7 +168,17 @@ public class LafPanel extends javax.swing.JPanel {
if( selLaFIndex != defaultLookAndFeelIndex && !isForcedLaF() ) {
LookAndFeelInfo li = lafs.get( comboLaf.getSelectedIndex() );
NbPreferences.root().node( "laf" ).put( "laf", li.getClassName()
); //NOI18N
- askForRestart();
+ if (NO_RESTART_ON_LAF_CHANGE) {
+ try {
+ UIManager.setLookAndFeel(li.getClassName());
+ WindowManager wmgr =
Lookup.getDefault().lookup(WindowManager.class);
+ wmgr.updateUI();
+ } catch (ClassNotFoundException | IllegalAccessException |
InstantiationException | UnsupportedLookAndFeelException ex) {
+ askForRestart();
+ }
+ } else {
+ askForRestart();
+ }
}
return false;
---------------------------------------------------------------------
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