mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
<help file="ideahelp.jar" root="idea"/>
|
||||
<documentation url="http://www.jetbrains.com/idea/documentation"/>
|
||||
<support url="http://www.jetbrains.com/support/idea/index.html"/>
|
||||
<feedback eap-url="http://youtrack.jetbrains.net" release-url="http://www.jetbrains.com/feedback/feedback.jsp?product=IDEA&build=$BUILD&timezone=$TIMEZONE&eval=$EVAL"/>
|
||||
<feedback eap-url="http://youtrack.jetbrains.net"
|
||||
release-url="http://www.jetbrains.com/feedback/feedback.jsp?product=IDEA&build=$BUILD&timezone=$TIMEZONE&eval=$EVAL"/>
|
||||
<plugins url="http://plugins.intellij.net"/>
|
||||
<whatsnew url="http://www.jetbrains.com/idea/whatsnew/index.html"/>
|
||||
<keymap win="http://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf"
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
@@ -26,6 +22,9 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class Bootstrap {
|
||||
private static final String PLUGIN_MANAGER = "com.intellij.ide.plugins.PluginManager";
|
||||
|
||||
@@ -35,16 +34,17 @@ public class Bootstrap {
|
||||
main(args, mainClass, methodName, new ArrayList<URL>());
|
||||
}
|
||||
|
||||
public static void main(final String[] args, final String mainClass, final String methodName, List<URL> classpathElements) {
|
||||
UrlClassLoader newClassLoader = ClassloaderUtil.initClassloader(classpathElements);
|
||||
public static void main(final String[] args, final String mainClass, final String methodName, final List<URL> classpathElements) {
|
||||
final UrlClassLoader newClassLoader = ClassloaderUtil.initClassloader(classpathElements);
|
||||
try {
|
||||
final Class klass = Class.forName(PLUGIN_MANAGER, true, newClassLoader);
|
||||
final Class<?> klass = Class.forName(PLUGIN_MANAGER, true, newClassLoader);
|
||||
|
||||
final Method startMethod = klass.getDeclaredMethod("start", String.class, String.class, String[].class);
|
||||
startMethod.setAccessible(true);
|
||||
startMethod.invoke(null, mainClass, methodName, args);
|
||||
}
|
||||
catch (Exception e) {
|
||||
//noinspection UseOfSystemOutOrSystemErr
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-7
@@ -25,17 +25,18 @@ import org.jetbrains.annotations.NonNls;
|
||||
* @author nik
|
||||
*/
|
||||
public class ApplicationNamesInfo {
|
||||
@NonNls
|
||||
private static final String COMPONENT_NAME = "ApplicationInfo";
|
||||
@NonNls private static final String COMPONENT_NAME = "ApplicationInfo";
|
||||
@NonNls private static final String ELEMENT_NAMES = "names";
|
||||
@NonNls private static final String ATTRIBUTE_PRODUCT = "product";
|
||||
@NonNls private static final String ATTRIBUTE_FULL_NAME = "fullname";
|
||||
|
||||
private String myProductName;
|
||||
private String myFullProductName;
|
||||
private String myLowercaseProductName;
|
||||
@NonNls private static final String ELEMENT_NAMES = "names";
|
||||
@NonNls private static final String ATTRIBUTE_PRODUCT = "product";
|
||||
@NonNls private static final String ATTRIBUTE_FULLNAME = "fullname";
|
||||
|
||||
private static class ApplicationNamesInfoHolder {
|
||||
private static final ApplicationNamesInfo ourInstance = new ApplicationNamesInfo();
|
||||
private ApplicationNamesInfoHolder() { }
|
||||
}
|
||||
|
||||
public static ApplicationNamesInfo getInstance() {
|
||||
@@ -45,10 +46,11 @@ public class ApplicationNamesInfo {
|
||||
private ApplicationNamesInfo() {
|
||||
try {
|
||||
//noinspection HardCodedStringLiteral
|
||||
Document doc = JDOMUtil.loadDocument(ApplicationNamesInfo.class.getResourceAsStream("/idea/" + getComponentName() + ".xml"));
|
||||
final Document doc = JDOMUtil.loadDocument(ApplicationNamesInfo.class.getResourceAsStream("/idea/" + getComponentName() + ".xml"));
|
||||
readInfo(doc.getRootElement());
|
||||
}
|
||||
catch (Exception e) {
|
||||
//noinspection CallToPrintStackTrace
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +58,7 @@ public class ApplicationNamesInfo {
|
||||
private void readInfo(final Element rootElement) {
|
||||
final Element names = rootElement.getChild(ELEMENT_NAMES);
|
||||
myProductName = names.getAttributeValue(ATTRIBUTE_PRODUCT);
|
||||
myFullProductName = names.getAttributeValue(ATTRIBUTE_FULLNAME);
|
||||
myFullProductName = names.getAttributeValue(ATTRIBUTE_FULL_NAME);
|
||||
myLowercaseProductName = StringUtil.capitalize(myProductName.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
+14
-26
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
@@ -35,10 +34,8 @@ import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExternalizable, ApplicationComponent {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.ApplicationInfoImpl");
|
||||
|
||||
@NonNls private static final String BUILD_STUB = "__BUILD_NUMBER__";
|
||||
private String myCodeName = null;
|
||||
private String myMajorVersion = null;
|
||||
private String myMinorVersion = null;
|
||||
@@ -47,7 +44,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
private Color myLogoTextColor = new Color(0, 35, 135); // idea blue
|
||||
private Color myProgressColor = null;
|
||||
private int myProgressY = 350;
|
||||
private int myProgressHeight = 2;
|
||||
private String myAboutLogoUrl = null;
|
||||
@NonNls private String myIconUrl = "/icon.png";
|
||||
@NonNls private String mySmallIconUrl = "/icon_small.png";
|
||||
@@ -91,7 +87,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
@NonNls private static final String ATTRIBUTE_TEXTCOLOR = "textcolor";
|
||||
@NonNls private static final String ATTRIBUTE_PROGRESS_COLOR = "progressColor";
|
||||
@NonNls private static final String ATTRIBUTE_PROGRESS_Y = "progressY";
|
||||
@NonNls private static final String ATTRIBUTE_PROGRESS_HEIGHT = "progressHeight";
|
||||
@NonNls private static final String ELEMENT_ABOUT = "about";
|
||||
@NonNls private static final String ELEMENT_ICON = "icon";
|
||||
@NonNls private static final String ATTRIBUTE_SIZE32 = "size32";
|
||||
@@ -125,12 +120,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
@NonNls private static final String ELEMENT_KEYMAP = "keymap";
|
||||
@NonNls private static final String ATTRIBUTE_WINDOWS_URL = "win";
|
||||
@NonNls private static final String ATTRIBUTE_MAC_URL = "mac";
|
||||
private static final String DEFAULT_PLUGINS_HOST = "http://plugins.intellij.net";
|
||||
@NonNls private static final String DEFAULT_PLUGINS_HOST = "http://plugins.intellij.net";
|
||||
|
||||
public void initComponent() { }
|
||||
|
||||
public void disposeComponent() {
|
||||
}
|
||||
public void disposeComponent() { }
|
||||
|
||||
public Calendar getBuildDate() {
|
||||
return myBuildDate;
|
||||
@@ -187,10 +181,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
return myProgressY;
|
||||
}
|
||||
|
||||
public int getProgressHeight() {
|
||||
return myProgressHeight;
|
||||
}
|
||||
|
||||
public String getAboutLogoUrl() {
|
||||
return myAboutLogoUrl;
|
||||
}
|
||||
@@ -336,14 +326,17 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
String dateString = buildElement.getAttributeValue(ATTRIBUTE_DATE);
|
||||
if (dateString.equals("__BUILD_DATE__")) {
|
||||
myBuildDate = new GregorianCalendar();
|
||||
final JarFile bootJar;
|
||||
try {
|
||||
bootJar = new JarFile(PathManager.getHomePath() + File.separator + "lib" + File.separator + "boot.jar");
|
||||
final JarEntry jarEntry = bootJar.entries().nextElement(); // /META-INF is always updated on build
|
||||
myBuildDate.setTime(new Date(jarEntry.getTime()));
|
||||
bootJar.close();
|
||||
} catch (Exception e) {//
|
||||
final JarFile bootJar = new JarFile(PathManager.getHomePath() + File.separator + "lib" + File.separator + "boot.jar");
|
||||
try {
|
||||
final JarEntry jarEntry = bootJar.entries().nextElement(); // /META-INF is always updated on build
|
||||
myBuildDate.setTime(new Date(jarEntry.getTime()));
|
||||
}
|
||||
finally {
|
||||
bootJar.close();
|
||||
}
|
||||
}
|
||||
catch (Exception ignore) { }
|
||||
}
|
||||
else {
|
||||
myBuildDate = parseDate(dateString);
|
||||
@@ -370,10 +363,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
if (v != null) {
|
||||
myProgressY = Integer.parseInt(v);
|
||||
}
|
||||
v = logoElement.getAttributeValue(ATTRIBUTE_PROGRESS_HEIGHT);
|
||||
if (v != null) {
|
||||
myProgressHeight = Integer.parseInt(v);
|
||||
}
|
||||
}
|
||||
|
||||
Element aboutLogoElement = parentNode.getChild(ELEMENT_ABOUT);
|
||||
@@ -498,14 +487,13 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
return new GregorianCalendar(year, month, day);
|
||||
}
|
||||
|
||||
public List<PluginChooserPage> getPluginChooserPages() {
|
||||
return myPluginChooserPages;
|
||||
}
|
||||
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
throw new WriteExternalException();
|
||||
}
|
||||
|
||||
public List<PluginChooserPage> getPluginChooserPages() {
|
||||
return myPluginChooserPages;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
|
||||
@@ -37,18 +37,20 @@ public final class IconLoader {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.IconLoader");
|
||||
private static final Color ourTransparentColor = new Color(0, 0, 0, 0);
|
||||
|
||||
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||
private static final ConcurrentHashMap<URL, Icon> ourIconsCache = new ConcurrentHashMap<URL, Icon>(100, 0.9f,2);
|
||||
|
||||
|
||||
/**
|
||||
* This cache contains mapping between icons and disabled icons.
|
||||
*/
|
||||
private static final Map<Icon, Icon> ourIcon2DisabledIcon = new WeakHashMap<Icon, Icon>(200);
|
||||
|
||||
/**
|
||||
* To get disabled icon with paint it into the imag. Some icons require
|
||||
* To get disabled icon with paint it into the image. Some icons require
|
||||
* not null component to paint.
|
||||
*/
|
||||
private static final JComponent ourFakeComponent = new JLabel();
|
||||
|
||||
private static final ImageIcon EMPTY_ICON = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR)) {
|
||||
@NonNls
|
||||
public String toString() {
|
||||
@@ -58,8 +60,7 @@ public final class IconLoader {
|
||||
|
||||
private static boolean ourIsActivated = false;
|
||||
|
||||
private IconLoader() {
|
||||
}
|
||||
private IconLoader() { }
|
||||
|
||||
@Deprecated
|
||||
public static Icon getIcon(@NotNull final Image image) {
|
||||
@@ -79,7 +80,6 @@ public final class IconLoader {
|
||||
return getIcon(path, callerClass);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
/**
|
||||
* Might return null if icon was not found.
|
||||
@@ -114,11 +114,11 @@ public final class IconLoader {
|
||||
return !ourIsActivated;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
/**
|
||||
* Might return null if icon was not found.
|
||||
* Use only if you expected null return value, otherwise see {@link IconLoader#getIcon(java.lang.String, java.lang.Class)}
|
||||
*/
|
||||
@Nullable
|
||||
public static Icon findIcon(@NotNull final String path, @NotNull final Class aClass) {
|
||||
return findIcon(path, aClass, false);
|
||||
}
|
||||
@@ -131,7 +131,6 @@ public final class IconLoader {
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -160,13 +159,17 @@ public final class IconLoader {
|
||||
}
|
||||
|
||||
final Icon icon = getIcon(image);
|
||||
if (icon != null && !ImageLoader.isGoodSize(icon)) {
|
||||
if (icon != null && !isGoodSize(icon)) {
|
||||
LOG.error("Invalid icon: " + url); // # 22481
|
||||
return EMPTY_ICON;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static boolean isGoodSize(@NotNull final Icon icon) {
|
||||
return icon.getIconWidth() > 0 && icon.getIconHeight() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (creates if necessary) disabled icon based on the passed one.
|
||||
*
|
||||
@@ -180,7 +183,7 @@ public final class IconLoader {
|
||||
}
|
||||
Icon disabledIcon = ourIcon2DisabledIcon.get(icon);
|
||||
if (disabledIcon == null) {
|
||||
if (!ImageLoader.isGoodSize(icon)) {
|
||||
if (!isGoodSize(icon)) {
|
||||
LOG.error(icon); // # 22481
|
||||
return EMPTY_ICON;
|
||||
}
|
||||
@@ -256,7 +259,6 @@ public final class IconLoader {
|
||||
return icon != null ? icon : EMPTY_ICON;
|
||||
}
|
||||
|
||||
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
getRealIcon().paintIcon(c, g, x, y);
|
||||
}
|
||||
@@ -281,7 +283,6 @@ public final class IconLoader {
|
||||
}
|
||||
|
||||
public abstract static class LazyIcon implements Icon {
|
||||
|
||||
private boolean myWasComputed;
|
||||
private Icon myIcon;
|
||||
|
||||
@@ -305,7 +306,6 @@ public final class IconLoader {
|
||||
return icon != null ? icon.getIconHeight() : 0;
|
||||
}
|
||||
|
||||
|
||||
protected synchronized final Icon getOrComputeIcon() {
|
||||
if (!myWasComputed) {
|
||||
myWasComputed = true;
|
||||
@@ -320,7 +320,6 @@ public final class IconLoader {
|
||||
}
|
||||
|
||||
protected abstract Icon compute();
|
||||
|
||||
}
|
||||
|
||||
private static class ByClass extends LazyIcon {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -105,7 +106,7 @@ public class ImageLoader implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isGoodSize(Icon icon) {
|
||||
return icon.getIconWidth() > 0 && icon.getIconHeight() > 0;
|
||||
public static boolean isGoodSize(final Icon icon) {
|
||||
return IconLoader.isGoodSize(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,16 +1626,14 @@ public class UIUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void initDefaultLAF(String productName) {
|
||||
public static void initDefaultLAF(final String productName) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
}
|
||||
catch (Exception ignored) { }
|
||||
}
|
||||
|
||||
public static void addKeyboardShortcut(final JComponent target,
|
||||
final AbstractButton button, final KeyStroke keyStroke) {
|
||||
public static void addKeyboardShortcut(final JComponent target, final AbstractButton button, final KeyStroke keyStroke) {
|
||||
target.registerKeyboardAction(
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user