diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/PrimitiveRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/PrimitiveRenderer.java index 79f634b97652..7d44b16e5f49 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/PrimitiveRenderer.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/PrimitiveRenderer.java @@ -105,7 +105,7 @@ public class PrimitiveRenderer extends NodeRendererImpl { static void appendCharValue(CharValue value, StringBuilder buf) { buf.append('\''); String s = value.toString(); - StringUtil.escapeStringCharacters(s.length(), s, buf); + StringUtil.escapeStringCharacters(s.length(), s, "\'", buf); buf.append('\''); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java index 65b5e61b28a7..fd45fdfc8b5a 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java @@ -57,7 +57,11 @@ public class DfaVariableValue extends DfaValue { } public DfaVariableValue createVariableValue(PsiVariable myVariable, boolean isNegated) { - return createVariableValue(myVariable, myVariable.getType(), isNegated, null); + PsiType varType = myVariable.getType(); + if (varType instanceof PsiEllipsisType) { + varType = new PsiArrayType(((PsiEllipsisType)varType).getComponentType()); + } + return createVariableValue(myVariable, varType, isNegated, null); } @NotNull public DfaVariableValue createVariableValue(@NotNull PsiModifierListOwner myVariable, diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java index cb2c3fda0b68..bda9f4be9581 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java @@ -53,6 +53,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo @Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL = true; @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_GETTER = true; @SuppressWarnings({"WeakerAccess"}) public boolean IGNORE_EXTERNAL_SUPER_NOTNULL = false; + @SuppressWarnings({"WeakerAccess"}) public boolean REQUIRE_NOTNULL_FIELDS_INITIALIZED = true; @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED = false; @Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_SETTER_PARAMETER = true; @Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true; // remains for test @@ -67,7 +68,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo String name = child.getAttributeValue("name"); String value = child.getAttributeValue("value"); if ("IGNORE_EXTERNAL_SUPER_NOTNULL".equals(name) && "false".equals(value) || - "REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED".equals(name) && "false".equals(value)) { + "REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED".equals(name) && "false".equals(value) || + "REQUIRE_NOTNULL_FIELDS_INITIALIZED".equals(name) && "true".equals(value)) { node.removeContent(child); } } @@ -178,12 +180,14 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo } List initializers = DfaPsiUtil.findAllConstructorInitializers(field); - if (annotated.isDeclaredNotNull && initializers.isEmpty()) { - final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, manager.getNotNulls()); - if (annotation != null) { - holder.registerProblem(annotation.isPhysical() ? annotation : field.getNameIdentifier(), - "Not-null fields must be initialized", - ProblemHighlightType.GENERIC_ERROR_OR_WARNING); + if (REQUIRE_NOTNULL_FIELDS_INITIALIZED) { + if (annotated.isDeclaredNotNull && initializers.isEmpty()) { + final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, manager.getNotNulls()); + if (annotation != null) { + holder.registerProblem(annotation.isPhysical() ? annotation : field.getNameIdentifier(), + "Not-null fields must be initialized", + ProblemHighlightType.GENERIC_ERROR_OR_WARNING); + } } } diff --git a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java index b860a937d412..125bb6a2c11b 100644 --- a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java @@ -40,6 +40,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase { private JButton myConfigureAnnotationsButton; private JCheckBox myIgnoreExternalSuperNotNull; private JCheckBox myNNParameterOverridesNA; + private JCheckBox myRequireNNFieldsInitialized; private OptionsPanel() { super(new BorderLayout()); @@ -56,6 +57,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase { myNNParameterOverridesNA.addActionListener(actionListener); myReportNotAnnotatedGetter.addActionListener(actionListener); myIgnoreExternalSuperNotNull.addActionListener(actionListener); + myRequireNNFieldsInitialized.addActionListener(actionListener); myConfigureAnnotationsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -74,6 +76,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase { myReportNotAnnotatedGetter.setSelected(REPORT_NOT_ANNOTATED_GETTER); myIgnoreExternalSuperNotNull.setSelected(IGNORE_EXTERNAL_SUPER_NOTNULL); myNNParameterOverridesNA.setSelected(REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED); + myRequireNNFieldsInitialized.setSelected(REQUIRE_NOTNULL_FIELDS_INITIALIZED); myIgnoreExternalSuperNotNull.setEnabled(myNAMethodOverridesNN.isSelected()); } @@ -84,6 +87,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase { REPORT_NOT_ANNOTATED_GETTER = myReportNotAnnotatedGetter.isSelected(); IGNORE_EXTERNAL_SUPER_NOTNULL = myIgnoreExternalSuperNotNull.isSelected(); REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED = myNNParameterOverridesNA.isSelected(); + REQUIRE_NOTNULL_FIELDS_INITIALIZED = myRequireNNFieldsInitialized.isSelected(); REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL; myIgnoreExternalSuperNotNull.setEnabled(myNAMethodOverridesNN.isSelected()); diff --git a/java/java-impl/src/com/intellij/codeInspection/nullable/OptionsPanel.form b/java/java-impl/src/com/intellij/codeInspection/nullable/OptionsPanel.form index 34c5535fa6fd..c9d38f447b36 100644 --- a/java/java-impl/src/com/intellij/codeInspection/nullable/OptionsPanel.form +++ b/java/java-impl/src/com/intellij/codeInspection/nullable/OptionsPanel.form @@ -1,16 +1,16 @@
- + - + - + @@ -39,7 +39,7 @@ - + @@ -61,6 +61,14 @@ + + + + + + + + diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java index 15ff329d955c..daa1950d94d2 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java @@ -1713,14 +1713,17 @@ public class ExtractMethodProcessor implements MatchProvider { if (duplicates != null && !duplicates.isEmpty()) { return true; } - final ExtractMethodSignatureSuggester suggester = new ExtractMethodSignatureSuggester(myProject, myExtractedMethod, myMethodCall, myVariableDatum); - duplicates = suggester.getDuplicates(myExtractedMethod, myMethodCall); - if (duplicates != null && !duplicates.isEmpty()) { - myDuplicates = duplicates; - myExtractedMethod = suggester.getExtractedMethod(); - myMethodCall = suggester.getMethodCall(); - myVariableDatum = suggester.getVariableData(); - return null; + + if (myExtractedMethod != null) { + final ExtractMethodSignatureSuggester suggester = new ExtractMethodSignatureSuggester(myProject, myExtractedMethod, myMethodCall, myVariableDatum); + duplicates = suggester.getDuplicates(myExtractedMethod, myMethodCall); + if (duplicates != null && !duplicates.isEmpty()) { + myDuplicates = duplicates; + myExtractedMethod = suggester.getExtractedMethod(); + myMethodCall = suggester.getMethodCall(); + myVariableDatum = suggester.getVariableData(); + return null; + } } return false; } diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/VarargInferred.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/VarargInferred.java new file mode 100644 index 000000000000..7f38129033be --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/VarargInferred.java @@ -0,0 +1,6 @@ +class X { + public static String compute(String... s) { + if (s == null) return null; + return ""; + } +} diff --git a/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitializedSetting.java b/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitializedSetting.java new file mode 100644 index 000000000000..5513b01408d9 --- /dev/null +++ b/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitializedSetting.java @@ -0,0 +1,9 @@ +import org.jetbrains.annotations.*; + +class Test { + @NotNull Object member; + + private void accessMember() { + member = new Object(); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java index c2cddc127835..50355f3c9ced 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java @@ -40,4 +40,5 @@ public class ContractCheckTest extends LightCodeInsightFixtureTestCase { public void testNestedCallsMayThrow() { doTest(); } public void testSignatureIssues() { doTest(); } + public void testVarargInferred() { doTest(); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java index 7ff990ffe87e..17b1d4f85d7b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java @@ -47,7 +47,7 @@ public class InspectionProfileTest extends LightIdeaTestCase { //noinspection AssignmentToStaticFieldFromInstanceMethod InspectionProfileImpl.INIT_INSPECTIONS = true; super.setUp(); - InspectionToolRegistrar.getInstance().ensureInitialized(); + InspectionToolRegistrar.getInstance().createTools(); } @Override diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java index 0b8e6c086b16..40302703f045 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java @@ -48,7 +48,13 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase public void testNullableFieldNotnullParam() throws Exception{ doTest(); } public void testNotNullFieldNullableParam() throws Exception{ doTest(); } public void testNotNullCustomException() throws Exception{ doTest(); } + public void testNotNullFieldNotInitialized() throws Exception{ doTest(); } + public void testNotNullFieldNotInitializedSetting() { + myInspection.REQUIRE_NOTNULL_FIELDS_INITIALIZED = false; + doTest(); + } + public void testNotNullAnnotationChecksInChildClassMethods() { doTest(); } public void testGetterSetterProblems() throws Exception{ doTest(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java index 39f83d4f7796..8b6ef9a30b04 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java @@ -15,7 +15,6 @@ public class RedundantSuppressTest extends InspectionTestCase { @Override protected void setUp() throws Exception { super.setUp(); - InspectionToolRegistrar.getInstance().ensureInitialized(); myInspectionToolWrappers = new InspectionToolWrapper[]{ new LocalInspectionToolWrapper(new I18nInspection()), new LocalInspectionToolWrapper(new RawUseOfParameterizedTypeInspection()), diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionToolRegistrar.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionToolRegistrar.java index c1223d719167..f4e129ba0b47 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionToolRegistrar.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionToolRegistrar.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.ReentrantReadWriteLock; /** * @author max @@ -41,10 +42,11 @@ public class InspectionToolRegistrar { private final List> myInspectionToolFactories = new ArrayList>(); - private final AtomicBoolean myInspectionComponentsLoaded = new AtomicBoolean(false); + private boolean myInspectionComponentsLoaded = false; - public void ensureInitialized() { - if (!myInspectionComponentsLoaded.getAndSet(true)) { + private synchronized void ensureInitialized() { + if (!myInspectionComponentsLoaded) { + myInspectionComponentsLoaded = true; Set providers = new THashSet(); ContainerUtil.addAll(providers, ApplicationManager.getApplication().getComponents(InspectionToolProvider.class)); ContainerUtil.addAll(providers, Extensions.getExtensions(InspectionToolProvider.EXTENSION_POINT_NAME)); @@ -89,7 +91,7 @@ public class InspectionToolRegistrar { throw new RuntimeException("unknown inspection class: " + profileEntry + "; "+profileEntry.getClass()); } - public void registerTools(@NotNull InspectionToolProvider[] providers) { + private void registerTools(@NotNull InspectionToolProvider[] providers) { for (InspectionToolProvider provider : providers) { Class[] classes = provider.getInspectionClasses(); for (Class aClass : classes) { @@ -117,7 +119,7 @@ public class InspectionToolRegistrar { * make sure that it is not too late */ @NotNull - public Factory registerInspectionToolFactory(@NotNull Factory factory, boolean store) { + private Factory registerInspectionToolFactory(@NotNull Factory factory, boolean store) { if (store) { myInspectionToolFactories.add(factory); } diff --git a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java index fac3451878b3..3ef73a61e10e 100644 --- a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java +++ b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java @@ -62,7 +62,7 @@ public class ApplicationUtil { * Note that the process may continue to run in background indefinitely - so avoid using this method unless absolutely needed. */ public static T runWithCheckCanceled(@NotNull final Callable callable, - @NotNull final ProgressIndicator indicator, ExecutorService executorService) throws Exception { + @NotNull final ProgressIndicator indicator, @NotNull ExecutorService executorService) throws Exception { final Ref result = Ref.create(); final Ref error = Ref.create(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java index dd370f6dfe7f..e84667ebd4d0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupTypedHandler.java @@ -207,6 +207,7 @@ public class LookupTypedHandler extends TypedActionHandlerBase { @Nullable private static CharFilter.Result getFiltersDecision(char charTyped, LookupImpl lookup) { + lookup.checkValid(); LookupElement item = lookup.getCurrentItem(); int prefixLength = item == null ? lookup.getAdditionalPrefix().length(): lookup.itemPattern(item).length(); @@ -215,6 +216,9 @@ public class LookupTypedHandler extends TypedActionHandlerBase { if (result != null) { return result; } + if (lookup.isLookupDisposed()) { + throw new AssertionError("Lookup disposed after " + extension); + } } return null; } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/BasePasteHandler.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/BasePasteHandler.java index cf3bbecae8c6..c7bb20f6f2fb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/BasePasteHandler.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/BasePasteHandler.java @@ -22,13 +22,19 @@ import com.intellij.openapi.editor.EditorCopyPasteHelper; import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; import com.intellij.util.Producer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.datatransfer.Transferable; -public abstract class BasePasteHandler extends EditorWriteActionHandler { +public class BasePasteHandler extends EditorWriteActionHandler { protected Transferable myTransferable; + @Override + public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { + return !editor.isViewer(); + } + @Override public void doExecute(Editor editor, @Nullable Caret caret, DataContext dataContext) { // We capture the contents to paste here, so it that it won't be affected by possible clipboard operations later (e.g. during unlocking diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/SimplePasteAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/SimplePasteAction.java index 0efcdb1d8705..c09be9b5b436 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/SimplePasteAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/SimplePasteAction.java @@ -17,12 +17,8 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.Presentation; -import com.intellij.openapi.editor.Caret; -import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorAction; -import org.jetbrains.annotations.NotNull; /** * @author max @@ -30,7 +26,7 @@ import org.jetbrains.annotations.NotNull; */ public class SimplePasteAction extends EditorAction { public SimplePasteAction() { - super(new Handler()); + super(new BasePasteHandler()); } @Override @@ -41,11 +37,4 @@ public class SimplePasteAction extends EditorAction { presentation.setVisible(presentation.isEnabled()); } } - - private static class Handler extends BasePasteHandler { - @Override - public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { - return !editor.isViewer(); - } - } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.java index 3fb69a7f5089..aba649be7115 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.java @@ -25,6 +25,7 @@ import com.intellij.openapi.fileEditor.FileEditorProvider; import com.intellij.openapi.fileEditor.WeighedFileEditorProvider; import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager; import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; +import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Condition; @@ -86,6 +87,9 @@ public final class FileEditorProviderManagerImpl extends FileEditorProviderManag if (ApplicationManager.getApplication().runReadAction(new Computable() { @Override public Boolean compute() { + if (DumbService.isDumb(project) && !DumbService.isDumbAware(provider)) { + return false; + } return provider.accept(project, file); } })) { diff --git a/platform/testFramework/src/com/intellij/util/GCUtil.java b/platform/testFramework/src/com/intellij/util/GCUtil.java index 610537beffa0..ab2f1a419b68 100644 --- a/platform/testFramework/src/com/intellij/util/GCUtil.java +++ b/platform/testFramework/src/com/intellij/util/GCUtil.java @@ -52,6 +52,7 @@ public class GCUtil { if (q.poll() != null) { break; } + TimeoutUtil.sleep(10); long bytes = Math.min(Runtime.getRuntime().freeMemory() / 2, Integer.MAX_VALUE); list.add(new SoftReference(new byte[(int)bytes])); } diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index 043d2c58cf51..fa6acd5d09b4 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -1558,7 +1558,7 @@ public class StringUtil extends StringUtilRt { sb.insert(0, units[i]).insert(0, count); } else if (remainder > 0) { - sb.append(String.format("%.2f", count + (double)remainder / multipliers[i - 1])).append(units[i]); + sb.append(String.format(Locale.US, "%.2f", count + (double)remainder / multipliers[i - 1])).append(units[i]); } return sb.toString(); } diff --git a/plugins/svn4idea/src/META-INF/plugin.xml b/plugins/svn4idea/src/META-INF/plugin.xml index fe98afcc4dcc..a49cc5a92dd6 100644 --- a/plugins/svn4idea/src/META-INF/plugin.xml +++ b/plugins/svn4idea/src/META-INF/plugin.xml @@ -37,6 +37,9 @@ + + diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index 60e823bb16d3..1aead66b53d4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -642,6 +642,8 @@ merge.source.details.title=Merge source details for {0} [{1}] repository.browser.edit.location.dialog.title= Edit Location Url loading.default.branches.configuration.text=Loading default branches configuration... loading.data.for.root.text=Loading data for {0} +action.Subversion.TogglePropertiesDiff.text=Show properties +action.Subversion.TogglePropertiesDiff.description=Show differences in SVN properties action.PropertiesDiff.text=Compare Subversion Properties action.AlienPropertiesLocalDiff.text=Compare Subversion Properties with Branch action.IntegrateChangeSetAction.text=Integrate to Branch diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java index aee5ec170cd9..f1d6b89cf45d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java @@ -10,9 +10,9 @@ import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.requests.ErrorDiffRequest; import com.intellij.diff.tools.ErrorDiffTool; import com.intellij.diff.util.DiffUtil; -import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.EmptyAction; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.DumbAware; @@ -192,6 +192,7 @@ public class SvnDiffViewer implements DiffViewer { // private void updatePropertiesPanel() { + boolean wasFocused = myContext.isFocused(); if (!mySettings.isHideProperties()) { mySplitter.setSecondComponent(myPropertiesViewer.getComponent()); myNotificationPanel.setContent(null); @@ -200,6 +201,7 @@ public class SvnDiffViewer implements DiffViewer { mySplitter.setSecondComponent(null); myNotificationPanel.setContent(createNotification()); } + if (wasFocused) myContext.requestFocus(); } @NotNull @@ -278,9 +280,9 @@ public class SvnDiffViewer implements DiffViewer { // Actions // - private class ToggleHidePropertiesAction extends ToggleAction implements DumbAware { // TODO: shortcut + private class ToggleHidePropertiesAction extends ToggleAction implements DumbAware { public ToggleHidePropertiesAction() { - super("Show SVN properties", null, AllIcons.Actions.Preview); + EmptyAction.setupAction(this, "Subversion.TogglePropertiesDiff", null); } @Override diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java index 742635651140..365bec995cca 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java @@ -50,8 +50,6 @@ public class DomHighlightingLiteTest extends DomTestCase { protected void setUp() throws Exception { super.setUp(); - final InspectionToolRegistrar registrar = new InspectionToolRegistrar(); - registrar.registerTools(new InspectionToolProvider[0]); myInspectionProfile = new MockInspectionProfile(); myAnnotationsManager = new DomElementAnnotationsManagerImpl(getProject()) {