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/move/moveMembers/MoveJavaMemberHandler.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java index bfeade036b0e..59dbd1ab271f 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java @@ -203,7 +203,7 @@ public class MoveJavaMemberHandler implements MoveMemberHandler { } protected static void changeQualifier(PsiReferenceExpression refExpr, PsiClass aClass, PsiMember member) throws IncorrectOperationException { - if (RefactoringUtil.hasOnDemandStaticImport(refExpr, aClass)) { + if (RefactoringUtil.hasOnDemandStaticImport(refExpr, aClass) && !(refExpr instanceof PsiMethodReferenceExpression)) { refExpr.setQualifierExpression(null); } else if (!ImportsUtil.hasStaticImportOn(refExpr, member, false)){ diff --git a/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java b/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java index 36d024726bbf..9ff9da60f09c 100644 --- a/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java +++ b/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.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. @@ -767,7 +767,10 @@ public class DeclarationParser { final PsiBuilder.Marker anno = builder.mark(); builder.advanceLexer(); - final PsiBuilder.Marker classRef = myParser.getReferenceParser().parseJavaCodeReference(builder, true, false, false, false); + PsiBuilder.Marker classRef = null; + if (builder.getTokenType() == JavaTokenType.IDENTIFIER) { + classRef = myParser.getReferenceParser().parseJavaCodeReference(builder, true, false, false, false); + } if (classRef == null) { error(builder, JavaErrorMessages.message("expected.class.reference")); } 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/testData/psi/parser-partial/declarations/AnnoDefault.txt b/java/java-tests/testData/psi/parser-partial/declarations/AnnoDefault.txt index 5d8e43524fb3..7ce071b2355e 100644 --- a/java/java-tests/testData/psi/parser-partial/declarations/AnnoDefault.txt +++ b/java/java-tests/testData/psi/parser-partial/declarations/AnnoDefault.txt @@ -13,7 +13,6 @@ PsiJavaFile:AnnoDefault.java PsiWhiteSpace(' ') PsiIdentifier:foo('foo') - PsiWhiteSpace(' ') PsiParameterList:() PsiJavaToken:LPARENTH('(') PsiJavaToken:RPARENTH(')') diff --git a/java/java-tests/testData/psi/parser-partial/declarations/AnnoLoop.txt b/java/java-tests/testData/psi/parser-partial/declarations/AnnoLoop.txt new file mode 100644 index 000000000000..36ed65b5c563 --- /dev/null +++ b/java/java-tests/testData/psi/parser-partial/declarations/AnnoLoop.txt @@ -0,0 +1,18 @@ +PsiJavaFile:AnnoLoop.java + PsiJavaToken:LBRACE('{') + PsiWhiteSpace(' ') + PsiErrorElement:Unexpected token + PsiJavaToken:AT('@') + PsiJavaToken:AT('@') + PsiJavaToken:AT('@') + PsiWhiteSpace(' ') + PsiField:i + PsiModifierList: + + PsiTypeElement:int + PsiKeyword:int('int') + PsiWhiteSpace(' ') + PsiIdentifier:i('i') + PsiJavaToken:SEMICOLON(';') + PsiWhiteSpace(' ') + PsiJavaToken:RBRACE('}') \ 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/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/lang/java/parser/partial/DeclarationParserTest.java b/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java index e088797031a4..624aea51f565 100644 --- a/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java +++ b/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java @@ -60,10 +60,11 @@ public class DeclarationParserTest extends JavaParsingTestCase { public void testEnumWithoutConstants() { doParserTest("{ private A }", false, true); } public void testAnnoSimple() { doParserTest("{ int foo (); }", true, false); } - public void testAnnoDefault() { doParserTest("{ Class foo () default String.class; }", true, false); } + public void testAnnoDefault() { doParserTest("{ Class foo() default String.class; }", true, false); } public void testAnnoNested() { doParserTest("{ @interface Inner { String bar () default \"\"; } }", true, false); } public void testAnnoInner() { doParserTest("{ @interface Inner { double bar () default 0.0; } }"); } public void testAnnoOtherMembers() { doParserTest("{ int field;\n void m() {}\n class C {}\n interface I {} }", true, false); } + public void testAnnoLoop() { doParserTest("{ @@@ int i; }"); } public void testFieldSimple() { doParserTest("{ int field = 0; }"); } public void testFieldMulti() { doParserTest("{ int field1 = 0, field2; }"); } diff --git a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java index 885720f0251f..c984f56575fd 100644 --- a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java +++ b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.lang.impl; import com.intellij.lang.*; @@ -66,6 +65,8 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder { public static final Key, ThreeState>> CUSTOM_COMPARATOR = Key.create("CUSTOM_COMPARATOR"); + private static TokenSet ourAnyLanguageWhitespaceTokens = TokenSet.EMPTY; + private final Project myProject; private PsiFile myFile; @@ -75,7 +76,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder { private final MyList myProduction = new MyList(); - @NotNull private final Lexer myLexer; + private final Lexer myLexer; private final TokenSet myWhitespaces; private TokenSet myComments; @@ -92,8 +93,6 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder { private final MyTreeStructure myParentLightTree; private final int myOffset; - private static TokenSet ourAnyLanguageWhitespaceTokens = TokenSet.EMPTY; - private Map myUserData = null; private IElementType myCachedTokenType; @@ -764,14 +763,16 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder { @Override public void advanceLexer() { + ProgressIndicatorProvider.checkCanceled(); + if (eof()) return; if (!myTokenTypeChecked) { - LOG.assertTrue(eof(), "Probably a bug: eating token without its type checking"); + LOG.error("Probably a bug: eating token without its type checking"); } + myTokenTypeChecked = false; myCurrentLexeme++; - ProgressIndicatorProvider.checkCanceled(); clearCachedTokenType(); } 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/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index 29d554ccf3d8..a54a57ede2de 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -157,7 +157,7 @@ public class DiffUtil { if (enableFolding) { editor.getSettings().setFoldingOutlineShown(true); - editor.getSettings().setCodeFoldingEnabled(false); + editor.getSettings().setAutoCodeFoldingEnabled(false); } else { editor.getSettings().setFoldingOutlineShown(false); diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorSettings.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorSettings.java index 68cb3b57b641..56e6d9a3489f 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorSettings.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorSettings.java @@ -54,8 +54,8 @@ public interface EditorSettings { boolean isFoldingOutlineShown(); void setFoldingOutlineShown(boolean val); - boolean isCodeFoldingEnabled(); - void setCodeFoldingEnabled(boolean val); + boolean isAutoCodeFoldingEnabled(); + void setAutoCodeFoldingEnabled(boolean val); boolean isUseTabCharacter(Project project); void setUseTabCharacter(boolean useTabCharacter); diff --git a/platform/icons/src/actions/close.png b/platform/icons/src/actions/close.png index 7e4dedc4f133..c5f4c69877c3 100644 Binary files a/platform/icons/src/actions/close.png and b/platform/icons/src/actions/close.png differ diff --git a/platform/icons/src/actions/close@2x.png b/platform/icons/src/actions/close@2x.png new file mode 100644 index 000000000000..5b8b5bceb673 Binary files /dev/null and b/platform/icons/src/actions/close@2x.png differ diff --git a/platform/icons/src/actions/close@2x_dark.png b/platform/icons/src/actions/close@2x_dark.png new file mode 100644 index 000000000000..5b8b5bceb673 Binary files /dev/null and b/platform/icons/src/actions/close@2x_dark.png differ diff --git a/platform/icons/src/actions/closeHovered.png b/platform/icons/src/actions/closeHovered.png index 5c2b1fd66ff1..155a0bbf021e 100644 Binary files a/platform/icons/src/actions/closeHovered.png and b/platform/icons/src/actions/closeHovered.png differ diff --git a/platform/icons/src/actions/closeHovered@2x.png b/platform/icons/src/actions/closeHovered@2x.png new file mode 100644 index 000000000000..64ad17544442 Binary files /dev/null and b/platform/icons/src/actions/closeHovered@2x.png differ diff --git a/platform/icons/src/actions/closeHovered@2x_dark.png b/platform/icons/src/actions/closeHovered@2x_dark.png new file mode 100644 index 000000000000..5561b8f7153f Binary files /dev/null and b/platform/icons/src/actions/closeHovered@2x_dark.png differ diff --git a/platform/icons/src/actions/closeHovered_dark.png b/platform/icons/src/actions/closeHovered_dark.png new file mode 100644 index 000000000000..7e2be76664b9 Binary files /dev/null and b/platform/icons/src/actions/closeHovered_dark.png differ diff --git a/platform/icons/src/actions/close_dark.png b/platform/icons/src/actions/close_dark.png new file mode 100644 index 000000000000..c5f4c69877c3 Binary files /dev/null and b/platform/icons/src/actions/close_dark.png differ diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/ArrangementRemoveConditionAction.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/ArrangementRemoveConditionAction.java index 4ce486536aa4..1778db0c51fa 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/ArrangementRemoveConditionAction.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/ArrangementRemoveConditionAction.java @@ -26,8 +26,8 @@ import com.intellij.openapi.actionSystem.AnActionEvent; public class ArrangementRemoveConditionAction extends AnAction { public ArrangementRemoveConditionAction() { - getTemplatePresentation().setIcon(AllIcons.Actions.CloseNew); - getTemplatePresentation().setHoveredIcon(AllIcons.Actions.CloseNewHovered); + getTemplatePresentation().setIcon(AllIcons.Actions.Close); + getTemplatePresentation().setHoveredIcon(AllIcons.Actions.CloseHovered); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java index eaaea3c7570e..7a3695f46fcb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java @@ -248,7 +248,6 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec } private void initFolding(@NotNull final Editor editor) { - if (!editor.getSettings().isCodeFoldingEnabled()) return; final Document document = editor.getDocument(); editor.getFoldingModel().runBatchFoldingOperation(new Runnable() { @Override @@ -289,6 +288,7 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec } public void updateFoldRegions(Editor editor, boolean quick) { + if (!editor.getSettings().isAutoCodeFoldingEnabled()) return; PsiDocumentManager.getInstance(myProject).commitDocument(editor.getDocument()); Runnable runnable = updateFoldRegions(editor, false, quick); if (runnable != null) { @@ -322,6 +322,7 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec @Override @Nullable public Runnable updateFoldRegionsAsync(@NotNull final Editor editor, final boolean firstTime) { + if (!editor.getSettings().isAutoCodeFoldingEnabled()) return null; final Runnable runnable = updateFoldRegions(editor, firstTime, false); return new Runnable() { @Override @@ -338,7 +339,6 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec @Nullable private Runnable updateFoldRegions(@NotNull Editor editor, boolean applyDefaultState, boolean quick) { - if (!editor.getSettings().isCodeFoldingEnabled()) return null; PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument()); if (file != null) { return FoldingUpdate.updateFoldRegions(editor, file, applyDefaultState, quick); 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/lang-impl/src/com/intellij/execution/ui/layout/actions/CloseViewAction.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/CloseViewAction.java index 45c1cb7615f7..b223d84999eb 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/CloseViewAction.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/CloseViewAction.java @@ -27,8 +27,8 @@ public class CloseViewAction extends BaseViewAction { @Override protected void update(final AnActionEvent e, final ViewContext context, final Content[] content) { setEnabled(e, isEnabled(content)); - e.getPresentation().setIcon(AllIcons.Actions.CloseNew); - e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseNewHovered); + e.getPresentation().setIcon(AllIcons.Actions.Close); + e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered); } @Override diff --git a/platform/lang-impl/src/com/intellij/ui/popup/util/MasterDetailPopupBuilder.java b/platform/lang-impl/src/com/intellij/ui/popup/util/MasterDetailPopupBuilder.java index 984b512fb254..ca661107cce0 100644 --- a/platform/lang-impl/src/com/intellij/ui/popup/util/MasterDetailPopupBuilder.java +++ b/platform/lang-impl/src/com/intellij/ui/popup/util/MasterDetailPopupBuilder.java @@ -186,7 +186,7 @@ public class MasterDetailPopupBuilder implements MasterController { }); } else { - builder.setCommandButton(new InplaceButton(new IconButton("Close", AllIcons.Actions.CloseNew, AllIcons.Actions.CloseNewHovered), actionListener)); + builder.setCommandButton(new InplaceButton(new IconButton("Close", AllIcons.Actions.Close, AllIcons.Actions.CloseHovered), actionListener)); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java index 6264fa486a7c..ed14e128a804 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java @@ -51,7 +51,7 @@ public class SettingsImpl implements EditorSettings { private int myLineCursorWidth = Registry.intValue("editor.caret.width", 2); private boolean myLineMarkerAreaShown = true; private boolean myAllowSingleLogicalLineFolding = false; - private boolean myCodeFoldingEnabled = true; + private boolean myAutoCodeFoldingEnabled = true; // These comes from CodeStyleSettings private Integer myTabSize = null; @@ -281,14 +281,13 @@ public class SettingsImpl implements EditorSettings { } @Override - public boolean isCodeFoldingEnabled() { - return myCodeFoldingEnabled; + public boolean isAutoCodeFoldingEnabled() { + return myAutoCodeFoldingEnabled; } @Override - public void setCodeFoldingEnabled(boolean val) { - myCodeFoldingEnabled = val; - fireEditorRefresh(); + public void setAutoCodeFoldingEnabled(boolean val) { + myAutoCodeFoldingEnabled = val; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java index 631b7771b844..ce1b556a5150 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java @@ -420,8 +420,8 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos @Override public void update(final AnActionEvent e) { - e.getPresentation().setIcon(myTabs.isEditorTabs() ? AllIcons.Actions.CloseNew : AllIcons.Actions.Close); - e.getPresentation().setHoveredIcon(myTabs.isEditorTabs()? AllIcons.Actions.CloseNewHovered : AllIcons.Actions.CloseHovered); + e.getPresentation().setIcon(AllIcons.Actions.Close); + e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered); e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON); e.getPresentation().setText("Close. Alt-click to close others."); } 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/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java index fdcc4f876b3f..3e8692d7b9bd 100644 --- a/platform/util/src/com/intellij/util/Restarter.java +++ b/platform/util/src/com/intellij/util/Restarter.java @@ -155,8 +155,8 @@ public class Restarter { public static File createTempExecutable(File executable) throws IOException { File executableDir = new File(System.getProperty("user.home") + "/." + System.getProperty("idea.paths.selector") + "/restart"); - File copy = new File(executableDir.getPath() + "/" + executable.getName()); if (!FileUtilRt.createDirectory(executableDir)) throw new IOException("Cannot create dir: " + executableDir); + File copy = new File(executableDir.getPath() + "/" + executable.getName()); if (!FileUtilRt.ensureCanCreateFile(copy) || (copy.exists() && !copy.delete())) { String ext = FileUtilRt.getExtension(executable.getName()); copy = FileUtilRt.createTempFile(executableDir, FileUtilRt.getNameWithoutExtension(copy.getName()), diff --git a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java index 9975bee0e526..a5b20ed3c645 100644 --- a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java +++ b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java @@ -189,8 +189,8 @@ public class StudyEditInputAction extends DumbAwareAction { @Override public void update(final AnActionEvent e) { - e.getPresentation().setIcon(tabbedPane.isEditorTabs() ? AllIcons.Actions.CloseNew : AllIcons.Actions.Close); - e.getPresentation().setHoveredIcon(tabbedPane.isEditorTabs() ? AllIcons.Actions.CloseNewHovered : AllIcons.Actions.CloseHovered); + e.getPresentation().setIcon(AllIcons.Actions.Close); + e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered); e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON); e.getPresentation().setText("Delete test"); }