diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/PublicConstructorInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/PublicConstructorInspection.java index 1a9874338ba1..ffdddabcd865 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/PublicConstructorInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/PublicConstructorInspection.java @@ -115,7 +115,7 @@ public class PublicConstructorInspection extends BaseInspection { @Override public void visitClass(PsiClass aClass) { super.visitClass(aClass); - if (!aClass.hasModifierProperty(PsiModifier.PUBLIC)) { + if (aClass.isInterface() || !aClass.hasModifierProperty(PsiModifier.PUBLIC)) { return; } final PsiMethod[] constructors = aClass.getConstructors(); diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java index 65e53924eb9a..1893ff6e5add 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2011 Dave Griffith, Bas Leijdekkers + * Copyright 2006-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ import com.intellij.codeInspection.reference.RefClass; import com.intellij.codeInspection.reference.RefEntity; import com.intellij.codeInspection.reference.RefModule; import com.intellij.codeInspection.ui.SingleIntegerFieldOptionsPanel; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleManager; +import com.intellij.openapi.project.Project; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseGlobalInspection; import org.jetbrains.annotations.NotNull; @@ -39,17 +42,13 @@ public class ModuleWithTooFewClassesInspection extends BaseGlobalInspection { @NotNull @Override public String getDisplayName() { - return InspectionGadgetsBundle.message( - "module.with.too.few.classes.display.name"); + return InspectionGadgetsBundle.message("module.with.too.few.classes.display.name"); } @Override @Nullable - public CommonProblemDescriptor[] checkElement( - RefEntity refEntity, - AnalysisScope analysisScope, - InspectionManager inspectionManager, - GlobalInspectionContext globalInspectionContext) { + public CommonProblemDescriptor[] checkElement(RefEntity refEntity, AnalysisScope analysisScope, InspectionManager inspectionManager, + GlobalInspectionContext globalInspectionContext) { if (!(refEntity instanceof RefModule)) { return null; } @@ -67,10 +66,13 @@ public class ModuleWithTooFewClassesInspection extends BaseGlobalInspection { if (numClasses >= limit || numClasses == 0) { return null; } - final String errorString = InspectionGadgetsBundle.message( - "module.with.too.few.classes.problem.descriptor", - refModule.getName(), Integer.valueOf(numClasses), - Integer.valueOf(limit)); + final Project project = globalInspectionContext.getProject(); + final Module[] modules = ModuleManager.getInstance(project).getModules(); + if (modules.length == 1) { + return null; + } + final String errorString = InspectionGadgetsBundle.message("module.with.too.few.classes.problem.descriptor", + refModule.getName(), Integer.valueOf(numClasses), Integer.valueOf(limit)); return new CommonProblemDescriptor[]{ inspectionManager.createProblemDescriptor(errorString) }; @@ -78,9 +80,6 @@ public class ModuleWithTooFewClassesInspection extends BaseGlobalInspection { @Override public JComponent createOptionsPanel() { - return new SingleIntegerFieldOptionsPanel( - InspectionGadgetsBundle.message( - "module.with.too.few.classes.min.option"), - this, "limit"); + return new SingleIntegerFieldOptionsPanel(InspectionGadgetsBundle.message("module.with.too.few.classes.min.option"), this, "limit"); } } \ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicInterface.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicInterface.java new file mode 100644 index 000000000000..7eafa56b735c --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicInterface.java @@ -0,0 +1,3 @@ +package com.siyeh.igtest.classlayout.public_constructor; + +public interface PublicInterface {} \ No newline at end of file diff --git a/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java b/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java index 2b129714da06..6f0cfe5e6530 100644 --- a/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java +++ b/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java @@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Iconable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; +import com.intellij.ui.ColorUtil; import com.intellij.xml.XmlBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -451,22 +452,7 @@ public class ColorSampleLookupValue implements LookupValueWithUIHint, DeferredUs } String hexValue = text.charAt(0) == '#' ? text : getHexCodeForColorName(text.toLowerCase()); if (hexValue != null) { - String hexValue2 = hexValue.substring(1); - if (hexValue2.length() == 3) { - StringBuilder buf = new StringBuilder(6); - buf.append(hexValue2.charAt(0)).append(hexValue2.charAt(0)); - buf.append(hexValue2.charAt(1)).append(hexValue2.charAt(1)); - buf.append(hexValue2.charAt(2)).append(hexValue2.charAt(2)); - - hexValue2 = buf.toString(); - } - - try { - return Color.decode("0x" + hexValue2); - } - catch (NumberFormatException e) { - //ignore - } + return ColorUtil.fromHex(hexValue, null); } return null; }