Merge remote-tracking branch 'origin/master' appcode/140.2710 clion/140.2703 dbe/140.2707 phpstorm/140.2705 pycharm/140.2708 rubymine/140.2704 webstorm/140.2706
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Tue, 24 Feb 2015 21:19:32 +0000 (00:19 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Tue, 24 Feb 2015 21:19:32 +0000 (00:19 +0300)
338 files changed:
bin/scripts/unix/idea.sh
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/AddToWatchActionHandler.java
java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/ShowFrameAction.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.java
java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java
java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java
java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
java/debugger/impl/src/com/intellij/debugger/ui/ExpressionEvaluationDialog.java [deleted file]
java/debugger/impl/src/com/intellij/debugger/ui/StatementEvaluationDialog.java [deleted file]
java/debugger/openapi/src/com/intellij/debugger/SourcePosition.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/codeEditor/printing/MethodSeparatorProvider.java [deleted file]
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/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.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-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
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/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions1.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA136759.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/CachedSubstitutionDuringOverloadResolution.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/SecondConflictResolution.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/completion/NormalCompletionTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.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/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/JavaPredefinedConfigurations.java
java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java
jps/jps-builders/src/org/jetbrains/jps/incremental/CompileScopeImpl.java
lib/markdown4j-2.2.jar [new file with mode: 0644]
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/fileEditor/FileDocumentManager.java
platform/core-api/src/com/intellij/openapi/project/DumbService.java
platform/core-api/src/com/intellij/psi/PsiDocumentManager.java
platform/core-api/src/com/intellij/psi/PsiFile.java
platform/core-impl/src/com/intellij/mock/MockDumbService.java
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/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/simple/SimpleDiffTool.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/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java
platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/settings/AbstractExternalProjectSettingsControl.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/settings/ExternalSystemSettingsControlCustomizer.java [new file with mode: 0644]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalSystemJdkComboBox.java
platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLManager.java
platform/lang-impl/src/com/intellij/codeEditor/printing/FileSeparatorProvider.java
platform/lang-impl/src/com/intellij/codeEditor/printing/HTMLTextPainter.java
platform/lang-impl/src/com/intellij/codeEditor/printing/TextPainter.java
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.form
platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzerSettingsImpl.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.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/execution/actions/RunConfigurationsComboBoxAction.java
platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.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/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/ide/GeneralSettings.java
platform/platform-api/src/com/intellij/ide/SaveAndSyncHandler.java [new file with mode: 0644]
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/ide/SaveAndSyncHandler.java [deleted file]
platform/platform-impl/src/com/intellij/ide/SaveAndSyncHandlerImpl.java
platform/platform-impl/src/com/intellij/ide/actions/SynchronizeAction.java
platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsState.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginHostsConfigurable.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/application/impl/ApplicationImpl.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/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/fileChooser/ex/FileChooserDialogImpl.java
platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.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/updateSettings/impl/UpdateChecker.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettingsConfigurable.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.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/com/intellij/ui/popup/AbstractPopup.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/IdeBundle.properties
platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
platform/platform-resources/src/META-INF/PlatformLangPlugin.xml
platform/platform-resources/src/brokenPlugins.txt
platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.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/StructuralSearchUtil.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/StringToConstraintsTransformer.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/messages/SSRBundle.properties
platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java
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/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java
platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/openapi/diff/impl/ComparisonPolicy.java
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/ContainerUtil.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/AbstractCollectionBinding.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/CollectionBinding.java
platform/util/src/com/intellij/util/xmlb/CompactCollectionBinding.java [new file with mode: 0644]
platform/util/src/com/intellij/util/xmlb/FieldAccessor.java
platform/util/src/com/intellij/util/xmlb/JDOMExternalizableStringListBinding.java [deleted file]
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/src/com/intellij/util/xmlb/XmlSerializerImpl.java
platform/util/src/com/intellij/util/xmlb/annotations/AbstractCollection.java
platform/util/src/com/intellij/util/xmlb/annotations/CollectionBean.java [new file with mode: 0644]
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/CacheChangeProcessor.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-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryFullyQualifiedNameInspection.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/style/UnnecessaryFullyQualifiedNameInspectionTest.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java
plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.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/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/src/META-INF/plugin.xml
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleProjectSettingsControl.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleProjectSettingsControlBuilder.java [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleSettingsControlProvider.java [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/IdeaGradleProjectSettingsControlBuilder.java [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/ImportFromGradleControl.java
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_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/actions/SwitchTaskCombo.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/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtils.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.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/EduUtils.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/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
python/src/com/jetbrains/numpy/codeInsight/NumpyDocStringTypeProvider.java
python/src/com/jetbrains/numpy/codeInsight/NumpyModuleMembersProvider.java
python/src/com/jetbrains/numpy/documentation/NumPyDocString.java
python/src/com/jetbrains/python/console/parsing/PyConsoleParser.java
python/src/com/jetbrains/python/debugger/PyDebugProcess.java
python/src/com/jetbrains/python/psi/resolve/QualifiedNameResolverImpl.java
python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java
python/src/com/jetbrains/python/refactoring/classes/membersManager/PyMembersRefactoringBaseProcessor.java
python/src/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpProcessor.java
python/src/com/jetbrains/python/refactoring/classes/pushDown/PyPushDownProcessor.java
resources-en/src/inspectionDescriptions/SuspiciousLocalesLanguages.html [new file with mode: 0644]
resources/src/META-INF/IdeaPlugin.xml
resources/src/idea/JavaActions.xml
xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java
xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java
xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
xml/impl/src/com/intellij/codeInsight/template/emmet/generators/ZenCodingGenerator.java
xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.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 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()]);
index a93bf8101a310d9a8c00ffc24cce18aa2565b638..c25db1da19b5f39572f36e164b552d18f1e1ecc0 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.
@@ -78,7 +78,7 @@ public class AddToWatchActionHandler extends DebuggerActionHandler {
     if(session == null) {
       return;
     }
-    final MainWatchPanel watchPanel = DebuggerPanelsManager.getInstance(debuggerContext.getProject()).getWatchPanel();
+    final MainWatchPanel watchPanel = null;// DebuggerPanelsManager.getInstance(debuggerContext.getProject()).getWatchPanel();
 
     if(watchPanel == null) {
       return;
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java
deleted file mode 100644 (file)
index 22694cb..0000000
+++ /dev/null
@@ -1,143 +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.
- */
-
-/*
- * Class EvaluateAction
- * @author Jeka
- */
-package com.intellij.debugger.actions;
-
-import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
-import com.intellij.debugger.engine.evaluation.EvaluateException;
-import com.intellij.debugger.engine.evaluation.TextWithImports;
-import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
-import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
-import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.impl.DebuggerSession;
-import com.intellij.debugger.impl.DebuggerUtilsEx;
-import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.debugger.ui.ExpressionEvaluationDialog;
-import com.intellij.debugger.ui.StatementEvaluationDialog;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeExpression;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
-import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.DataKeys;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
-import org.jetbrains.annotations.NotNull;
-
-public class EvaluateActionHandler extends DebuggerActionHandler {
-  public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
-    DebuggerContextImpl context = DebuggerAction.getDebuggerContext(event.getDataContext());
-
-    if(context != null) {
-      DebuggerSession debuggerSession = context.getDebuggerSession();
-      return debuggerSession != null && debuggerSession.isPaused();
-    }
-
-    return false;
-  }
-
-  public void perform(@NotNull final Project project, final AnActionEvent event) {
-    final DataContext dataContext = event.getDataContext();
-    final DebuggerContextImpl context = DebuggerAction.getDebuggerContext(dataContext);
-
-    if(context == null) {
-      return;
-    }
-
-    final Editor editor = event.getData(DataKeys.EDITOR);
-
-    TextWithImports editorText = DebuggerUtilsEx.getEditorText(editor);
-    if (editorText == null) {
-      final DebuggerTreeNodeImpl selectedNode = DebuggerAction.getSelectedNode(dataContext);
-      final String actionName = event.getPresentation().getText();
-
-      if (selectedNode != null && selectedNode.getDescriptor() instanceof ValueDescriptorImpl) {
-        context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
-          public void threadAction() {
-            try {
-              final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(selectedNode, context);
-              DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
-                public void run() {
-                  showEvaluationDialog(project, evaluationText);
-                }
-              });
-            }
-            catch (final EvaluateException e1) {
-              DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
-                public void run() {
-                  Messages.showErrorDialog(project, e1.getMessage(), actionName);
-                }
-              });
-            }
-          }
-
-          protected void commandCancelled() {
-            DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
-              public void run() {
-                if(selectedNode.getDescriptor() instanceof WatchItemDescriptor) {
-                  try {
-                    TextWithImports editorText = DebuggerTreeNodeExpression.createEvaluationText(selectedNode, context);
-                    showEvaluationDialog(project, editorText);
-                  }
-                  catch (EvaluateException e1) {
-                    Messages.showErrorDialog(project, e1.getMessage(), actionName);
-                  }
-                }
-              }
-            });
-          }
-        });
-        return;
-      }
-    }
-
-    showEvaluationDialog(project, editorText);
-  }
-
-  public static void showEvaluationDialog(Project project, TextWithImports defaultExpression, String dialogType) {
-    if(defaultExpression == null) {
-      defaultExpression = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
-    }
-
-    CodeFragmentKind kind = DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType) ? CodeFragmentKind.CODE_BLOCK : CodeFragmentKind.EXPRESSION;
-
-    DebuggerSettings.getInstance().EVALUATION_DIALOG_TYPE = dialogType;
-    TextWithImportsImpl text = new TextWithImportsImpl(kind, defaultExpression.getText(), defaultExpression.getImports(), defaultExpression.getFileType());
-
-    final DialogWrapper dialog;
-    if(DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType)) {
-      dialog = new StatementEvaluationDialog(project, text);
-    }
-    else {
-      dialog = new ExpressionEvaluationDialog(project, text);
-    }
-
-    dialog.show();
-  }
-
-  public static void showEvaluationDialog(Project project, TextWithImports text) {
-    showEvaluationDialog(project, text, DebuggerSettings.getInstance().EVALUATION_DIALOG_TYPE);
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ShowFrameAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ShowFrameAction.java
deleted file mode 100644 (file)
index 6b1bf1f..0000000
+++ /dev/null
@@ -1,42 +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.impl.DebuggerStateManager;
-import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.impl.DebuggerSession;
-import com.intellij.debugger.ui.DebuggerPanelsManager;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.DataConstants;
-import com.intellij.openapi.project.Project;
-
-/**
- * User: lex
- * Date: Sep 26, 2003
- * Time: 7:45:21 PM
- */
-public class ShowFrameAction extends GotoFrameSourceAction {
-  public void actionPerformed(AnActionEvent e) {
-    super.actionPerformed(e);
-    DebuggerStateManager stateManager = getContextManager(e.getDataContext());
-    DebuggerContextImpl context = stateManager.getContext();
-
-    if(context != null) {
-      DebuggerPanelsManager.getInstance(context.getProject()).showFramePanel();
-    }
-  }
-}
index 96e6d015f02628e16fba5794891f5496500ff064..9386cca37ec8e4282d957961086116c422987aba 100644 (file)
@@ -27,8 +27,8 @@ import com.intellij.debugger.engine.DebugProcessImpl;
 import com.intellij.debugger.engine.events.DebuggerCommandImpl;
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.impl.DebuggerSession;
+import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
-import com.intellij.debugger.ui.DebuggerSessionTab;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -70,7 +70,7 @@ public class ThreadDumpAction extends AnAction implements AnAction.TransparentUp
               public void run() {
                 XDebugSession xSession = session.getXDebugSession();
                 if (xSession != null) {
-                  DebuggerSessionTab.addThreadDump(project, threads, xSession.getUI(), session);
+                  DebuggerUtilsEx.addThreadDump(project, threads, xSession.getUI(), session);
                 }
               }
             }, ModalityState.NON_MODAL);
index ce2215f1665b18475b6b1bf23889b09e9b435977..92fbca93472078543827867ec99214dea7683c07 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.
@@ -27,7 +27,6 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
 import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
 import com.intellij.debugger.requests.Requestor;
 import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.debugger.ui.DebuggerPanelsManager;
 import com.intellij.debugger.ui.breakpoints.Breakpoint;
 import com.intellij.debugger.ui.breakpoints.LineBreakpoint;
 import com.intellij.execution.configurations.RemoteConnection;
@@ -452,7 +451,6 @@ public class DebugProcessEvents extends DebugProcessImpl {
           DebuggerInvocationUtil.invokeAndWait(getProject(), new Runnable() {
             @Override
             public void run() {
-              DebuggerPanelsManager.getInstance(getProject()).toFront(mySession);
               final String displayName = requestor instanceof Breakpoint? ((Breakpoint)requestor).getDisplayName() : requestor.getClass().getSimpleName();
               final String message = DebuggerBundle.message("error.evaluating.breakpoint.condition.or.action", displayName, ex.getMessage());
               considerRequestHit[0] = Messages.showYesNoDialog(getProject(), message, ex.getTitle(), Messages.getQuestionIcon()) == Messages.YES;
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 c7e682f200a5b08a229d85caa0a219c5ee1477ac..5bd576c109f6951c6616dc618ee77659f01a2d32 100644 (file)
@@ -33,7 +33,14 @@ import com.intellij.debugger.requests.Requestor;
 import com.intellij.debugger.ui.CompletionEditor;
 import com.intellij.debugger.ui.breakpoints.Breakpoint;
 import com.intellij.debugger.ui.tree.DebuggerTreeNode;
+import com.intellij.execution.filters.ExceptionFilters;
+import com.intellij.execution.filters.TextConsoleBuilder;
+import com.intellij.execution.filters.TextConsoleBuilderFactory;
+import com.intellij.execution.ui.ConsoleView;
+import com.intellij.execution.ui.RunnerLayoutUi;
+import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
@@ -47,6 +54,9 @@ import com.intellij.pom.Navigatable;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.ui.classFilter.ClassFilter;
+import com.intellij.ui.content.Content;
+import com.intellij.unscramble.ThreadDumpPanel;
+import com.intellij.unscramble.ThreadState;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.xdebugger.XSourcePosition;
@@ -399,6 +409,43 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
     return null;
   }
 
+  private static int myThreadDumpsCount = 0;
+  private static int myCurrentThreadDumpId = 1;
+
+  private static final String THREAD_DUMP_CONTENT_PREFIX = "Dump";
+
+  public static void addThreadDump(Project project, List<ThreadState> threads, final RunnerLayoutUi ui, DebuggerSession session) {
+    final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
+    consoleBuilder.filters(ExceptionFilters.getFilters(session.getSearchScope()));
+    final ConsoleView consoleView = consoleBuilder.getConsole();
+    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
+    consoleView.allowHeavyFilters();
+    final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
+
+    final String id = THREAD_DUMP_CONTENT_PREFIX + " #" + myCurrentThreadDumpId;
+    final Content content = ui.createContent(id, panel, id, null, null);
+    content.setCloseable(true);
+    content.setDescription("Thread Dump");
+    ui.addContent(content);
+    ui.selectAndFocus(content, true, true);
+    myThreadDumpsCount++;
+    myCurrentThreadDumpId++;
+    Disposer.register(content, new Disposable() {
+      @Override
+      public void dispose() {
+        myThreadDumpsCount--;
+        if (myThreadDumpsCount == 0) {
+          myCurrentThreadDumpId = 1;
+        }
+      }
+    });
+    Disposer.register(content, consoleView);
+    ui.selectAndFocus(content, true, false);
+    if (threads.size() > 0) {
+      panel.selectStackFrame(0);
+    }
+  }
+
   public abstract DebuggerTreeNode  getSelectedNode    (DataContext context);
 
   public abstract EvaluatorBuilder  getEvaluatorBuilder();
index d084c0308b72372e102ab8b9959e2ddc01c0ac67..a443b6c03dbd8f0c5ce09285c2dc34c08ba16244 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,22 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy {
     throw new EvaluateException(error.getMessage(), error);
   }
 
+  @Override
+  public boolean isValid() {
+    DebuggerManagerThreadImpl.assertIsManagerThread();
+    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 eaf49dc37b29a9ccd494ec16fee4aa73f43609fd..71811a2bde26b95ed033d2e1bb6f8d56a731736f 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.
@@ -24,10 +24,8 @@ import com.intellij.debugger.engine.JavaDebugProcess;
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.impl.DebuggerSession;
 import com.intellij.debugger.impl.DebuggerStateManager;
-import com.intellij.debugger.ui.impl.MainWatchPanel;
 import com.intellij.debugger.ui.tree.render.BatchEvaluator;
 import com.intellij.execution.ExecutionException;
-import com.intellij.execution.ExecutionManager;
 import com.intellij.execution.Executor;
 import com.intellij.execution.configurations.RemoteConnection;
 import com.intellij.execution.configurations.RunProfileState;
@@ -39,9 +37,8 @@ import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.execution.ui.RunContentManager;
 import com.intellij.execution.ui.RunContentWithExecutorListener;
 import com.intellij.openapi.components.ProjectComponent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
 import com.intellij.xdebugger.XDebugProcess;
 import com.intellij.xdebugger.XDebugProcessStarter;
 import com.intellij.xdebugger.XDebugSession;
@@ -50,43 +47,10 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class DebuggerPanelsManager implements ProjectComponent {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerPanelsManager");
-
   private final Project myProject;
-  private final ExecutionManager myExecutionManager;
-
-  //private final PositionHighlighter myEditorManager;
-  //private final HashMap<ProcessHandler, DebuggerSessionTab> mySessionTabs = new HashMap<ProcessHandler, DebuggerSessionTab>();
 
-  public DebuggerPanelsManager(Project project, final EditorColorsManager colorsManager, ExecutionManager executionManager) {
+  public DebuggerPanelsManager(Project project) {
     myProject = project;
-    myExecutionManager = executionManager;
-
-    //myEditorManager = new PositionHighlighter(myProject, getContextManager());
-    //
-    //final EditorColorsListener myColorsListener = new EditorColorsListener() {
-    //  public void globalSchemeChange(EditorColorsScheme scheme) {
-    //    myEditorManager.updateContextPointDescription();
-    //  }
-    //};
-    //colorsManager.addEditorColorsListener(myColorsListener);
-    //Disposer.register(project, new Disposable() {
-    //  public void dispose() {
-    //    colorsManager.removeEditorColorsListener(myColorsListener);
-    //  }
-    //});
-    //
-    //getContextManager().addListener(new DebuggerContextListener() {
-    //  public void changeEvent(final DebuggerContextImpl newContext, int event) {
-    //    if (event == DebuggerSession.EVENT_PAUSE) {
-    //      DebuggerInvocationUtil.invokeLater(myProject, new Runnable() {
-    //        public void run() {
-    //          toFront(newContext.getDebuggerSession());
-    //        }
-    //      });
-    //    }
-    //  }
-    //});
   }
 
   private DebuggerStateManager getContextManager() {
@@ -195,48 +159,12 @@ public class DebuggerPanelsManager implements ProjectComponent {
     return project.getComponent(DebuggerPanelsManager.class);
   }
 
-  @Nullable
-  public MainWatchPanel getWatchPanel() {
-    DebuggerSessionTab sessionTab = getSessionTab();
-    return sessionTab != null ? sessionTab.getWatchPanel() : null;
-  }
-
-  @Nullable
-  public DebuggerSessionTab getSessionTab() {
-    DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(myProject).getContext();
-    return getSessionTab(context.getDebuggerSession());
-  }
-
-  public void showFramePanel() {
-    DebuggerSessionTab sessionTab = getSessionTab();
-    if (sessionTab != null) {
-      sessionTab.showFramePanel();
-    }
-  }
-
-  public void toFront(DebuggerSession session) {
-    DebuggerSessionTab sessionTab = getSessionTab(session);
-    if (sessionTab != null) {
-      sessionTab.toFront(true, null);
-    }
-  }
-
   private static DebuggerSession getSession(Project project, RunContentDescriptor descriptor) {
-    for (XDebugSession session : XDebuggerManager.getInstance(project).getDebugSessions()) {
-      if (session.getRunContentDescriptor().equals(descriptor)) {
-        XDebugProcess process = session.getDebugProcess();
-        if (process instanceof JavaDebugProcess) {
-          return ((JavaDebugProcess)process).getDebuggerSession();
-        }
+    for (JavaDebugProcess process : XDebuggerManager.getInstance(project).getDebugProcesses(JavaDebugProcess.class)) {
+      if (Comparing.equal(process.getProcessHandler(), descriptor.getProcessHandler())) {
+        return process.getDebuggerSession();
       }
     }
     return null;
   }
-
-  @Nullable
-  private DebuggerSessionTab getSessionTab(DebuggerSession session) {
-    //return session != null ? getSessionTab(session.getProcess().getExecutionResult().getProcessHandler()) : null;
-    return null;
-  }
-
 }
index 51a96197ba488fec67959a95550a926bef71a252..7842769a747974b9fb694826cc28fe4304796e9f 100644 (file)
@@ -36,12 +36,8 @@ import com.intellij.execution.ExecutionManager;
 import com.intellij.execution.ExecutionResult;
 import com.intellij.execution.configurations.RunProfile;
 import com.intellij.execution.executors.DefaultDebugExecutor;
-import com.intellij.execution.filters.ExceptionFilters;
-import com.intellij.execution.filters.TextConsoleBuilder;
-import com.intellij.execution.filters.TextConsoleBuilderFactory;
 import com.intellij.execution.ui.ConsoleView;
 import com.intellij.execution.ui.ExecutionConsoleEx;
-import com.intellij.execution.ui.RunnerLayoutUi;
 import com.intellij.execution.ui.layout.PlaceInGrid;
 import com.intellij.icons.AllIcons;
 import com.intellij.idea.ActionsBundle;
@@ -56,8 +52,6 @@ import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentManagerAdapter;
 import com.intellij.ui.content.ContentManagerEvent;
 import com.intellij.ui.content.tabs.PinToolwindowTabAction;
-import com.intellij.unscramble.ThreadDumpPanel;
-import com.intellij.unscramble.ThreadState;
 import com.intellij.xdebugger.XDebuggerBundle;
 import com.intellij.xdebugger.impl.actions.XDebuggerActions;
 import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
@@ -68,7 +62,6 @@ import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import javax.swing.tree.TreePath;
-import java.util.List;
 
 public class DebuggerSessionTab extends DebuggerSessionTabBase implements Disposable {
   private static final Logger LOG = Logger.getInstance(DebuggerSessionTab.class);
@@ -84,7 +77,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
   private final DebugUIEnvironment myDebugUIEnvironment;
 
   private final ThreadsPanel myThreadsPanel;
-  private static final String THREAD_DUMP_CONTENT_PREFIX = "Dump";
 
   public DebuggerSessionTab(final Project project, final String sessionName, @NotNull final DebugUIEnvironment environment,
                             @NotNull DebuggerSession debuggerSession) {
@@ -447,51 +439,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
     myUi.selectAndFocus(myUi.findContent(DebuggerContentInfo.FRAME_CONTENT), true, false);
   }
 
-  private static int myThreadDumpsCount = 0;
-  private static int myCurrentThreadDumpId = 1;
-
-  public static void addThreadDump(Project project, List<ThreadState> threads, final RunnerLayoutUi ui, DebuggerSession session) {
-    final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
-    consoleBuilder.filters(ExceptionFilters.getFilters(session.getSearchScope()));
-    final ConsoleView consoleView = consoleBuilder.getConsole();
-    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
-    consoleView.allowHeavyFilters();
-    final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
-
-    final String id = createThreadDumpContentId();
-    final Content content = ui.createContent(id, panel, id, null, null);
-    content.setCloseable(true);
-    content.setDescription("Thread Dump");
-    ui.addContent(content);
-    ui.selectAndFocus(content, true, true);
-    myThreadDumpsCount += 1;
-    myCurrentThreadDumpId += 1;
-    //Disposer.register(this, new Disposable() {
-    //  @Override
-    //  public void dispose() {
-    //    ui.removeContent(content, true);
-    //  }
-    //});
-    Disposer.register(content, new Disposable() {
-      @Override
-      public void dispose() {
-        myThreadDumpsCount -= 1;
-        if (myThreadDumpsCount == 0) {
-          myCurrentThreadDumpId = 1;
-        }
-      }
-    });
-    Disposer.register(content, consoleView);
-    ui.selectAndFocus(content, true, false);
-    if (threads.size() > 0) {
-      panel.selectStackFrame(0);
-    }
-  }
-
-  private static String createThreadDumpContentId() {
-    return THREAD_DUMP_CONTENT_PREFIX + " #" + myCurrentThreadDumpId;
-  }
-
   private class MyDebuggerStateManager extends DebuggerStateManager {
     @Override
     public void fireStateChanged(DebuggerContextImpl newContext, int event) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/ExpressionEvaluationDialog.java b/java/debugger/impl/src/com/intellij/debugger/ui/ExpressionEvaluationDialog.java
deleted file mode 100644 (file)
index a4e1b16..0000000
+++ /dev/null
@@ -1,190 +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.ui;
-
-import com.intellij.debugger.DebuggerBundle;
-import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.HelpID;
-import com.intellij.debugger.actions.EvaluateActionHandler;
-import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
-import com.intellij.debugger.engine.evaluation.TextWithImports;
-import com.intellij.debugger.impl.PositionUtil;
-import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CustomShortcutSet;
-import com.intellij.openapi.help.HelpManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.wm.ex.AbstractDelegatingToRootTraversalPolicy;
-import com.intellij.ui.IdeBorderFactory;
-import com.intellij.ui.components.JBLabel;
-import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-
-public class ExpressionEvaluationDialog extends EvaluationDialog {
-
-  public ExpressionEvaluationDialog(Project project, TextWithImports defaultExpression) {
-    super(project, defaultExpression);
-    setTitle(DebuggerBundle.message("evaluate.expression.dialog.title"));
-
-    final KeyStroke expressionStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK);
-    final KeyStroke resultStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK);
-
-    final JRootPane rootPane = getRootPane();
-
-    final AnAction anAction = new AnAction() {
-      public void actionPerformed(AnActionEvent e) {
-        getExpressionCombo().requestFocus();
-      }
-    };
-    anAction.registerCustomShortcutSet(new CustomShortcutSet(expressionStroke), rootPane);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        anAction.unregisterCustomShortcutSet(rootPane);
-      }
-    });
-
-    final AnAction anAction2 = new AnAction() {
-      public void actionPerformed(AnActionEvent e) {
-        getEvaluationPanel().getWatchTree().requestFocus();
-      }
-    };
-    anAction2.registerCustomShortcutSet(new CustomShortcutSet(resultStroke), rootPane);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        anAction2.unregisterCustomShortcutSet(rootPane);
-      }
-    });
-
-    init();
-  }
-
-  protected DebuggerExpressionComboBox createEditor(final CodeFragmentFactory factory) {
-    return new DebuggerExpressionComboBox(getProject(), PositionUtil.getContextElement(getDebuggerContext()), "evaluation", factory);
-  }
-
-  protected JComponent createCenterPanel() {
-    final JPanel panel = new JPanel(new BorderLayout());
-
-    final JPanel exprPanel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, 0));
-    exprPanel.add(new JLabel(DebuggerBundle.message("label.evaluate.dialog.expression")), BorderLayout.WEST);
-    exprPanel.add(getExpressionCombo(), BorderLayout.CENTER);
-    final JBLabel help = new JBLabel("Press Enter to Evaluate or Control+Enter to evaluate and add to the Watches", SwingConstants.RIGHT);
-    help.setBorder(IdeBorderFactory.createEmptyBorder(2,0,6,0));
-    help.setComponentStyle(UIUtil.ComponentStyle.SMALL);
-    help.setFontColor(UIUtil.FontColor.BRIGHTER);
-    exprPanel.add(help, BorderLayout.SOUTH);
-
-
-    final JPanel resultPanel = new JPanel(new BorderLayout());
-    //resultPanel.add(new JLabel(DebuggerBundle.message("label.evaluate.dialog.result")), BorderLayout.NORTH);
-    resultPanel.add(getEvaluationPanel(), BorderLayout.CENTER);
-
-    panel.add(exprPanel, BorderLayout.NORTH);
-    panel.add(resultPanel, BorderLayout.CENTER);
-    
-    panel.setFocusTraversalPolicyProvider(true);
-    panel.setFocusTraversalPolicy(new AbstractDelegatingToRootTraversalPolicy() {
-      @Override
-      public Component getComponentBefore(Container aContainer, Component aComponent) {
-        boolean focusExpressionCombo = isParent(aComponent, getEvaluationPanel());
-        return focusExpressionCombo ? getExpressionCombo().getEditorComponent() : super.getComponentBefore(aContainer, aComponent);
-      }
-
-      @Override
-      public Component getComponentAfter(Container aContainer, Component aComponent) {
-        boolean focusEvaluationPanel = isParent(aComponent, exprPanel);
-        return focusEvaluationPanel ? getEvaluationPanel().getTree() : super.getComponentAfter(aContainer, aComponent);
-      }
-
-      private boolean isParent(@NotNull Component component, @NotNull Container parent) {
-        for (Component c = component; c != null; c = c.getParent()) {
-          if (c == parent) {
-            return true;
-          }
-        }
-        return false;
-      }
-    });
-
-    return panel;
-  }
-
-  protected void initDialogData(TextWithImports text) {
-    super.initDialogData(text);
-    getExpressionCombo().selectAll();
-  }
-
-  private DebuggerExpressionComboBox getExpressionCombo() {
-    return (DebuggerExpressionComboBox)getEditor();
-  }
-
-  @NotNull
-  protected Action[] createActions() {
-    return new Action[] { getOKAction(), getCancelAction(), new SwitchAction(), getHelpAction() } ;
-  }
-
-  @Override
-  protected void createDefaultActions() {
-    super.createDefaultActions();
-    myOKAction = new OkAction(){
-      @Override
-      public void actionPerformed(ActionEvent e) {
-        super.actionPerformed(e);
-        if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) {
-          addCurrentExpressionToWatches();
-        }
-      }
-    };
-  }
-
-  private void addCurrentExpressionToWatches() {
-    final DebuggerSessionTab tab = DebuggerPanelsManager.getInstance(getProject()).getSessionTab();
-    if (tab != null) {
-      final TextWithImports evaluate = getCodeToEvaluate();
-      if (evaluate != null) {
-        tab.getWatchPanel().getWatchTree().addWatch(evaluate, null);
-      }
-    }
-  }
-
-  protected void doHelpAction() {
-    HelpManager.getInstance().invokeHelp(HelpID.EVALUATE);
-  }
-
-  private class SwitchAction extends AbstractAction {
-    public SwitchAction() {
-      putValue(Action.NAME, DebuggerBundle.message("action.evaluate.expression.dialog.switch.mode.description"));
-    }
-
-    public void actionPerformed(ActionEvent e) {
-      final TextWithImports text = getEditor().getText();
-      doCancelAction();
-      DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
-        public void run() {
-          EvaluateActionHandler.showEvaluationDialog(getProject(), text, DebuggerSettings.EVALUATE_FRAGMENT);
-        }
-      });
-    }
-  }
-
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/StatementEvaluationDialog.java b/java/debugger/impl/src/com/intellij/debugger/ui/StatementEvaluationDialog.java
deleted file mode 100644 (file)
index 653f24f..0000000
+++ /dev/null
@@ -1,221 +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.ui;
-
-import com.intellij.debugger.DebuggerBundle;
-import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.HelpID;
-import com.intellij.debugger.actions.EvaluateActionHandler;
-import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
-import com.intellij.debugger.engine.evaluation.TextWithImports;
-import com.intellij.debugger.impl.PositionUtil;
-import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CustomShortcutSet;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.event.DocumentAdapter;
-import com.intellij.openapi.editor.event.DocumentEvent;
-import com.intellij.openapi.help.HelpManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.Splitter;
-import com.intellij.openapi.util.DimensionService;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiWhiteSpace;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-
-/**
- * @author lex
- */
-public class StatementEvaluationDialog extends EvaluationDialog{
-  private final JPanel myPanel;
-  private final Action mySwitchAction = new SwitchAction();
-  private static final @NonNls String STATEMENT_EDITOR_DIMENSION_KEY = "#com.intellij.debugger.ui.StatementEvaluationDialog.StatementEditor";
-  private static final @NonNls String EVALUATION_PANEL_DIMENSION_KEY = "#com.intellij.debugger.ui.StatementEvaluationDialog.EvaluationPanel";
-
-  public StatementEvaluationDialog(final Project project, TextWithImports text) {
-    super(project, text);
-    setTitle(DebuggerBundle.message("evaluate.statement.dialog.title"));
-    myPanel = new JPanel(new BorderLayout());
-
-    final Splitter splitter = new Splitter(true);
-    splitter.setHonorComponentsMinimumSize(true);
-
-    final JPanel editorPanel = new JPanel(new GridBagLayout());
-
-    final JLabel statementsLabel = new JLabel(DebuggerBundle.message("label.evaluation.dialog.statements"));
-    editorPanel.add(statementsLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
-    editorPanel.add(getStatementEditor(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 0, 0, 0), 0, 0));
-
-    splitter.setFirstComponent(editorPanel);
-
-    final MyEvaluationPanel evaluationPanel = getEvaluationPanel();
-    final JPanel ep = new JPanel(new BorderLayout());
-    //final JLabel resultLabel = new JLabel(DebuggerBundle.message("label.evaluate.dialog.result"));
-    //ep.add(resultLabel, BorderLayout.NORTH);
-    ep.add(evaluationPanel, BorderLayout.CENTER);
-    splitter.setSecondComponent(ep);
-    final Dimension statementSize = DimensionService.getInstance().getSize(STATEMENT_EDITOR_DIMENSION_KEY, project);
-    final Dimension evaluationSize = DimensionService.getInstance().getSize(EVALUATION_PANEL_DIMENSION_KEY, project);
-    if (statementSize != null && evaluationSize != null) {
-      final float proportion = (float)statementSize.height / (float)(statementSize.height + evaluationSize.height);
-      splitter.setProportion(proportion);
-    }
-    myPanel.add(splitter, BorderLayout.CENTER);
-
-    setDebuggerContext(getDebuggerContext());
-
-    final KeyStroke codeFragment = KeyStroke.getKeyStroke(KeyEvent.VK_E,     KeyEvent.ALT_MASK);
-    final KeyStroke resultStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,     KeyEvent.ALT_MASK);
-    final KeyStroke altEnter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_MASK);
-
-    final JRootPane rootPane = getRootPane();
-    final AnAction toStatementAction = new AnAction() {
-      public void actionPerformed(AnActionEvent e) {
-        getStatementEditor().requestFocus();
-      }
-    };
-    toStatementAction.registerCustomShortcutSet(new CustomShortcutSet(codeFragment), rootPane);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        toStatementAction.unregisterCustomShortcutSet(rootPane);
-      }
-    });
-
-    final AnAction toEvaluationAction = new AnAction() {
-      public void actionPerformed(AnActionEvent e) {
-        getEvaluationPanel().getWatchTree().requestFocus();
-      }
-    };
-    toEvaluationAction.registerCustomShortcutSet(new CustomShortcutSet(resultStroke), rootPane);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        toEvaluationAction.unregisterCustomShortcutSet(rootPane);
-      }
-    });
-
-    final AnAction okAction = new AnAction() {
-      public void actionPerformed(AnActionEvent e) {
-        doOKAction();
-      }
-    };
-    okAction.registerCustomShortcutSet(new CustomShortcutSet(altEnter), rootPane);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        okAction.unregisterCustomShortcutSet(rootPane);
-      }
-    });
-
-    final DebuggerEditorImpl editor = getEditor();
-    final DocumentAdapter docListener = new DocumentAdapter() {
-      public void documentChanged(final DocumentEvent e) {
-        DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
-          public void run() {
-            updateSwitchButton(e.getDocument());
-          }
-        });
-      }
-    };
-    editor.addDocumentListener(docListener);
-    addDisposeRunnable(new Runnable() {
-      public void run() {
-        editor.removeDocumentListener(docListener);
-      }
-    });
-
-    init();
-  }
-
-  private void updateSwitchButton(Document document) {
-    PsiDocumentManager.getInstance(getProject()).commitDocument(document);
-    PsiFile psiFile = PsiDocumentManager.getInstance(getProject()).getPsiFile(document);
-    if (psiFile == null) {
-      return;
-    }
-    PsiElement[] children = psiFile.getChildren();
-    int nonWhite = 0;
-    for (PsiElement child : children) {
-      if (!(child instanceof PsiWhiteSpace)) {
-        nonWhite++;
-        if (nonWhite > 1) {
-          mySwitchAction.setEnabled(false);
-          return;
-        }
-      }
-    }
-
-    mySwitchAction.setEnabled(true);
-  }
-
-  @NotNull
-  protected Action[] createActions(){
-    return new Action[]{getOKAction(), getCancelAction(), mySwitchAction, getHelpAction() };
-  }
-
-  protected void doHelpAction() {
-    HelpManager.getInstance().invokeHelp(HelpID.EVALUATE);
-  }
-
-  protected DebuggerEditorImpl createEditor(final CodeFragmentFactory factory) {
-    return new DebuggerStatementEditor(getProject(), PositionUtil.getContextElement(getDebuggerContext()), "evaluation", factory);
-  }
-
-  public void dispose() {
-    try {
-      final DebuggerEditorImpl editor = getEditor();
-      final DimensionService dimensionService = DimensionService.getInstance();
-      dimensionService.setSize(STATEMENT_EDITOR_DIMENSION_KEY, editor.getSize(null), getProject());
-      dimensionService.setSize(EVALUATION_PANEL_DIMENSION_KEY, getEvaluationPanel().getSize(), getProject());
-    }
-    finally {
-      super.dispose();
-    }
-  }
-
-  protected JComponent createCenterPanel() {
-    return myPanel;
-  }
-
-  private DebuggerStatementEditor getStatementEditor() {
-    return (DebuggerStatementEditor)getEditor();
-  }
-
-  private class SwitchAction extends AbstractAction {
-    public SwitchAction() {
-      putValue(NAME, DebuggerBundle.message("action.evaluate.statement.dialog.switch.mode.description"));
-    }
-
-    public void actionPerformed(ActionEvent e) {
-      final TextWithImports text = getEditor().getText();
-      doCancelAction();
-      DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
-        public void run() {
-          EvaluateActionHandler.showEvaluationDialog(getProject(), text, DebuggerSettings.EVALUATE_EXPRESSION);
-        }
-      });
-    }
-  }
-
-
-}
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 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());
 
diff --git a/java/java-impl/src/com/intellij/codeEditor/printing/MethodSeparatorProvider.java b/java/java-impl/src/com/intellij/codeEditor/printing/MethodSeparatorProvider.java
deleted file mode 100644 (file)
index 80aa4d5..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * User: anna
- * Date: 25-Jan-2008
- */
-package com.intellij.codeEditor.printing;
-
-import com.intellij.codeInsight.daemon.LineMarkerInfo;
-import com.intellij.codeInsight.daemon.impl.LineMarkersPass;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.psi.PsiFile;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-public class MethodSeparatorProvider extends FileSeparatorProvider {
-  @Override
-  public List<LineMarkerInfo> getFileSeparators(final PsiFile file, final Document document, @Nullable final Editor editor) {
-    final List<LineMarkerInfo> result = new ArrayList<LineMarkerInfo>();
-    LineMarkersPass pass = new LineMarkersPass(file.getProject(), file, editor, document, file.getTextRange());
-    for (LineMarkerInfo lineMarkerInfo : pass.queryLineMarkers()) {
-      if (lineMarkerInfo.separatorColor != null) {
-        result.add(lineMarkerInfo);
-      }
-    }
-
-    Collections.sort(result, new Comparator<LineMarkerInfo>() {
-      public int compare(final LineMarkerInfo i1, final LineMarkerInfo i2) {
-        return i1.startOffset - i2.startOffset;
-      }
-    });
-    return result;
-  }
-}
\ No newline at end of file
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 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 1fd4e786509fa780ad969969b9ae60f388961312..827461de6b3e60ad87b9f8d9c3ce461e86301299 100644 (file)
@@ -17,60 +17,40 @@ package com.intellij.psi;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.psi.util.*;
-import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Map;
-
 /**
  * User: anna
  */
 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 && 
+  public static boolean isSecondSearchPossible(PsiType[] parameterTypes,
+                                               QualifierResolveResult qualifierResolveResult,
+                                               PsiMethodReferenceExpression methodRef) {
+    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;
   }
 
-  public static String checkReturnType(PsiMethodReferenceExpression expression, JavaResolveResult result, PsiType functionalInterfaceType) {
-    final PsiElement resolve = result.getElement();
-    if (resolve instanceof PsiMethod) {
-      final PsiClass containingClass = ((PsiMethod)resolve).getContainingClass();
-      LOG.assertTrue(containingClass != null);
-      PsiSubstitutor subst = result.getSubstitutor();
-      PsiClass qContainingClass = getQualifierResolveResult(expression).getContainingClass();
-      if (qContainingClass != null && isReceiverType(functionalInterfaceType, containingClass, (PsiMethod)resolve)) {
-        subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
-        LOG.assertTrue(subst != null);
-      }
-
-
-      final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
-
-      PsiType returnType = PsiTypesUtil.patchMethodGetClassReturnType(expression, expression,
-                                                                      (PsiMethod)resolve, null,
-                                                                      PsiUtil.getLanguageLevel(expression));
-      if (returnType == null) {
-        returnType = ((PsiMethod)resolve).getReturnType();
-      }
-      PsiType methodReturnType = subst.substitute(returnType);
-      if (interfaceReturnType != null && interfaceReturnType != PsiType.VOID) {
-        if (methodReturnType == null) {
-          methodReturnType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(containingClass, subst);
-        }
-        if (!TypeConversionUtil.isAssignable(interfaceReturnType, methodReturnType, false)) {
-          return "Bad return type in method reference: cannot convert " + methodReturnType.getCanonicalText() + " to " + interfaceReturnType.getCanonicalText();
-        }
-      }
+  public static boolean isResolvedBySecondSearch(@NotNull PsiMethodReferenceExpression methodRef,
+                                                 @Nullable MethodSignature signature,
+                                                 boolean varArgs,
+                                                 boolean isStatic,
+                                                 int parametersCount) {
+    if (signature == null) {
+      return false;
     }
-    return null;
+    final QualifierResolveResult qualifierResolveResult = getQualifierResolveResult(methodRef);
+    final PsiType[] functionalMethodParameterTypes = signature.getParameterTypes();
+    return (parametersCount + 1 == functionalMethodParameterTypes.length && !varArgs ||
+            varArgs && functionalMethodParameterTypes.length > 0 && !isStatic) &&
+           isSecondSearchPossible(functionalMethodParameterTypes, qualifierResolveResult, methodRef);
   }
 
   public static boolean isCorrectAssignment(PsiType[] parameterTypes,
@@ -163,7 +143,7 @@ public class PsiMethodReferenceUtil {
     PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
     final PsiExpression expression = methodReferenceExpression.getQualifierExpression();
     if (expression != null) {
-      final PsiType expressionType = getExpandedType(expression.getType(), expression);
+      final PsiType expressionType = replaceArrayType(expression.getType(), expression);
       PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(expressionType);
       containingClass = result.getElement();
       if (containingClass != null) {
@@ -182,7 +162,7 @@ public class PsiMethodReferenceUtil {
     else {
       final PsiTypeElement typeElement = methodReferenceExpression.getQualifierType();
       if (typeElement != null) {
-        PsiType type = getExpandedType(typeElement.getType(), typeElement);
+        PsiType type = replaceArrayType(typeElement.getType(), typeElement);
         PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(type);
         containingClass = result.getElement();
         if (containingClass != null) {
@@ -202,59 +182,33 @@ 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), 
+                                           replaceArrayType(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) {
+  private static PsiType replaceArrayType(PsiType type, @NotNull PsiElement context) {
     if (type instanceof PsiArrayType) {
-      type = JavaPsiFacade.getElementFactory(typeElement.getProject())
-        .getArrayClassType(((PsiArrayType)type).getComponentType(), PsiUtil.getLanguageLevel(typeElement));
+      type = JavaPsiFacade.getElementFactory(context.getProject())
+        .getArrayClassType(((PsiArrayType)type).getComponentType(), PsiUtil.getLanguageLevel(context));
     }
     return type;
   }
@@ -282,8 +236,15 @@ public class PsiMethodReferenceUtil {
 
       isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
       isConstructor = method.isConstructor();
-      receiverReferenced = hasReceiver(methodRef, method, functionalInterfaceType);
-      
+
+      final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
+      final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
+      receiverReferenced = isResolvedBySecondSearch(methodRef,
+                                                    interfaceMethod != null ? interfaceMethod.getSignature(LambdaUtil.getSubstitutor(interfaceMethod, resolveResult)) : null, 
+                                                    method.isVarArgs(), 
+                                                    isMethodStatic,
+                                                    method.getParameterList().getParametersCount());
+
       if (method.hasModifierProperty(PsiModifier.ABSTRACT) && qualifier instanceof PsiSuperExpression) {
         return "Abstract method '" + method.getName() + "' cannot be accessed directly";
       }
@@ -322,27 +283,6 @@ public class PsiMethodReferenceUtil {
     return null;
   }
 
-  public static boolean hasReceiver(@NotNull PsiMethodReferenceExpression methodRef,
-                                    @NotNull PsiMethod method) {
-    return hasReceiver(methodRef, method, methodRef.getFunctionalInterfaceType());
-  }
-
-  private static boolean hasReceiver(@NotNull PsiMethodReferenceExpression methodRef,
-                                     @NotNull PsiMethod method,
-                                     PsiType functionalInterfaceType) {
-    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
-    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
-    final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(LambdaUtil.getSubstitutor(interfaceMethod, resolveResult)) : null;
-    if (signature == null) {
-      return false;
-    }
-    final PsiType[] parameterTypes = signature.getParameterTypes();
-    final QualifierResolveResult qualifierResolveResult = getQualifierResolveResult(methodRef);
-    return (method.getParameterList().getParametersCount() + 1 == parameterTypes.length ||
-            method.isVarArgs() && parameterTypes.length > 0 && !method.hasModifierProperty(PsiModifier.STATIC)) &&
-           hasReceiver(parameterTypes, qualifierResolveResult, methodRef);
-  }
-
   public static String checkTypeArguments(PsiTypeElement qualifier, PsiType psiType) {
     if (psiType instanceof PsiClassType) {
       final PsiJavaCodeReferenceElement referenceElement = qualifier.getInnermostComponentReferenceElement();
@@ -357,4 +297,38 @@ public class PsiMethodReferenceUtil {
     }
     return null;
   }
+
+  public static String checkReturnType(PsiMethodReferenceExpression expression, JavaResolveResult result, PsiType functionalInterfaceType) {
+    final PsiElement resolve = result.getElement();
+    if (resolve instanceof PsiMethod) {
+      final PsiClass containingClass = ((PsiMethod)resolve).getContainingClass();
+      LOG.assertTrue(containingClass != null);
+      PsiSubstitutor subst = result.getSubstitutor();
+      PsiClass qContainingClass = getQualifierResolveResult(expression).getContainingClass();
+      if (qContainingClass != null && isReceiverType(getFirstParameterType(functionalInterfaceType, expression), qContainingClass,  subst)) {
+        subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
+        LOG.assertTrue(subst != null);
+      }
+
+
+      final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
+
+      PsiType returnType = PsiTypesUtil.patchMethodGetClassReturnType(expression, expression,
+                                                                      (PsiMethod)resolve, null,
+                                                                      PsiUtil.getLanguageLevel(expression));
+      if (returnType == null) {
+        returnType = ((PsiMethod)resolve).getReturnType();
+      }
+      PsiType methodReturnType = subst.substitute(returnType);
+      if (interfaceReturnType != null && interfaceReturnType != PsiType.VOID) {
+        if (methodReturnType == null) {
+          methodReturnType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(containingClass, subst);
+        }
+        if (!TypeConversionUtil.isAssignable(interfaceReturnType, methodReturnType, false)) {
+          return "Bad return type in method reference: cannot convert " + methodReturnType.getCanonicalText() + " to " + interfaceReturnType.getCanonicalText();
+        }
+      }
+    }
+    return null;
+  }
 }
index 063f2b81934e42a4c0dcc52647b6ac1a42602e72..8a63eabe16e2780bcbdb3cb8a4b69e5b4d7e3a57 100644 (file)
@@ -116,48 +116,36 @@ public class MethodCandidateInfo extends CandidateInfo{
       return getApplicabilityLevel();
     }
     @ApplicabilityLevelConstant int level;
-    Integer boxedLevel = ourOverloadGuard.doPreventingRecursion(myArgumentList, false, new Computable<Integer>() {
-      @Override
-      public Integer compute() {
-        if (PsiUtil.isLanguageLevel8OrHigher(myArgumentList)) {
-          PsiSubstitutor substitutor = getSubstitutor(false);
-          Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
-          if (map == null) {
-            map = ContainerUtil.createConcurrentWeakMap();
-            CURRENT_CANDIDATE.set(map);
-          }
-          final PsiMethod method = getElement();
-          final CurrentCandidateProperties properties = new CurrentCandidateProperties(method, substitutor, isVarargs(), true);
-          final CurrentCandidateProperties alreadyThere = map.put(getMarkerList(), properties);
-          try {
-            PsiType[] argumentTypes = getArgumentTypes();
-            if (argumentTypes == null) {
-              return ApplicabilityLevel.NOT_APPLICABLE;
-            }
-
-            final int applicabilityLevel = PsiUtil.getApplicabilityLevel(method, substitutor, argumentTypes, myLanguageLevel);
-            if (!isVarargs() && applicabilityLevel < ApplicabilityLevel.FIXED_ARITY) {
-              return ApplicabilityLevel.NOT_APPLICABLE;
-            }
-            return applicabilityLevel;
-          }
-          finally {
-            if (alreadyThere == null) {
-              map.remove(getMarkerList());
-            } else {
-              map.put(getMarkerList(), alreadyThere);
-            }
-          }
-        }
-        return getApplicabilityLevelInner();
+    PsiSubstitutor substitutor = getSubstitutor(false);
+    Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
+    if (map == null) {
+      map = ContainerUtil.createConcurrentWeakMap();
+      CURRENT_CANDIDATE.set(map);
+    }
+    final PsiMethod method = getElement();
+    final CurrentCandidateProperties properties = new CurrentCandidateProperties(method, substitutor, isVarargs(), true);
+    final CurrentCandidateProperties alreadyThere = map.put(getMarkerList(), properties);
+    try {
+      PsiType[] argumentTypes = getArgumentTypes();
+      if (argumentTypes == null) {
+        return ApplicabilityLevel.NOT_APPLICABLE;
       }
 
-    });
-    if (boxedLevel == null) {
-      return getApplicabilityLevel();
+      level = PsiUtil.getApplicabilityLevel(method, substitutor, argumentTypes, myLanguageLevel);
+      if (!isVarargs() && level < ApplicabilityLevel.FIXED_ARITY) {
+        return ApplicabilityLevel.NOT_APPLICABLE;
+      }
+    }
+    finally {
+      if (alreadyThere == null) {
+        map.remove(getMarkerList());
+      } else {
+        map.put(getMarkerList(), alreadyThere);
+      }
+    }
+    if (level > ApplicabilityLevel.NOT_APPLICABLE && !isTypeArgumentsApplicable(false)) {
+      level = ApplicabilityLevel.NOT_APPLICABLE;
     }
-    level = boxedLevel;
-    if (level > ApplicabilityLevel.NOT_APPLICABLE && !isTypeArgumentsApplicable(false)) level = ApplicabilityLevel.NOT_APPLICABLE;
     return level;
   }
 
@@ -312,17 +300,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 8ed59d42b629f1e0137a1df979c4cce1c3939fec..389c9d3c23ee773c30eb6843ba63b12b09e0b677 100644 (file)
@@ -396,8 +396,17 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
             return parent instanceof PsiNewExpression ? ((PsiNewExpression)parent).getArgumentList() : super.getMarkerList();
           }
         };
-      if (!varargs && staticFactoryMethod.isVarArgs() && staticFactoryCandidateInfo.getPertinentApplicabilityLevel() < MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY) {
-        return inferTypeParametersForStaticFactory(staticFactoryMethod, expression, parent, true);
+      if (!varargs && staticFactoryMethod.isVarArgs()) {
+        final Computable<Integer> computable = new Computable<Integer>() {
+          @Override
+          public Integer compute() {
+            return staticFactoryCandidateInfo.getPertinentApplicabilityLevel();
+          }
+        };
+        final Integer applicability = MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(expression, true, computable);
+        if ((applicability != null ? applicability : staticFactoryCandidateInfo.getApplicabilityLevel()) < MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY) {
+          return inferTypeParametersForStaticFactory(staticFactoryMethod, expression, parent, true);
+        }
       }
       return staticFactoryCandidateInfo.getSubstitutor();
     }
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 bd9307e5a498baac2923484a0478690e655f163a..f03b12bb0ab5486cbca21b149c80cb97194ff19d 100644 (file)
@@ -1223,8 +1223,7 @@ public class InferenceSession {
                                                       PsiImplUtil.normalizeWildcardTypeByPosition(pType, reference)));
       }
     }
-    else if (parameters.length + 1 == functionalMethodParameters.length && !varargs || 
-             !isStatic && varargs && functionalMethodParameters.length > 0 && PsiMethodReferenceUtil.hasReceiver(reference, method)) { //instance methods
+    else if (PsiMethodReferenceUtil.isResolvedBySecondSearch(reference, signature, varargs, isStatic, parameters.length)) { //instance methods
       initBounds(containingClass.getTypeParameters());
 
       final PsiType pType = signature.getParameterTypes()[0];
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 56674fa3952bd7d72ababec9a9e7fc141fe211c1..8acbda0128946568c5ea9fb70416a2b8d1e964ba 100644 (file)
 package com.intellij.psi.impl.source.tree.java;
 
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Computable;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy;
 import com.intellij.psi.impl.source.resolve.ResolveCache;
-import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
 import com.intellij.psi.infos.CandidateInfo;
 import com.intellij.psi.infos.ClassCandidateInfo;
@@ -38,7 +38,6 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 public class MethodReferenceResolver implements ResolveCache.PolyVariantContextResolver<PsiMethodReferenceExpressionImpl> {
   private static final Logger LOG = Logger.getInstance("#" + MethodReferenceResolver.class.getName());
@@ -214,14 +213,14 @@ public class MethodReferenceResolver implements ResolveCache.PolyVariantContextR
 
     @Nullable
     @Override
-    public CandidateInfo resolveConflict(@NotNull List<CandidateInfo> conflicts) {
+    protected CandidateInfo guardedOverloadResolution(@NotNull List<CandidateInfo> conflicts) {
       if (mySignature == null) return null;
 
       if (conflicts.size() > 1) checkSameSignatures(conflicts);
       if (conflicts.size() > 1) checkAccessStaticLevels(conflicts, true);
 
       final PsiType[] argTypes = mySignature.getParameterTypes();
-      boolean hasReceiver = PsiMethodReferenceUtil.hasReceiver(argTypes, myQualifierResolveResult, myReferenceExpression);
+      boolean hasReceiver = PsiMethodReferenceUtil.isSecondSearchPossible(argTypes, myQualifierResolveResult, myReferenceExpression);
 
       final List<CandidateInfo> firstCandidates = new ArrayList<CandidateInfo>();
       final List<CandidateInfo> secondCandidates = new ArrayList<CandidateInfo>();
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);
         }
index 678011e4048d964d8110c3241df1a87ff5133652..ce4e29a6781e82a6b5195c9b38f217f1ff80f06b 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
 import com.intellij.openapi.projectRoots.JavaVersionService;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Computable;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiSuperMethodImplUtil;
@@ -68,7 +69,17 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
   }
 
   @Override
-  public CandidateInfo resolveConflict(@NotNull List<CandidateInfo> conflicts){
+  public final CandidateInfo resolveConflict(@NotNull final List<CandidateInfo> conflicts){
+    return MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(myArgumentsList, true, new Computable<CandidateInfo>() {
+      @Override
+      public CandidateInfo compute() {
+        return guardedOverloadResolution(conflicts);
+      }
+    });
+  }
+
+  @Nullable
+  protected CandidateInfo guardedOverloadResolution(@NotNull List<CandidateInfo> conflicts) {
     if (conflicts.isEmpty()) return null;
     if (conflicts.size() == 1) return conflicts.get(0);
 
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/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/newLambda/IDEA136759.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA136759.java
new file mode 100644 (file)
index 0000000..50348e4
--- /dev/null
@@ -0,0 +1,19 @@
+
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+class Test {
+
+  public Long getKey() {
+    return 0L;
+  }
+
+  public static void main(Stream<Test> stream) {
+    stream.map(s -> Inner.of(Test::getKey, s));
+  }
+
+  public static final class Inner<K> {
+    public static <T> Inner<T> of(final Object key, final Test   value) {return null;}
+    public static <T> Inner<T> of(final Function< T, Long> keyMapper, final Test value) {return null;}
+  }
+}
\ No newline at end of file
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/CachedSubstitutionDuringOverloadResolution.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/CachedSubstitutionDuringOverloadResolution.java
new file mode 100644 (file)
index 0000000..8c020ce
--- /dev/null
@@ -0,0 +1,19 @@
+
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+class Test {
+
+  public Long getKey() {
+    return 0L;
+  }
+
+  public static void main(Stream<Test> stream) {
+    stream.map(s -> Inner.of(Test::get<ref>Key, s));
+  }
+
+  public static final class Inner<K> {
+    public static <T> Inner<T> of(final Object key, final Test   value) {return null;}
+    public static <T> Inner<T> of(final Function< T, Long> keyMapper, final Test value) {return null;}
+  }
+}
\ 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
index 50206caa0053afb516016b0b768c009def2f29ea..b27540c6a50d08094d623d15afd083be6df1398f 100644 (file)
@@ -122,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 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 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 {
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 d53205a820cbb6741c726fa83e9fc17ba128c9e7..b43b210229468039d77c9db9cffbb3924e02b96f 100644 (file)
@@ -17,14 +17,13 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
-import com.intellij.idea.Bombed;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
+import junit.framework.Test;
+import junit.framework.TestSuite;
 import org.jetbrains.annotations.NonNls;
 
-import java.util.Calendar;
-
 public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
   @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/newLambda";
 
@@ -80,7 +79,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 +137,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 +169,6 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
-  @Bombed(year = 2015, month = Calendar.MARCH, day = 30)
   public void testIDEA127124() throws Exception {
     doTest();
   }
@@ -177,6 +177,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
+  public void testIDEA136759() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
@@ -193,7 +197,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
 /*
   public static Test suite() {
     final TestSuite suite = new TestSuite();
-    for (int i = 0; i < 100; i++) {
+    for (int i = 0; i < 1000; i++) {
       suite.addTestSuite(NewLambdaHighlightingTest.class);
     }
     return suite;
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..04b261cedec8bfd030596783f4fc39225697b76a 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,18 @@ public class TypeInference18Test extends ResolveTestCase {
     doTest();
   }
 
+  public void testSecondConflictResolution() throws Exception {
+    doTestMethodCall();
+  }
+
+  public void testCachedSubstitutionDuringOverloadResolution() throws Exception {
+    PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
+    assertNotNull(ref);
+    PsiMethodReferenceExpression methodCallExpression = PsiTreeUtil.getParentOfType(ref.getElement(), PsiMethodReferenceExpression.class, false);
+    assertNotNull(methodCallExpression);
+    assertNotNull(methodCallExpression.resolve());
+  }
+
   private LanguageLevel myOldLanguageLevel;
 
   @Override
@@ -46,6 +59,14 @@ public class TypeInference18Test extends ResolveTestCase {
     super.tearDown();
   }
 
+  private void doTestMethodCall() 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 void doTest() throws Exception {
     PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
     assertNotNull(ref);
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 45c38a57154fe71fd910692e120ff75bb3b0ec13..85bdf9c1398aa6f45c7c614940a2f61780cc9da9 100644 (file)
@@ -165,7 +165,7 @@ class JavaPredefinedConfigurations {
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.typed.symbol"),"'Symbol <'_GenericArgument+>", GENERICS_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.generic.casts"),"( '_Type <'_GenericArgument+> ) '_Expr", GENERICS_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.type.var.substitutions.in.intanceof.with.generic.types"),"'_Expr instanceof '_Type <'Substitutions+> ", GENERICS_TYPE),
-      createSearchTemplateInfo(SSRBundle.message("predefined.configuration.variables.of.generic.types"),"'_Type <'_GenericArgument+>  'Var = 'Init?;", GENERICS_TYPE),
+      createSearchTemplateInfo(SSRBundle.message("predefined.configuration.variables.of.generic.types"),"'_Type <'_GenericArgument+>  'Var = '_Init?;", GENERICS_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.diamond.operators"), "new 'ClassName<>('_Argument*)", GENERICS_TYPE),
 
       // Add comments and metadata
@@ -226,7 +226,7 @@ class JavaPredefinedConfigurations {
                                                                                                "  public void ejbRemove();\n" +
                                                                                                "}", J2EE_TYPE),
       createSearchTemplateInfoSimple(SSRBundle.message("predefined.configuration.ejb.interface"),"interface 'EjbInterface extends EJBObject {\n" +
-                                                                                                 "  'Type+ 'Method+('ParamType* 'ParamName*);\n" +
+                                                                                                 "  '_Type+ '_Method+('_ParamType* '_ParamName*);\n" +
                                                                                                  "}", J2EE_TYPE),
       createSearchTemplateInfoSimple(SSRBundle.message("predefined.configuration.servlets"),"public class 'Servlet extends '_ParentClass:*HttpServlet {\n" +
                                                                                             "  public void '_InitServletMethod?:init ();\n" +
@@ -243,19 +243,19 @@ class JavaPredefinedConfigurations {
 
       // Misc types
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.serializable.classes.and.their.serialization.implementation"),
-                               "class '_Class implements '_Serializable:*Serializable {\n" +
-                               "  static final long 'VersionField?:serialVersionUID = '_VersionFieldInit?;\n" +
+                               "class 'Class implements '_Serializable:*Serializable {\n" +
+                               "  static final long '_VersionField?:serialVersionUID = '_VersionFieldInit?;\n" +
                                "  private static final ObjectStreamField[] '_persistentFields?:serialPersistentFields = '_persistentFieldInitial?; \n" +
-                               "  private void 'SerializationWriteHandler?:writeObject (ObjectOutputStream '_stream) throws IOException;\n" +
-                               "  private void 'SerializationReadHandler?:readObject (ObjectInputStream '_stream2) throws IOException, ClassNotFoundException;\n" +
-                               "  Object 'SpecialSerializationReadHandler?:readResolve () throws ObjectStreamException;\n" +
-                               "  Object 'SpecialSerializationWriteHandler?:writeReplace () throws ObjectStreamException;\n" +
+                               "  private void '_SerializationWriteHandler?:writeObject (ObjectOutputStream '_stream) throws IOException;\n" +
+                               "  private void '_SerializationReadHandler?:readObject (ObjectInputStream '_stream2) throws IOException, ClassNotFoundException;\n" +
+                               "  Object '_SpecialSerializationReadHandler?:readResolve () throws ObjectStreamException;\n" +
+                               "  Object '_SpecialSerializationWriteHandler?:writeReplace () throws ObjectStreamException;\n" +
                                "}",MISC_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.cloneable.implementations"),
                                "class '_Class implements '_Interface:*Cloneable {\n" +
                                "  Object 'CloningMethod:*clone ();\n" +
                                "}",MISC_TYPE),
-      createSearchTemplateInfoSimple(SSRBundle.message("predefined.configuration.]junit.test.cases"),"public class 'TestCase extends 'TestCaseClazz:*TestCase {\n" +
+      createSearchTemplateInfoSimple(SSRBundle.message("predefined.configuration.]junit.test.cases"),"public class 'TestCase extends '_TestCaseClazz:*TestCase {\n" +
                                                                                                      "  public void '_testMethod+:test.* ();\n" +
                                                                                                      "}", MISC_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.singletons"),"class 'Class {\n" +
@@ -285,7 +285,7 @@ class JavaPredefinedConfigurations {
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.symbol"),"'Symbol",INTERESTING_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.fields.variables.read"),"'Symbol:[read]",INTERESTING_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.fields_variables.with.given.name.pattern.updated"),"'Symbol:[regex( name ) && write]",INTERESTING_TYPE),
-      createSearchTemplateInfo(SSRBundle.message("predefined.configuration.usage.of.derived.type.in.cast"),"('CastType:*Base ) 'Expr",INTERESTING_TYPE),
+      createSearchTemplateInfo(SSRBundle.message("predefined.configuration.usage.of.derived.type.in.cast"),"('CastType:*[regex( Base )]) '_Expr",INTERESTING_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.declarations"),"'_Type:Object|Integer|Boolean|Long|Character|Short|Byte 'Var = '_Value:[exprtype( int|boolean|long|char|short|byte )]",INTERESTING_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.unboxing.in.declarations"),"'_Type:int|boolean|long|char|short|byte 'Var = '_Value:[exprtype( Integer|Boolean|Long|Character|Short|Byte )]",INTERESTING_TYPE),
       createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.method.calls"),"'_Instance?.'Call('_BeforeParam*,'_Param:[ exprtype( int|boolean|long|char|short|byte ) && formal( Object|Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",INTERESTING_TYPE),
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 d116c3ce30fe3aa4199c8ad3a21170ceb8cfef37..0861f1ec9e5ccf12b02d1f1bf9d2ed2a4924c34a 100644 (file)
@@ -1,6 +1,7 @@
 package com.intellij.refactoring.typeMigration;
 
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiExpression;
@@ -65,7 +66,9 @@ public class TypeConversionDescriptor extends TypeConversionDescriptorBase {
     if (getExpression() != null) expression = getExpression();
     final Project project = expression.getProject();
     final ReplaceOptions options = new ReplaceOptions();
-    options.setMatchOptions(new MatchOptions());
+    final MatchOptions matchOptions = new MatchOptions();
+    matchOptions.setFileType(StdFileTypes.JAVA);
+    options.setMatchOptions(matchOptions);
     final Replacer replacer = new Replacer(project, null);
     try {
       final String replacement = replacer.testReplace(expression.getText(), getStringToReplace(), getReplaceByString(), options);
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 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 2bd3099dbf659a32ecd4a69936cef75a113fdade..3e71eb849bc51a19db39fd89735956ad233c01e5 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.
@@ -23,27 +23,52 @@ import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+/**
+ * Tracks the correspondence between {@link VirtualFile} instances and corresponding {@link Document} instances.
+ * Manages the saving of changes to disk.
+ */
 public abstract class FileDocumentManager implements SavingRequestor {
   @NotNull
   public static FileDocumentManager getInstance() {
     return ApplicationManager.getApplication().getComponent(FileDocumentManager.class);
   }
 
+  /**
+   * Returns the document for the specified virtual file.
+   * @param file the file for which the document is requested.
+   * @return the document, or null if the file represents a directory, or is binary without an associated decompiler,
+   * or is too large.
+   */
   @Nullable
   public abstract Document getDocument(@NotNull VirtualFile file);
 
+  /**
+   * Returns the document for the specified file which has already been loaded into memory.
+   *
+   * @param file the file for which the document is requested.
+   * @return the document, or null if the specified virtual file hasn't been loaded into memory.
+   */
   @Nullable
   public abstract Document getCachedDocument(@NotNull VirtualFile file);
 
+  /**
+   * Returns the virtual file corresponding to the specified document.
+   *
+   * @param document the document for which the virtual file is requested.
+   * @return the file, or null if the document wasn't created from a virtual file.
+   */
   @Nullable
   public abstract VirtualFile getFile(@NotNull Document document);
 
   /**
-   * This operation can modify documents that will be saved (due to 'Trip trailing spaces on Save' functionality).
+   * Saves all unsaved documents to disk. This operation can modify documents that will be saved
+   * (due to 'Strip trailing spaces on Save' functionality).
    */
   public abstract void saveAllDocuments();
+
   /**
-   * This operation can modify the document (due to 'Trip trailing spaces on Save' functionality).
+   * Saves the specified document to disk. This operation can modify the document (due to 'Strip
+   * trailing spaces on Save' functionality).
    */
   public abstract void saveDocument(@NotNull Document document);
 
@@ -52,12 +77,35 @@ public abstract class FileDocumentManager implements SavingRequestor {
    * @param document the document to save.
    */
   public abstract void saveDocumentAsIs(@NotNull Document document);
-  
+
+  /**
+   * Returns the ist of all documents that have unsaved changes.
+   * @return the documents that have unsaved changes.
+   */
   @NotNull
   public abstract Document[] getUnsavedDocuments();
+
+  /**
+   * Checks if the document has unsaved changes.
+   *
+   * @param document the document to check.
+   * @return true if the document has unsaved changes, false otherwise.
+   */
   public abstract boolean isDocumentUnsaved(@NotNull Document document);
+
+  /**
+   * Checks if the document corresponding to the specified file has unsaved changes.
+   *
+   * @param file the file to check.
+   * @return true if the file has unsaved changes, false otherwise.
+   */
   public abstract boolean isFileModified(@NotNull VirtualFile file);
 
+  /**
+   * Discards unsaved changes for the specified document and reloads it from disk.
+   *
+   * @param document the document to reload.
+   */
   public abstract void reloadFromDisk(@NotNull Document document);
 
   @NotNull
@@ -77,5 +125,10 @@ public abstract class FileDocumentManager implements SavingRequestor {
     return getInstance().requestWriting(document, project);
   }
 
+  /**
+   * Discards unsaved changes for the specified files.
+   *
+   * @param files the files to discard the changes for.
+   */
   public abstract void reloadFiles(@NotNull VirtualFile... files);
 }
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.
index d05b11e47de18662c8f9dcee4bda9475f204d78f..36299685bc513655044c5e7a33d58ecc933de416 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.
@@ -29,6 +29,13 @@ import java.util.EventListener;
  * Manages the relationship between documents and PSI trees.
  */
 public abstract class PsiDocumentManager {
+  /**
+   * Checks if the PSI tree for the specified document is up to date (its state reflects the latest changes made
+   * to the document content).
+   *
+   * @param document the document to check.
+   * @return true if the PSI tree for the document is up to date, false otherwise.
+   */
   public abstract boolean isCommitted(@NotNull Document document);
 
   /**
@@ -206,8 +213,22 @@ public abstract class PsiDocumentManager {
    */
   public abstract void removeListener(@NotNull Listener listener);
 
+  /**
+   * Checks if the PSI tree corresponding to the specified document has been modified and the changes have not
+   * yet been applied to the document. Documents in that state cannot be modified directly, because such changes
+   * would conflict with the pending PSI changes. Changes made through PSI are always applied in the end of a write action,
+   * and can be applied in the middle of a write action by calling {@link #doPostponedOperationsAndUnblockDocument}.
+   *
+   * @param doc the document to check.
+   * @return true if the corresponding PSI has changes that haven't been applied to the document.
+   */
   public abstract boolean isDocumentBlockedByPsi(@NotNull Document doc);
 
+  /**
+   * Applies pending changes made through the PSI to the specified document.
+   *
+   * @param doc the document to apply the changes to.
+   */
   public abstract void doPostponedOperationsAndUnblockDocument(@NotNull Document doc);
 
   /**
index 4a4cf92c965e5cc0eafeceaca0ddbc036fa8c258..3f052ae59243a3f2e6dc29975c6ce40d7debb560 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 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.
@@ -19,7 +19,6 @@ import com.intellij.lang.FileASTNode;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * A PSI element representing a file.
@@ -101,5 +100,9 @@ public interface PsiFile extends PsiFileSystemItem {
   @Override
   FileASTNode getNode();
 
+  /**
+   * Called by the PSI framework when the contents of the file changes. Can be used to invalidate
+   * file-level caches. If you override this method, you <b>must</b> call the base class implementation.
+   */
   void subtreeChanged();
 }
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 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 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 {
index 542ce0779bc40c39d0a46a04b58a92148ea82856..a3fe98a865a499d6f19954bef397812ccace12fb 100644 (file)
@@ -37,6 +37,6 @@ public class BinaryDiffTool implements FrameDiffTool {
   @NotNull
   @Override
   public String getName() {
-    return "Binary File Viewer";
+    return "Binary file viewer";
   }
 }
index 98786884cb1d0c7b65219bec1d435dfa9d34be76..b362604c5f96df33795d6e7feed46989814e579f 100644 (file)
@@ -23,17 +23,21 @@ import com.intellij.diff.contents.EmptyContent;
 import com.intellij.diff.contents.FileContent;
 import com.intellij.diff.requests.ContentDiffRequest;
 import com.intellij.diff.requests.DiffRequest;
+import com.intellij.ide.DataManager;
 import com.intellij.ide.diff.DiffElement;
 import com.intellij.ide.diff.DirDiffSettings;
 import com.intellij.ide.diff.JarFileDiffElement;
 import com.intellij.ide.diff.VirtualFileDiffElement;
 import com.intellij.ide.highlighter.ArchiveFileType;
 import com.intellij.openapi.Disposable;
+import com.intellij.openapi.actionSystem.DataProvider;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.diff.impl.dir.DirDiffFrame;
 import com.intellij.openapi.diff.impl.dir.DirDiffPanel;
 import com.intellij.openapi.diff.impl.dir.DirDiffTableModel;
 import com.intellij.openapi.diff.impl.dir.DirDiffWindow;
 import com.intellij.openapi.util.Disposer;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -46,7 +50,8 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
   @NotNull private final DiffContext myContext;
   @NotNull private final ContentDiffRequest myRequest;
 
-  @NotNull private final DirDiffPanel myPanel;
+  @NotNull private final DirDiffPanel myDirDiffPanel;
+  @NotNull private final JPanel myPanel;
 
   public DifDiffViewer(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
     myContext = context;
@@ -57,7 +62,7 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
     DiffElement element2 = createDiffElement(contents.get(1));
     DirDiffTableModel model = new DirDiffTableModel(context.getProject(), element1, element2, new DirDiffSettings());
 
-    myPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
+    myDirDiffPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
       @Override
       public Window getWindow() {
         return null;
@@ -72,31 +77,43 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
       public void setTitle(String title) {
       }
     });
+
+    myPanel = new JPanel(new BorderLayout());
+    myPanel.add(myDirDiffPanel.getPanel(), BorderLayout.CENTER);
+    DataManager.registerDataProvider(myPanel, new DataProvider() {
+      @Override
+      public Object getData(@NonNls String dataId) {
+        if (PlatformDataKeys.HELP_ID.is(dataId)) {
+          return "reference.dialogs.diff.folder";
+        }
+        return null;
+      }
+    });
   }
 
   @NotNull
   @Override
   public FrameDiffTool.ToolbarComponents init() {
-    myPanel.setupSplitter();
+    myDirDiffPanel.setupSplitter();
 
     return new FrameDiffTool.ToolbarComponents();
   }
 
   @Override
   public void dispose() {
-    Disposer.dispose(myPanel);
+    Disposer.dispose(myDirDiffPanel);
   }
 
   @NotNull
   @Override
   public JComponent getComponent() {
-    return myPanel.getPanel();
+    return myPanel;
   }
 
   @Nullable
   @Override
   public JComponent getPreferredFocusedComponent() {
-    return myPanel.getTable();
+    return myDirDiffPanel.getTable();
   }
 
   //
index 4bdf3d29256f8dfccda1e12646d4062924c280b5..8e52612567078487b0a9ea6e50df915617fcffa1 100644 (file)
@@ -38,6 +38,6 @@ public class DirDiffTool implements FrameDiffTool {
   @NotNull
   @Override
   public String getName() {
-    return "Directory Viewer";
+    return "Directory viewer";
   }
 }
index b94dbefc2b54bd1d5eb8779c032d54d0133c5058..881099ae5f91f2554b3119331db206b1fb6d914e 100644 (file)
@@ -37,6 +37,6 @@ public class OnesideDiffTool implements FrameDiffTool {
   @NotNull
   @Override
   public String getName() {
-    return "Oneside Viewer";
+    return "Oneside viewer";
   }
 }
index 8e450792cb301f123d76d160c86e5d529730257b..00ad0ec846e3677bf5b03310aa73075fc0be4000 100644 (file)
@@ -38,6 +38,6 @@ public class SimpleDiffTool implements FrameDiffTool {
   @NotNull
   @Override
   public String getName() {
-    return "Default Viewer";
+    return "Default viewer";
   }
 }
index 69938f66fdadd3f26e9acfcad7195b3a74de3ec0..919832f9338642b93d36f0402e3d908757570e26 100644 (file)
@@ -18,10 +18,10 @@ package com.intellij.diff.tools.util.base;
 import org.jetbrains.annotations.NotNull;
 
 public enum HighlightPolicy {
-  DO_NOT_HIGHLIGHT("Do Not Highlight"),
-  BY_LINE("By Line"),
-  BY_WORD("By Word"),
-  BY_WORD_SPLIT("By Word In Chunks");
+  DO_NOT_HIGHLIGHT("Do not highlight"),
+  BY_LINE("Highlight words"),
+  BY_WORD("Highlight lines"),
+  BY_WORD_SPLIT("Highlight split changes");
 
   @NotNull private final String myText;
 
index a2317b3489ede253cb88c3e975682fd120fe237e..8c38a2af350c3c32b968b6259fd74f92d2aa25c7 100644 (file)
@@ -19,10 +19,10 @@ import com.intellij.diff.comparison.ComparisonPolicy;
 import org.jetbrains.annotations.NotNull;
 
 public enum IgnorePolicy {
-  DEFAULT("Do Not Ignore"),
-  TRIM_WHITESPACES("Trim Whitespaces"),
-  IGNORE_WHITESPACES("Ignore Whitespaces"),
-  IGNORE_WHITESPACES_CHUNKS("Ignore Whitespaces And Empty Lines");
+  DEFAULT("Do not ignore"),
+  TRIM_WHITESPACES("Trim whitespaces"),
+  IGNORE_WHITESPACES("Ignore whitespaces"),
+  IGNORE_WHITESPACES_CHUNKS("Ignore whitespaces and empty lines");
 
   @NotNull private final String myText;
 
index a583068b26689408298347c023ab7eac4cae201a..f73a10053abead1f399e35953a4f38bf68c01121 100644 (file)
@@ -31,15 +31,15 @@ import java.util.Map;
 
 @State(
   name = "TextDiffSettings",
-  storages = {@Storage(
-    file = DiffUtil.DIFF_CONFIG)})
+  storages = @Storage(file = DiffUtil.DIFF_CONFIG)
+)
 public class TextDiffSettingsHolder implements PersistentStateComponent<TextDiffSettingsHolder.State> {
   public static final Key<TextDiffSettings> KEY = Key.create("TextDiffSettings");
 
   public static final int[] CONTEXT_RANGE_MODES = {1, 2, 4, 8, -1};
   public static final String[] CONTEXT_RANGE_MODE_LABELS = {"1", "2", "4", "8", "Disable"};
 
-  private static class SharedSettings {
+  private final static class SharedSettings {
     // Fragments settings
     public int CONTEXT_RANGE = 4;
   }
index 9f10311f68d3d558294c1c8ba97506447145cb3c..a3e6cdab3d03c56d56fe5082e6f62f43f405e153 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 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.
@@ -16,7 +16,6 @@
 package com.intellij.dvcs;
 
 import com.intellij.ide.SaveAndSyncHandler;
-import com.intellij.ide.SaveAndSyncHandlerImpl;
 import com.intellij.ide.plugins.IdeaPluginDescriptor;
 import com.intellij.ide.plugins.PluginManager;
 import com.intellij.openapi.application.ApplicationManager;
@@ -133,7 +132,7 @@ public abstract class DvcsPlatformFacadeImpl implements DvcsPlatformFacade {
   @NotNull
   @Override
   public SaveAndSyncHandler getSaveAndSyncHandler() {
-    return SaveAndSyncHandlerImpl.getInstance();
+    return SaveAndSyncHandler.getInstance();
   }
 
   @Override
index 055fbc8ca6d73792f82c5ffc1616b0f9bbd043cf..d2f9b41fde605bb7b22eb5b613c66566f25bea31 100644 (file)
@@ -184,7 +184,7 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
 
   public static class FontFilter implements SerializationFilter {
     @Override
-    public boolean accepts(@NotNull Accessor accessor, Object bean) {
+    public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
       UISettings settings = (UISettings)bean;
       return !hasDefaultFontSetting(settings);
     }
index f1daae220d8540b2fc7d1454990f41efa6818084..91f363684185cb6f11f78b0a5acee647cf14c1a4 100644 (file)
@@ -40,12 +40,23 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
 
   @NotNull private S myInitialSettings;
 
+  @Nullable
   private JBCheckBox myUseAutoImportBox;
+  @Nullable
   private JBCheckBox myCreateEmptyContentRootDirectoriesBox;
-  private boolean myHideUseAutoImportBox;
+  @NotNull
+  private ExternalSystemSettingsControlCustomizer myCustomizer;
 
   protected AbstractExternalProjectSettingsControl(@NotNull S initialSettings) {
+    this(null, initialSettings, null);
+  }
+
+  protected AbstractExternalProjectSettingsControl(@Nullable Project project,
+                                                   @NotNull S initialSettings,
+                                                   @Nullable ExternalSystemSettingsControlCustomizer controlCustomizer) {
+    myProject = project;
     myInitialSettings = initialSettings;
+    myCustomizer = controlCustomizer == null ? new ExternalSystemSettingsControlCustomizer() : controlCustomizer;
   }
 
   @NotNull
@@ -53,27 +64,31 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
     return myInitialSettings;
   }
 
-  public void hideUseAutoImportBox() {
-    myHideUseAutoImportBox = true;
-  }
-
   @Override
   public void fillUi(@NotNull PaintAwarePanel canvas, int indentLevel) {
-    myUseAutoImportBox = new JBCheckBox(ExternalSystemBundle.message("settings.label.use.auto.import"));
-    myUseAutoImportBox.setVisible(!myHideUseAutoImportBox);
-    canvas.add(myUseAutoImportBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
-    myCreateEmptyContentRootDirectoriesBox =
-      new JBCheckBox(ExternalSystemBundle.message("settings.label.create.empty.content.root.directories"));
-    canvas.add(myCreateEmptyContentRootDirectoriesBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
+    if (!myCustomizer.isUseAutoImportBoxHidden()) {
+      myUseAutoImportBox = new JBCheckBox(ExternalSystemBundle.message("settings.label.use.auto.import"));
+      canvas.add(myUseAutoImportBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
+    }
+    if (!myCustomizer.isCreateEmptyContentRootDirectoriesBoxHidden()) {
+      myCreateEmptyContentRootDirectoriesBox =
+        new JBCheckBox(ExternalSystemBundle.message("settings.label.create.empty.content.root.directories"));
+      canvas.add(myCreateEmptyContentRootDirectoriesBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
+    }
     fillExtraControls(canvas, indentLevel); 
   }
   
   protected abstract void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel);
 
   public boolean isModified() {
-    return myUseAutoImportBox.isSelected() != getInitialSettings().isUseAutoImport()
-           || myCreateEmptyContentRootDirectoriesBox.isSelected() != getInitialSettings().isCreateEmptyContentRootDirectories()
-           || isExtraSettingModified();
+    boolean result = false;
+    if (!myCustomizer.isUseAutoImportBoxHidden() && myUseAutoImportBox != null) {
+      result = myUseAutoImportBox.isSelected() != getInitialSettings().isUseAutoImport();
+    }
+    if (!myCustomizer.isCreateEmptyContentRootDirectoriesBoxHidden() && myCreateEmptyContentRootDirectoriesBox != null) {
+      result = result || myCreateEmptyContentRootDirectoriesBox.isSelected() != getInitialSettings().isCreateEmptyContentRootDirectories();
+    }
+    return result || isExtraSettingModified();
   }
 
   protected abstract boolean isExtraSettingModified();
@@ -83,8 +98,12 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
   }
 
   public void reset(boolean isDefaultModuleCreation) {
-    myUseAutoImportBox.setSelected(getInitialSettings().isUseAutoImport());
-    myCreateEmptyContentRootDirectoriesBox.setSelected(getInitialSettings().isCreateEmptyContentRootDirectories());
+    if (!myCustomizer.isUseAutoImportBoxHidden() && myUseAutoImportBox != null) {
+      myUseAutoImportBox.setSelected(getInitialSettings().isUseAutoImport());
+    }
+    if (!myCustomizer.isCreateEmptyContentRootDirectoriesBoxHidden() && myCreateEmptyContentRootDirectoriesBox != null) {
+      myCreateEmptyContentRootDirectoriesBox.setSelected(getInitialSettings().isCreateEmptyContentRootDirectories());
+    }
     resetExtraSettings(isDefaultModuleCreation);
   }
 
@@ -92,8 +111,13 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
 
   @Override
   public void apply(@NotNull S settings) {
-    settings.setUseAutoImport(myUseAutoImportBox.isSelected());
-    settings.setCreateEmptyContentRootDirectories(myCreateEmptyContentRootDirectoriesBox.isSelected());
+    if (!myCustomizer.isUseAutoImportBoxHidden() && myUseAutoImportBox != null) {
+      settings.setUseAutoImport(myUseAutoImportBox.isSelected());
+    }
+
+    if (!myCustomizer.isCreateEmptyContentRootDirectoriesBoxHidden() && myCreateEmptyContentRootDirectoriesBox != null) {
+      settings.setCreateEmptyContentRootDirectories(myCreateEmptyContentRootDirectoriesBox.isSelected());
+    }
     if (myInitialSettings.getExternalProjectPath() != null) {
       settings.setExternalProjectPath(myInitialSettings.getExternalProjectPath());
     }
@@ -112,8 +136,13 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
   }
 
   public void updateInitialSettings() {
-    myInitialSettings.setUseAutoImport(myUseAutoImportBox.isSelected());
-    myInitialSettings.setCreateEmptyContentRootDirectories(myCreateEmptyContentRootDirectoriesBox.isSelected());
+    if (!myCustomizer.isUseAutoImportBoxHidden() && myUseAutoImportBox != null) {
+      myInitialSettings.setUseAutoImport(myUseAutoImportBox.isSelected());
+    }
+
+    if (!myCustomizer.isCreateEmptyContentRootDirectoriesBoxHidden() && myCreateEmptyContentRootDirectoriesBox != null) {
+      myInitialSettings.setCreateEmptyContentRootDirectories(myCreateEmptyContentRootDirectoriesBox.isSelected());
+    }
     updateInitialExtraSettings();
   }
 
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/settings/ExternalSystemSettingsControlCustomizer.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/settings/ExternalSystemSettingsControlCustomizer.java
new file mode 100644 (file)
index 0000000..4291f99
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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.externalSystem.service.settings;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 2/24/2015
+ */
+public class ExternalSystemSettingsControlCustomizer {
+
+  private boolean hideUseAutoImportBox;
+  private boolean hideCreateEmptyContentRootDirectoriesBox;
+
+  public ExternalSystemSettingsControlCustomizer() {
+  }
+
+  public ExternalSystemSettingsControlCustomizer(boolean hideUseAutoImportBox, boolean hideCreateEmptyContentRootDirectoriesBox) {
+    this.hideUseAutoImportBox = hideUseAutoImportBox;
+    this.hideCreateEmptyContentRootDirectoriesBox = hideCreateEmptyContentRootDirectoriesBox;
+  }
+
+  public boolean isUseAutoImportBoxHidden() {
+    return hideUseAutoImportBox;
+  }
+
+  public boolean isCreateEmptyContentRootDirectoriesBoxHidden() {
+    return hideCreateEmptyContentRootDirectoriesBox;
+  }
+}
index 34d9e0b0b75a4149b759f3c9ab60fbe5c9812f35..4a1d89817cfd2f9b1993dbd37854d50851f8bfeb 100644 (file)
@@ -92,6 +92,7 @@ public class ExternalSystemJdkComboBox extends ComboBoxWithWidePopup {
     myProject = project;
   }
 
+  @NotNull
   public ExternalSystemJdkComboBox withoutJre() {
     suggestJre = false;
     return this;
index e8fd2235d370848ff09fa8b038f57cc5f43dc5cc..0ee2cd2e5e4618b9b88c1ae8d3f62f9cab4d091b 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.
@@ -20,6 +20,7 @@ import com.intellij.CommonBundle;
 import com.intellij.ide.BrowserUtil;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.Extensions;
@@ -130,32 +131,39 @@ class ExportToHTMLManager {
     }
   }
 
-  private static boolean exportPsiFile(final PsiFile psiFile, String outputDirectoryName, Project project, HashMap<PsiFile, PsiFile> filesMap) {
-    ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(project);
+  private static boolean exportPsiFile(final PsiFile psiFile,
+                                       final String outputDirectoryName,
+                                       final Project project,
+                                       final HashMap<PsiFile, PsiFile> filesMap) {
+    final ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(project);
 
     if (psiFile instanceof PsiBinaryFile) {
       return true;
     }
 
-    TreeMap<Integer, PsiReference> refMap = null;
-    for (PrintOption printOption : Extensions.getExtensions(PrintOption.EP_NAME)) {
-      final TreeMap<Integer, PsiReference> map = printOption.collectReferences(psiFile, filesMap);
-      if (map != null) {
-        refMap = new TreeMap<Integer, PsiReference>();
-        refMap.putAll(map);
-      }
-    }
+    ApplicationManager.getApplication().runReadAction(new Runnable() {
+      @Override
+      public void run() {
+        TreeMap<Integer, PsiReference> refMap = null;
+        for (PrintOption printOption : Extensions.getExtensions(PrintOption.EP_NAME)) {
+          final TreeMap<Integer, PsiReference> map = printOption.collectReferences(psiFile, filesMap);
+          if (map != null) {
+            refMap = new TreeMap<Integer, PsiReference>();
+            refMap.putAll(map);
+          }
+        }
 
-    String dirName = constructOutputDirectory(psiFile, outputDirectoryName);
-    HTMLTextPainter textPainter = new HTMLTextPainter(psiFile, project, dirName, exportToHTMLSettings.PRINT_LINE_NUMBERS);
-    try {
-      textPainter.paint(refMap, psiFile.getFileType());
-    }
-    catch (FileNotFoundException e) {
-      myLastException = e;
-      return false;
-    }
-    return true;
+        String dirName = constructOutputDirectory(psiFile, outputDirectoryName);
+        HTMLTextPainter textPainter = new HTMLTextPainter(psiFile, project, dirName, exportToHTMLSettings.PRINT_LINE_NUMBERS);
+        try {
+          textPainter.paint(refMap, psiFile.getFileType());
+        }
+        catch (FileNotFoundException e) {
+          myLastException = e;
+        }
+      }
+    });
+    return myLastException == null;
   }
 
   private static String constructOutputDirectory(PsiFile psiFile, String outputDirectoryName) {
@@ -241,11 +249,18 @@ class ExportToHTMLManager {
       final ArrayList<PsiFile> filesList = new ArrayList<PsiFile>();
       final boolean isRecursive = myExportToHTMLSettings.isIncludeSubdirectories();
 
-      try {
-        addToPsiFileList(myPsiDirectory, filesList, isRecursive, myOutputDirectoryName);
-      }
-      catch (FileNotFoundException e) {
-        myLastException = e;
+      ApplicationManager.getApplication().runReadAction(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            addToPsiFileList(myPsiDirectory, filesList, isRecursive, myOutputDirectoryName);
+          }
+          catch (FileNotFoundException e) {
+            myLastException = e;
+          }
+        }
+      });
+      if (myLastException != null) {
         return;
       }
       HashMap<PsiFile, PsiFile> filesMap = new HashMap<PsiFile, PsiFile>();
index 1a1d7b0a43c14aa19e3928a7408151d180076379..31ec50c83606c0a41c849930e4b8f03618f31e83 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.
 package com.intellij.codeEditor.printing;
 
 import com.intellij.codeInsight.daemon.LineMarkerInfo;
-import com.intellij.openapi.components.ServiceManager;
+import com.intellij.codeInsight.daemon.impl.LineMarkersPass;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 public class FileSeparatorProvider {
-  public static FileSeparatorProvider getInstance() {
-    return ServiceManager.getService(FileSeparatorProvider.class);
-  }
-
   @Nullable
-  public List<LineMarkerInfo> getFileSeparators(PsiFile file, final Document document, @Nullable final Editor editor) {
-    return null;
+  public static List<LineMarkerInfo> getFileSeparators(PsiFile file, final Document document) {
+    final List<LineMarkerInfo> result = new ArrayList<LineMarkerInfo>();
+    LineMarkersPass pass = new LineMarkersPass(file.getProject(), file, null, document, file.getTextRange());
+    for (LineMarkerInfo lineMarkerInfo : pass.queryLineMarkers()) {
+      if (lineMarkerInfo.separatorColor != null) {
+        result.add(lineMarkerInfo);
+      }
+    }
+
+    Collections.sort(result, new Comparator<LineMarkerInfo>() {
+      public int compare(final LineMarkerInfo i1, final LineMarkerInfo i2) {
+        return i1.startOffset - i2.startOffset;
+      }
+    });
+    return result;
   }
 }
\ No newline at end of file
index 22e365cc5a4f95e60b545a264344525183e5f94f..ccb474bcadcf821c044a72762396da7f3c9320d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 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.
@@ -35,7 +35,6 @@ import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiReference;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.impl.file.PsiDirectoryFactory;
-import com.intellij.psi.util.PsiUtilBase;
 import com.intellij.ui.JBColor;
 import org.jetbrains.annotations.NonNls;
 
@@ -86,8 +85,7 @@ class HTMLTextPainter {
 
     ArrayList<LineMarkerInfo> methodSeparators = new ArrayList<LineMarkerInfo>();
     if (document != null) {
-      final List<LineMarkerInfo> separators = FileSeparatorProvider.getInstance().getFileSeparators(psiFile, document,
-                                                                                                    PsiUtilBase.findEditor(psiFile));
+      final List<LineMarkerInfo> separators = FileSeparatorProvider.getFileSeparators(psiFile, document);
       if (separators != null) {
         methodSeparators.addAll(separators);
       }
index 7c84f5e637aad37309be99caf68ebd26ee5f4dd0..801bfdc5f8197ff0bf98e6be6cce449cb52b8fa4 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.
@@ -100,7 +100,7 @@ class TextPainter extends BasePainter {
                      FileType fileType,
                      Editor editor) {
     this(editorDocument, highlighter, fullFileName, shortFileName, psiFile.getProject(), fileType,
-         FileSeparatorProvider.getInstance().getFileSeparators(psiFile, editorDocument, editor));
+         FileSeparatorProvider.getFileSeparators(psiFile, editorDocument));
   }
 
   public TextPainter(@NotNull DocumentEx editorDocument,
index b6e07f4c8a5b5575cec1b006f336f1834f179a31..3c6a16512e869339d6e51f2b345f538c1aff4ea0 100644 (file)
           <text value="Scope:"/>
         </properties>
       </component>
-      <component id="1fda7" class="javax.swing.JLabel">
+      <component id="1fda7" class="javax.swing.JLabel" binding="myOptionalLabel">
         <constraints>
           <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
index 6dc2971b800cdb0fc58226e805cc58e986803ac6..cd0a9c0890f2a901022302f3c185d524908953fa 100644 (file)
@@ -51,6 +51,7 @@ public class LayoutCodeDialog extends DialogWrapper {
 
   private JPanel myActionsPanel;
   private JPanel myScopePanel;
+  private JLabel myOptionalLabel;
 
   private LayoutCodeOptions myRunOptions;
 
@@ -127,6 +128,8 @@ public class LayoutCodeDialog extends DialogWrapper {
     if (canRearrangeCode) {
       myRearrangeCodeCb.setSelected(myLastRunOptions.isRearrangeCode(myFile.getLanguage()));
     }
+
+    myOptionalLabel.setVisible(canOptimizeImports || canRearrangeCode);
   }
 
   @Nullable
index d4889a97f8020196ad54d890771d309587fdbe16..0334f18b093141a9514ff3577951fbe9d1231d7a 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.
@@ -24,13 +24,13 @@ import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProfileManagerImpl;
-import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
+import com.intellij.util.xmlb.SkipDefaultsSerializationFilter;
 import com.intellij.util.xmlb.XmlSerializer;
 import org.jdom.Element;
 
 @State(
   name = "DaemonCodeAnalyzerSettings",
-  storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml")}
+  storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml")
 )
 public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings implements PersistentStateComponent<Element>, Cloneable {
   @Override
@@ -42,7 +42,7 @@ public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings i
   public DaemonCodeAnalyzerSettingsImpl clone() {
     DaemonCodeAnalyzerSettingsImpl settings = new DaemonCodeAnalyzerSettingsImpl();
     settings.AUTOREPARSE_DELAY = AUTOREPARSE_DELAY;
-    settings.SHOW_ADD_IMPORT_HINTS = SHOW_ADD_IMPORT_HINTS;
+    settings.myShowAddImportHints = myShowAddImportHints;
     settings.SHOW_METHOD_SEPARATORS = SHOW_METHOD_SEPARATORS;
     settings.NO_AUTO_IMPORT_PATTERN = NO_AUTO_IMPORT_PATTERN;
     settings.SHOW_SMALL_ICONS_IN_GUTTER = SHOW_SMALL_ICONS_IN_GUTTER;
@@ -51,7 +51,7 @@ public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings i
 
   @Override
   public Element getState() {
-    Element element = XmlSerializer.serialize(this, new SkipDefaultValuesSerializationFilters());
+    Element element = XmlSerializer.serialize(this, new SkipDefaultsSerializationFilter());
     String profile = InspectionProfileManager.getInstance().getRootProfile().getName();
     if (!"Default".equals(profile)) {
       element.setAttribute("profile", profile);
index 6ae363f52f7e3386495e8409e77a0ac17c58ae9d..e67c63bb7a50d54114be12121c967f31b0a4fed9 100644 (file)
@@ -109,7 +109,7 @@ public class LineMarkersPass extends TextEditorHighlightingPass implements LineM
     myMarkers = mergeLineMarkers(lineMarkers, myEditor);
   }
 
-  static List<LineMarkerInfo> mergeLineMarkers(@NotNull List<LineMarkerInfo> markers, Editor editor) {
+  static List<LineMarkerInfo> mergeLineMarkers(@NotNull List<LineMarkerInfo> markers, @Nullable Editor editor) {
     List<MergeableLineMarkerInfo> forMerge = new ArrayList<MergeableLineMarkerInfo>();
     final Iterator<LineMarkerInfo> iterator = markers.iterator();
     while (iterator.hasNext()) {
index da055a4d1044dd86d3776eb401756d586773c549..9020b07c22c97faa7752b3178749a80fe8af2cd7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.LogicalPosition;
 import com.intellij.openapi.editor.RangeMarker;
+import com.intellij.openapi.editor.actions.EditorActionUtil;
 import com.intellij.openapi.editor.markup.GutterIconRenderer;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.progress.ProgressIndicator;
@@ -78,7 +79,8 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass {
 
   @NotNull
   public static List<HighlightInfo.IntentionActionDescriptor> getAvailableActions(@NotNull final Editor editor, @NotNull final PsiFile file, final int passId) {
-    final int offset = editor.getCaretModel().getOffset();
+    final Integer expectedCaretOffset = editor.getUserData(EditorActionUtil.EXPECTED_CARET_OFFSET);
+    final int offset = expectedCaretOffset != null ? expectedCaretOffset : editor.getCaretModel().getOffset();
     final Project project = file.getProject();
 
     final List<HighlightInfo.IntentionActionDescriptor> result = new ArrayList<HighlightInfo.IntentionActionDescriptor>();
index b6f951efb8650026d7a04ac6bd66bb9b9564aa61..449f0865f79378e8405e392e208dbb45ae598fcd 100644 (file)
@@ -356,7 +356,7 @@ public class EnterHandler extends BaseEnterHandler {
                   commentContext.docStart = false;
                 }
                 else {
-                  commentContext.docAsterisk = true;
+                  commentContext.docAsterisk = CodeStyleSettingsManager.getSettings(getProject()).JD_LEADING_ASTERISKS_ARE_ENABLED;
                   commentContext.docStart = false;
                 }
               }
index c7c05dc68d74148e36837785fbf9da5ea5711f32..3f644c04fd3954947aac243d4142efdf78ba54b9 100644 (file)
@@ -452,12 +452,10 @@ public class TemplateSettings implements PersistentStateComponent<TemplateSettin
     }
   }
 
-  private void readDefTemplate(DefaultLiveTemplatesProvider provider, String defTemplate, boolean registerTemplate)
-    throws JDOMException, InvalidDataException, IOException {
-    String templateName = getDefaultTemplateName(defTemplate);
+  private void readDefTemplate(DefaultLiveTemplatesProvider provider, String defTemplate, boolean registerTemplate) throws JDOMException, InvalidDataException, IOException {
     InputStream inputStream = DecodeDefaultsUtil.getDefaultsInputStream(provider, defTemplate);
     if (inputStream != null) {
-      TemplateGroup group = readTemplateFile(JDOMUtil.load(inputStream), templateName, true, registerTemplate, provider.getClass().getClassLoader());
+      TemplateGroup group = readTemplateFile(JDOMUtil.load(inputStream), getDefaultTemplateName(defTemplate), true, registerTemplate, provider.getClass().getClassLoader());
       if (group != null && group.getReplace() != null) {
         for (TemplateImpl template : myTemplates.get(group.getReplace())) {
           removeTemplate(template);
index dee3d78b4f69ff1d8351e7a1c3295f1bd5618fa2..50d3ac732482eaedaa52c29e12aa371574a32140 100644 (file)
@@ -22,62 +22,46 @@ import com.intellij.icons.AllIcons;
 import com.intellij.ide.DataManager;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.wm.IdeFrame;
 import com.intellij.ui.SizedIcon;
 import com.intellij.util.ui.EmptyIcon;
-import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import java.awt.*;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 public class RunConfigurationsComboBoxAction extends ComboBoxAction implements DumbAware {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.execution.actions.RunConfigurationAction");
-  private static final Key<ComboBoxButton> BUTTON_KEY = Key.create("COMBOBOX_BUTTON");
 
   public static final Icon CHECKED_ICON = new SizedIcon(AllIcons.Actions.Checked, 16, 16);
   public static final Icon CHECKED_SELECTED_ICON = new SizedIcon(AllIcons.Actions.Checked_selected, 16, 16);
   public static final Icon EMPTY_ICON = EmptyIcon.ICON_16;
 
   @Override
-  public void actionPerformed(final AnActionEvent e) {
-    final IdeFrame ideFrame = findFrame(e.getData(PlatformDataKeys.CONTEXT_COMPONENT));
-    final ComboBoxButton button = (ComboBoxButton)ideFrame.getComponent().getRootPane().getClientProperty(BUTTON_KEY);
+  public void actionPerformed(AnActionEvent e) {
+    ComboBoxButton button = (ComboBoxButton)e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY);
     if (button == null || !button.isShowing()) return;
     button.showPopup();
   }
 
-  private static IdeFrame findFrame(final Component component) {
-    return UIUtil.getParentOfType(IdeFrame.class, component);
-  }
-
   @Override
-  public void update(final AnActionEvent e) {
-    final Presentation presentation = e.getPresentation();
-    final Project project = e.getData(CommonDataKeys.PROJECT);
+  public void update(AnActionEvent e) {
+    Presentation presentation = e.getPresentation();
+    ComboBoxButton button = (ComboBoxButton)presentation.getClientProperty(CUSTOM_COMPONENT_PROPERTY);
+    Project project = e.getData(CommonDataKeys.PROJECT);
     if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) {
       presentation.setDescription(ExecutionBundle.message("choose.run.configuration.action.description"));
-      presentation.setEnabled(findFrame(e.getData(PlatformDataKeys.CONTEXT_COMPONENT)) != null);
+      presentation.setEnabled(button != null);
       return;
     }
 
     try {
       if (project == null || project.isDisposed() || !project.isInitialized()) {
-        //if (ProjectManager.getInstance().getOpenProjects().length > 0) {
-        //  // do nothing if frame is not active
-        //  return;
-        //}
-
         updateButton(null, null, null, presentation);
         presentation.setEnabled(false);
       }
@@ -135,31 +119,9 @@ public class RunConfigurationsComboBoxAction extends ComboBoxAction implements D
 
   @Override
   public JComponent createCustomComponent(final Presentation presentation) {
-    final ComboBoxButton comboBoxButton = new ComboBoxButton(presentation) {
-      @Override
-      public void addNotify() {
-        super.addNotify();    //To change body of overriden methods use Options | File Templates.;
-        final IdeFrame frame = findFrame(this);
-        LOG.assertTrue(frame != null);
-        frame.getComponent().getRootPane().putClientProperty(BUTTON_KEY, this);
-      }
-
-      @Override
-      public void removeNotify() {
-        final IdeFrame frame = findFrame(this);
-        LOG.assertTrue(frame != null);
-        frame.getComponent().getRootPane().putClientProperty(BUTTON_KEY, null);
-        presentation.setIcon(null);
-        setIcon(null);
-        super.removeNotify();
-      }
-    };
-
-    final JPanel panel = new JPanel(new BorderLayout());
-    panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
-    panel.add(comboBoxButton);
-    panel.setOpaque(false);
-    return panel;
+    ComboBoxButton button = new ComboBoxButton(presentation);
+    button.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
+    return button;
   }
 
 
index 6dca47feed69e41b42f16eab99c87aab84f2665a..2777be242a4ece34f063a25858f64909ff167402 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.
@@ -31,6 +31,7 @@ import com.intellij.execution.runners.ProgramRunner;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.execution.ui.RunContentManager;
 import com.intellij.execution.ui.RunContentManagerImpl;
+import com.intellij.ide.SaveAndSyncHandler;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
@@ -45,7 +46,6 @@ import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.Trinity;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.ui.docking.DockManager;
 import com.intellij.util.Alarm;
 import com.intellij.util.SmartList;
@@ -548,7 +548,8 @@ public class ExecutionManagerImpl extends ExecutionManager implements Disposable
       if (myProject.isDisposed()) return;
 
       myProject.getMessageBus().syncPublisher(EXECUTION_TOPIC).processTerminated(myProfile, myProcessHandler);
-      VirtualFileManager.getInstance().asyncRefresh(null);
+
+      SaveAndSyncHandler.getInstance().scheduleRefresh();
     }
 
     @Override
index a2eaae64f8517b9c62afb1e141afcfb384222a81..342c1ea329cfac4e1b98903320a8a88a70cb36e8 100644 (file)
@@ -1055,8 +1055,6 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
 
     window.validate();
     window.repaint();
-    table.revalidate();
-    table.repaint();
   }
 
   private static Rectangle fitToScreen(@NotNull Dimension newDim, @NotNull RelativePoint popupPosition, JTable table) {
index 93e88a25e0fa675b062c424161ad217b1953d92d..973be2bc7416137dc1e152fa53a0900eb72c6f7e 100644 (file)
@@ -267,7 +267,7 @@ class FindInProjectTask {
 
   @NotNull
   private Collection<VirtualFile> collectFilesInScope(@NotNull final Set<VirtualFile> alreadySearched, final boolean skipIndexed) {
-    SearchScope customScope = myFindModel.getCustomScope();
+    SearchScope customScope = myFindModel.isCustomScope() ? myFindModel.getCustomScope() : null;
     final GlobalSearchScope globalCustomScope = toGlobal(customScope);
 
     final ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(myProject);
@@ -432,17 +432,7 @@ class FindInProjectTask {
       return Collections.emptySet();
     }
 
-    SearchScope customScope = myFindModel.getCustomScope();
-    GlobalSearchScope scope = myPsiDirectory != null
-                              ? GlobalSearchScopesCore.directoryScope(myPsiDirectory, myFindModel.isWithSubdirectories())
-                              : myModule != null
-                                ? myModule.getModuleContentScope()
-                                : customScope instanceof GlobalSearchScope
-                                  ? (GlobalSearchScope)customScope
-                                  : toGlobal(customScope);
-    if (scope == null) {
-      scope = ProjectScope.getContentScope(myProject);
-    }
+    GlobalSearchScope scope = toGlobal(FindInProjectUtil.getScopeFromModel(myProject, myFindModel));
 
     final Set<VirtualFile> resultFiles = new LinkedHashSet<VirtualFile>();
 
index 17ca7e4436bf2f1332a9991bbbadc83c91f7df70..d22071e66b8eb510977153fc220dd1ca73c49da8 100644 (file)
@@ -49,10 +49,7 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
 import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.GlobalSearchScopesCore;
-import com.intellij.psi.search.LocalSearchScope;
-import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.*;
 import com.intellij.ui.content.Content;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.usageView.UsageViewManager;
@@ -443,7 +440,7 @@ public class FindInProjectUtil {
   }
 
   @NotNull
-  private static SearchScope getScopeFromModel(@NotNull Project project, @NotNull FindModel findModel) {
+  static SearchScope getScopeFromModel(@NotNull Project project, @NotNull FindModel findModel) {
     SearchScope customScope = findModel.getCustomScope();
     PsiDirectory psiDir = getPsiDirectory(findModel, project);
     VirtualFile directory = psiDir == null ? null : psiDir.getVirtualFile();
@@ -452,8 +449,8 @@ public class FindInProjectUtil {
            // we don't have to check for myProjectFileIndex.isExcluded(file) here like FindInProjectTask.collectFilesInScope() does
            // because all found usages are guaranteed to be not in excluded dir
            directory != null ? GlobalSearchScopesCore.directoryScope(project, directory, findModel.isWithSubdirectories()) :
-           module != null ? GlobalSearchScope.moduleScope(module) :
-           findModel.isProjectScope() ? GlobalSearchScope.projectScope(project) :
+           module != null ? module.getModuleContentScope() :
+           findModel.isProjectScope() ? ProjectScope.getContentScope(project) :
            GlobalSearchScope.allScope(project);
   }
 }
index bed9f0267e4fd9fb10fb111498c0a0c49dd92fc1..cabb8f3f249444ba43e8f2a830d692bf1fca2ccf 100644 (file)
@@ -308,6 +308,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
     if (mySearchResults.getMatchesCount() >= mySearchResults.getMatchesLimit())
       return;
     for (FindResult range : mySearchResults.getOccurrences()) {
+      if (range.getEndOffset() > mySearchResults.getEditor().getDocument().getTextLength()) continue;
       TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
       if (range.getLength() == 0) {
         attributes = attributes.clone();
index 5a76d4bd52c795e29f0f09c5e37f4e46158a81ad..46521faff6c51fd24464969ef0c0dcd4540d069b 100644 (file)
@@ -99,8 +99,8 @@ public class TemplateKindCombo extends ComboboxWithBrowseButton {
   }
 
   private void scrollBy(int delta) {
-    if (delta == 0) return;
     final int size = getComboBox().getModel().getSize();
+    if (delta == 0 || size == 0) return;
     int next = getComboBox().getSelectedIndex() + delta;
     if (next < 0 || next >= size) {
       if (!UISettings.getInstance().CYCLE_SCROLLING) {
index fef6554ca238c2084569d333244707fc8bfe15d5..46075f81f4ae934da91515c47278de853bf189ac 100644 (file)
@@ -29,7 +29,11 @@ public abstract class ScratchFileService {
   public enum Option { existing_only, create_if_missing, create_new_always }
 
   public static ScratchFileService getInstance() {
-    return ServiceManager.getService(ScratchFileService.class);
+    return ServiceHolder.instance;
+  }
+
+  private static class ServiceHolder {
+    static final ScratchFileService instance = ServiceManager.getService(ScratchFileService.class);
   }
 
   @NotNull