Пример #1
0
 /**
  * @return default LookAndFeelInfo for the running OS. For Win32 and Linux the method returns
  *     Alloy LAF or IDEA LAF if first not found, for Mac OS X it returns Aqua RubyMine uses Native
  *     L&F for linux as well
  */
 private UIManager.LookAndFeelInfo getDefaultLaf() {
   if (WelcomeWizardUtil.getWizardLAF() != null) {
     UIManager.LookAndFeelInfo laf = findLaf(WelcomeWizardUtil.getWizardLAF());
     LOG.assertTrue(laf != null);
     return laf;
   }
   final String systemLafClassName = UIManager.getSystemLookAndFeelClassName();
   if (SystemInfo.isMac) {
     UIManager.LookAndFeelInfo laf =
         findLaf(
             Registry.is("ide.mac.yosemite.laf")
                 ? IntelliJLaf.class.getName()
                 : systemLafClassName);
     LOG.assertTrue(laf != null);
     return laf;
   }
   if (PlatformUtils.isRubyMine() || PlatformUtils.isPyCharm()) {
     final String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
     if ("gnome".equals(desktop)) {
       UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName);
       if (laf != null) {
         return laf;
       }
       LOG.info("Could not find system look and feel: " + systemLafClassName);
     }
   }
   // Default
   final String defaultLafName = WelcomeWizardUtil.getDefaultLAF();
   if (defaultLafName != null) {
     UIManager.LookAndFeelInfo defaultLaf = findLaf(defaultLafName);
     if (defaultLaf != null) {
       return defaultLaf;
     }
   }
   UIManager.LookAndFeelInfo ideaLaf =
       findLaf(
           isIntelliJLafEnabled() ? IntelliJLaf.class.getName() : IdeaLookAndFeelInfo.CLASS_NAME);
   if (ideaLaf != null) {
     return ideaLaf;
   }
   throw new IllegalStateException("No default look&feel found");
 }
Пример #2
0
  @Override
  public void initComponent() {
    if (myCurrentLaf != null) {
      final UIManager.LookAndFeelInfo laf = findLaf(myCurrentLaf.getClassName());
      if (laf != null) {
        boolean needUninstall = UIUtil.isUnderDarcula();
        setCurrentLookAndFeel(laf); // setup default LAF or one specified by readExternal.
        if (WelcomeWizardUtil.getWizardLAF() != null) {
          if (UIUtil.isUnderDarcula()) {
            DarculaInstaller.install();
          } else if (needUninstall) {
            DarculaInstaller.uninstall();
          }
        }
      }
    }

    updateUI();

    if (SystemInfo.isXWindow) {
      myThemeChangeListener =
          new PropertyChangeListener() {
            @Override
            public void propertyChange(final PropertyChangeEvent evt) {
              //noinspection SSBasedInspection
              SwingUtilities.invokeLater(
                  new Runnable() {
                    @Override
                    public void run() {
                      fixGtkPopupStyle();
                      patchGtkDefaults(UIManager.getLookAndFeelDefaults());
                    }
                  });
            }
          };
      Toolkit.getDefaultToolkit()
          .addPropertyChangeListener(GNOME_THEME_PROPERTY_NAME, myThemeChangeListener);
    }
  }