Merge remote-tracking branch 'origin/master' idea/140.563
authorVladimir.Orlov <Vladimir.Orlov@jetbrains.com>
Thu, 13 Nov 2014 14:34:00 +0000 (17:34 +0300)
committerVladimir.Orlov <Vladimir.Orlov@jetbrains.com>
Thu, 13 Nov 2014 14:34:00 +0000 (17:34 +0300)
308 files changed:
colorSchemes/src/colorSchemes/Darcula.xml
java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
java/compiler/impl/src/com/intellij/compiler/impl/ExcludeFromCompileAction.java
java/compiler/impl/src/com/intellij/compiler/options/ValidationConfiguration.java
java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java
java/compiler/openapi/src/com/intellij/compiler/CompilerConfiguration.java
java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfigurable.java
java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfiguration.java
java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludesConfiguration.java [new file with mode: 0644]
java/debugger/impl/src/com/intellij/debugger/actions/AutoRendererAction.java
java/debugger/impl/src/com/intellij/debugger/actions/DebuggerAction.java
java/debugger/impl/src/com/intellij/debugger/actions/ViewAsGroup.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java
java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java
java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
java/java-impl/src/com/intellij/ide/actions/JavaQualifiedNameProvider.java
java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java
java/java-psi-impl/src/messages/JavaErrorMessages.properties
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnusedInspectionNonPrivateMembers.java [moved from java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnusedNonPrivateMembers.java with 100% similarity]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnusedInspectionNonPrivateMembersReferencedFromText.java [moved from java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnusedNonPrivateMembersReferencedFromText.java with 100% similarity]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/enumValues.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/ExpectedTypeFromOuterArrayCreation.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA132725.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/EnsureThatCapturedWildcardsAreNotOpenWithoutAnyReason.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/redundantCast/LambdaReturnExpressions.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterVarargsCall.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall1.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCallMoreArgs.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalNestedFilters.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalNestedFilters.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak_after.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/CopyReferenceTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/daemon/AnnotationsHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LossyEncodingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaRedundantCastTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/PsiPolyExpressionUtilTest.java
java/java-tests/testSrc/com/intellij/index/IndexTest.java
java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodTest.java
jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java
platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzerSettings.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionToolWrapper.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
platform/core-api/src/com/intellij/psi/FileViewProvider.java
platform/core-api/src/com/intellij/psi/stubs/LightStubBuilder.java
platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java
platform/core-impl/src/com/intellij/openapi/fileEditor/impl/LoadTextUtil.java
platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java
platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java
platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java
platform/icons/src/actions/inspectionsPause@2x.png [changed mode: 0755->0644]
platform/icons/src/actions/inspectionsPause@2x_dark.png [changed mode: 0755->0644]
platform/icons/src/general/errorMask.png [deleted file]
platform/icons/src/general/errorsFound.png [deleted file]
platform/icons/src/general/errorsFound_dark.png [deleted file]
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
platform/lang-api/src/com/intellij/formatting/SpacingBuilder.java
platform/lang-api/src/com/intellij/refactoring/classMembers/MemberInfoBase.java
platform/lang-impl/src/com/intellij/application/options/colors/FontEditorPreview.java
platform/lang-impl/src/com/intellij/application/options/editor/ErrorHighlightingPanel.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficTooltipRendererImpl.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/FileLevelIntentionComponent.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java
platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java
platform/lang-impl/src/com/intellij/execution/console/BaseConsoleExecuteActionHandler.java
platform/lang-impl/src/com/intellij/execution/console/ConsoleExecuteAction.java
platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java
platform/lang-impl/src/com/intellij/execution/console/LanguageConsole.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java
platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleView.java
platform/lang-impl/src/com/intellij/execution/console/ProcessBackedConsoleExecuteActionHandler.java
platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/IDEInspectionToolsConfigurable.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.form [deleted file]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProjectInspectionToolsConfigurable.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/AuxiliaryRightPanel.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java [moved from platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java with 60% similarity]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ManageButton.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ManageButtonBuilder.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesConfigurableComboBox.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/SaveInputComponent.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/SaveInputComponentValidator.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
platform/platform-api/src/com/intellij/codeHighlighting/DefaultIconCreator.java [deleted file]
platform/platform-api/src/com/intellij/openapi/MnemonicHelper.java
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
platform/platform-api/src/com/intellij/openapi/ui/OnePixelDivider.java
platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
platform/platform-api/src/com/intellij/ui/table/JBTable.java
platform/platform-api/src/com/intellij/util/net/NetUtils.java
platform/platform-api/src/com/intellij/util/ui/ButtonlessScrollBarUI.java
platform/platform-api/src/com/intellij/util/ui/update/UiNotifyConnector.java
platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java
platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginHostsConfigurable.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java
platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableCardPanel.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java
platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsDialog.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoDialog.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java
platform/platform-impl/src/com/intellij/ui/CardLayoutPanel.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ui/components/SliderSelectorAction.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/util/BufferedListConsumer.java
platform/platform-impl/src/com/intellij/util/HttpRequests.java
platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-resources/src/DefaultColorSchemesManager.xml
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/idea/LangActions.xml
platform/usageView/src/com/intellij/usages/actions/RerunSearchAction.java [new file with mode: 0644]
platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/icons/AllIcons.java
platform/util/src/com/intellij/ui/TableUtil.java
platform/util/src/com/intellij/util/ArrayUtil.java
platform/util/src/com/intellij/util/containers/ImmutableList.java
platform/util/src/com/intellij/util/io/PersistentHashMap.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewContentManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java
platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XValueExtendedPresentation.java [moved from platform/platform-impl/src/com/intellij/ide/reporter/ConnectionException.java with 60% similarity]
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XDebuggerTreeActionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/imports/ImportsAreUsedVisitor.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/ResourceInspection.java
plugins/InspectionGadgets/test/com/siyeh/igtest/resources/io/inside_try/expected.xml [deleted file]
plugins/InspectionGadgets/test/com/siyeh/igtest/resources/io/plain/expected.xml [deleted file]
plugins/InspectionGadgets/test/com/siyeh/igtest/resources/ioresource/IOResource.java [moved from plugins/InspectionGadgets/test/com/siyeh/igtest/resources/io/plain/IOResourceInspection.java with 68% similarity]
plugins/InspectionGadgets/test/com/siyeh/igtest/resources/ioresource/InsideTry.java [moved from plugins/InspectionGadgets/test/com/siyeh/igtest/resources/io/inside_try/A.java with 84% similarity]
plugins/InspectionGadgets/testsrc/com/resources/IOResourceInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/imports/UnusedImportInspectionTest.java
plugins/gradle/gradle.iml
plugins/gradle/jps-plugin/gradle-jps-plugin.iml
plugins/gradle/lib/gradle-2.2-src.zip [moved from plugins/gradle/lib/gradle-2.1-src.zip with 74% similarity]
plugins/gradle/lib/gradle-base-services-2.2.jar [moved from plugins/gradle/lib/gradle-base-services-2.1.jar with 69% similarity]
plugins/gradle/lib/gradle-base-services-groovy-2.1.jar [deleted file]
plugins/gradle/lib/gradle-base-services-groovy-2.2.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-core-2.2.jar [moved from plugins/gradle/lib/gradle-core-2.1.jar with 68% similarity]
plugins/gradle/lib/gradle-messaging-2.2.jar [moved from plugins/gradle/lib/gradle-messaging-2.1.jar with 75% similarity]
plugins/gradle/lib/gradle-model-core-2.1.jar [deleted file]
plugins/gradle/lib/gradle-model-core-2.2.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-model-groovy-2.1.jar [deleted file]
plugins/gradle/lib/gradle-model-groovy-2.2.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-native-2.1.jar [deleted file]
plugins/gradle/lib/gradle-native-2.2.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-resources-2.2.jar [moved from plugins/gradle/lib/gradle-resources-2.1.jar with 81% similarity]
plugins/gradle/lib/gradle-tooling-api-2.2.jar [moved from plugins/gradle/lib/gradle-tooling-api-2.1.jar with 54% similarity]
plugins/gradle/lib/gradle-wrapper-2.2.jar [moved from plugins/gradle/lib/gradle-wrapper-2.1.jar with 80% similarity]
plugins/gradle/lib/slf4j-api-1.7.5.jar [deleted file]
plugins/gradle/lib/slf4j-api-1.7.7.jar [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleFoldersImportingTest.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml
plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.2.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.1.jar with 65% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-ide-2.2.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-ide-2.1.jar with 50% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.2.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.1.jar [deleted file]
plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.2.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.2.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.2.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.2.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.1.jar with 62% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-scala-2.2.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-scala-2.1.jar with 74% similarity]
plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/tooling/annotation/TargetVersions.java
plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/tooling/util/VersionMatcher.java [new file with mode: 0644]
plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.2.jar [moved from plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.1.jar with 88% similarity]
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImpl.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ExtraModelBuilder.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/IdeaContentRootImpl.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/IdeaSourceDirectoryImpl.java
plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java
plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfiguration.java
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java
plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/IdeaDecompiler.java
plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/IdeaLogger.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/configurers/MavenCompilerConfigurer.java
plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java
plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java
plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java
plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java
plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java
python/helpers/pycharm/nose_utils.py
python/helpers/python-skeletons/README.md
python/helpers/python-skeletons/__builtin__.py
python/helpers/python-skeletons/builtins.py
python/helpers/python-skeletons/collections.py
python/helpers/python-skeletons/itertools.py [new file with mode: 0644]
python/helpers/python-skeletons/os/__init__.py
python/helpers/python-skeletons/sys.py [new file with mode: 0644]
python/ipnb/src/org/jetbrains/plugins/ipnb/configuration/IpnbConnectionManager.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbEditorState.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbAddCellAboveAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbAddCellBelowAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbCodeCellAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbCutCellAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbDeleteCellAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbHeadingCellActionBase.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbMarkdownCellAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbMoveCellDownAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbMoveCellUpAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbPasteCellAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/actions/IpnbRunCellBaseAction.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/IpnbFilePanel.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/IpnbMarkdownPanel.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java
python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java
python/ipnb/src/org/jetbrains/plugins/ipnb/format/IpnbParser.java
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
python/src/com/jetbrains/python/console/PydevConsoleExecuteActionHandler.java
python/src/com/jetbrains/python/debugger/array/PyViewArrayAction.java
python/src/com/jetbrains/python/psi/impl/PyImportedModule.java
python/src/com/jetbrains/python/psi/impl/PyReferenceExpressionImpl.java
python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java
python/src/com/jetbrains/python/psi/types/PyModuleType.java
python/src/com/jetbrains/python/psi/types/PyTypeParser.java
python/src/com/jetbrains/python/refactoring/move/PyMoveFileHandler.java
python/src/com/jetbrains/python/sdk/PySdkListCellRenderer.java
python/src/com/jetbrains/python/testing/PythonTestConfigurationProducer.java
python/testData/completion/relativeFromImportInNamespacePackage/nspkg1/a.after.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage/nspkg1/a.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage/nspkg1/nspkg2/bar.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage/nspkg1/nspkg2/foo.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/a.after.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/a.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/bar.py [new file with mode: 0644]
python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/foo.py [new file with mode: 0644]
python/testData/inspections/PyTypeCheckerInspection/Generator.py
python/testData/inspections/PyTypeCheckerInspection/GenericUserClasses.py
python/testData/inspections/PyUnresolvedReferencesInspection3K/attributesOfUnresolvedTypeFile.py [new file with mode: 0644]
python/testData/quickdoc/NumPyOnesDoc.html
python/testData/refactoring/move/moveNamespacePackage1/after/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage1/after/src/nspkg/empty.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage1/after/src/nssubpkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage1/before/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage1/before/src/nspkg/empty.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage1/before/src/nspkg/nssubpkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/after/src/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/after/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/after/src/nspkg/nssubpkg/empty.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/before/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/before/src/nspkg/nssubpkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage2/before/src/nspkg/nssubpkg/empty.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/after/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/after/src/nspkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/after/src/nspkg/nssubpkg/empty.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/before/src/b.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/before/src/nspkg/nssubpkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/moveNamespacePackage3/before/src/nspkg/nssubpkg/empty.py [new file with mode: 0644]
python/testData/resolve/multiFile/moduleInDeeplyNestedNamespacePackage/ModuleInDeeplyNestedNamespacePackage.py [new file with mode: 0644]
python/testData/resolve/multiFile/moduleInDeeplyNestedNamespacePackage/pkg1/pkg2/m1.py [new file with mode: 0644]
python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java
python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java
python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java
python/testSrc/com/jetbrains/python/Py3CompletionTest.java
python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java
python/testSrc/com/jetbrains/python/PyTypeParserTest.java
python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java
python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java
spellchecker/src/com/intellij/spellchecker/SpellCheckerSeveritiesProvider.java
xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java
xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnusedNamespaceInspection.java

index de43ae57788fd2c9fe3385e05ab814633e368ec2..203b991512b6603ba9bdb362e74ead2ff98a39dc 100644 (file)
       <value>
         <option name="BACKGROUND" value="52503a" />
         <option name="EFFECT_TYPE" value="2" />
-        <option name="ERROR_STRIPE_COLOR" value="8c8c00" />
+        <option name="ERROR_STRIPE_COLOR" value="be9117" />
       </value>
     </option>
     <option name="WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES">
index b677df25ac71611a9a55f7edc2e5786b50fc65d9..87eae631d3043b53c6cf010801ffea7c88f9403f 100644 (file)
@@ -30,7 +30,9 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ApplicationNamesInfo;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.openapi.compiler.CompilerManager;
+import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
 import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
 import com.intellij.openapi.components.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.Extensions;
@@ -90,7 +92,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
   private final List<CompiledPattern> myNegatedCompiledPatterns = new ArrayList<CompiledPattern>();
   private boolean myWildcardPatternsInitialized = false;
   private final Project myProject;
-  private final ExcludedEntriesConfiguration myExcludedEntriesConfiguration;
+  private final ExcludesConfigNotificationsWrapper<ExcludedEntriesConfiguration> myExcludesConfiguration;
 
   private final Collection<BackendCompiler> myRegisteredCompilers = new ArrayList<BackendCompiler>();
   private JavacCompiler JAVAC_EXTERNAL_BACKEND;
@@ -113,8 +115,8 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
 
   public CompilerConfigurationImpl(Project project) {
     myProject = project;
-    myExcludedEntriesConfiguration = new ExcludedEntriesConfiguration();
-    Disposer.register(project, myExcludedEntriesConfiguration);
+    myExcludesConfiguration = new ExcludesConfigNotificationsWrapper<ExcludedEntriesConfiguration>(project, new ExcludedEntriesConfiguration());
+    Disposer.register(project, myExcludesConfiguration.getDelegate());
     MessageBusConnection connection = project.getMessageBus().connect(project);
     connection.subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
       @Override
@@ -153,8 +155,8 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
         JpsJavaCompilerConfigurationSerializer.ENABLED, String.valueOf(myAddNotNullAssertions));
     }
 
-    if (myExcludedEntriesConfiguration.getExcludeEntryDescriptions().length > 0) {
-      myExcludedEntriesConfiguration.writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE));
+    if (myExcludesConfiguration.getExcludeEntryDescriptions().length > 0) {
+      myExcludesConfiguration.getDelegate().writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE));
     }
 
     final Element newChild = addChild(state, JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS);
@@ -390,13 +392,13 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
   }
 
   @Override
-  public ExcludedEntriesConfiguration getExcludedEntriesConfiguration() {
-    return myExcludedEntriesConfiguration;
+  public ExcludesConfiguration getExcludedEntriesConfiguration() {
+    return myExcludesConfiguration;
   }
 
   @Override
   public boolean isExcludedFromCompilation(final VirtualFile virtualFile) {
-    return myExcludedEntriesConfiguration.isExcluded(virtualFile);
+    return myExcludesConfiguration.isExcluded(virtualFile);
   }
 
   @Override
@@ -661,7 +663,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
 
     Element node = parentNode.getChild(JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE);
     if (node != null) {
-      myExcludedEntriesConfiguration.readExternal(node);
+      myExcludesConfiguration.getDelegate().readExternal(node);
     }
 
     try {
@@ -984,4 +986,64 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
     return child;
   }
 
+  private static class ExcludesConfigNotificationsWrapper<T extends ExcludesConfiguration> implements ExcludesConfiguration {
+    private final Project myProject;
+    private final T myDelegate;
+
+    public ExcludesConfigNotificationsWrapper(@NotNull Project project, @NotNull T delegate) {
+      myProject = project;
+      myDelegate = delegate;
+    }
+
+    @NotNull
+    public T getDelegate() {
+      return myDelegate;
+    }
+
+    @Override
+    public ExcludeEntryDescription[] getExcludeEntryDescriptions() {
+      return myDelegate.getExcludeEntryDescriptions();
+    }
+
+    @Override
+    public void addExcludeEntryDescription(ExcludeEntryDescription description) {
+      try {
+        myDelegate.addExcludeEntryDescription(description);
+      }
+      finally {
+        BuildManager.getInstance().clearState(myProject);
+      }
+    }
+
+    @Override
+    public void removeExcludeEntryDescription(ExcludeEntryDescription description) {
+      try {
+        myDelegate.removeExcludeEntryDescription(description);
+      }
+      finally {
+        BuildManager.getInstance().clearState(myProject);
+      }
+    }
+
+    @Override
+    public void removeAllExcludeEntryDescriptions() {
+      try {
+        myDelegate.removeAllExcludeEntryDescriptions();
+      }
+      finally {
+        BuildManager.getInstance().clearState(myProject);
+      }
+    }
+
+    @Override
+    public boolean containsExcludeEntryDescription(ExcludeEntryDescription description) {
+      return myDelegate.containsExcludeEntryDescription(description);
+    }
+
+    @Override
+    public boolean isExcluded(VirtualFile virtualFile) {
+      return myDelegate.isExcluded(virtualFile);
+    }
+  }
+  
 }
\ No newline at end of file
index 91055dbf180aae1afefb6579685a6d87c01576a3..10dfbb05682fff52cf8294a0675198f6e72d2a72 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.compiler.impl;
 
 import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
 import com.intellij.ide.errorTreeView.ErrorTreeElement;
 import com.intellij.ide.errorTreeView.ErrorTreeNodeDescriptor;
 import com.intellij.ide.errorTreeView.GroupingElement;
@@ -51,7 +50,7 @@ class ExcludeFromCompileAction extends AnAction {
 
     if (file != null && file.isValid()) {
       ExcludeEntryDescription description = new ExcludeEntryDescription(file, false, true, myProject);
-      ((CompilerConfigurationImpl) CompilerConfiguration.getInstance(myProject)).getExcludedEntriesConfiguration().addExcludeEntryDescription(description);
+      CompilerConfiguration.getInstance(myProject).getExcludedEntriesConfiguration().addExcludeEntryDescription(description);
       FileStatusManager.getInstance(myProject).fileStatusesChanged();
     }
   }
index b6e545c2202a3af7783c04831bcea68e9a908299..31c614e9088dd73993cf928adcc3fa638f643295 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.compiler.options;
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.Compiler;
 import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
 import com.intellij.openapi.components.*;
 import com.intellij.openapi.project.Project;
 import com.intellij.util.xmlb.XmlSerializerUtil;
@@ -66,7 +67,7 @@ public class ValidationConfiguration implements PersistentStateComponent<Validat
     return ServiceManager.getService(project, ValidationConfiguration.class);
   }
 
-  public static ExcludedEntriesConfiguration getExcludedEntriesConfiguration(Project project) {
+  public static ExcludesConfiguration getExcludedEntriesConfiguration(Project project) {
     return ServiceManager.getService(project, ExcludedFromValidationConfiguration.class);
   }
 
index 3d03858bbb5f33011820a751eb99a5f40203570c..a6b879bbef80e6ef7bcea625290b3015f6027278 100644 (file)
@@ -33,7 +33,7 @@ import com.intellij.openapi.application.ReadAction;
 import com.intellij.openapi.application.ReadActionProcessor;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
@@ -142,7 +142,7 @@ public class InspectionValidatorWrapper implements Validator {
     if (project.isDefault() || !ValidationConfiguration.shouldValidate(this, context)) {
       return ProcessingItem.EMPTY_ARRAY;
     }
-    final ExcludedEntriesConfiguration excludedEntriesConfiguration = ValidationConfiguration.getExcludedEntriesConfiguration(project);
+    final ExcludesConfiguration excludesConfiguration = ValidationConfiguration.getExcludedEntriesConfiguration(project);
     final List<ProcessingItem> items = new ReadAction<List<ProcessingItem>>() {
       @Override
       protected void run(final Result<List<ProcessingItem>> result) {
@@ -159,7 +159,7 @@ public class InspectionValidatorWrapper implements Validator {
             }
 
             if (myCompilerManager.isExcludedFromCompilation(file) ||
-                excludedEntriesConfiguration.isExcluded(file)) {
+                excludesConfiguration.isExcluded(file)) {
               return true;
             }
 
index 36437949085217e07d6a0c37b7efc2fa32c7df00..890d25cf1c51994af3fb7bc6bb1e3711d46caa28 100644 (file)
@@ -16,7 +16,7 @@
 
 package com.intellij.compiler;
 
-import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -62,5 +62,5 @@ public abstract class CompilerConfiguration {
 
   public abstract void setAddNotNullAssertions(boolean enabled);
 
-  public abstract ExcludedEntriesConfiguration getExcludedEntriesConfiguration();
+  public abstract ExcludesConfiguration getExcludedEntriesConfiguration();
 }
\ No newline at end of file
index 6a2cd877faf8d14140210110ed6a85a806f2fbfb..d58b9b3a540f652c7f3703cba395a75d03434a81 100644 (file)
@@ -46,7 +46,7 @@ public class ExcludedEntriesConfigurable implements UnnamedConfigurable {
   private final Project myProject;
   private final ArrayList<ExcludeEntryDescription> myExcludeEntryDescriptions = new ArrayList<ExcludeEntryDescription>();
   private final FileChooserDescriptor myDescriptor;
-  private final ExcludedEntriesConfiguration myConfiguration;
+  private final ExcludesConfiguration myConfiguration;
   private ExcludedEntriesPanel myExcludedEntriesPanel;
 
   public ExcludedEntriesConfigurable(Project project) {
@@ -54,7 +54,7 @@ public class ExcludedEntriesConfigurable implements UnnamedConfigurable {
          CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration());
   }
 
-  public ExcludedEntriesConfigurable(Project project, FileChooserDescriptor descriptor, final ExcludedEntriesConfiguration configuration) {
+  public ExcludedEntriesConfigurable(Project project, FileChooserDescriptor descriptor, final ExcludesConfiguration configuration) {
     myDescriptor = descriptor;
     myConfiguration = configuration;
     myProject = project;
index 67e87454336d08fcc676204aad7901e2e9695230..4baad849bd867d4dd6688278ce7c572ca1ee5b0e 100644 (file)
@@ -31,7 +31,8 @@ import java.util.LinkedHashSet;
 /**
  * @author nik
  */
-public class ExcludedEntriesConfiguration implements PersistentStateComponent<ExcludedEntriesConfiguration>, JDOMExternalizable, Disposable {
+public class ExcludedEntriesConfiguration implements PersistentStateComponent<ExcludedEntriesConfiguration>, JDOMExternalizable, Disposable,
+                                                     ExcludesConfiguration {
   @NonNls private static final String FILE = "file";
   @NonNls private static final String DIRECTORY = "directory";
   @NonNls private static final String URL = "url";
@@ -39,6 +40,7 @@ public class ExcludedEntriesConfiguration implements PersistentStateComponent<Ex
   private final Collection<ExcludeEntryDescription> myExcludeEntryDescriptions = new LinkedHashSet<ExcludeEntryDescription>();
   private ExcludeEntryDescription[] myCachedDescriptions = null;
 
+  @Override
   public synchronized ExcludeEntryDescription[] getExcludeEntryDescriptions() {
     if (myCachedDescriptions == null) {
       myCachedDescriptions = myExcludeEntryDescriptions.toArray(new ExcludeEntryDescription[myExcludeEntryDescriptions.size()]);
@@ -46,21 +48,25 @@ public class ExcludedEntriesConfiguration implements PersistentStateComponent<Ex
     return myCachedDescriptions;
   }
 
+  @Override
   public synchronized void addExcludeEntryDescription(ExcludeEntryDescription description) {
     myExcludeEntryDescriptions.add(description);
     myCachedDescriptions = null;
   }
 
+  @Override
   public synchronized void removeExcludeEntryDescription(ExcludeEntryDescription description) {
     myExcludeEntryDescriptions.remove(description);
     myCachedDescriptions = null;
   }
 
+  @Override
   public synchronized void removeAllExcludeEntryDescriptions() {
     myExcludeEntryDescriptions.clear();
     myCachedDescriptions = null;
   }
 
+  @Override
   public synchronized boolean containsExcludeEntryDescription(ExcludeEntryDescription description) {
     return myExcludeEntryDescriptions.contains(description);
   }
@@ -98,6 +104,7 @@ public class ExcludedEntriesConfiguration implements PersistentStateComponent<Ex
     }
   }
 
+  @Override
   public boolean isExcluded(VirtualFile virtualFile) {
     for (final ExcludeEntryDescription entryDescription : getExcludeEntryDescriptions()) {
       VirtualFile descriptionFile = entryDescription.getVirtualFile();
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludesConfiguration.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludesConfiguration.java
new file mode 100644 (file)
index 0000000..4c62238
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.compiler.options;
+
+import com.intellij.openapi.vfs.VirtualFile;
+
+/**
+ * @author Eugene Zhuravlev
+ *         Date: 12-Nov-14
+ */
+public interface ExcludesConfiguration {
+  ExcludeEntryDescription[] getExcludeEntryDescriptions();
+
+  void addExcludeEntryDescription(ExcludeEntryDescription description);
+
+  void removeExcludeEntryDescription(ExcludeEntryDescription description);
+
+  void removeAllExcludeEntryDescriptions();
+
+  boolean containsExcludeEntryDescription(ExcludeEntryDescription description);
+
+  boolean isExcluded(VirtualFile virtualFile);
+}
index 1d1537f93c9e89a8e37cddcc37091baf498a94f5..15b03ef237d0f85015c9d0935ef979fbba87d943 100644 (file)
 package com.intellij.debugger.actions;
 
 import com.intellij.debugger.engine.DebugProcessImpl;
+import com.intellij.debugger.engine.JavaValue;
 import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
 import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
-import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
 
 public class AutoRendererAction extends AnAction{
-  public void actionPerformed(AnActionEvent e) {
+  public void actionPerformed(@NotNull final AnActionEvent e) {
     final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
 
     if(debuggerContext != null) {
       final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
       if(debugProcess != null) {
-        final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(e.getDataContext());
-        if (selectedNodes != null) {
+        final List<JavaValue> selectedValues = ViewAsGroup.getSelectedValues(e);
+        if (!selectedValues.isEmpty()) {
           debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
               public void threadAction() {
-                for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
-                  final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
-                  if (descriptor instanceof ValueDescriptorImpl) {
-                    ((ValueDescriptorImpl)descriptor).setRenderer(null);
-                    selectedNode.calcRepresentation();
-                  }
+                for (JavaValue selectedValue : selectedValues) {
+                  selectedValue.getDescriptor().setRenderer(null);
                 }
+                DebuggerAction.refreshViews(e);
               }
             });
         }
index 2e87aa97328518ac6cc0c8ffbac69af3548a01f5..cb800685f6247093188f027f82b2448d52fd2b79 100644 (file)
@@ -36,6 +36,7 @@ import com.intellij.ui.DoubleClickListener;
 import com.intellij.xdebugger.XDebugProcess;
 import com.intellij.xdebugger.XDebugSession;
 import com.intellij.xdebugger.impl.frame.XDebugView;
+import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -160,6 +161,13 @@ public abstract class DebuggerAction extends AnAction {
     });
   }
 
+  public static void refreshViews(final AnActionEvent e) {
+    XDebuggerTree tree = XDebuggerTree.getTree(e.getDataContext());
+    if (tree != null) {
+    refreshViews(XDebugView.getSession(tree));
+    }
+  }
+
   public static void refreshViews(@NotNull XValueNodeImpl node) {
     refreshViews(XDebugView.getSession(node.getTree()));
   }
index fd0d8f6785b39dad4da9a5aeedc60d96e225774e..c4217a179f0fdffd6b6eb68cadfa42fe87f4e172 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.debugger.engine.JavaValue;
 import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.settings.NodeRendererSettings;
-import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
 import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.debugger.ui.tree.render.NodeRenderer;
 import com.intellij.openapi.actionSystem.*;
@@ -33,6 +32,7 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -58,13 +58,12 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     }
 
     public boolean isSelected(AnActionEvent e) {
-      XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
-      if (node == null) {
+      List<JavaValue> values = getSelectedValues(e);
+      if (values.isEmpty()) {
         return false;
       }
-      XValue container = node.getValueContainer();
-      if (container instanceof JavaValue) {
-        if (((JavaValue)container).getDescriptor().getLastRenderer() != myNodeRenderer) {
+      for (JavaValue value : values) {
+        if (value.getDescriptor().getLastRenderer() != myNodeRenderer) {
           return false;
         }
       }
@@ -72,23 +71,19 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     }
 
     public void setSelected(final AnActionEvent e, final boolean state) {
+      if (!state) return;
+
       final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
-      final XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
+      final List<JavaValue> values = getSelectedValues(e);
 
-      LOG.assertTrue(debuggerContext != null && node != null);
+      LOG.assertTrue(debuggerContext != null && !values.isEmpty());
 
       debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
           public void threadAction() {
-            XValue container = node.getValueContainer();
-            if (container instanceof JavaValue) {
-              final ValueDescriptorImpl valueDescriptor = ((JavaValue)container).getDescriptor();
-              if (state) {
-                valueDescriptor.setRenderer(myNodeRenderer);
-                DebuggerAction.refreshViews(node);
-                //valueDescriptor.updateRepresentation(debuggerContext.createEvaluationContext(), DescriptorLabelListener.DUMMY_LISTENER);
-                //container.computePresentation(node, XValuePlace.TREE);
-              }
+            for (JavaValue value : values) {
+              value.getDescriptor().setRenderer(myNodeRenderer);
             }
+            DebuggerAction.refreshViews(e);
           }
         }
       );
@@ -100,7 +95,7 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     return myChildren;
   }
 
-  private static AnAction [] calcChildren(NodeDescriptorImpl[] descriptors) {
+  private static AnAction [] calcChildren(List<JavaValue> values) {
     List<AnAction> renderers = new ArrayList<AnAction>();
 
     List<NodeRenderer> allRenderers = NodeRendererSettings.getInstance().getAllRenderers();
@@ -110,14 +105,12 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     for (NodeRenderer nodeRenderer : allRenderers) {
       boolean allApp = true;
 
-      for (NodeDescriptorImpl descriptor : descriptors) {
-        if (descriptor instanceof ValueDescriptorImpl) {
-          anyValueDescriptor = true;
-          ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)descriptor;
-          if (!valueDescriptor.isValueValid() || !nodeRenderer.isApplicable(valueDescriptor.getType())) {
-            allApp = false;
-            break;
-          }
+      for (JavaValue value : values) {
+        ValueDescriptorImpl valueDescriptor = value.getDescriptor();
+        anyValueDescriptor = true;
+        if (!valueDescriptor.isValueValid() || !nodeRenderer.isApplicable(valueDescriptor.getType())) {
+          allApp = false;
+          break;
         }
       }
 
@@ -158,13 +151,8 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     }
 
     final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(event.getDataContext());
-    XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
-    if (node == null) {
-      return;
-    }
-    final XValue container = node.getValueContainer();
-    if (!(container instanceof JavaValue)) {
-      event.getPresentation().setEnabled(false);
+    final List<JavaValue> values = getSelectedValues(event);
+    if (values.isEmpty()) {
       return;
     }
 
@@ -176,9 +164,23 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
     
     process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
       public void threadAction() {
-        myChildren = calcChildren(new NodeDescriptorImpl[]{((JavaValue)container).getDescriptor()});
+        myChildren = calcChildren(values);
         DebuggerAction.enableAction(event, myChildren.length > 0);
       }
     });
   }
+
+  public static List<JavaValue> getSelectedValues(AnActionEvent event) {
+    List<XValueNodeImpl> selectedNodes = XDebuggerTreeActionBase.getSelectedNodes(event.getDataContext());
+    if (selectedNodes.isEmpty()) return Collections.emptyList();
+
+    List<JavaValue> res = new ArrayList<JavaValue>(selectedNodes.size());
+    for (XValueNodeImpl node : selectedNodes) {
+      XValue container = node.getValueContainer();
+      if (container instanceof JavaValue) {
+        res.add((JavaValue)container);
+      }
+    }
+    return res;
+  }
 }
index 8c4b58e86c3045fba8abc206a27606ee23615aab..43232ce3fd2d4c8686961a6f1dbb4d2677a97d54 100644 (file)
@@ -46,6 +46,7 @@ import com.intellij.xdebugger.frame.*;
 import com.intellij.xdebugger.frame.presentation.XValuePresentation;
 import com.intellij.xdebugger.impl.evaluate.XValueCompactPresentation;
 import com.intellij.xdebugger.impl.ui.XValueTextProvider;
+import com.intellij.xdebugger.impl.ui.tree.XValueExtendedPresentation;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
 import com.sun.jdi.ArrayReference;
 import com.sun.jdi.ArrayType;
@@ -183,7 +184,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
     return value.substring(0, Math.min(value.length(), XValueNode.MAX_VALUE_LENGTH));
   }
 
-  private static class JavaValuePresentation extends XValuePresentation implements XValueCompactPresentation {
+  private static class JavaValuePresentation extends XValueExtendedPresentation implements XValueCompactPresentation {
     private final String myValue;
     private final String myType;
     private final String myError;
@@ -271,6 +272,11 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
       }
       return DEFAULT_SEPARATOR;
     }
+
+    @Override
+    public boolean isModified() {
+      return myValueDescriptor.isDirty();
+    }
   }
 
   String getValueString() {
index 26d0820fedc973a3cdb08c43c92ddbca7ef11b00..574377e84b8710f7a03f9b42f12d7e6d4ccebe13 100644 (file)
@@ -671,14 +671,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
     @Override
     public void evaluationFinished(final SuspendContextImpl context) {
       myIsEvaluating = false;
-      DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
-        @Override
-        public void run() {
-          if (context != getSuspendContext()) {
-            getContextManager().setState(DebuggerContextUtil.createDebuggerContext(DebuggerSession.this, context), STATE_PAUSED, EVENT_REFRESH, null);
-          }
-        }
-      });
+      // seems to be not required after move to xdebugger
+      //DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
+      //  @Override
+      //  public void run() {
+      //    if (context != getSuspendContext()) {
+      //      getContextManager().setState(DebuggerContextUtil.createDebuggerContext(DebuggerSession.this, context), STATE_PAUSED, EVENT_REFRESH, null);
+      //    }
+      //  }
+      //});
     }
   }
 
index f64137a7a545b830c79f12f0452ce16298c30d99..39da71b4e714d473046dd783902bfa9f19cfef02 100644 (file)
@@ -26,6 +26,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
 import com.intellij.openapi.util.registry.Registry;
+import org.jetbrains.annotations.NotNull;
 
 public class ShowStructureSettingsAction extends AnAction implements DumbAware {
   @Override
@@ -40,6 +41,7 @@ public class ShowStructureSettingsAction extends AnAction implements DumbAware {
   static void showDialog(Project project) {
     if (Registry.is("ide.new.project.settings")) {
       new SingleConfigurableEditor(project, ProjectStructureConfigurable.getInstance(project), OptionsEditorDialog.DIMENSION_KEY) {
+        @NotNull
         @Override
         protected DialogStyle getStyle() {
           return DialogStyle.COMPACT;
index 10b933018455113e9598a4b4b5045978f0316316..642a8edb755fefc32832980494479b68d0f5fc04 100644 (file)
@@ -145,6 +145,13 @@ public class AnnotationsHighlightUtil {
     if (value instanceof PsiExpression) {
       PsiExpression expr = (PsiExpression)value;
       PsiType type = expr.getType();
+
+      final PsiClass psiClass = PsiUtil.resolveClassInType(type);
+      if (psiClass != null && psiClass.isEnum() && !(expr instanceof PsiReferenceExpression && ((PsiReferenceExpression)expr).resolve() instanceof PsiEnumConstant)) {
+        String description = JavaErrorMessages.message("annotation.non.enum.constant.attribute.value");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description).create(); 
+      }
+
       if (type != null && TypeConversionUtil.areTypesAssignmentCompatible(expectedType, expr) ||
           expectedType instanceof PsiArrayType &&
           TypeConversionUtil.areTypesAssignmentCompatible(((PsiArrayType)expectedType).getComponentType(), expr)) {
index 90275c9f6d5e1744c1064fad957ead70e41d938f..c5278ac15bafb6e6d57319b58f3e00f5593fba24 100644 (file)
@@ -125,30 +125,37 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
     if (argumentList == null) {
       return false;
     }
-    int offset = parameters.length - psiMethod.getParameterList().getParametersCount();
+
+    final int calledParametersCount = psiMethod.getParameterList().getParametersCount();
     final PsiExpression[] expressions = argumentList.getExpressions();
+
+    final PsiExpression qualifier;
+    if (callExpression instanceof PsiMethodCallExpression) {
+      qualifier = ((PsiMethodCallExpression)callExpression).getMethodExpression().getQualifierExpression();
+    }
+    else if (callExpression instanceof PsiNewExpression) {
+      qualifier = ((PsiNewExpression)callExpression).getQualifier();
+    }
+    else {
+      qualifier = null;
+    }
+
+    if (expressions.length == 0 && parameters.length == 0) {
+      return true;
+    }
+
+    final int offset = parameters.length - calledParametersCount;
+    if (expressions.length > calledParametersCount || offset < 0) {
+      return false;
+    }
+
     for (int i = 0; i < expressions.length; i++) {
       if (!resolvesToParameter(expressions[i], parameters[i + offset])) {
         return false;
       }
     }
-    if (offset > 0) {
-      final PsiExpression qualifier;
-      if (callExpression instanceof PsiMethodCallExpression) {
-        qualifier = ((PsiMethodCallExpression)callExpression).getMethodExpression().getQualifierExpression();
-      } 
-      else if (callExpression instanceof PsiNewExpression) {
-        qualifier = ((PsiNewExpression)callExpression).getQualifier();
-      }
-      else {
-        return false;
-      }
 
-      if (!resolvesToParameter(qualifier, parameters[0])) {
-        return false;
-      }
-    }
-    return true;
+    return offset == 0 || resolvesToParameter(qualifier, parameters[0]);
   }
 
   private static boolean resolvesToParameter(PsiExpression expression, PsiParameter parameter) {
index bc9a1d9ae011e438dc538f2dc4a5e7fc67762676..e0b64135f9ddac9333608d0923ae8063a740e2c3 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -34,7 +35,7 @@ import com.intellij.util.containers.IntArrayList;
 import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Collection;
+import java.util.*;
 
 /**
  * User: anna
@@ -92,26 +93,14 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
                                                PsiBreakStatement.class, PsiReturnStatement.class, PsiThrowStatement.class);
                 if (exitPoints.isEmpty()) {
   
-                  final boolean[] effectivelyFinal = {true};
-                  body.accept(new JavaRecursiveElementWalkingVisitor() {
-                    @Override
-                    public void visitElement(PsiElement element) {
-                      if (!effectivelyFinal[0]) return;
-                      super.visitElement(element);
+                  final List<PsiVariable> usedVariables = ControlFlowUtil.getUsedVariables(controlFlow, startOffset, endOffset);
+                  for (PsiVariable variable : usedVariables) {
+                    if (!HighlightControlFlowUtil.isEffectivelyFinal(variable, body, null)) {
+                      return;
                     }
-  
-                    @Override
-                    public void visitReferenceExpression(PsiReferenceExpression expression) {
-                      if (!effectivelyFinal[0]) return;
-                      super.visitReferenceExpression(expression);
-                      final PsiElement resolve = expression.resolve();
-                      if (resolve instanceof PsiVariable && !(resolve instanceof PsiField)) {
-                        effectivelyFinal[0] = HighlightControlFlowUtil.isEffectivelyFinal((PsiVariable)resolve, body, expression);
-                      }
-                    }
-                  });
-  
-                  if (effectivelyFinal[0] && ExceptionUtil.getThrownCheckedExceptions(new PsiElement[] {body}).isEmpty()) {
+                  }
+
+                  if (ExceptionUtil.getThrownCheckedExceptions(new PsiElement[] {body}).isEmpty()) {
                     if (isCollectCall(body)) {
                       holder.registerProblem(iteratedValue, "Can be replaced with collect call",
                                              ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithCollectCallFix());
@@ -132,8 +121,8 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
   }
 
   private static boolean isCollectCall(PsiStatement body) {
-    final PsiIfStatement ifStatement = extractIfStatement(body);
-    final PsiMethodCallExpression methodCallExpression = extractAddCall(body);
+    PsiIfStatement ifStatement = extractIfStatement(body);
+    final PsiMethodCallExpression methodCallExpression = extractAddCall(body, ifStatement);
     if (methodCallExpression != null) {
       final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
       final PsiExpression qualifierExpression = methodExpression.getQualifierExpression();
@@ -150,9 +139,10 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
       if (qualifierClass != null && 
           InheritanceUtil.isInheritor(qualifierClass, false, CommonClassNames.JAVA_UTIL_COLLECTION)) {
 
-        if (ifStatement != null) {
+        while (ifStatement != null && PsiTreeUtil.isAncestor(body, ifStatement, false)) {
           final PsiExpression condition = ifStatement.getCondition();
           if (condition != null && isConditionDependsOnUpdatedCollections(condition, qualifierExpression)) return false;
+          ifStatement = PsiTreeUtil.getParentOfType(ifStatement, PsiIfStatement.class);
         }
 
         final PsiElement resolve = methodExpression.resolve();
@@ -276,16 +266,12 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
           String foreEachText = wrapInBlock(body);
           String iterated = getIteratedValueText(iteratedValue);
           if (ifStmt != null) {
-            final PsiExpression condition = ifStmt.getCondition();
-            if (condition != null) {
-              final PsiStatement thenBranch = ifStmt.getThenBranch();
-              LOG.assertTrue(thenBranch != null);
-              if (InheritanceUtil.isInheritor(iteratedValue.getType(), CommonClassNames.JAVA_UTIL_COLLECTION)) {
-                body = thenBranch;
-                foreEachText = wrapInBlock(thenBranch);
-                iterated += ".stream().filter(" + parameter.getName() + " -> " + condition.getText() +")";
-              }
-            }
+            final PsiStatement thenBranch = ifStmt.getThenBranch();
+            LOG.assertTrue(thenBranch != null);
+            foreEachText = wrapInBlock(thenBranch);
+            iterated += ".stream()";
+            iterated += composeFilters(body, parameter, ifStmt);
+            body = thenBranch;
           }
 
           final PsiParameter[] parameters = {parameter};
@@ -356,16 +342,12 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
         final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
         if (body != null && iteratedValue != null) {
           final PsiParameter parameter = foreachStatement.getIterationParameter();
+          String iteration = getIteratedValueText(iteratedValue) + ".stream()";
 
           final PsiIfStatement ifStatement = extractIfStatement(body);
-          final PsiMethodCallExpression methodCallExpression = extractAddCall(body);
-          String iteration = getIteratedValueText(iteratedValue) + ".stream()";
-          if (ifStatement != null) {
-            final PsiExpression condition = ifStatement.getCondition();
-            if (condition != null) {
-              iteration += ".filter(" + parameter.getName() + " -> " + condition.getText() +")";
-            }
-          }
+          final PsiMethodCallExpression methodCallExpression = extractAddCall(body, ifStatement);
+          iteration += composeFilters(body, parameter, ifStatement);
+
           final PsiExpression mapperCall = methodCallExpression.getArgumentList().getExpressions()[0];
           if (!isIdentityMapping(parameter, mapperCall)) {
             iteration +=".map(";
@@ -443,6 +425,19 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
     }
   }
 
+  private static String composeFilters(PsiStatement body, PsiParameter parameter, PsiIfStatement ifStatement) {
+    final List<String> filters = new ArrayList<String>();
+    while (ifStatement != null && PsiTreeUtil.isAncestor(body, ifStatement, false)) {
+      final PsiExpression condition = ifStatement.getCondition();
+      if (condition != null) {
+        filters.add(".filter(" + parameter.getName() + " -> " + condition.getText() +")");
+      }
+      ifStatement = PsiTreeUtil.getParentOfType(ifStatement, PsiIfStatement.class);
+    }
+    Collections.reverse(filters);
+    return StringUtil.join(filters, "");
+  }
+
   private static String getIteratedValueText(PsiExpression iteratedValue) {
     return iteratedValue instanceof PsiCallExpression ||
            iteratedValue instanceof PsiReferenceExpression ||
@@ -450,26 +445,31 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
            iteratedValue instanceof PsiParenthesizedExpression ? iteratedValue.getText() : "(" + iteratedValue.getText() + ")";
   }
 
-  public static PsiIfStatement extractIfStatement(PsiStatement body) {
+  private static PsiIfStatement extractIfStatement(PsiStatement body) {
     PsiIfStatement ifStmt = null;
     if (body instanceof PsiIfStatement) {
       ifStmt = (PsiIfStatement)body;
-    } else if (body instanceof PsiBlockStatement) {
+    }
+    else if (body instanceof PsiBlockStatement) {
       final PsiStatement[] statements = ((PsiBlockStatement)body).getCodeBlock().getStatements();
       if (statements.length == 1 && statements[0] instanceof PsiIfStatement) {
         ifStmt = (PsiIfStatement)statements[0];
       }
     }
-    if (ifStmt != null && ifStmt.getElseBranch() == null && ifStmt.getThenBranch() != null) {
-      return ifStmt;
+    if (ifStmt != null && ifStmt.getElseBranch() == null && ifStmt.getCondition() != null) {
+      final PsiStatement thenBranch = ifStmt.getThenBranch();
+      if (thenBranch != null) {
+        final PsiIfStatement deeperThen = extractIfStatement(thenBranch);
+        return deeperThen != null ? deeperThen : ifStmt;
+      }
     }
     return null;
   }
   
-  private static PsiMethodCallExpression extractAddCall(PsiStatement body) {
-    final PsiIfStatement ifStatement = extractIfStatement(body);
+  private static PsiMethodCallExpression extractAddCall(PsiStatement body, PsiIfStatement ifStatement) {
     if (ifStatement != null) {
-      return extractAddCall(ifStatement.getThenBranch());
+      final PsiStatement thenBranch = ifStatement.getThenBranch();
+      return extractAddCall(thenBranch, null);
     }
     PsiExpressionStatement stmt = null;
     if (body instanceof PsiBlockStatement) {
index 61d018f2f5aed9d47c715715484e220cb9764973..5919ad6e6bb430d59a7305e79aff712f9ec33c28 100644 (file)
@@ -203,13 +203,6 @@ abstract class Analysis<Res> {
   public static final int STEPS_LIMIT = 30000;
   public static final int EQUATION_SIZE_LIMIT = 30;
 
-  protected static final ThreadLocal<State[]> ourPendingStates = new ThreadLocal<State[]>() {
-    @Override
-    protected State[] initialValue() {
-      return new State[STEPS_LIMIT];
-    }
-  };
-
   final RichControlFlow richControlFlow;
   final Direction direction;
   final ControlFlowGraph controlFlow;
index 900c137c7c1f52ab97b60c48d6294ea4d9c99ed0..97d7b390987a4c8525f61f104b3195dcd1349529 100644 (file)
@@ -77,6 +77,13 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
 
   public static Map<Key, List<Equation<Key, Value>>> processClass(final ClassReader classReader, final String presentableUrl) {
 
+    // It is OK to share pending states, actions and results for analyses.
+    // Analyses are designed in such a way that they first write to states/actions/results and then read only those portion
+    // of states/actions/results which were written by the current pass of the analysis.
+    // Since states/actions/results are quite expensive to create (32K array) for each analysis, we create them once per class analysis.
+    final State[] sharedPendingStates = new State[Analysis.STEPS_LIMIT];
+    final PendingAction[] sharedPendingActions = new PendingAction[Analysis.STEPS_LIMIT];
+    final PResults.PResult[] sharedResults = new PResults.PResult[Analysis.STEPS_LIMIT];
     final Map<Key, List<Equation<Key, Value>>> equations = new HashMap<Key, List<Equation<Key, Value>>>();
 
     classReader.accept(new ClassVisitor(Opcodes.ASM5) {
@@ -215,7 +222,7 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
 
         Equation<Key, Value> outEquation =
           isInterestingResult ?
-          new InOutAnalysis(richControlFlow, Out, origins, stable).analyze() :
+          new InOutAnalysis(richControlFlow, Out, origins, stable, sharedPendingStates).analyze() :
           null;
 
         if (isReferenceResult) {
@@ -229,7 +236,8 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
           if (ASMUtils.isReferenceType(argumentTypes[i])) {
             boolean possibleNPE = false;
             if (leakingParameters[i]) {
-              NonNullInAnalysis notNullInAnalysis = new NonNullInAnalysis(richControlFlow, new In(i, In.NOT_NULL_MASK), stable);
+              NonNullInAnalysis notNullInAnalysis =
+                new NonNullInAnalysis(richControlFlow, new In(i, In.NOT_NULL_MASK), stable, sharedPendingActions, sharedResults);
               Equation<Key, Value> notNullParamEquation = notNullInAnalysis.analyze();
               possibleNPE = notNullInAnalysis.possibleNPE;
               notNullParam = notNullParamEquation.rhs.equals(FINAL_NOT_NULL);
@@ -245,7 +253,7 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
                 result.add(new Equation<Key, Value>(new Key(method, new In(i, In.NULLABLE_MASK), stable), FINAL_TOP));
               }
               else {
-                result.add(new NullableInAnalysis(richControlFlow, new In(i, In.NULLABLE_MASK), stable).analyze());
+                result.add(new NullableInAnalysis(richControlFlow, new In(i, In.NULLABLE_MASK), stable, sharedPendingStates).analyze());
               }
             }
             else {
@@ -260,9 +268,9 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
                 }
                 else {
                   // may be null on some branch, running "null->..." analysis
-                  result.add(new InOutAnalysis(richControlFlow, new InOut(i, Value.Null), origins, stable).analyze());
+                  result.add(new InOutAnalysis(richControlFlow, new InOut(i, Value.Null), origins, stable, sharedPendingStates).analyze());
                 }
-                result.add(new InOutAnalysis(richControlFlow, new InOut(i, Value.NotNull), origins, stable).analyze());
+                result.add(new InOutAnalysis(richControlFlow, new InOut(i, Value.NotNull), origins, stable, sharedPendingStates).analyze());
               }
               else {
                 // parameter is not leaking, so a contract is the same as for the whole method
index 46ec090db16c1373307b9915c6a0259da8a95c46..2134b0b585e98c8802e6c9f96e0e7c34e02d17b9 100644 (file)
@@ -41,7 +41,7 @@ class InOutAnalysis extends Analysis<Result<Key, Value>> {
   static final ResultUtil<Key, Value> resultUtil =
     new ResultUtil<Key, Value>(new ELattice<Value>(Value.Bot, Value.Top));
 
-  final private State[] pending = ourPendingStates.get();
+  final private State[] pending;
   private final InOutInterpreter interpreter;
   private final Value inValue;
   private final int generalizeShift;
@@ -49,8 +49,9 @@ class InOutAnalysis extends Analysis<Result<Key, Value>> {
   private int id = 0;
   private int pendingTop = 0;
 
-  protected InOutAnalysis(RichControlFlow richControlFlow, Direction direction, boolean[] resultOrigins, boolean stable) {
+  protected InOutAnalysis(RichControlFlow richControlFlow, Direction direction, boolean[] resultOrigins, boolean stable, State[] pending) {
     super(richControlFlow, direction, stable);
+    this.pending = pending;
     interpreter = new InOutInterpreter(direction, richControlFlow.controlFlow.methodNode.instructions, resultOrigins);
     inValue = direction instanceof InOut ? ((InOut)direction).inValue : null;
     generalizeShift = (methodNode.access & ACC_STATIC) == 0 ? 1 : 0;
index 8bf3f5961a89dba4c8c883b7843c4df52eab75ac..28188fc4278677e6fa33151702ab2815dec1ef38 100644 (file)
@@ -167,30 +167,21 @@ class MakeResult implements PendingAction {
 }
 
 class NonNullInAnalysis extends Analysis<PResult> {
-  private static final ThreadLocal<PendingAction[]> ourPending = new ThreadLocal<PendingAction[]>() {
-    @Override
-    protected PendingAction[] initialValue() {
-      return new PendingAction[Analysis.STEPS_LIMIT];
-    }
-  };
-  private static final ThreadLocal<PResult[]> ourResults = new ThreadLocal<PResult[]>() {
-    @Override
-    protected PResult[] initialValue() {
-      return new PResult[Analysis.STEPS_LIMIT];
-    }
-  };
-
-  final private PendingAction[] pending = ourPending.get();
-
+  final private PendingAction[] pendingActions;
+  private final PResult[] results;
   private final NotNullInterpreter interpreter = new NotNullInterpreter();
-  private PResult[] results;
 
   // Flag saying that at some branch NPE was found. Used later as an evidence that this param is *NOT* @Nullable (optimization).
   boolean possibleNPE;
 
-  protected NonNullInAnalysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
+  protected NonNullInAnalysis(RichControlFlow richControlFlow,
+                              Direction direction,
+                              boolean stable,
+                              PendingAction[] pendingActions,
+                              PResult[] results) {
     super(richControlFlow, direction, stable);
-    results = ourResults.get();
+    this.pendingActions = pendingActions;
+    this.results = results;
   }
 
   PResult combineResults(PResult delta, int[] subResults) throws AnalyzerException {
@@ -232,7 +223,7 @@ class NonNullInAnalysis extends Analysis<PResult> {
       if (steps >= STEPS_LIMIT) {
         throw new AnalyzerException(null, "limit is reached, steps: " + steps + " in method " + method);
       }
-      PendingAction action = pending[--pendingTop];
+      PendingAction action = pendingActions[--pendingTop];
       if (action instanceof MakeResult) {
         MakeResult makeResult = (MakeResult) action;
         PResult result = combineResults(makeResult.subResult, makeResult.indices);
@@ -397,7 +388,7 @@ class NonNullInAnalysis extends Analysis<PResult> {
     if (pendingTop >= STEPS_LIMIT) {
       throw new AnalyzerException(null, "limit is reached in method " + method);
     }
-    pending[pendingTop++] = action;
+    pendingActions[pendingTop++] = action;
   }
 
   private void execute(Frame<BasicValue> frame, AbstractInsnNode insnNode) throws AnalyzerException {
@@ -418,12 +409,13 @@ class NonNullInAnalysis extends Analysis<PResult> {
 }
 
 class NullableInAnalysis extends Analysis<PResult> {
-  final private State[] pending = ourPendingStates.get();
+  final private State[] pending;
 
   private final NullableInterpreter interpreter = new NullableInterpreter();
 
-  protected NullableInAnalysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
+  protected NullableInAnalysis(RichControlFlow richControlFlow, Direction direction, boolean stable, State[] pending) {
     super(richControlFlow, direction, stable);
+    this.pending = pending;
   }
 
   @NotNull
index 5185d996f4eb140866645ac8e93b8f665b2675e0..941de66f8519e9fcb2f3656ea7e293594eda4ed9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -368,9 +368,8 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
     return isLibraryOverride(new HashSet<RefMethod>());
   }
 
-  private boolean isLibraryOverride(Collection<RefMethod> processed) {
-    if (processed.contains(this)) return false;
-    processed.add(this);
+  private boolean isLibraryOverride(@NotNull Collection<RefMethod> processed) {
+    if (!processed.add(this)) return false;
 
     if (checkFlag(IS_LIBRARY_OVERRIDE_MASK)) return true;
     for (RefMethod superMethod : getSuperMethods()) {
index 112add434e6b161c1793661d1a3a74b6b8951649..3d84f8760522fa2dfccd17e8ec9cfda1f22b23f6 100644 (file)
@@ -60,7 +60,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
   public boolean SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES = true;
   public boolean SUGGEST_PRIVATE_FOR_INNERS = false;
   private static final String DISPLAY_NAME = InspectionsBundle.message("inspection.visibility.display.name");
-  @NonNls private static final String SHORT_NAME = "WeakerAccess";
+  @NonNls public static final String SHORT_NAME = "WeakerAccess";
   private static final String CAN_BE_PRIVATE = InspectionsBundle.message("inspection.visibility.compose.suggestion", "private");
   private static final String CAN_BE_PACKAGE_LOCAL = InspectionsBundle.message("inspection.visibility.compose.suggestion", "package local");
   private static final String CAN_BE_PROTECTED = InspectionsBundle.message("inspection.visibility.compose.suggestion", "protected");
@@ -149,71 +149,71 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
                                                 @NotNull final InspectionManager manager,
                                                 @NotNull final GlobalInspectionContext globalContext,
                                                 @NotNull final ProblemDescriptionsProcessor processor) {
-    if (refEntity instanceof RefJavaElement) {
-      final RefJavaElement refElement = (RefJavaElement)refEntity;
+    if (!(refEntity instanceof RefJavaElement)) {
+      return null;
+    }
+    final RefJavaElement refElement = (RefJavaElement)refEntity;
 
-      if (refElement instanceof RefParameter) return null;
-      if (refElement.isSyntheticJSP()) return null;
+    if (refElement instanceof RefParameter) return null;
+    if (refElement.isSyntheticJSP()) return null;
 
-      //ignore entry points.
-      if (refElement.isEntry()) return null;
+    //ignore entry points.
+    if (refElement.isEntry()) return null;
 
-      //ignore implicit constructors. User should not be able to see them.
-      if (refElement instanceof RefImplicitConstructor) return null;
+    //ignore implicit constructors. User should not be able to see them.
+    if (refElement instanceof RefImplicitConstructor) return null;
 
-      if (refElement instanceof RefField) {
-        final Boolean isEnumConstant = refElement.getUserData(RefField.ENUM_CONSTANT);
-        if (isEnumConstant != null && isEnumConstant.booleanValue()) return null;
-      }
+    if (refElement instanceof RefField) {
+      final Boolean isEnumConstant = refElement.getUserData(RefField.ENUM_CONSTANT);
+      if (isEnumConstant != null && isEnumConstant.booleanValue()) return null;
+    }
 
-      //ignore library override methods.
-      if (refElement instanceof RefMethod) {
-        RefMethod refMethod = (RefMethod) refElement;
-        if (refMethod.isExternalOverride()) return null;
-        if (refMethod.isEntry()) return null;
-      }
+    //ignore library override methods.
+    if (refElement instanceof RefMethod) {
+      RefMethod refMethod = (RefMethod) refElement;
+      if (refMethod.isExternalOverride()) return null;
+    }
 
-      //ignore anonymous classes. They do not have access modifiers.
-      if (refElement instanceof RefClass) {
-        RefClass refClass = (RefClass) refElement;
-        if (refClass.isAnonymous() || refClass.isEntry() || refClass.isTestCase() || refClass.isServlet() || refClass.isApplet() || refClass.isLocalClass()) return null;
-        if (isTopLevelClass(refClass) && !SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES) return null;
-      }
+    //ignore anonymous classes. They do not have access modifiers.
+    if (refElement instanceof RefClass) {
+      RefClass refClass = (RefClass) refElement;
+      if (refClass.isAnonymous() || refClass.isTestCase() || refClass.isServlet() || refClass.isApplet() || refClass.isLocalClass()) return null;
+      if (isTopLevelClass(refClass) && !SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES) return null;
+    }
 
-      //ignore unreferenced code. They could be a potential entry points.
-      if (refElement.getInReferences().isEmpty()) return null;
+    //ignore unreferenced code. They could be a potential entry points.
+    if (refElement.getInReferences().isEmpty()) return null;
 
-      //ignore interface members. They always have public access modifier.
-      if (refElement.getOwner() instanceof RefClass) {
-        RefClass refClass = (RefClass) refElement.getOwner();
-        if (refClass.isInterface()) return null;
-      }
-      String access = getPossibleAccess(refElement);
-      if (access != refElement.getAccessModifier() && access != null) {
-        final PsiElement element = refElement.getElement();
-        final PsiElement nameIdentifier = element != null ? IdentifierUtil.getNameIdentifier(element) : null;
-        if (nameIdentifier != null) {
-          final String message;
-          String quickFixName = "Make " + ElementDescriptionUtil.getElementDescription(element, UsageViewTypeLocation.INSTANCE) + " ";
-          if (access.equals(PsiModifier.PRIVATE)) {
-            message = CAN_BE_PRIVATE;
-            quickFixName += PsiModifier.PRIVATE;
+    //ignore interface members. They always have public access modifier.
+    if (refElement.getOwner() instanceof RefClass) {
+      RefClass refClass = (RefClass) refElement.getOwner();
+      if (refClass.isInterface()) return null;
+    }
+    String access = getPossibleAccess(refElement);
+    if (access != refElement.getAccessModifier() && access != null) {
+      final PsiElement element = refElement.getElement();
+      final PsiElement nameIdentifier = element != null ? IdentifierUtil.getNameIdentifier(element) : null;
+      if (nameIdentifier != null) {
+        final String message;
+        String quickFixName = "Make " + ElementDescriptionUtil.getElementDescription(element, UsageViewTypeLocation.INSTANCE) + " ";
+        if (access.equals(PsiModifier.PRIVATE)) {
+          message = CAN_BE_PRIVATE;
+          quickFixName += PsiModifier.PRIVATE;
+        }
+        else {
+          if (access.equals(PsiModifier.PACKAGE_LOCAL)) {
+            message = CAN_BE_PACKAGE_LOCAL;
+            quickFixName += "package local";
           }
           else {
-            if (access.equals(PsiModifier.PACKAGE_LOCAL)) {
-              message = CAN_BE_PACKAGE_LOCAL;
-              quickFixName += "package local";
-            }
-            else {
-              message = CAN_BE_PROTECTED;
-              quickFixName += PsiModifier.PROTECTED;
-            }
+            message = CAN_BE_PROTECTED;
+            quickFixName += PsiModifier.PROTECTED;
           }
-          return new ProblemDescriptor[]{manager.createProblemDescriptor(nameIdentifier,
-                                                                         message,
-                                                                         new AcceptSuggestedAccess(globalContext.getRefManager(), access, quickFixName),
-                                                                         ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)};
         }
+        return new ProblemDescriptor[]{manager.createProblemDescriptor(nameIdentifier,
+                                                                       message,
+                                                                       new AcceptSuggestedAccess(globalContext.getRefManager(), access, quickFixName),
+                                                                       ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)};
       }
     }
     return null;
@@ -221,8 +221,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
 
   @Nullable
   @PsiModifier.ModifierConstant
-  private String getPossibleAccess(@Nullable RefJavaElement refElement) {
-    if (refElement == null) return null;
+  private String getPossibleAccess(@NotNull RefJavaElement refElement) {
     String curAccess = refElement.getAccessModifier();
     String weakestAccess = PsiModifier.PRIVATE;
 
@@ -546,7 +545,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
   @Override
   @Nullable
   public String getHint(@NotNull final QuickFix fix) {
-    return ((AcceptSuggestedAccess)fix).getHint();
+    return ((AcceptSuggestedAccess)fix).myHint;
   }
 
   private static class AcceptSuggestedAccess implements LocalQuickFix{
@@ -610,9 +609,5 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
         }
       }
     }
-
-    public String getHint() {
-      return myHint;
-    }
   }
 }
index ecb0a9b5f18f8b6ee5ee47031bc8619b0f25250c..ef5544775adb3d63573b56af425a4bcda5dcd9a9 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.ui.components.JBTabbedPane;
+import org.jetbrains.annotations.TestOnly;
 
 import javax.swing.*;
 import java.awt.*;
@@ -31,6 +32,14 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase {
+  @TestOnly
+  public UnusedDeclarationInspection(boolean enabledInEditor) {
+    super(enabledInEditor);
+  }
+
+  public UnusedDeclarationInspection() {
+  }
+
   @Override
   protected UnusedSymbolLocalInspectionBase createUnusedSymbolLocalInspection() {
     return new UnusedSymbolLocalInspection();
index 4bccec21ec7ed12c5680137ca9eced2bd17e09db..da011319c80fbf5a6a494a597f54fffcdedcd5d9 100644 (file)
@@ -180,7 +180,9 @@ public class JavaQualifiedNameProvider implements QualifiedNameProvider {
 
       toInsert = targetElement.getName();
       if (targetElement instanceof PsiMethod) {
-        suffix = "()";
+        if (!fqn.contains("(")) {
+          suffix = "()";
+        }
         if (((PsiMethod)targetElement).isConstructor()) {
           targetElement = targetElement.getContainingClass();
         }
index 24ada216c0d9718fe59f397b4282d027ce7d7438..00c9967fdcd4543553b3f5d3c48ca7c8220b5d84 100644 (file)
@@ -30,6 +30,7 @@ import com.intellij.psi.impl.PsiSuperMethodImplUtil;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.PsiSearchScopeUtil;
 import com.intellij.psi.search.PsiShortNamesCache;
+import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.Processor;
@@ -89,19 +90,24 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
     return member.getContainingFile().getVirtualFile() != null;
   }
 
-  private static boolean hasSuperMethod(PsiMethod method, GlobalSearchScope scope, Condition<PsiMember> qualifiedMatcher) {
-    PsiClass containingClass = method.getContainingClass();
+  private static boolean hasSuperMethod(final PsiMethod method, final GlobalSearchScope scope, final Condition<PsiMember> qualifiedMatcher) {
+    final PsiClass containingClass = method.getContainingClass();
     if (containingClass == null) return false;
 
-    for (PsiMethod candidate : containingClass.findMethodsByName(method.getName(), true)) {
-      if (candidate.getContainingClass() != containingClass &&
-          PsiSearchScopeUtil.isInScope(scope, candidate) &&
-          qualifiedMatcher.value(candidate) &&
-          PsiSuperMethodImplUtil.isSuperMethodSmart(method, candidate)) {
+    // avoid using hierarchical findMethodsByName because we only want to check the given method hierarchy, without its siblings  
+    return !InheritanceUtil.processSupers(containingClass, false, new Processor<PsiClass>() {
+      @Override
+      public boolean process(PsiClass superClass) {
+        if (PsiSearchScopeUtil.isInScope(scope, superClass)) {
+          for (PsiMethod candidate : superClass.findMethodsByName(method.getName(), false)) {
+            if (qualifiedMatcher.value(candidate) && PsiSuperMethodImplUtil.isSuperMethodSmart(method, candidate)) {
+              return false;
+            }
+          }
+        }
         return true;
       }
-    }
-    return false;
+    });
   }
 
   public void processNames(@NotNull Processor<String> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter filter) {
index 0b760502384a6211edfa5f83d54b3df116b270fb..af2893077386a978f23493326e840768bd664fe3 100644 (file)
@@ -712,11 +712,21 @@ public class ExtractMethodProcessor implements MatchProvider {
             (PsiMethodCallExpression)((PsiAssignmentExpression)assignmentExpression.getExpression()).getRExpression().replace(myMethodCall);
         }
         declareNecessaryVariablesAfterCall(myOutputVariable);
-        PsiIfStatement ifStatement =
-          (PsiIfStatement)myElementFactory.createStatementFromText(myHasReturnStatementOutput || (myGenerateConditionalExit && myFirstExitStatementCopy instanceof PsiReturnStatement &&
-                                                                                                  ((PsiReturnStatement)myFirstExitStatementCopy).getReturnValue() != null)
-                                                                   ? "if (" + varName + "==null) return null;"
-                                                                   : "if (" + varName + "==null) return;", null);
+        PsiIfStatement ifStatement;
+        if (myHasReturnStatementOutput) {
+          ifStatement = (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) return null;", null);
+        }
+        else if (myGenerateConditionalExit) {
+          if (myFirstExitStatementCopy instanceof PsiReturnStatement && ((PsiReturnStatement)myFirstExitStatementCopy).getReturnValue() != null) {
+            ifStatement = (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) return null;", null);
+          } 
+          else {
+            ifStatement = (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) " + myFirstExitStatementCopy.getText(), null);
+          }
+        }
+        else {
+          ifStatement = (PsiIfStatement)myElementFactory.createStatementFromText("if (" + varName + "==null) return;", null);
+        }
         ifStatement = (PsiIfStatement)addToMethodCallLocation(ifStatement);
         CodeStyleManager.getInstance(myProject).reformat(ifStatement);
       }
index e7f6d5706b9c02c32b83a947d65bf7b448494789..e711aa01b2b3a2feeffe1c8feb1bc6c6824fbe0a 100644 (file)
@@ -215,6 +215,15 @@ public class PsiTypesUtil {
     }
     else if (PsiUtil.isCondition(methodCall, parent)) {
       return PsiType.BOOLEAN.getBoxedType(parent);
+    } 
+    else if (parent instanceof PsiArrayInitializerExpression) {
+      final PsiElement gParent = parent.getParent();
+      if (gParent instanceof PsiNewExpression) {
+        final PsiType type = ((PsiNewExpression)gParent).getType();
+        if (type instanceof PsiArrayType) {
+          return ((PsiArrayType)type).getComponentType();
+        }
+      }
     }
     return null;
   }
index ccb606d51376ddf5bb9d471e56d5b20e440fa3cf..eca80b6ee824d5f9bd592e5548ee5479f5541025 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -341,6 +342,47 @@ public class RedundantCastUtil {
               }
             }
           }
+          else if (arg instanceof PsiLambdaExpression) {
+            final PsiType interfaceType = ((PsiLambdaExpression)arg).getFunctionalInterfaceType();
+            if (interfaceType != null) {
+              List<PsiExpression> expressions = LambdaUtil.getReturnExpressions((PsiLambdaExpression)arg);
+              for (int returnExprIdx = 0; returnExprIdx < expressions.size(); returnExprIdx++) {
+                PsiExpression returnExpression = deparenthesizeExpression(expressions.get(returnExprIdx));
+                if (returnExpression instanceof PsiTypeCastExpression) {
+                  processLambdaReturnExpression(expression, i, interfaceType, (PsiTypeCastExpression)returnExpression, returnExprIdx,
+                                                    new Function<PsiExpression, PsiTypeCastExpression>() {
+                                                      @Override
+                                                      public PsiTypeCastExpression fun(PsiExpression expression) {
+                                                        return (PsiTypeCastExpression)expression;
+                                                      }
+                                                    });
+                }
+                else if (returnExpression instanceof PsiConditionalExpression) {
+                  final PsiExpression thenExpression = ((PsiConditionalExpression)returnExpression).getThenExpression();
+                  if (thenExpression instanceof PsiTypeCastExpression) {
+                    processLambdaReturnExpression(expression, i, interfaceType, (PsiTypeCastExpression)thenExpression,
+                                                  returnExprIdx, new Function<PsiExpression, PsiTypeCastExpression>() {
+                                                    @Override
+                                                    public PsiTypeCastExpression fun(PsiExpression expression) {
+                                                      return (PsiTypeCastExpression)((PsiConditionalExpression)expression).getThenExpression();
+                                                    }
+                                                  });
+                  }
+
+                  final PsiExpression elseExpression = ((PsiConditionalExpression)returnExpression).getElseExpression();
+                  if (elseExpression instanceof PsiTypeCastExpression) {
+                    processLambdaReturnExpression(expression, i, interfaceType, (PsiTypeCastExpression)elseExpression,
+                                                  returnExprIdx, new Function<PsiExpression, PsiTypeCastExpression>() {
+                                                    @Override
+                                                    public PsiTypeCastExpression fun(PsiExpression expression) {
+                                                      return (PsiTypeCastExpression)((PsiConditionalExpression)expression).getElseExpression();
+                                                    }
+                                                  });
+                  }
+                }
+              }
+            }
+          }
         }
       }
       catch (IncorrectOperationException e) {
@@ -360,6 +402,29 @@ public class RedundantCastUtil {
       }
     }
 
+    private void processLambdaReturnExpression(PsiCall expression,
+                                               int i,
+                                               PsiType interfaceType,
+                                               PsiTypeCastExpression returnExpression,
+                                               int returnExprIdx,
+                                               Function<PsiExpression, PsiTypeCastExpression> computeCastExpression) {
+      final PsiCall newCall = (PsiCall)expression.copy();
+      final PsiExpressionList newArgsList = newCall.getArgumentList();
+      LOG.assertTrue(newArgsList != null);
+      final PsiExpression[] newArgs = newArgsList.getExpressions();
+      final PsiLambdaExpression lambdaExpression = (PsiLambdaExpression)deparenthesizeExpression(newArgs[i]);
+      LOG.assertTrue(lambdaExpression != null, newCall);
+      final PsiExpression newReturnExpression = deparenthesizeExpression(LambdaUtil.getReturnExpressions(lambdaExpression).get(returnExprIdx));
+      PsiTypeCastExpression castExpression = computeCastExpression.fun(newReturnExpression);
+      PsiExpression castOperand = castExpression.getOperand();
+      if (castOperand == null) return;
+      castExpression.replace(castOperand);
+      final PsiType functionalInterfaceType = lambdaExpression.getFunctionalInterfaceType();
+      if (interfaceType.equals(functionalInterfaceType)) {
+        addToResults(returnExpression);
+      }
+    }
+
     @Override public void visitTypeCastExpression(PsiTypeCastExpression typeCast) {
       PsiExpression operand = typeCast.getOperand();
       if (operand == null) return;
@@ -404,7 +469,7 @@ public class RedundantCastUtil {
             return;
           }
 
-          final PsiType functionalInterfaceType = LambdaUtil.getFunctionalInterfaceType(typeCast, true);
+          final PsiType functionalInterfaceType = PsiTypesUtil.getExpectedTypeByParent(typeCast);
           if (topCastType != null && functionalInterfaceType != null && !TypeConversionUtil.isAssignable(topCastType, functionalInterfaceType, false)) return;
         }
         processAlreadyHasTypeCast(typeCast);
@@ -456,6 +521,15 @@ public class RedundantCastUtil {
       if (parent instanceof PsiReturnStatement) return;
       if (parent instanceof PsiTypeCastExpression) return;
 
+      if (parent instanceof PsiLambdaExpression) return;
+
+      if (parent instanceof PsiConditionalExpression) {
+        PsiElement gParent = PsiUtil.skipParenthesizedExprUp(parent.getParent());
+        if (gParent instanceof PsiLambdaExpression) return;
+        if (gParent instanceof PsiReturnStatement && 
+            PsiTreeUtil.getParentOfType(gParent, PsiMethod.class, PsiLambdaExpression.class) instanceof PsiLambdaExpression) return;
+      }
+
       if (isTypeCastSemantic(typeCast)) return;
 
       PsiTypeElement typeElement = typeCast.getCastType();
index 22beb02e68b8ed9b97a4fb1cae17363b98f7a2fa..008216b63e066aba353743424c2c46d2a3786389 100644 (file)
@@ -1395,7 +1395,8 @@ public class InferenceSession {
   }
 
   public PsiType substituteWithInferenceVariables(PsiType type) {
-    return myInferenceSubstitution.substitute(type);
+    final PsiType substituted = myInferenceSubstitution.substitute(type);
+    return isProperType(substituted) ? type : substituted;
   }
 
   public InferenceSession findNestedCallSession(PsiExpression arg) {
index 1481238b8dfd6009b7d96580cc203f453b2604a2..cc7a64dc7d960227b9ce9171904eed1fd5409950 100644 (file)
@@ -126,8 +126,11 @@ public class PsiPolyExpressionUtil {
   }
 
   private static boolean isInAssignmentOrInvocationContext(PsiExpression expr) {
-    final PsiElement context = expr.getParent();
-    return context instanceof PsiExpressionList || context instanceof PsiConditionalExpression || isAssignmentContext(expr, context);
+    final PsiElement context = PsiUtil.skipParenthesizedExprUp(expr.getParent());
+    return context instanceof PsiExpressionList || 
+           context instanceof PsiArrayInitializerExpression || 
+           context instanceof PsiConditionalExpression || 
+           isAssignmentContext(expr, context);
   }
 
   private static boolean isAssignmentContext(PsiExpression expr, PsiElement context) {
index f8712565c0ec3f9a606c4dfbf82b63ded1e10b6d..4fd37b6c0e933c672a552c45b155d8a2be8aac24 100644 (file)
@@ -10,6 +10,7 @@ annotation.missing.attribute={0} missing though required
 annotation.not.applicable=''@{0}'' not applicable to {1}
 annotation.non.constant.attribute.value=Attribute value must be constant
 annotation.non.class.literal.attribute.value=Attribute value must be a class literal
+annotation.non.enum.constant.attribute.value=Attribute value must be an enum constant
 annotation.invalid.annotation.member.type=Invalid type for annotation member
 annotation.cyclic.element.type=Cyclic annotation element type
 annotation.annotation.type.expected=Annotation type expected
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/enumValues.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/enumValues.java
new file mode 100644 (file)
index 0000000..57b0983
--- /dev/null
@@ -0,0 +1,12 @@
+class EnumExample {
+  static @interface MyAnnotation {
+    MyEnum enumValue();
+  }
+
+  static enum MyEnum { E }
+
+  static final MyEnum E = MyEnum.E;
+
+  @MyAnnotation(enumValue = <error descr="Attribute value must be an enum constant">E</error>)
+  void method() {}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/ExpectedTypeFromOuterArrayCreation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/ExpectedTypeFromOuterArrayCreation.java
new file mode 100644 (file)
index 0000000..6524bab
--- /dev/null
@@ -0,0 +1,9 @@
+class Test {
+  public <T> T f() {
+    return null;
+  }
+
+  public Object foo() {
+    return true ? new String[]{f()} : new String[][]{f()};
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA132725.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA132725.java
new file mode 100644 (file)
index 0000000..263a7c8
--- /dev/null
@@ -0,0 +1,18 @@
+import java.util.*;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+
+abstract class Example {
+  interface PriceList {}
+  List<PriceList> findByTags(List<String> tags, Date date) {
+    return copyOf(findMatching(tags).stream().filter(isActive(date)).collect(toList()));
+  }
+
+  protected abstract Predicate<PriceList> isActive(Date date);
+  protected abstract List<PriceList> findMatching(List<String> tags);
+  protected abstract <E> List<E> copyOf(Collection<? extends E> e);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/EnsureThatCapturedWildcardsAreNotOpenWithoutAnyReason.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/EnsureThatCapturedWildcardsAreNotOpenWithoutAnyReason.java
new file mode 100644 (file)
index 0000000..b55fa7e
--- /dev/null
@@ -0,0 +1,9 @@
+import java.util.*;
+import java.util.stream.Stream;
+
+abstract class Example {
+  abstract <E> Optional<E> findById(Class<E> type);
+  void main(Stream<Class<? extends String>> stream) {
+    stream.map(this::findById).map(Optional::get);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/redundantCast/LambdaReturnExpressions.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/redundantCast/LambdaReturnExpressions.java
new file mode 100644 (file)
index 0000000..9222b98
--- /dev/null
@@ -0,0 +1,40 @@
+import java.util.function.Supplier;
+
+class Main {
+  private static void boom() {}
+  private static <R> void map (Supplier<R> fn) {}
+  private static     void map1(Supplier<Runnable> fn) {}
+
+  public static void main(String[] args) {
+    Runnable r = () -> {};
+    map(() -> (Runnable) Main::boom );
+    map(() -> true ? (Runnable) Main::boom : (Runnable) Main::boom );
+    map(() -> {
+      return true ? (Runnable) Main::boom : (Runnable) Main::boom;
+    });
+
+    map(() -> true ? (Runnable) Main::boom : r );
+    map(() -> (true ? (Runnable)(Main::boom) : r));
+
+    map(() -> {
+      if (true) {
+        return (Runnable) Main::boom;
+      }
+      return (Runnable) Main::boom;
+    });
+
+    map1(() -> (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom);
+    map1(() -> true ? (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom : (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom);
+    map1(() -> {
+      return true ? (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom : (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom;
+    });
+    map1(() ->  true ? (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom : r);
+    map1(() -> (true ? (<warning descr="Casting '(Main::boom)' to 'Runnable' is redundant">Runnable</warning>) (Main::boom) : r));
+    map1(() -> {
+      if (true) {
+        return (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom;
+      }
+      return (<warning descr="Casting 'Main::boom' to 'Runnable' is redundant">Runnable</warning>) Main::boom;
+    });
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterVarargsCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterVarargsCall.java
new file mode 100644 (file)
index 0000000..a722989
--- /dev/null
@@ -0,0 +1,9 @@
+// "Replace lambda with method reference" "true"
+class Example {
+  public void m(String... s) {
+  }
+
+  {
+    Runnable r = this::m;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall.java
new file mode 100644 (file)
index 0000000..42a2755
--- /dev/null
@@ -0,0 +1,9 @@
+// "Replace lambda with method reference" "true"
+class Example {
+  public void m(String... s) {
+  }
+
+  {
+    Runnable r = () -> <caret>m();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCall1.java
new file mode 100644 (file)
index 0000000..04dd04e
--- /dev/null
@@ -0,0 +1,9 @@
+// "Replace lambda with method reference" "false"
+class Example {
+  public void m(String ss, String... s) {
+  }
+
+  {
+    Runnable r = () -> <caret>m("", "");
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCallMoreArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeVarargsCallMoreArgs.java
new file mode 100644 (file)
index 0000000..1d1261a
--- /dev/null
@@ -0,0 +1,12 @@
+// "Replace lambda with method reference" "false"
+import java.util.function.Function;
+class Example {
+  public String m(String... s) {
+    return "";
+  }
+
+  {
+    Function<String, String> r = (s) -> m(s, s);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalNestedFilters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalNestedFilters.java
new file mode 100644 (file)
index 0000000..64b2990
--- /dev/null
@@ -0,0 +1,10 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  {
+      foo.stream().filter(s -> s != null).filter(s -> s.startsWith("a")).forEach(System.out::println);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalNestedFilters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalNestedFilters.java
new file mode 100644 (file)
index 0000000..8fdea88
--- /dev/null
@@ -0,0 +1,16 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  {
+    for (String s : fo<caret>o) {
+      if (s != null) {
+        if (s.startsWith("a")) {
+          System.out.println(s);
+        }
+      }
+    }
+  }
+}
diff --git a/java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak.java b/java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak.java
new file mode 100644 (file)
index 0000000..08ef1b5
--- /dev/null
@@ -0,0 +1,24 @@
+import java.util.List;
+
+class Test {
+  List<Pojo> things;
+
+  void foo() {
+    while(true) {
+      <selection>Pojo x = things.get(0);
+
+      if(x.it > 0) {
+        break;
+      }
+      things.remove(x);</selection> 
+      System.out.println(x.it);
+    }
+  }
+
+  static class Pojo {
+    double it;
+    Pojo(double w) {
+      it = w;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak_after.java b/java/java-tests/testData/refactoring/extractMethod/NullableCheckBreak_after.java
new file mode 100644 (file)
index 0000000..dab162d
--- /dev/null
@@ -0,0 +1,30 @@
+import java.util.List;
+
+class Test {
+  List<Pojo> things;
+
+  void foo() {
+    while(true) {
+        Pojo x = newMethod();
+        if (x == null) break; 
+      System.out.println(x.it);
+    }
+  }
+
+    private Pojo newMethod() {
+        Pojo x = things.get(0);
+
+        if(x.it > 0) {
+            return null;
+        }
+        things.remove(x);
+        return x;
+    }
+
+    static class Pojo {
+    double it;
+    Pojo(double w) {
+      it = w;
+    }
+  }
+}
\ No newline at end of file
index 3b4929d874a4b7d42a20116a744a4e4898c5b922..a5ef7e03d2870bc88d79498a743311c79d50cd10 100644 (file)
@@ -74,6 +74,24 @@ class Foo {
     performPaste()
     myFixture.checkResult "/** Foo#foo(java.util.List)<caret> */"
   }
+
+  public void "test paste overloaded signature to a comment"() {
+    myFixture.configureByText "a.java", """
+class Foo {
+  void foo<caret>(int a) {} //
+  void foo(int a, int b) {}
+}
+"""
+    performCopy()
+    myFixture.editor.caretModel.moveToOffset(myFixture.editor.document.text.indexOf('//') + 2)
+    performPaste()
+    myFixture.checkResult """
+class Foo {
+  void foo(int a) {} //Foo.foo(int)<caret>
+  void foo(int a, int b) {}
+}
+"""
+  }
   
   public void testFqnInImport() {
     myFixture.addClass("package foo; public class Foo {}")
index 43e90b84257b4a4642698fcdd041aae8d5a43d7d..a24408b7c77dbd35214ebf90e85b6b077bda1f3d 100644 (file)
@@ -49,6 +49,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
 
   public void testTypeAnnotations() { doTest8(false); }
   public void testRepeatable() { doTest8(false); }
+  public void testEnumValues() { doTest8(false); }
 
   private void doTest(boolean checkWarnings) {
     setLanguageLevel(LanguageLevel.JDK_1_7);
index cc02f8e523beb63a5bbf697ccd051ba1b8b57b7e..99b26e91ba0fa9c1696df35af4c176795a4a42f0 100644 (file)
@@ -434,6 +434,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
   }
 
+  public void testExpectedTypeFromOuterArrayCreation() throws Exception {
+    doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+  }
+
   public void testJavaUtilCollections_NoVerify() throws Exception {
     PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
     assertNotNull(collectionsClass);
index 5d26c0e46e6d2b356fc3dbe2adb24d1871cf648e..9ac53f437de38152302294289d67333fbc1e45f3 100644 (file)
@@ -77,11 +77,15 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    myUnusedDeclarationInspection = new UnusedDeclarationInspection();
+    myUnusedDeclarationInspection = new UnusedDeclarationInspection(isUnusedInspectionRequired());
     enableInspectionTool(myUnusedDeclarationInspection);
     setLanguageLevel(LanguageLevel.JDK_1_4);
   }
 
+  private boolean isUnusedInspectionRequired() {
+    return getTestName(false).contains("UnusedInspection");
+  }
+
   @NotNull
   @Override
   protected LocalInspectionTool[] configureLocalInspectionTools() {
@@ -226,14 +230,8 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
     }
   }
 
-  public void testUnusedNonPrivateMembers() {
-    try {
-      myUnusedDeclarationInspection.setEnabledInEditor(true);
-      doTest(true, false);
-    }
-    finally {
-      myUnusedDeclarationInspection.setEnabledInEditor(false);
-    }
+  public void testUnusedInspectionNonPrivateMembers() {
+    doTest(true, false);
   }
 
   public void testUnusedNonPrivateMembers2() {
@@ -281,33 +279,27 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
       myUnusedDeclarationInspection = new UnusedDeclarationInspectionBase();
     }
   }
-  public void testUnusedNonPrivateMembersReferencedFromText() {
-    try {
-      myUnusedDeclarationInspection.setEnabledInEditor(true);
-      doTest(true, false);
-      WriteCommandAction.runWriteCommandAction(null, new Runnable() {
-        @Override
-        public void run() {
-          PsiDirectory directory = myFile.getParent();
-          assertNotNull(myFile.toString(), directory);
-          PsiFile txt = directory.createFile("x.txt");
-          VirtualFile vFile = txt.getVirtualFile();
-          assertNotNull(txt.toString(), vFile);
-          try {
-            VfsUtil.saveText(vFile, "XXX");
-          }
-          catch (IOException e) {
-            throw new RuntimeException(e);
-          }
+  public void testUnusedInspectionNonPrivateMembersReferencedFromText() {
+    doTest(true, false);
+    WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
+      public void run() {
+        PsiDirectory directory = myFile.getParent();
+        assertNotNull(myFile.toString(), directory);
+        PsiFile txt = directory.createFile("x.txt");
+        VirtualFile vFile = txt.getVirtualFile();
+        assertNotNull(txt.toString(), vFile);
+        try {
+          VfsUtil.saveText(vFile, "XXX");
         }
-      });
+        catch (IOException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    });
 
-      List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
-      assertEmpty(infos);
-    }
-    finally {
-      myUnusedDeclarationInspection.setEnabledInEditor(false);
-    }
+    List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
+    assertEmpty(infos);
   }
 
   public void testNamesHighlighting() {
index 6cf226623f929273ace3d1192907390d229822a6..5ef7fe870644313c337bdee41142002eeacc62de 100644 (file)
@@ -64,7 +64,9 @@ public class LossyEncodingTest extends DaemonAnalyzerTestCase {
     doTest("Text.txt");
     Charset ascii = CharsetToolkit.forName("US-ASCII");
     VirtualFile myVFile = myFile.getVirtualFile();
+    FileDocumentManager.getInstance().saveAllDocuments();
     EncodingManager.getInstance().setEncoding(myVFile, ascii);
+    UIUtil.dispatchAllInvocationEvents(); // wait for reload requests to bubble up
     assertEquals(ascii, myVFile.getCharset());
     int start = myEditor.getCaretModel().getOffset();
     type((char)0x445);
@@ -126,6 +128,7 @@ public class LossyEncodingTest extends DaemonAnalyzerTestCase {
 
   public void testNativeEncoding() throws Exception {
     EncodingManager.getInstance().setNative2AsciiForPropertiesFiles(null, true);
+    UIUtil.dispatchAllInvocationEvents();
     configureByFile(BASE_PATH + "/" + "NativeEncoding.properties");
 
     doDoTest(true, false);
index acec098d6a5b61ead6e0edda185e9889e6550e2b..4d04b70256b19db637fc0890987fedc546796503 100644 (file)
@@ -256,7 +256,11 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
   }
 
   public void testUncheckedConversionWithRecursiveTypeParams() throws Exception {
-    doTest(false);
+    doTest();
+  }
+
+  public void testIDEA132725() throws Exception {
+    doTest();
   }
 
   private void doTest() throws Exception {
index ae5a97933ca8042b9aa4955d02c5d5971412aa1e..f66b9b95ad3b7394bfac4cd7e023227271528434 100644 (file)
@@ -18,6 +18,8 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
@@ -34,7 +36,13 @@ public class LambdaRedundantCastTest extends LightDaemonAnalyzerTestCase {
 
   public void testIntersection() { doTest(); }
   public void testSer() { doTest(); }
+  public void testLambdaReturnExpressions() { doTest(); }
   private void doTest() {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
   }
+
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
 }
index 2dcf81c64744be24056b5c59e54d11d969572f61..29c7756e1c4a33e77a70c7ee908fc9d3bcf1a4be 100644 (file)
@@ -326,6 +326,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
+  public void testEnsureThatCapturedWildcardsAreNotOpenWithoutAnyReason() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
index ce2d449f9cc0afa7101808569b86d91a081779cf..8012ee51a960b7250fad42e9df396aa5f695cef5 100644 (file)
@@ -69,6 +69,37 @@ public class PsiPolyExpressionUtilTest extends LightCodeInsightFixtureTestCase {
     assertFalse(PsiPolyExpressionUtil.isPolyExpression(psiExpression));
   }
 
+  public void testMethodCallInsideArrayCreation() throws Exception {
+    myFixture.configureByText("Foo.java", "import java.util.*;" +
+                                          "class Foo {" +
+                                          "  <T> T bar() {return null;}" +
+                                          "  void foo() {" +
+                                          "    String[] a = new String[] {ba<caret>r()};" +
+                                          "  }" +
+                                          "}");
+    final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
+    assertNotNull(elementAtCaret);
+    final PsiExpression psiExpression = PsiTreeUtil.getParentOfType(elementAtCaret, PsiMethodCallExpression.class);
+    assertInstanceOf(psiExpression, PsiMethodCallExpression.class);
+    assertTrue(PsiPolyExpressionUtil.isPolyExpression(psiExpression));
+  }
+
+  public void testConditional() throws Exception {
+    myFixture.configureByText("Foo.java", "import java.util.function.Supplier;" +
+                                          "class Foo {" +
+                                          "    private static <R> void map(Supplier<R> fn) {}\n" +
+                                          "    public static void main(String[] args) {\n" +
+                                          "        Runnable r = null;\n" +
+                                          "        map(() -> (true <caret>? r : r));\n" +
+                                          "    }" +
+                                          "}");
+    final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
+    assertNotNull(elementAtCaret);
+    final PsiExpression psiExpression = PsiTreeUtil.getParentOfType(elementAtCaret, PsiExpression.class);
+    assertInstanceOf(psiExpression, PsiConditionalExpression.class);
+    assertTrue(PsiPolyExpressionUtil.isPolyExpression(psiExpression));
+  }
+
   private PsiExpression findExpression(String textWithExpression) {
     myFixture.configureByText("Foo.java", "import java.util.*;" +
                                           "class Foo {" +
index b3be1f9f4feb9bfe92cacf161f20026e7863f229..93130e085e91d26e3bb4a26666b46b771aa6f1a7 100644 (file)
@@ -240,6 +240,43 @@ public class IndexTest extends CodeInsightTestCase {
       }
     });
   }
+  
+  public void _testCollectedPsiWithDocumentChangedCommittedAndChangedAgain() throws IOException {
+    VirtualFile dir = getVirtualFile(createTempDirectory());
+    PsiTestUtil.addSourceContentToRoots(myModule, dir);
+
+    final VirtualFile vFile = createChildData(dir, "Foo.java");
+    VfsUtil.saveText(vFile, "class Foo {}");
+
+    final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
+    assertNotNull(myJavaFacade.findClass("Foo", scope));
+    WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
+      public void run() {
+        PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(vFile);
+        assertNotNull(psiFile);
+
+        Document document = FileDocumentManager.getInstance().getDocument(vFile);
+        document.deleteString(0, document.getTextLength());
+        PsiDocumentManager.getInstance(myProject).commitAllDocuments();
+        document.insertString(0, " ");
+        //assertNotNull(myJavaFacade.findClass("Foo", scope));
+
+        psiFile = null;
+        PlatformTestUtil.tryGcSoftlyReachableObjects();
+        assertNull(((PsiManagerEx)PsiManager.getInstance(getProject())).getFileManager().getCachedPsiFile(vFile));
+
+        PsiClass foo = myJavaFacade.findClass("Foo", scope);
+        assertNotNull(foo);
+        assertTrue(foo.isValid());
+        assertEquals("class Foo {}", foo.getText());
+        assertTrue(foo.isValid());
+
+        PsiDocumentManager.getInstance(myProject).commitAllDocuments();
+        assertNull(myJavaFacade.findClass("Foo", scope));
+      }
+    });
+  }
 
   public void testSavedUncommittedDocument() throws IOException {
     VirtualFile dir = getVirtualFile(createTempDirectory());
index 07002255014a833ab27015f9f42beabace62edd6..2caded9f6e6355802d3d81e88f5a5d9f9460534d 100644 (file)
@@ -455,6 +455,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
     doTest();
   }
 
+  public void testNullableCheckBreak() throws Exception {
+    doTest();
+  }
+
   public void testSimpleArrayAccess() throws Exception {
     doTest();
   }
index 5b118680597de1aac6ab75cc51eae3d829f31f48..549e5cddb953c574d16fa905f60ad3101f305992 100644 (file)
@@ -220,6 +220,10 @@ final class BuildSession implements Runnable, CanceledStatus {
 
         if (storedFsData != null) {
           updateFsStateOnDisk(dataStorageRoot, storedFsData, myInitialFSDelta.getOrdinal());
+          LOG.info("No changes found since last build. Exiting.");
+          if (preloadedProject != null) {
+            preloadedProject.release();
+          }
           return;
         }
       }
index 75a2eca11e4328ae4a37c5845e1b5f272d73a686..c4488674602f7ff2ae1470aa951ead0a164cfb0d 100644 (file)
@@ -17,13 +17,16 @@ package com.intellij.codeHighlighting;
 
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.editor.colors.CodeInsightColors;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
 import com.intellij.openapi.editor.colors.TextAttributesKey;
 import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.util.Comparing;
-import com.intellij.util.ImageLoader;
+import com.intellij.ui.JBColor;
 import com.intellij.util.containers.HashMap;
+import com.intellij.util.ui.ColorIcon;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -35,10 +38,11 @@ public class HighlightDisplayLevel {
   private static final Map<HighlightSeverity, HighlightDisplayLevel> ourMap = new HashMap<HighlightSeverity, HighlightDisplayLevel>();
 
   public static final HighlightDisplayLevel GENERIC_SERVER_ERROR_OR_WARNING = new HighlightDisplayLevel(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING,
-                                                                                                        createIconByMask(CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING));
-  public static final HighlightDisplayLevel ERROR = new HighlightDisplayLevel(HighlightSeverity.ERROR, createIconByMask(CodeInsightColors.ERRORS_ATTRIBUTES));
-  public static final HighlightDisplayLevel WARNING = new HighlightDisplayLevel(HighlightSeverity.WARNING, createIconByMask(CodeInsightColors.WARNINGS_ATTRIBUTES));
-  public static final HighlightDisplayLevel DO_NOT_SHOW = new HighlightDisplayLevel(HighlightSeverity.INFORMATION, createIconByMask(new Color(30, 160, 0)));
+                                                                                                        createIconByKey(CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING));
+  public static final HighlightDisplayLevel ERROR = new HighlightDisplayLevel(HighlightSeverity.ERROR, createIconByKey(CodeInsightColors.ERRORS_ATTRIBUTES));
+  public static final HighlightDisplayLevel WARNING = new HighlightDisplayLevel(HighlightSeverity.WARNING, createIconByKey(CodeInsightColors.WARNINGS_ATTRIBUTES));
+  public static final Color GREEN = new JBColor(new Color(30, 160, 0), new Color(30, 160, 0));
+  public static final HighlightDisplayLevel DO_NOT_SHOW = new HighlightDisplayLevel(HighlightSeverity.INFORMATION, createIconByMask(GREEN));
   /**
    * use #WEAK_WARNING instead
    */
@@ -107,19 +111,14 @@ public class HighlightDisplayLevel {
     }
   }
 
-  public static class ImageHolder {
-    public static final Image ourErrorMaskImage = ImageLoader.loadFromResource("/general/errorMask.png");
-  }
-
   private static final int EMPTY_ICON_DIM = 12;
 
-  @NotNull
-  private static Icon createIconByMask(@NotNull TextAttributesKey key) {
-    Icon icon = createIconByMaskFromExtensions(key);
-    if (icon != null) return icon;
-    TextAttributes defaultAttributes = key.getDefaultAttributes();
-    if (defaultAttributes == null) defaultAttributes = TextAttributes.ERASE_MARKER;
-    return createIconByMask(defaultAttributes.getErrorStripeColor());
+  public static Icon createIconByKey(@NotNull TextAttributesKey key) {
+    for (IconCreator creator : Extensions.getExtensions(IconCreator.EXTENSION_POINT_NAME)) {
+      Icon icon = creator.createIcon(key);
+      if (icon != null) return icon;
+    }
+    return new SingleColorIcon(key);
   }
 
   public interface IconCreator {
@@ -128,35 +127,49 @@ public class HighlightDisplayLevel {
     Icon createIcon(@NotNull TextAttributesKey key);
   }
 
-  public static Icon createIconByMaskFromExtensions(@NotNull TextAttributesKey key) {
-    for (IconCreator creator : Extensions.getExtensions(IconCreator.EXTENSION_POINT_NAME)) {
-      Icon icon = creator.createIcon(key);
-      if (icon != null) return icon;
-    }
-    return null;
-  }
-
   @NotNull
   public static Icon createIconByMask(final Color renderColor) {
-    return new SingleColorIconWithMask(renderColor);
+    return new MyColorIcon(EMPTY_ICON_DIM, renderColor);
   }
 
-  public static class SingleColorIconWithMask implements Icon {
+  private static class MyColorIcon extends ColorIcon implements ColoredIcon {
+    public MyColorIcon(int size, @NotNull Color color) {
+      super(size, color);
+    }
 
-    private final Color myColor;
+    @Override
+    public Color getColor() {
+      return getIconColor();
+    }
+  } 
+  
+  public interface ColoredIcon {
+    Color getColor();
+  }
+  
+  public static class SingleColorIcon implements Icon, ColoredIcon {
+    private final TextAttributesKey myKey;
 
-    public SingleColorIconWithMask(final Color color) {
-      myColor = color;
+    public SingleColorIcon(final TextAttributesKey key) {
+      myKey = key;
     }
 
     public Color getColor() {
-      return myColor;
+      final EditorColorsManager manager = EditorColorsManager.getInstance();
+      if (manager != null) {
+        final EditorColorsScheme globalScheme = manager.getGlobalScheme();
+        return globalScheme.getAttributes(myKey).getErrorStripeColor();
+      }
+      TextAttributes defaultAttributes = myKey.getDefaultAttributes();
+      if (defaultAttributes == null) defaultAttributes = TextAttributes.ERASE_MARKER;
+      return  defaultAttributes.getErrorStripeColor();
     }
 
     @Override
     public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
       final Graphics2D g2 = (Graphics2D)g;
-      g2.drawImage(ImageHolder.ourErrorMaskImage, x, y, myColor, null);
+      g2.setColor(getColor());
+      g2.fillRect(x, y, EMPTY_ICON_DIM, EMPTY_ICON_DIM);
     }
 
     @Override
index b2164ea6a08b0cb083135814064d37e748a6ad13..00fa3f0f4cff595364416a35ee455543a8936b59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -30,7 +30,7 @@ public class DaemonCodeAnalyzerSettings {
   public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
   public boolean SUPPRESS_WARNINGS = true;
   public boolean SHOW_METHOD_SEPARATORS = false;
-  public int ERROR_STRIPE_MARK_MIN_HEIGHT = 3;
+  public int ERROR_STRIPE_MARK_MIN_HEIGHT = 2;
   public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
 
   @Transient
index 88f230f8f2d381872cfaddaf6ed5fd9de07d7d73..a297f76f51402421f20f903b9c7e52384a689c9e 100644 (file)
@@ -59,7 +59,7 @@ public class HighlightInfo implements Segment {
 
   public static final HighlightInfo[] EMPTY_ARRAY = new HighlightInfo[0];
   // optimisation: if tooltip contains this marker object, then it replaced with description field in getTooltip()
-  private static final String DESCRIPTION_PLACEHOLDER = "{\u0000}";
+  private static final String DESCRIPTION_PLACEHOLDER = "\u0000";
   JComponent fileLevelComponent;
   public final TextAttributes forcedTextAttributes;
   public final TextAttributesKey forcedTextAttributesKey;
index 8f6e87c3c495f766b8b76f52dc304982cdd86e69..3d167950731bde8f997ae2b64feff872f68be6fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -34,6 +34,10 @@ public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalIns
     super(globalInspectionTool);
   }
 
+  public GlobalInspectionToolWrapper(@NotNull GlobalInspectionTool tool, @NotNull InspectionEP ep) {
+    super(tool, ep);
+  }
+
   public GlobalInspectionToolWrapper(@NotNull InspectionEP ep) {
     super(ep);
   }
index 9a2213ce1634096502a0e05ae215b38b9f55339d..70577a37ff245e78d47e231e3ef7885bcd06438b 100644 (file)
@@ -62,55 +62,34 @@ import java.util.*;
  * @author max
  */
 public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, InspectionProfile, ExternalizableScheme {
+  @NonNls public static final String INSPECTION_TOOL_TAG = "inspection_tool";
+  @NonNls public static final String CLASS_TAG = "class";
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionProfileImpl");
   @NonNls private static final String VALID_VERSION = "1.0";
-
-  private Map<String, ToolsImpl> myTools = new THashMap<String, ToolsImpl>();
-
-  private Map<String, Boolean> myDisplayLevelMap;
-  @NotNull
-  private final Map<String, Element> myDeinstalledInspectionsSettings;
-  private boolean myLockedProfile = false;
-
-  protected InspectionProfileImpl mySource;
-  private InspectionProfileImpl myBaseProfile = null;
   @NonNls private static final String VERSION_TAG = "version";
-  @NonNls public static final String INSPECTION_TOOL_TAG = "inspection_tool";
-
-  @NonNls public static final String CLASS_TAG = "class";
   @NonNls private static final String PROFILE_NAME_TAG = "profile_name";
   @NonNls private static final String ROOT_ELEMENT_TAG = "inspections";
-
-  private String myEnabledTool = null;
   @NonNls private static final String USED_LEVELS = "used_levels";
-
-  final InspectionToolRegistrar myRegistrar;
   @NonNls private static final String IS_LOCKED = "is_locked";
-  private final ExternalInfo myExternalInfo = new ExternalInfo();
+  @NonNls private static final String DESCRIPTION = "description";
   @TestOnly
   public static boolean INIT_INSPECTIONS = false;
+  private static Map<String, InspectionElementsMerger> ourMergers = null;
+  final InspectionToolRegistrar myRegistrar;
+  @NotNull
+  private final Map<String, Element> myDeinstalledInspectionsSettings;
+  private final ExternalInfo myExternalInfo = new ExternalInfo();
+  protected InspectionProfileImpl mySource;
+  private Map<String, ToolsImpl> myTools = new THashMap<String, ToolsImpl>();
+  private Map<String, Boolean> myDisplayLevelMap;
+  private boolean myLockedProfile = false;
+  private InspectionProfileImpl myBaseProfile = null;
+  private String myEnabledTool = null;
   private String[] myScopesOrder = null;
-
-  @Override
-  public void setModified(final boolean modified) {
-    myModified = modified;
-  }
-
+  private String myDescription;
   private boolean myModified = false;
   private volatile boolean myInitialized;
 
-  private static Map<String, InspectionElementsMerger> ourMergers = null;
-
-  private static synchronized Map<String, InspectionElementsMerger> getMergers() {
-    if (ourMergers == null) {
-      ourMergers = new LinkedHashMap<String, InspectionElementsMerger>();
-      for (InspectionElementsMerger merger : Extensions.getExtensions(InspectionElementsMerger.EP_NAME)) {
-        ourMergers.put(merger.getMergedToolName(), merger);
-      }
-    }
-    return ourMergers;
-  }
-
   InspectionProfileImpl(@NotNull InspectionProfileImpl inspectionProfile) {
     super(inspectionProfile.getName());
 
@@ -142,6 +121,16 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     myDeinstalledInspectionsSettings = new TreeMap<String, Element>();
   }
 
+  private static synchronized Map<String, InspectionElementsMerger> getMergers() {
+    if (ourMergers == null) {
+      ourMergers = new LinkedHashMap<String, InspectionElementsMerger>();
+      for (InspectionElementsMerger merger : Extensions.getExtensions(InspectionElementsMerger.EP_NAME)) {
+        ourMergers.put(merger.getMergedToolName(), merger);
+      }
+    }
+    return ourMergers;
+  }
+
   @NotNull
   public static InspectionProfileImpl createSimple(@NotNull String name,
                                                    @NotNull Project project,
@@ -168,6 +157,36 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return profile;
   }
 
+  private static boolean toolSettingsAreEqual(@NotNull String toolName, @NotNull InspectionProfileImpl profile1, @NotNull InspectionProfileImpl profile2) {
+    final Tools toolList1 = profile1.myTools.get(toolName);
+    final Tools toolList2 = profile2.myTools.get(toolName);
+
+    return Comparing.equal(toolList1, toolList2);
+  }
+
+  @NotNull
+  private static InspectionToolWrapper copyToolSettings(@NotNull InspectionToolWrapper toolWrapper)
+    throws WriteExternalException, InvalidDataException {
+    final InspectionToolWrapper inspectionTool = toolWrapper.createCopy();
+    if (toolWrapper.isInitialized()) {
+      @NonNls String tempRoot = "config";
+      Element config = new Element(tempRoot);
+      toolWrapper.getTool().writeSettings(config);
+      inspectionTool.getTool().readSettings(config);
+    }
+    return inspectionTool;
+  }
+
+  @NotNull
+  public static InspectionProfileImpl getDefaultProfile() {
+    return InspectionProfileImplHolder.DEFAULT_PROFILE;
+  }
+
+  @Override
+  public void setModified(final boolean modified) {
+    myModified = modified;
+  }
+
   @Override
   public InspectionProfile getParentProfile() {
     return mySource;
@@ -191,13 +210,6 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return myModified;
   }
 
-  private static boolean toolSettingsAreEqual(@NotNull String toolName, @NotNull InspectionProfileImpl profile1, @NotNull InspectionProfileImpl profile2) {
-    final Tools toolList1 = profile1.myTools.get(toolName);
-    final Tools toolList2 = profile2.myTools.get(toolName);
-
-    return Comparing.equal(toolList1, toolList2);
-  }
-
   @Override
   public boolean isProperSetting(@NotNull String toolId) {
     if (myBaseProfile != null) {
@@ -237,7 +249,6 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return level;
   }
 
-
   @Override
   public void readExternal(@NotNull Element element) throws InvalidDataException {
     super.readExternal(element);
@@ -274,6 +285,11 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
       JDOMUtil.internElement(toolElement, interner);
       myDeinstalledInspectionsSettings.put(toolElement.getAttributeValue(CLASS_TAG), toolElement);
     }
+
+    final Element descriptionElement = element.getChild(DESCRIPTION);
+    if (descriptionElement != null) {
+      myDescription = descriptionElement.getText();
+    }
   }
 
   @NotNull
@@ -288,13 +304,14 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return result;
   }
 
-
   @Override
   public void writeExternal(@NotNull Element element) throws WriteExternalException {
     super.writeExternal(element);
     element.setAttribute(VERSION_TAG, VALID_VERSION);
     element.setAttribute(IS_LOCKED, String.valueOf(myLockedProfile));
-
+    if (myDescription != null) {
+      element.addContent(new Element(DESCRIPTION).addContent(myDescription));
+    }
     synchronized (myExternalInfo) {
     if (!myInitialized) {
         for (Element el : myDeinstalledInspectionsSettings.values()) {
@@ -446,6 +463,11 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return myEnabledTool == null;
   }
 
+  @Override
+  public void setEditable(final String displayName) {
+    myEnabledTool = displayName;
+  }
+
   @Override
   @NotNull
   public String getDisplayName() {
@@ -460,11 +482,6 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     InspectionProfileManager.getInstance().fireProfileChanged(this);
   }
 
-  @Override
-  public void setEditable(final String displayName) {
-    myEnabledTool = displayName;
-  }
-
   @Override
   public boolean isProfileLocked() {
     return myLockedProfile;
@@ -690,19 +707,6 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     }
   }
 
-  @NotNull
-  private static InspectionToolWrapper copyToolSettings(@NotNull InspectionToolWrapper toolWrapper)
-    throws WriteExternalException, InvalidDataException {
-    final InspectionToolWrapper inspectionTool = toolWrapper.createCopy();
-    if (toolWrapper.isInitialized()) {
-      @NonNls String tempRoot = "config";
-      Element config = new Element(tempRoot);
-      toolWrapper.getTool().writeSettings(config);
-      inspectionTool.getTool().readSettings(config);
-    }
-    return inspectionTool;
-  }
-
   @Override
   public void cleanup(@NotNull Project project) {
     for (final ToolsImpl toolList : myTools.values()) {
@@ -793,6 +797,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
 
   private void commit(@NotNull InspectionProfileImpl inspectionProfile) {
     setName(inspectionProfile.getName());
+    setDescription(inspectionProfile.getDescription());
     myLocal = inspectionProfile.myLocal;
     myLockedProfile = inspectionProfile.myLockedProfile;
     myDisplayLevelMap = inspectionProfile.myDisplayLevelMap;
@@ -805,13 +810,16 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
   }
 
-  private static class InspectionProfileImplHolder {
-    private static final InspectionProfileImpl DEFAULT_PROFILE = new InspectionProfileImpl("Default");
+  public String getDescription() {
+    return myDescription;
   }
 
-  @NotNull
-  public static InspectionProfileImpl getDefaultProfile() {
-    return InspectionProfileImplHolder.DEFAULT_PROFILE;
+  public void setDescription(String description) {
+    if (Comparing.strEqual(description, myDescription)) {
+      return;
+    }
+    setModified(true);
+    myDescription = description;
   }
 
   public Element saveToDocument() throws WriteExternalException {
@@ -960,12 +968,12 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     }
     return myDisplayLevelMap;
   }
-  
+
   @Override
   public void profileChanged() {
     myDisplayLevelMap = null;
   }
-
+  
   @NotNull
   public HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, NamedScope scope, Project project) {
     final ToolsImpl tools = getTools(key.toString(), project);
@@ -1017,4 +1025,8 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
     return super.equals(o) && ((InspectionProfileImpl)o).getProfileManager() == getProfileManager();
   }
 
+  private static class InspectionProfileImplHolder {
+    private static final InspectionProfileImpl DEFAULT_PROFILE = new InspectionProfileImpl("Default");
+  }
+
 }
index d307e50f1a7b39332b8ac4e159a8b419799d9a2d..40b948991ce72a88e08f9f61b85c1d0899c25a00 100644 (file)
@@ -98,6 +98,13 @@ public interface FileViewProvider extends Cloneable, UserDataHolder {
   @Nullable
   PsiReference findReferenceAt(int offsetInElement, @NotNull Language language);
 
+  /**
+   * Creates a copy of this view provider linked with the give (typically light) file.
+   * The result provider is required to be NOT event-system-enabled.
+   * 
+   * @see com.intellij.testFramework.LightVirtualFile
+   * @see #isEventSystemEnabled() 
+   */
   @NotNull
   FileViewProvider createCopy(@NotNull VirtualFile copy);
 
index 9ed329bc6dbf524ce742f3e403833f8ec0d52da0..4b9f7a992a14146b537f51726b644a61e155b10c 100644 (file)
@@ -33,11 +33,11 @@ import java.util.List;
 
 public class LightStubBuilder implements StubBuilder {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.LightStubBuilder");
-  private LighterAST myForcedLighterAst;
+  public static final ThreadLocal<LighterAST> FORCED_AST = new ThreadLocal<LighterAST>();
 
   @Override
   public StubElement buildStubTree(@NotNull PsiFile file) {
-    LighterAST tree = myForcedLighterAst;
+    LighterAST tree = FORCED_AST.get();
     if (tree == null) {
       FileType fileType = file.getFileType();
       if (!(fileType instanceof LanguageFileType)) {
@@ -51,6 +51,8 @@ public class LightStubBuilder implements StubBuilder {
         return null;
       }
       tree = file.getNode().getLighterAST();
+    } else {
+      FORCED_AST.set(null);
     }
     if (tree == null) return null;
 
@@ -158,8 +160,4 @@ public class LightStubBuilder implements StubBuilder {
   protected boolean skipChildProcessingWhenBuildingStubs(@NotNull LighterAST tree, @NotNull LighterASTNode parent, @NotNull LighterASTNode node) {
     return false;
   }
-
-  public void setForcedLighterAst(LighterAST forcedLighterAst) {
-    myForcedLighterAst = forcedLighterAst;
-  }
 }
index 59b6533f42426c2a4dee605996c9b61456cfb2e9..809bd9fcafb0f3a8c450993fa217a4ed75f060ad 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.lang.ASTNode;
 import com.intellij.lang.Language;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.progress.ProgressIndicatorProvider;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
@@ -179,7 +180,16 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
       ApplicationManager.getApplication().assertReadAccessAllowed();
       synchronized (PsiLock.LOCK) {
         if (myStub != null) {
-          throw new PsiInvalidElementAccessException(this, "no psi for file stub " + stub + ", invalidation reason=" + ((PsiFileStubImpl<?>) stub).getInvalidationReason(), null);
+          String reason = ((PsiFileStubImpl<?>)stub).getInvalidationReason();
+          PsiInvalidElementAccessException exception =
+            new PsiInvalidElementAccessException(this, "no psi for file stub " + stub + ", invalidation reason=" + reason, null);
+          if (PsiFileImpl.STUB_PSI_MISMATCH.equals(reason)) {
+            // we're between finding stub-psi mismatch and the next EDT spot where the file is reparsed and stub rebuilt
+            //    see com.intellij.psi.impl.source.PsiFileImpl.rebuildStub()
+            // most likely it's just another highlighting thread accessing the same PSI concurrently and not yet canceled, so cancel it
+            throw new ProcessCanceledException(exception);  
+          }
+          throw exception;
         }
       }
     }
index 94061b31aceef1cc1b860457721ba75767fbf2be..c7cf4a8da64cf276e19a90670c306982563f962a 100644 (file)
@@ -23,7 +23,10 @@ import com.intellij.openapi.util.Ref;
 import com.intellij.util.ExceptionUtil;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.concurrent.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 public class ApplicationUtil {
   // throws exception if can't grab read action right now
@@ -63,7 +66,7 @@ public class ApplicationUtil {
           error.set(t);
           return null;
         }
-      };
+      }
     });
 
     while (true) {
index bf4c421c38ea6ef896d14086253344d8d2026faa..ca194dd5ce65dc981caf748a11936b341aa0416d 100644 (file)
@@ -43,6 +43,7 @@ import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.awt.*;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
@@ -376,7 +377,7 @@ public final class LoadTextUtil {
         CharSequence text;
 
         Application app = ApplicationManager.getApplication();
-        if (app != null && app.isDispatchThread() && !app.isWriteAccessAllowed()) {
+        if (app != null && app.isDispatchThread() && !app.isWriteAccessAllowed() && !GraphicsEnvironment.isHeadless()) {
           final Ref<CharSequence> result = Ref.create(ArrayUtil.EMPTY_CHAR_SEQUENCE);
           final Ref<Throwable> error = Ref.create();
           ProgressManager.getInstance().run(new Task.Modal(null, "Decompiling " + file.getName(), true) {
index dabb45cd7667a096e434497489b6814669e60e89..bdbbc364aa60b54d7592ee3e302c4e455e6d11ea 100644 (file)
@@ -53,6 +53,7 @@ import com.intellij.psi.tree.ILazyParseableElementType;
 import com.intellij.psi.tree.IStubFileElementType;
 import com.intellij.psi.tree.TokenSet;
 import com.intellij.reference.SoftReference;
+import com.intellij.util.FileContentUtilCore;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.PatchedWeakReference;
 import com.intellij.util.containers.ContainerUtil;
@@ -67,6 +68,7 @@ import java.util.*;
 
 public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiFileWithStubSupport, Queryable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiFileImpl");
+  public static final String STUB_PSI_MISMATCH = "stub-psi mismatch";
 
   private IElementType myElementType;
   protected IElementType myContentElementType;
@@ -299,7 +301,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
 
   protected void reportStubAstMismatch(String message, StubTree stubTree, Document cachedDocument) {
     rebuildStub();
-    clearStub("stub-psi mismatch");
+    clearStub(STUB_PSI_MISMATCH);
     scheduleDropCachesWithInvalidStubPsi();
 
     String msg = message;
@@ -1007,21 +1009,23 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
   }
 
   private void rebuildStub() {
-    final VirtualFile vFile = getVirtualFile();
+    ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
+      public void run() {
+        myManager.dropResolveCaches();
 
-    if (vFile != null && vFile.isValid()) {
-      ApplicationManager.getApplication().invokeLater(new Runnable() {
-        @Override
-        public void run() {
+        final VirtualFile vFile = getVirtualFile();
+        if (vFile != null && vFile.isValid()) {
           final Document doc = FileDocumentManager.getInstance().getCachedDocument(vFile);
           if (doc != null) {
             FileDocumentManager.getInstance().saveDocument(doc);
           }
-        }
-      }, ModalityState.NON_MODAL);
 
-      StubTreeLoader.getInstance().rebuildStubTree(vFile);
-    }
+          FileContentUtilCore.reparseFiles(vFile);
+          StubTreeLoader.getInstance().rebuildStubTree(vFile);
+        }
+      }
+    }, ModalityState.NON_MODAL);
   }
 
   @Override
index 708a4e2ac1d4795389af19dc33db0565d788daf1..768a75def04b57afeada3a9121ee22a9848e41a8 100644 (file)
@@ -193,6 +193,9 @@ public class BlockSupportImpl extends BlockSupport {
       lightFile.setOriginalFile(viewProvider.getVirtualFile());
 
       FileViewProvider copy = viewProvider.createCopy(lightFile);
+      if (copy.isEventSystemEnabled()) {
+        throw new AssertionError("Copied view provider must be non-physical for reparse to deliver correct events: " + viewProvider);
+      }
       copy.getLanguages();
       SingleRootFileViewProvider.doNotCheckFileSizeLimit(lightFile); // optimization: do not convert file contents to bytes to determine if we should codeinsight it
       PsiFileImpl newFile = getFileCopy(fileImpl, copy);
@@ -202,7 +205,6 @@ public class BlockSupportImpl extends BlockSupport {
       final FileElement newFileElement = (FileElement)newFile.getNode();
       final FileElement oldFileElement = (FileElement)fileImpl.getNode();
 
-      assert oldFileElement != null && newFileElement != null;
       DiffLog diffLog = mergeTrees(fileImpl, oldFileElement, newFileElement, indicator);
 
       ((PsiManagerEx)fileImpl.getManager()).getFileManager().setViewProvider(lightFile, null);
index af76f62331fd4b6574c17e1a28c448548e0b1e3d..d026bc284845caf3759beb0c6dc3f2445193ade5 100644 (file)
@@ -81,8 +81,8 @@ public class StubTreeBuilder {
           }
           if (stubFileElementType != null) {
             StubBuilder stubBuilder = stubFileElementType.getBuilder();
-            if (stubBuilder instanceof LightStubBuilder) { // each builder is pristine
-              ((LightStubBuilder)stubBuilder).setForcedLighterAst(fileContent.getLighterAST());
+            if (stubBuilder instanceof LightStubBuilder) {
+              LightStubBuilder.FORCED_AST.set(fileContent.getLighterAST());
             }
             data = stubBuilder.buildStubTree(psi);
           }
index 355300b4814b6d331149394e711c2b1e55d09b8b..bc0fc8d1291ce1bbe4aa3c8e8cb37b752e0181eb 100644 (file)
@@ -20,15 +20,17 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Splitter;
 import com.intellij.openapi.vcs.VcsDataKeys;
 import com.intellij.openapi.vcs.changes.Change;
+import com.intellij.openapi.vcs.changes.TextRevisionNumber;
 import com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser;
 import com.intellij.openapi.vcs.changes.ui.ChangesBrowser;
-import com.intellij.ui.CheckboxTree;
-import com.intellij.ui.CheckedTreeNode;
-import com.intellij.ui.ColoredTreeCellRenderer;
-import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.openapi.vcs.history.VcsRevisionNumber;
+import com.intellij.ui.*;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.ui.tree.TreeUtil;
+import com.intellij.vcs.log.Hash;
+import com.intellij.vcs.log.ui.VcsLogUiImpl;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -48,6 +50,7 @@ import java.util.List;
 
 public class PushLog extends JPanel implements TypeSafeDataProvider {
 
+  private final static String COMMIT_MENU = "Vcs.Push.ContextMenu";
   private static final String START_EDITING = "startEditing";
   private final ChangesBrowser myChangesBrowser;
   private final CheckboxTree myTree;
@@ -163,6 +166,7 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
 
     myTree.setRowHeight(0);
     ToolTipManager.sharedInstance().registerComponent(myTree);
+    PopupHandler.installPopupHandler(myTree, VcsLogUiImpl.POPUP_ACTION_GROUP, COMMIT_MENU);
 
     myChangesBrowser =
       new ChangesBrowser(project, null, Collections.<Change>emptyList(), null, false, true, null, ChangesBrowser.MyUseCase.LOCAL_CHANGES,
@@ -180,21 +184,18 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
   }
 
   private void updateChangesView() {
-    int[] rows = myTree.getSelectionRows();
-    if (rows != null && rows.length != 0) {
+    List<CommitNode> commitNodes = getSelectedCommitNodes();
+    if (!commitNodes.isEmpty()) {
       myChangesBrowser.getViewer().setEmptyText("No differences");
-      myChangesBrowser.setChangesToDisplay(collectAllChanges(rows));
     }
     else {
       setDefaultEmptyText();
-      myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
     }
+    myChangesBrowser.setChangesToDisplay(collectAllChanges(commitNodes));
   }
 
   @NotNull
-  private List<Change> collectAllChanges(@NotNull int[] selectedRows) {
-    List<DefaultMutableTreeNode> selectedNodes = getNodesForRows(getSortedRows(selectedRows));
-    List<CommitNode> commitNodes = collectSelectedCommitNodes(selectedNodes);
+  private static List<Change> collectAllChanges(@NotNull List<CommitNode> commitNodes) {
     return CommittedChangesTreeBrowser.zipChanges(collectChanges(commitNodes));
   }
 
@@ -241,16 +242,33 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
     myChangesBrowser.getViewer().setEmptyText("No commits selected");
   }
 
-  // Make changes available for diff action
+  // Make changes available for diff action; revisionNumber for create patch and copy revision number actions
   @Override
   public void calcData(DataKey key, DataSink sink) {
-    if (VcsDataKeys.CHANGES.equals(key)) {
-      int[] rows = myTree.getSelectionRows();
-      if (rows != null && rows.length != 0) {
-        Collection<Change> changes = collectAllChanges(rows);
-        sink.put(key, ArrayUtil.toObjectArray(changes, Change.class));
-      }
+    if (VcsDataKeys.CHANGES == key) {
+      List<CommitNode> commitNodes = getSelectedCommitNodes();
+      sink.put(key, ArrayUtil.toObjectArray(collectAllChanges(commitNodes), Change.class));
+    }
+    else if (VcsDataKeys.VCS_REVISION_NUMBERS == key) {
+      List<CommitNode> commitNodes = getSelectedCommitNodes();
+      sink.put(key, ArrayUtil.toObjectArray(ContainerUtil.map(commitNodes, new Function<CommitNode, VcsRevisionNumber>() {
+        @Override
+        public VcsRevisionNumber fun(CommitNode commitNode) {
+          Hash hash = commitNode.getUserObject().getId();
+          return new TextRevisionNumber(hash.asString(), hash.toShortString());
+        }
+      }), VcsRevisionNumber.class));
+    }
+  }
+
+  @NotNull
+  private List<CommitNode> getSelectedCommitNodes() {
+    int[] rows = myTree.getSelectionRows();
+    if (rows != null && rows.length != 0) {
+      List<DefaultMutableTreeNode> selectedNodes = getNodesForRows(getSortedRows(rows));
+      return collectSelectedCommitNodes(selectedNodes);
     }
+    return ContainerUtil.emptyList();
   }
 
   @NotNull
index 0e112b1c2b149f37a73b72219ea0e6840263d7bf..01156d0899695596f3971059daba58cc78fc2a7c 100644 (file)
@@ -1,5 +1,7 @@
 package com.intellij.openapi.externalSystem.model.project;
 
+import org.jetbrains.annotations.Nullable;
+
 /**
  * Enumerates module source types.
  * 
@@ -11,7 +13,7 @@ public enum ExternalSystemSourceType implements IExternalSystemSourceType {
   SOURCE(false, false, false, false),
   TEST(true, false, false, false),
   EXCLUDED(false, false, false, true),
-  SOURCE_GENERATED(true, true, false, false),
+  SOURCE_GENERATED(false, true, false, false),
   TEST_GENERATED(true, true, false, false),
   RESOURCE(false, false, true, false),
   TEST_RESOURCE(true, false, true, false);
@@ -59,4 +61,20 @@ public enum ExternalSystemSourceType implements IExternalSystemSourceType {
     }
     throw new IllegalArgumentException("Invalid source type: " + sourceType);
   }
+
+  @Nullable
+  public static ExternalSystemSourceType from(boolean isTest,
+                                              boolean isGenerated,
+                                              boolean isResource,
+                                              boolean isExcluded) {
+    for (ExternalSystemSourceType systemSourceType : ExternalSystemSourceType.values()) {
+      if (systemSourceType.isGenerated == isGenerated &&
+          systemSourceType.isResource == isResource &&
+          systemSourceType.isTest == isTest &&
+          systemSourceType.isExcluded == isExcluded) {
+        return systemSourceType;
+      }
+    }
+    return null;
+  }
 }
index 1182c019b2cf9baa34e90e42a4de380425be638a..1a2323cabba2efa5f074d265705121f2b5fce67e 100644 (file)
@@ -103,10 +103,18 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
   }
 
   protected void assertGeneratedSources(String moduleName, String... expectedSources) {
+    assertGeneratedSources(moduleName, JavaSourceRootType.SOURCE, expectedSources);
+  }
+
+  protected void assertGeneratedTestSources(String moduleName, String... expectedSources) {
+    assertGeneratedSources(moduleName, JavaSourceRootType.TEST_SOURCE, expectedSources);
+  }
+
+  private void assertGeneratedSources(String moduleName, JavaSourceRootType type, String... expectedSources) {
     ContentEntry contentRoot = getContentRoot(moduleName);
     List<ContentFolder> folders = new ArrayList<ContentFolder>();
-    for (SourceFolder folder : contentRoot.getSourceFolders(JavaSourceRootType.SOURCE)) {
-      JavaSourceRootProperties properties = folder.getJpsElement().getProperties(JavaSourceRootType.SOURCE);
+    for (SourceFolder folder : contentRoot.getSourceFolders(type)) {
+      JavaSourceRootProperties properties = folder.getJpsElement().getProperties(type);
       assertNotNull(properties);
       if (properties.isForGeneratedSources()) {
         folders.add(folder);
@@ -115,6 +123,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
     doAssertContentFolders(contentRoot, folders, expectedSources);
   }
 
+
   protected void assertResources(String moduleName, String... expectedSources) {
     doAssertContentFolders(moduleName, JavaResourceRootType.RESOURCE, expectedSources);
   }
old mode 100755 (executable)
new mode 100644 (file)
index 86b7346..ee3e4ed
Binary files a/platform/icons/src/actions/inspectionsPause@2x.png and b/platform/icons/src/actions/inspectionsPause@2x.png differ
old mode 100755 (executable)
new mode 100644 (file)
index 02c2ae8..c3e2617
Binary files a/platform/icons/src/actions/inspectionsPause@2x_dark.png and b/platform/icons/src/actions/inspectionsPause@2x_dark.png differ
diff --git a/platform/icons/src/general/errorMask.png b/platform/icons/src/general/errorMask.png
deleted file mode 100644 (file)
index d957e29..0000000
Binary files a/platform/icons/src/general/errorMask.png and /dev/null differ
diff --git a/platform/icons/src/general/errorsFound.png b/platform/icons/src/general/errorsFound.png
deleted file mode 100644 (file)
index 00b688b..0000000
Binary files a/platform/icons/src/general/errorsFound.png and /dev/null differ
diff --git a/platform/icons/src/general/errorsFound_dark.png b/platform/icons/src/general/errorsFound_dark.png
deleted file mode 100644 (file)
index bd6001d..0000000
Binary files a/platform/icons/src/general/errorsFound_dark.png and /dev/null differ
index c9f3a996bec7782f8a9d6e565390052699d02182..f2eb233259c78d0d51ff5813d83851659e2c7dbe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.ClassConditionKey;
 import com.intellij.openapi.util.UserDataHolderBase;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.ResolveResult;
+import com.intellij.psi.SmartPsiElementPointer;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -62,6 +63,9 @@ public abstract class LookupElement extends UserDataHolderBase {
     if (o instanceof PsiElementNavigationItem) {
       return ((PsiElementNavigationItem)o).getTargetElement();
     }
+    if (o instanceof SmartPsiElementPointer) {
+      return ((SmartPsiElementPointer)o).getElement();
+    }
     return null;
   }
 
index 771ca526b5fe784baa7bdd7221f71f76f92b050a..daf8b3955c51b99419e38fec54b472b64426e949 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.completion.InsertionContext;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.SmartPointerManager;
 import com.intellij.psi.util.PsiUtilCore;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.Contract;
@@ -65,6 +66,12 @@ public final class LookupElementBuilder extends LookupElement {
   public static LookupElementBuilder create(@NotNull String lookupString) {
     return new LookupElementBuilder(lookupString, lookupString);
   }
+  
+  public static LookupElementBuilder createWithSmartPointer(@NotNull String lookupString, @NotNull PsiElement element) {
+    PsiUtilCore.ensureValid(element);
+    return new LookupElementBuilder(lookupString, 
+                                    SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element));
+  }
 
   public static LookupElementBuilder create(@NotNull PsiNamedElement element) {
     PsiUtilCore.ensureValid(element);
index 7b751b0d27eb5752030b988063e1ae052113a5e9..d773109b66632075262d3f6d76aafb7b56089068 100644 (file)
@@ -103,6 +103,14 @@ public class SpacingBuilder {
       return SpacingBuilder.this;
     }
 
+    public SpacingBuilder lineBreakOrForceSpace(boolean lbOption, boolean spaceOption) {
+      if (lbOption) {
+        return lineBreakInCode();
+      }
+
+      int count = spaceOption ? 1 : 0;
+      return spacing(count, count, 0, false, 0);
+    }
 
     public SpacingBuilder spacing(int minSpaces, int maxSpaces, int minLF, boolean keepLineBreaks, int keepBlankLines) {
       for (RuleCondition condition : myConditions) {
@@ -148,6 +156,10 @@ public class SpacingBuilder {
     return new RuleBuilder(new RuleCondition(null, TokenSet.create(elementType), null));
   }
 
+  public RuleBuilder after(TokenSet tokenSet) {
+    return new RuleBuilder(new RuleCondition(null, tokenSet, null));
+  }
+
   public RuleBuilder afterInside(IElementType elementType, IElementType parentType) {
     return new RuleBuilder(new RuleCondition(TokenSet.create(parentType), TokenSet.create(elementType), null));
   }
@@ -172,6 +184,10 @@ public class SpacingBuilder {
     return new RuleBuilder(new RuleCondition(TokenSet.create(parentType), null, TokenSet.create(elementType)));
   }
 
+  public RuleBuilder beforeInside(IElementType elementType, TokenSet parentTypes) {
+    return new RuleBuilder(new RuleCondition(parentTypes, null, TokenSet.create(elementType)));
+  }
+
   public RuleBuilder between(IElementType left, IElementType right) {
     return new RuleBuilder(new RuleCondition(null, TokenSet.create(left), TokenSet.create(right)));
   }
index 1ddbf5a65d8319f0d2db13fbe1cb44a3a680e369..74782538c2ca0b54b3258302fe8676649e1eff4a 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.refactoring.classMembers;
 
 import com.intellij.psi.PsiElement;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.psi.util.PsiUtilCore;
 
 /**
  * @author Dennis.Ushakov
@@ -66,7 +67,7 @@ public abstract class MemberInfoBase<T extends PsiElement> {
   }
 
   public T getMember() {
-    LOG.assertTrue(myMember.isValid(), myMember.getText() + " is invalid");
+    PsiUtilCore.ensureValid(myMember);
     return myMember;
   }
 
index c0587f1fea0ae2c22c909c3b6f71ae81aa768884..a2df79e7cff97c65ca1bed5960520fe6b7c4caf7 100644 (file)
@@ -38,7 +38,7 @@ public class FontEditorPreview implements PreviewPanel{
 
   private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
 
-  public FontEditorPreview(final ColorAndFontOptions options, boolean editable) {
+  FontEditorPreview(final ColorAndFontOptions options, boolean editable) {
     myOptions = options;
 
     @Nls String text = getIDEDemoText();
@@ -65,7 +65,7 @@ public class FontEditorPreview implements PreviewPanel{
   }
 
   static void installTrafficLights(@NotNull EditorEx editor) {
-    TrafficLightRenderer renderer = new TrafficLightRenderer(null, null,null){
+    TrafficLightRenderer renderer = new TrafficLightRenderer(null, null,null) {
       @NotNull
       @Override
       protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(@NotNull SeverityRegistrar severityRegistrar) {
index a8bf87f8578b818c61d8f1a3bb0426dd31e30269..12163888d19e2afc0899791809bd1ec2e9cbe6e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@
 package com.intellij.application.options.editor;
 
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
+import com.intellij.ide.ui.UISettings;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.options.ex.ConfigurableWrapper;
 import com.intellij.profile.codeInspection.ui.ErrorOptionsProvider;
@@ -66,6 +67,7 @@ public class ErrorHighlightingPanel {
     for (ErrorOptionsProvider optionsProvider : myExtensions) {
       optionsProvider.apply();
     }
+    UISettings.getInstance().fireUISettingsChanged();
   }
 
   public JPanel getPanel(){
index 6e64e60d5364ef0e205782270ca0b52abf63ff37..dd115ef45e3417c8ba21d6ed10c405c58ea28904 100644 (file)
@@ -144,10 +144,10 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
       if (tlr.myFile == null || tlr.myFile.isValid()) return;
       Disposer.dispose(tlr);
     }
-    renderer = new TrafficLightRenderer(project, document, file);
     EditorImpl editor = (EditorImpl)editorMarkupModel.getEditor();
 
     if (!editor.isDisposed()) {
+      renderer = new TrafficLightRenderer(project, document, file);
       Disposer.register(editor.getDisposable(), (Disposable)renderer);
       editorMarkupModel.setErrorStripeRenderer(renderer);
     }
@@ -168,14 +168,16 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
     }
   }
 
-  public static class DaemonCodeAnalyzerStatus {
+  protected static class DaemonCodeAnalyzerStatus {
     public boolean errorAnalyzingFinished; // all passes done
-    public List<ProgressableTextEditorHighlightingPass> passStati = Collections.emptyList();
+    List<ProgressableTextEditorHighlightingPass> passStati = Collections.emptyList();
     public int[] errorCount = ArrayUtil.EMPTY_INT_ARRAY;
-    public String reasonWhyDisabled;
-    public String reasonWhySuspended;
+    private String reasonWhyDisabled;
+    private String reasonWhySuspended;
+
+    public DaemonCodeAnalyzerStatus() {
+    }
 
-    public int rootsNumber;
     @Override
     public String toString() {
       @NonNls String s = "DS: finished=" + errorAnalyzingFinished;
@@ -245,7 +247,6 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
     }
 
     status.errorCount = errorCount.clone();
-    status.rootsNumber = languages.size();
     fillDaemonCodeAnalyzerErrorsStatus(status, severityRegistrar);
     List<TextEditorHighlightingPass> passes = myDaemonCodeAnalyzer.getPassesToShowProgressFor(myDocument);
     status.passStati = passes.isEmpty() ? Collections.<ProgressableTextEditorHighlightingPass>emptyList() :
@@ -269,7 +270,7 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
                                                     @NotNull SeverityRegistrar severityRegistrar) {
   }
 
-  public final Project getProject() {
+  protected final Project getProject() {
     return myProject;
   }
 
index 55bf221973df3e8f6f59ee2cc658fbd8aaa59d39..b5502015bb4f26189074b7d3f45e9393ab98ecc4 100644 (file)
@@ -34,12 +34,12 @@ import java.util.EventObject;
 /**
  * User: cdr
  */
-public class TrafficTooltipRendererImpl extends ComparableObject.Impl implements TrafficTooltipRenderer {
+class TrafficTooltipRendererImpl extends ComparableObject.Impl implements TrafficTooltipRenderer {
   private TrafficProgressPanel myPanel;
   private final Runnable onHide;
   private TrafficLightRenderer myTrafficLightRenderer;
 
-  public TrafficTooltipRendererImpl(@NotNull Runnable onHide, @NotNull Editor editor) {
+  TrafficTooltipRendererImpl(@NotNull Runnable onHide, @NotNull Editor editor) {
     super(editor);
     this.onHide = onHide;
   }
index 7d650fa3cb3f992cb1e71173403ef91a249a05dd..3fcb65cbc340a98deba0b8cd8af985c7b12d1843 100644 (file)
@@ -85,7 +85,7 @@ public class FileLevelIntentionComponent extends EditorNotificationPanel {
     new ClickListener() {
       @Override
       public boolean onClick(@NotNull MouseEvent e, int clickCount) {
-        IntentionListStep step = new IntentionListStep(null, info, editor, psiFile, project);
+        IntentionListStep step = new IntentionListStep(null, editor, psiFile, project);
         if (intentions != null && !intentions.isEmpty()) {
           HighlightInfo.IntentionActionDescriptor descriptor = intentions.get(0).getFirst();
           IntentionActionWithTextCaching actionWithTextCaching = step.wrapAction(descriptor, psiFile, psiFile, editor);
index 9db2c7db75c56814cc461af35d5fb7e60667b0da..99cfc6e9f978512c6708f2c4e63ec072c5e1e533 100644 (file)
@@ -82,12 +82,19 @@ class IntentionListStep implements ListPopupStep<IntentionActionWithTextCaching>
                     @NotNull Editor editor,
                     @NotNull PsiFile file,
                     @NotNull Project project) {
+    this(intentionHintComponent, editor, file, project);
+    updateActions(intentions);
+  }
+
+  IntentionListStep(@Nullable IntentionHintComponent intentionHintComponent,
+                    @NotNull Editor editor,
+                    @NotNull PsiFile file,
+                    @NotNull Project project) {
     myIntentionHintComponent = intentionHintComponent;
     myEditor = editor;
     myFile = file;
     myProject = project;
     mySettings = IntentionManagerSettings.getInstance();
-    updateActions(intentions);
   }
 
   //true if something changed
index f4c151623ca4d2fa0e1526e1a86c23e1f4fc8913..2484e1e71d5840ad5ec2e08af4a63b814023cb9f 100644 (file)
@@ -35,7 +35,7 @@ import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowAnchor;
 import com.intellij.openapi.wm.ToolWindowId;
 import com.intellij.openapi.wm.ToolWindowManager;
-import com.intellij.profile.codeInspection.ui.InspectionToolsConfigurable;
+import com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable;
 import com.intellij.psi.PsiElement;
 import com.intellij.ui.content.ContentFactory;
 import com.intellij.ui.content.ContentManager;
@@ -52,9 +52,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.regex.Pattern;
 
 public class InspectionManagerEx extends InspectionManagerBase {
-  private GlobalInspectionContextImpl myGlobalInspectionContext;
+  private static final Pattern HTML_PATTERN = Pattern.compile("<[^<>]*>");
   private final NotNullLazyValue<ContentManager> myContentManager;
   private final Set<GlobalInspectionContextImpl> myRunningContexts = new HashSet<GlobalInspectionContextImpl>();
+  private final AtomicBoolean myToolsAreInitialized = new AtomicBoolean(false);
+  private GlobalInspectionContextImpl myGlobalInspectionContext;
+
 
   public InspectionManagerEx(final Project project) {
     super(project);
@@ -111,6 +114,15 @@ public class InspectionManagerEx extends InspectionManagerBase {
     });
   }
 
+  private static void processText(@NotNull @NonNls String descriptionText,
+                                  @NotNull InspectionToolWrapper tool,
+                                  @NotNull SearchableOptionsRegistrar myOptionsRegistrar) {
+    if (ApplicationManager.getApplication().isDisposed()) return;
+    final Set<String> words = myOptionsRegistrar.getProcessedWordsWithoutStemming(descriptionText);
+    for (String word : words) {
+      myOptionsRegistrar.addOption(word, tool.getShortName(), tool.getDisplayName(), InspectionToolsConfigurable.ID, InspectionToolsConfigurable.DISPLAY_NAME);
+    }
+  }
 
   @NotNull
   public ProblemDescriptor createProblemDescriptor(@NotNull final PsiElement psiElement,
@@ -170,8 +182,6 @@ public class InspectionManagerEx extends InspectionManagerBase {
     return myContentManager;
   }
 
-  private final AtomicBoolean myToolsAreInitialized = new AtomicBoolean(false);
-  private static final Pattern HTML_PATTERN = Pattern.compile("<[^<>]*>");
   public void buildInspectionSearchIndexIfNecessary() {
     if (!myToolsAreInitialized.getAndSet(true)) {
       final SearchableOptionsRegistrar myOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
@@ -196,14 +206,4 @@ public class InspectionManagerEx extends InspectionManagerBase {
       });
     }
   }
-
-  private static void processText(@NotNull @NonNls String descriptionText,
-                                  @NotNull InspectionToolWrapper tool,
-                                  @NotNull SearchableOptionsRegistrar myOptionsRegistrar) {
-    if (ApplicationManager.getApplication().isDisposed()) return;
-    final Set<String> words = myOptionsRegistrar.getProcessedWordsWithoutStemming(descriptionText);
-    for (String word : words) {
-      myOptionsRegistrar.addOption(word, tool.getShortName(), tool.getDisplayName(), InspectionToolsConfigurable.ID, InspectionToolsConfigurable.DISPLAY_NAME);
-    }
-  }
 }
index 2f4ae7d41735e20692fbdd54c9505f2f75d4158f..7ed208258dbf43d66cf1597ef61a399552400bde 100644 (file)
@@ -28,7 +28,7 @@ public abstract class BaseConsoleExecuteActionHandler extends ConsoleExecuteActi
   }
 
   @Override
-  final void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
+  final void doExecute(@NotNull String text, @NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView) {
     if (consoleView == null) {
       //noinspection deprecation
       execute(text);
index fe260df740381893354a4fb20016e83864ca62b8..bcb5f024a45f85efb55caa342607d2ad0c00f449 100644 (file)
@@ -39,58 +39,58 @@ public class ConsoleExecuteAction extends DumbAwareAction {
   static final String CONSOLE_EXECUTE_ACTION_ID = "Console.Execute";
 
   private final LanguageConsoleView myConsoleView;
-  private final LanguageConsoleImpl myConsole;
+  private final LanguageConsole myConsole;
   final ConsoleExecuteActionHandler myExecuteActionHandler;
-  private final Condition<LanguageConsoleImpl> myEnabledCondition;
+  private final Condition<LanguageConsole> myEnabledCondition;
 
   @SuppressWarnings("UnusedDeclaration")
   public ConsoleExecuteAction(@NotNull LanguageConsoleView console, @NotNull BaseConsoleExecuteActionHandler executeActionHandler) {
-    this(console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, Conditions.<LanguageConsoleImpl>alwaysTrue());
+    this(console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, Conditions.<LanguageConsole>alwaysTrue());
   }
 
   /**
    * Only internal usage, to keep backward compatibility
    * to remove in IDEA 14
    */
-  public static ConsoleExecuteAction createAction(@NotNull final LanguageConsoleImpl languageConsole,
+  public static ConsoleExecuteAction createAction(@NotNull final LanguageConsole languageConsole,
                                                   @NotNull ProcessBackedConsoleExecuteActionHandler consoleExecuteActionHandler) {
     final ConsoleExecuteActionHandler handler = consoleExecuteActionHandler;
     return new ConsoleExecuteAction(languageConsole, new ConsoleExecuteActionHandler(handler.myPreserveMarkup) {
       @Override
-      void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
+      void doExecute(@NotNull String text, @NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView) {
         handler.doExecute(text, languageConsole, null);
       }
     }, consoleExecuteActionHandler);
   }
 
-  ConsoleExecuteAction(@NotNull LanguageConsoleImpl console, final @NotNull ConsoleExecuteActionHandler executeActionHandler, @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
+  ConsoleExecuteAction(@NotNull LanguageConsole console, final @NotNull ConsoleExecuteActionHandler executeActionHandler, @Nullable Condition<LanguageConsole> enabledCondition) {
     this(console, null, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, enabledCondition);
   }
 
   public ConsoleExecuteAction(@NotNull LanguageConsoleView console,
                               @NotNull BaseConsoleExecuteActionHandler executeActionHandler,
-                              @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
+                              @Nullable Condition<LanguageConsole> enabledCondition) {
     this(console.getConsole(), console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, enabledCondition);
   }
 
   public ConsoleExecuteAction(@NotNull LanguageConsoleView console,
                               @NotNull BaseConsoleExecuteActionHandler executeActionHandler,
                               @NotNull String emptyExecuteActionId,
-                              @NotNull Condition<LanguageConsoleImpl> enabledCondition) {
+                              @NotNull Condition<LanguageConsole> enabledCondition) {
     this(console.getConsole(), console, executeActionHandler, emptyExecuteActionId, enabledCondition);
   }
 
-  private ConsoleExecuteAction(@NotNull LanguageConsoleImpl console,
+  private ConsoleExecuteAction(@NotNull LanguageConsole console,
                                @Nullable LanguageConsoleView consoleView,
                                @NotNull ConsoleExecuteActionHandler executeActionHandler,
                                @NotNull String emptyExecuteActionId,
-                               @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
+                               @Nullable Condition<LanguageConsole> enabledCondition) {
     super(null, null, AllIcons.Actions.Execute);
 
     myConsole = console;
     myConsoleView = consoleView;
     myExecuteActionHandler = executeActionHandler;
-    myEnabledCondition = enabledCondition == null ? Conditions.<LanguageConsoleImpl>alwaysTrue() : enabledCondition;
+    myEnabledCondition = enabledCondition == null ? Conditions.<LanguageConsole>alwaysTrue() : enabledCondition;
 
     EmptyAction.setupAction(this, emptyExecuteActionId, null);
   }
@@ -120,7 +120,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
 
   public void execute(@Nullable TextRange range, @NotNull String text, @Nullable EditorEx editor) {
     if (range == null) {
-      myConsole.doAddPromptToHistory();
+      ((LanguageConsoleImpl)myConsole).doAddPromptToHistory();
       DocumentEx document = myConsole.getHistoryViewer().getDocument();
       document.insertString(document.getTextLength(), text);
       if (!text.endsWith("\n")) {
@@ -129,7 +129,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
     }
     else {
       assert editor != null;
-      myConsole.addTextRangeToHistory(range, editor, myExecuteActionHandler.myPreserveMarkup);
+      ((LanguageConsoleImpl)myConsole).addTextRangeToHistory(range, editor, myExecuteActionHandler.myPreserveMarkup);
     }
     myExecuteActionHandler.addToCommandHistoryAndExecute(myConsole, myConsoleView, text);
   }
@@ -159,15 +159,15 @@ public class ConsoleExecuteAction extends DumbAwareAction {
       myAddToHistory = addCurrentToHistory;
     }
 
-    protected void beforeExecution(@NotNull LanguageConsoleImpl console) {
+    protected void beforeExecution(@NotNull LanguageConsole console) {
     }
 
-    protected void runExecuteAction(@NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
+    protected void runExecuteAction(@NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView) {
       if (!myUseProcessStdIn) {
         beforeExecution(console);
       }
 
-      String text = console.prepareExecuteAction(myAddToHistory && !myUseProcessStdIn, myPreserveMarkup, true);
+      String text = ((LanguageConsoleImpl)console).prepareExecuteAction(myAddToHistory && !myUseProcessStdIn, myPreserveMarkup, true);
       ((UndoManagerImpl)UndoManager.getInstance(console.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(console.getCurrentEditor().getDocument()));
 
       if (myUseProcessStdIn) {
@@ -180,11 +180,11 @@ public class ConsoleExecuteAction extends DumbAwareAction {
       }
     }
 
-    private void addToCommandHistoryAndExecute(@NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView, @NotNull String text) {
+    private void addToCommandHistoryAndExecute(@NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView, @NotNull String text) {
       myCommandHistoryModel.addToHistory(text);
       doExecute(text, console, consoleView);
     }
 
-    abstract void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView);
+    abstract void doExecute(@NotNull String text, @NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView);
   }
 }
\ No newline at end of file
index 8a9ac7fd548f1a1169c5a0b24b1b7b3f8f9d7235..707a0f877d146519f12b4642d3a369eb5d8704db 100644 (file)
@@ -74,7 +74,7 @@ public class ConsoleHistoryController {
 
   private static final Logger LOG = Logger.getInstance("com.intellij.execution.console.ConsoleHistoryController");
 
-  private final LanguageConsoleImpl myConsole;
+  private final LanguageConsole myConsole;
   private final AnAction myHistoryNext = new MyAction(true, getKeystrokesUpDown(true));
   private final AnAction myHistoryPrev = new MyAction(false, getKeystrokesUpDown(false));
   private final AnAction myBrowseHistory = new MyBrowseAction();
@@ -83,7 +83,7 @@ public class ConsoleHistoryController {
   private long myLastSaveStamp;
 
   public ConsoleHistoryController(@NotNull String type, @Nullable String persistenceId,
-                                  @NotNull LanguageConsoleImpl console, @NotNull ConsoleHistoryModel model) {
+                                  @NotNull LanguageConsole console, @NotNull ConsoleHistoryModel model) {
     myHelper = new ModelHelper(type, StringUtil.isEmpty(persistenceId) ? console.getProject().getPresentableUrl() : persistenceId, model);
     myConsole = console;
   }
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsole.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsole.java
new file mode 100644 (file)
index 0000000..0dc9894
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.execution.console;
+
+import com.intellij.lang.Language;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.ex.EditorEx;
+import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author gregsh
+ */
+public interface LanguageConsole extends Disposable {
+  @NotNull
+  Project getProject();
+
+  boolean isValid();
+
+  @NotNull
+  String getTitle();
+
+  @NotNull
+  PsiFile getFile();
+
+  @NotNull
+  VirtualFile getVirtualFile();
+
+  @NotNull
+  Editor getCurrentEditor();
+
+  @NotNull
+  EditorEx getConsoleEditor();
+
+  @NotNull
+  Document getEditorDocument();
+
+  @NotNull
+  EditorEx getHistoryViewer();
+
+  @NotNull
+  Language getLanguage();
+
+  void setLanguage(@NotNull Language language);
+
+  @Nullable
+  String getPrompt();
+
+  void setPrompt(@Nullable String prompt);
+
+  void setPromptAttributes(@NotNull TextAttributes attributes);
+
+  boolean isEditable();
+
+  void setEditable(boolean editable);
+
+  boolean isConsoleEditorEnabled();
+
+  void setConsoleEditorEnabled(boolean enabled);
+}
index a763d934b30eb1a3dcd0f17ef3f83c19e5da2bfd..b207b95c83ad6218baa78b632fb53a3f5619185b 100644 (file)
@@ -47,7 +47,7 @@ public final class LanguageConsoleBuilder {
   @Nullable
   private LanguageConsoleView consoleView;
   @Nullable
-  private Condition<LanguageConsoleImpl> executionEnabled = Conditions.alwaysTrue();
+  private Condition<LanguageConsole> executionEnabled = Conditions.alwaysTrue();
 
   @Nullable
   private PairFunction<VirtualFile, Project, PsiFile> psiFileFactory;
@@ -71,13 +71,18 @@ public final class LanguageConsoleBuilder {
   public LanguageConsoleBuilder() {
   }
 
-  public LanguageConsoleBuilder processHandler(@NotNull ProcessHandler processHandler) {
-    //noinspection deprecation
-    executionEnabled = new ProcessBackedExecutionEnabledCondition(processHandler);
+  public LanguageConsoleBuilder processHandler(@NotNull final ProcessHandler processHandler) {
+    executionEnabled = new Condition<LanguageConsole>() {
+
+      @Override
+      public boolean value(LanguageConsole console) {
+        return !processHandler.isProcessTerminated();
+      }
+    };
     return this;
   }
 
-  public LanguageConsoleBuilder executionEnabled(@NotNull Condition<LanguageConsoleImpl> condition) {
+  public LanguageConsoleBuilder executionEnabled(@NotNull Condition<LanguageConsole> condition) {
     executionEnabled = condition;
     return this;
   }
@@ -112,14 +117,14 @@ public final class LanguageConsoleBuilder {
   /**
    * todo This API doesn't look good, but it is much better than force client to know low-level details
    */
-  public static Pair<AnAction, ConsoleHistoryController> registerExecuteAction(@NotNull LanguageConsoleImpl console,
+  public static Pair<AnAction, ConsoleHistoryController> registerExecuteAction(@NotNull LanguageConsole console,
                                                                                @NotNull final Consumer<String> executeActionHandler,
                                                                                @NotNull String historyType,
                                                                                @Nullable String historyPersistenceId,
-                                                                               @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
+                                                                               @Nullable Condition<LanguageConsole> enabledCondition) {
     ConsoleExecuteAction.ConsoleExecuteActionHandler handler = new ConsoleExecuteAction.ConsoleExecuteActionHandler(true) {
       @Override
-      void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
+      void doExecute(@NotNull String text, @NotNull LanguageConsole console, @Nullable LanguageConsoleView consoleView) {
         executeActionHandler.consume(text);
       }
     };
@@ -186,24 +191,6 @@ public final class LanguageConsoleBuilder {
     return consoleView;
   }
 
-  @Deprecated
-  /**
-   * @deprecated Don't use it directly!
-   * Will be private in IDEA >13
-   */
-  public static class ProcessBackedExecutionEnabledCondition implements Condition<LanguageConsoleImpl> {
-    private final ProcessHandler myProcessHandler;
-
-    public ProcessBackedExecutionEnabledCondition(ProcessHandler myProcessHandler) {
-      this.myProcessHandler = myProcessHandler;
-    }
-
-    @Override
-    public boolean value(LanguageConsoleImpl console) {
-      return !myProcessHandler.isProcessTerminated();
-    }
-  }
-
   private final static class GutteredLanguageConsole extends LanguageConsoleImpl {
     private final GutterContentProvider gutterContentProvider;
     @Nullable
index 388b66c714c02f750e06a223d19ff5e43a724187..be22d49c1672125e42430a4ea3061b7532bcf0ab 100644 (file)
@@ -20,12 +20,13 @@ import com.intellij.execution.impl.ConsoleViewUtil;
 import com.intellij.execution.ui.ConsoleViewContentType;
 import com.intellij.ide.DataManager;
 import com.intellij.ide.highlighter.HighlighterFactory;
-import com.intellij.ide.impl.TypeSafeDataProviderAdapter;
 import com.intellij.injected.editor.EditorWindow;
 import com.intellij.lang.Language;
 import com.intellij.lang.annotation.HighlightSeverity;
-import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.DataProvider;
+import com.intellij.openapi.actionSystem.EmptyAction;
+import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.*;
 import com.intellij.openapi.editor.actions.EditorActionUtil;
@@ -61,6 +62,7 @@ import com.intellij.ui.SideBorder;
 import com.intellij.util.*;
 import com.intellij.util.ui.AbstractLayoutManager;
 import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -77,7 +79,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
  * @author Gregory.Shrago
  * In case of REPL consider to use {@link LanguageConsoleBuilder}
  */
-public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
+public class LanguageConsoleImpl implements LanguageConsole, DataProvider {
   private static final int SEPARATOR_THICKNESS = 1;
   private final Project myProject;
 
@@ -177,7 +179,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
     myPanel.add(myHistoryViewer.getComponent());
     myPanel.add(myConsoleEditor.getComponent());
 
-    DataManager.registerDataProvider(myPanel, new TypeSafeDataProviderAdapter(this));
+    DataManager.registerDataProvider(myPanel, this);
 
     myHistoryViewer.getComponent().addComponentListener(new ComponentAdapter() {
       @Override
@@ -612,14 +614,17 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
     }
   }
 
+  @Nullable
   @Override
-  public void calcData(@NotNull DataKey key, @NotNull DataSink sink) {
-    if (OpenFileDescriptor.NAVIGATE_IN_EDITOR == key) {
-      sink.put(OpenFileDescriptor.NAVIGATE_IN_EDITOR, myConsoleEditor);
+  public Object getData(@NonNls String dataId) {
+    if (OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
+      return myConsoleEditor;
     }
     else if (getProject().isInitialized()) {
-      sink.put(key, FileEditorManagerEx.getInstanceEx(getProject()).getData(key.getName(), myConsoleEditor, myConsoleEditor.getCaretModel().getCurrentCaret()));
+      Caret caret = myConsoleEditor.getCaretModel().getCurrentCaret();
+      return FileEditorManagerEx.getInstanceEx(getProject()).getData(dataId, myConsoleEditor, caret);
     }
+    return null;
   }
 
   private void installEditorFactoryListener() {
index 1a53660c3017199bf3b75e3396b90e4634f33806..cd07953068bbbeaea993294b036efaf48a15af48 100644 (file)
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
  */
 public interface LanguageConsoleView extends ConsoleView {
   @NotNull
-  LanguageConsoleImpl getConsole();
+  LanguageConsole getConsole();
 
   @NotNull
   Project getProject();
index 2c957a4ed2da3838fd93978721a956c6cf70891d..49e7f2fb4f42759b93efabf8b72f147420cf5cb6 100644 (file)
@@ -27,7 +27,7 @@ import java.nio.charset.Charset;
 /**
  * @author traff
  */
-public class ProcessBackedConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler implements Condition<LanguageConsoleImpl> {
+public class ProcessBackedConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler implements Condition<LanguageConsole> {
   private volatile ProcessHandler myProcessHandler;
 
   public ProcessBackedConsoleExecuteActionHandler(ProcessHandler processHandler, boolean preserveMarkup) {
@@ -74,7 +74,7 @@ public class ProcessBackedConsoleExecuteActionHandler extends BaseConsoleExecute
   }
 
   @Override
-  public boolean value(LanguageConsoleImpl console) {
+  public boolean value(LanguageConsole console) {
     return !isProcessTerminated();
   }
 }
\ No newline at end of file
index 517a4cab42b2bd20c0a61b17645d6b92d2ddd309..794f23e44985514bd02abcc00b773d807fec9b2e 100644 (file)
@@ -233,7 +233,7 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
   }
 
   public LanguageConsoleImpl getLanguageConsole() {
-    return myConsoleView.getConsole();
+    return (LanguageConsoleImpl)myConsoleView.getConsole();
   }
 
   @SuppressWarnings("UnusedDeclaration")
index b42acb3ccf285da7a45105027d75d93cca668dce..22bb571d780d794149cbc42d69f132a7ac48be8b 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable;
 
 public class IDEInspectionToolsConfigurable extends InspectionToolsConfigurable {
   private String myCurrentSelection;
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.form b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.form
deleted file mode 100644 (file)
index 1e6fb60..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.profile.codeInspection.ui.InspectionToolsConfigurable">
-  <grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-    <margin top="0" left="0" bottom="0" right="0"/>
-    <constraints>
-      <xy x="20" y="20" width="1033" height="471"/>
-    </constraints>
-    <properties/>
-    <border type="none"/>
-    <children>
-      <grid id="d67c2" binding="myPanel" layout-manager="CardLayout" hgap="0" vgap="0">
-        <constraints>
-          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children/>
-      </grid>
-      <scrollpane id="64d7f" class="com.intellij.ui.components.JBScrollPane" binding="myJBScrollPane">
-        <constraints>
-          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false">
-            <minimum-size width="-1" height="45"/>
-            <preferred-size width="-1" height="45"/>
-          </grid>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children>
-          <grid id="6012b" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-            <margin top="0" left="0" bottom="0" right="0"/>
-            <constraints/>
-            <properties/>
-            <border type="none"/>
-            <children>
-              <component id="a4fd5" class="javax.swing.JComboBox" binding="myProfiles">
-                <constraints>
-                  <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-              </component>
-              <grid id="316ed" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="true" same-size-vertically="false" hgap="5" vgap="-1">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <border type="none"/>
-                <children>
-                  <component id="9715e" class="javax.swing.JButton" binding="myAddButton" default-binding="true">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="A&amp;dd"/>
-                    </properties>
-                  </component>
-                  <component id="95fc" class="javax.swing.JButton" binding="myDeleteButton" default-binding="true">
-                    <constraints>
-                      <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="De&amp;lete"/>
-                    </properties>
-                  </component>
-                  <component id="4aa90" class="javax.swing.JButton" binding="myImportButton" default-binding="true">
-                    <constraints>
-                      <grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="&amp;Import"/>
-                    </properties>
-                  </component>
-                  <component id="f1082" class="javax.swing.JButton" binding="myExportButton" default-binding="true">
-                    <constraints>
-                      <grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="&amp;Export"/>
-                    </properties>
-                  </component>
-                  <component id="6a3c2" class="javax.swing.JButton" binding="myCopyButton" default-binding="true">
-                    <constraints>
-                      <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="&amp;Copy"/>
-                    </properties>
-                  </component>
-                </children>
-              </grid>
-              <component id="3617d" class="javax.swing.JCheckBox" binding="myShareProfileCheckBox">
-                <constraints>
-                  <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties>
-                  <text value="&amp;Share profile"/>
-                </properties>
-              </component>
-              <hspacer id="2ef95">
-                <constraints>
-                  <grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                </constraints>
-              </hspacer>
-            </children>
-          </grid>
-        </children>
-      </scrollpane>
-    </children>
-  </grid>
-</form>
index af19c9f1f6cec305ebe4bbb92ba2833b96bd8293..54b7464d64b72b224bee0c00a9eebebd9a362791 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.Comparing;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProfileManagerImpl;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable;
 
 import java.util.Arrays;
 
@@ -45,7 +46,6 @@ public class ProjectInspectionToolsConfigurable extends InspectionToolsConfigura
   public void apply() throws ConfigurationException {
     super.apply();
     final InspectionProfileImpl selectedObject = getSelectedObject();
-    LOG.assertTrue(selectedObject != null);
     final String profileName = selectedObject.getName();
     final SingleInspectionProfilePanel selectedPanel = getSelectedPanel();
     LOG.assertTrue(selectedPanel != null, "selected profile: " + profileName + " panels: " + Arrays.toString(getKnownNames().toArray()));
@@ -61,7 +61,7 @@ public class ProjectInspectionToolsConfigurable extends InspectionToolsConfigura
   @Override
   public boolean isModified() {
     final InspectionProfileImpl selectedObject = getSelectedObject();
-    if (selectedObject != null && !Comparing.strEqual(getCurrentProfile().getName(), selectedObject.getName())) return true;
+    if (!Comparing.strEqual(getCurrentProfile().getName(), selectedObject.getName())) return true;
     return super.isModified();
   }
 }
\ No newline at end of file
index 5c5f8c745c73da5d5474a14b10b82ab4256b78ab..1ceec293a55a9c4c8c49f2de5ef1810a7af3439b 100644 (file)
@@ -101,7 +101,15 @@ public class SingleInspectionProfilePanel extends JPanel {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionToolsPanel");
   @NonNls private static final String INSPECTION_FILTER_HISTORY = "INSPECTION_FILTER_HISTORY";
   private static final String UNDER_CONSTRUCTION = InspectionsBundle.message("inspection.tool.description.under.construction.text");
+  @NonNls private static final String EMPTY_HTML = "<html><body></body></html>";
+  @NonNls private static final String VERTICAL_DIVIDER_PROPORTION = "VERTICAL_DIVIDER_PROPORTION";
+  @NonNls private static final String HORIZONTAL_DIVIDER_PROPORTION = "HORIZONTAL_DIVIDER_PROPORTION";
   private final List<ToolDescriptors> myInitialToolDescriptors = new ArrayList<ToolDescriptors>();
+  private final InspectionConfigTreeNode myRoot =
+    new InspectionConfigTreeNode(InspectionsBundle.message("inspection.root.node.title"));
+  private final Alarm myAlarm = new Alarm();
+  private final StorageAccessors myProperties = StorageAccessors.createGlobal("SingleInspectionProfilePanel");
+  private final InspectionProjectProfileManager myProjectProfileManager;
   private InspectionProfileImpl mySelectedProfile;
   private JEditorPane myBrowser;
   private JPanel myOptionsPanel;
@@ -113,22 +121,13 @@ public class SingleInspectionProfilePanel extends JPanel {
       filterTree(myProfileFilter.getFilter());
     }
   };
-  private final InspectionConfigTreeNode myRoot =
-    new InspectionConfigTreeNode(InspectionsBundle.message("inspection.root.node.title"));
-  private final Alarm myAlarm = new Alarm();
   private boolean myModified = false;
   private InspectionsConfigTreeTable myTreeTable;
   private TreeExpander myTreeExpander;
   @NotNull
   private String myInitialProfile;
-  @NonNls private static final String EMPTY_HTML = "<html><body></body></html>";
   private boolean myIsInRestore = false;
-  @NonNls private static final String VERTICAL_DIVIDER_PROPORTION = "VERTICAL_DIVIDER_PROPORTION";
-  @NonNls private static final String HORIZONTAL_DIVIDER_PROPORTION = "HORIZONTAL_DIVIDER_PROPORTION";
-  private final StorageAccessors myProperties = StorageAccessors.createGlobal("SingleInspectionProfilePanel");
-
   private boolean myShareProfile;
-  private final InspectionProjectProfileManager myProjectProfileManager;
   private Splitter myRightSplitter;
   private Splitter myMainSplitter;
 
@@ -158,6 +157,181 @@ public class SingleInspectionProfilePanel extends JPanel {
     }
   }
 
+  @Nullable
+  public static ModifiableModel createNewProfile(final int initValue,
+                                                 ModifiableModel selectedProfile,
+                                                 JPanel parent,
+                                                 String profileName,
+                                                 Set<String> existingProfileNames,
+                                                 @NotNull Project project) {
+    profileName = Messages.showInputDialog(parent, profileName, "Create New Inspection Profile", Messages.getQuestionIcon());
+    if (profileName == null) return null;
+    final ProfileManager profileManager = selectedProfile.getProfileManager();
+    if (existingProfileNames.contains(profileName)) {
+      Messages.showErrorDialog(InspectionsBundle.message("inspection.unable.to.create.profile.message", profileName),
+                               InspectionsBundle.message("inspection.unable.to.create.profile.dialog.title"));
+      return null;
+    }
+    InspectionProfileImpl inspectionProfile =
+        new InspectionProfileImpl(profileName, InspectionToolRegistrar.getInstance(), profileManager);
+      if (initValue == -1) {
+        inspectionProfile.initInspectionTools(project);
+        ModifiableModel profileModifiableModel = inspectionProfile.getModifiableModel();
+        final InspectionToolWrapper[] profileEntries = profileModifiableModel.getInspectionTools(null);
+        for (InspectionToolWrapper toolWrapper : profileEntries) {
+          profileModifiableModel.disableTool(toolWrapper.getShortName(), null, project);
+        }
+        profileModifiableModel.setLocal(true);
+        profileModifiableModel.setModified(true);
+        return profileModifiableModel;
+      } else if (initValue == 0) {
+        inspectionProfile.copyFrom(selectedProfile);
+        inspectionProfile.setName(profileName);
+        inspectionProfile.initInspectionTools(project);
+        inspectionProfile.setModified(true);
+        return inspectionProfile;
+      }
+      return null;
+  }
+
+  @Nullable
+  private static InspectionConfigTreeNode findNodeByKey(String name, InspectionConfigTreeNode root) {
+    for (int i = 0; i < root.getChildCount(); i++) {
+      final InspectionConfigTreeNode child = (InspectionConfigTreeNode)root.getChildAt(i);
+      final Descriptor descriptor = child.getDefaultDescriptor();
+      if (descriptor != null) {
+        if (descriptor.getKey().toString().equals(name)) {
+          return child;
+        }
+      }
+      else {
+        final InspectionConfigTreeNode node = findNodeByKey(name, child);
+        if (node != null) return node;
+      }
+    }
+    return null;
+  }
+
+  public static String renderSeverity(HighlightSeverity severity) {
+    return StringUtil.capitalizeWords(severity.getName().toLowerCase(), true);
+  }
+
+  private static void updateUpHierarchy(final InspectionConfigTreeNode node, final InspectionConfigTreeNode parent) {
+    if (parent != null) {
+      parent.dropCache();
+      updateUpHierarchy(parent, (InspectionConfigTreeNode)parent.getParent());
+    }
+  }
+
+  private static boolean isDescriptorAccepted(Descriptor descriptor,
+                                              @NonNls String filter,
+                                              final boolean forceInclude,
+                                              final List<Set<String>> keySetList, final Set<String> quoted) {
+    filter = filter.toLowerCase();
+    if (StringUtil.containsIgnoreCase(descriptor.getText(), filter)) {
+      return true;
+    }
+    final String[] groupPath = descriptor.getGroup();
+    for (String group : groupPath) {
+      if (StringUtil.containsIgnoreCase(group, filter)) {
+        return true;
+      }
+    }
+    for (String stripped : quoted) {
+      if (StringUtil.containsIgnoreCase(descriptor.getText(),stripped)) {
+        return