diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java index eaf6c37821b1..996c878f212f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java @@ -34,13 +34,11 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.CommonClassNames; -import com.intellij.psi.JavaPsiFacade; -import com.intellij.psi.PsiElementFactory; -import com.intellij.psi.PsiExpression; +import com.intellij.psi.PsiElement; import com.intellij.util.EventDispatcher; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.InternalIterator; -import com.sun.jdi.*; +import com.sun.jdi.Value; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -90,11 +88,7 @@ public class NodeRendererSettings implements PersistentStateComponent { new MapEntryLabelRenderer()/*createLabelRenderer(null, "\" \" + getKey() + \" -> \" + getValue()", null)*/, createEnumerationChildrenRenderer(new String[][]{{"key", "getKey()"}, {"value", "getValue()"}}) ), - createCompoundReferenceRenderer( - "List", CommonClassNames.JAVA_UTIL_LIST, - createLabelRenderer(" size = ", "size()", null), - new ListChildrenRenderer() - ), + new ListObjectRenderer(this), createCompoundReferenceRenderer( "Collection", "java.util.Collection", createLabelRenderer(" size = ", "size()", null), @@ -494,33 +488,25 @@ public class NodeRendererSettings implements PersistentStateComponent { } } - private static class ListChildrenRenderer extends ExpressionChildrenRenderer { - private static final ArrayRenderer ourChildrenRenderer = new ArrayRenderer() { - @Override - public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) { - try { - ArrayElementDescriptorImpl descriptor = (ArrayElementDescriptorImpl)node.getDescriptor(); - PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory(); - return elementFactory.createExpressionFromText("get(" + descriptor.getIndex() + ")", null); - } - catch (IncorrectOperationException e) { - // fallback to original - return super.getChildValueExpression(node, context); - } - } - }; - - public ListChildrenRenderer() { - setChildrenExpression(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "toArray()", "", StdFileTypes.JAVA)); - setChildrenExpandable(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "!isEmpty()", "", StdFileTypes.JAVA)); + private static class ListObjectRenderer extends CompoundReferenceRenderer { + public ListObjectRenderer(NodeRendererSettings rendererSettings) { + super(rendererSettings, + "List", + createLabelRenderer(" size = ", "size()", null), + createExpressionChildrenRenderer("toArray()", "!isEmpty()")); + setClassName(CommonClassNames.JAVA_UTIL_LIST); } @Override - public void buildChildren(Value value, ChildrenBuilder builder, EvaluationContext evaluationContext) { - if (getLastChildrenRenderer(builder.getParentDescriptor()) == null) { - setPreferableChildrenRenderer(builder.getParentDescriptor(), ourChildrenRenderer); + public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException { + LOG.assertTrue(node.getDescriptor() instanceof ArrayElementDescriptorImpl); + try { + return getChildValueExpression("this.get(" + ((ArrayElementDescriptorImpl)node.getDescriptor()).getIndex() + ")", node, context); + } + catch (IncorrectOperationException e) { + // fallback to original + return super.getChildValueExpression(node, context); } - super.buildChildren(value, builder, evaluationContext); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/CompoundReferenceRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/CompoundReferenceRenderer.java index 4cb8a56021f2..76976c36c7d4 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/CompoundReferenceRenderer.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/CompoundReferenceRenderer.java @@ -15,16 +15,24 @@ */ package com.intellij.debugger.ui.tree.render; +import com.intellij.debugger.DebuggerContext; +import com.intellij.debugger.engine.DebugProcess; import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.debugger.settings.NodeRendererSettings; +import com.intellij.debugger.ui.tree.DebuggerTreeNode; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.project.Project; import com.intellij.psi.CommonClassNames; +import com.intellij.psi.JavaPsiFacade; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementFactory; +import com.intellij.psi.search.GlobalSearchScope; import com.sun.jdi.ReferenceType; import com.sun.jdi.Type; import org.jetbrains.annotations.NotNull; public class CompoundReferenceRenderer extends CompoundNodeRenderer{ - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer"); + protected static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer"); public CompoundReferenceRenderer(final NodeRendererSettings rendererSettings, String name, ValueLabelRenderer labelRenderer, ChildrenRenderer childrenRenderer) { super(rendererSettings, name, labelRenderer, childrenRenderer); @@ -109,4 +117,16 @@ public class CompoundReferenceRenderer extends CompoundNodeRenderer{ public @NotNull String getClassName() { return myProperties.getClassName(); } + + protected final PsiElement getContext(Project project, DebuggerContext context) { + DebugProcess process = context.getDebugProcess(); + GlobalSearchScope scope = process != null ? process.getSearchScope() : GlobalSearchScope.allScope(project); + return DebuggerUtils.findClass(getClassName(), project, scope); + } + + protected final PsiElement getChildValueExpression(String text, DebuggerTreeNode node, DebuggerContext context) { + Project project = node.getProject(); + PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory(); + return elementFactory.createExpressionFromText(text, getContext(project, context)); + } } diff --git a/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml b/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml index 9cd23b0df42b..8184735d55cf 100644 --- a/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml +++ b/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml @@ -1,7 +1,7 @@ - testSimple.iml + testSimple_0.iml Unused library Unused library 'JUnit' diff --git a/platform/core-api/src/com/intellij/psi/impl/ElementBase.java b/platform/core-api/src/com/intellij/psi/impl/ElementBase.java index 702411925593..aff2ecf633b2 100644 --- a/platform/core-api/src/com/intellij/psi/impl/ElementBase.java +++ b/platform/core-api/src/com/intellij/psi/impl/ElementBase.java @@ -128,7 +128,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable } @Nullable - private static Icon computeIconNow(PsiElement element, @Iconable.IconFlags int flags) { + private static Icon computeIconNow(@NotNull PsiElement element, @Iconable.IconFlags int flags) { final Icon providersIcon = PsiIconUtil.getProvidersIcon(element, flags); if (providersIcon != null) { return providersIcon instanceof RowIcon ? (RowIcon)providersIcon : createLayeredIcon(element, providersIcon, flags); diff --git a/platform/core-api/src/com/intellij/util/PsiIconUtil.java b/platform/core-api/src/com/intellij/util/PsiIconUtil.java index e46ba964a752..485242b1a955 100644 --- a/platform/core-api/src/com/intellij/util/PsiIconUtil.java +++ b/platform/core-api/src/com/intellij/util/PsiIconUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -24,6 +24,7 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.util.Iconable; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -31,7 +32,7 @@ import javax.swing.*; public class PsiIconUtil { @Nullable - public static Icon getProvidersIcon(PsiElement element, @Iconable.IconFlags int flags) { + public static Icon getProvidersIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) { final boolean dumb = DumbService.getInstance(element.getProject()).isDumb(); for (final IconProvider iconProvider : getIconProviders()) { if (dumb && !DumbService.isDumbAware(iconProvider)) { diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/DaltonizationFilter.java b/platform/editor-ui-api/src/com/intellij/ide/ui/DaltonizationFilter.java new file mode 100644 index 000000000000..ced72d726d5c --- /dev/null +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/DaltonizationFilter.java @@ -0,0 +1,57 @@ +package com.intellij.ide.ui; + +import java.awt.image.ImageFilter; + +final class DaltonizationFilter extends WeightFilter { + public static final ImageFilter protanopia = forProtanopia(null); + public static final ImageFilter deuteranopia = forDeuteranopia(null); + public static final ImageFilter tritanopia = forTritanopia(null); + + public static ImageFilter forProtanopia(Double weight) { + return new DaltonizationFilter(weight, 0, 2.02344, -2.52581, 0, 1, 0, 0, 0, 1); + } + + public static ImageFilter forDeuteranopia(Double weight) { + return new DaltonizationFilter(weight, 1, 0, 0, 0.494207, 0, 1.24827, 0, 0, 1); + } + + public static ImageFilter forTritanopia(Double weight) { + return new DaltonizationFilter(weight, 1, 0, 0, 0, 1, 0, -0.395913, 0.801109, 0); + } + + private final double[] myMatrix; + + private DaltonizationFilter(Double weight, double... matrix) { + super(weight); + myMatrix = matrix; + } + + @Override + int toRGB(int srcR, int srcG, int srcB) { + // RGB to LMS matrix conversion + double L = (17.8824 * srcR) + (43.5161 * srcG) + (4.11935 * srcB); + double M = (3.45565 * srcR) + (27.1554 * srcG) + (3.86714 * srcB); + double S = (0.0299566 * srcR) + (0.184309 * srcG) + (1.46709 * srcB); + // Simulate color blindness + double l = L * myMatrix[0] + M * myMatrix[1] + S * myMatrix[2]; + double m = L * myMatrix[3] + M * myMatrix[4] + S * myMatrix[5]; + double s = L * myMatrix[6] + M * myMatrix[7] + S * myMatrix[8]; + // LMS to RGB matrix conversion + double R = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s); + double G = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s); + double B = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s); + // Isolate invisible colors to color vision deficiency (calculate error matrix) + R = srcR - R; + G = srcG - G; + B = srcB - B; + // Shift colors towards visible spectrum (apply error modifications) + // and add compensation to original values + double dstR = srcR + (0.0 * R) + (0.0 * G) + (0.0 * B); + double dstG = srcG + (0.7 * R) + (1.0 * G) + (0.0 * B); + double dstB = srcB + (0.7 * R) + (0.0 * G) + (1.0 * B); + return toRGB(srcR, srcG, srcB, + dstR < 0 ? 0 : dstR > 255 ? 255 : dstR, + dstR < 0 ? 0 : dstR > 255 ? 255 : dstG, + dstR < 0 ? 0 : dstR > 255 ? 255 : dstB); + } +} diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/SimulationFilter.java b/platform/editor-ui-api/src/com/intellij/ide/ui/SimulationFilter.java new file mode 100644 index 000000000000..86137be69739 --- /dev/null +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/SimulationFilter.java @@ -0,0 +1,101 @@ +package com.intellij.ide.ui; + +import java.awt.image.ImageFilter; + +final class SimulationFilter extends WeightFilter { + public static final ImageFilter protanopia = forProtanopia(null); + public static final ImageFilter deuteranopia = forDeuteranopia(null); + public static final ImageFilter tritanopia = forTritanopia(null); + public static final ImageFilter achromatopsia = forAchromatopsia(null); + + public static ImageFilter forProtanopia(Double weight) { + return new SimulationFilter(weight, 0.7465, 0.2535, 1.273463, -0.073894); + } + + public static ImageFilter forDeuteranopia(Double weight) { + return new SimulationFilter(weight, 1.4, -0.4, 0.968437, 0.003331); + } + + public static ImageFilter forTritanopia(Double weight) { + return new SimulationFilter(weight, 0.1748, 0, 0.062921, 0.292119); + } + + public static ImageFilter forAchromatopsia(Double weight) { + return new WeightFilter(weight) { + @Override + int toRGB(int srcR, int srcG, int srcB) { + double gray = 0.212656 * srcR + 0.715158 * srcG + 0.072186 * srcB; + return toRGB(srcR, srcG, srcB, gray, gray, gray); + } + }; + } + + private final double myConfuseX; + private final double myConfuseY; + private final double myConfuseM; + private final double myConfuseYint; + + private SimulationFilter(Double weight, double x, double y, double m, double yint) { + super(weight); + myConfuseX = x; + myConfuseY = y; + myConfuseM = m; + myConfuseYint = yint; + } + + @Override + int toRGB(int srcR, int srcG, int srcB) { + // Convert source color into XYZ color space + double powR = Math.pow(srcR, 2.2); + double powG = Math.pow(srcG, 2.2); + double powB = Math.pow(srcB, 2.2); + // RGB->XYZ (sRGB:D65) + double X = 0.4124240 * powR + 0.357579 * powG + 0.1804640 * powB; + double Y = 0.2126560 * powR + 0.715158 * powG + 0.0721856 * powB; + double Z = 0.0193324 * powR + 0.119193 * powG + 0.9504440 * powB; + // Convert XYZ into xyY Chromacity Coordinates (xy) and Luminance (Y) + double chroma_x = X / (X + Y + Z); + double chroma_y = Y / (X + Y + Z); + // Generate the "Confusion Line" between the source color and the Confusion Point + double m = (chroma_y - myConfuseY) / (chroma_x - myConfuseX); // slope of Confusion Line + double yint = chroma_y - chroma_x * m; // y-intercept of confusion line (x-intercept = 0.0) + // How far the xy coords deviate from the simulation + double deviate_x = (myConfuseYint - yint) / (m - myConfuseM); + double deviate_y = (m * deviate_x) + yint; + // Compute the simulated color's XYZ coords + X = deviate_x * Y / deviate_y; + Z = (1.0 - (deviate_x + deviate_y)) * Y / deviate_y; + // Neutral grey calculated from luminance (in D65) + double neutral_X = Y * 0.312713 / 0.329016; + double neutral_Z = Y * 0.358271 / 0.329016; + // Difference between simulated color and neutral grey + double diffX = neutral_X - X; + double diffZ = neutral_Z - Z; + // XYZ->RGB (sRGB:D65) + double diffR = +3.2407100 * diffX - 0.4985710 * diffZ; + double diffG = -0.9692580 * diffX + 0.0415557 * diffZ; + double diffB = +0.0556352 * diffX + 1.0570700 * diffZ; + // Convert to RGB color space + // XYZ->RGB (sRGB:D65) + double dstR = +3.2407100 * X - 1.537260 * Y - 0.4985710 * Z; + double dstG = -0.9692580 * X + 1.875990 * Y + 0.0415557 * Z; + double dstB = +0.0556352 * X - 0.203996 * Y + 1.0570700 * Z; + // Compensate simulated color towards a neutral fit in RGB space + double fitR = ((dstR < 0 ? 0 : 1) - dstR) / diffR; + double fitG = ((dstG < 0 ? 0 : 1) - dstG) / diffG; + double fitB = ((dstB < 0 ? 0 : 1) - dstB) / diffB; + double adjust = Math.max(Math.max( // highest value + (fitR < 0 || 1 < fitR) ? 0 : fitR, + (fitG < 0 || 1 < fitG) ? 0 : fitG), + (fitB < 0 || 1 < fitB) ? 0 : fitB); + // Shift proportional to the greatest shift + dstR += adjust * diffR; + dstG += adjust * diffG; + dstB += adjust * diffB; + // Apply gamma correction + dstR = Math.pow(dstR, 1 / 2.2); + dstG = Math.pow(dstG, 1 / 2.2); + dstB = Math.pow(dstB, 1 / 2.2); + return toRGB(srcR, srcG, srcB, dstR, dstG, dstB); + } +} diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java index 0617189a53c8..5f0fb7766179 100644 --- a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java @@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.*; +import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.SimpleModificationTracker; import com.intellij.openapi.util.SystemInfo; @@ -167,6 +168,13 @@ public class UISettings extends SimpleModificationTracker implements PersistentS incModificationCount(); myDispatcher.getMulticaster().uiSettingsChanged(this); ApplicationManager.getApplication().getMessageBus().syncPublisher(UISettingsListener.TOPIC).uiSettingsChanged(this); + IconLoader.setFilter(COLOR_BLINDNESS == ColorBlindness.protanopia + ? DaltonizationFilter.protanopia + : COLOR_BLINDNESS == ColorBlindness.deuteranopia + ? DaltonizationFilter.deuteranopia + : COLOR_BLINDNESS == ColorBlindness.tritanopia + ? DaltonizationFilter.tritanopia + : null); } public void removeUISettingsListener(UISettingsListener listener) { diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/WeightFilter.java b/platform/editor-ui-api/src/com/intellij/ide/ui/WeightFilter.java new file mode 100644 index 000000000000..8e00effef346 --- /dev/null +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/WeightFilter.java @@ -0,0 +1,37 @@ +package com.intellij.ide.ui; + +import java.awt.image.RGBImageFilter; + +abstract class WeightFilter extends RGBImageFilter { + private final Double myWeight; + + WeightFilter(Double weight) { + if (weight != null && (weight < 0 || 1 < weight)) { + throw new IllegalArgumentException("weight " + weight + " out of [0..1]"); + } + myWeight = weight; + canFilterIndexColorModel = true; + } + + @Override + public final int filterRGB(int x, int y, int rgb) { + return (0xFF000000 & rgb) | toRGB(0xFF & (rgb >> 16), 0xFF & (rgb >> 8), 0xFF & rgb); + } + + abstract int toRGB(int srcR, int srcG, int srcB); + + final int toRGB(int srcR, int srcG, int srcB, double dstR, double dstG, double dstB) { + if (Double.isNaN(dstR)) dstR = 0; + if (Double.isNaN(dstG)) dstG = 0; + if (Double.isNaN(dstB)) dstB = 0; + if (myWeight != null) { + dstR = dstR * myWeight + srcR * (1 - myWeight); + dstG = dstG * myWeight + srcG * (1 - myWeight); + dstB = dstB * myWeight + srcB * (1 - myWeight); + } + srcR = (int)dstR; + srcG = (int)dstG; + srcB = (int)dstB; + return (srcR << 16) | (srcG << 8) | srcB; + } +} diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java index fc093b7e5e5d..a0766b7e70ba 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java @@ -605,6 +605,17 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea return OTHER_INDENT_OPTIONS; } + /** + * If the document has an associated PsiFile, returns options for this file. Otherwise attempts to find associated VirtualFile and + * return options for corresponding FileType. If none are found, other indent options are returned. + * + * @param project The project in which PsiFile should be searched. + * @param document The document to search indent options for. + * @return Indent options from the indent options providers or file type indent options or OTHER_INDENT_OPTIONS. + * @see FileIndentOptionsProvider + * @see FileTypeIndentOptionsProvider + * @see LanguageCodeStyleSettingsProvider + */ @NotNull public IndentOptions getIndentOptionsByDocument(@Nullable Project project, @NotNull Document document) { PsiFile file = project != null ? PsiDocumentManager.getInstance(project).getPsiFile(document) : null; diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java index a3b45f166fc3..9619043e859d 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java @@ -130,7 +130,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre }; final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode(treeStructure.getRootElement())); - JTree tree = new JBTreeWithHintProvider(model); + JTree tree = new MyTree(model); tree.setRootVisible(showRootNode); tree.setShowsRootHandles(true); @@ -168,6 +168,17 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } }; } + + private static class MyTree extends JBTreeWithHintProvider implements PlaceProvider { + public MyTree(javax.swing.tree.TreeModel treemodel) { + super(treemodel); + } + + @Override + public String getPlace() { + return ActionPlaces.STRUCTURE_VIEW_TOOLBAR; + } + } public void showToolbar() { setToolbar(createToolbar()); diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 3fc771141d10..5e67fe6cc371 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -1112,7 +1112,7 @@ public class FileStructurePopup implements Disposable, TreeActionsOwner { } } - class FileStructureTree extends JBTreeWithHintProvider implements AlwaysExpandedTree { + class FileStructureTree extends JBTreeWithHintProvider implements AlwaysExpandedTree, PlaceProvider { private final boolean fast; public FileStructureTree(Object rootElement, boolean fastExpand) { @@ -1157,5 +1157,10 @@ public class FileStructurePopup implements Disposable, TreeActionsOwner { //noinspection ConstantConditions return getPsi((FilteringTreeStructure.FilteringNode)((DefaultMutableTreeNode)selectedValue).getUserObject()); } + + @Override + public String getPlace() { + return ActionPlaces.STRUCTURE_VIEW_POPUP; + } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java index 52d50ee38f9d..6d42647ba651 100644 --- a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java @@ -162,7 +162,7 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { @NotNull private final ComboBox myComboBox; - protected SwitchBootJdkDialog(@Nullable Project project, List jdkBundlesList) { + protected SwitchBootJdkDialog(@Nullable Project project, final List jdkBundlesList) { super(project, false); final ArrayList pathsList = JdkUtil.findJdkPaths(); @@ -175,7 +175,9 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { DefaultComboBoxModel model = new DefaultComboBoxModel(); for (JdkBundleDescriptor jdkBundlePath : pathsList) { - if (!jdkBundlesList.isEmpty() && FileUtil.filesEqual(jdkBundlePath.getBundleAsFile(),jdkBundlesList.get(0).getBundleAsFile())) { + if (!(jdkBundlesList.isEmpty() || jdkBundlePath == null) + && FileUtil.filesEqual(jdkBundlePath.getBundleAsFile(),jdkBundlesList.get(0).getBundleAsFile())) + { continue; } model.addElement(jdkBundlePath); @@ -185,8 +187,20 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { myComboBox.setRenderer(new ListCellRendererWrapper() { @Override public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) { - JdkBundleDescriptor jdkBundleDescriptor = ((JdkBundleDescriptor)value); - setText(jdkBundleDescriptor.getVisualRepresentation()); + if (value != null) { + JdkBundleDescriptor jdkBundleDescriptor = ((JdkBundleDescriptor)value); + setText(jdkBundleDescriptor.getVisualRepresentation()); + } else { + LOG.error("Null value has been passed to a cell renderer. Available JDKs count: " + pathsList.size()); + StringBuilder jdkNames = new StringBuilder(); + for (JdkBundleDescriptor jdkBundlePath : pathsList) { + if (!jdkBundlesList.isEmpty()) { + continue; + } + jdkNames.append(jdkBundlePath.getVisualRepresentation()).append("; "); + } + LOG.error("Available JDKs names: " + jdkNames.toString()); + } } }); diff --git a/platform/lang-impl/src/com/intellij/ui/JBTreeWithHintProvider.java b/platform/lang-impl/src/com/intellij/ui/JBTreeWithHintProvider.java index 023ed3998829..d3a823d63b01 100644 --- a/platform/lang-impl/src/com/intellij/ui/JBTreeWithHintProvider.java +++ b/platform/lang-impl/src/com/intellij/ui/JBTreeWithHintProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -18,10 +18,8 @@ package com.intellij.ui; import com.intellij.ide.DataManager; import com.intellij.ide.dnd.aware.DnDAwareTree; import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.psi.PsiElement; import com.intellij.ui.popup.HintUpdateSupply; -import com.intellij.util.ObjectUtils; import org.jetbrains.annotations.Nullable; import javax.swing.tree.TreeModel; @@ -30,7 +28,7 @@ import javax.swing.tree.TreeNode; /** * @author Konstantin Bulenkov * @deprecated - * @see com.intellij.ui.popup.HintUpdateSupply + * @see HintUpdateSupply */ public class JBTreeWithHintProvider extends DnDAwareTree { { @@ -57,19 +55,4 @@ public class JBTreeWithHintProvider extends DnDAwareTree { protected PsiElement getPsiElementForHint(final Object selectedValue) { return CommonDataKeys.PSI_ELEMENT.getData(DataManager.getInstance().getDataContext(this)); } - - @Deprecated - public void registerHint(JBPopup hint) { - ObjectUtils.assertNotNull(HintUpdateSupply.getSupply(this)).registerHint(hint); - } - - @Deprecated - public void hideHint() { - ObjectUtils.assertNotNull(HintUpdateSupply.getSupply(this)).hideHint(); - } - - @Deprecated - public void updateHint(PsiElement element) { - ObjectUtils.assertNotNull(HintUpdateSupply.getSupply(this)).updateHint(element); - } } diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index bcec64bb14af..a84317dc5f3b 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -1433,8 +1433,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui { } } }; - ImageProducer prod = new FilteredImageSource(image.getSource(), filter); - return Toolkit.getDefaultToolkit().createImage(prod); + return ImageUtil.filter(image, filter); } @Override diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml index b6d950475c56..e6681e5a1f4e 100644 --- a/platform/platform-resources/src/DefaultColorSchemesManager.xml +++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml @@ -1705,12 +1705,6 @@ - - - - - - - - - - - - - -