Skip to content

Commit

Permalink
Cleanup (drops outdated L&F check; formatting)
Browse files Browse the repository at this point in the history
  • Loading branch information
trespasserw committed Apr 10, 2017
1 parent 31b766d commit 79398f4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 73 deletions.
13 changes: 5 additions & 8 deletions platform/platform-api/src/com/intellij/ide/ui/LafManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,28 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.intellij.ide.ui;

import com.intellij.openapi.application.ApplicationManager;

import javax.swing.*;

/**
* User: anna
* Date: 17-May-2006
* @author anna
* @since 17-May-2006
*/
public abstract class LafManager {
public static LafManager getInstance(){
public static LafManager getInstance() {
return ApplicationManager.getApplication().getComponent(LafManager.class);
}

public abstract UIManager.LookAndFeelInfo[] getInstalledLookAndFeels();

public abstract UIManager.LookAndFeelInfo getCurrentLookAndFeel();

public abstract boolean checkLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo);

public abstract void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo);

public abstract void updateUI();
Expand All @@ -44,4 +41,4 @@ public static LafManager getInstance(){
public abstract void addLafManagerListener(LafManagerListener l);

public abstract void removeLafManagerListener(LafManagerListener l);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,11 @@ public void apply() {
settings.setShowIconInQuickNavigation(myComponent.myHideIconsInQuickNavigation.isSelected());

if (!Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), lafManager.getCurrentLookAndFeel())) {
final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem();
if (lafManager.checkLookAndFeel(lafInfo)) {
update = true;
shouldUpdateUI = false;
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> QuickChangeLookAndFeel.switchLafAndUpdateUI(lafManager, lafInfo));
}
UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem();
update = true;
shouldUpdateUI = false;
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> QuickChangeLookAndFeel.switchLafAndUpdateUI(lafManager, lafInfo));
}

if (shouldUpdateUI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,28 @@
import javax.swing.*;

public class HeadlessLafManagerImpl extends LafManager {
@Override
public UIManager.LookAndFeelInfo[] getInstalledLookAndFeels() {
return new UIManager.LookAndFeelInfo[0];
}

@Override
public UIManager.LookAndFeelInfo getCurrentLookAndFeel() {
return null;
}

public boolean checkLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
return true;
}
@Override
public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) { }

public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
}
@Override
public void updateUI() { }

public void updateUI() {
}
@Override
public void repaintUI() { }

public void repaintUI() {
}
@Override
public void addLafManagerListener(LafManagerListener l) { }

public void addLafManagerListener(LafManagerListener l) {
}

public void removeLafManagerListener(LafManagerListener l) {
}
}
@Override
public void removeLafManagerListener(LafManagerListener l) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
import com.intellij.ide.ui.laf.darcula.DarculaLaf;
import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
Expand Down Expand Up @@ -119,9 +115,8 @@ public final class LafManagerImpl extends LafManager implements PersistentStateC
private final UIManager.LookAndFeelInfo[] myLaFs;
private UIManager.LookAndFeelInfo myCurrentLaf;
private final Map<UIManager.LookAndFeelInfo, HashMap<String, Object>> myStoredDefaults = ContainerUtil.newHashMap();
private String myLastWarning = null;
private static final Map<String, String> ourLafClassesAliases = ContainerUtil.newHashMap();

private static final Map<String, String> ourLafClassesAliases = ContainerUtil.newHashMap();
static {
ourLafClassesAliases.put("idea.dark.laf.classname", DarculaLookAndFeelInfo.CLASS_NAME);
}
Expand Down Expand Up @@ -407,8 +402,6 @@ else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName()
}
}
myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo);

checkLookAndFeel(lookAndFeelInfo, false);
}

public void setLookAndFeelAfterRestart(UIManager.LookAndFeelInfo lookAndFeelInfo) {
Expand Down Expand Up @@ -445,39 +438,6 @@ private static Icon getAquaMenuInvertedIcon() {
return null;
}

@Override
public boolean checkLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
return checkLookAndFeel(lookAndFeelInfo, true);
}

private boolean checkLookAndFeel(final UIManager.LookAndFeelInfo lafInfo, final boolean confirm) {
String message = null;

if (lafInfo.getName().contains("GTK") && SystemInfo.isXWindow && !SystemInfo.isJavaVersionAtLeast("1.6.0_12")) {
message = IdeBundle.message("warning.problem.laf.1");
}

if (message != null) {
if (confirm) {
final String[] options = {IdeBundle.message("confirm.set.look.and.feel"), CommonBundle.getCancelButtonText()};
final int result = Messages.showOkCancelDialog(message, CommonBundle.getWarningTitle(), options[0], options[1], Messages.getWarningIcon());
if (result == Messages.OK) {
myLastWarning = message;
return true;
}
return false;
}

if (!message.equals(myLastWarning)) {
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "L&F Manager", message, NotificationType.WARNING,
NotificationListener.URL_OPENING_LISTENER));
myLastWarning = message;
}
}

return true;
}

/**
* Updates LAF of all windows. The method also updates font of components
* as it's configured in <code>UISettings</code>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,7 @@ checkbox.use.lcd.rendered.font.in.editor=LCD rendering
idea.default.look.and.feel=IDEA (4.5 default)
idea.intellij.look.and.feel=IntelliJ
idea.dark.look.and.feel=Darcula
confirm.set.look.and.feel=Change &theme
error.cannot.set.look.and.feel=<html><body>Cannot set {0} theme:<br>{1}</body></html>
warning.problem.laf.1=<html><body>GTK+ theme is known to be problematic on a JDK prior to 1.6 b12.<br>Please choose another theme, or upgrade your JDK. <a href="http://bugs.sun.com/view_bug.do?bug_id=6624717">More info...</a></body></html>
error.adding.action.without.icon.to.toolbar=You are adding an action without icon to the toolbar. The default icon will be added to this action.
title.unable.to.add.action.without.icon.to.toolbar=Unable to Add Action Without Icon to the Toolbar
error.please.specify.new.name.for.schema=Please, specify new name for scheme ''{0}''.
Expand Down

0 comments on commit 79398f4

Please sign in to comment.