mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
More consistent WM_CLASS setting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -17,10 +17,12 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -40,10 +42,11 @@ public class AppUIUtil {
|
||||
frame.setIconImages(getAppIconImages());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UnnecessaryFullyQualifiedName", "deprecation"})
|
||||
public static List<Image> getAppIconImages() {
|
||||
final List<Image> images = new ArrayList<Image>();
|
||||
images.add(ImageLoader.loadFromResource(ApplicationInfoImpl.getShadowInstance().getIconUrl()));
|
||||
images.add(ImageLoader.loadFromResource(ApplicationInfoImpl.getShadowInstance().getSmallIconUrl()));
|
||||
images.add(com.intellij.util.ImageLoader.loadFromResource(ApplicationInfoImpl.getShadowInstance().getIconUrl()));
|
||||
images.add(com.intellij.util.ImageLoader.loadFromResource(ApplicationInfoImpl.getShadowInstance().getSmallIconUrl()));
|
||||
return images;
|
||||
}
|
||||
|
||||
@@ -66,16 +69,22 @@ public class AppUIUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateFrameClass(final String productName) {
|
||||
public static void updateFrameClass() {
|
||||
try {
|
||||
final Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
final Class<? extends Toolkit> aClass = toolkit.getClass();
|
||||
if ("sun.awt.X11.XToolkit".equals(aClass.getName())) {
|
||||
final Field awtAppClassName = aClass.getDeclaredField("awtAppClassName");
|
||||
awtAppClassName.setAccessible(true);
|
||||
awtAppClassName.set(toolkit, productName);
|
||||
awtAppClassName.set(toolkit, getFrameClass());
|
||||
}
|
||||
}
|
||||
catch (Exception ignore) { }
|
||||
}
|
||||
|
||||
public static String getFrameClass() {
|
||||
final String name = ApplicationNamesInfo.getInstance().getProductName();
|
||||
final String wmClass = StringUtil.replaceChar(name.toLowerCase(), ' ', '-');
|
||||
return PlatformUtils.isCommunity() ? wmClass + "-ce" : wmClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -42,10 +42,7 @@ public class MainImpl {
|
||||
|
||||
StartupUtil.isHeadless = Main.isHeadless(args);
|
||||
if (!StartupUtil.isHeadless) {
|
||||
String name = ApplicationNamesInfo.getInstance().getFullProductName();
|
||||
if (name.toUpperCase().contains("IDEA")) name += " CE";
|
||||
AppUIUtil.updateFrameClass(name);
|
||||
|
||||
AppUIUtil.updateFrameClass();
|
||||
AppUIUtil.updateFrameIcon(JOptionPane.getRootFrame());
|
||||
|
||||
final boolean isNewConfigFolder = PathManager.ensureConfigFolderExists(true);
|
||||
|
||||
Reference in New Issue
Block a user