Merge remote-tracking branch 'origin/master'
authorEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Tue, 24 Feb 2015 16:03:02 +0000 (19:03 +0300)
committerEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Tue, 24 Feb 2015 16:03:02 +0000 (19:03 +0300)
410 files changed:
bin/scripts/unix/idea.sh
build/scripts/utils.gant
java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java
java/debugger/impl/src/com/intellij/debugger/actions/CompareValueWithClipboardAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/CopyValueAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/EditWatchAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/NewWatchAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/RemoveAllWatchesAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/RemoveWatchAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/ShowExecutionPointActionHandler.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/ShowLibraryFramesAction.java
java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/DisableGC.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LiteralEvaluator.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LocalVariableEvaluator.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java
java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
java/debugger/openapi/src/com/intellij/debugger/SourcePosition.java
java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/IncreaseLanguageLevelFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersUtil.java
java/java-impl/src/com/intellij/codeInsight/generation/builderSetter.vm
java/java-impl/src/com/intellij/codeInsight/generation/defaultGetter.vm
java/java-impl/src/com/intellij/codeInsight/generation/defaultSetter.vm
java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodHandler.java
java/java-impl/src/com/intellij/jarFinder/MavenCentralSourceSearcher.java
java/java-impl/src/com/intellij/jarFinder/SonatypeSourceSearcher.java
java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java
java/java-impl/src/com/intellij/lang/java/JavaImportOptimizer.java
java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.java
java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java
java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java
java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/light/LightFieldBuilder.java
java/java-psi-impl/src/com/intellij/psi/impl/search/MethodSuperSearcher.java [moved from java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodSuperSearcher.java with 99% similarity]
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_after.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_before.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_after.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_before.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_after.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_before.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_after.java [new file with mode: 0644]
java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_before.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastConversionToTypeParameter.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeDistinctProverForWildcardAndTypeParameter.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA134277.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/FieldInitializedUsedInLambda.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions1.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SecondSearchIfFirstParameterIsASubtypeOfReferenceTypeFromExpressionDeclaration.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136856.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136887.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/SecondConflictResolution.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterMultipleImplementationsAlreadyExist.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeMultipleImplementationsAlreadyExist.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java
java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java
java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/TypeInference18Test.java
java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
jps/jps-builders/src/org/jetbrains/jps/incremental/CompileScopeImpl.java
lib/markdown4j-2.2.jar [new file with mode: 0644]
platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzerSettings.java
platform/bootstrap/src/com/intellij/ide/BootstrapClassLoaderUtil.java
platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java
platform/core-api/src/com/intellij/openapi/options/BaseSchemeProcessor.java
platform/core-api/src/com/intellij/openapi/options/SchemeExtensionProvider.java [moved from platform/platform-api/src/com/intellij/openapi/options/SchemeExtensionProvider.java with 100% similarity]
platform/core-api/src/com/intellij/openapi/options/SchemesManager.java
platform/core-api/src/com/intellij/openapi/options/SharedScheme.java [deleted file]
platform/core-api/src/com/intellij/openapi/project/DumbService.java
platform/core-api/src/com/intellij/openapi/project/IndexNotReadyException.java [new file with mode: 0644]
platform/core-impl/src/com/intellij/mock/MockDumbService.java
platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
platform/core-impl/src/com/intellij/openapi/options/AbstractSchemesManager.java
platform/core-impl/src/com/intellij/openapi/options/EmptySchemesManager.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/DiffManagerImpl.java
platform/diff-impl/src/com/intellij/diff/actions/CompareFilesAction.java
platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
platform/diff-impl/src/com/intellij/diff/tools/ErrorDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/binary/BinaryDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/dir/DifDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/dir/DirDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/util/DiffDataKeys.java
platform/diff-impl/src/com/intellij/diff/tools/util/DiffSplitter.java
platform/diff-impl/src/com/intellij/diff/tools/util/PrevNextDifferenceIterable.java
platform/diff-impl/src/com/intellij/diff/tools/util/base/HighlightPolicy.java
platform/diff-impl/src/com/intellij/diff/tools/util/base/IgnorePolicy.java
platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffSettingsHolder.java
platform/diff-impl/src/com/intellij/diff/tools/util/threeside/ThreesideTextDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/util/twoside/TwosideTextDiffViewer.java
platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java
platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColorsScheme.java
platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorFontType.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/ex/DefaultColorSchemesManager.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
platform/lang-api/src/com/intellij/lang/ImportOptimizer.java
platform/lang-api/src/com/intellij/usageView/UsageTreeColorsScheme.java
platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/RearrangeCodeAction.java
platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/FileInEditorProcessor.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
platform/lang-impl/src/com/intellij/codeInsight/actions/LastRunReformatCodeOptionsProvider.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.form [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeInfoCollector.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeOptions.java
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeSettingsStorage.java [deleted file]
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java
platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/OptionalReformatActions.java [moved from platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeConstants.java with 54% similarity]
platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeRunOptions.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesOptions.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ShowReformatFileDialog.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzerSettingsImpl.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java
platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorComposer.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/ConsoleHistoryModel.java [moved from platform/platform-impl/src/com/intellij/execution/process/ConsoleHistoryModel.java with 82% similarity]
platform/lang-impl/src/com/intellij/execution/console/DuplexConsoleView.java
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/impl/RunManagerImpl.java
platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java
platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
platform/lang-impl/src/com/intellij/ide/actions/TemplateKindCombo.java
platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileService.java
platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java
platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java
platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java
platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/PersistableCodeStyleSchemes.java
platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java
platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java
platform/platform-api/src/com/intellij/openapi/diff/DiffManager.java
platform/platform-api/src/com/intellij/openapi/util/registry/RegistryState.java
platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
platform/platform-api/src/com/intellij/util/config/AbstractProperty.java
platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java
platform/platform-api/src/com/intellij/util/config/Externalizer.java
platform/platform-impl/src/com/intellij/application/options/ShareSchemeDialog.java [deleted file]
platform/platform-impl/src/com/intellij/application/options/ShareSchemePanel.form [deleted file]
platform/platform-impl/src/com/intellij/application/options/ShareSchemePanel.java [deleted file]
platform/platform-impl/src/com/intellij/execution/impl/ConsoleViewUtil.java
platform/platform-impl/src/com/intellij/ide/startup/impl/StartupManagerImpl.java
platform/platform-impl/src/com/intellij/ide/ui/laf/IntelliJLaf.java
platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java
platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaLaf.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickListsManager.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/SaveSessionBase.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageBase.java [moved from platform/platform-impl/src/com/intellij/openapi/components/store/StateStorageBase.java with 91% similarity]
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java
platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/CompositeDiffTool.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/DiffManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/AbstractToggleUseSoftWrapsAction.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/ReadOnlyColorsSchemeImpl.java [deleted file]
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorComponentImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToggleReadOnlyAttributePanel.java
platform/platform-impl/src/com/intellij/ui/Splash.java
platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/CodeInsightBundle.properties
platform/platform-resources-en/src/messages/OptionsBundle.properties
platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/platform-resources/src/brokenPlugins.txt
platform/platform-resources/src/idea/Keymap_Default.xml
platform/platform-resources/src/idea/LangActions.xml
platform/platform-tests/testData/codeStyle/formatter/addedLines.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/addedLines_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/changedAndDeleted.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/changedAndDeleted_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/changedSingleLine.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/changedSingleLine_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/deletedLines.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/deletedLines_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/insert.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/insert_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/lotsWhiteSpaces.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/lotsWhiteSpaces_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/modification.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/modification_revision.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/modifiedLines.java [new file with mode: 0644]
platform/platform-tests/testData/codeStyle/formatter/modifiedLines_revision.java [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ChangedLinesCounterTest.java [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.java
platform/projectModel-api/src/com/intellij/openapi/components/State.java
platform/projectModel-api/src/com/intellij/openapi/components/Storage.java
platform/projectModel-api/src/com/intellij/openapi/components/StorageId.java
platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java
platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMapDecoder.java
platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form
platform/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java
platform/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/openapi/diff/impl/ComparisonPolicy.java
platform/util/src/com/intellij/openapi/project/IndexNotReadyException.java [deleted file]
platform/util/src/com/intellij/openapi/util/io/ZipFileCache.java
platform/util/src/com/intellij/openapi/util/registry/Registry.java
platform/util/src/com/intellij/openapi/util/registry/RegistryValue.java
platform/util/src/com/intellij/util/ImageLoader.java
platform/util/src/com/intellij/util/SystemProperties.java
platform/util/src/com/intellij/util/containers/MostlySingularMultiMap.java
platform/util/src/com/intellij/util/lang/JarLoader.java
platform/util/src/com/intellij/util/ui/JBUI.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/util/src/com/intellij/util/xmlb/Accessor.java
platform/util/src/com/intellij/util/xmlb/BeanBinding.java
platform/util/src/com/intellij/util/xmlb/FieldAccessor.java
platform/util/src/com/intellij/util/xmlb/PropertyAccessor.java
platform/util/src/com/intellij/util/xmlb/SerializationFilter.java
platform/util/src/com/intellij/util/xmlb/SerializationFilterBase.java
platform/util/src/com/intellij/util/xmlb/SkipDefaultValuesSerializationFilters.java
platform/util/src/com/intellij/util/xmlb/SkipDefaultsSerializationFilter.java [new file with mode: 0644]
platform/util/src/com/intellij/util/xmlb/SmartSerializer.java
platform/util/src/com/intellij/util/xmlb/XmlSerializer.java
platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/PatchReader.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/ForCanBeForeachInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/SleepWhileHoldingLockInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryFullyQualifiedNameInspection.java
plugins/InspectionGadgets/test/com/siyeh/igtest/migration/foreach/ForCanBeForEach.java
plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_fqn_javadoc_fully_qualify_if_not_imported/DoubleQualify.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_fqn_javadoc_fully_qualify_if_not_imported/Single.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_fqn_javadoc_fully_qualify_if_not_imported/expected.xml [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/ForCanBeForeachInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryFullyQualifiedNameInspectionTest.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java
plugins/ant/src/com/intellij/lang/ant/config/impl/AllJarsUnderDirEntry.java
plugins/ant/src/com/intellij/lang/ant/config/impl/AntClasspathEntry.java
plugins/ant/src/com/intellij/lang/ant/config/impl/AntInstallation.java
plugins/ant/src/com/intellij/lang/ant/config/impl/AntReference.java
plugins/ant/src/com/intellij/lang/ant/config/impl/GlobalAntConfiguration.java
plugins/ant/src/com/intellij/lang/ant/config/impl/SinglePathEntry.java
plugins/coverage/src/com/intellij/coverage/view/JavaCoverageViewExtension.java
plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java
plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java
plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java
plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/WarModelBuilderImpl.groovy
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit Test Case.groovy.ft
plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellActionBase.java
plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/changeSignature/SimpleParameterGen.groovy
plugins/java-i18n/src/META-INF/plugin.xml
plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/simple1/p.properties [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/simple1/p_en.properties [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/simple2/p.properties [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/simple2/p_asd.properties [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/withAdditionalLocales/p.properties [new file with mode: 0644]
plugins/java-i18n/testData/inspections/suspiciousLanguages/withAdditionalLocales/p_asd.properties [new file with mode: 0644]
plugins/java-i18n/testSrc/com/intellij/codeInspection/SuspiciousLanguagesInspectionTest.java [new file with mode: 0644]
plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.ft
plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.ft
plugins/junit_rt/src/com/intellij/junit4/JUnit4IdeaTestRunner.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenSchemaProvider.java
plugins/properties/properties-psi-api/resources/messages/PropertiesBundle.properties
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java
plugins/properties/src/com/intellij/lang/properties/customizeActions/DissociateResourceBundleAction.java
plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleNode.java
plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnPhantomChangeDiffRequestProvider.java
plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnTreeConflictDiffRequestProvider.java
plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffTool.java
plugins/tasks/tasks-api/src/com/intellij/tasks/CustomTaskState.java [new file with mode: 0644]
plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepositoryType.java
plugins/tasks/tasks-api/src/com/intellij/tasks/TaskState.java
plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepository.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestApi.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/api2/JiraRestApi2.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/api2/model/JiraTransitionsWrapperApi2.java [new file with mode: 0644]
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/api20alpha1/JiraRestApi20Alpha1.java
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java
plugins/tasks/tasks-core/src/com/intellij/tasks/TaskBundle.properties
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskAction.java
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.form
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.form
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerBreakpointsContextProvider.java
plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerWatchesProvider.java
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java [new file with mode: 0644]
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/httpclient/ResponseUtil.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepositoryEditor.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepositoryType.java
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackOptionsTab.form [deleted file]
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackOptionsTab.java [deleted file]
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepositoryEditor.java
plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/JiraIntegrationTest.java
plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/YouTrackIntegrationTest.java [new file with mode: 0644]
plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/TrelloIntegrationTest.java
plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java
plugins/testng/src/fileTemplates/code/TestNG Test Class.java.ft
plugins/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/editor/StudyEditorFactoryListener.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/run/StudySmartChecker.java
python/educational/src/com/jetbrains/edu/EduAnswerPlaceholderPainter.java
python/educational/src/com/jetbrains/edu/EduNames.java
python/educational/src/com/jetbrains/edu/stepic/CourseInfo.java
python/educational/src/com/jetbrains/edu/stepic/EduStepicConnector.java
python/ide/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java
python/openapi/src/com/jetbrains/python/templateLanguages/PythonTemplateLanguage.java
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
python/src/com/jetbrains/python/console/PydevConsoleRunner.java
resources-en/src/inspectionDescriptions/SuspiciousLocalesLanguages.html [new file with mode: 0644]
resources/src/META-INF/IdeaPlugin.xml
resources/src/idea/ContextViewSettings.xml [deleted file]
resources/src/idea/Debugger.xml [deleted file]
resources/src/idea/JavaActions.xml
resources/src/idea/UsageViewSettings.xml [deleted file]
xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java
xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java
xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java
xml/xml-psi-api/src/com/intellij/javaee/ExternalResourceManager.java
xml/xml-psi-impl/src/com/intellij/javaee/CoreExternalResourceManager.java
xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerEx.java
xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java
xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java
xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java
xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java

index 19932d440338c518bb5ff3aab2c977ae7033d68f..28b37bd39950dbb949d25af3af7a73569e65227c 100755 (executable)
@@ -151,7 +151,7 @@ if [ "$IS_EAP" = "true" ]; then
   OS_NAME=`echo $OS_TYPE | "$TR" '[:upper:]' '[:lower:]'`
   AGENT_LIB="yjpagent-$OS_NAME$BITS"
   if [ -r "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then
-    AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablealloc,delay=10000,sessionname=@@system_selector@@"
+    AGENT="-agentlib:$AGENT_LIB=disablealloc,delay=10000,sessionname=@@system_selector@@"
   fi
 fi
 
index 7421c91f9cc5cd7cba218a7f62d31abdebcec0d7..12a2a523c743a67013c4668597e04070ba2fb347 100644 (file)
@@ -784,6 +784,8 @@ binding.setVariable("buildMacZip", { String zipRoot, String zipPath, List paths,
         exclude(name: "bin/fsnotifier")
         exclude(name: "bin/restarter")
         exclude(name: "MacOS/*")
+        exclude(name: "build.txt")
+        exclude(name: "NOTICE.txt")
         extraBins.each {
           exclude(name: it)
         }
@@ -804,6 +806,13 @@ binding.setVariable("buildMacZip", { String zipRoot, String zipPath, List paths,
       }
     }
 
+    allPaths.each {
+      zipfileset(dir: it, prefix: "$zipRoot/Resources") {
+        include(name: "build.txt")
+        include(name: "NOTICE.txt")
+      }
+    }
+
     zipfileset(file: "$macPath/bin/idea.properties", prefix: "$zipRoot/bin")
   }
 })
index 4edda91e2dd6097e49d503ca0459465b26a701f4..fc3cf13b92db592469720b22be7eb2968fefc342 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -142,11 +142,11 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
     Element state = new Element("state");
     XmlSerializer.serializeInto(myState, state, new SkipDefaultValuesSerializationFilters() {
       @Override
-      protected boolean accepts(@NotNull Accessor accessor, @NotNull Object bean, @Nullable Object beanValue) {
+      public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
         if (myState.compilerWasSpecified && "DEFAULT_COMPILER".equals(accessor.getName())) {
           return true;
         }
-        return super.accepts(accessor, bean, beanValue);
+        return super.accepts(accessor, bean);
       }
     });
 
index 9ceffac57eb4f3167a7773f5d439b4db84a13a1b..ceeef8a6c7810d0a5192a017b62a907fd3a07010 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -93,6 +93,7 @@ import io.netty.handler.codec.protobuf.ProtobufDecoder;
 import io.netty.handler.codec.protobuf.ProtobufEncoder;
 import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
 import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
+import io.netty.util.internal.ThreadLocalRandom;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.ide.PooledThreadExecutor;
@@ -999,6 +1000,9 @@ public class BuildManager implements ApplicationComponent{
       cmdLine.addParameter("-Didea.case.sensitive.fs=" + isFSCaseSensitive);
     }
 
+    // this will make netty initialization faster on some systems
+    cmdLine.addParameter("-Dio.netty.initialSeedUniquifier=" + ThreadLocalRandom.getInitialSeedUniquifier());
+
     boolean isProfilingMode = false;
     final String additionalOptions = config.COMPILER_PROCESS_ADDITIONAL_VM_OPTIONS;
     if (!StringUtil.isEmpty(additionalOptions)) {
@@ -1013,7 +1017,7 @@ public class BuildManager implements ApplicationComponent{
     }
 
     if (isProfilingMode) {
-      cmdLine.addParameter("-agentlib:yjpagent=disablej2ee,disablealloc,delay=10000,sessionname=ExternalBuild");
+      cmdLine.addParameter("-agentlib:yjpagent=disablealloc,delay=10000,sessionname=ExternalBuild");
     }
 
     // debugging
index 4868321f9ca2dcf10099d6aa5014446bf5812983..9d34478d9e534a6b23c1a07e28935103bc325308 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,13 +29,11 @@ import com.intellij.lang.annotation.AnnotationSession;
 import com.intellij.lang.annotation.ExternalAnnotator;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.application.ApplicationManager;
-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.ExcludesConfiguration;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -143,41 +141,41 @@ public class InspectionValidatorWrapper implements Validator {
       return ProcessingItem.EMPTY_ARRAY;
     }
     final ExcludesConfiguration excludesConfiguration = ValidationConfiguration.getExcludedEntriesConfiguration(project);
-    final List<ProcessingItem> items = new ReadAction<List<ProcessingItem>>() {
-      @Override
-      protected void run(final Result<List<ProcessingItem>> result) {
-        final CompileScope compileScope = context.getCompileScope();
-        if (!myValidator.isAvailableOnScope(compileScope)) return;
+    final List<ProcessingItem> items =
+      DumbService.getInstance(project).runReadActionInSmartMode(new Computable<List<ProcessingItem>>() {
+        @Override
+        public List<ProcessingItem> compute() {
+          final CompileScope compileScope = context.getCompileScope();
+          if (!myValidator.isAvailableOnScope(compileScope)) return null;
 
-        final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
+          final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
 
-        final Processor<VirtualFile> processor = new ReadActionProcessor<VirtualFile>() {
-          @Override
-          public boolean processInReadAction(VirtualFile file) {
-            if (!file.isValid()) {
-              return true;
-            }
+          final Processor<VirtualFile> processor = new Processor<VirtualFile>() {
+            @Override
+            public boolean process(VirtualFile file) {
+              if (!file.isValid()) {
+                return true;
+              }
 
-            if (myCompilerManager.isExcludedFromCompilation(file) ||
-                excludesConfiguration.isExcluded(file)) {
-              return true;
-            }
+              if (myCompilerManager.isExcludedFromCompilation(file) ||
+                  excludesConfiguration.isExcluded(file)) {
+                return true;
+              }
 
-            final Module module = context.getModuleByFile(file);
-            if (module != null) {
-              final PsiFile psiFile = myPsiManager.findFile(file);
-              if (psiFile != null) {
-                items.add(new MyValidatorProcessingItem(psiFile));
+              final Module module = context.getModuleByFile(file);
+              if (module != null) {
+                final PsiFile psiFile = myPsiManager.findFile(file);
+                if (psiFile != null) {
+                  items.add(new MyValidatorProcessingItem(psiFile));
+                }
               }
+              return true;
             }
-            return true;
-          }
-        };
-        ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor);
-
-        result.setResult(items);
-      }
-    }.execute().getResultObject();
+          };
+          ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor);
+          return items;
+        }
+      });
     if (items == null) return ProcessingItem.EMPTY_ARRAY;
 
     return items.toArray(new ProcessingItem[items.size()]);
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/CompareValueWithClipboardAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/CompareValueWithClipboardAction.java
deleted file mode 100644 (file)
index 1d6ed15..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2012 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.debugger.actions;
-
-import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.diff.DiffDialogHints;
-import com.intellij.diff.DiffManager;
-import com.intellij.diff.DiffRequestFactory;
-import com.intellij.diff.requests.DiffRequest;
-import com.intellij.openapi.project.Project;
-
-/**
- * @author Jeka
- */
-public class CompareValueWithClipboardAction extends BaseValueAction {
-  protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
-    DiffRequest request = DiffRequestFactory.getInstance().createClipboardVsValue(text);
-    DiffManager.getInstance().showDiff(project, request);
-  }
-}
\ No newline at end of file
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/CopyValueAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/CopyValueAction.java
deleted file mode 100644 (file)
index 2565665..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2000-2009 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.debugger.actions;
-
-import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.openapi.ide.CopyPasteManager;
-import com.intellij.openapi.project.Project;
-
-import java.awt.datatransfer.StringSelection;
-
-/*
- * @author Jeka
- */
-public class CopyValueAction extends BaseValueAction {
-  protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
-    CopyPasteManager.getInstance().setContents(new StringSelection(text));
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/EditWatchAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/EditWatchAction.java
deleted file mode 100644 (file)
index 48bf5ac..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2000-2009 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.debugger.actions;
-
-import com.intellij.debugger.ui.DebuggerPanelsManager;
-import com.intellij.debugger.ui.impl.MainWatchPanel;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.project.Project;
-
-/**
- * User: lex
- * Date: Sep 26, 2003
- * Time: 8:34:01 PM
- */
-public class EditWatchAction extends DebuggerAction {
-  public void actionPerformed(final AnActionEvent e) {
-    final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
-    if(selectedNode == null || !(selectedNode.getDescriptor() instanceof WatchItemDescriptor)) return;
-
-    Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
-
-    MainWatchPanel watchPanel = DebuggerPanelsManager.getInstance(project).getWatchPanel();
-    if(watchPanel != null) {
-      watchPanel.editNode(selectedNode);
-    }
-  }
-
-  public void update(AnActionEvent e) {
-    final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
-
-    e.getPresentation().setVisible(selectedNode != null && selectedNode.getDescriptor() instanceof WatchItemDescriptor);
-  }
-
-};
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/NewWatchAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/NewWatchAction.java
deleted file mode 100644 (file)
index 6a8d3fe..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Class NewWatchAction
- * @author Jeka
- */
-package com.intellij.debugger.actions;
-
-import com.intellij.debugger.ui.DebuggerPanelsManager;
-import com.intellij.debugger.ui.impl.MainWatchPanel;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-public class NewWatchAction extends DebuggerAction {
-  public void actionPerformed(final AnActionEvent e) {
-    getWatchPanel(e).newWatch();
-  }
-
-  @Override
-  public void update(@NotNull AnActionEvent e) {
-    e.getPresentation().setEnabled(getWatchPanel(e) != null);
-  }
-
-  private static MainWatchPanel getWatchPanel(AnActionEvent e) {
-    Project project = e.getProject();
-    return project != null ? DebuggerPanelsManager.getInstance(project).getWatchPanel() : null;
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/RemoveAllWatchesAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/RemoveAllWatchesAction.java
deleted file mode 100644 (file)
index e677322..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2000-2009 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.debugger.actions;
-
-import com.intellij.debugger.ui.impl.watch.DebuggerTree;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.Presentation;
-
-import java.util.Enumeration;
-
-/**
- * User: lex
- * Date: Sep 26, 2003
- * Time: 6:24:44 PM
- */
-public class RemoveAllWatchesAction extends RemoveWatchAction {
-  protected DebuggerTreeNodeImpl[] getNodesToDelete(AnActionEvent e) {
-    DebuggerTree tree = getTree(e.getDataContext());
-    if(tree == null) return null;
-    DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl)tree.getModel().getRoot();
-    DebuggerTreeNodeImpl [] result = new DebuggerTreeNodeImpl[root.getChildCount()];
-    int i = 0;
-    for(Enumeration enumeration = root.children(); enumeration.hasMoreElements(); i++) {
-      DebuggerTreeNodeImpl node = (DebuggerTreeNodeImpl)enumeration.nextElement();
-      result[i] = node;
-    }
-    return result;
-  }
-
-  protected void updatePresentation(Presentation presentation, int watchesCount) {
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/RemoveWatchAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/RemoveWatchAction.java
deleted file mode 100644 (file)
index 3222419..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2000-2009 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.debugger.actions;
-
-import com.intellij.debugger.ui.impl.MainWatchPanel;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
-import com.intellij.debugger.DebuggerBundle;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.Presentation;
-
-import java.util.ArrayList;
-
-public class RemoveWatchAction extends DebuggerAction {
-  protected DebuggerTreeNodeImpl[] getNodesToDelete(AnActionEvent e) {
-    DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
-    if(selectedNodes == null) return null;
-    ArrayList<DebuggerTreeNodeImpl> selectedWatches = new ArrayList<DebuggerTreeNodeImpl>();
-    for (int i = 0; i < selectedNodes.length; i++) {
-      if(selectedNodes[i].getDescriptor() instanceof WatchItemDescriptor) {
-        selectedWatches.add(selectedNodes[i]);
-      }
-    }
-
-    return selectedWatches.toArray(new DebuggerTreeNodeImpl[selectedWatches.size()]);
-  }
-
-  public void actionPerformed(AnActionEvent e) {
-    DebuggerTreeNodeImpl [] nodes = getNodesToDelete(e);
-    if (nodes == null || nodes.length == 0) return;
-
-    MainWatchPanel watchPanel = (MainWatchPanel)getPanel(e.getDataContext());
-
-    for (int i = 0; i < nodes.length; i++) {
-      DebuggerTreeNodeImpl node = nodes[i];
-      watchPanel.getWatchTree().removeWatch(node);
-    }
-  }
-
-  protected void updatePresentation(Presentation presentation, int watchesCount) {
-    presentation.setText(DebuggerBundle.message("action.remove.watch.text", watchesCount));
-  }
-
-  public void update(AnActionEvent event) {
-    Presentation presentation = event.getPresentation();
-    DebuggerTreeNodeImpl[] nodes = getNodesToDelete(event);
-    if (nodes != null && nodes.length > 0) {
-      presentation.setEnabled(true);
-    }
-    else {
-      presentation.setEnabled(false);
-    }
-    updatePresentation(presentation, nodes != null? nodes.length : 0);
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ShowExecutionPointActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/ShowExecutionPointActionHandler.java
deleted file mode 100644 (file)
index f80bab0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2009 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.debugger.actions;
-
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.impl.DebuggerSession;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
-import org.jetbrains.annotations.NotNull;
-
-public class ShowExecutionPointActionHandler extends DebuggerActionHandler {
-  public void perform(@NotNull final Project project, final AnActionEvent event) {
-    final DebuggerSession session = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
-    if (session != null) {
-      session.showExecutionPoint();
-    }
-  }
-
-  public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
-    DebuggerSession debuggerSession = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
-    return debuggerSession != null && debuggerSession.isPaused() &&
-           debuggerSession.getContextManager().getContext().getSuspendContext().getThread() != null;
-  }
-}
\ No newline at end of file
index 972cfef4866101902c0c27cf74274b04520a2295..6c53669dd810a0557013cec223d6ef524c2106e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.actionSystem.ToggleAction;
 import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * @author egor
@@ -36,10 +37,10 @@ public class ShowLibraryFramesAction extends ToggleAction {
   }
 
   @Override
-  public void update(final AnActionEvent e) {
+  public void update(@NotNull final AnActionEvent e) {
     super.update(e);
     final Presentation presentation = e.getPresentation();
-    final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+    final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
     presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
   }
 
index 29a2c3414695d3e1522f71ed42f55108088ad08d..09c869db99c5ecd1f63600d3f96c98e9594adb85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1098,7 +1098,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
           throw (RuntimeException)exception[0];
         }
         else {
-          LOG.assertTrue(false);
+          LOG.error("Unexpected exception " + exception[0]);
         }
       }
 
index 0b1cd18bb05bb2a42df9ea64ea5eab7eaefe0078..5dd4279b3cd1139585ecd89fe6c3b679b7267e66 100644 (file)
@@ -137,11 +137,7 @@ public class JavaDebugProcess extends XDebugProcess {
     myNodeManager = new NodeManagerImpl(session.getProject(), null) {
       @Override
       public DebuggerTreeNodeImpl createNode(final NodeDescriptor descriptor, EvaluationContext evaluationContext) {
-        // value gathered here is required for correct renderers work. e.g. array renderer
-        //((NodeDescriptorImpl)descriptor).setContext((EvaluationContextImpl)evaluationContext);
-        final DebuggerTreeNodeImpl node = new DebuggerTreeNodeImpl(null, descriptor);
-        //((NodeDescriptorImpl)descriptor).updateRepresentation((EvaluationContextImpl)evaluationContext, DescriptorLabelListener.DUMMY_LISTENER);
-        return node;
+        return new DebuggerTreeNodeImpl(null, descriptor);
       }
 
       @Override
@@ -322,7 +318,6 @@ public class JavaDebugProcess extends XDebugProcess {
   public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
     Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
     leftToolbar.add(Separator.getInstance(), beforeRunner);
-    //leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.EXPORT_THREADS), beforeRunner);
     leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
     leftToolbar.add(Separator.getInstance(), beforeRunner);
 
@@ -339,10 +334,10 @@ public class JavaDebugProcess extends XDebugProcess {
     }
 
     @Override
-    public void update(final AnActionEvent e) {
+    public void update(@NotNull final AnActionEvent e) {
       super.update(e);
       final Presentation presentation = e.getPresentation();
-      final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+      final boolean autoModeEnabled = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
       presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
     }
 
@@ -374,10 +369,10 @@ public class JavaDebugProcess extends XDebugProcess {
     }
 
     @Override
-    public void update(final AnActionEvent e) {
+    public void update(@NotNull final AnActionEvent e) {
       super.update(e);
       final Presentation presentation = e.getPresentation();
-      final boolean watchValues = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+      final boolean watchValues = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
       DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
       final String actionText = watchValues ? myMyTextDisable : myTextEnable;
       if (process == null || process.canGetMethodReturnValue()) {
index e4905af7fec5f1d85d6e34c559dc363e553432d8..196995a2501314dce25255945d802a7e5bd1852e 100644 (file)
@@ -46,4 +46,9 @@ public class DisableGC implements Evaluator{
   public Modifier getModifier() {
     return myDelegate.getModifier();
   }
+
+  @Override
+  public String toString() {
+    return "NoGC -> " + myDelegate;
+  }
 }
index 2363cf9f93ba536923005f570e28f4590a819ed5..8779d9f94b91b71bca22b8a4a4dbe6b5928f7a02 100644 (file)
@@ -952,11 +952,10 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
           }
 
           if (qualifier instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifier).resolve() instanceof PsiClass) {
-            // this is a call to a 'static' method
-            if (contextClass == null && type == null) {
-              throwEvaluateException(DebuggerBundle.message("evaluation.error.qualifier.type.unknown", qualifier.getText()));
+            // this is a call to a 'static' method but class is not available, try to evaluate by qname
+            if (contextClass == null) {
+              contextClass = JVMNameUtil.getJVMRawText(((PsiReferenceExpression)qualifier).getQualifiedName());
             }
-            assert contextClass != null;
             objectEvaluator = new TypeEvaluator(contextClass);
           }
           else {
index 2f4b85d22609fd9bc606e81bb3314b1fc45336d7..4597167d9c9941a551362b1fa5171aa55ce75227 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -66,4 +66,9 @@ class LiteralEvaluator implements Evaluator {
     throw EvaluateExceptionUtil
       .createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));
   }
+
+  @Override
+  public String toString() {
+    return myValue.toString();
+  }
 }
index b02ec96fad31c103af47a279564f8d3cc11568b0..caf0e41c07c38024cf1654ef229a7a58bcd852de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -156,4 +156,9 @@ class LocalVariableEvaluator implements Evaluator {
     }
     return modifier;
   }
+
+  @Override
+  public String toString() {
+    return myLocalVariableName;
+  }
 }
index d495f3d19d0867e1007e46b8981ab1a1d2dab778..3aff8225622f8ef044e00d27ae79ff246b814bd0 100644 (file)
@@ -211,4 +211,9 @@ public class MethodEvaluator implements Evaluator {
     }
     return null;
   }
+
+  @Override
+  public String toString() {
+    return "call " + myMethodName;
+  }
 }
index d084c0308b72372e102ab8b9959e2ddc01c0ac67..cc0a18951971e9781604df530ace39dbf85d906e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -84,6 +84,21 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy {
     throw new EvaluateException(error.getMessage(), error);
   }
 
+  @Override
+  public boolean isValid() {
+    if (!super.isValid()) {
+      return false;
+    }
+    try {
+      if (myStackFrame != null) {
+        myStackFrame.location(); //extra check if jdi frame is valid
+      }
+      return true;
+    } catch (InvalidStackFrameException e) {
+      return false;
+    }
+  }
+
   @Override
   protected void clearCaches() {
     DebuggerManagerThreadImpl.assertIsManagerThread();
index 2855ab4dfc1f2b66ac02544a8528d3a37d42d07f..7d654d621549d782f7728006a7cdb7687def2586 100644 (file)
@@ -35,10 +35,8 @@ import java.util.Map;
 
 @State(
   name = "DebuggerSettings",
-  storages = {
-    @Storage(
-      file = StoragePathMacros.APP_CONFIG + "/other.xml"
-    )}
+  defaultStateAsResource = true,
+  storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml")
 )
 public class DebuggerSettings implements Cloneable, PersistentStateComponent<Element> {
   private static final Logger LOG = Logger.getInstance(DebuggerSettings.class);
index a088e953557f1313ac52fb7a60fc123d8268072c..51a96197ba488fec67959a95550a926bef71a252 100644 (file)
@@ -287,7 +287,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
     }
 
     leftToolbar.addSeparator();
-    //addAction(leftToolbar, DebuggerActions.EXPORT_THREADS);
     addAction(leftToolbar, DebuggerActions.DUMP_THREADS);
     leftToolbar.addSeparator();
 
@@ -523,10 +522,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
     }
 
     @Override
-    public void update(final AnActionEvent e) {
+    public void update(@NotNull final AnActionEvent e) {
       super.update(e);
       final Presentation presentation = e.getPresentation();
-      final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+      final boolean autoModeEnabled = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
       presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
     }
 
@@ -558,10 +557,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
     }
 
     @Override
-    public void update(final AnActionEvent e) {
+    public void update(@NotNull final AnActionEvent e) {
       super.update(e);
       final Presentation presentation = e.getPresentation();
-      final boolean watchValues = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+      final boolean watchValues = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
       final DebugProcessImpl process = getDebugProcess();
       final String actionText = watchValues ? myMyTextDisable : myTextEnable;
       if (process != null && process.canGetMethodReturnValue()) {
index e17b8af108271a4a6f0662d44368297ec077cb91..dba4453ae43ce98443719fd0c222d4e026225ab1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -710,10 +710,10 @@ public class FramesPanel extends UpdatableDebuggerView implements DataProvider {
     }
 
     @Override
-    public void update(final AnActionEvent e) {
+    public void update(@NotNull final AnActionEvent e) {
       super.update(e);
       final Presentation presentation = e.getPresentation();
-      final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+      final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
       presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
     }
 
index fc13858daac9cff4de005f732a373c2f1da48346..d10b656ad6a89c9d96b9533d17cb4d6e164ecd60 100644 (file)
@@ -307,7 +307,10 @@ public abstract class SourcePosition implements Navigatable{
   }
      
   public static SourcePosition createFromElement(PsiElement element) {
-    final PsiElement navigationElement = element.getNavigationElement();
+    ApplicationManager.getApplication().assertReadAccessAllowed();
+    PsiElement navigationElement = element.getNavigationElement();
+    final SmartPsiElementPointer<PsiElement> pointer =
+      SmartPointerManager.getInstance(navigationElement.getProject()).createSmartPsiElementPointer(navigationElement);
     final PsiFile psiFile;
     if (JspPsiUtil.isInJspFile(navigationElement)) {
       psiFile = JspPsiUtil.getJspFile(navigationElement);
@@ -318,12 +321,19 @@ public abstract class SourcePosition implements Navigatable{
     return new SourcePositionCache(psiFile) {
       @Override
       protected PsiElement calcPsiElement() {
-        return navigationElement;
+        ApplicationManager.getApplication().assertReadAccessAllowed();
+        return pointer.getElement();
       }
 
       @Override
       protected int calcOffset() {
-        return navigationElement.getTextOffset();
+        return ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
+          @Override
+          public Integer compute() {
+            PsiElement elem = pointer.getElement();
+            return elem != null ? elem.getTextOffset() : -1;
+          }
+        });
       }
     };
   }
index c6bb1f199b0ef4a0306a7e4baed232d6538d4cfb..be42dd7fbf8bbcbf6c62524b641a26724fef882c 100644 (file)
@@ -67,7 +67,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
   @NotNull
   @Override
   public Collection<AttachSourcesAction> getActions(List<LibraryOrderEntry> orderEntries, final PsiFile psiFile) {
-    VirtualFile jar = getJarByPsiFile(psiFile);
+    final VirtualFile jar = getJarByPsiFile(psiFile);
     if (jar == null) return Collections.emptyList();
 
     final String jarName = jar.getNameWithoutExtension();
@@ -145,7 +145,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
             SourceSearcher[] searchers = {new MavenCentralSourceSearcher(), new SonatypeSourceSearcher()};
             for (SourceSearcher searcher : searchers) {
               try {
-                artifactUrl = searcher.findSourceJar(indicator, artifactId, version);
+                artifactUrl = searcher.findSourceJar(indicator, artifactId, version, jar);
               }
               catch (SourceSearchException e) {
                 LOG.warn(e);
index 87867565f63adf2c17951d0af39fa99d325cf338..466903efaf3000c29fea869d5cf515861b0e2601 100644 (file)
@@ -86,20 +86,20 @@ public class IncreaseLanguageLevelFix implements IntentionAction {
     LOG.assertTrue(virtualFile != null);
     final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
     final LanguageLevel moduleLevel = module == null ? null : LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
-    if (moduleLevel != null && isLanguageLevelAcceptable(project, module, myLevel)) {
-      final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
-      rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(myLevel);
-      ApplicationManager.getApplication().runWriteAction(new Runnable() {
-        @Override
-        public void run() {
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        if (moduleLevel != null && isLanguageLevelAcceptable(project, module, myLevel)) {
+          final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
+          rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(myLevel);
           rootModel.commit();
         }
-      });
-    }
-    else {
-      LanguageLevelProjectExtension.getInstance(project).setLanguageLevel(myLevel);
-      ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.INSTANCE, false, true);
-    }
+        else {
+          LanguageLevelProjectExtension.getInstance(project).setLanguageLevel(myLevel);
+          ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.INSTANCE, false, true);
+        }
+      }
+    });
   }
 
   @Nullable
index dc392cec131b585ca585275ad651358221c0d564..eb9f162a909d5264223e76e9a0fee906e6b9891c 100644 (file)
@@ -263,13 +263,14 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
     if (element instanceof PsiMethodCallExpression) {
       final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)element;
 
-      final PsiMethod psiMethod = methodCall.resolveMethod();
+      JavaResolveResult result = methodCall.resolveMethodGenerics();
+      final PsiMethod psiMethod = (PsiMethod)result.getElement();
       if (psiMethod == null) {
         return null;
       }
 
       final PsiReferenceExpression methodExpression = methodCall.getMethodExpression();
-      final String qualifierByMethodCall = getQualifierTextByMethodCall(methodCall, functionalInterfaceType, parameters, psiMethod);
+      final String qualifierByMethodCall = getQualifierTextByMethodCall(methodCall, functionalInterfaceType, parameters, psiMethod, result.getSubstitutor());
       if (qualifierByMethodCall != null) {
         return qualifierByMethodCall + "::" + ((PsiMethodCallExpression)element).getTypeArgumentList().getText() + methodExpression.getReferenceName();
       }
@@ -324,7 +325,8 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
   private static String getQualifierTextByMethodCall(final PsiMethodCallExpression methodCall,
                                                      final PsiType functionalInterfaceType,
                                                      final PsiParameter[] parameters,
-                                                     final PsiMethod psiMethod) {
+                                                     final PsiMethod psiMethod, 
+                                                     final PsiSubstitutor substitutor) {
 
     final PsiExpression qualifierExpression = methodCall.getMethodExpression().getQualifierExpression();
 
@@ -332,7 +334,7 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
     LOG.assertTrue(containingClass != null);
 
     if (qualifierExpression != null) {
-      boolean isReceiverType = PsiMethodReferenceUtil.isReceiverType(functionalInterfaceType, containingClass, psiMethod);
+      boolean isReceiverType = PsiMethodReferenceUtil.isReceiverType(PsiMethodReferenceUtil.getFirstParameterType(functionalInterfaceType, methodCall), containingClass, substitutor);
       return isReceiverType ? composeReceiverQualifierText(parameters, psiMethod, containingClass, qualifierExpression)
                             : qualifierExpression.getText();
     }
@@ -422,7 +424,6 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
       if (lambdaExpression == null) return;
       PsiType functionalInterfaceType = lambdaExpression.getFunctionalInterfaceType();
       if (functionalInterfaceType == null || !functionalInterfaceType.isValid()) return;
-      String functionalTypeText = functionalInterfaceType.getCanonicalText();
       final String methodRefText = createMethodReferenceText(element, functionalInterfaceType,
                                                              lambdaExpression.getParameterList().getParameters());
 
index 65c6777bcbbb58508d84b58ec3340d7fc593aa0a..e4103ce1a9c9a39b3b146a65546263000912327b 100644 (file)
@@ -106,7 +106,7 @@ public class CodeInsightUtil {
     if (parent == null) return PsiElement.EMPTY_ARRAY;
     while (true) {
       if (parent instanceof PsiStatement) {
-        if (!(element1 instanceof PsiComment || element2 instanceof PsiComment)) {
+        if (!(element1 instanceof PsiComment)) {
           parent = parent.getParent();
         }
         break;
index d36c35ca6e739887670d6e9d52c497f9275c6916..90e550a75b307b276bdab9b12fe43a8253406a2c 100644 (file)
@@ -37,9 +37,11 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
+import java.util.Set;
 
 import static com.intellij.patterns.PsiJavaPatterns.psiClass;
 import static com.intellij.patterns.PsiJavaPatterns.psiElement;
@@ -117,26 +119,52 @@ public class JavaClassNameCompletionContributor extends CompletionContributor {
 
     final boolean pkgContext = JavaCompletionUtil.inSomePackage(insertedElement);
     AllClassesGetter.processJavaClasses(parameters, matcher, filterByScope, new Consumer<PsiClass>() {
-        @Override
-        public void consume(PsiClass psiClass) {
-          if (filter.isAcceptable(psiClass, insertedElement)) {
-            if (!inJavaContext) {
-              consumer.consume(AllClassesGetter.createLookupItem(psiClass, AllClassesGetter.TRY_SHORTENING));
-            } else {
-              for (JavaPsiClassReferenceElement element : createClassLookupItems(psiClass, afterNew,
-                                                                                 JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER, new Condition<PsiClass>() {
+      @Override
+      public void consume(PsiClass psiClass) {
+        processClass(psiClass, ContainerUtil.<PsiClass>newHashSet(), "");
+      }
+
+      private void processClass(PsiClass psiClass, Set<PsiClass> visited, String prefix) {
+        if (!visited.add(psiClass)) return;
+
+        boolean isInnerClass = StringUtil.isNotEmpty(prefix);
+        if (isInnerClass && isProcessedIndependently(psiClass)) {
+          return;
+        }
+
+        if (filter.isAcceptable(psiClass, insertedElement)) {
+          if (!inJavaContext) {
+            JavaPsiClassReferenceElement element = AllClassesGetter.createLookupItem(psiClass, AllClassesGetter.TRY_SHORTENING);
+            element.setLookupString(prefix + element.getLookupString());
+            consumer.consume(element);
+          } else {
+            for (JavaPsiClassReferenceElement element : createClassLookupItems(psiClass, afterNew,
+                                                                               JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER, new Condition<PsiClass>() {
                 @Override
                 public boolean value(PsiClass psiClass) {
                   return filter.isAcceptable(psiClass, insertedElement) &&
                          AllClassesGetter.isAcceptableInContext(insertedElement, psiClass, filterByScope, pkgContext);
                 }
               })) {
-                consumer.consume(element);
-              }
+              element.setLookupString(prefix + element.getLookupString());
+              consumer.consume(element);
+            }
+          }
+        } else {
+          String name = psiClass.getName();
+          if (name != null) {
+            for (PsiClass innerClass : psiClass.getInnerClasses()) {
+              processClass(innerClass, visited, prefix + name + ".");
             }
           }
         }
-      });
+      }
+
+      private boolean isProcessedIndependently(PsiClass psiClass) {
+        String innerName = psiClass.getName();
+        return innerName != null && matcher.prefixMatches(innerName);
+      }
+    });
   }
 
   static LookupElement highlightIfNeeded(JavaPsiClassReferenceElement element, CompletionParameters parameters) {
index 9817ce5e631d24ce1ec838715754dba07fff310b..3dca018ab61a78a50ee1d9819220479ba80e20d5 100644 (file)
@@ -664,7 +664,20 @@ public class GenerateMembersUtil {
       }
     }
     result = (PsiMethod)CodeStyleManager.getInstance(project).reformat(result);
-    PropertyUtil.annotateWithNullableStuff(field, result);
+
+    PsiModifierListOwner listOwner = null;
+    if (templatesManager instanceof GetterTemplatesManager) {
+      listOwner = result;
+    }
+    else {
+      final PsiParameter[] parameters = result.getParameterList().getParameters();
+      if (parameters.length == 1) {
+        listOwner = parameters[0];
+      }
+    }
+    if (listOwner != null) {
+      PropertyUtil.annotateWithNullableStuff(field, listOwner);
+    }
     return generatePrototype(field, result);
   }
 
index bb6bb906b464cbab16ed8ff4c0fe5e691bc31564..4c1046e4f50390e96da84312d273e40ae5d4ec94 100644 (file)
@@ -5,7 +5,7 @@ static void ##
 #else
   $classname ##
 #end
-set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name))($field.type $paramName) {
+set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
 #if ($field.name == $paramName)
   #if (!$field.modifierStatic)
   this.##
index b63bfeb33fd8f2131014bdb561b1c672881bd021..7482fcfb2a6cff875c698196e25617e9b0cb7e5e 100644 (file)
@@ -3,7 +3,7 @@ public ##
   static ##
 #end
 $field.type ##
-#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name)))
+#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
 #if ($field.boolean)
   #if ($StringUtil.startsWithIgnoreCase($name, 'is'))
     #set($name = $StringUtil.decapitalize($name))
index 1418987baba0017a026d5eab3e0615e0e81956d0..7a1e2a76100ee405086b803967e5fe6262df0d64 100644 (file)
@@ -3,7 +3,7 @@ public ##
 #if($field.modifierStatic)
   static ##
 #end
-void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name))($field.type $paramName) {
+void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
   #if ($field.name == $paramName)
     #if (!$field.modifierStatic)
       this.##
index c8b7da8aed28ac5b3fd718802288ca0a65b7118c..e62fa10e4550a4f9cf7afe6ff1a92a5220322731 100644 (file)
@@ -40,7 +40,9 @@ import com.intellij.openapi.ui.popup.PopupChooserBuilder;
 import com.intellij.openapi.util.Computable;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.util.MethodSignatureUtil;
 import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.ui.components.JBList;
 import com.intellij.util.IncorrectOperationException;
 
@@ -180,7 +182,9 @@ public class ImplementAbstractMethodHandler {
     ArrayList<PsiClass> list = new ArrayList<PsiClass>();
     for (PsiClass inheritor : ClassInheritorsSearch.search(psiClass, true)) {
       if (!inheritor.isInterface()) {
-        PsiMethod method = inheritor.findMethodBySignature(myMethod, true);
+        final PsiSubstitutor classSubstitutor = TypeConversionUtil.getClassSubstitutor(psiClass, inheritor, PsiSubstitutor.EMPTY);
+        LOG.assertTrue(classSubstitutor != null);
+        PsiMethod method = MethodSignatureUtil.findMethodBySignature(inheritor, myMethod.getSignature(classSubstitutor), true);
         if (method == null || !method.getContainingClass().equals(psiClass)) continue;
         list.add(inheritor);
       }
index aeb6c7574a01b54261abe7cd9b3524106dc91f81..7e4ed56399049f32a4b042970bcd5827383cc57e 100644 (file)
@@ -2,6 +2,7 @@ package com.intellij.jarFinder;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.vfs.VirtualFile;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.xpath.XPath;
@@ -21,13 +22,19 @@ public class MavenCentralSourceSearcher extends SourceSearcher {
   @Override
   protected String findSourceJar(@NotNull ProgressIndicator indicator,
                                  @NotNull String artifactId,
-                                 @NotNull String version) throws SourceSearchException {
+                                 @NotNull String version,
+                                 @NotNull VirtualFile classesJar) throws SourceSearchException {
     try {
       indicator.setText("Connecting to https://search.maven.org");
 
       indicator.checkCanceled();
 
-      String url = "https://search.maven.org/solrsearch/select?rows=3&wt=xml&q=a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
+      String url = "https://search.maven.org/solrsearch/select?rows=3&wt=xml&q=";
+      final String groupId = findMavenGroupId(classesJar, artifactId);
+      if (groupId != null) {
+        url += "g:%22" + groupId + "%22%20AND%20";
+      }
+      url += "a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
       @SuppressWarnings("unchecked")
       List<Element> artifactList = (List<Element>)XPath.newInstance("/response/result/doc/str[@name='g']").selectNodes(readDocumentCancelable(indicator, url));
       if (artifactList.isEmpty()) {
index b4251970fc1033f13c9a32e8210124a4bbbfa55c..76d713055a4a116e9ee537b6eabbba8adaf6b920 100644 (file)
@@ -2,6 +2,7 @@ package com.intellij.jarFinder;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.vfs.VirtualFile;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.xpath.XPath;
@@ -19,7 +20,10 @@ public class SonatypeSourceSearcher extends SourceSearcher {
 
   @Nullable
   @Override
-  public String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version)
+  public String findSourceJar(@NotNull final ProgressIndicator indicator,
+                              @NotNull String artifactId,
+                              @NotNull String version,
+                              @NotNull VirtualFile classesJar)
     throws SourceSearchException {
     try {
       indicator.setIndeterminate(true);
@@ -28,6 +32,11 @@ public class SonatypeSourceSearcher extends SourceSearcher {
       indicator.checkCanceled();
 
       String url = "https://oss.sonatype.org/service/local/lucene/search?collapseresults=true&c=sources&a=" + artifactId + "&v=" + version;
+      String groupId = findMavenGroupId(classesJar, artifactId);
+      if(groupId != null) {
+        url += ("&g=" + groupId);
+      }
+
       List<Element> artifactList = (List<Element>)XPath.newInstance("/searchNGResponse/data/artifact").selectNodes(readDocumentCancelable(indicator, url));
       if (artifactList.isEmpty()) {
         return null;
@@ -50,7 +59,7 @@ public class SonatypeSourceSearcher extends SourceSearcher {
         return null;
       }
 
-      String groupId = element.getChildTextTrim("groupId");
+      groupId = element.getChildTextTrim("groupId");
       String repositoryId = artifactHintList.get(0).getChildTextTrim("repositoryId");
 
       return "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=" +
index 3c5d138e2b13d0bf1c899a3a7bd37f93a6aedaa0..3533f1a4bb21128e638edd1c9ad509fd805ca2ff 100644 (file)
@@ -2,6 +2,10 @@ package com.intellij.jarFinder;
 
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.openapi.util.io.StreamUtil;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.io.HttpRequests;
 import org.jdom.Document;
 import org.jdom.JDOMException;
@@ -9,19 +13,43 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
+import java.util.Enumeration;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 
 /**
  * @author Sergey Evdokimov
  */
 public abstract class SourceSearcher {
+
+  private static final String MAVEN_POM_ENTRY_PREFIX = "META-INF/maven/";
+
+  /**
+   * @param indicator
+   * @param artifactId
+   * @param version
+   * @return url of found artifact
+   */
+  @Nullable
+  protected String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version)
+    throws SourceSearchException {
+    return null;
+  }
+
   /**
    * @param indicator
    * @param artifactId
    * @param version
-   * @return groupId of found artifact and url.
+   * @param classesJar classes jar
+   * @return url of found artifact
    */
   @Nullable
-  protected abstract String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version) throws SourceSearchException;
+  protected String findSourceJar(@NotNull final ProgressIndicator indicator,
+                                 @NotNull String artifactId,
+                                 @NotNull String version,
+                                 @NotNull VirtualFile classesJar) throws SourceSearchException {
+    return findSourceJar(indicator, artifactId, version);
+  }
 
   @NotNull
   protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException {
@@ -39,6 +67,34 @@ public abstract class SourceSearcher {
         }
       });
   }
+
+  @Nullable
+  protected static String findMavenGroupId(@NotNull VirtualFile classesJar, String artifactId) {
+    try {
+      JarFile jarFile = new JarFile(VfsUtilCore.virtualToIoFile(classesJar));
+      try {
+        final Enumeration<JarEntry> entries = jarFile.entries();
+        while (entries.hasMoreElements()) {
+          JarEntry entry = entries.nextElement();
+          final String name = entry.getName();
+          if (StringUtil.startsWith(name, MAVEN_POM_ENTRY_PREFIX) && StringUtil.endsWith(name, "/" + artifactId + "/pom.xml")) {
+            final int index = name.indexOf('/', MAVEN_POM_ENTRY_PREFIX.length());
+            return index != -1 ? name.substring(MAVEN_POM_ENTRY_PREFIX.length(), index) : null;
+          }
+        }
+      }
+      finally {
+        try {
+          jarFile.close();
+        }
+        catch (IOException ignore) {
+        }
+      }
+    }
+    catch (IOException ignore) {
+    }
+    return null;
+  }
 }
 
 class SourceSearchException extends Exception {
index bd2d1a9a29fc3a6abe10f32743e5507b5e163eba..eddd536d19fbacc08ac4dec47932f7e235b9e490 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.psi.PsiJavaFile;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * @author max
@@ -44,7 +45,10 @@ public class JavaImportOptimizer implements ImportOptimizer {
     Project project = file.getProject();
     final PsiImportList newImportList = JavaCodeStyleManager.getInstance(project).prepareOptimizeImportsResult((PsiJavaFile)file);
     if (newImportList == null) return EmptyRunnable.getInstance();
-    return new Runnable() {
+
+    return new CollectingInfoRunnable() {
+      private int myImportListLengthDiff = 0;
+
       @Override
       public void run() {
         try {
@@ -55,12 +59,23 @@ public class JavaImportOptimizer implements ImportOptimizer {
           }
           final PsiImportList oldImportList = ((PsiJavaFile)file).getImportList();
           assert oldImportList != null;
+          int importsBefore = oldImportList.getAllImportStatements().length;
           oldImportList.replace(newImportList);
+          myImportListLengthDiff = importsBefore - newImportList.getAllImportStatements().length;
         }
         catch (IncorrectOperationException e) {
           LOG.error(e);
         }
       }
+
+      @Nullable
+      @Override
+      public String getUserNotificationInfo() {
+        if (myImportListLengthDiff > 0) {
+          return "removed " + myImportListLengthDiff + " import" + (myImportListLengthDiff > 1 ? "s" : "");
+        }
+        return null;
+      }
     };
   }
 
index 392cacfb2ac91f38cf0b6df172b69da8fabbf642..c93b33068c1bab438eda2786e5afa6cd9d6a90f1 100644 (file)
@@ -1,19 +1,34 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.psi.impl.source.resolve.reference.impl.providers;
 
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiPackage;
-import com.intellij.psi.impl.source.resolve.reference.impl.providers.PackageReferenceSet;
 import com.intellij.util.PatternUtil;
 import com.intellij.util.Processor;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.regex.Pattern;
 
 public class PatternPackageReferenceSet extends PackageReferenceSet {
+
   public PatternPackageReferenceSet(String packageName, PsiElement element, int startInElement) {
     super(packageName, element, startInElement);
   }
@@ -24,7 +39,7 @@ public class PatternPackageReferenceSet extends PackageReferenceSet {
 
     if (packageName.contains("*")) {
       final Pattern pattern = PatternUtil.fromMask(packageName);
-      final Set<PsiPackage> packages = new HashSet<PsiPackage>();
+      final Set<PsiPackage> packages = new LinkedHashSet<PsiPackage>();
 
       processSubPackages(context, new Processor<PsiPackage>() {
         @Override
@@ -39,13 +54,13 @@ public class PatternPackageReferenceSet extends PackageReferenceSet {
 
       return packages;
     }
-    else {
-      return super.resolvePackageName(context, packageName);
-    }
+
+    return super.resolvePackageName(context, packageName);
   }
 
-   protected static boolean processSubPackages(final PsiPackage pkg, final Processor<PsiPackage> processor) {
+  protected static boolean processSubPackages(final PsiPackage pkg, final Processor<PsiPackage> processor) {
     if (!processor.process(pkg)) return false;
+
     for (final PsiPackage aPackage : pkg.getSubPackages()) {
       if (!processSubPackages(aPackage, processor)) return false;
     }
index a620938830ef2ac7d69a57e83acbf997744825cb..c07294b603515334e347612c0cb0c491c1db5cc9 100644 (file)
@@ -203,8 +203,8 @@ public class CreateTestDialog extends DialogWrapper {
     }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)),
                                 myTargetPackageField.getChildComponent());
 
-    myGenerateBeforeBox = new JCheckBox("setUp/@Before");
-    myGenerateAfterBox = new JCheckBox("tearDown/@After");
+    myGenerateBeforeBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.setUp"));
+    myGenerateAfterBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.tearDown"));
 
     myShowInheritedMethodsBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.show.inherited"));
     myShowInheritedMethodsBox.addActionListener(new ActionListener() {
@@ -411,7 +411,9 @@ public class CreateTestDialog extends DialogWrapper {
     constr.gridy = gridy++;
     constr.gridx = 0;
     constr.weightx = 0;
-    panel.add(new JLabel(CodeInsightBundle.message("intention.create.test.dialog.select.methods")), constr);
+    final JLabel membersLabel = new JLabel(CodeInsightBundle.message("intention.create.test.dialog.select.methods"));
+    membersLabel.setLabelFor(myMethodsTable);
+    panel.add(membersLabel, constr);
 
     constr.gridx = 1;
     constr.weightx = 1;
index 1fd4e786509fa780ad969969b9ae60f388961312..b9cd4b2a13935b797aebfe867862a3bce80598d9 100644 (file)
@@ -30,10 +30,10 @@ public class PsiMethodReferenceUtil {
   public static final Logger LOG = Logger.getInstance("#" + PsiMethodReferenceUtil.class.getName());
 
   public static boolean hasReceiver(PsiType[] parameterTypes, QualifierResolveResult qualifierResolveResult, PsiMethodReferenceExpression methodRef) {
-    if (parameterTypes.length > 0 && 
+    if (parameterTypes.length > 0 &&
         !methodRef.isConstructor() &&
-        isReceiverType(parameterTypes[0], qualifierResolveResult.getContainingClass(), qualifierResolveResult.getSubstitutor()) &&
-        isStaticallyReferenced(methodRef)) {
+        isStaticallyReferenced(methodRef) &&
+        isReceiverType(parameterTypes[0], qualifierResolveResult.getContainingClass(), qualifierResolveResult.getSubstitutor())) {
       return true;
     }
     return false;
@@ -46,7 +46,7 @@ public class PsiMethodReferenceUtil {
       LOG.assertTrue(containingClass != null);
       PsiSubstitutor subst = result.getSubstitutor();
       PsiClass qContainingClass = getQualifierResolveResult(expression).getContainingClass();
-      if (qContainingClass != null && isReceiverType(functionalInterfaceType, containingClass, (PsiMethod)resolve)) {
+      if (qContainingClass != null && isReceiverType(getFirstParameterType(functionalInterfaceType, expression), qContainingClass,  subst)) {
         subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
         LOG.assertTrue(subst != null);
       }
@@ -202,53 +202,27 @@ public class PsiMethodReferenceUtil {
     return true;
   }
 
-  public static boolean isReceiverType(@Nullable PsiClass aClass, @Nullable PsiClass containingClass) {
-    return InheritanceUtil.isInheritorOrSelf(aClass, containingClass, true);
-  }
-
-  public static boolean isReceiverType(PsiType receiverType, @Nullable PsiClass containingClass, PsiSubstitutor psiSubstitutor) {
-    if (containingClass != null) {
-      receiverType = getExpandedType(receiverType, containingClass);
-    }
-    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(receiverType);
-    final PsiClass receiverClass = resolveResult.getElement();
-    if (receiverClass != null && isReceiverType(receiverClass, containingClass)) {
-      if (emptyOrRaw(containingClass, psiSubstitutor)) {
-        return true;
-      }
-      final PsiSubstitutor derivedSubstitutor = TypeConversionUtil.getClassSubstitutor(containingClass, receiverClass, psiSubstitutor);
-      return derivedSubstitutor != null && TypeConversionUtil.isAssignable(JavaPsiFacade.getElementFactory(containingClass.getProject()).createType(containingClass, derivedSubstitutor), receiverType);
+  //if P1, ..., Pn is not empty and P1 is a subtype of ReferenceType, then the method reference expression is treated as 
+  // if it were a method invocation expression with argument expressions of types P2, ...,Pn.
+  public static boolean isReceiverType(@Nullable PsiType receiverType, PsiClass containingClass, PsiSubstitutor psiSubstitutor) {
+    if (receiverType == null) {
+      return false;
     }
-    return false;
+    return TypeConversionUtil.isAssignable(JavaPsiFacade.getElementFactory(containingClass.getProject()).createType(containingClass, psiSubstitutor), 
+                                           getExpandedType(receiverType, containingClass));
   }
 
-  private static boolean emptyOrRaw(PsiClass containingClass, PsiSubstitutor psiSubstitutor) {
-    return PsiUtil.isRawSubstitutor(containingClass, psiSubstitutor) ||
-           psiSubstitutor.getSubstitutionMap().isEmpty();
-  }
-
-  public static boolean isReceiverType(PsiType functionalInterfaceType, PsiClass containingClass, @Nullable PsiMethod referencedMethod) {
+  public static PsiType getFirstParameterType(PsiType functionalInterfaceType, PsiElement context) {
     final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
     final MethodSignature function = LambdaUtil.getFunction(resolveResult.getElement());
     if (function != null) {
       final int interfaceMethodParamsLength = function.getParameterTypes().length;
       if (interfaceMethodParamsLength > 0) {
-        final PsiType firstParamType = resolveResult.getSubstitutor().substitute(function.getParameterTypes()[0]);
-        boolean isReceiver = isReceiverType(firstParamType,
-                                            containingClass, PsiUtil.resolveGenericsClassInType(firstParamType).getSubstitutor());
-        if (isReceiver) {
-          if (referencedMethod == null){
-            if (interfaceMethodParamsLength == 1) return true;
-            return false;
-          }
-          if (referencedMethod.getParameterList().getParametersCount() != interfaceMethodParamsLength - 1) {
-            return false;
-          }
-          return true;
-        }
+        PsiType type = resolveResult.getSubstitutor().substitute(function.getParameterTypes()[0]);
+        return type != null ? PsiUtil.captureToplevelWildcards(type, context) : null;
       }
     }
-    return false;
+    return null;
   }
 
   private static PsiType getExpandedType(PsiType type, @NotNull PsiElement typeElement) {
index 063f2b81934e42a4c0dcc52647b6ac1a42602e72..276fd77f0e3f9d8b62015a41e167a32ee0f4b7f5 100644 (file)
@@ -312,17 +312,17 @@ public class MethodCandidateInfo extends CandidateInfo{
 
 
   public static CurrentCandidateProperties getCurrentMethod(PsiElement context) {
+    if (isOverloadCheck()) {
+      ourOverloadGuard.prohibitResultCaching(ourOverloadGuard.currentStack().get(0));
+    }
     final Map<PsiElement, CurrentCandidateProperties> currentMethodCandidates = CURRENT_CANDIDATE.get();
     return currentMethodCandidates != null ? currentMethodCandidates.get(context) : null;
   }
 
   public static void updateSubstitutor(PsiElement context, PsiSubstitutor newSubstitutor) {
-    final Map<PsiElement, CurrentCandidateProperties> currentMethodCandidates = CURRENT_CANDIDATE.get();
-    if (currentMethodCandidates != null) {
-      final CurrentCandidateProperties properties = currentMethodCandidates.get(context);
-      if (properties != null) {
-        properties.setSubstitutor(newSubstitutor);
-      }
+    CurrentCandidateProperties candidateProperties = getCurrentMethod(context);
+    if (candidateProperties != null) {
+      candidateProperties.setSubstitutor(newSubstitutor);
     }
   }
 
index 3213970cc2601a3e18149af319c87591a613a462..1106633efdb01bfe0baa9fef10f045be4af05a98 100644 (file)
@@ -403,6 +403,7 @@ public class TypeConversionUtil {
       final PsiClass class1 = PsiUtil.resolveClassInType(typeArg1);
       if (class1 instanceof PsiTypeParameter) {
         for (PsiType type : class1.getExtendsListTypes()) {
+          type = substitutor1.substitute(type);
           if (TypesDistinctProver.provablyDistinct(type, typeArg2) && !isAssignable(type, typeArg2)) return false;
         }
       }
index 9a3fc135e16fc1d2d0e485ef401b51fcc311a38a..7d59b98b1fcfeeebbad57e330fe8cff033d92bbb 100644 (file)
@@ -262,7 +262,13 @@ public class TypesDistinctProver {
       final PsiType boundBound = ((PsiWildcardType)bound).getBound();
       if (boundBound != null && !boundBound.equals(type)) {
         final PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(boundBound);
-        return psiClass == null || !(((PsiWildcardType)bound).isExtends() && possibleClasses.contains(psiClass));
+        if (psiClass == null) {
+          return true;
+        }
+        if (psiClass instanceof PsiTypeParameter) {
+          return try2ProveTypeParameterDistinct(type, psiClass);
+        }
+        return !(((PsiWildcardType)bound).isExtends() && possibleClasses.contains(psiClass));
       }
       return false;
     }
index 8311ec0b199a59ab99ae59a2bd70719951893c65..e4a4add097d05d267cdcde375aa252c026fff5a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,10 +41,13 @@ import com.intellij.psi.impl.LanguageConstantExpressionEvaluator;
 import com.intellij.psi.impl.PsiExpressionEvaluator;
 import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
 import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
+import com.intellij.psi.impl.search.MethodSuperSearcher;
 import com.intellij.psi.impl.source.tree.CoreJavaASTFactory;
 import com.intellij.psi.impl.source.tree.PlainTextASTFactory;
 import com.intellij.psi.presentation.java.*;
+import com.intellij.psi.search.searches.SuperMethodsSearch;
 import com.intellij.psi.stubs.BinaryFileStubBuilders;
+import com.intellij.util.QueryExecutor;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -98,6 +101,8 @@ public class JavaCoreApplicationEnvironment extends CoreApplicationEnvironment {
       }
     });
 
+    registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class);
+    addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher());
   }
 
   @SuppressWarnings("MethodMayBeStatic") // overridden in upsource
index cc632cae898338fb0919d55ef7e5f69180daa402..64169e127a6cc3673f52502f5cde1ec7dd5c57b3 100644 (file)
@@ -852,6 +852,7 @@ public class ControlFlowUtil {
 
   private static PsiReferenceExpression findReferenceTo(PsiElement element, PsiVariable variable) {
     if (element instanceof PsiReferenceExpression
+        && !((PsiReferenceExpression)element).isQualified()
         && ((PsiReferenceExpression)element).resolve() == variable) {
       return (PsiReferenceExpression)element;
     }
index 67143a7b73a50bd93cca1a11375c0284d9827159..2a03a31bb3ea4e7233224b05c778bd218ca9da4a 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicatorProvider;
 import com.intellij.openapi.roots.FileIndexFacade;
 import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
@@ -711,6 +712,10 @@ public class PsiClassImplUtil {
 
   @Nullable
   public static PsiClassType correctType(PsiClassType originalType, final GlobalSearchScope resolveScope) {
+    if (!Registry.is("java.correct.class.type.by.place.resolve.scope")) {
+      return originalType;
+    }
+
     final PsiClassType.ClassResolveResult originalResolveResult = originalType.resolveGenerics();
     PsiClass superClass = originalResolveResult.getElement();
     if (superClass == null) {
@@ -746,7 +751,7 @@ public class PsiClassImplUtil {
             }
           });
           if (substitute == null) return null;
-          
+
           substitutor = substitutor.put(typeParameters[i], substitute);
         }
       }
index 72256079a0fd11fa722c474c57a0b43bd97dff9e..87df5dcb049d7920d2208660c8cc19b5da3172df 100644 (file)
@@ -83,4 +83,14 @@ public class LightFieldBuilder extends LightVariableBuilder<LightFieldBuilder> i
   public PsiClass getContainingClass() {
     return myContainingClass;
   }
+
+  @Override
+  public boolean isEquivalentTo(PsiElement another) {
+    if (!(another instanceof PsiField)) return false;
+    if (!((PsiField)another).getName().equals(getName())) return false;
+    if (hasModifierProperty(PsiModifier.STATIC) != ((PsiField)another).hasModifierProperty(PsiModifier.STATIC)) return false;
+    final PsiClass containingClass = getContainingClass();
+    final PsiClass anotherClass = ((PsiField)another).getContainingClass();
+    return containingClass == null && anotherClass == null || getManager().areElementsEquivalent(containingClass, anotherClass);
+  }
 }
similarity index 99%
rename from java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodSuperSearcher.java
rename to java/java-psi-impl/src/com/intellij/psi/impl/search/MethodSuperSearcher.java
index acb5faae4947d98d1da9ca24adf20ea781d00fab..d19b54fdd75c35c86f7f9164316c808a6e5d115a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 23460fbda4fc2dba17359fa678ecfdd355ca9ba5..cf974c91f9804c72387ab0dba3fcdf95d61310c8 100644 (file)
@@ -18,10 +18,12 @@ package com.intellij.psi.impl.source.resolve.graphInference.constraints;
 import com.intellij.codeInsight.ExceptionUtil;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.Condition;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable;
 import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
+import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.Function;
@@ -45,7 +47,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
   }
 
   @Override
-  public boolean reduce(InferenceSession session, List<ConstraintFormula> constraints) {
+  public boolean reduce(final InferenceSession session, List<ConstraintFormula> constraints) {
     if (!PsiPolyExpressionUtil.isPolyExpression(myExpression)) {
       return true;
     }
@@ -111,7 +113,12 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
             }
           });
           if (exceptions != null) {
-            thrownTypes.addAll(exceptions);
+            thrownTypes.addAll(ContainerUtil.filter(exceptions, new Condition<PsiClassType>() {
+              @Override
+              public boolean value(PsiClassType type) {
+                return session.isProperType(type) && InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_EXCEPTION);
+              }
+            }));
           }
         }
       } else {
@@ -169,7 +176,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
 
   private static boolean isAddressed(List<PsiType> expectedThrownTypes, PsiType thrownType) {
     for (PsiType expectedThrownType : expectedThrownTypes) {
-      if (TypeConversionUtil.isAssignable(expectedThrownType, thrownType)) {
+      if (TypeConversionUtil.isAssignable(TypeConversionUtil.erasure(thrownType), expectedThrownType)) {
         return true;
       }
     }
index 2408bbba5bff7a7258add9a9d26eef6bd9fea682..e640caf1f80269babb03fa9d12eccadb10b1d7fc 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.registry.Registry;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
@@ -480,7 +479,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
 
         PsiClass qContainingClass = PsiMethodReferenceUtil.getQualifierResolveResult(this).getContainingClass();
         if (qContainingClass != null && containingClass != null &&
-            PsiMethodReferenceUtil.isReceiverType(left, containingClass, (PsiMethod)resolve)) {
+            PsiMethodReferenceUtil.isReceiverType(PsiMethodReferenceUtil.getFirstParameterType(left, this), qContainingClass, subst)) {
           subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
           LOG.assertTrue(subst != null);
         }
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_after.java b/java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_after.java
new file mode 100644 (file)
index 0000000..edb36d6
--- /dev/null
@@ -0,0 +1,14 @@
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class Test {
+
+        public static void main(String[] args) {
+            List<String> list = new ArrayList<String>();
+            int a = 3;
+
+int b = 3;
+        }
+
+}
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_before.java b/java/java-tests/testData/actions/reformatFileInEditor/selectedTextAndOptimizeImports_before.java
new file mode 100644 (file)
index 0000000..2256d47
--- /dev/null
@@ -0,0 +1,17 @@
+import java.lang.String;
+import java.util.List;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+
+public class Test {
+
+        public static void main(String[] args) {
+<selection>List<String> list = new ArrayList<String>();
+int a = 3;</selection>
+
+int b = 3;
+        }
+
+}
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_after.java b/java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_after.java
new file mode 100644 (file)
index 0000000..7e145c3
--- /dev/null
@@ -0,0 +1,11 @@
+public class Test {
+
+    int a = 2;
+    int b = 3;
+
+
+         public void run() {
+               int myFirst = 12;
+            }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_before.java b/java/java-tests/testData/actions/reformatFileInEditor/selectionReformat_before.java
new file mode 100644 (file)
index 0000000..d753fc6
--- /dev/null
@@ -0,0 +1,11 @@
+public class Test {
+
+      <selection>int a = 2;
+           int b = 3;</selection>
+
+
+         public void run() {
+               int myFirst = 12;
+            }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_after.java b/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_after.java
new file mode 100644 (file)
index 0000000..b3c3407
--- /dev/null
@@ -0,0 +1,11 @@
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class Test {
+
+    public static void main(String[] args) {
+        List<String> list = new ArrayList<String>();
+    }
+
+}
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_before.java b/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformatAndOptimize_before.java
new file mode 100644 (file)
index 0000000..a996d55
--- /dev/null
@@ -0,0 +1,14 @@
+import java.lang.String;
+import java.util.List;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+
+public class Test {
+
+        public static void main(String[] args) {
+List<String> list = new ArrayList<String>();
+  }
+
+}
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_after.java b/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_after.java
new file mode 100644 (file)
index 0000000..05460c5
--- /dev/null
@@ -0,0 +1,10 @@
+public class Test {
+
+    public int a = 3;
+
+
+    public void test() {
+        int c = 3;
+    }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_before.java b/java/java-tests/testData/actions/reformatFileInEditor/wholeFileReformat_before.java
new file mode 100644 (file)
index 0000000..e8d0ad4
--- /dev/null
@@ -0,0 +1,10 @@
+public class Test {
+
+        public int a = 3;
+
+
+            public void test() {
+                       int c = 3;
+                }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation.java b/java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation.java
new file mode 100644 (file)
index 0000000..4fd5cc0
--- /dev/null
@@ -0,0 +1,11 @@
+final class MyModule {
+  @Target({FIELD,PARAMETER,METHOD})
+  @Retention(RUNTIME)
+  public static @interface Dependency { }
+}
+
+final class SomeService {
+
+  SomeService(@My<caret>) {
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation_after.java b/java/java-tests/testData/codeInsight/completion/normal/InnerAnnotation_after.java
new file mode 100644 (file)
index 0000000..9ad5271
--- /dev/null
@@ -0,0 +1,11 @@
+final class MyModule {
+  @Target({FIELD,PARAMETER,METHOD})
+  @Retention(RUNTIME)
+  public static @interface Dependency { }
+}
+
+final class SomeService {
+
+  SomeService(@MyModule.Dependency<caret>) {
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastConversionToTypeParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastConversionToTypeParameter.java
new file mode 100644 (file)
index 0000000..2499d4d
--- /dev/null
@@ -0,0 +1,7 @@
+import java.util.List;
+
+abstract class Test implements List<Test> {
+  private <T extends List<T>> T foo() {
+    return (T)this;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeDistinctProverForWildcardAndTypeParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeDistinctProverForWildcardAndTypeParameter.java
new file mode 100644 (file)
index 0000000..183eed8
--- /dev/null
@@ -0,0 +1,18 @@
+abstract class Test {
+  interface Selection<A> {}
+  interface CriteriaQuery<T> {
+    void select(Selection<? extends T> selection);
+  }
+
+  private <N> void foo(CriteriaQuery<N> criteria, Selection<String[]> array) {
+    criteria.select((Selection<? extends N>)array);
+  }
+
+  private <N extends Integer> void foo1(CriteriaQuery<N> criteria, Selection<String[]> array) {
+    criteria.select(<error descr="Inconvertible types; cannot cast 'Test.Selection<java.lang.String[]>' to 'Test.Selection<? extends N>'">(Selection<? extends N>)array</error>);
+  }
+
+  private <N extends Integer> void foo2(CriteriaQuery<N> criteria, Selection<Object> array) {
+    criteria.select(<error descr="Inconvertible types; cannot cast 'Test.Selection<java.lang.Object>' to 'Test.Selection<? extends N>'">(Selection<? extends N>)array</error>);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA134277.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA134277.java
new file mode 100644 (file)
index 0000000..e0956a0
--- /dev/null
@@ -0,0 +1,18 @@
+import java.util.concurrent.Future;
+
+class TypeInferenceBug
+{
+  public interface Callback<V> {
+    void done(V value);
+  }
+
+  public static <V> void addCallback(Future<V> future, Callback<? super V> callback) {}
+
+  public static <T> Callback<T> createCallback() {
+    return value -> {};
+  }
+
+  public static void bind(Future<?> future) {
+    addCallback(future, createCallback());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/FieldInitializedUsedInLambda.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/FieldInitializedUsedInLambda.java
new file mode 100644 (file)
index 0000000..4096706
--- /dev/null
@@ -0,0 +1,17 @@
+
+import java.util.Comparator;
+
+class Test {
+  private final int x;
+
+  public Test(int x) {
+    this.x = x;
+  }
+
+  public static final Comparator<Test> comparator = (o1, o2) -> {
+    if (o1.x == o2.x) {
+    }
+    <error descr="'Test.this' cannot be referenced from a static context">this</error>.x != o2.x;
+    return 0;
+  };
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions1.java
new file mode 100644 (file)
index 0000000..476d30a
--- /dev/null
@@ -0,0 +1,38 @@
+import java.io.IOException;
+
+class Test {
+
+  interface B<K, E extends Throwable> {
+    K l(K k) throws E;
+  }
+
+  <R> void bar(B<R, IOException> b) {}
+
+  <E extends Exception, T> T baz(T l) throws E {
+    return null;
+  }
+
+  {
+    bar(l -> baz(l));
+    bar(this::baz);
+  }
+}
+class Test1 {
+
+  interface B<K, E extends Throwable> {
+    K l(K k) throws E;
+  }
+
+  <R> void bar(B<R, IOException> b) {}
+
+  class MyEx extends Exception{}
+  
+  <E extends MyEx, T> T baz(T l) throws E {
+    return null;
+  }
+
+  {
+    bar(l -> baz<error descr="'baz(java.lang.Object)' in 'Test1' cannot be applied to '(<lambda parameter>)'">(l)</error>);
+    bar(<error descr="Unhandled exception: Test1.MyEx">this::baz</error>);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SecondSearchIfFirstParameterIsASubtypeOfReferenceTypeFromExpressionDeclaration.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SecondSearchIfFirstParameterIsASubtypeOfReferenceTypeFromExpressionDeclaration.java
new file mode 100644 (file)
index 0000000..a0621c1
--- /dev/null
@@ -0,0 +1,28 @@
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.function.Function;
+
+class Test {
+
+  static class Base {
+    public BigDecimal getTotal() {
+      return null;
+    }
+  }
+
+  public static void foo(List<? extends Base> list, List<Base> list1) {
+    System.out.println(add(list, Base::getTotal));
+    list1.forEach(Base::getTotal);
+  }
+
+
+  public static <T> BigDecimal add(Collection<T> objectsThatHaveBigDecimals, Function<T, ? extends BigDecimal> functionToGet) {
+    return objectsThatHaveBigDecimals == null ? null : objectsThatHaveBigDecimals.stream().map(functionToGet).reduce(null, Test::add);
+  }
+
+  public static BigDecimal add(BigDecimal... sequence) {
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136856.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136856.java
new file mode 100644 (file)
index 0000000..7b75b0f
--- /dev/null
@@ -0,0 +1,43 @@
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collector;
+
+class Test {
+  public static final <T> Collector<T, AtomicReference<T>, Optional<T>> toSingleton() {
+    return Collector.of(
+      AtomicReference::new,
+      (ref, v) -> {
+        if (!ref.compareAndSet(null, v) && v != null) {
+          throw new IllegalStateException("There is only one elvis.");
+        }
+      },
+      (left, right) -> setOrFail(left, right.get()),
+      ref -> Optional.of(ref.get())
+    );
+  }
+
+  public static final <T> Collector<T, AtomicReference<T>, Optional<T>> toSingleton1() {
+    return Collector.of(
+      AtomicReference::new,
+      (ref, v) -> setOrFail(ref, v),
+      (left, right) -> setOrFail(left, right.get()),
+      ref -> Optional.of(ref.get())
+    );
+  }
+
+  public static final <T> Collector<T, AtomicReference<T>, Optional<T>> toSingleton2() {
+    return Collector.of(
+      AtomicReference::new,
+      Test::setOrFail,
+      (left, right) -> setOrFail(left, right.get()),
+      ref -> Optional.of(ref.get())
+    );
+  }    
+
+  private static final <T> AtomicReference<T> setOrFail(AtomicReference<T> ref, T v) {
+    if (!ref.compareAndSet(null, v) && v != null) {
+      throw new IllegalStateException("There is only one elvis.");
+    }
+    return ref;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136887.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA136887.java
new file mode 100644 (file)
index 0000000..6015c09
--- /dev/null
@@ -0,0 +1,9 @@
+import java.util.Collection;
+import java.util.function.ToIntFunction;
+import java.util.stream.Collectors;
+
+class Test {
+  public static <T> int sum(Collection<? extends T> collection, ToIntFunction<? super T> mapper) {
+    return collection.stream().collect(Collectors.summingInt(mapper));
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/SecondConflictResolution.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/SecondConflictResolution.java
new file mode 100644 (file)
index 0000000..ac48bcb
--- /dev/null
@@ -0,0 +1,21 @@
+
+import java.util.*;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.counting;
+import static java.util.stream.Collectors.groupingBy;
+
+abstract class Token {
+
+
+  private static B<Long> getMode(Optional<Map.Entry<Integer, Long>> max){
+    return  max
+      .flatMap(e -> Optional.of(new B<>(Long.valu<ref>eOf(e.getValue().longValue()))))
+      .get();
+  }
+
+  static class B<K> {
+    public B(K k) {}
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterMultipleImplementationsAlreadyExist.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterMultipleImplementationsAlreadyExist.java
new file mode 100644 (file)
index 0000000..c83805d
--- /dev/null
@@ -0,0 +1,20 @@
+// "Implement method 'foo'" "true"
+
+abstract class A<T> {
+    abstract String foo(T t);
+}
+
+class B extends A<String> {
+
+    @Override
+    String foo(String s1) {
+        return null;
+    }
+}
+
+class ABC extends A<Integer> {
+    @Override
+    String foo(Integer integer) {
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeMultipleImplementationsAlreadyExist.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeMultipleImplementationsAlreadyExist.java
new file mode 100644 (file)
index 0000000..eb47525
--- /dev/null
@@ -0,0 +1,15 @@
+// "Implement method 'foo'" "true"
+
+abstract class A<T> {
+    abstract String f<caret>oo(T t);
+}
+
+class B extends A<String> {
+
+    @Override
+    String foo(String s1) {
+        return null;
+    }
+}
+
+class ABC extends A<Integer> {}
\ No newline at end of file
index 89213c72649fccd39942a0f1eac16b5afca03fd7..b27540c6a50d08094d623d15afd083be6df1398f 100644 (file)
@@ -20,6 +20,9 @@ import com.intellij.codeInsight.generation.GenerateSetterHandler
 import com.intellij.openapi.command.WriteCommandAction
 import com.intellij.openapi.editor.Editor
 import com.intellij.openapi.project.Project
+import com.intellij.psi.codeStyle.CodeStyleSettings
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager
+import com.intellij.psi.codeStyle.JavaCodeStyleManager
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 import com.intellij.util.ui.UIUtil
 import com.siyeh.ig.style.UnqualifiedFieldAccessInspection
@@ -70,6 +73,34 @@ class Foo {
 '''
   }
 
+  public void "test strip field prefix"() {
+    def settings = CodeStyleSettingsManager.getInstance(getProject()).currentSettings
+    String oldPrefix = settings.FIELD_NAME_PREFIX
+    try {
+      settings.FIELD_NAME_PREFIX = "my"
+      myFixture.configureByText 'a.java', '''
+  class Foo {
+      String myName;
+
+      <caret>
+  }
+  '''
+      generateGetter()
+      myFixture.checkResult '''
+  class Foo {
+      String myName;
+
+      public String getName() {
+          return myName;
+      }
+  }
+  '''
+    }
+    finally {
+      settings.FIELD_NAME_PREFIX = oldPrefix
+    }
+  }
+
   public void "test qualified this"() {
     myFixture.enableInspections(UnqualifiedFieldAccessInspection.class)
     myFixture.configureByText 'a.java', '''
@@ -91,6 +122,38 @@ class Foo {
 '''
   }
 
+  public void "test nullable stuff"() {
+    myFixture.addClass("package org.jetbrains.annotations;\n" +
+                       "public @interface NotNull {}")
+    myFixture.configureByText 'a.java', '''
+class Foo {
+    @org.jetbrains.annotations.NotNull
+    private String myName;
+
+    <caret>
+}
+'''
+    generateGetter()
+    generateSetter()
+    myFixture.checkResult '''import org.jetbrains.annotations.NotNull;
+
+class Foo {
+    @org.jetbrains.annotations.NotNull
+    private String myName;
+
+    public void setMyName(@NotNull String myName) {
+        this.myName = myName;
+    }
+
+    @NotNull
+    public String getMyName() {
+    
+        return myName;
+    }
+}
+'''
+  }
+
   private void generateGetter() {
     WriteCommandAction.runWriteCommandAction(getProject(), {
     new GenerateGetterHandler() {
index 05a14ef267f0a084913811b3dcbd6e6e4b489fc3..b02d90b6d5962043cf4c6e1c8b7e3962ba3a8e71 100644 (file)
@@ -25,7 +25,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
  */
 class MultipleModuleHighlightingTest extends JavaCodeInsightFixtureTestCase {
 
-  @Bombed(day = 1, month = Calendar.MARCH)
+  @Bombed(day = 1, month = Calendar.APRIL)
   public void "test use original place classpath for reference type resolving"() {
     addTwoModules()
 
@@ -60,7 +60,7 @@ class Class3 {
     myFixture.checkHighlighting()
   }
 
-  @Bombed(day = 1, month = Calendar.MARCH)
+  @Bombed(day = 1, month = Calendar.APRIL)
   public void "test use original place classpath for new expression type resolving"() {
     addTwoModules()
 
index 366fd626baaf8a829c8d3d3df2656a7188940039..b780665d1c63796681f21a86fa6f492b678e084d 100644 (file)
@@ -316,14 +316,9 @@ class AdditionalEventInfo {
   }
 }
 
-class MockReformatFileSettings implements LayoutCodeOptions {
-  private boolean myProcessWholeFile;
-  private boolean myProcessDirectories;
-  private boolean myRearrange;
-  private boolean myIncludeSubdirs;
+class MockReformatFileSettings implements ReformatFilesOptions {
   private boolean myOptimizeImports;
-  private boolean myProcessOnlyChangedText;
-  private boolean myIsOK = true;
+  private boolean myIncludeSubdirs;
 
   @Nullable
   @Override
@@ -338,33 +333,13 @@ class MockReformatFileSettings implements LayoutCodeOptions {
   }
 
   @Override
-  public boolean isProcessWholeFile() {
-    return myProcessWholeFile;
-  }
-
-  MockReformatFileSettings setProcessWholeFile(boolean processWholeFile) {
-    myProcessWholeFile = processWholeFile;
-    return this;
+  public TextRangeType getTextRangeType() {
+    return TextRangeType.WHOLE_FILE;
   }
 
   @Override
-  public boolean isProcessDirectory() {
-    return myProcessDirectories;
-  }
-
-  MockReformatFileSettings setProcessDirectory(boolean processDirectories) {
-    myProcessDirectories = processDirectories;
-    return this;
-  }
-
-  @Override
-  public boolean isRearrangeEntries() {
-    return myRearrange;
-  }
-
-  @Override
-  public boolean isIncludeSubdirectories() {
-    return myIncludeSubdirs;
+  public boolean isRearrangeCode() {
+    return false;
   }
 
   @Override
@@ -378,23 +353,6 @@ class MockReformatFileSettings implements LayoutCodeOptions {
     return this;
   }
 
-  @Override
-  public boolean isProcessOnlyChangedText() {
-    return myProcessOnlyChangedText;
-  }
-
-  @NotNull
-  MockReformatFileSettings setProcessOnlyChangedText(boolean processOnlyChangedText) {
-    myProcessOnlyChangedText = processOnlyChangedText;
-    return this;
-  }
-
-  @NotNull
-  MockReformatFileSettings setRearrange(boolean rearrange) {
-    myRearrange = rearrange;
-    return this;
-  }
-
   @NotNull
   MockReformatFileSettings setIncludeSubdirs(boolean includeSubdirs) {
     myIncludeSubdirs = includeSubdirs;
index 0dd2bcebc27d8adf486598b66d3e7df127fd62c5..058d165c3ddf158c16457f4244d02eb6d56cb8f5 100644 (file)
 package com.intellij.codeInsight.actions;
 
 import com.intellij.JavaTestUtil;
-import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vcs.changes.Change;
-import com.intellij.openapi.vcs.changes.ContentRevision;
-import com.intellij.openapi.vcs.history.VcsRevisionNumber;
 import com.intellij.psi.PsiFile;
-import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
 
-public class ReformatCodeActionInEditorTest extends LightCodeInsightFixtureTestCase {
+import static com.intellij.codeInsight.actions.TextRangeType.*;
+
+public class ReformatCodeActionInEditorTest extends LightPlatformCodeInsightFixtureTestCase {
 
   @Override
   protected String getTestDataPath() {
     return JavaTestUtil.getJavaTestDataPath() + "/actions/reformatFileInEditor/";
   }
 
-  public void doTest(@NotNull ReformatFilesOptions options) {
-    setOptions(options);
+  @Override
+  public void tearDown() throws Exception {
+    myFixture.getFile().putUserData(FormatChangedTextUtil.TEST_REVISION_CONTENT, null);
+    super.tearDown();
+  }
 
-    String before = null;
-    if (options.isProcessOnlyChangedText()) {
+  public void doTest(LayoutCodeOptions options) {
+    CharSequence revisionContent = null;
+    if (options.getTextRangeType() == VCS_CHANGED_TEXT) {
       myFixture.configureByFile(getTestName(true) + "_revision.java");
       PsiFile file = myFixture.getFile();
       Document document = myFixture.getDocument(file);
-      before = document.getText();
+      revisionContent = document.getCharsSequence();
     }
 
     myFixture.configureByFile(getTestName(true) + "_before.java");
-
-    if (before != null) {
-      myFixture.getFile().putUserData(FormatChangedTextUtil.TEST_REVISION_CONTENT, before);
+    if (revisionContent != null) {
+      myFixture.getFile().putUserData(FormatChangedTextUtil.TEST_REVISION_CONTENT, revisionContent);
     }
 
-    final String actionId = IdeActions.ACTION_EDITOR_REFORMAT;
-    AnAction action = ActionManager.getInstance().getAction(actionId);
-
-    AnActionEvent event = createEventFor(action, getProject(), myFixture.getEditor());
+    FileInEditorProcessor processor = new FileInEditorProcessor(myFixture.getFile(), myFixture.getEditor(), options);
 
-    action.actionPerformed(event);
+    processor.processCode();
     myFixture.checkResultByFile(getTestName(true) + "_after.java");
   }
 
-  @Override
-  public void tearDown() throws Exception {
-    myFixture.getFile().putUserData(FormatChangedTextUtil.TEST_REVISION_CONTENT, null);
-    super.tearDown();
+  public void testSelectionReformat() {
+    doTest(new ReformatCodeRunOptions(SELECTED_TEXT));
   }
 
-  protected AnActionEvent createEventFor(@NotNull AnAction action, @NotNull final Project project, @NotNull final Editor editor) {
-    return new AnActionEvent(null, new DataContext() {
-      @Nullable
-      @Override
-      public Object getData(@NonNls String dataId) {
-        if (CommonDataKeys.PROJECT.is(dataId)) return project;
-        if (CommonDataKeys.EDITOR.is(dataId)) return editor;
-        return null;
-      }
-    }, "", action.getTemplatePresentation(), ActionManager.getInstance(), 0);
+  public void testWholeFileReformat() {
+    doTest(new ReformatCodeRunOptions(WHOLE_FILE));
   }
 
-  protected void setOptions(ReformatFilesOptions options) {
-    ReformatCodeAction.setTestOptions(options);
+  public void testWholeFileReformatAndOptimize() {
+    doTest(new ReformatCodeRunOptions(WHOLE_FILE).setOptimizeImports(true));
+  }
+
+  public void testSelectedTextAndOptimizeImports() {
+    doTest(new ReformatCodeRunOptions(SELECTED_TEXT).setOptimizeImports(true));
   }
 
   public void testFormatWholeFile() {
-    doTest(new MockReformatFileSettings().setProcessWholeFile(true));
+    doTest(new ReformatCodeRunOptions(WHOLE_FILE));
   }
 
   public void testFormatOptimizeWholeFile() {
-    doTest(new MockReformatFileSettings().setProcessWholeFile(true).setOptimizeImports(true));
+    doTest(new ReformatCodeRunOptions(WHOLE_FILE).setOptimizeImports(true));
   }
 
   public void testFormatOptimizeRearrangeWholeFile() {
-    doTest(new MockReformatFileSettings().setProcessWholeFile(true).setOptimizeImports(true).setRearrange(true));
+    doTest(new ReformatCodeRunOptions(WHOLE_FILE).setOptimizeImports(true).setRearrangeCode(true));
   }
 
   public void testFormatSelection() {
-    doTest(new MockReformatFileSettings().setProcessWholeFile(false));
+    doTest(new ReformatCodeRunOptions(SELECTED_TEXT));
   }
 
   public void testFormatRearrangeSelection() {
-    doTest(new MockReformatFileSettings().setProcessWholeFile(false).setRearrange(true));
+    doTest(new ReformatCodeRunOptions(SELECTED_TEXT).setRearrangeCode(true));
   }
 
   public void testFormatVcsChanges() {
-    doTest(new MockReformatFileSettings().setProcessOnlyChangedText(true));
+    doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT));
   }
 
   public void testFormatOptimizeVcsChanges() {
-    doTest(new MockReformatFileSettings().setProcessOnlyChangedText(true).setOptimizeImports(true));
+    doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT).setOptimizeImports(true));
   }
 
   public void testFormatOptimizeRearrangeVcsChanges() {
-    doTest(new MockReformatFileSettings().setProcessOnlyChangedText(true).setOptimizeImports(true).setRearrange(true));
+    doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT).setOptimizeImports(true).setRearrangeCode(true));
   }
-
 }
index b0e4024ff076fe28602f9dc5b65ee55892efe9d2..09dff801a2f531915c8962a24dccb9d4df39b8a1 100644 (file)
@@ -35,35 +35,10 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
   public void testReformatAndOptimizeMultipleFiles() throws IOException {
     List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
     injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
     performReformatActionOnSelectedFiles(files);
     checkFormationAndImportsOptimizationFor(files);
   }
 
-  public void testReformatSingleSelectedFile() throws IOException {
-    List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
-    PsiFile fileToReformat = files.get(0);
-    List<PsiFile> shouldNotBeFormatted = files.subList(1, files.size());
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
-    performReformatActionOnSelectedFile(fileToReformat);
-
-    checkFormationAndImportsOptimizationFor(Arrays.asList(fileToReformat));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
-  public void testReformatAndOptimizeFileFromEditor() throws IOException {
-    List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
-    PsiFile fileToFormat = files.get(0);
-    List<PsiFile> shouldNotBeFormatted = files.subList(1, files.size());
-
-    performReformatActionOnFileInEditor(fileToFormat);
-    checkFormationAndImportsOptimizationFor(Arrays.asList(fileToFormat));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
   public void testOptimizeAndReformatOnlySelectedFiles() throws IOException {
     List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
     List<PsiFile> forProcessing = ContainerUtil.newArrayList(files.get(0), files.get(1));
@@ -77,28 +52,6 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
     checkNoProcessingWasPerformedOn(noProcessing);
   }
 
-  public void testOptimizeAndReformatAllFilesInDirectoryIncludeSubdirs() throws IOException {
-    TestFileStructure fileStructure = getThreeLevelDirectoryStructure();
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true).setProcessDirectory(true).setIncludeSubdirs(true));
-    PsiFile fileInEditor = fileStructure.getFilesAtLevel(2).get(0);
-    List<PsiFile> shouldNotBeFormatted = fileStructure.getFilesAtLevel(1);
-
-    performReformatActionOnFileInEditor(fileInEditor);
-
-    checkFormationAndImportsOptimizationFor(fileStructure.getFilesAtLevel(2), fileStructure.getFilesAtLevel(3));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
-  public void testOptimizeAndReformatAllFilesInDirectoryExcludeSubdirs() throws IOException {
-    TestFileStructure fileStructure = getThreeLevelDirectoryStructure();
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true).setIncludeSubdirs(false));
-
-    performReformatActionOnSelectedFiles(fileStructure.getFilesAtLevel(2));
-
-    checkFormationAndImportsOptimizationFor(fileStructure.getFilesAtLevel(2));
-    checkNoProcessingWasPerformedOn(fileStructure.getFilesAtLevel(1), fileStructure.getFilesAtLevel(3));
-  }
-
   public void testOptimizeAndReformatInModule() throws IOException {
     Module module = createModuleWithSourceRoot("newModule");
     VirtualFile srcDir = ModuleRootManager.getInstance(module).getSourceRoots()[0];
@@ -109,26 +62,4 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
 
     checkFormationAndImportsOptimizationFor(files);
   }
-
-  private TestFileStructure getThreeLevelDirectoryStructure() throws IOException {
-    TestFileStructure fileStructure = new TestFileStructure(getModule(), getTempRootDirectory());
-
-    fileStructure.createDirectoryAndMakeItCurrent("dir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    fileStructure.createDirectoryAndMakeItCurrent("innerDir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    fileStructure.createDirectoryAndMakeItCurrent("innerInnerDir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    return fileStructure;
-  }
-
-  private void addFilesToCurrentDirectory(TestFileStructure fileStructure) throws IOException {
-    for (int i = 0; i < 5; i++) {
-      String className = "Test" + i;
-      fileStructure.addTestFile("Test" + i + ".java", getUntouchedJavaSourceForTotalProcessing(className));
-    }
-  }
 }
index d8abdbd5a9e820e575f80e605974d187de7b2aef..0852028413bf9b12b2b663b754505d57fb4517c7 100644 (file)
@@ -932,6 +932,7 @@ public class ListUtils {
 
   public void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); }
   public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
+  public void testInnerAnnotation() { doTest('\n'); }
   public void testPrimitiveCastOverwrite() throws Throwable { doTest '\t' }
   public void testClassReferenceInFor() throws Throwable { doTest ' ' }
   public void testClassReferenceInFor2() throws Throwable { doTest ' ' }
index ac8bb477b0278e26771fcc15bf47da333cb0863d..d61c5f0f096d229c37daa3aa409b8cf17fbc0a07 100644 (file)
@@ -455,6 +455,14 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
   }
 
+  public void testCastConversionToTypeParameter() throws Exception {
+    doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+  }
+
+  public void testTypeDistinctProverForWildcardAndTypeParameter() 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 64b013d44df73e9f103c0387ff38ea4e2f8783b0..2630d5f999a645c4f3a169bc531791ebe9dc682c 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.JavaTestUtil;
-import com.intellij.idea.Bombed;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
@@ -25,7 +24,6 @@ import com.intellij.testFramework.LightProjectDescriptor;
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Calendar;
 import java.util.Collection;
 
 public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase {
index 4d04b70256b19db637fc0890987fedc546796503..8e777ddaf0a7647290a32d75dbb4a3defd462788 100644 (file)
@@ -263,6 +263,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
     doTest();
   }
 
+  public void testIDEA134277() throws Exception {
+    doTest();
+  }
+
   private void doTest() throws Exception {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java
new file mode 100644 (file)
index 0000000..e6934f2
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.codeInsight.daemon.lambda;
+
+import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
+import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.testFramework.IdeaTestUtil;
+import org.jetbrains.annotations.NonNls;
+
+public class Java8RegressionTest extends LightDaemonAnalyzerTestCase {
+  @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/regression";
+
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    enableInspectionTool(new UnusedDeclarationInspection());
+  }
+
+  public void testIDEA136856() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA136887() throws Exception {
+    doTest();
+  }
+
+  private void doTest() {
+    doTest(false);
+  }
+
+  private void doTest(boolean warnings) {
+    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
+    doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
+  }
+
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
+}
index 868982e18bb82a587d990eeb467de89fa63277cc..673a5cfaa44a8dbb3c7f9ed8bedab8ced9103db2 100644 (file)
@@ -32,6 +32,7 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
 
   public void testStaticAccess() { doTest(); }
   public void testEffectiveFinal() { doTest(); }
+  public void testFieldInitializedUsedInLambda() {doTest();}
   public void testReassignUsedVars() { doTest(); }
   public void testLambdaContext() { doTest(); }
   public void testReturnTypeCompatibility() { doTest(); }
index d53205a820cbb6741c726fa83e9fc17ba128c9e7..f0636eb92e5708d31b6ea76d205e9a610e08f8fa 100644 (file)
@@ -80,7 +80,6 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
   public void testLiftedIntersectionType() { doTest(); }
   public void testInferenceFromReturnStatements() { doTest(); }
   public void testDownUpThroughLambdaReturnStatements() { doTest(); }
-  @Bombed(year = 2015, month = Calendar.MARCH, day = 30)
   public void testIDEA124547() { doTest(); }
   public void testIDEA118362() { doTest(); }
   public void testIDEA126056() { doTest(); }
@@ -139,11 +138,14 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
-  @Bombed(year = 2015, month = Calendar.MARCH, day = 30)
   public void testCheckedExceptionsConstraintsSubstitutions() throws Exception {
     doTest();
   }
 
+  public void testCheckedExceptionsConstraintsSubstitutions1() throws Exception {
+    doTest();
+  }
+
   public void testCheckedExceptionsConstraintsSubstitutionsDeepInBody() throws Exception {
     doTest();
   }
@@ -168,7 +170,6 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
-  @Bombed(year = 2015, month = Calendar.MARCH, day = 30)
   public void testIDEA127124() throws Exception {
     doTest();
   }
index 60ad003549b3ba2ea281a3190ffd31170204ae14..dad206251e3e56a9c9a567a55a41f1c734a4ad50 100644 (file)
@@ -19,15 +19,12 @@ import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
-import com.intellij.idea.Bombed;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Calendar;
-
 public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
   @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef";
 
@@ -373,7 +370,6 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
-  @Bombed(year = 2015, month = Calendar.MARCH, day = 30)
   public void testIDEA132379() throws Exception {
     doTest();
   }
@@ -386,6 +382,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest(false);
   }
 
+  public void testSecondSearchIfFirstParameterIsASubtypeOfReferenceTypeFromExpressionDeclaration() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
index 8a9a451c14da9a66c51fdbdf843c0f948218459f..5d8cd07c3270a70f1c9a9de8bea3ca1d587e4175 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.ResolveTestCase;
 
@@ -30,6 +31,14 @@ public class TypeInference18Test extends ResolveTestCase {
     doTest();
   }
 
+  public void testSecondConflictResolution() throws Exception {
+    PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
+    assertNotNull(ref);
+    PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(ref.getElement(), PsiMethodCallExpression.class);
+    assertNotNull(methodCallExpression);
+    assertNotNull(methodCallExpression.resolveMethod());
+  }
+
   private LanguageLevel myOldLanguageLevel;
 
   @Override
index 8bf2fb1d4284c3974ac7cd1f105f82c27bf7aa26..384fdc3eb3391def12e6080ddc396712e53916e7 100644 (file)
@@ -365,6 +365,19 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
     assertSize(1, findUsages(findModel));
   }
 
+  public void testNonSourceContent() throws Exception {
+    VirtualFile root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(createTempDirectory());
+    PsiTestUtil.addContentRoot(myModule, root);
+
+    createFile(myModule, root, "A.txt", "goo doo");
+
+    FindModel findModel = FindManagerTestUtils.configureFindModel("goo");
+    findModel.setProjectScope(false);
+    findModel.setModuleName(myModule.getName());
+
+    assertSize(1, findUsages(findModel));
+  }
+
   public void testReplaceRegexp() {
     FindModel findModel = new FindModel();
     findModel.setStringToFind("bug_(?=here)");
@@ -537,6 +550,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
       findModel.setFromCursor(false);
       findModel.setGlobal(true);
       findModel.setMultipleFiles(true);
+      findModel.setCustomScope(true);
 
       ThrowableRunnable test = new ThrowableRunnable() {
         @Override
@@ -573,6 +587,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
       VirtualFile file = tempDirFixture.createFile("a.txt", "foo bar foo");
       FindModel findModel = FindManagerTestUtils.configureFindModel("foo");
       findModel.setWholeWordsOnly(true);
+      findModel.setCustomScope(true);
       findModel.setCustomScope(new LocalSearchScope(PsiManager.getInstance(myProject).findFile(file)));
       assertSize(2, findUsages(findModel));
     }
index 93e35b20b965d002e3d4871d4191a04404581a9a..9b7c1c6cdf292128f2ddfa15be37ef6d1d9955de 100644 (file)
@@ -446,7 +446,8 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
           ParameterInfo nameInfo = builder.findParameterization(name);
           ParameterInfo typeInfo = builder.findParameterization(type);
 
-          if (nameInfo != null && typeInfo != null && !(parameter.getParent() instanceof PsiCatchSection)) {
+          final PsiElement scope = parameter.getDeclarationScope();
+          if (nameInfo != null && typeInfo != null && !(scope instanceof PsiCatchSection) && !(scope instanceof PsiForeachStatement)) {
             nameInfo.setArgumentContext(false);
             typeInfo.setArgumentContext(false);
             typeInfo.setMethodParameterContext(true);
index c8dca645f698df1a3faf69794caf8389c8f3431e..467b18f1778c24ca76171cfffe14fbab91d12760 100644 (file)
@@ -1205,9 +1205,10 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
   public void visitIfStatement(final PsiIfStatement if1) {
     final PsiIfStatement if2 = (PsiIfStatement)myMatchingVisitor.getElement();
 
+    final PsiStatement elseBranch = if1.getElseBranch();
     myMatchingVisitor.setResult(myMatchingVisitor.match(if1.getCondition(), if2.getCondition()) &&
                                 compareBody(if1.getThenBranch(), if2.getThenBranch()) &&
-                                compareBody(if1.getElseBranch(), if2.getElseBranch()));
+                                (elseBranch == null || compareBody(elseBranch, if2.getElseBranch())));
   }
 
   @Override
index 84627a339de8bff9eca972a28d2467cd27d394ef..afb1f271a59726dca1c97d48ad5bfcc6a0c341cc 100644 (file)
@@ -84,7 +84,7 @@ public class CompileScopeImpl extends CompileScope {
   @Override
   public boolean isAffected(BuildTarget<?> target, @NotNull File file) {
     if (myFiles.isEmpty()) {//optimization
-      return true;
+      return isAffected(target);
     }
     final Set<File> files = myFiles.get(target);
     return files != null && files.contains(file);
diff --git a/lib/markdown4j-2.2.jar b/lib/markdown4j-2.2.jar
new file mode 100644 (file)
index 0000000..65030fa
Binary files /dev/null and b/lib/markdown4j-2.2.jar differ
index 738e970fbca1b054dab6107011db259cf4ce67bb..2de6b80ee9f4724495629bf3a1640563bfaf5805 100644 (file)
@@ -60,7 +60,7 @@ public class HighlightDisplayLevel {
    */
   @Deprecated
   public static final HighlightDisplayLevel INFO = new HighlightDisplayLevel(HighlightSeverity.INFO, DO_NOT_SHOW.getIcon());
-  public static final HighlightDisplayLevel WEAK_WARNING = new HighlightDisplayLevel(HighlightSeverity.WEAK_WARNING, DO_NOT_SHOW.getIcon());
+  public static final HighlightDisplayLevel WEAK_WARNING = new HighlightDisplayLevel(HighlightSeverity.WEAK_WARNING, createIconByKey(CodeInsightColors.WEAK_WARNING_ATTRIBUTES));
 
   public static final HighlightDisplayLevel NON_SWITCHABLE_ERROR = new HighlightDisplayLevel(HighlightSeverity.ERROR);
 
index 00fa3f0f4cff595364416a35ee455543a8936b59..9fc611d6dbbcca0b25b1f3d3ff0d856398ac12b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.intellij.codeInsight.daemon;
 
 import com.intellij.openapi.components.ServiceManager;
+import com.intellij.util.xmlb.annotations.OptionTag;
 import com.intellij.util.xmlb.annotations.Transient;
 
 public class DaemonCodeAnalyzerSettings {
@@ -26,9 +26,9 @@ public class DaemonCodeAnalyzerSettings {
 
   public boolean NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = true;
   public int AUTOREPARSE_DELAY = 300;
-  public boolean SHOW_ADD_IMPORT_HINTS = true;
+  protected boolean myShowAddImportHints = true;
   public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
-  public boolean SUPPRESS_WARNINGS = true;
+  protected boolean mySuppressWarnings = true;
   public boolean SHOW_METHOD_SEPARATORS = false;
   public int ERROR_STRIPE_MARK_MIN_HEIGHT = 2;
   public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
@@ -38,21 +38,21 @@ public class DaemonCodeAnalyzerSettings {
     return false;
   }
 
-  @Transient
+  @OptionTag(value = "SHOW_ADD_IMPORT_HINTS")
   public boolean isImportHintEnabled() {
-    return SHOW_ADD_IMPORT_HINTS;
+    return myShowAddImportHints;
   }
 
   public void setImportHintEnabled(boolean isImportHintEnabled) {
-    SHOW_ADD_IMPORT_HINTS = isImportHintEnabled;
+    myShowAddImportHints = isImportHintEnabled;
   }
 
-  @Transient
+  @OptionTag(value = "SUPPRESS_WARNINGS")
   public boolean isSuppressWarnings() {
-    return SUPPRESS_WARNINGS;
+    return mySuppressWarnings;
   }
 
   public void setSuppressWarnings(boolean suppressWarnings) {
-    SUPPRESS_WARNINGS = suppressWarnings;
+    mySuppressWarnings = suppressWarnings;
   }
 }
index 29a8905a45b9f737c7238d336ff627d1243691af..6e313990e1128b784b8242d98ba5ec841e4a87aa 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.idea.Main;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.lang.UrlClassLoader;
 import com.intellij.util.text.StringTokenizer;
@@ -28,13 +27,10 @@ import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 import java.util.regex.Pattern;
 
 /**
@@ -55,14 +51,14 @@ public class BootstrapClassLoaderUtil extends ClassUtilCore {
   public static ClassLoader initClassLoader(boolean updatePlugins) throws MalformedURLException {
     PathManager.loadProperties();
 
-    List<URL> classpath = new ArrayList<URL>();
+    Collection<URL> classpath = new LinkedHashSet<URL>();
     addParentClasspath(classpath);
     addIDEALibraries(classpath);
     addAdditionalClassPath(classpath);
 
     UrlClassLoader.Builder builder = UrlClassLoader.build()
-      .urls(filterClassPath(classpath))
-      .allowLock()
+      .urls(filterClassPath(new ArrayList<URL>(classpath)))
+      .allowLock(false)
       .usePersistentClasspathIndexForLocalClassDirectories()
       .useCache();
     if (Boolean.valueOf(System.getProperty(PROPERTY_ALLOW_BOOTSTRAP_RESOURCES, "true"))) {
@@ -85,68 +81,35 @@ public class BootstrapClassLoaderUtil extends ClassUtilCore {
     return newClassLoader;
   }
 
-  private static List<URL> filterClassPath(List<URL> classpathElements) {
-    String ignoreProperty = System.getProperty(PROPERTY_IGNORE_CLASSPATH);
-    if (ignoreProperty != null) {
-      Pattern pattern = Pattern.compile(ignoreProperty);
-      for (Iterator<URL> i = classpathElements.iterator(); i.hasNext(); ) {
-        String url = i.next().toExternalForm();
-        if (pattern.matcher(url).matches()) {
-          i.remove();
-        }
-      }
-    }
-    return classpathElements;
-  }
-
-  private static void addParentClasspath(List<URL> classpathElements) throws MalformedURLException {
+  private static void addParentClasspath(Collection<URL> classpath) throws MalformedURLException {
+    List<URLClassLoader> loaders = new ArrayList<URLClassLoader>(2);
     for (ClassLoader loader = BootstrapClassLoaderUtil.class.getClassLoader(); loader != null; loader = loader.getParent()) {
       if (loader instanceof URLClassLoader) {
-        ContainerUtil.addAll(classpathElements, ((URLClassLoader)loader).getURLs());
+        loaders.add(0, (URLClassLoader)loader);
       }
       else {
-        String loaderName = loader.getClass().getName();
-        try {
-          Class<?> antClassLoaderClass = Class.forName("org.apache.tools.ant.AntClassLoader");
-          if (antClassLoaderClass.isInstance(loader) ||
-              "org.apache.tools.ant.AntClassLoader".equals(loaderName) ||
-              "org.apache.tools.ant.loader.AntClassLoader2".equals(loaderName)) {
-            String classpath = (String)antClassLoaderClass
-              .getDeclaredMethod("getClasspath", ArrayUtil.EMPTY_CLASS_ARRAY)
-              .invoke(loader, ArrayUtil.EMPTY_OBJECT_ARRAY);
-            StringTokenizer tokenizer = new StringTokenizer(classpath, File.separator, false);
-            while (tokenizer.hasMoreTokens()) {
-              String token = tokenizer.nextToken();
-              classpathElements.add(new File(token).toURI().toURL());
-            }
-          }
-          else {
-            getLogger().warn("Unknown class loader: " + loaderName);
-          }
-        }
-        catch (ClassCastException e) { getLogger().warn("Unknown class loader '" + loaderName + "'", e); }
-        catch (ClassNotFoundException e) { getLogger().warn("Unknown class loader '" + loaderName + "'", e); }
-        catch (NoSuchMethodException e) { getLogger().warn("Unknown class loader '" + loaderName + "'", e); }
-        catch (IllegalAccessException e) { getLogger().warn("Unknown class loader '" + loaderName + "'", e); }
-        catch (InvocationTargetException e) { getLogger().warn("Unknown class loader '" + loaderName + "'", e); }
+        getLogger().warn("Unknown class loader: " + loader.getClass().getName());
       }
     }
+    for (URLClassLoader loader : loaders) {
+      ContainerUtil.addAll(classpath, loader.getURLs());
+    }
   }
 
-  private static void addIDEALibraries(List<URL> classpathElements) throws MalformedURLException {
+  private static void addIDEALibraries(Collection<URL> classpath) throws MalformedURLException {
     Class<BootstrapClassLoaderUtil> aClass = BootstrapClassLoaderUtil.class;
     String selfRoot = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
     assert selfRoot != null;
     URL selfRootUrl = new File(selfRoot).getAbsoluteFile().toURI().toURL();
-    classpathElements.add(selfRootUrl);
+    classpath.add(selfRootUrl);
 
     File libFolder = new File(PathManager.getLibPath());
-    addLibraries(classpathElements, libFolder, selfRootUrl);
-    addLibraries(classpathElements, new File(libFolder, "ext"), selfRootUrl);
-    addLibraries(classpathElements, new File(libFolder, "ant/lib"), selfRootUrl);
+    addLibraries(classpath, libFolder, selfRootUrl);
+    addLibraries(classpath, new File(libFolder, "ext"), selfRootUrl);
+    addLibraries(classpath, new File(libFolder, "ant/lib"), selfRootUrl);
   }
 
-  private static void addLibraries(List<URL> classPath, File fromDir, URL selfRootUrl) throws MalformedURLException {
+  private static void addLibraries(Collection<URL> classPath, File fromDir, URL selfRootUrl) throws MalformedURLException {
     File[] files = fromDir.listFiles();
     if (files == null) return;
 
@@ -160,16 +123,30 @@ public class BootstrapClassLoaderUtil extends ClassUtilCore {
     }
   }
 
-  private static void addAdditionalClassPath(List<URL> classPath) {
+  private static void addAdditionalClassPath(Collection<URL> classpath) {
     try {
       StringTokenizer tokenizer = new StringTokenizer(System.getProperty(PROPERTY_ADDITIONAL_CLASSPATH, ""), File.pathSeparator, false);
       while (tokenizer.hasMoreTokens()) {
         String pathItem = tokenizer.nextToken();
-        classPath.add(new File(pathItem).toURI().toURL());
+        classpath.add(new File(pathItem).toURI().toURL());
       }
     }
     catch (MalformedURLException e) {
       getLogger().error(e);
     }
   }
+
+  private static List<URL> filterClassPath(List<URL> classpath) {
+    String ignoreProperty = System.getProperty(PROPERTY_IGNORE_CLASSPATH);
+    if (ignoreProperty != null) {
+      Pattern pattern = Pattern.compile(ignoreProperty);
+      for (Iterator<URL> i = classpath.iterator(); i.hasNext(); ) {
+        String url = i.next().toExternalForm();
+        if (pattern.matcher(url).matches()) {
+          i.remove();
+        }
+      }
+    }
+    return classpath;
+  }
 }
index c9d4bd59ec59e28c153f5fa0af79df308bdc711b..bd98d77dd9874a0c8b6ba58b805634a796b33527 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.openapi.editor.markup;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.JDOMExternalizable;
-import com.intellij.openapi.util.WriteExternalException;
 import org.intellij.lang.annotations.JdkConstants;
 import org.jdom.Element;
 import org.jetbrains.annotations.Contract;
@@ -30,7 +28,7 @@ import java.awt.*;
 /**
  * Defines the visual representation (colors and effects) of text.
  */
-public class TextAttributes implements JDOMExternalizable, Cloneable {
+public class TextAttributes implements Cloneable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.markup.TextAttributes");
 
   public static final TextAttributes ERASE_MARKER = new TextAttributes();
@@ -77,7 +75,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
     myEnforcedDefaults = enforced;
   }
 
-  public TextAttributes(@NotNull Element element) throws InvalidDataException {
+  public TextAttributes(@NotNull Element element) {
     readExternal(element);
   }
 
@@ -191,14 +189,20 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
     return myAttrs.hashCode();
   }
 
-  @Override
-  public void readExternal(Element element) throws InvalidDataException {
-    myAttrs = AttributesFlyweight.create(element);
-    if (isEmpty()) myEnforcedDefaults = true;
+  public void readExternal(Element element) {
+    try {
+      myAttrs = AttributesFlyweight.create(element);
+    }
+    catch (InvalidDataException e) {
+      throw new RuntimeException(e);
+    }
+
+    if (isEmpty()) {
+      myEnforcedDefaults = true;
+    }
   }
 
-  @Override
-  public void writeExternal(Element element) throws WriteExternalException {
+  public void writeExternal(Element element) {
     myAttrs.writeExternal(element);
   }
 
index 845e50fbe804492f372a29ffa67abdf7fd7cb66c..e9630d6330009cf6818200f8f77e2c91285a53be 100644 (file)
@@ -27,7 +27,7 @@ import java.io.IOException;
 /**
  * @author yole
  */
-public abstract class BaseSchemeProcessor<T extends ExternalizableScheme> implements SchemeProcessor<T> {
+public abstract class BaseSchemeProcessor<T extends ExternalizableScheme> implements SchemeProcessor<T>, SchemeExtensionProvider {
   @Override
   public void initScheme(@NotNull T scheme) {
   }
@@ -75,4 +75,15 @@ public abstract class BaseSchemeProcessor<T extends ExternalizableScheme> implem
   public State getState(@NotNull T scheme) {
     return shouldBeSaved(scheme) ? State.POSSIBLY_CHANGED : State.NON_PERSISTENT;
   }
+
+  @Override
+  public boolean isUpgradeNeeded() {
+    return false;
+  }
+
+  @NotNull
+  @Override
+  public String getSchemeExtension() {
+    return ".xml";
+  }
 }
index cef94aefcc06d645b44d1dc66ea9f9dc2f920e59..c085400d9465b6f59426a19aa5716e78bb1b49fd 100644 (file)
  */
 package com.intellij.openapi.options;
 
+import com.intellij.util.ThrowableConvertor;
+import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
-public interface SchemesManager <T extends Scheme, E extends ExternalizableScheme>{
-  SchemesManager EMPTY = new SchemesManager(){
-    @Override
-    @NotNull
-    public Collection loadSchemes() {
-      return Collections.emptySet();
-    }
-
-    @Override
-    public void addNewScheme(@NotNull final Scheme scheme, final boolean replaceExisting) {
-    }
-
-    @Override
-    public void clearAllSchemes() {
-    }
-
-    @Override
-    @NotNull
-    public List getAllSchemes() {
-      return Collections.emptyList();
-    }
-
-    @Override
-    public Scheme findSchemeByName(@NotNull String schemeName) {
-      return null;
-    }
-
-    @Override
-    public void save() {
-    }
-
-    @Override
-    public void setCurrentSchemeName(String schemeName) {
-    }
-
-    @Override
-    public Scheme getCurrentScheme() {
-      return null;
-    }
-
-    @Override
-    public void removeScheme(@NotNull Scheme scheme) {
-    }
-
-    @Override
-    @NotNull
-    public Collection getAllSchemeNames() {
-      return Collections.emptySet();
-    }
-
-    @Override
-    public File getRootDirectory() {
-      return null;
-    }
-  };
-
+public abstract class SchemesManager<T extends Scheme, E extends ExternalizableScheme> {
   @NotNull
-  Collection<E> loadSchemes();
+  public abstract Collection<E> loadSchemes();
 
-  void addNewScheme(@NotNull T scheme, final boolean replaceExisting);
+  public abstract void addNewScheme(@NotNull T scheme, final boolean replaceExisting);
 
-  void clearAllSchemes();
+  public abstract void clearAllSchemes();
 
   @NotNull
-  List<T> getAllSchemes();
+  public abstract List<T> getAllSchemes();
 
   @Nullable
-  T findSchemeByName(@NotNull String schemeName);
+  public abstract T findSchemeByName(@NotNull String schemeName);
 
-  void save();
+  public abstract void save();
 
-  void setCurrentSchemeName(@Nullable String schemeName);
+  public abstract void setCurrentSchemeName(@Nullable String schemeName);
 
   @Nullable
-  T getCurrentScheme();
+  public abstract T getCurrentScheme();
 
-  void removeScheme(@NotNull T scheme);
+  public abstract void removeScheme(@NotNull T scheme);
 
   @NotNull
-  Collection<String> getAllSchemeNames();
+  public abstract Collection<String> getAllSchemeNames();
+
+  public abstract File getRootDirectory();
 
-  File getRootDirectory();
+  public void loadBundledScheme(@NotNull String resourceName, @NotNull Object requestor, @NotNull ThrowableConvertor<Element, T, Throwable> convertor) {
+  }
 }
diff --git a/platform/core-api/src/com/intellij/openapi/options/SharedScheme.java b/platform/core-api/src/com/intellij/openapi/options/SharedScheme.java
deleted file mode 100644 (file)
index a0f59d3..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2000-2013 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.options;
-
-import org.jetbrains.annotations.NotNull;
-
-@Deprecated
-public class SharedScheme<E extends ExternalizableScheme> {
-  private final String myUserName;
-  private final String myDescription;
-  private final E myScheme;
-
-  public SharedScheme(@NotNull String userName, final String description, @NotNull E scheme) {
-    myUserName = userName;
-    myDescription = description;
-    myScheme = scheme;
-  }
-
-  @NotNull
-  public String getUserName() {
-    return myUserName;
-  }
-
-  public String getDescription() {
-    return myDescription;
-  }
-
-  @NotNull
-  public E getScheme() {
-    return myScheme;
-  }
-}
index 68ca99133e4687418b57d51879c0cd375f839457..efd18fbf8805af50c76b717612196f8d06f6b392 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.ModificationTracker;
 import com.intellij.openapi.util.NotNullLazyKey;
 import com.intellij.openapi.util.Ref;
 import com.intellij.util.messages.Topic;
@@ -37,9 +38,6 @@ import java.util.List;
  * A service managing IDEA's 'dumb' mode: when indices are updated in background and the functionality is very much limited.
  * Only the explicitly allowed functionality is available. Usually it's allowed by implementing {@link DumbAware} interface.
  *
- * If you want to register a toolwindow, which will be enabled during the dumb mode, please use {@link com.intellij.openapi.wm.ToolWindowManager}'s
- * registration methods which have 'canWorkInDumMode' parameter. 
- *
  * @author peter
  */
 public abstract class DumbService {
@@ -50,6 +48,11 @@ public abstract class DumbService {
    */
   public static final Topic<DumbModeListener> DUMB_MODE = new Topic<DumbModeListener>("dumb mode", DumbModeListener.class);
 
+  /**
+   * The tracker is advanced each time we enter/exit from dumb mode.
+   */
+  public abstract ModificationTracker getModificationTracker();
+
   /**
    * @return whether IntelliJ IDEA is in dumb mode, which means that right now indices are updated in background.
    * IDEA offers only limited functionality at such times, e.g. plain text file editing and version control operations.
diff --git a/platform/core-api/src/com/intellij/openapi/project/IndexNotReadyException.java b/platform/core-api/src/com/intellij/openapi/project/IndexNotReadyException.java
new file mode 100644 (file)
index 0000000..b8bd964
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2013 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.project;
+
+import com.intellij.openapi.util.Computable;
+
+/**
+ * Thrown on accessing indices when they're not ready, in so-called dumb mode. Possible fixes:
+ * <ul>
+ * <li> If {@link com.intellij.openapi.actionSystem.AnAction#actionPerformed(com.intellij.openapi.actionSystem.AnActionEvent)} is in stack trace,
+ * consider making the action not implement {@link DumbAware}.
+ *
+ * <li> A {@link DumbAware} action, having got this exception, may just notify the user that the requested activity is not possible while
+ * indexing is in progress. It can be done via a dialog (see {@link com.intellij.openapi.ui.Messages}) or a status bar balloon
+ * (see {@link DumbService#showDumbModeNotification(String)}, {@link com.intellij.openapi.actionSystem.ex.ActionUtil#showDumbModeWarning(com.intellij.openapi.actionSystem.AnActionEvent...)}).
+ *
+ * <li> If index access is performed from some non-urgent invokeLater activity, consider replacing it with
+ * {@link DumbService#smartInvokeLater(Runnable)}. Note that this 'later' can be very late, several minutes may pass. So if that code
+ * involves user interaction, {@link DumbService#smartInvokeLater(Runnable)} should probably not be used to avoid dialogs popping out of the blue.
+ *
+ * <li> If it's a non-urgent background process (e.g. compilation, usage search), consider replacing topmost read-action with
+ * {@link DumbService#runReadActionInSmartMode(Computable)}.
+ *
+ * <li> If the exception comes from within Java's findClass call, and the IDE is currently performing a user-initiated action or a
+ * task when skipping findClass would lead to very negative consequences (e.g. not stopping at a breakpoint), then it might be possible
+ * to avoid index query by using alternative resolve (and findClass) strategy, which is significantly slower and might return null. To do this,
+ * use {@link DumbService#setAlternativeResolveEnabled(boolean)}.
+ *
+ * <li> It's preferable to avoid the exception entirely by adding {@link DumbService#isDumb()} checks where necessary.
+ * </ul>
+ *
+ * @author peter
+ * @see DumbService
+ * @see DumbAware
+ */
+public class IndexNotReadyException extends RuntimeException {
+
+  @Override
+  public String getMessage() {
+    return "Please change caller according to " + IndexNotReadyException.class.getName() + " documentation";
+  }
+}
index b1fe7ae2a727892d6ad06851780967a19f8c0837..e97a9f64c7f3263788ede4e4df0681c5e7514f3c 100644 (file)
@@ -22,6 +22,8 @@ import com.intellij.openapi.project.DumbModeTask;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.util.SimpleModificationTracker;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -36,6 +38,11 @@ public class MockDumbService extends DumbService {
     myProject = project;
   }
 
+  @Override
+  public ModificationTracker getModificationTracker() {
+    return new SimpleModificationTracker();
+  }
+
   @Override
   public boolean isDumb() {
     return false;
index 5543c430f361afb71a498e2ec70f8846a36063cb..a7f54fc9c8dda23ee8c4e6da5ff4e61d11944308 100644 (file)
@@ -770,10 +770,10 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
   }
 
   private void assertInsideCommand() {
+    if (!myAssertThreading) return;
     CommandProcessor commandProcessor = CommandProcessor.getInstance();
     if (!commandProcessor.isUndoTransparentActionInProgress() &&
-        commandProcessor.getCurrentCommand() == null &&
-      myAssertThreading) {
+        commandProcessor.getCurrentCommand() == null) {
       throw new IncorrectOperationException("Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor");
     }
   }
index d4f3f707d4e66d1d36597aec84297a445e141585..14f3b057a5fc80c33bb2afe918076a396f7e81ca 100644 (file)
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
 
-public abstract class AbstractSchemesManager<T extends Scheme, E extends ExternalizableScheme> implements SchemesManager<T, E> {
+public abstract class AbstractSchemesManager<T extends Scheme, E extends ExternalizableScheme> extends SchemesManager<T, E> {
   private static final Logger LOG = Logger.getInstance(AbstractSchemesManager.class);
 
   protected final List<T> mySchemes = new ArrayList<T>();
diff --git a/platform/core-impl/src/com/intellij/openapi/options/EmptySchemesManager.java b/platform/core-impl/src/com/intellij/openapi/options/EmptySchemesManager.java
new file mode 100644 (file)
index 0000000..55a74d0
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.options;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class EmptySchemesManager extends SchemesManager {
+  @Override
+  @NotNull
+  public Collection loadSchemes() {
+    return Collections.emptySet();
+  }
+
+  @Override
+  public void addNewScheme(@NotNull final Scheme scheme, final boolean replaceExisting) {
+  }
+
+  @Override
+  public void clearAllSchemes() {
+  }
+
+  @Override
+  @NotNull
+  public List getAllSchemes() {
+    return Collections.emptyList();
+  }
+
+  @Override
+  public Scheme findSchemeByName(@NotNull String schemeName) {
+    return null;
+  }
+
+  @Override
+  public void save() {
+  }
+
+  @Override
+  public void setCurrentSchemeName(String schemeName) {
+  }
+
+  @Override
+  public Scheme getCurrentScheme() {
+    return null;
+  }
+
+  @Override
+  public void removeScheme(@NotNull Scheme scheme) {
+  }
+
+  @Override
+  @NotNull
+  public Collection getAllSchemeNames() {
+    return Collections.emptySet();
+  }
+
+  @Override
+  public File getRootDirectory() {
+    return null;
+  }
+}
index b71a7e5e4f78dd72c7e442ad73e01364ba5d06d6..816ea9595797bd521e3e3c91767081b10f5f3610 100644 (file)
@@ -26,7 +26,6 @@ import com.intellij.diff.tools.external.ExternalDiffTool;
 import com.intellij.diff.tools.fragmented.OnesideDiffTool;
 import com.intellij.diff.tools.simple.SimpleDiffTool;
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import org.jetbrains.annotations.NotNull;
@@ -34,11 +33,10 @@ import org.jetbrains.annotations.Nullable;
 
 import java.awt.*;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 public class DiffManagerImpl extends DiffManagerEx {
-  private static final Logger LOG = Logger.getInstance(DiffManagerImpl.class);
-
   @Override
   public void showDiff(@Nullable Project project, @NotNull DiffRequest request) {
     showDiff(project, request, DiffDialogHints.DEFAULT);
@@ -88,16 +86,11 @@ public class DiffManagerImpl extends DiffManagerEx {
   @Override
   public List<DiffTool> getDiffTools() {
     List<DiffTool> result = new ArrayList<DiffTool>();
-
     result.add(SimpleDiffTool.INSTANCE);
     result.add(OnesideDiffTool.INSTANCE);
     result.add(BinaryDiffTool.INSTANCE);
     result.add(DirDiffTool.INSTANCE);
-
-    for (DiffTool tool : DiffTool.EP_NAME.getExtensions()) {
-      result.add(tool);
-    }
-
+    Collections.addAll(result, DiffTool.EP_NAME.getExtensions());
     return result;
   }
 }
index 2e321952643af973d65788074feabb7f7724fe03..4e00df7f1e419f5a9c24de272c4f507e3af83a2e 100644 (file)
@@ -42,8 +42,31 @@ public class CompareFilesAction extends BaseShowDiffAction {
 
     VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
 
-    String text = getTemplatePresentation().getText();
-    if (files != null && files.length == 1) text += "...";
+    String text = "Compare Files";
+    if (files != null && files.length == 1) {
+      text = "Compare With...";
+    }
+    else if (files != null && files.length == 2) {
+      Type type1 = getType(files[0]);
+      Type type2 = getType(files[1]);
+
+      if (type1 != type2) {
+        text = "Compare";
+      }
+      else {
+        switch (type1) {
+          case FILE:
+            text = "Compare Files";
+            break;
+          case DIRECTORY:
+            text = "Compare Directories";
+            break;
+          case ARCHIEVE:
+            text = "Compare Archieves";
+            break;
+        }
+      }
+    }
     e.getPresentation().setText(text);
   }
 
@@ -93,7 +116,9 @@ public class CompareFilesAction extends BaseShowDiffAction {
   private static VirtualFile getOtherFile(@Nullable Project project, @NotNull VirtualFile file) {
     FileChooserDescriptor descriptor;
     String key;
-    if (file.isDirectory() || file.getFileType() instanceof ArchiveFileType) {
+
+    Type type = getType(file);
+    if (type == Type.DIRECTORY || type == Type.ARCHIEVE) {
       descriptor = new FileChooserDescriptor(false, true, true, false, false, false);
       key = LAST_USED_FOLDER_KEY;
     }
@@ -121,4 +146,14 @@ public class CompareFilesAction extends BaseShowDiffAction {
     if (project == null) return;
     PropertiesComponent.getInstance(project).setValue(key, file.getPath());
   }
+
+  @NotNull
+  private static Type getType(@Nullable VirtualFile file) {
+    if (file == null) return Type.FILE;
+    if (file.isDirectory()) return Type.DIRECTORY;
+    if (file.getFileType() instanceof ArchiveFileType) return Type.ARCHIEVE;
+    return Type.FILE;
+  }
+
+  private enum Type {FILE, DIRECTORY, ARCHIEVE}
 }
index 5da3e9afc46fca61ff58d53c26a6969741d55c15..a8d07656c78c60f8f619e2359cbc8bd1c565b207 100644 (file)
@@ -15,6 +15,9 @@
  */
 package com.intellij.diff.impl;
 
+import com.intellij.codeInsight.hint.HintManager;
+import com.intellij.codeInsight.hint.HintManagerImpl;
+import com.intellij.codeInsight.hint.HintUtil;
 import com.intellij.diff.DiffContext;
 import com.intellij.diff.DiffManagerEx;
 import com.intellij.diff.DiffTool;
@@ -37,15 +40,20 @@ import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.ui.popup.Balloon;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.ui.popup.ListPopup;
 import com.intellij.openapi.util.*;
 import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
+import com.intellij.ui.HintHint;
+import com.intellij.ui.LightweightHint;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.ui.JBUI;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.CalledInAwt;
 import org.jetbrains.annotations.NonNls;
@@ -624,7 +632,7 @@ public abstract class DiffRequestProcessor implements Disposable {
 
       if (myIterationState != IterationState.NEXT) {
         // TODO: provide "change" word in chain UserData - for tests/etc
-        if (iterable != null) iterable.notify("Press again to go to the next file");
+        notifyMessage(e.getData(DiffDataKeys.CURRENT_EDITOR), "Press again to go to the next file", true);
         myIterationState = IterationState.NEXT;
         return;
       }
@@ -667,7 +675,7 @@ public abstract class DiffRequestProcessor implements Disposable {
       if (!isNavigationEnabled() || !hasPrevChange()) return;
 
       if (myIterationState != IterationState.PREV) {
-        if (iterable != null) iterable.notify("Press again to go to the previous file");
+        notifyMessage(e.getData(DiffDataKeys.CURRENT_EDITOR), "Press again to go to the previous file", false);
         myIterationState = IterationState.PREV;
         return;
       }
@@ -676,6 +684,29 @@ public abstract class DiffRequestProcessor implements Disposable {
     }
   }
 
+  private void notifyMessage(@Nullable Editor editor, @NotNull String message, boolean next) {
+    final LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(message));
+    Point point = new Point(myContentPanel.getWidth() / 2, next ? myContentPanel.getHeight() - JBUI.scale(40) : JBUI.scale(40));
+
+    final HintHint hintHint = new HintHint(myContentPanel, point)
+      .setPreferredPosition(next ? Balloon.Position.above : Balloon.Position.below)
+      .setAwtTooltip(true)
+      .setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD))
+      .setTextBg(HintUtil.INFORMATION_COLOR)
+      .setShowImmediately(true);
+
+    if (editor == null) {
+      final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+      hint.show(myContentPanel, point.x, point.y, owner instanceof JComponent ? (JComponent)owner : null, hintHint);
+    }
+    else {
+      Point editorPoint = SwingUtilities.convertPoint(myContentPanel, point, editor.getComponent());
+      HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, editorPoint, HintManager.HIDE_BY_ANY_KEY |
+                                                                                  HintManager.HIDE_BY_TEXT_CHANGE |
+                                                                                  HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
+    }
+  }
+
   // Iterate requests
 
   protected class MyNextChangeAction extends NextChangeAction {
index dd0a87dd7dfcf496d8e24e1f588f5bb715c6fe17..dc0b4fae73ea8770ca3c2557378093e701e74a2c 100644 (file)
@@ -44,7 +44,7 @@ public class ErrorDiffTool implements FrameDiffTool {
   @NotNull
   @Override
   public String getName() {
-    return "Error Viewer";
+    return "Error viewer";
   }
 
   private static class MyViewer implements DiffViewer {