Merge remote-tracking branch 'origin/master' into amakeev/gradle
authorAnton Makeev <Anton.Makeev@jetbrains.com>
Fri, 10 May 2019 14:19:25 +0000 (16:19 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Fri, 17 May 2019 16:10:16 +0000 (19:10 +0300)
GitOrigin-RevId: dde010049a2a7ec2d336249fe52a49b17156f4a3

330 files changed:
.idea/libraries/ion.xml [new file with mode: 0644]
.idea/modules.xml
aether-dependency-resolver/src/org/jetbrains/idea/maven/aether/ArtifactRepositoryManager.java
community-resources/src/idea_community_about.png
community-resources/src/idea_community_about@2x.png
community-resources/src/idea_community_logo.png
community-resources/src/idea_community_logo@2x.png
java/debugger/impl/src/com/intellij/debugger/memory/ui/ExpressionEditorWithHistory.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java
java/java-analysis-api/intellij.java.analysis.iml
java/java-impl/src/META-INF/JavaPlugin.xml
java/java-impl/src/com/intellij/codeInsight/AnnotationLineMarkerProviders.kt [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
java/java-impl/src/com/intellij/codeInsight/MakeExternalAnnotationExplicit.java
java/java-impl/src/com/intellij/codeInsight/NonCodeAnnotationsLineMarkerProvider.java [moved from java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java with 89% similarity]
java/java-impl/src/com/intellij/codeInsight/ToggleSourceInferredAnnotations.java [deleted file]
java/java-impl/src/com/intellij/codeInsight/javadoc/AnnotationDocGenerator.java
java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/editable/JavaPostfixTemplateEditor.java
java/java-impl/src/com/intellij/codeInspection/duplicateExpressions/ComplexityCalculator.java
java/java-impl/src/com/intellij/codeInspection/duplicateExpressions/SideEffectCalculator.java
java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
java/java-impl/src/com/intellij/refactoring/actions/TypeCookAction.java
java/java-impl/src/com/intellij/refactoring/anonymousToInner/MoveAnonymousToInnerHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineLocalHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineMethodHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineParameterHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineStaticImportHandler.java
java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java
java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringHandler.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/JavaMoveClassesOrPackagesHandler.java
java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerToUpperHandler.java
java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerToUpperOrMembersHandler.java
java/java-impl/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodHandlerDelegate.java
java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersHandler.java
java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/after.java.template [deleted file]
java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/before.java.template [deleted file]
java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/description.html [deleted file]
java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java
java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java
java/java-tests/testData/refactoring/moveActionName/anonymousToInner.java [new file with mode: 0644]
java/java-tests/testData/refactoring/moveActionName/innerClass.java [new file with mode: 0644]
java/java-tests/testData/refactoring/moveActionName/instanceMethod.java [new file with mode: 0644]
java/java-tests/testData/refactoring/moveActionName/moveClass.java [new file with mode: 0644]
java/java-tests/testData/refactoring/moveActionName/staticMethod.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CompletionHintsTest.java
java/java-tests/testSrc/com/intellij/java/refactoring/MoveActionNameTest.kt [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/java/refactoring/MoveClassAndFileTest.java
jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
json/src/com/intellij/json/JsonUtil.java
platform/analysis-api/intellij.platform.analysis.iml
platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionActionBean.java
platform/analysis-api/src/com/intellij/codeInspection/InspectionEP.java
platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy
platform/built-in-server-api/intellij.platform.builtInServer.iml
platform/built-in-server/src/org/jetbrains/ide/RestService.kt
platform/configuration-store-impl/intellij.platform.configurationStore.impl.iml
platform/configuration-store-impl/src/ExternalStorageConfigurationManagerImpl.kt [moved from platform/projectModel-api/src/com/intellij/openapi/project/ExternalStorageConfigurationManagerImpl.kt with 79% similarity]
platform/configuration-store-impl/testSrc/DoNotStorePasswordTest.kt
platform/core-api/src/com/intellij/testFramework/BinaryLightVirtualFile.java
platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java
platform/core-api/src/com/intellij/testFramework/LightVirtualFileBase.java
platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java
platform/diff-impl/tests/com/intellij/diff/merge/MergeTestBase.kt
platform/editor-ui-api/intellij.platform.editor.iml
platform/icons/src/actions/intentionBulbGrey.svg [new file with mode: 0644]
platform/icons/src/actions/intentionBulbGrey_dark.svg [new file with mode: 0644]
platform/lang-api/intellij.platform.lang.iml
platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java
platform/lang-api/src/com/intellij/codeInsight/daemon/NavigateAction.java
platform/lang-api/src/com/intellij/lang/refactoring/InlineActionHandler.java
platform/lang-api/src/com/intellij/lang/refactoring/InlineHandler.java
platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java
platform/lang-impl/src/com/intellij/application/options/colors/EditorColorSchemeDropHandler.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/application/options/editor/EditorCaretStopPolicyItem.kt
platform/lang-impl/src/com/intellij/application/options/editor/EditorOptionsPanel.java
platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipUtil.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GotoNextErrorHandler.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowErrorDescriptionHandler.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupValueWithPsiElement.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java
platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplateEditorBase.java
platform/lang-impl/src/com/intellij/execution/compound/CompoundRunConfigurationSettingsEditor.java
platform/lang-impl/src/com/intellij/execution/impl/ConfigurationSettingsEditor.java
platform/lang-impl/src/com/intellij/execution/startup/ProjectStartupConfigurable.java
platform/lang-impl/src/com/intellij/find/impl/FindSettingsImpl.java
platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/AbstractGotoSEContributor.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateDefaultExtension.java [deleted file]
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTabAsList.java
platform/lang-impl/src/com/intellij/openapi/editor/richcopy/view/RtfTransferableData.java
platform/lang-impl/src/com/intellij/platform/templates/ManageProjectTemplatesDialog.java
platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java
platform/lang-impl/src/com/intellij/refactoring/actions/InlineAction.java
platform/lang-impl/src/com/intellij/refactoring/actions/IntroduceParameterObjectAction.java
platform/lang-impl/src/com/intellij/refactoring/actions/MoveAction.java
platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java
platform/lang-impl/src/com/intellij/refactoring/move/MoveHandler.java
platform/lang-impl/src/com/intellij/refactoring/move/MoveHandlerDelegate.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesHandler.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveRelatedFilesHandler.java
platform/object-serializer/intellij.platform.objectSerializer.iml [new file with mode: 0644]
platform/object-serializer/intellij.platform.objectSerializer.tests.iml [new file with mode: 0644]
platform/object-serializer/src/AccessorWrapperBinding.kt [new file with mode: 0644]
platform/object-serializer/src/BaseBeanBinding.kt [new file with mode: 0644]
platform/object-serializer/src/BaseState.kt [moved from platform/projectModel-api/src/com/intellij/openapi/components/BaseState.kt with 100% similarity]
platform/object-serializer/src/BeanBinding.kt [new file with mode: 0644]
platform/object-serializer/src/Binding.kt [new file with mode: 0644]
platform/object-serializer/src/BindingProducer.kt [new file with mode: 0644]
platform/object-serializer/src/CollectionBinding.kt [new file with mode: 0644]
platform/object-serializer/src/IonBindingProducer.kt [new file with mode: 0644]
platform/object-serializer/src/ObjectSerializer.kt [new file with mode: 0644]
platform/object-serializer/src/StoredPropertyBase.kt [moved from platform/projectModel-api/src/com/intellij/openapi/components/StoredPropertyBase.kt with 94% similarity]
platform/object-serializer/src/configurationStore/properties/CollectionStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/CollectionStoredProperty.kt with 100% similarity]
platform/object-serializer/src/configurationStore/properties/FloatStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/FloatStoredProperty.kt with 97% similarity]
platform/object-serializer/src/configurationStore/properties/IntStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/IntStoredProperty.kt with 97% similarity]
platform/object-serializer/src/configurationStore/properties/LongStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/LongStoredProperty.kt with 97% similarity]
platform/object-serializer/src/configurationStore/properties/MapStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/MapStoredProperty.kt with 100% similarity]
platform/object-serializer/src/configurationStore/properties/ObjectStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/ObjectStoredProperty.kt with 98% similarity]
platform/object-serializer/src/configurationStore/properties/StringStoredProperty.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/properties/StringStoredProperty.kt with 95% similarity]
platform/object-serializer/src/xml/KotlinAwareBeanBinding.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/KotlinAwareBeanBinding.kt with 57% similarity]
platform/object-serializer/src/xml/xmlSerializer.kt [moved from platform/projectModel-api/src/com/intellij/configurationStore/xmlSerializer.kt with 70% similarity]
platform/object-serializer/testSnapshots/array_of_objects.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/array_of_string.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/boolean_as_null_object.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/boolean_as_object.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/float_as_null_object.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/float_as_object.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/int_and_null_string.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/int_and_string.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/int_as_object.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/list_of_objects.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/list_of_strings.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/recursive_reference.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/self_class_reference.ion [new file with mode: 0644]
platform/object-serializer/testSnapshots/several_recursive_reference.ion [new file with mode: 0644]
platform/object-serializer/testSrc/ObjectSerializerTest.kt [new file with mode: 0644]
platform/platform-api/intellij.platform.ide.iml
platform/platform-api/src/com/intellij/ide/TypeNameEP.java
platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java
platform/platform-api/src/com/intellij/openapi/ui/SelectFromListDialog.java
platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java
platform/platform-impl/src/com/intellij/ide/actions/QuickChangeColorSchemeAction.java
platform/platform-impl/src/com/intellij/ide/actions/Switcher.java
platform/platform-impl/src/com/intellij/ide/dnd/FileCopyPasteUtil.java
platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java
platform/platform-impl/src/com/intellij/ide/plugins/newui/BaselinePanel.java
platform/platform-impl/src/com/intellij/ide/plugins/newui/MyPluginModel.java
platform/platform-impl/src/com/intellij/ide/plugins/newui/NewListPluginComponent.java
platform/platform-impl/src/com/intellij/ide/plugins/newui/PluginDetailsPageComponent.java
platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaJBPopupComboPopup.java
platform/platform-impl/src/com/intellij/idea/IdeaApplication.java
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
platform/platform-impl/src/com/intellij/internal/statistic/actions/AddGroupToLocalWhitelistDialog.form
platform/platform-impl/src/com/intellij/internal/statistic/actions/AddGroupToLocalWhitelistDialog.java
platform/platform-impl/src/com/intellij/internal/statistic/actions/AddTestGroupToLocalWhitelistAction.java
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/StatisticsFileEventLogger.kt
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/SensitiveDataValidator.java
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/persistence/EventLogTestWhitelistPersistence.java [moved from platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/persistence/FUSTestWhiteListPersistence.java with 80% similarity]
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/persistence/EventLogWhitelistPersistence.java [moved from platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/persistence/FUSWhiteListPersistence.java with 60% similarity]
platform/platform-impl/src/com/intellij/internal/statistic/eventLog/validator/rules/utils/WhiteListSimpleRuleFactory.java
platform/platform-impl/src/com/intellij/internal/statistic/service/fus/FUStatisticsWhiteListGroupsService.java
platform/platform-impl/src/com/intellij/internal/statistic/updater/StatisticsJobsScheduler.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/CaretStopOptions.kt
platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
platform/platform-impl/src/com/intellij/openapi/options/SchemeExporterEP.java
platform/platform-impl/src/com/intellij/openapi/options/SchemeImporterEP.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java
platform/platform-impl/src/com/intellij/ui/ListSpeedSearch.java
platform/platform-impl/src/com/intellij/util/ui/ListModelEditor.java
platform/platform-resources-en/src/messages/ApplicationBundle.properties
platform/platform-resources-en/src/messages/VcsBundle.properties
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/idea/LangActions.xml
platform/platform-resources/src/idea/PlatformActions.xml
platform/platform-resources/src/keymaps/$default.xml
platform/platform-resources/src/keymaps/Emacs.xml
platform/platform-resources/src/keymaps/NetBeans 6.5.xml
platform/platform-resources/src/keymaps/ReSharper OSX.xml
platform/platform-resources/src/keymaps/ReSharper.xml
platform/platform-resources/src/keymaps/Xcode.xml
platform/platform-tests/intellij.platform.tests.iml
platform/platform-tests/testData/editor/multiCaret/EditorNextWord-after.txt
platform/platform-tests/testData/editor/multiCaret/EditorNextWordInDifferentHumpsMode-after.txt
platform/platform-tests/testData/editor/multiCaret/EditorNextWordInDifferentHumpsModeWithSelection-after.txt
platform/platform-tests/testData/editor/multiCaret/EditorNextWordWithSelection-after.txt
platform/platform-tests/testData/fus/validation/test_simple_expression_rules.json
platform/platform-tests/testSrc/com/intellij/internal/statistics/FeatureUsageEventLoggerTest.kt
platform/platform-tests/testSrc/com/intellij/internal/statistics/SensitiveDataValidatorTest.kt
platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/MoveToCaretStopTest.kt
platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java
platform/platform-tests/testSrc/com/intellij/openapi/vfs/ArchiveFileSystemPerformanceTest.kt
platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/JarFileSystemTest.java
platform/projectModel-api/intellij.platform.projectModel.iml
platform/projectModel-api/src/com/intellij/openapi/application/pathManagerEx.kt [deleted file]
platform/projectModel-impl/intellij.platform.projectModel.impl.iml
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/StructuralSearchDialog.java
platform/testFramework/extensions/src/com/intellij/keymap/KeymapsTestCase.java
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/CleanupSnapshots.kt [new file with mode: 0644]
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/PathAssertEx.kt
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/StringAssertEx.kt [new file with mode: 0644]
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/snapshot.kt
platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCaseExt.kt
platform/util-ex/intellij.platform.util.ex.iml [new file with mode: 0644]
platform/util-ex/src/com/intellij/application/Topics.kt [moved from platform/projectModel-api/src/com/intellij/application/Topics.kt with 92% similarity]
platform/util-ex/src/com/intellij/openapi/application/actions.kt [moved from platform/projectModel-api/src/com/intellij/openapi/application/actions.kt with 100% similarity]
platform/util-ex/src/com/intellij/openapi/application/pathManagerEx.kt [new file with mode: 0644]
platform/util-ex/src/com/intellij/openapi/command/actions.kt [moved from platform/projectModel-api/src/com/intellij/openapi/command/actions.kt with 100% similarity]
platform/util-ex/src/com/intellij/openapi/diagnostic/logger.kt [moved from platform/projectModel-api/src/com/intellij/openapi/diagnostic/logger.kt with 100% similarity]
platform/util-ex/src/com/intellij/util/KtUtils.kt [moved from platform/projectModel-api/src/com/intellij/util/KtUtils.kt with 100% similarity]
platform/util-ex/src/com/intellij/util/RecursionPreventingSafePublicationLazy.kt [moved from platform/projectModel-api/src/com/intellij/util/RecursionPreventingSafePublicationLazy.kt with 100% similarity]
platform/util-ex/src/com/intellij/util/concurrency/SynchronizedClearableLazy.kt [moved from platform/platform-impl/src/com/intellij/util/concurrency/SynchronizedClearableLazy.kt with 94% similarity]
platform/util-ex/src/com/intellij/util/containers/LookbackSequence.kt [moved from platform/projectModel-api/src/com/intellij/util/containers/LookbackSequence.kt with 100% similarity]
platform/util-ex/src/com/intellij/util/containers/util.kt [moved from platform/projectModel-api/src/com/intellij/util/containers/util.kt with 98% similarity]
platform/util-ex/src/com/intellij/util/io/DigestUtil.kt [moved from platform/projectModel-impl/src/com/intellij/util/io/DigestUtil.kt with 78% similarity]
platform/util-ex/src/com/intellij/util/io/io.kt [moved from platform/projectModel-api/src/com/intellij/util/io/io.kt with 92% similarity]
platform/util-ex/src/com/intellij/util/io/path.kt [moved from platform/projectModel-api/src/com/intellij/util/io/path.kt with 95% similarity]
platform/util-ex/src/com/intellij/util/jdom.kt [moved from platform/projectModel-api/src/com/intellij/util/jdom.kt with 100% similarity]
platform/util-ex/src/com/intellij/util/lazy.kt [moved from platform/projectModel-api/src/com/intellij/util/lazy.kt with 100% similarity]
platform/util-ex/src/org/jetbrains/concurrency/AsyncPromise.kt [moved from platform/projectModel-api/src/org/jetbrains/concurrency/AsyncPromise.kt with 98% similarity]
platform/util-ex/src/org/jetbrains/concurrency/AsyncValueLoader.java [moved from platform/platform-impl/src/org/jetbrains/concurrency/AsyncValueLoader.java with 98% similarity]
platform/util-ex/src/org/jetbrains/concurrency/PromiseManager.java [moved from platform/platform-impl/src/org/jetbrains/concurrency/PromiseManager.java with 98% similarity]
platform/util-ex/src/org/jetbrains/concurrency/promise-coroutines.kt [moved from platform/platform-impl/src/org/jetbrains/concurrency/promise-coroutines.kt with 97% similarity]
platform/util-ex/src/org/jetbrains/concurrency/promise.kt [moved from platform/projectModel-api/src/org/jetbrains/concurrency/promise.kt with 100% similarity]
platform/util-rt/src/com/intellij/util/containers/SLRUMap.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/icons/AllIcons.java
platform/util/src/com/intellij/openapi/util/text/StringUtil.java
platform/util/src/com/intellij/util/containers/ObjectIntHashMap.java
platform/util/src/com/intellij/util/serialization/ClassUtil.java [new file with mode: 0644]
platform/util/src/com/intellij/util/serialization/FieldAccessor.java
platform/util/src/com/intellij/util/serialization/PropertyAccessor.java
platform/util/src/com/intellij/util/serialization/PropertyCollector.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/AccessorBindingWrapper.java
platform/util/src/com/intellij/util/xmlb/ArrayBinding.java
platform/util/src/com/intellij/util/xmlb/AttributeBinding.java
platform/util/src/com/intellij/util/xmlb/BasePrimitiveBinding.java
platform/util/src/com/intellij/util/xmlb/BeanBinding.java
platform/util/src/com/intellij/util/xmlb/Binding.java
platform/util/src/com/intellij/util/xmlb/CollectionBinding.java
platform/util/src/com/intellij/util/xmlb/CompactCollectionBinding.java
platform/util/src/com/intellij/util/xmlb/JDOMElementBinding.java
platform/util/src/com/intellij/util/xmlb/MapBinding.java
platform/util/src/com/intellij/util/xmlb/MultiNodeBinding.java
platform/util/src/com/intellij/util/xmlb/NestedBinding.java [new file with mode: 0644]
platform/util/src/com/intellij/util/xmlb/NotNullDeserializeBinding.java
platform/util/src/com/intellij/util/xmlb/OptionTagBinding.java
platform/util/src/com/intellij/util/xmlb/Serializer.java
platform/util/src/com/intellij/util/xmlb/SkipDefaultsSerializationFilter.java
platform/util/src/com/intellij/util/xmlb/SmartSerializer.java
platform/util/src/com/intellij/util/xmlb/TagBinding.java
platform/util/src/com/intellij/util/xmlb/TextBinding.java
platform/util/src/com/intellij/util/xmlb/XmlSerializer.java
platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java
platform/util/testSrc/com/intellij/openapi/application/PathManagerTest.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ColumnFilteringStrategy.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/actions/IgnoreFileAction.kt [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/actions/IgnoreFileActionGroup.kt [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/psi/util/IgnoreFilePsiUtil.kt
platform/vcs-log/impl/src/com/intellij/vcs/log/data/AbstractDataGetter.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/CommitDetailsGetter.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsCommitCache.java
plugins/IntelliLang/intellilang-jps-plugin/test/org/jetbrains/jps/intellilang/instrumentation/PatternInstrumenterTest.kt
plugins/cucumber-jvm-formatter/src/org/jetbrains/plugins/cucumber/java/run/CucumberJvmSMFormatter.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/checkout/ChooseCheckoutMode.java
plugins/devkit/devkit-core/resources/META-INF/plugin.xml
plugins/devkit/devkit-core/src/dom/IdeaPlugin.java
plugins/devkit/devkit-core/src/dom/impl/ExtensionDomExtender.java
plugins/devkit/devkit-core/src/dom/impl/I18nReferenceContributor.java
plugins/devkit/devkit-core/src/dom/impl/PluginDescriptorDomFileDescription.java
plugins/devkit/devkit-core/src/inspections/PluginXmlCapitalizationInspection.java
plugins/devkit/devkit-core/src/inspections/RegistryPropertiesAnnotator.kt
plugins/devkit/devkit-core/src/inspections/quickfix/CreateHtmlDescriptionFix.java
plugins/devkit/devkit-core/src/navigation/structure/PluginDescriptorStructureUtil.java
plugins/devkit/devkit-core/src/references/ExperimentalFeatureIdContributor.java
plugins/devkit/devkit-core/src/util/ActionType.java
plugins/devkit/devkit-core/src/util/ComponentType.java
plugins/git4idea/resources/META-INF/plugin.xml
plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java
plugins/git4idea/src/git4idea/ignore/actions/GitIgnoreFileActionGroup.kt [new file with mode: 0644]
plugins/gradle/plugin-resources/META-INF/plugin.xml
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/GradleIssueChecker.kt [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/GradleIssueData.kt
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/IncompatibleGradleJdkIssueChecker.kt
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/quickfix/GradleSettingsQuickFix.kt
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/quickfix/GradleVersionQuickFix.kt
plugins/gradle/src/org/jetbrains/plugins/gradle/issue/quickfix/ReimportQuickFix.kt
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseProjectImportErrorHandler.java
plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java
plugins/groovy/src/META-INF/plugin.xml
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyInlineLocalHandler.java
plugins/java-decompiler/plugin/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.kt
plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java
plugins/javaFX/intellij.javaFX.iml
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXQuickfixTest.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFxSdkSetupNotificationTest.java
plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/AbstractJavaFXTestCase.java
plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleMoveProvider.java
plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CopyOptionsDialog.java
plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MessageBoxCellRenderer.java [deleted file]
plugins/svn4idea/src/org/jetbrains/idea/svn/update/MultipleRootEditorWithSplitter.java
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/ChooseStacktraceDialog.java
plugins/tasks/tasks-core/src/com/intellij/tasks/actions/vcs/VcsOpenTaskPanel.java
plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java
plugins/ui-designer/src/com/intellij/uiDesigner/projectView/FormMoveProvider.java
python/python-community-configure/src/com/jetbrains/python/newProject/steps/PyAddNewEnvironmentPanel.kt
python/src/com/jetbrains/python/refactoring/move/PyMoveSymbolDelegate.java
python/testSrc/com/jetbrains/python/PyNextPrevWordTest.java
resources/src/idea/JavaActions.xml
spellchecker/src/com/intellij/spellchecker/jetbrains.dic
xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java
xml/impl/src/com/intellij/ide/browsers/actions/BaseOpenInBrowserAction.kt
xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java

diff --git a/.idea/libraries/ion.xml b/.idea/libraries/ion.xml
new file mode 100644 (file)
index 0000000..0fa23c0
--- /dev/null
@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="ion" type="repository">
+    <properties maven-id="software.amazon.ion:ion-java:1.4.0" />
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/software/amazon/ion/ion-java/1.4.0/ion-java-1.4.0.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/software/amazon/ion/ion-java/1.4.0/ion-java-1.4.0-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>
\ No newline at end of file
index 92d90d3c9abda2600fcac294198d8df0b779d13b..4028c51c5440baa6a6c6acafc078d6e2de6fc7f0 100644 (file)
       <module fileurl="file://$PROJECT_DIR$/platform/lvcs-api/intellij.platform.lvcs.iml" filepath="$PROJECT_DIR$/platform/lvcs-api/intellij.platform.lvcs.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/lvcs-impl/intellij.platform.lvcs.impl.iml" filepath="$PROJECT_DIR$/platform/lvcs-impl/intellij.platform.lvcs.impl.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/platform-main/intellij.platform.main.iml" filepath="$PROJECT_DIR$/platform/platform-main/intellij.platform.main.iml" />
+      <module fileurl="file://$PROJECT_DIR$/platform/object-serializer/intellij.platform.objectSerializer.iml" filepath="$PROJECT_DIR$/platform/object-serializer/intellij.platform.objectSerializer.iml" />
+      <module fileurl="file://$PROJECT_DIR$/platform/object-serializer/intellij.platform.objectSerializer.tests.iml" filepath="$PROJECT_DIR$/platform/object-serializer/intellij.platform.objectSerializer.tests.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/projectModel-api/intellij.platform.projectModel.iml" filepath="$PROJECT_DIR$/platform/projectModel-api/intellij.platform.projectModel.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/projectModel-impl/intellij.platform.projectModel.impl.iml" filepath="$PROJECT_DIR$/platform/projectModel-impl/intellij.platform.projectModel.impl.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/remote-servers/api/intellij.platform.remoteServers.iml" filepath="$PROJECT_DIR$/platform/remote-servers/api/intellij.platform.remoteServers.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/util/intellij.platform.util.iml" filepath="$PROJECT_DIR$/platform/util/intellij.platform.util.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" filepath="$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" />
+      <module fileurl="file://$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" filepath="$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" filepath="$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/util/testSrc/intellij.platform.util.tests.iml" filepath="$PROJECT_DIR$/platform/util/testSrc/intellij.platform.util.tests.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/vcs-api/intellij.platform.vcs.iml" filepath="$PROJECT_DIR$/platform/vcs-api/intellij.platform.vcs.iml" />
index 7800c084b91045ee72eb8dc1f87e0ad7f5950f7f..239bb945906219302d4a8dc6b14251a97f90a68a 100644 (file)
@@ -408,11 +408,17 @@ public class ArtifactRepositoryManager {
     public boolean visitEnter(DependencyNode node) {
       final Dependency dep = node.getDependency();
       if (dep != null) {
-        myRequests.add(new ArtifactRequest(
-          new ArtifactWithChangedClassifier(node.getDependency().getArtifact(), myKind.getClassifier()),
-          node.getRepositories(),
-          node.getRequestContext()
-        ));
+        Artifact artifact = dep.getArtifact();
+        String classifier = myKind.getClassifier();
+        if (classifier.isEmpty()) {
+          myRequests.add(new ArtifactRequest(node));
+        }
+        else {
+          myRequests.add(new ArtifactRequest(new ArtifactWithChangedClassifier(artifact, classifier),
+            node.getRepositories(),
+            node.getRequestContext()
+          ));
+        }
       }
       return true;
     }
index 3667fde00b60f489b87280d5d88cf3d887035cce..7318f614d51c8883c12edce68fce449b79f67af3 100644 (file)
Binary files a/community-resources/src/idea_community_about.png and b/community-resources/src/idea_community_about.png differ
index f96bb3c49298d3f394827ef8552be57a04d361fd..461f9babef871255f407b46d6f9097c6b62c21b8 100644 (file)
Binary files a/community-resources/src/idea_community_about@2x.png and b/community-resources/src/idea_community_about@2x.png differ
index f806531605862786e7c9147b2a5e52a11c13f44e..bc0b20ebe051a4ce37b3cc6f5006363c76123073 100644 (file)
Binary files a/community-resources/src/idea_community_logo.png and b/community-resources/src/idea_community_logo.png differ
index 43e051d46b3da233a08901376e740c0d25ba2d59..04fbbdeb354ca412faaf5a2c6d598085d64fa020 100644 (file)
Binary files a/community-resources/src/idea_community_logo@2x.png and b/community-resources/src/idea_community_logo@2x.png differ
index 42061804d7559603e16c40c32efb5bc0d7a6564c..d32824bb75f81cb386d275b045d16df665647ed4 100644 (file)
@@ -14,8 +14,7 @@ import com.intellij.openapi.ui.popup.PopupStep;
 import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.ui.ColoredListCellRenderer;
-import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.ui.popup.list.ListPopupImpl;
 import com.intellij.xdebugger.XExpression;
 import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
@@ -75,13 +74,7 @@ class ExpressionEditorWithHistory extends XDebuggerExpressionEditor {
       }) {
         @Override
         protected ListCellRenderer getListElementRenderer() {
-          return new ColoredListCellRenderer<XExpression>() {
-            @Override
-            protected void customizeCellRenderer(@NotNull JList list, XExpression value, int index,
-                                                 boolean selected, boolean hasFocus) {
-              append(value.getExpression(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
-            }
-          };
+          return SimpleListCellRenderer.create("", XExpression::getExpression);
         }
       };
 
index 5a6ea383e3ecb986e398351329395f84f1e4e034..49007fbd304e3bd23a86cbf56ac35e80b431fd6e 100644 (file)
@@ -75,7 +75,7 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator {
           platformClasspath.add(new File(s));
         }
       }
-      JavaBuilder.addAnnotationProcessingOptions(options, profile);
+      JavaBuilder.addAnnotationProcessingOptions(options, profile, false);
 
       Pair<Sdk, JavaSdkVersion> runtime = BuildManager.getJavacRuntimeSdk(myProject);
       JavaSdkVersion buildRuntimeVersion = runtime.getSecond();
index b7dc59075776ec46e30c74196fa6af2ec0fe6ea1..5333316574df930faaba18db5bbb41819bbe779c 100644 (file)
@@ -12,5 +12,6 @@
     <orderEntry type="module" module-name="intellij.platform.projectModel" />
     <orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
     <orderEntry type="module" module-name="intellij.platform.uast" exported="" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" />
   </component>
 </module>
\ No newline at end of file
index 29015a1c8f1b409aa2c2594bcf1a57a57a6dfc40..c0bd8ea90c0168a4795ec63cc2ba6019ba06ba52 100644 (file)
     <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.codeInsight.daemon.impl.JavaLineMarkerProvider"/>
     <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.codeInsight.daemon.impl.RecursiveCallLineMarkerProvider"/>
     <codeInsight.lineMarkerProvider language="UAST" implementationClass="com.intellij.codeInsight.daemon.impl.IconLineMarkerProvider"/>
-    <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.codeInsight.ExternalAnnotationsLineMarkerProvider"/>
+    <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.codeInsight.ExternalAnnotationLineMarkerProvider"/>
+    <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.codeInsight.InferredAnnotationsLineMarkerProvider"/>
     <codeInsight.gotoSuper language="SPI" implementationClass="com.intellij.spi.SPIGotoSuperHandler"/>
     <codeInsight.gotoSuper language="JAVA" implementationClass="com.intellij.codeInsight.navigation.JavaGotoSuperHandler"/>
     <codeInsight.delegateMethods language="JAVA" implementationClass="com.intellij.codeInsight.generation.GenerateDelegateHandler"/>
       <category>Java/Control Flow</category>
     </intentionAction>
     <intentionAction>
-      <className>com.intellij.codeInsight.ToggleSourceInferredAnnotations</className>
-      <category>Java/Annotations</category>
-      <descriptionDirectoryName>ToggleSourceInferredAnnotations</descriptionDirectoryName>
-    </intentionAction>
-    <intentionAction>
       <className>com.intellij.codeInsight.MakeAnnotationExternal</className>
       <category>Java/Annotations</category>
       <descriptionDirectoryName>MakeAnnotationExternal</descriptionDirectoryName>
diff --git a/java/java-impl/src/com/intellij/codeInsight/AnnotationLineMarkerProviders.kt b/java/java-impl/src/com/intellij/codeInsight/AnnotationLineMarkerProviders.kt
new file mode 100644 (file)
index 0000000..6c79e1a
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.codeInsight
+
+import com.intellij.codeInsight.javadoc.NonCodeAnnotationGenerator
+import com.intellij.psi.PsiModifierListOwner
+
+class ExternalAnnotationLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider() {
+  override fun hasAnnotationsToShow(owner: PsiModifierListOwner): Boolean {
+    return NonCodeAnnotationGenerator.getSignatureNonCodeAnnotations(owner).values().any { !it.isInferred }
+  }
+
+  override fun getName() = "External annotations"
+}
+
+class InferredAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider() {
+  override fun hasAnnotationsToShow(owner: PsiModifierListOwner): Boolean {
+    val values = NonCodeAnnotationGenerator.getSignatureNonCodeAnnotations(owner).values()
+    // Don't show two markers
+    return values.any { it.isInferred } && values.none { !it.isInferred }
+  }
+
+
+  override fun getName() = "Inferred annotations"
+}
index 98e7c9981a6e87be11072ba35ce91863ccb922d2..704b8f5a3c1bd89ab6e7257eb5662e6db0974996 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
 import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy;
 import com.intellij.psi.infos.CandidateInfo;
 import com.intellij.psi.infos.MethodCandidateInfo;
-import com.intellij.psi.scope.conflictResolvers.DuplicateConflictResolver;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.PsiShortNamesCache;
 import com.intellij.psi.tree.IElementType;
@@ -667,11 +666,10 @@ public class ExpectedTypesProvider {
     private void getExpectedArgumentsTypesForNewExpression(@NotNull final PsiNewExpression newExpr,
                                                            @NotNull final PsiExpressionList list) {
       if (PsiDiamondType.hasDiamond(newExpr)) {
-        final JavaResolveResult[] candidates = PsiDiamondTypeImpl.collectStaticFactories(newExpr, DuplicateConflictResolver.INSTANCE);
+        final List<CandidateInfo> candidates = PsiDiamondTypeImpl.collectStaticFactories(newExpr);
         if (candidates != null) {
           final PsiExpressionList argumentList = Objects.requireNonNull(newExpr.getArgumentList());
-          CandidateInfo[] converted = ContainerUtil.map(candidates, candidate -> (CandidateInfo)candidate, CandidateInfo.EMPTY_ARRAY);
-          Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(converted, argumentList, myExpr, myForCompletion,
+          Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(candidates.toArray(CandidateInfo.EMPTY_ARRAY), argumentList, myExpr, myForCompletion,
                                                                              newExpr.resolveMethod()));
         }
         return;
index c1c7b7ccb8641859a6967bdd4ae46687aa054c4d..201c981e796c312b12d24e49051615f7dfa3f19c 100644 (file)
@@ -51,7 +51,7 @@ public class MakeExternalAnnotationExplicit extends BaseIntentionAction {
   @Override
   public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
     final PsiElement leaf = file.findElementAt(editor.getCaretModel().getOffset());
-    final PsiModifierListOwner owner = ExternalAnnotationsLineMarkerProvider.getAnnotationOwner(leaf);
+    final PsiModifierListOwner owner = NonCodeAnnotationsLineMarkerProvider.getAnnotationOwner(leaf);
     if (owner != null && owner.getLanguage().isKindOf(JavaLanguage.INSTANCE) && isWritable(owner) &&
         ModuleUtilCore.findModuleForPsiElement(file) != null &&
         PsiUtil.getLanguageLevel(file).isAtLeast(LanguageLevel.JDK_1_5)) {
@@ -73,7 +73,7 @@ public class MakeExternalAnnotationExplicit extends BaseIntentionAction {
   @Override
   public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
     final PsiElement leaf = file.findElementAt(editor.getCaretModel().getOffset());
-    final PsiModifierListOwner owner = ExternalAnnotationsLineMarkerProvider.getAnnotationOwner(leaf);
+    final PsiModifierListOwner owner = NonCodeAnnotationsLineMarkerProvider.getAnnotationOwner(leaf);
     assert owner != null;
     final PsiModifierList modifierList = owner.getModifierList();
     assert modifierList != null;
similarity index 89%
rename from java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
rename to java/java-impl/src/com/intellij/codeInsight/NonCodeAnnotationsLineMarkerProvider.java
index 0ef406fdd864b975588a1639188cfe9dc21ffd8d..6de66c8355ca572ccc98961308d037b5dd49697b 100644 (file)
@@ -1,7 +1,6 @@
 // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.codeInsight;
 
-import com.intellij.codeHighlighting.Pass;
 import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
 import com.intellij.codeInsight.daemon.LineMarkerInfo;
 import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor;
@@ -30,7 +29,6 @@ import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.ui.awt.RelativePoint;
 import com.intellij.util.Function;
 import com.intellij.util.ObjectUtils;
-import com.intellij.util.containers.ContainerUtil;
 import com.intellij.xml.util.XmlStringUtil;
 import one.util.streamex.StreamEx;
 import org.jetbrains.annotations.NotNull;
@@ -45,8 +43,8 @@ import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-public class ExternalAnnotationsLineMarkerProvider extends LineMarkerProviderDescriptor {
-  private static final Function<PsiElement, String> ourTooltipProvider = nameIdentifier -> {
+public abstract class NonCodeAnnotationsLineMarkerProvider extends LineMarkerProviderDescriptor {
+  private final Function<PsiElement, String> myTooltipProvider = nameIdentifier -> {
     PsiModifierListOwner owner = (PsiModifierListOwner)nameIdentifier.getParent();
 
     return XmlStringUtil.wrapInHtml(NonCodeAnnotationGenerator.getNonCodeHeader(NonCodeAnnotationGenerator.getSignatureNonCodeAnnotations(owner).values()) +
@@ -59,20 +57,18 @@ public class ExternalAnnotationsLineMarkerProvider extends LineMarkerProviderDes
     PsiModifierListOwner owner = getAnnotationOwner(element);
     if (owner == null) return null;
 
-    boolean includeSourceInferred = CodeInsightSettings.getInstance().SHOW_SOURCE_INFERRED_ANNOTATIONS;
-    boolean hasAnnotationsToShow = ContainerUtil.exists(NonCodeAnnotationGenerator.getSignatureNonCodeAnnotations(owner).values(),
-                                                        a -> includeSourceInferred || !a.isInferredFromSource());
-    if (!hasAnnotationsToShow) {
+    if (!hasAnnotationsToShow(owner)) {
       return null;
     }
 
     return new LineMarkerInfo<>(element, element.getTextRange(),
                                 AllIcons.Gutter.ExtAnnotation,
-                                Pass.LINE_MARKERS,
-                                ourTooltipProvider, MyIconGutterHandler.INSTANCE,
+                                myTooltipProvider, MyIconGutterHandler.INSTANCE,
                                 GutterIconRenderer.Alignment.RIGHT);
   }
 
+  protected abstract boolean hasAnnotationsToShow(@NotNull PsiModifierListOwner owner);
+
   @Nullable
   static PsiModifierListOwner getAnnotationOwner(@Nullable PsiElement element) {
     if (element == null) return null;
@@ -87,12 +83,6 @@ public class ExternalAnnotationsLineMarkerProvider extends LineMarkerProviderDes
     return (PsiModifierListOwner)owner;
   }
 
-  @NotNull
-  @Override
-  public String getName() {
-    return "External annotations";
-  }
-
   @Nullable
   @Override
   public Icon getIcon() {
@@ -184,7 +174,6 @@ public class ExternalAnnotationsLineMarkerProvider extends LineMarkerProviderDes
       return action instanceof AnnotateIntentionAction ||
              action instanceof DeannotateIntentionAction ||
              action instanceof EditContractIntention ||
-             action instanceof ToggleSourceInferredAnnotations ||
              action instanceof MakeInferredAnnotationExplicit ||
              action instanceof MakeExternalAnnotationExplicit;
     }
diff --git a/java/java-impl/src/com/intellij/codeInsight/ToggleSourceInferredAnnotations.java b/java/java-impl/src/com/intellij/codeInsight/ToggleSourceInferredAnnotations.java
deleted file mode 100644 (file)
index 7f0c0a7..0000000
+++ /dev/null
@@ -1,100 +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.
- */
-package com.intellij.codeInsight;
-
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.intention.LowPriorityAction;
-import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
-import com.intellij.codeInsight.javadoc.AnnotationDocGenerator;
-import com.intellij.openapi.command.undo.BasicUndoableAction;
-import com.intellij.openapi.command.undo.UndoManager;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.containers.ContainerUtil;
-import one.util.streamex.StreamEx;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.NotNull;
-
-import static com.intellij.codeInsight.ExternalAnnotationsLineMarkerProvider.getAnnotationOwner;
-
-/**
- * @author peter
- */
-public class ToggleSourceInferredAnnotations extends BaseIntentionAction implements LowPriorityAction {
-
-  @Nls
-  @NotNull
-  @Override
-  public String getFamilyName() {
-    return "Show/Hide Gutter Icon for Annotations Inferred from Source Code";
-  }
-
-  @Override
-  public boolean isAvailable(@NotNull final Project project, Editor editor, PsiFile file) {
-    final PsiElement leaf = file.findElementAt(editor.getCaretModel().getOffset());
-    final PsiModifierListOwner owner = getAnnotationOwner(leaf);
-    if (owner != null) {
-      boolean hasSrcInferredAnnotation = ContainerUtil.exists(AnnotationDocGenerator.getAnnotationsToShow(owner),
-                                                              AnnotationDocGenerator::isInferredFromSource);
-      if (!hasSrcInferredAnnotation) {
-        if (owner instanceof PsiMethod) {
-          hasSrcInferredAnnotation = StreamEx.of(((PsiMethod)owner).getParameterList().getParameters())
-                                             .flatCollection(AnnotationDocGenerator::getAnnotationsToShow)
-                                             .anyMatch(AnnotationDocGenerator::isInferredFromSource);
-        }
-      }
-      if (hasSrcInferredAnnotation) {
-        setText((CodeInsightSettings.getInstance().SHOW_SOURCE_INFERRED_ANNOTATIONS ? "Hide" : "Show") +
-                " gutter icon for annotations inferred from source code");
-        return true;
-      }
-    }
-    
-    return false;
-  }
-
-  @Override
-  public void invoke(@NotNull final Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
-    boolean showAnnotations = !CodeInsightSettings.getInstance().SHOW_SOURCE_INFERRED_ANNOTATIONS;
-    showAnnotations(project, file, showAnnotations);
-    UndoManager.getInstance(project).undoableActionPerformed(new BasicUndoableAction(file.getVirtualFile()) {
-      @Override
-      public void undo() {
-        showAnnotations(project, file, !showAnnotations);
-      }
-
-      @Override
-      public void redo() {
-        showAnnotations(project, file, showAnnotations);
-      }
-    });
-  }
-
-  private static void showAnnotations(@NotNull Project project, PsiFile file, boolean showAnnotations) {
-    CodeInsightSettings.getInstance().SHOW_SOURCE_INFERRED_ANNOTATIONS = showAnnotations;
-    DaemonCodeAnalyzer.getInstance(project).restart(file);
-  }
-
-  @Override
-  public boolean startInWriteAction() {
-    return false;
-  }
-}
index 5d44e236a668ecb28fa75ea4268862652f660781..75f772ef041b5ab8416d174cbca4243df1579b87 100644 (file)
@@ -57,7 +57,7 @@ public class AnnotationDocGenerator {
     return AnnotationUtil.isExternalAnnotation(myAnnotation);
   }
 
-  boolean isInferred() {
+  public boolean isInferred() {
     return AnnotationUtil.isInferredAnnotation(myAnnotation);
   }
 
index 6d3c68111b91d82712b05720c29278c659b66c3f..5f6f6d05619e5f4f0776533b42c836188d45e83e 100644 (file)
@@ -19,7 +19,7 @@ import com.intellij.openapi.ui.ComboBox;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
-import com.intellij.ui.ColoredListCellRenderer;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.ui.FormBuilder;
@@ -39,12 +39,7 @@ public class JavaPostfixTemplateEditor extends PostfixTemplateEditorBase<JavaPos
   public JavaPostfixTemplateEditor(@NotNull PostfixTemplateProvider provider) {
     super(provider, createEditor(), true);
     myLanguageLevelCombo = new ComboBox<>(LanguageLevel.values());
-    myLanguageLevelCombo.setRenderer(new ColoredListCellRenderer<LanguageLevel>() {
-      @Override
-      protected void customizeCellRenderer(@NotNull JList list, LanguageLevel value, int index, boolean selected, boolean hasFocus) {
-        append(value.getPresentableText());
-      }
-    });
+    myLanguageLevelCombo.setRenderer(SimpleListCellRenderer.create("", LanguageLevel::getPresentableText));
 
     myPanel = FormBuilder.createFormBuilder()
                          .addLabeledComponent("Minimum language level:", myLanguageLevelCombo)
index ed633dcd448dac04f55d8fd90dc9e608a9bb6ee6..da7646852fce03b5f8d637732a356e1a3f35fd4e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.codeInspection.duplicateExpressions;
 
 import com.intellij.psi.*;
@@ -43,7 +43,7 @@ class ComplexityCalculator {
       return 0;
     }
 
-    int complexity = myCache.get(expression, -1);
+    int complexity = myCache.get(expression);
     if (complexity < 0) {
       complexity = calculateComplexity(expression);
       myCache.put(expression, complexity);
index 0fbd1428f50e60cb5ad6bd4fb295d062373ffd55..25fe32b8fd9cae4391b712d2a34ddd809f164685 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.codeInspection.duplicateExpressions;
 
 import com.intellij.codeInspection.dataFlow.CommonDataflow;
@@ -54,7 +54,7 @@ class SideEffectCalculator {
         expression instanceof PsiClassObjectAccessExpression) {
       return false;
     }
-    int c = myCache.get(expression, -1);
+    int c = myCache.get(expression);
     if (c < 0) {
       c = calculateSideEffect(expression) ? 1 : 0;
       myCache.put(expression, c);
index 26c01c00d498626cbaf89ef51c7b0f0e34ede0df..73db6592f467c0c0a11cfe2d9d0766c9061bd0e4 100644 (file)
@@ -215,6 +215,14 @@ public class JavaSdkImpl extends JavaSdk {
     return JdkUtil.checkForJdk(path);
   }
 
+  @Override
+  public String getInvalidHomeMessage(String path) {
+    if (JdkUtil.checkForJre(path)) {
+      return "The selected directory points to a JRE, not a JDK.\nYou can download a JDK from " + getDownloadSdkUrl();
+    }
+    return super.getInvalidHomeMessage(path);
+  }
+
   @NotNull
   @Override
   public String suggestSdkName(@Nullable String currentSdkName, String sdkHome) {
index 9497fc0ee3afd682959ddbda9c4f61f2ad8592de..66cde30427aa8954451b13b7bd81ee0a64c7a847 100644 (file)
@@ -15,7 +15,9 @@
  */
 package com.intellij.refactoring.actions;
 
+import com.intellij.openapi.actionSystem.ActionPlaces;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.*;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.typeCook.TypeCookHandler;
@@ -30,6 +32,18 @@ public class TypeCookAction extends BaseJavaRefactoringAction {
   }
 
   @Override
+  protected boolean isAvailableOnElementInEditorAndFile(@NotNull PsiElement element,
+                                                        @NotNull Editor editor,
+                                                        @NotNull PsiFile file,
+                                                        @NotNull DataContext context,
+                                                        @NotNull String place) {
+    if (ActionPlaces.isPopupPlace(place)) {
+      return element instanceof PsiClass || element instanceof PsiJavaFile;
+    }
+    return super.isAvailableOnElementInEditorAndFile(element, editor, file, context, place);
+  }
+
+  @Override
   public boolean isEnabledOnElements(@NotNull PsiElement[] elements) {
     return elements.length > 0 && Arrays.stream(elements).allMatch(
       e -> e instanceof PsiClass || e instanceof PsiJavaFile || e instanceof PsiDirectory || e instanceof PsiPackage);
index da5aeb1799ea610b3de1c0fdbbf105ea08e99c57..cafecbe3b0c30bb78589c48b240869ae2a0da032 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.intellij.refactoring.anonymousToInner;
 
+import com.intellij.lang.Language;
+import com.intellij.lang.jvm.JvmLanguage;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
@@ -23,6 +25,7 @@ import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiNewExpression;
 import com.intellij.psi.PsiReference;
 import com.intellij.refactoring.move.MoveHandlerDelegate;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -30,11 +33,11 @@ import org.jetbrains.annotations.Nullable;
  */
 public class MoveAnonymousToInnerHandler extends MoveHandlerDelegate {
   @Override
-  public boolean canMove(PsiElement[] elements, @Nullable PsiElement targetContainer) {
+  public boolean canMove(PsiElement[] elements, @Nullable PsiElement targetContainer, @Nullable PsiReference reference) {
     for (PsiElement element : elements) {
       if (!(element instanceof PsiAnonymousClass)) return false;
     }
-    return targetContainer == null || super.canMove(elements, targetContainer);
+    return targetContainer == null || super.canMove(elements, targetContainer, reference);
   }
 
   @Override
@@ -46,4 +49,15 @@ public class MoveAnonymousToInnerHandler extends MoveHandlerDelegate {
     }
     return false;
   }
+
+  @Override
+  public boolean supportsLanguage(@NotNull Language language) {
+    return language instanceof JvmLanguage;
+  }
+
+  @Nullable
+  @Override
+  public String getActionName(@NotNull PsiElement[] elements) {
+    return "Convert Anonymous to Inner...";
+  }
 }
index c5ac32305850678abe6c186630d7f6238b576c26..a35a05240aa83d50541aa7b1e7de530f3cb6e08b 100644 (file)
@@ -151,4 +151,10 @@ public class InlineConstantFieldHandler extends JavaInlineActionHandler {
 
     return null;
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME + "...";
+  }
 }
index 4b7d322d1c80b2d5430a464b402749891781e2c8..0a9335a7815a59c2e2973c15ebe91dd59467180d 100644 (file)
@@ -177,14 +177,14 @@ public class InlineLocalHandler extends JavaInlineActionHandler {
     final Ref<Boolean> inlineAll = new Ref<>(true);
     if (editor != null && !ApplicationManager.getApplication().isUnitTestMode()) {
       int occurrencesCount = refsToInlineList.size();
-      if (refExpr != null && occurrencesCount > 1 || EditorSettingsExternalizable.getInstance().isShowInlineLocalDialog()) {
+      if (refExpr != null && (occurrencesCount > 1 || EditorSettingsExternalizable.getInstance().isShowInlineLocalDialog())) {
         final InlineLocalDialog inlineLocalDialog = new InlineLocalDialog(project, local, refExpr, occurrencesCount);
         if (!inlineLocalDialog.showAndGet()) {
           WindowManager.getInstance().getStatusBar(project).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
           return;
         }
 
-        if (refExpr != null && inlineLocalDialog.isInlineThis()) {
+        if (inlineLocalDialog.isInlineThis()) {
           refsToInlineList = Collections.singletonList(refExpr);
           inlineAll.set(false);
         }
@@ -403,4 +403,10 @@ public class InlineLocalHandler extends JavaInlineActionHandler {
     }
     return local.getInitializer();
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME;
+  }
 }
index a64638a9e87d1fba9cf086a349e226ff6362cb10..43cfcf768dba64b5ab4a7a88be4f1b65cf67622a 100644 (file)
@@ -15,6 +15,7 @@ import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import com.intellij.refactoring.util.InlineUtil;
 import com.intellij.refactoring.util.RefactoringUtil;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.Collections;
 import java.util.function.Supplier;
@@ -172,4 +173,10 @@ public class InlineMethodHandler extends JavaInlineActionHandler {
     }
     return false;
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME + "...";
+  }
 }
\ No newline at end of file
index 985da3c03f4e1ddeaa3d4b7cd1c7accee50ee62b..5fe8a9d0b5b6bf303aeccaac9315891d6509e283 100644 (file)
@@ -286,4 +286,10 @@ public class InlineParameterHandler extends JavaInlineActionHandler {
     }
     return null;
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME + "...";
+  }
 }
index 8915650eb5f29e40f5769a4972664acb1bc33d92..0e363026138f96170fe5751fe59ad8a19b80db8c 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiJavaCodeReferenceElement;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.listeners.RefactoringEventData;
 import com.intellij.refactoring.listeners.RefactoringEventListener;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.List;
 
@@ -55,4 +56,10 @@ public class InlineStaticImportHandler extends JavaInlineActionHandler {
     WriteCommandAction.writeCommandAction(project).withName(REFACTORING_NAME).run(() -> replaceAllAndDeleteImport(referenceElements, null, staticStatement));
     project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(REFACTORING_ID, null);
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME;
+  }
 }
index 28562cccd8ac733ad7050cd4f15a2a1987c01355..ac02af400e33a97a964af85061a818aca96ba42b 100644 (file)
@@ -97,7 +97,7 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
       if (!InlineMethodHandler.isThisReference(reference)) {
         if (element instanceof PsiMethod && reference != null) {
           final PsiElement referenceElement = reference.getElement();
-          return referenceElement != null && !PsiTreeUtil.isAncestor(((PsiMethod)element).getContainingClass(), referenceElement, false);
+          return !PsiTreeUtil.isAncestor(((PsiMethod)element).getContainingClass(), referenceElement, false);
         }
         return true;
       }
@@ -253,7 +253,7 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
     final PsiClass[] innerClasses = psiClass.getInnerClasses();
     for(PsiClass innerClass: innerClasses) {
       PsiModifierList classModifiers = innerClass.getModifierList();
-      if (classModifiers.hasModifierProperty(PsiModifier.STATIC)) {
+      if (classModifiers != null && classModifiers.hasModifierProperty(PsiModifier.STATIC)) {
         return "Class cannot be inlined because it has static inner classes";
       }
       if (!ReferencesSearch.search(innerClass, searchScope).forEach(new AllowedUsagesProcessor(psiClass))) {
@@ -310,7 +310,6 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
     boolean hasUsages = false;
     for(PsiReference reference : ReferencesSearch.search(aClass, GlobalSearchScope.projectScope(aClass.getProject()))) {
       final PsiElement element = reference.getElement();
-      if (element == null) continue;
       if (!PsiTreeUtil.isAncestor(aClass, element, false)) {
         hasUsages = true;
       }
@@ -363,7 +362,7 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
     @Override
     public boolean process(final PsiReference psiReference) {
       PsiElement element = psiReference.getElement();
-      if (element != null && PsiTreeUtil.isAncestor(myPsiElement, element.getNavigationElement(), false)) {
+      if (PsiTreeUtil.isAncestor(myPsiElement, element.getNavigationElement(), false)) {
         return true;
       }
       if (element instanceof PsiReferenceExpression) {
@@ -382,4 +381,10 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
       return false;
     }
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return "Inline to Anonymous Class";
+  }
 }
\ No newline at end of file
index 60fbecce168287cca9a4fe73cf7b290b82f9e659..b180fc1a90e90bb1dbd09f453db6eba464670c70 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiReferenceList;
 import com.intellij.psi.search.searches.DirectClassInheritorsSearch;
 import com.intellij.refactoring.inline.JavaInlineActionHandler;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
 
@@ -60,17 +61,21 @@ public class InlineSuperClassRefactoringHandler extends JavaInlineActionHandler
       final PsiElement resolve = reference.resolve();
       if (resolve == superClass) {
         final PsiElement referenceElement = reference.getElement();
-        if (referenceElement != null) {
-          final PsiElement parent = referenceElement.getParent();
-          if (parent instanceof PsiReferenceList) {
-            final PsiElement gParent = parent.getParent();
-            if (gParent instanceof PsiClass) {
-              chosen = (PsiClass)gParent;
-            }
+        final PsiElement parent = referenceElement.getParent();
+        if (parent instanceof PsiReferenceList) {
+          final PsiElement gParent = parent.getParent();
+          if (gParent instanceof PsiClass) {
+            chosen = (PsiClass)gParent;
           }
         }
       }
     }
     new InlineSuperClassRefactoringDialog(project, superClass, chosen).show();
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement element) {
+    return REFACTORING_NAME + "...";
+  }
 }
\ No newline at end of file
index 604b5d06acf823bd674e210c02559f3cf7fce3e3..34ef2f67b0afc81467f5c362dd4d23c64543039a 100644 (file)
@@ -72,16 +72,17 @@ public class JavaMoveClassesOrPackagesHandler extends MoveHandlerDelegate {
   }
 
   @Override
-  public boolean canMove(PsiElement[] elements, @Nullable PsiElement targetContainer) {
+  public boolean canMove(PsiElement[] elements, @Nullable PsiElement targetContainer, @Nullable PsiReference reference) {
     for (PsiElement element : elements) {
       if (!isPackageOrDirectory(element) && invalid4Move(element)) return false;
     }
-    return targetContainer == null || super.canMove(elements, targetContainer);
+    if (isReferenceInAnonymousClass(reference)) return false;
+    return targetContainer == null || super.canMove(elements, targetContainer, reference);
   }
 
   @Nullable
   @Override
-  public String getActionName(PsiElement[] elements) {
+  public String getActionName(@NotNull PsiElement[] elements) {
     int classCount = 0, directoryCount = 0;
     for (PsiElement element : elements) {
       if (element instanceof PsiClass) classCount++;
index d3f6f3f437462b78eeffa77232ecdec2437e4b8d..e8d6b2cc7d56a19a5d3c387bdfb0702fc08f698a 100644 (file)
@@ -49,15 +49,16 @@ public class JavaMoveFilesOrDirectoriesHandler extends MoveFilesOrDirectoriesHan
   }
 
   @Override
-  public boolean canMove(PsiElement[] elements, PsiElement targetContainer) {
-    if (elements.length > 0) {
+  public boolean canMove(PsiElement[] elements, PsiElement targetContainer, @Nullable PsiReference reference) {
+    if (reference != null) return false;
+    if (elements.length > 1) {
       final Project project = elements[0].getProject();
       final PsiElement[] adjustForMove = adjustForMove(project, elements, targetContainer);
       if (adjustForMove != null) {
-        return super.canMove(adjustForMove, targetContainer);
+        return super.canMove(adjustForMove, targetContainer, reference);
       }
     }
-    return super.canMove(elements, targetContainer);
+    return super.canMove(elements, targetContainer, reference);
   }
 
   @Override
index 803b542fb1f03c8b4074345d4979d7633304c8de..11c0f089e7519012281e19d8c8993fd4c4914280 100644 (file)
@@ -16,6 +16,8 @@
 package com.intellij.refactoring.move.moveInner;
 
 import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.lang.Language;
+import com.intellij.lang.jvm.JvmLanguage;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.editor.Editor;
@@ -30,11 +32,12 @@ import com.intellij.refactoring.move.MoveCallback;
 import com.intellij.refactoring.move.MoveHandlerDelegate;
 import com.intellij.refactoring.move.moveClassesOrPackages.JavaMoveClassesOrPackagesHandler;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class MoveInnerToUpperHandler extends MoveHandlerDelegate {
   @Override
-  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer) {
+  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) {
     if (elements.length != 1) return false;
     PsiElement element = elements [0];
     return isNonStaticInnerClass(element);
@@ -70,7 +73,12 @@ public class MoveInnerToUpperHandler extends MoveHandlerDelegate {
 
   @Nullable
   @Override
-  public String getActionName(PsiElement[] elements) {
+  public String getActionName(@NotNull PsiElement[] elements) {
     return "Move Inner Class to Upper Level...";
   }
+
+  @Override
+  public boolean supportsLanguage(@NotNull Language language) {
+    return language instanceof JvmLanguage;
+  }
 }
index c18d01e1240b03d3eba041c1a0aae8db925c5cd4..904d33be4aa039dbeea2e0fd195370fbd6b0ca23 100644 (file)
@@ -16,6 +16,8 @@
 package com.intellij.refactoring.move.moveInner;
 
 import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.lang.Language;
+import com.intellij.lang.jvm.JvmLanguage;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.editor.Editor;
@@ -31,6 +33,7 @@ import com.intellij.refactoring.move.MoveHandlerDelegate;
 import com.intellij.refactoring.move.moveClassesOrPackages.JavaMoveClassesOrPackagesHandler;
 import com.intellij.refactoring.move.moveMembers.MoveMembersHandler;
 import com.intellij.refactoring.util.RadioUpDownListener;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
@@ -38,7 +41,7 @@ import java.awt.*;
 
 public class MoveInnerToUpperOrMembersHandler extends MoveHandlerDelegate {
   @Override
-  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer) {
+  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) {
     if (elements.length != 1) return false;
     PsiElement element = elements [0];
     return isStaticInnerClass(element);
@@ -80,6 +83,17 @@ public class MoveInnerToUpperOrMembersHandler extends MoveHandlerDelegate {
     return false;
   }
 
+  @Override
+  public boolean supportsLanguage(@NotNull Language language) {
+    return language instanceof JvmLanguage;
+  }
+
+  @Nullable
+  @Override
+  public String getActionName(@NotNull PsiElement[] elements) {
+    return "Move Inner Class...";
+  }
+
   private static class SelectInnerOrMembersRefactoringDialog extends DialogWrapper {
     private JRadioButton myRbMoveInner;
     private JRadioButton myRbMoveMembers;
index 93971c6b70b0d24859e492dae783731ef8dbc32f..fe2b304025fc3161385de320227902d4ed0b8748 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.intellij.refactoring.move.moveInstanceMethod;
 
+import com.intellij.lang.Language;
+import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
@@ -22,18 +24,19 @@ import com.intellij.psi.*;
 import com.intellij.refactoring.move.MoveCallback;
 import com.intellij.refactoring.move.MoveHandlerDelegate;
 import com.intellij.refactoring.move.moveClassesOrPackages.JavaMoveClassesOrPackagesHandler;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class MoveInstanceMethodHandlerDelegate extends MoveHandlerDelegate {
   @Override
-  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer) {
+  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) {
     if (elements.length != 1) return false;
     PsiElement element = elements [0];
     if (!(element instanceof PsiMethod)) return false;
     if (element instanceof SyntheticElement) return false;
     PsiMethod method = (PsiMethod) element;
     if (method.hasModifierProperty(PsiModifier.STATIC)) return false;
-    return targetContainer == null || super.canMove(elements, targetContainer);
+    return targetContainer == null || super.canMove(elements, targetContainer, reference);
   }
 
   @Override
@@ -64,7 +67,12 @@ public class MoveInstanceMethodHandlerDelegate extends MoveHandlerDelegate {
 
   @Nullable
   @Override
-  public String getActionName(PsiElement[] elements) {
+  public String getActionName(@NotNull PsiElement[] elements) {
     return "Move Instance Method...";
   }
+
+  @Override
+  public boolean supportsLanguage(@NotNull Language language) {
+    return language == JavaLanguage.INSTANCE;
+  }
 }
index 86e60a5022dde75805002d0cdc949408206b3141..1be9edd5f0ea6821b2a50e2e624f00fad2e2e2aa 100644 (file)
  */
 package com.intellij.refactoring.move.moveMembers;
 
+import com.intellij.lang.Language;
+import com.intellij.lang.jvm.JvmLanguage;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.refactoring.move.MoveCallback;
 import com.intellij.refactoring.move.MoveHandlerDelegate;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class MoveMembersHandler extends MoveHandlerDelegate {
   @Override
-  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer) {
+  public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) {
     for(PsiElement element: elements) {
       if (!isFieldOrStaticMethod(element)) return false;
     }
-    return targetContainer == null || super.canMove(elements, targetContainer);
+    return targetContainer == null || super.canMove(elements, targetContainer, reference);
   }
 
   @Override
@@ -63,10 +66,12 @@ public class MoveMembersHandler extends MoveHandlerDelegate {
 
   @Nullable
   @Override
-  public String getActionName(PsiElement[] elements) {
-    if (elements.length == 1) {
-      return "Move Member...";
-    }
+  public String getActionName(@NotNull PsiElement[] elements) {
     return "Move Members...";
   }
+
+  @Override
+  public boolean supportsLanguage(@NotNull Language language) {
+    return language instanceof JvmLanguage;
+  }
 }
diff --git a/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/after.java.template b/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/after.java.template
deleted file mode 100644 (file)
index b852af5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class A {
-
-  // An icon for @Contract("_->null") <spot>not</spot> shown in the gutter, but still visible in the intention list
-  Object getObject() {
-    //do smth
-    return null;
-  }
-}                      ]
\ No newline at end of file
diff --git a/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/before.java.template b/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/before.java.template
deleted file mode 100644 (file)
index 4593c70..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class A {
-
-  // An icon for @Contract("_->null") shown in the gutter
-  Object getObject() {
-    //do smth
-    return null;
-  }
-}                      ]
\ No newline at end of file
diff --git a/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/description.html b/java/java-impl/src/intentionDescriptions/ToggleSourceInferredAnnotations/description.html
deleted file mode 100644 (file)
index 550d8ca..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<body>
-Enable or disable '@' gutter icon where IntelliJ IDEA has inferred @Nullable/@NotNull/@Contract annotations for source code.
-<!-- tooltip end -->
-</body>
-</html>
\ No newline at end of file
index 097fb6cf06cf524e7114ea8a3ca73ae07f97f0f3..09326f34be04ae3456c379e906e60ddc273fef9e 100644 (file)
@@ -241,8 +241,9 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
       }
 
       final JavaMethodsConflictResolver resolver = new JavaMethodsConflictResolver(argumentList, PsiUtil.getLanguageLevel(newExpression));
-      final JavaResolveResult[] result = collectStaticFactories(newExpression, resolver);
-      final PsiMethod staticFactory = result != null && result.length == 1 ? (PsiMethod)result[0].getElement() : null;
+      final List<CandidateInfo> results = collectStaticFactories(newExpression);
+      CandidateInfo result = results != null ? resolver.resolveConflict(new ArrayList<>(results)) : null;
+      final PsiMethod staticFactory = result != null ? (PsiMethod)result.getElement() : null;
       if (staticFactory == null) {
         //additional diagnostics: inference fails due to unresolved constructor
         return JavaResolveResult.EMPTY;
@@ -261,7 +262,13 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
   }
 
   @Nullable
-  public static JavaResolveResult[] collectStaticFactories(PsiNewExpression newExpression, final PsiConflictResolver... conflictResolvers) {
+  public static List<CandidateInfo> collectStaticFactories(PsiNewExpression newExpression) {
+    return CachedValuesManager.getCachedValue(newExpression,
+                                              () -> new CachedValueProvider.Result<>(collectStaticFactoriesInner(newExpression),
+                                                                                     PsiModificationTracker.MODIFICATION_COUNT));
+  }
+
+  private static List<CandidateInfo> collectStaticFactoriesInner(PsiNewExpression newExpression) {
     PsiExpressionList argumentList = newExpression.getArgumentList();
     if (argumentList == null) {
       return null;
@@ -281,7 +288,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
     }
 
     final MethodCandidatesProcessor
-      processor = new MethodCandidatesProcessor(argumentList, argumentList.getContainingFile(), conflictResolvers, candidates) {
+      processor = new MethodCandidatesProcessor(argumentList, argumentList.getContainingFile(), new PsiConflictResolver[0], candidates) {
       @Override
       protected boolean isAccepted(@NotNull PsiMethod candidate) {
         return true;
@@ -307,7 +314,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
       }
     }
 
-    return processor.getResult();
+    return processor.getResults();
   }
 
   @Nullable
index 8a0cd6b79d3a671732c2c1e74e6f57c84c1bde3c..b9e1daa9434f8bac2c9d0d7dad468bfbb1a51c54 100644 (file)
@@ -1,19 +1,5 @@
 
-/*
- * 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.
- */
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.psi.controlFlow;
 
 import com.intellij.openapi.diagnostic.Logger;
@@ -64,12 +50,12 @@ class ControlFlowImpl implements ControlFlow {
 
   @Override
   public int getStartOffset(@NotNull PsiElement element) {
-    return myElementToStartOffsetMap.get(element, -1);
+    return myElementToStartOffsetMap.get(element);
   }
 
   @Override
   public int getEndOffset(@NotNull PsiElement element) {
-    return myElementToEndOffsetMap.get(element, -1);
+    return myElementToEndOffsetMap.get(element);
   }
 
   @Override
index cd51d64c4671af63ecf1eea665c1a86c53063a78..61a2ecbb3a6e7614feff6b135eb9c4f79aaf5e80 100644 (file)
@@ -164,9 +164,6 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements
         final JavaResolveResult candidateInfo = results[i];
 
         if (genericMethodCall && PsiPolyExpressionUtil.isMethodCallPolyExpression(call, (PsiMethod)candidateInfo.getElement())) {
-          if (callParent instanceof PsiAssignmentExpression) {
-            return null;
-          }
           LOG.error("poly expression evaluation during overload resolution");
         }
 
diff --git a/java/java-tests/testData/refactoring/moveActionName/anonymousToInner.java b/java/java-tests/testData/refactoring/moveActionName/anonymousToInner.java
new file mode 100644 (file)
index 0000000..3cfda48
--- /dev/null
@@ -0,0 +1,7 @@
+class C {
+  void foo() {
+    new Ru<caret>nnable() {
+      public void run() { }
+    }.run();
+  }
+}
diff --git a/java/java-tests/testData/refactoring/moveActionName/innerClass.java b/java/java-tests/testData/refactoring/moveActionName/innerClass.java
new file mode 100644 (file)
index 0000000..29aed10
--- /dev/null
@@ -0,0 +1,4 @@
+class Foo {
+  public static class Ba<caret>r {
+  }
+}
diff --git a/java/java-tests/testData/refactoring/moveActionName/instanceMethod.java b/java/java-tests/testData/refactoring/moveActionName/instanceMethod.java
new file mode 100644 (file)
index 0000000..9b46502
--- /dev/null
@@ -0,0 +1,4 @@
+class C {
+  public void f<caret>oo() {
+  }
+}
diff --git a/java/java-tests/testData/refactoring/moveActionName/moveClass.java b/java/java-tests/testData/refactoring/moveActionName/moveClass.java
new file mode 100644 (file)
index 0000000..f51d8d3
--- /dev/null
@@ -0,0 +1,7 @@
+class C {
+  public void foo() {
+  }
+  <caret>
+  public void bar() {
+  }
+}
diff --git a/java/java-tests/testData/refactoring/moveActionName/staticMethod.java b/java/java-tests/testData/refactoring/moveActionName/staticMethod.java
new file mode 100644 (file)
index 0000000..c2d93fd
--- /dev/null
@@ -0,0 +1,5 @@
+class C {
+  public static void foo() {
+    <caret>
+  }
+}
index 260e02b78b037f9695f8039d8af16b0a266e0720..06de8839ca3c59044b434256c66c36c328a0dadf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.java.codeInsight.completion;
 
 import com.intellij.codeInsight.CodeInsightSettings;
@@ -1712,7 +1712,8 @@ public class CompletionHintsTest extends AbstractParameterInfoTestCase {
     checkResultWithInlays("class C { void m() { Character.toChars(<HINT text=\"codePoint:\"/><caret><Hint text=\",dst:\"/><Hint text=\",dstIndex:\"/>) } }");
     myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
     waitForAllAsyncStuff();
-    checkResultWithInlays("class C { void m() { Character.toChars(<hint text=\"codePoint:\"/><hint text=\",dst:\"/><hint text=\",dstIndex:\"/>) <caret>} }");
+    checkResultWithInlays(
+      "class C { void m() { Character.toChars(<hint text=\"codePoint:\"/><hint text=\",dst:\"/><hint text=\",dstIndex:\"/>)<caret> } }");
     myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD);
     waitForAllAsyncStuff();
     checkResultWithInlays("class C { void m() { Character.toChars(<Hint text=\"codePoint:\"/>, <Hint text=\"dst:\"/>, <HINT text=\"dstIndex:\"/><caret>) } }");
diff --git a/java/java-tests/testSrc/com/intellij/java/refactoring/MoveActionNameTest.kt b/java/java-tests/testSrc/com/intellij/java/refactoring/MoveActionNameTest.kt
new file mode 100644 (file)
index 0000000..93cd954
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.java.refactoring
+
+import com.intellij.JavaTestUtil
+import com.intellij.openapi.editor.ex.EditorEx
+import com.intellij.refactoring.move.MoveHandler
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+
+/**
+ * @author yole
+ */
+class MoveActionNameTest : LightCodeInsightFixtureTestCase() {
+  private val TEST_ROOT = "/refactoring/moveActionName/"
+
+  override fun getTestDataPath(): String {
+    return JavaTestUtil.getJavaTestDataPath()
+  }
+
+  fun testStaticMethod() {
+    assertEquals("Move Members...", doTest())
+  }
+
+  fun testInstanceMethod() {
+    assertEquals("Move Instance Method...", doTest())
+  }
+
+  fun testMoveClass() {
+    assertEquals("Move Class...", doTest())
+  }
+
+  fun testInnerClass() {
+    assertEquals("Move Inner Class...", doTest())
+  }
+
+  fun testAnonymousToInner() {
+    assertEquals("Convert Anonymous to Inner...", doTest())
+  }
+
+  private fun doTest(): String? {
+    myFixture.configureByFile(TEST_ROOT + getTestName(true) + ".java")
+    return MoveHandler.getActionName((myFixture.editor as EditorEx).dataContext)
+  }
+}
\ No newline at end of file
index a3bd47ac232fa762d1fe9fa37f46240d01c6c1b5..d3aef067e1d1555211692895b34b4d7f7771e642 100644 (file)
@@ -53,7 +53,7 @@ public class MoveClassAndFileTest extends LightMultiFileTestCase {
     assertEquals(1, dirs.length);
 
     final JavaMoveFilesOrDirectoriesHandler handler = new JavaMoveFilesOrDirectoriesHandler();
-    assertTrue(handler.canMove(elements, dirs[0]));
+    assertTrue(handler.canMove(elements, dirs[0], null));
     handler.doMove(getProject(), elements, dirs[0], null);
   }
 }
index 71af4e6c0ffaa9d76ed90f735888209d5aa2011e..12871196a1ab5c422ac46b512f8956d95b883ed6 100644 (file)
@@ -24,13 +24,13 @@ public class JavacMain {
 
   //private static final boolean ECLIPSE_COMPILER_SINGLE_THREADED_MODE = Boolean.parseBoolean(System.getProperty("jdt.compiler.useSingleThread", "false"));
   private static final Set<String> FILTERED_OPTIONS = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
-    "-d", "-classpath", "-cp", "-bootclasspath"
+    "-d", "-classpath", "-cp", "--class-path", "-bootclasspath", "--boot-class-path"
   )));
   private static final Set<String> FILTERED_SINGLE_OPTIONS = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
     /*javac options*/  "-verbose", "-proc:only", "-implicit:class", "-implicit:none", "-Xprefer:newer", "-Xprefer:source"
   )));
   private static final Set<String> FILE_MANAGER_EARLY_INIT_OPTIONS = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
-    "-encoding", "-extdirs", "-endorseddirs", "-processorpath", "-s", "-d", "-h"
+    "-encoding", "-extdirs", "-endorseddirs", "-processorpath", "--processor-path", "--processor-module-path", "-s", "-d", "-h"
   )));
 
   public static final String JAVA_RUNTIME_VERSION = System.getProperty("java.runtime.version");
@@ -99,7 +99,7 @@ public class JavacMain {
       if (!classpath.isEmpty()) {
         try {
           fileManager.setLocation(StandardLocation.CLASS_PATH, classpath);
-          if (!usingJavac && !isOptionSet(options, "-processorpath")) {
+          if (!usingJavac && isAnnotationProcessingEnabled(_options) && !_options.contains("-processorpath")) {
             // for non-javac file manager ensure annotation processor path defaults to classpath
             fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpath);
           }
@@ -123,7 +123,7 @@ public class JavacMain {
 
       if (!upgradeModulePath.isEmpty()) {
         try {
-          setModulePath(fileManager, "UPGRADE_MODULE_PATH", upgradeModulePath);
+          setLocation(fileManager, "UPGRADE_MODULE_PATH", upgradeModulePath);
         }
         catch (IOException e) {
           fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage());
@@ -133,7 +133,11 @@ public class JavacMain {
 
       if (!modulePath.isEmpty()) {
         try {
-          setModulePath(fileManager, "MODULE_PATH", modulePath);
+          setLocation(fileManager, "MODULE_PATH", modulePath);
+          if (isAnnotationProcessingEnabled(_options) && getLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH") == null) {
+            // default annotation processing discovery path to module path if not explicitly set
+            setLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH", modulePath);
+          }
         }
         catch (IOException e) {
           fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage());
@@ -168,9 +172,11 @@ public class JavacMain {
         }
       };
 
+      final StandardJavaFileManager fm = wrapWithCallDispatcher(fileManager);
       final JavaCompiler.CompilationTask task = compiler.getTask(
-        out, wrapWithCallDispatcher(fileManager), diagnosticConsumer, _options, null, fileManager.getJavaFileObjectsFromFiles(sources)
+        out, fm, diagnosticConsumer, _options, null, fileManager.getJavaFileObjectsFromFiles(sources)
       );
+      tryUnwrapFileManager(task, fileManager);
       for (JavaCompilerToolExtension extension : JavaCompilerToolExtension.getExtensions()) {
         try {
           extension.beforeCompileTaskExecution(compilingTool, task, _options, diagnosticConsumer);
@@ -221,13 +227,53 @@ public class JavacMain {
     return false;
   }
 
-  private static void setModulePath(JpsJavacFileManager fileManager, String option, Collection<? extends File> path) throws IOException {
-    JavaFileManager.Location location = StandardLocation.locationFor(option);
+  // Workaround for javac bug:
+  // the internal ClientCodeWrapper class may not implement some interface-declared methods
+  // which throw UnsupportedOperationException instead of delegating to our JpsFileManager instance
+  private static void tryUnwrapFileManager(JavaCompiler.CompilationTask task, JavaFileManager manager) {
+    try {
+      final Class<? extends JavaCompiler.CompilationTask> taskClass = task.getClass();
+      final Field contextField = findFiledOfType(taskClass, Class.forName("com.sun.tools.javac.util.Context", true, taskClass.getClassLoader()));
+      if (contextField != null) {
+        final Object contextObject = contextField.get(task);
+        final Method getMethod = contextObject.getClass().getMethod("get", Class.class);
+        if (getMethod.invoke(contextObject, JavaFileManager.class) != null) {
+          final Method putMethod = contextObject.getClass().getMethod("put", Class.class, Object.class);
+          putMethod.invoke(contextObject, JavaFileManager.class, null);  // must clear previous value first
+          putMethod.invoke(contextObject, JavaFileManager.class, manager);
+        }
+      }
+    }
+    catch (Throwable ignored) {
+    }
+  }
+
+  private static Field findFiledOfType(final Class<?> aClass, final Class<?> fieldType) {
+    for (Class<?> from = aClass; from != null && !Object.class.equals(from); from = from.getSuperclass()) {
+      for (Field field : from.getDeclaredFields()) {
+        if (fieldType.equals(field.getType())) {
+          if (!field.isAccessible()) {
+            field.setAccessible(true);
+          }
+          return field;
+        }
+      }
+    }
+    return null;
+  }
+
+  private static void setLocation(JpsJavacFileManager fileManager, String locationId, Iterable<? extends File> path) throws IOException {
+    JavaFileManager.Location location = StandardLocation.locationFor(locationId);
     if (location != null) { // if this option is supported
       fileManager.setLocation(location, path);
     }
   }
 
+  private static Iterable<? extends File> getLocation(JpsJavacFileManager fileManager, String locationId) {
+    final JavaFileManager.Location location = StandardLocation.locationFor(locationId);
+    return location != null? fileManager.getLocation(location) : null;
+  }
+
   // methods added to newer versions of StandardJavaFileManager interfaces have default implementations that
   // do not delegate to corresponding methods of FileManager's base implementation
   // this proxy object makes sure the calls, not implemented in our file manager, are dispatched further to the base file manager implementation
@@ -275,21 +321,7 @@ public class JavacMain {
   }
 
   private static boolean isAnnotationProcessingEnabled(final Collection<String> options) {
-    for (String option : options) {
-      if ("-proc:none".equals(option)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  private static boolean isOptionSet(final Collection<String> options, String option) {
-    for (String opt : options) {
-      if (option.equals(opt)) {
-        return true;
-      }
-    }
-    return false;
+    return !options.contains("-proc:none");
   }
 
   private static Collection<String> prepareOptions(final Collection<String> options, @NotNull JavaCompilingTool compilingTool) {
index 6eb4eaf4b9e4dcec88a41d84900a32f32ab80176..56ecc12aba5a40674a6c4a6e01f153851357da3b 100644 (file)
@@ -410,7 +410,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
       final int compilerSdkVersion = forkSdk == null ? JavaVersion.current().feature : forkSdk.getSecond();
 
       final Pair<List<String>, List<String>> vm_compilerOptions = getCompilationOptions(
-        compilerSdkVersion, context, chunk, profile, compilingTool
+        compilerSdkVersion, context, chunk, profile, hasModules, compilingTool
       );
       final List<String> vmOptions = vm_compilerOptions.first;
       final List<String> options = vm_compilerOptions.second;
@@ -730,6 +730,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
                                                                         CompileContext context,
                                                                         ModuleChunk chunk,
                                                                         @Nullable ProcessorConfigProfile profile,
+                                                                        boolean withModules,
                                                                         @NotNull JavaCompilingTool compilingTool) {
     final List<String> compilationOptions = new ArrayList<>();
     final List<String> vmOptions = new ArrayList<>();
@@ -807,7 +808,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
       vmOptions.addAll(extension.getOptions(compilingTool));
     }
 
-    addCompilationOptions(compilerSdkVersion, compilationOptions, context, chunk, profile);
+    addCompilationOptions(compilerSdkVersion, compilationOptions, context, chunk, profile, withModules);
 
     return pair(vmOptions, compilationOptions);
   }
@@ -816,13 +817,13 @@ public class JavaBuilder extends ModuleLevelBuilder {
                                            CompileContext context,
                                            ModuleChunk chunk,
                                            @Nullable ProcessorConfigProfile profile) {
-    addCompilationOptions(JavaVersion.current().feature, options, context, chunk, profile);
+    addCompilationOptions(JavaVersion.current().feature, options, context, chunk, profile, false);
   }
 
   private static void addCompilationOptions(int compilerSdkVersion,
                                             List<String> options,
                                             CompileContext context, ModuleChunk chunk,
-                                            @Nullable ProcessorConfigProfile profile) {
+                                            @Nullable ProcessorConfigProfile profile, boolean withModules) {
     if (!options.contains("-encoding")) {
       final CompilerEncodingConfiguration config = context.getProjectDescriptor().getEncodingConfiguration();
       final String encoding = config.getPreferredModuleChunkEncoding(chunk);
@@ -849,7 +850,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
       }
     }
 
-    if (addAnnotationProcessingOptions(options, profile)) {
+    if (addAnnotationProcessingOptions(options, profile, withModules)) {
       final File srcOutput = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(
         chunk.getModules().iterator().next(), chunk.containsTests(), profile
       );
@@ -864,7 +865,9 @@ public class JavaBuilder extends ModuleLevelBuilder {
   /**
    * @return true if annotation processing is enabled and corresponding options were added, false if profile is null or disabled
    */
-  public static boolean addAnnotationProcessingOptions(List<? super String> options, @Nullable AnnotationProcessingConfiguration profile) {
+  public static boolean addAnnotationProcessingOptions(List<? super String> options,
+                                                       @Nullable AnnotationProcessingConfiguration profile,
+                                                       boolean withModules) {
     if (profile == null || !profile.isEnabled()) {
       options.add("-proc:none");
       return false;
@@ -873,7 +876,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
     // configuring annotation processing
     if (!profile.isObtainProcessorsFromClasspath()) {
       final String processorsPath = profile.getProcessorPath();
-      options.add("-processorpath");
+      options.add(withModules ? "--processor-module-path" : "-processorpath");
       options.add(FileUtil.toSystemDependentName(processorsPath.trim()));
     }
 
index 51f751b98e23785658442aad67b21c7bf7cdca8d..ba11cd8583f6a6f164852fcb401b4db348859540 100644 (file)
@@ -4,16 +4,13 @@ package com.intellij.json;
 import com.intellij.json.psi.*;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiElement;
 import com.intellij.util.ObjectUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Collections;
 import java.util.List;
-import java.util.stream.Collectors;
 
 /**
  * @author Mikhail Golubev
@@ -55,22 +52,6 @@ public class JsonUtil {
     return ObjectUtils.tryCast(property.getValue(), clazz);
   }
 
-  @Nullable
-  public static List<String> getChildAsStringList(@NotNull final JsonObject object, @NotNull final String name) {
-    final JsonArray array = getPropertyValueOfType(object, name, JsonArray.class);
-    if (array != null) return array.getValueList().stream().filter(value -> value instanceof JsonStringLiteral)
-      .map(value -> StringUtil.unquoteString(value.getText())).collect(Collectors.toList());
-    return null;
-  }
-
-  @Nullable
-  public static List<String> getChildAsSingleStringOrList(@NotNull final JsonObject object, @NotNull final String name) {
-    final List<String> list = getChildAsStringList(object, name);
-    if (list != null) return list;
-    final JsonStringLiteral literal = getPropertyValueOfType(object, name, JsonStringLiteral.class);
-    return literal == null ? null : Collections.singletonList(StringUtil.unquoteString(literal.getText()));
-  }
-
   public static boolean isArrayElement(@NotNull PsiElement element) {
     return element instanceof JsonValue && element.getParent() instanceof JsonArray;
   }
index 9b95ecc7e01083a4f3cd94c837ef59f47c03ed15..f728ea2a11f23e7328a445700e78b6828deeced7 100644 (file)
@@ -13,5 +13,6 @@
     <orderEntry type="module" module-name="intellij.platform.core" />
     <orderEntry type="module" module-name="intellij.platform.projectModel" />
     <orderEntry type="module" module-name="intellij.platform.editor" exported="" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" />
   </component>
 </module>
\ No newline at end of file
index d9c8abcd2dff9d3a565a8156543f971018a507d0..f14c017095c3556b2ada38d67c59227805dcdcb9 100644 (file)
@@ -9,6 +9,7 @@ import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.CustomLoadingExtensionPointBean;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.xmlb.annotations.Tag;
+import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -19,12 +20,18 @@ public final class IntentionActionBean extends CustomLoadingExtensionPointBean {
 
   @Tag
   public String className;
+
   @Tag
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String category;
+
   @Tag
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String categoryKey;
+
   @Tag
   public String bundleName;
+
   @Tag
   public String descriptionDirectoryName;
 
index 96432cf1310b7f19b07f66e2ac4feaab3e04dd54..408527beabb82c3f31ef39681c6dc71087cc29b5 100644 (file)
@@ -68,6 +68,7 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr
    * @see #bundle
    */
   @Attribute("key")
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String key;
 
   /**
@@ -83,6 +84,7 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr
    * Non-localized display name. Use {@link #key} for I18N.
    */
   @Attribute("displayName")
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String displayName;
 
   /**
@@ -91,6 +93,7 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr
    * @see #groupBundle
    */
   @Attribute("groupKey")
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String groupKey;
 
   /**
@@ -106,6 +109,7 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr
    * Non-localized group display name. Use {@link #groupKey} for I18N.
    */
   @Attribute("groupName")
+  @Nls(capitalization = Nls.Capitalization.Sentence)
   public String groupDisplayName;
 
   /**
index 0cef140b21b48ed89afe05e580048b43f96b2696..afda4601e85022c62e9c8a7929d3a4e8a6d3dcac 100644 (file)
@@ -19,6 +19,9 @@ class CommunityLibraryLicenses {
                        libraryName: 'org.eclipse.aether:aether-api', licenseUrl: "http://www.eclipse.org/legal/epl-v10.html",
                        additionalLibraryNames: ['org.eclipse.aether:aether-impl', 'org.eclipse.aether:aether-connector-basic',
                                                 'org.eclipse.aether:aether-transport-file', 'org.eclipse.aether:aether-transport-http']),
+
+    new LibraryLicense(name: "Amazon Ion Java", libraryName: "ion", license: "Apache 2.0", url: "https://github.com/amzn/ion-java"),
+
     new LibraryLicense(name: "Android Analytics", attachedTo: "intellij.android.core", license: "Apache 2.0",
                        url: "http://source.android.com/"),
     new LibraryLicense(name: "Android Analytics Crash", libraryName: "com.android.tools.analytics-library:crash",
index 83700eb9d0733e8785ca80cb5557b793b4c4f6be..506f92775ed76999cff6ffdf581b85bfa0a72c18 100644 (file)
@@ -53,6 +53,7 @@ class CommunityRepositoryModules {
     "intellij.platform.analysis.impl",
     "intellij.platform.builtInServer.impl",
     "intellij.platform.core.impl",
+    "intellij.platform.util.ex",
     "intellij.platform.credentialStore",
     "intellij.platform.diff.impl",
     "intellij.platform.vcs.dvcs.impl",
@@ -63,6 +64,7 @@ class CommunityRepositoryModules {
     "intellij.platform.lang.impl",
     "intellij.platform.lvcs.impl",
     "intellij.platform.ide.impl",
+    "intellij.platform.objectSerializer",
     "intellij.platform.projectModel.impl",
     "intellij.platform.scriptDebugger.protocolReaderRuntime",
     "intellij.regexp",
index bca0b699b6eefdc57fc68ada9bec802714332c4b..54adeba5998b7b021dc39f39d45095f401248fcb 100644 (file)
@@ -12,5 +12,6 @@
     <orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
     <orderEntry type="module" module-name="intellij.platform.ide" />
     <orderEntry type="library" name="netty-codec-http" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.util.ex" />
   </component>
 </module>
\ No newline at end of file
index 6017819b410785d3546c1ba2b27ada16e329faad..718878a33cb1a2b1b716fe27e0e0940985163a51 100644 (file)
@@ -60,19 +60,19 @@ abstract class RestService : HttpRequestHandler() {
     const val PREFIX = "api"
 
     @JvmStatic
-    protected fun activateLastFocusedFrame() {
+    fun activateLastFocusedFrame() {
       (IdeFocusManager.getGlobalInstance().lastFocusedFrame as? Window)?.toFront()
     }
 
     @JvmStatic
-    protected fun createJsonReader(request: FullHttpRequest): JsonReader {
+    fun createJsonReader(request: FullHttpRequest): JsonReader {
       val reader = JsonReader(ByteBufInputStream(request.content()).reader())
       reader.isLenient = true
       return reader
     }
 
     @JvmStatic
-    protected fun createJsonWriter(out: OutputStream): JsonWriter {
+    fun createJsonWriter(out: OutputStream): JsonWriter {
       val writer = JsonWriter(out.writer())
       writer.setIndent("  ")
       return writer
@@ -84,12 +84,12 @@ abstract class RestService : HttpRequestHandler() {
     }
 
     @JvmStatic
-    protected fun sendOk(request: FullHttpRequest, context: ChannelHandlerContext) {
+    fun sendOk(request: FullHttpRequest, context: ChannelHandlerContext) {
       sendStatus(HttpResponseStatus.OK, HttpUtil.isKeepAlive(request), context.channel())
     }
 
     @JvmStatic
-    protected fun sendStatus(status: HttpResponseStatus, keepAlive: Boolean, channel: Channel) {
+    fun sendStatus(status: HttpResponseStatus, keepAlive: Boolean, channel: Channel) {
       val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status)
       HttpUtil.setContentLength(response, 0)
       response.addCommonHeaders()
@@ -102,13 +102,13 @@ abstract class RestService : HttpRequestHandler() {
     }
 
     @JvmStatic
-    protected fun send(byteOut: BufferExposingByteArrayOutputStream, request: HttpRequest, context: ChannelHandlerContext) {
+    fun send(byteOut: BufferExposingByteArrayOutputStream, request: HttpRequest, context: ChannelHandlerContext) {
       val response = response("application/json", Unpooled.wrappedBuffer(byteOut.internalBuffer, 0, byteOut.size()))
       sendResponse(request, context, response)
     }
 
     @JvmStatic
-    protected fun sendResponse(request: HttpRequest, context: ChannelHandlerContext, response: HttpResponse) {
+    fun sendResponse(request: HttpRequest, context: ChannelHandlerContext, response: HttpResponse) {
       response.addNoCache()
       response.headers().set("X-Frame-Options", "Deny")
       response.send(context.channel(), request)
@@ -116,18 +116,18 @@ abstract class RestService : HttpRequestHandler() {
 
     @Suppress("SameParameterValue")
     @JvmStatic
-    protected fun getStringParameter(name: String, urlDecoder: QueryStringDecoder): String? {
+    fun getStringParameter(name: String, urlDecoder: QueryStringDecoder): String? {
       return urlDecoder.parameters().get(name)?.lastOrNull()
     }
 
     @JvmStatic
-    protected fun getIntParameter(name: String, urlDecoder: QueryStringDecoder): Int {
+    fun getIntParameter(name: String, urlDecoder: QueryStringDecoder): Int {
       return StringUtilRt.parseInt(getStringParameter(name, urlDecoder).nullize(nullizeSpaces = true), -1)
     }
 
     @JvmOverloads
     @JvmStatic
-    protected fun getBooleanParameter(name: String, urlDecoder: QueryStringDecoder, defaultValue: Boolean = false): Boolean {
+    fun getBooleanParameter(name: String, urlDecoder: QueryStringDecoder, defaultValue: Boolean = false): Boolean {
       val values = urlDecoder.parameters().get(name) ?: return defaultValue
       // if just name specified, so, true
       val value = values.lastOrNull() ?: return true
index 48847932a60fb763d2338a14b93e8c05aaa1ed99..85f7b04fa5b833f526f393c26ad4567dc7da70c5 100644 (file)
@@ -23,5 +23,6 @@
     <orderEntry type="library" name="lz4-java" level="project" />
     <orderEntry type="library" scope="TEST" name="kotlin-test" level="project" />
     <orderEntry type="library" name="kotlinx-coroutines-jdk8" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" />
   </component>
 </module>
\ No newline at end of file
similarity index 79%
rename from platform/projectModel-api/src/com/intellij/openapi/project/ExternalStorageConfigurationManagerImpl.kt
rename to platform/configuration-store-impl/src/ExternalStorageConfigurationManagerImpl.kt
index 44fe9ea253d0859143cc6ce95f7f40fe242afee4..9f8307f70a919d126ca90a4fc0eebd0fb72b0b7b 100644 (file)
@@ -1,9 +1,8 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.openapi.project
 
 import com.intellij.openapi.components.BaseState
 import com.intellij.openapi.components.PersistentStateComponent
-import com.intellij.openapi.components.ServiceManager
 import com.intellij.openapi.components.State
 import com.intellij.openapi.util.ModificationTracker
 import com.intellij.util.xmlb.annotations.Property
@@ -14,7 +13,7 @@ class ExternalStorageConfiguration : BaseState() {
 }
 
 @State(name = "ExternalStorageConfigurationManager")
-class ExternalStorageConfigurationManagerImpl : PersistentStateComponent<ExternalStorageConfiguration>, ModificationTracker, ExternalStorageConfigurationManager {
+internal class ExternalStorageConfigurationManagerImpl : PersistentStateComponent<ExternalStorageConfiguration>, ModificationTracker, ExternalStorageConfigurationManager {
   private var state = ExternalStorageConfiguration()
 
   override fun getModificationCount(): Long = state.modificationCount
index 9a3fd7ff54276e85c3f8251e08b69165e561e14e..f2e9c51f0abe5931c1401328b3c63c9dd7a92455 100644 (file)
@@ -1,11 +1,4 @@
 // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
 import com.intellij.configurationStore.BaseXmlOutputter
 import com.intellij.configurationStore.getStateSpec
 import com.intellij.openapi.application.ApplicationManager
@@ -69,7 +62,7 @@ class DoNotStorePasswordTest {
   }
 
   fun check(clazz: Class<*>) {
-    if (clazz === Attribute::class.java || clazz === Element::class.java) {
+    if (clazz === Attribute::class.java || clazz === Element::class.java || clazz === java.lang.String::class.java || Map::class.java.isAssignableFrom(clazz)) {
       return
     }
 
index fb7582782706502a1e87276c5a5bd4afcdc5bffd..d65455bc7d93f1572f55908c9dc9699311783321 100644 (file)
@@ -1,18 +1,4 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.testFramework;
 
 import com.intellij.openapi.fileTypes.FileType;
@@ -20,7 +6,6 @@ import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.LocalTimeCounter;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.ByteArrayOutputStream;
@@ -34,30 +19,19 @@ import java.io.OutputStream;
 public class BinaryLightVirtualFile extends LightVirtualFileBase {
   private byte[] myContent = ArrayUtil.EMPTY_BYTE_ARRAY;
 
-  public BinaryLightVirtualFile() {
-    this("");
-  }
-
-  public BinaryLightVirtualFile(@NonNls String name) {
+  public BinaryLightVirtualFile(String name) {
     this(name, ArrayUtil.EMPTY_BYTE_ARRAY);
   }
 
-  public BinaryLightVirtualFile(@NonNls String name, @NotNull byte[] content) {
+  public BinaryLightVirtualFile(String name, @NotNull byte[] content) {
     this(name, null, content, LocalTimeCounter.currentTime());
   }
 
-  public BinaryLightVirtualFile(final String name, final FileType fileType, @NotNull byte[] content) {
+  public BinaryLightVirtualFile(String name, FileType fileType, @NotNull byte[] content) {
     this(name, fileType, content, LocalTimeCounter.currentTime());
   }
 
-  public BinaryLightVirtualFile(VirtualFile original, @NotNull byte[] content, long modificationStamp) {
-    this(original.getName(), original.getFileType(), content, modificationStamp);
-  }
-
-  public BinaryLightVirtualFile(final String name,
-                                final FileType fileType,
-                                @NotNull byte[] content,
-                                final long modificationStamp) {
+  public BinaryLightVirtualFile(String name, FileType fileType, @NotNull byte[] content, long modificationStamp) {
     super(name, fileType, modificationStamp);
     setContent(content);
   }
@@ -74,9 +48,7 @@ public class BinaryLightVirtualFile extends LightVirtualFileBase {
       @Override
       public void close() {
         setModificationStamp(newModificationStamp);
-
-        byte[] content = toByteArray();
-        setContent(content);
+        setContent(toByteArray());
       }
     }, this);
   }
@@ -87,11 +59,6 @@ public class BinaryLightVirtualFile extends LightVirtualFileBase {
     return myContent;
   }
 
-  public void setContent(Object requestor, @NotNull byte[] content, boolean fireEvent) {
-    setContent(content);
-    setModificationStamp(LocalTimeCounter.currentTime());
-  }
-
   private void setContent(@NotNull byte[] content) {
     //StringUtil.assertValidSeparators(content);
     myContent = content;
@@ -106,4 +73,4 @@ public class BinaryLightVirtualFile extends LightVirtualFileBase {
   public String toString() {
     return "BinaryLightVirtualFile: " + getPresentableUrl();
   }
-}
+}
\ No newline at end of file
index 8d24b0025e9d3d0b0daafd0e596157452fd9273e..a4801be485e93f7798176359e253ffe7af11ff1c 100644 (file)
@@ -1,18 +1,4 @@
-/*
- * 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.
- */
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.testFramework;
 
 import com.intellij.lang.Language;
@@ -22,7 +8,6 @@ import com.intellij.openapi.fileTypes.FileTypeRegistry;
 import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.LocalTimeCounter;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.*;
@@ -39,15 +24,15 @@ public class LightVirtualFile extends LightVirtualFileBase {
     this("");
   }
 
-  public LightVirtualFile(@NonNls @NotNull String name) {
+  public LightVirtualFile(@NotNull String name) {
     this(name, "");
   }
 
-  public LightVirtualFile(@NonNls @NotNull String name, @NotNull CharSequence content) {
+  public LightVirtualFile(@NotNull String name, @NotNull CharSequence content) {
     this(name, null, content, LocalTimeCounter.currentTime());
   }
 
-  public LightVirtualFile(@NotNull String name, final FileType fileType, @NotNull CharSequence text) {
+  public LightVirtualFile(@NotNull String name, FileType fileType, @NotNull CharSequence text) {
     this(name, fileType, text, LocalTimeCounter.currentTime());
   }
 
@@ -56,15 +41,15 @@ public class LightVirtualFile extends LightVirtualFileBase {
     setCharset(original.getCharset());
   }
 
-  public LightVirtualFile(@NotNull String name, final FileType fileType, @NotNull CharSequence text, final long modificationStamp) {
+  public LightVirtualFile(@NotNull String name, FileType fileType, @NotNull CharSequence text, long modificationStamp) {
     this(name, fileType, text, CharsetUtil.extractCharsetFromFileContent(null, null, fileType, text), modificationStamp);
   }
 
   public LightVirtualFile(@NotNull String name,
-                          final FileType fileType,
+                          FileType fileType,
                           @NotNull CharSequence text,
                           Charset charset,
-                          final long modificationStamp) {
+                          long modificationStamp) {
     super(name, fileType, modificationStamp);
     myContent = text;
     setCharset(charset);
index 77f7429bb1830189f5e7d4cb3572f6994798baaa..89b5ccfc12b9bfac5a3704ff92fe35ec16efd0be 100644 (file)
@@ -1,18 +1,4 @@
-/*
- * 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.
- */
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.testFramework;
 
 import com.intellij.openapi.fileTypes.FileType;
@@ -21,7 +7,6 @@ import com.intellij.openapi.vfs.NonPhysicalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileSystem;
 import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -57,7 +42,7 @@ public abstract class LightVirtualFileBase extends VirtualFile {
   }
 
   private static class MyVirtualFileSystem extends DeprecatedVirtualFileSystem implements NonPhysicalFileSystem {
-    @NonNls private static final String PROTOCOL = "mock";
+    private static final String PROTOCOL = "mock";
 
     private MyVirtualFileSystem() {
       startEventPropagation();
@@ -76,8 +61,7 @@ public abstract class LightVirtualFileBase extends VirtualFile {
     }
 
     @Override
-    public void refresh(boolean asynchronous) {
-    }
+    public void refresh(boolean asynchronous) { }
 
     @Override
     @Nullable
@@ -169,8 +153,7 @@ public abstract class LightVirtualFileBase extends VirtualFile {
   }
 
   @Override
-  public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) {
-  }
+  public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { }
 
   @Override
   public void setWritable(boolean writable) {
@@ -226,4 +209,4 @@ public abstract class LightVirtualFileBase extends VirtualFile {
     assertWritable();
     super.setBinaryContent(content, newModificationStamp, newTimeStamp, requestor);
   }
-}
+}
\ No newline at end of file
index 7a8719d0bbf7898197831ff3680f2a7ba471830a..c321eaa27cfa0a0160e7160a8db323f090071118 100644 (file)
@@ -1,18 +1,4 @@
-/*
- * Copyright 2000-2011 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.
- */
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.openapi.editor.impl;
 
 import com.intellij.openapi.editor.TextChange;
@@ -160,27 +146,6 @@ public class TextChangeImpl implements TextChange {
     setEnd(myEnd + offset);
   }
 
-  /**
-   * Shorthand for calling {@link #isWithinBounds(int, int)} with zero start offset and given length as and end offset
-   * 
-   * @param length  target length
-   * @return        {@code true} if current change is within the target bounds; {@code false} otherwise
-   */
-  public boolean isWithinBounds(int length) {
-    return isWithinBounds(0, length);
-  }
-
-  /**
-   * Allows to check if current change is within the given bounds.
-   * 
-   * @param start  target bounds start offset (inclusive)
-   * @param end    target bounds end offset (exclusive)
-   * @return       {@code true} if current change is within the target bounds; {@code false} otherwise
-   */
-  public boolean isWithinBounds(int start, int end) {
-    return myStart >= start && myEnd <= end && myStart <= myEnd;
-  }
-  
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
@@ -192,7 +157,7 @@ public class TextChangeImpl implements TextChange {
 
   @Override
   public int hashCode() {
-    int result = StringUtil.hashCode(myText);
+    int result = StringUtil.stringHashCode(myText);
     result = 31 * result + myStart;
     return 31 * result + myEnd;
   }
@@ -201,4 +166,4 @@ public class TextChangeImpl implements TextChange {
   public String toString() {
     return String.format("%d-%d: '%s'", myStart, myEnd, myText);
   }
-}
+}
\ No newline at end of file
index 3ce619a2f21b79c1b92fb093f1052db2382fb21b..3f7b40904c499dc736e53ca4b26d00018285c497 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.diff.merge
 
 import com.intellij.diff.DiffContentFactoryImpl
@@ -408,7 +408,7 @@ abstract class MergeTestBase : HeavyDiffTestCase() {
       return true
     }
 
-    override fun hashCode(): Int = StringUtil.hashCode(content)
+    override fun hashCode(): Int = StringUtil.stringHashCode(content)
 
     private data class ChangeState(private val content: CharSequence,
                                    private val starts: Trio<Int>,
@@ -425,7 +425,7 @@ abstract class MergeTestBase : HeavyDiffTestCase() {
         return true
       }
 
-      override fun hashCode(): Int = StringUtil.hashCode(content)
+      override fun hashCode(): Int = StringUtil.stringHashCode(content)
     }
   }
-}
+}
\ No newline at end of file
index 5bb6f034c8a66e3ae10fa1f5a89694c9ec2c0034..beee41826df69897c9d36b3810aa1d1569356446 100644 (file)
@@ -15,5 +15,7 @@
     <orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
     <orderEntry type="library" name="JDOM" level="project" />
     <orderEntry type="library" name="jetbrains-annotations" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" />
+    <orderEntry type="module" module-name="intellij.platform.util.ex" />
   </component>
 </module>
\ No newline at end of file
diff --git a/platform/icons/src/actions/intentionBulbGrey.svg b/platform/icons/src/actions/intentionBulbGrey.svg
new file mode 100644 (file)
index 0000000..46c814f
--- /dev/null
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+  <g fill="none" fill-rule="evenodd">
+    <rect width="6" height="1" x="5" y="12" fill="#6E6E6E"/>
+    <path fill="#6E6E6E" d="M5.5 14L10.5 14 10.5 14C10.5 14.5522847 10.0522847 15 9.5 15L6.5 15C5.94771525 15 5.5 14.5522847 5.5 14L5.5 14zM13 5.2C13 9.2 11 8.96875 11 11L5 11C5 9.03125 3 9.2 3 5.2 3 2.991 5.23878906 1 8 1 10.76125 1 13 2.99103125 13 5.2z"/>
+  </g>
+</svg>
diff --git a/platform/icons/src/actions/intentionBulbGrey_dark.svg b/platform/icons/src/actions/intentionBulbGrey_dark.svg
new file mode 100644 (file)
index 0000000..b48d699
--- /dev/null
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+  <g fill="none" fill-rule="evenodd">
+    <rect width="6" height="1" x="5" y="12" fill="#AFB1B3"/>
+    <path fill="#AFB1B3" d="M5.5 14L10.5 14 10.5 14C10.5 14.5522847 10.0522847 15 9.5 15L6.5 15C5.94771525 15 5.5 14.5522847 5.5 14L5.5 14zM13 5.2C13 9.2 11 8.96875 11 11L5 11C5 9.03125 3 9.2 3 5.2 3 2.991 5.23878906 1 8 1 10.76125 1 13 2.99103125 13 5.2z"/>
+  </g>
+</svg>
index b9bd977487b5e6cf12df2f9c25ae518279fe1d78..d3f6c50a065eb7243e3fdb1ae31788bef9c8eacf 100644 (file)
@@ -18,5 +18,7 @@
     <orderEntry type="library" scope="TEST" name="Mocks" level="project" />
     <orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
     <orderEntry type="library" scope="TEST" name="hamcrest" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.util.ex" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" exported="" />
   </component>
 </module>
\ No newline at end of file
index 18ea2205d2a9307798af58e32efd001da4b4d0d2..37ffdb43e0b4553ec3a4fb1a9ab50b76c816945e 100644 (file)
@@ -31,7 +31,7 @@ import java.util.List;
  * Completion FAQ:<p>
  *
  * Q: How do I implement code completion?<br>
- * A: Define a completion.contributor extension of type {@link CompletionContributor}.
+ * A: Define a {@code com.intellij.completion.contributor} extension of type {@link CompletionContributor}.
  * Or, if the place you want to complete in contains a {@link PsiReference}, just return the variants
  * you want to suggest from its {@link PsiReference#getVariants()} method as {@link String}s,
  * {@link PsiElement}s, or better {@link LookupElement}s.<p>
@@ -53,7 +53,7 @@ import java.util.List;
  * It's one of the item's lookup strings ({@link LookupElement#getAllLookupStrings()} that is matched against prefix matcher.<p>
  *
  * Q: How do I plug into those funny texts below the items in shown lookup?<br>
- * A: Use {@link CompletionResultSet#addLookupAdvertisement(String)} <p>
+ * A: Use {@link CompletionResultSet#addLookupAdvertisement(String)}.<p>
  *
  * Q: How do I change the text that gets shown when there are no suitable variants at all? <br>
  * A: Use {@link CompletionContributor#handleEmptyLookup(CompletionParameters, Editor)}.
@@ -86,18 +86,16 @@ import java.util.List;
  * Also there's a number of "weigher" extensions under "completion" key (see {@link CompletionWeigher}) that bubble up the most relevant
  * items. To control lookup elements order you may implement {@link CompletionWeigher} or use {@link PrioritizedLookupElement}.<br>
  * To debug the order of the completion items use '<code>Dump lookup element weights to log</code>' action when the completion lookup is
- * shown (Ctrl+Alt+Shift+W / Cmd+Alt+Shift+W), the action also copies the debug info to the the Clipboard.
- * <p>
+ * shown (Ctrl+Alt+Shift+W / Cmd+Alt+Shift+W), the action also copies the debug info to the Clipboard.<p>
  *
  * Q: Elements in the lookup are sorted in an unexpected way, the weights I provide are not honored, why?<br>
  * A: To be more responsive, when first lookup elements are produced, completion infrastructure waits for some small time
  * and then displays the lookup with whatever items are ready. After that, few the most relevant of the displayed items
  * are considered "frozen" and not re-sorted anymore, to avoid changes around the selected item that the user already sees
  * and can interact with. Even if new, more relevant items are added, they won't make it to the top of the list anymore.
- * Therefore you should try to create most relevant items as early as possible. If you can't reliably produce
+ * Therefore you should try to create the most relevant items as early as possible. If you can't reliably produce
  * most relevant items first, you could also return all your items in batch via {@link CompletionResultSet#addAllElements} to ensure
- * that this batch is all sorted and displayed together.
- * <p>
+ * that this batch is all sorted and displayed together.<p>
  *
  * Q: My completion is not working! How do I debug it?<br>
  * A: One source of common errors is that the pattern you gave to {@link #extend(CompletionType, ElementPattern, CompletionProvider)} method
@@ -108,16 +106,15 @@ import java.util.List;
  * is the 'final' consumer, it will pass your lookup elements directly to the lookup.<br>
  * If your contributor isn't even invoked, probably there was another contributor that said 'stop' to the system, and yours happened to be ordered after
  * that contributor. To test this hypothesis, put a breakpoint to
- * {@link CompletionService#getVariantsFromContributors(CompletionParameters, CompletionContributor, Consumer)},
- * to the 'return false' line.<p>
+ * {@link CompletionService#getVariantsFromContributors(CompletionParameters, CompletionContributor, PrefixMatcher, Consumer)},
+ * to the 'return' line.<p>
  *
- * Q: My completion contributor has to get its results from far away (e.g. blocking I/O or internet). How do I do that?<br>
+ * Q: My completion contributor has to get its results from far away (e.g., blocking I/O or internet). How do I do that?<br>
  * A: To avoid UI freezes, your completion thread should be cancellable at all times.
- * So it's a bad idea to do blocking requests from it directly, since it runs in a read action,
+ * So it's a bad idea to do blocking requests from it directly since it runs in a read action,
  * and if it can't do {@link ProgressManager#checkCanceled()} and therefore any attempt to type in a document will freeze the UI.
  * A common solution is to start another thread, without read action, for such blocking requests,
- * and wait for their results in completion thread. You can use {@link com.intellij.openapi.application.ex.ApplicationUtil#runWithCheckCanceled} for that.
- * <p></p>
+ * and wait for their results in completion thread. You can use {@link com.intellij.openapi.application.ex.ApplicationUtil#runWithCheckCanceled} for that.<p>
  *
  * @author peter
  */
index 65a2ec38ba1d1ff6522f7df7cb7f38c4205b61a5..2390fabba23809e932bb92dd54922ebee9f4e2b7 100644 (file)
@@ -30,12 +30,14 @@ import java.awt.event.MouseEvent;
  */
 public class NavigateAction<T extends PsiElement> extends AnAction {
   private final LineMarkerInfo<T> myInfo;
+  @Nullable private final String myOriginalActionId;
 
   public NavigateAction(@NotNull String text,
                         @NotNull LineMarkerInfo<T> info,
                         @Nullable String originalActionId) {
     super(text);
     myInfo = info;
+    myOriginalActionId = originalActionId;
     if (originalActionId != null) {
       ShortcutSet set = ActionManager.getInstance().getAction(originalActionId).getShortcutSet();
       setShortcutSet(set);
@@ -44,6 +46,7 @@ public class NavigateAction<T extends PsiElement> extends AnAction {
 
   public NavigateAction(@NotNull LineMarkerInfo<T> info) {
     myInfo = info;
+    myOriginalActionId = null;
   }
 
   @Override
@@ -63,4 +66,9 @@ public class NavigateAction<T extends PsiElement> extends AnAction {
     info.setNavigateAction(action);
     return info;
   }
+
+  @Nullable
+  public String getOriginalActionId() {
+    return myOriginalActionId;
+  }
 }
index 7bcdfdc5da5442936476555dde7c165c85791258..1f138df973ad7ee98bbb6b71db438a9cae02642a 100644 (file)
@@ -52,4 +52,9 @@ public abstract class InlineActionHandler {
   }
 
   public abstract void inlineElement(Project project, Editor editor, PsiElement element);
+
+  @Nullable
+  public String getActionName(PsiElement element) {
+    return null;
+  }
 }
index f7ef0e8586090f249bfcdaae42c5a7e3a26a446d..5ef7113f856ca80e570e9cdb836ace153f540575 100644 (file)
@@ -53,6 +53,10 @@ public interface InlineHandler {
     };
   }
 
+  default boolean canInlineElement(@NotNull PsiElement element) {
+    return true;
+  }
+
   /**
    * @param element element to be inlined
    * @param invokedOnReference true if the user invoked the refactoring on an element reference
index 5c30c2847f957d8976265494b6daf5e0be55e19c..1dd982284f23b2e00c2110b29028e9654d6ef931 100644 (file)
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import java.io.File;
 import java.util.*;
 
 public abstract class SdkType implements SdkTypeId {
@@ -63,6 +64,15 @@ public abstract class SdkType implements SdkTypeId {
 
   public abstract boolean isValidSdkHome(String path);
 
+  /**
+   * Returns the message to be shown to the user when {@link #isValidSdkHome(String)} returned false for the path.
+   */
+  public String getInvalidHomeMessage(String path) {
+    return new File(path).isDirectory()
+      ? ProjectBundle.message("sdk.configure.home.invalid.error", getPresentableName())
+      : ProjectBundle.message("sdk.configure.home.file.invalid.error", getPresentableName());
+  }
+
   @Override
   @Nullable
   public String getVersionString(@NotNull Sdk sdk) {
@@ -166,9 +176,7 @@ public abstract class SdkType implements SdkTypeId {
           if (!valid) {
             valid = isValidSdkHome(adjustSelectedSdkHome(selectedPath));
             if (!valid) {
-              String message = files[0].isDirectory()
-                               ? ProjectBundle.message("sdk.configure.home.invalid.error", getPresentableName())
-                               : ProjectBundle.message("sdk.configure.home.file.invalid.error", getPresentableName());
+              String message = getInvalidHomeMessage(selectedPath);
               throw new Exception(message);
             }
           }
diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/EditorColorSchemeDropHandler.java b/platform/lang-impl/src/com/intellij/application/options/colors/EditorColorSchemeDropHandler.java
new file mode 100644 (file)
index 0000000..eb6d224
--- /dev/null
@@ -0,0 +1,98 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.application.options.colors;
+
+import com.intellij.application.options.schemes.SchemeNameGenerator;
+import com.intellij.ide.actions.QuickChangeColorSchemeAction;
+import com.intellij.ide.dnd.FileCopyPasteUtil;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationType;
+import com.intellij.notification.Notifications;
+import com.intellij.openapi.application.ApplicationBundle;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.CustomFileDropHandler;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.editor.colors.impl.AbstractColorsScheme;
+import com.intellij.openapi.editor.colors.impl.EditorColorsSchemeImpl;
+import com.intellij.openapi.editor.colors.impl.EmptyColorScheme;
+import com.intellij.openapi.options.SchemeImportException;
+import com.intellij.openapi.project.DefaultProjectFactory;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.Alarm;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.awt.datatransfer.Transferable;
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class EditorColorSchemeDropHandler extends CustomFileDropHandler {
+  @Override
+  public boolean canHandle(@NotNull Transferable t, @Nullable Editor editor) {
+    return getColorSchemeFile(t) != null;
+  }
+
+  private static VirtualFile getColorSchemeFile(@NotNull Transferable t) {
+    List<File> list = FileCopyPasteUtil.getFileList(t);
+    final File io = list != null && list.size() == 1 ? ContainerUtil.getFirstItem(list) : null;
+    if (io == null || !StringUtil.endsWithIgnoreCase(io.getName(), ".icls")) return null;
+
+    return VfsUtil.findFileByIoFile(io, true);
+  }
+
+  @Override
+  public boolean handleDrop(@NotNull Transferable t, @Nullable Editor editor, Project project) {
+    VirtualFile file = getColorSchemeFile(t);
+    assert file != null;
+
+    if (Messages.YES == Messages.showYesNoDialog("Would you like to install and apply '" + file.getName() + "' editor color scheme?",
+                                                 "Install Color Scheme?",
+                                                 "Install",
+                                                 "Open in Editor",
+                                                 null)) {
+      try {
+        ColorSchemeImporter importer = new ColorSchemeImporter();
+        EditorColorsManager colorsManager = EditorColorsManager.getInstance();
+        List<String> names = ContainerUtil.map(colorsManager.getAllSchemes(), EditorColorsScheme::getName);
+        EditorColorsScheme imported = importer
+          .importScheme(DefaultProjectFactory.getInstance().getDefaultProject(), file, colorsManager.getGlobalScheme(),
+                        name -> {
+                          String preferredName = name != null ? name : "Unnamed";
+                          String newName = SchemeNameGenerator.getUniqueName(preferredName, candidate -> names.contains(candidate));
+                          AbstractColorsScheme newScheme = new EditorColorsSchemeImpl(EmptyColorScheme.INSTANCE);
+                          newScheme.setName(newName);
+                          newScheme.setDefaultMetaInfo(EmptyColorScheme.INSTANCE);
+                          return newScheme;
+                        });
+        if (imported != null) {
+          colorsManager.addColorsScheme(imported);
+          String message = importer.getAdditionalImportInfo(imported);
+          if (message == null) {
+            message = ApplicationBundle.message("settings.editor.scheme.import.success", file.getPresentableUrl(), imported.getName());
+          }
+
+          colorsManager.setGlobalScheme(imported);
+          Notification notification = new Notification("", "Color scheme added", message, NotificationType.INFORMATION);
+          QuickChangeColorSchemeAction.changeLafIfNecessary(imported,
+                                                            () -> new Alarm().addRequest(
+                                                              () -> Notifications.Bus.notify(notification, project), 300));
+        }
+      }
+      catch (SchemeImportException e) {
+        Logger.getInstance(getClass()).error(e);
+      }
+      return true;
+    }
+
+    return false;
+  }
+}
index 87ace2350ddb05aada70deb6f490382a8d08924a..399d59c4f0359477320a52f3d3c0af8929ed7d49 100644 (file)
@@ -2,6 +2,7 @@
 package com.intellij.application.options.editor
 
 import com.intellij.openapi.application.ApplicationBundle
+import com.intellij.openapi.application.ApplicationNamesInfo
 import com.intellij.openapi.editor.actions.CaretStopBoundary
 import com.intellij.openapi.editor.actions.CaretStopOptions
 import com.intellij.openapi.editor.actions.CaretStopOptionsTransposed
@@ -22,7 +23,7 @@ internal interface EditorCaretStopPolicyItem {
     internal inline fun <reified E> findMatchingItem(caretStopBoundary: CaretStopBoundary): E
       where E : Enum<E>,
             E : EditorCaretStopPolicyItem = enumValues<E>().find { it.caretStopBoundary == caretStopBoundary }
-                                            ?: checkNotNull(enumValues<E>().find { it.osDefault.isCurrentOsDefault })
+                                            ?: checkNotNull(enumValues<E>().find { it.osDefault.isIdeDefault })
     internal fun String.appendHint(hint: String): String =
       if (hint.isBlank()) this else "$this ($hint)"
   }
@@ -66,24 +67,28 @@ internal interface EditorCaretStopPolicyItem {
     }
   }
 
-  enum class OsDefault(val isCurrentOsDefault: Boolean = false,
-                       open val hint: String = "") {
-    UNIX(SystemInfo.isUnix,
-         hint = when {
+  enum class OsDefault(open val hint: String = "") {
+    UNIX(hint = when {
            SystemInfo.isLinux -> ApplicationBundle.message("combobox.item.hint.os.default.linux")
            SystemInfo.isMac -> ApplicationBundle.message("combobox.item.hint.os.default.mac")
            else -> ApplicationBundle.message("combobox.item.hint.os.default.unix")
          }),
-    WINDOWS(SystemInfo.isWindows,
-            hint = ApplicationBundle.message("combobox.item.hint.os.default.windows")),
+    WINDOWS(hint = ApplicationBundle.message("combobox.item.hint.os.default.windows")),
+    IDE(hint = run {
+      // Don't let long product names like "Android Studio" stretch the combobox presentation.
+      val shortProductName = ApplicationNamesInfo.getInstance().fullProductName.takeIf { it.length <= 8 } ?: "IDE"
+      ApplicationBundle.message("combobox.item.hint.ide.default", shortProductName)
+    }),
     NONE;
+
+    val isIdeDefault: Boolean get() = this == IDE
   }
 
   enum class WordBoundary(override val title: String,
                           override val caretStopBoundary: CaretStopBoundary,
                           override val osDefault: OsDefault = OsDefault.NONE) : EditorCaretStopPolicyItem {
     STICK_TO_WORD_BOUNDARIES(ApplicationBundle.message("combobox.item.stick.to.word.boundaries"), CaretStopBoundary.CURRENT,
-                             OsDefault.UNIX),
+                             OsDefault.IDE),
     JUMP_TO_WORD_START(ApplicationBundle.message("combobox.item.jump.to.word.start"), CaretStopBoundary.START,
                        OsDefault.WINDOWS),
     JUMP_TO_WORD_END(ApplicationBundle.message("combobox.item.jump.to.word.end"), CaretStopBoundary.END),
@@ -101,12 +106,13 @@ internal interface EditorCaretStopPolicyItem {
   enum class LineBoundary(override val title: String,
                           override val caretStopBoundary: CaretStopBoundary,
                           override val osDefault: OsDefault = OsDefault.NONE) : EditorCaretStopPolicyItem {
+    JUMP_TO_NEIGHBORING_LINE(ApplicationBundle.message("combobox.item.jump.to.neighboring.line"), CaretStopBoundary.NEIGHBOR,
+                             OsDefault.IDE),
     SKIP_LINE_BREAK(ApplicationBundle.message("combobox.item.proceed.to.word.boundary"), CaretStopBoundary.NONE,
                     OsDefault.UNIX),
     STOP_AT_BOTH_LINE_BOUNDARIES(ApplicationBundle.message("combobox.item.stop.at.both.line.ends"), CaretStopBoundary.BOTH,
                                  OsDefault.WINDOWS),
     STAY_ON_CURRENT_LINE(ApplicationBundle.message("combobox.item.stay.on.current.line"), CaretStopBoundary.CURRENT),
-    JUMP_TO_NEIGHBORING_LINE(ApplicationBundle.message("combobox.item.jump.to.neighboring.line"), CaretStopBoundary.NEIGHBOR),
     JUMP_TO_LINE_START(ApplicationBundle.message("combobox.item.stop.at.line.start"), CaretStopBoundary.START),
     JUMP_TO_LINE_END(ApplicationBundle.message("combobox.item.stop.at.line.end"), CaretStopBoundary.END);
 
index 9ee99c041b4b46decfa91b5b21512daf05c046b6..9ffea07ee66ed888f628df067745ea99c67b85fd 100644 (file)
@@ -159,7 +159,7 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
       if (lastWasOsDefault && !isOsDefault) model.addElement(null);
       lastWasOsDefault = isOsDefault;
 
-      final int insertionIndex = item.getOsDefault().isCurrentOsDefault() ? 0 : model.getSize();
+      final int insertionIndex = item.getOsDefault().isIdeDefault() ? 0 : model.getSize();
       model.insertElementAt(item, insertionIndex);
     }
 
index ac070941139b0b7c9173969942af9f016427b2ec..e96968195c15e6334e8fa45ae778f697e442ea3c 100644 (file)
@@ -116,8 +116,6 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, C
 
   public boolean SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO;
 
-  public boolean SHOW_SOURCE_INFERRED_ANNOTATIONS = true;
-
   @OptionTag("SMART_BACKSPACE") // explicit name makes it work also for obfuscated private field's name
   private int SMART_BACKSPACE = SmartBackspaceMode.AUTOINDENT.ordinal();
 
index b4cac6b5deed9adb9d7186ccbc2ace1a6ab6c11b..2e4927f996965d9381850668dd5359ff530a41e6 100644 (file)
@@ -48,7 +48,7 @@ public class DaemonTooltipUtil {
                                       @NotNull Editor editor,
                                       final int defaultOffset,
                                       final int currentWidth) {
-    showInfoTooltip(info, editor, defaultOffset, currentWidth, false);
+    showInfoTooltip(info, editor, defaultOffset, currentWidth, false, false);
   }
   
 
@@ -56,7 +56,8 @@ public class DaemonTooltipUtil {
                               @NotNull Editor editor,
                               final int defaultOffset,
                               final int currentWidth,
-                              final boolean requestFocus) {
+                              final boolean requestFocus,
+                              final boolean showImmediately) {
     String text = info.getToolTip();
     if (text == null) return;
     Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
@@ -85,8 +86,8 @@ public class DaemonTooltipUtil {
       .setAwtTooltip(true)
       .setHighlighterType(true)
       .setRequestFocus(requestFocus)
-      .setCalloutShift(editor.getLineHeight() / 2 - 1);
-
+      .setCalloutShift(editor.getLineHeight() / 2 - 1)
+      .setShowImmediately(showImmediately);
 
     TooltipAction action = TooltipActionProvider.calcTooltipAction(info, editor);
     ErrorStripTooltipRendererProvider provider = ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider();
index 187a7e4d2cc667ab95794c746c4c11a98be71e8d..bf12a9a4ae9dd46e534c75e54d3f5bf5224425ba 100644 (file)
@@ -11,6 +11,7 @@ import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.editor.*;
 import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
@@ -43,6 +44,10 @@ public class GotoNextErrorHandler implements CodeInsightActionHandler {
       HighlightInfo infoToGo = findInfo(project, editor, caretOffset, minSeverity);
       if (infoToGo != null) {
         navigateToError(project, editor, infoToGo);
+        if (Registry.is("error.navigation.show.tooltip")) {
+          DaemonTooltipUtil.showInfoTooltip(infoToGo, editor, editor.getCaretModel().getOffset(), 0, false, true);
+        }
+
         return;
       }
     }
index 0b0dcaebddc5267076d0282086d5aa85cc45fdba..3172fd2dd93a6a2855b198f87e63a4f14dea594c 100644 (file)
@@ -38,7 +38,7 @@ public class ShowErrorDescriptionHandler implements CodeInsightActionHandler {
     DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project);
     HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(editor.getDocument(), offset, false);
     if (info != null) {
-      DaemonTooltipUtil.showInfoTooltip(info, editor, editor.getCaretModel().getOffset(), myWidth, myRequestFocus);
+      DaemonTooltipUtil.showInfoTooltip(info, editor, editor.getCaretModel().getOffset(), myWidth, myRequestFocus, true);
     }
   }
 
index a77aec50a48ef6da45af6236ec626ef424201f49..dee65e1dbc28c7ad6bb0c63cd95504ec5352ce98 100644 (file)
@@ -968,6 +968,8 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
   private String decorate(String text) {
     text = StringUtil.replaceIgnoreCase(text, "</html>", "");
     text = StringUtil.replaceIgnoreCase(text, "</body>", "");
+    text = StringUtil.replaceIgnoreCase(text, DocumentationMarkup.SECTIONS_START + DocumentationMarkup.SECTIONS_END, "");
+    text = StringUtil.replaceIgnoreCase(text, DocumentationMarkup.SECTIONS_START + "<p>" + DocumentationMarkup.SECTIONS_END, "");
     boolean hasContent = text.contains(DocumentationMarkup.CONTENT_START);
     if (!hasContent) {
       if (!text.contains(DocumentationMarkup.DEFINITION_START)) {
index 5821dd036c6a47571493807011c0b59dcb80ddd9..66c573ea8b55a791cb0b12c3985577d42035838c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2019 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,7 +20,7 @@ import com.intellij.psi.PsiElement;
 
 /**
  * @author Maxim.Mossienko
- * Use {@link com.intellij.codeInsight.lookup.LookupElementBuilder}
+ * @deprecated use {@link LookupElementBuilder}
  */
 @Deprecated
 public interface LookupValueWithPsiElement {
index 533cd925e5672d862703306d747ba618555c3482..0a69ddf5b7d7e5dbf835c9b037dfdfdf5ebd949d 100644 (file)
@@ -19,10 +19,16 @@ package com.intellij.codeInsight.navigation;
 import com.intellij.codeInsight.CodeInsightBundle;
 import com.intellij.codeInsight.ContainerProvider;
 import com.intellij.codeInsight.TargetElementUtil;
+import com.intellij.codeInsight.daemon.GutterMark;
+import com.intellij.codeInsight.daemon.LineMarkerInfo;
+import com.intellij.codeInsight.daemon.NavigateAction;
 import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction;
 import com.intellij.navigation.ItemPresentation;
 import com.intellij.navigation.NavigationItem;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.text.StringUtil;
@@ -36,8 +42,10 @@ import com.intellij.util.Consumer;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.List;
 import java.util.function.Function;
 
 public class GotoImplementationHandler extends GotoTargetHandler {
@@ -51,6 +59,12 @@ public class GotoImplementationHandler extends GotoTargetHandler {
   public GotoData getSourceAndTargetElements(@NotNull Editor editor, PsiFile file) {
     int offset = editor.getCaretModel().getOffset();
     PsiElement source = TargetElementUtil.getInstance().findTargetElement(editor, ImplementationSearcher.getFlags(), offset);
+    if (source == null) {
+      offset = tryGetNavigationSourceOffsetFromGutterIcon(editor, IdeActions.ACTION_GOTO_IMPLEMENTATION);
+      if (offset >= 0) {
+        source = TargetElementUtil.getInstance().findTargetElement(editor, ImplementationSearcher.getFlags(), offset);
+      }
+    }
     if (source == null) return null;
     return createDataForSource(editor, offset, source);
   }
@@ -84,6 +98,27 @@ public class GotoImplementationHandler extends GotoTargetHandler {
     return gotoData;
   }
 
+  public static int tryGetNavigationSourceOffsetFromGutterIcon(@NotNull Editor editor, String actionId) {
+    int line = editor.getCaretModel().getVisualPosition().line;
+    List<GutterMark> renderers = ((EditorGutterComponentEx)editor.getGutter()).getGutterRenderers(line);
+    if (renderers != null) {
+      List<PsiElement> elementCandidates = new ArrayList<>();
+      for (GutterMark renderer : renderers) {
+        if (renderer instanceof LineMarkerInfo.LineMarkerGutterIconRenderer) {
+          LineMarkerInfo.LineMarkerGutterIconRenderer lineMarkerRenderer = (LineMarkerInfo.LineMarkerGutterIconRenderer)renderer;
+          AnAction clickAction = ((LineMarkerInfo.LineMarkerGutterIconRenderer)renderer).getClickAction();
+          if (clickAction instanceof NavigateAction && actionId.equals(((NavigateAction)clickAction).getOriginalActionId())) {
+            elementCandidates.add(lineMarkerRenderer.getLineMarkerInfo().getElement());
+          }
+        }
+      }
+      if (elementCandidates.size() == 1) {
+        return elementCandidates.iterator().next().getTextRange().getStartOffset();
+      }
+    }
+    return -1;
+  }
+
   @Override
   protected void chooseFromAmbiguousSources(Editor editor, PsiFile file, Consumer<? super GotoData> successCallback) {
     int offset = editor.getCaretModel().getOffset();
index 6d01e6141016a2dded9ed3b0237d03f834cc5b0e..00034b7c899d87f66c27bc1421ba13a98fb8481b 100644 (file)
@@ -21,8 +21,8 @@ import com.intellij.openapi.ui.panel.PanelGridBuilder;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.ui.popup.ListPopup;
 import com.intellij.ui.AnActionButton;
-import com.intellij.ui.ColoredListCellRenderer;
 import com.intellij.ui.ListUtil;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.ui.ToolbarDecorator;
 import com.intellij.ui.components.JBCheckBox;
 import com.intellij.ui.components.JBList;
@@ -78,17 +78,7 @@ public abstract class PostfixTemplateEditorBase<Condition extends PostfixTemplat
 
     myExpressionTypesListModel = JBList.createDefaultListModel();
     myExpressionTypesList = new JBList<>(myExpressionTypesListModel);
-    myExpressionTypesList.setCellRenderer(new ColoredListCellRenderer<PostfixTemplateExpressionCondition>() {
-
-      @Override
-      protected void customizeCellRenderer(@NotNull JList<? extends PostfixTemplateExpressionCondition> list,
-                                           PostfixTemplateExpressionCondition value,
-                                           int index,
-                                           boolean selected,
-                                           boolean hasFocus) {
-        append(value.getPresentableName());
-      }
-    });
+    myExpressionTypesList.setCellRenderer(SimpleListCellRenderer.create("", PostfixTemplateExpressionCondition::getPresentableName));
 
     PanelGridBuilder grid = UI.PanelFactory.grid().resize();
     if (showExpressionTypes) {
index e4b591de441704e913b0e490975f44f64f9f50a3..32d59f27c0a016b16a56042747dcf3d04d749f03 100644 (file)
@@ -29,7 +29,7 @@ import java.util.Map;
 
 public class CompoundRunConfigurationSettingsEditor extends SettingsEditor<CompoundRunConfiguration> {
   private final Project myProject;
-  private final JBList myList;
+  private final JBList<Pair<RunConfiguration, ExecutionTarget>> myList;
   private final RunManagerImpl myRunManager;
   private final SortedListModel<Pair<RunConfiguration, ExecutionTarget>> myModel;
   private CompoundRunConfiguration mySnapshot;
@@ -38,17 +38,11 @@ public class CompoundRunConfigurationSettingsEditor extends SettingsEditor<Compo
     myProject = project;
     myRunManager = RunManagerImpl.getInstanceImpl(project);
     myModel = new SortedListModel<>((o1, o2) -> CompoundRunConfiguration.COMPARATOR.compare(o1.first, o2.first));
-    myList = new JBList(myModel);
-    myList.setCellRenderer(new ColoredListCellRenderer() {
-      @Override
-      protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
-        RunConfiguration configuration = myModel.get(index).first;
-        ExecutionTarget target = myModel.get(index).second;
-
-        setIcon(configuration.getType().getIcon());
-        append(ConfigurationSelectionUtil.getDisplayText(configuration, target));
-      }
-    });
+    myList = new JBList<>(myModel);
+    myList.setCellRenderer(SimpleListCellRenderer.create((label, value, index) -> {
+      label.setIcon(value.first.getType().getIcon());
+      label.setText(ConfigurationSelectionUtil.getDisplayText(value.first, value.second));
+    }));
     myList.setVisibleRowCount(15);
   }
 
index 8a96d2971048dbfe9e0d6235b1b9512075799f58..1e0f6e054c3708bac04ed823b431e115753e9f8b 100644 (file)
@@ -14,9 +14,8 @@ import com.intellij.execution.ui.AdjustingTabSettingsEditor;
 import com.intellij.openapi.options.*;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Pair;
-import com.intellij.ui.ColoredListCellRenderer;
 import com.intellij.ui.ScrollingUtil;
-import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.ui.components.JBScrollPane;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.Convertor;
@@ -236,14 +235,10 @@ public class ConfigurationSettingsEditor extends CompositeSettingsEditor<RunnerA
         }
       });
       updateRunnerComponent();
-      myRunnersList.setCellRenderer(new ColoredListCellRenderer<Executor>() {
-        @Override
-        protected void customizeCellRenderer(@NotNull JList<? extends Executor> list, Executor value, int index, boolean selected, boolean hasFocus) {
-          setIcon(value.getIcon());
-          append(value.getId(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
-        }
-      });
-
+      myRunnersList.setCellRenderer(SimpleListCellRenderer.create((label, value, index) -> {
+        label.setIcon(value.getIcon());
+        label.setText(value.getId());
+      }));
       myScrollPane.setBorder(JBUI.Borders.empty());
       myScrollPane.setViewportBorder(JBUI.Borders.empty());
     }
index c281198b9c4d04b263c8a5dc7431ceffabbd0ffd..2f37ef6c3b17c2bd85d22a536b240729f71bd54a 100644 (file)
@@ -279,19 +279,16 @@ final class ProjectStartupConfigurable implements SearchableConfigurable, Config
     }
     final JBPopup popup = JBPopupFactory.getInstance()
       .createPopupChooserBuilder(wrappers)
-      .setRenderer(new ColoredListCellRenderer<ChooseRunConfigurationPopup.ItemWrapper>() {
-        @Override
-        protected void customizeCellRenderer(@NotNull JList<? extends ChooseRunConfigurationPopup.ItemWrapper> list,
-                                             ChooseRunConfigurationPopup.ItemWrapper value, int index, boolean selected, boolean hasFocus) {
-          setIcon(value.getIcon());
-          append(value.getText());
-        }
-      })
+      .setRenderer(SimpleListCellRenderer.<ChooseRunConfigurationPopup.ItemWrapper>create((label, value, index) -> {
+        label.setIcon(value.getIcon());
+        label.setText(value.getText());
+      }))
       .setItemChosenCallback((at) -> {
         if (at.getValue() instanceof RunnerAndConfigurationSettings) {
           final RunnerAndConfigurationSettings added = (RunnerAndConfigurationSettings)at.getValue();
           addConfiguration(added);
-        } else {
+        }
+        else {
           at.perform(myProject, executor, button.getDataContext());
         }
       })
index e7313b152d5af62ed8af91e39f9475a51838a60b..a6e126408f57a0fc8820098d36d05bd7a0ec535b 100644 (file)
@@ -4,10 +4,15 @@ package com.intellij.find.impl;
 import com.intellij.find.FindBundle;
 import com.intellij.find.FindModel;
 import com.intellij.find.FindSettings;
+import com.intellij.lang.IdeLanguageCustomization;
+import com.intellij.lang.Language;
 import com.intellij.openapi.components.*;
+import com.intellij.openapi.fileTypes.ExtensionFileNameMatcher;
+import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.ArrayUtil;
-import com.intellij.util.PlatformUtils;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.JBIterable;
 import com.intellij.util.xmlb.XmlSerializerUtil;
 import com.intellij.util.xmlb.annotations.Property;
 import com.intellij.util.xmlb.annotations.Transient;
@@ -16,7 +21,9 @@ import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 
 @State(name = "FindSettings", storages = @Storage("find.xml"))
 public class FindSettingsImpl extends FindSettings implements PersistentStateComponent<FindSettingsImpl> {
@@ -29,26 +36,24 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
   private static final String DEFAULT_SEARCH_SCOPE = FindBundle.message("find.scope.all.project.classes");
 
   public FindSettingsImpl() {
-    recentFileMasks.add("*.properties");
-    recentFileMasks.add("*.html");
-    recentFileMasks.add("*.jsp");
-    recentFileMasks.add("*.xml");
-    recentFileMasks.add("*.java");
-    recentFileMasks.add("*.js");
-    recentFileMasks.add("*.as");
-    recentFileMasks.add("*.css");
-    recentFileMasks.add("*.mxml");
-    if (PlatformUtils.isPyCharm()) {
-      recentFileMasks.add("*.py");
+    Set<String> extensions = JBIterable.from(IdeLanguageCustomization.getInstance().getPrimaryIdeLanguages())
+      .filterMap(Language::getAssociatedFileType)
+      .flatten(o -> JBIterable.of(o.getDefaultExtension())
+        .append(JBIterable.from(FileTypeManager.getInstance().getAssociations(o))
+                  .filter(ExtensionFileNameMatcher.class)
+                  .filterMap(ExtensionFileNameMatcher::getExtension)))
+      .addAllTo(new LinkedHashSet<>());
+    if (extensions.contains("java")) {
+      extensions.add("properties");
+      extensions.add("jsp");
     }
-    else if (PlatformUtils.isRubyMine()) {
-      recentFileMasks.add("*.rb");
+    if (!extensions.contains("sql")) {
+      extensions.add("xml");
+      extensions.add("html");
+      extensions.add("css");
     }
-    else if (PlatformUtils.isPhpStorm()) {
-      recentFileMasks.add("*.php");
-    }
-    else if (PlatformUtils.isDataGrip()) {
-      recentFileMasks.add("*.sql");
+    for (String ext : ContainerUtil.reverse(new ArrayList<>(extensions))) {
+      recentFileMasks.add("*." + ext);
     }
   }
 
index e9d00def29e59edef809f5fa7fc7d20add30fe2c..404961cf5b60b1672f6938db2b6c147bf6d02c09 100644 (file)
@@ -44,6 +44,7 @@ import com.intellij.util.ObjectUtils;
 import com.intellij.util.Processor;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.indexing.FindSymbolParameters;
+import com.intellij.util.ui.JBUI;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -396,7 +397,23 @@ public abstract class AbstractGotoSEContributor implements SearchEverywhereContr
       JComponent button = e.getPresentation().getClientProperty(CustomComponentAction.COMPONENT_KEY);
       if (button == null || !button.isValid()) return;
       JList<ScopeDescriptor> fakeList = new JBList<>();
-      ListCellRenderer<ScopeDescriptor> renderer = ScopeChooserCombo.createDefaultRenderer();
+      ListCellRenderer<ScopeDescriptor> renderer = new ListCellRenderer<ScopeDescriptor>() {
+        final ListCellRenderer<ScopeDescriptor> delegate = ScopeChooserCombo.createDefaultRenderer();
+        @Override
+        public Component getListCellRendererComponent(JList<? extends ScopeDescriptor> list,
+                                                      ScopeDescriptor value,
+                                                      int index,
+                                                      boolean isSelected,
+                                                      boolean cellHasFocus) {
+          // copied from DarculaJBPopupComboPopup.customizeListRendererComponent()
+          Component component = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+          if (component instanceof JComponent &&
+              !(component instanceof JSeparator || component instanceof TitledSeparator)) {
+            ((JComponent)component).setBorder(JBUI.Borders.empty(2, 8));
+          }
+          return component;
+        }
+      };
       List<ScopeDescriptor> items = new ArrayList<>();
       ScopeChooserCombo.processScopes(e.getRequiredData(CommonDataKeys.PROJECT),
                                       e.getDataContext(),
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateDefaultExtension.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateDefaultExtension.java
deleted file mode 100644 (file)
index bb79568..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-package com.intellij.ide.fileTemplates;
-
-import com.intellij.util.xmlb.annotations.Attribute;
-import com.intellij.openapi.extensions.ExtensionPointName;
-
-/**
- * @author yole
- */
-public class FileTemplateDefaultExtension {
-  public static final ExtensionPointName<FileTemplateDefaultExtension> EP_NAME = ExtensionPointName.create("com.intellij.fileTemplateDefaultExtension");
-
-  @Attribute("value")
-  public String value;
-}
index f4076920c1852f3de216cc43a173b1de0ff873ed..3590bcab5e45251ee4f62411c0e02044553ae771 100644 (file)
@@ -10,23 +10,28 @@ import com.intellij.icons.AllIcons;
 import com.intellij.ide.IdeBundle;
 import com.intellij.ide.fileTemplates.*;
 import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.lang.IdeLanguageCustomization;
+import com.intellij.lang.Language;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.options.*;
+import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.ui.Splitter;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.ScrollPaneFactory;
 import com.intellij.ui.TabbedPaneWrapper;
 import com.intellij.ui.border.CustomLineBorder;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.PlatformIcons;
-import com.intellij.util.PlatformUtils;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.JBIterable;
 import com.intellij.util.ui.JBUI;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -60,11 +65,6 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
     public Configurable createConfigurable() {
       return new AllFileTemplatesConfigurable(myProject);
     }
-
-    @Override
-    public boolean canCreateConfigurable() {
-      return !PlatformUtils.isDataGrip();
-    }
   }
 
   private final Project myProject;
@@ -105,12 +105,11 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
   }
 
   private void onAdd() {
-    String ext = "java";
-    final List<FileTemplateDefaultExtension> defaultExtensions = FileTemplateDefaultExtension.EP_NAME.getExtensionList();
-    if (!defaultExtensions.isEmpty()) {
-      ext = defaultExtensions.get(0).value;
-    }
-    createTemplate(IdeBundle.message("template.unnamed"), ext, "");
+    String ext = JBIterable.from(IdeLanguageCustomization.getInstance().getPrimaryIdeLanguages())
+      .filterMap(Language::getAssociatedFileType)
+      .filterMap(FileType::getDefaultExtension)
+      .first();
+    createTemplate(IdeBundle.message("template.unnamed"), StringUtil.notNullize(ext, "txt"), "");
   }
 
   @NotNull
@@ -252,7 +251,7 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
     myTabbedPane.addChangeListener(__ -> onTabChanged());
 
     DefaultActionGroup group = new DefaultActionGroup();
-    AnAction removeAction = new AnAction(IdeBundle.message("action.remove.template"), null, AllIcons.General.Remove) {
+    AnAction removeAction = new DumbAwareAction(IdeBundle.message("action.remove.template"), null, AllIcons.General.Remove) {
       @Override
       public void actionPerformed(@NotNull AnActionEvent e) {
         onRemove();
@@ -268,7 +267,7 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
         e.getPresentation().setEnabled(selectedItem != null && !isInternalTemplate(selectedItem.getName(), myCurrentTab.getTitle()));
       }
     };
-    AnAction addAction = new AnAction(IdeBundle.message("action.create.template"), null, AllIcons.General.Add) {
+    AnAction addAction = new DumbAwareAction(IdeBundle.message("action.create.template"), null, AllIcons.General.Add) {
       @Override
       public void actionPerformed(@NotNull AnActionEvent e) {
         onAdd();
@@ -279,7 +278,7 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
         e.getPresentation().setEnabled(!(myCurrentTab == myCodeTemplatesList || myCurrentTab == myOtherTemplatesList));
       }
     };
-    AnAction cloneAction = new AnAction(IdeBundle.message("action.copy.template"), null, PlatformIcons.COPY_ICON) {
+    AnAction cloneAction = new DumbAwareAction(IdeBundle.message("action.copy.template"), null, PlatformIcons.COPY_ICON) {
       @Override
       public void actionPerformed(@NotNull AnActionEvent e) {
         onClone();
@@ -292,7 +291,7 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
                                        && myCurrentTab.getSelectedTemplate() != null);
       }
     };
-    AnAction resetAction = new AnAction(IdeBundle.message("action.reset.to.default"), null, AllIcons.Actions.Rollback) {
+    AnAction resetAction = new DumbAwareAction(IdeBundle.message("action.reset.to.default"), null, AllIcons.Actions.Rollback) {
       @Override
       public void actionPerformed(@NotNull AnActionEvent e) {
         onReset();
@@ -473,6 +472,7 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
     myTemplatesList.init(getTemplates(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY));
     myIncludesList.init(getTemplates(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY));
     myCodeTemplatesList.init(getTemplates(FileTemplateManager.CODE_TEMPLATES_CATEGORY));
+    myTabbedPane.setEnabledAt(2, !myCodeTemplatesList.myTemplates.isEmpty());
     if (myOtherTemplatesList != null) {
       myOtherTemplatesList.init(getTemplates(FileTemplateManager.J2EE_TEMPLATES_CATEGORY));
     }
@@ -657,13 +657,19 @@ public final class AllFileTemplatesConfigurable implements SearchableConfigurabl
       if (!myChangesCache.containsKey(myScheme)) {
         Map<String, FileTemplate[]> templates = new HashMap<>();
         FileTemplate[] allTemplates = myTemplatesList.getTemplates();
-        templates.put(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, ContainerUtil.filter(allTemplates,
-                                                                       template -> !myInternalTemplateNames.contains(template.getName())).toArray(FileTemplate.EMPTY_ARRAY));
-        templates.put(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, ContainerUtil.filter(allTemplates,
-                                                                        template -> myInternalTemplateNames.contains(template.getName())).toArray(FileTemplate.EMPTY_ARRAY));
+        templates.put(
+          FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY,
+          ContainerUtil.filter(allTemplates, template -> !myInternalTemplateNames.contains(template.getName()))
+            .toArray(FileTemplate.EMPTY_ARRAY));
+        templates.put(
+          FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY,
+          ContainerUtil.filter(allTemplates, template -> myInternalTemplateNames.contains(template.getName()))
+            .toArray(FileTemplate.EMPTY_ARRAY));
         templates.put(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY, myIncludesList.getTemplates());
         templates.put(FileTemplateManager.CODE_TEMPLATES_CATEGORY, myCodeTemplatesList.getTemplates());
-        templates.put(FileTemplateManager.J2EE_TEMPLATES_CATEGORY, myOtherTemplatesList == null ? FileTemplate.EMPTY_ARRAY : myOtherTemplatesList.getTemplates());
+        templates.put(
+          FileTemplateManager.J2EE_TEMPLATES_CATEGORY,
+          myOtherTemplatesList == null ? FileTemplate.EMPTY_ARRAY : myOtherTemplatesList.getTemplates());
         myChangesCache.put(myScheme, templates);
       }
     }
index f913a8eee8a339adcb6789abc38c8a8f3107c3b2..1cfba8cb31717795c839aaab09dc50917e858590 100644 (file)
@@ -19,9 +19,9 @@ package com.intellij.ide.fileTemplates.impl;
 import com.intellij.ide.fileTemplates.FileTemplate;
 import com.intellij.ide.fileTemplates.FileTemplateUtil;
 import com.intellij.ui.ListSpeedSearch;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.ui.components.JBList;
 import com.intellij.util.Function;
-import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -39,44 +39,17 @@ abstract class FileTemplateTabAsList extends FileTemplateTab {
   FileTemplateTabAsList(String title) {
     super(title);
     myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    myList.setCellRenderer(new MyListCellRenderer());
-    myList.addListSelectionListener(__ -> onTemplateSelected());
-    new ListSpeedSearch(myList, (Function<Object, String>)o -> {
-      if (o instanceof FileTemplate) {
-        return ((FileTemplate)o).getName();
+    myList.setCellRenderer(SimpleListCellRenderer.create((label, value, index) -> {
+      boolean internalTemplate = AllFileTemplatesConfigurable.isInternalTemplate(value.getName(), getTitle());
+      label.setIcon(FileTemplateUtil.getIcon(value));
+      label.setText(value.getName());
+      label.setFont(label.getFont().deriveFont(internalTemplate ? Font.BOLD : Font.PLAIN));
+      if (!value.isDefault() && myList.getSelectedIndex() != index) {
+        label.setForeground(MODIFIED_FOREGROUND);
       }
-      return null;
-    });
-  }
-
-  private class MyListCellRenderer extends DefaultListCellRenderer {
-    @Override
-    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
-      super.getListCellRendererComponent(list, value, index, isSelected, false);
-      Icon icon = null;
-      if (value instanceof FileTemplate) {
-        FileTemplate template = (FileTemplate) value;
-        icon = FileTemplateUtil.getIcon(template);
-        final boolean internalTemplate = AllFileTemplatesConfigurable.isInternalTemplate(template.getName(), getTitle());
-        if (internalTemplate) {
-          setFont(getFont().deriveFont(Font.BOLD));
-          setText(template.getName());
-        }
-        else {
-          setFont(getFont().deriveFont(Font.PLAIN));
-          setText(template.getName());
-        }
-
-        if (!template.isDefault()) {
-          if (!isSelected) {
-            setForeground(MODIFIED_FOREGROUND);
-          }
-        }
-      }
-      setIcon(icon);
-      if (isSelected) setBackground(UIUtil.getListSelectionBackground(cellHasFocus));
-      return this;
-    }
+    }));
+    myList.addListSelectionListener(__ -> onTemplateSelected());
+    new ListSpeedSearch<>(myList, (Function<FileTemplate, String>)FileTemplate::getName);
   }
 
   @Override
index de8fcde7aed84e9f262eb8b322fa0aaa29fe754b..d860318e7d977cc163b315c39f11e24d28c40d60 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.openapi.editor.richcopy.view;
 
 import com.intellij.ide.MacOSApplicationProvider;
@@ -15,15 +15,15 @@ import java.awt.datatransfer.DataFlavor;
 
 public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransferableData {
   public static final int PRIORITY = 100;
-  @NotNull public static final DataFlavor FLAVOR = new DataFlavor("text/rtf;class=java.io.InputStream", "RTF text");
+  public static final DataFlavor FLAVOR = new DataFlavor("text/rtf;class=java.io.InputStream", "RTF text");
 
-  @NotNull private static final String HEADER_PREFIX = "{\\rtf1\\ansi\\deff0";
-  @NotNull private static final String HEADER_SUFFIX = "}";
-  @NotNull private static final String TAB           = "\\tab\n";
+  private static final String HEADER_PREFIX = "{\\rtf1\\ansi\\deff0";
+  private static final String HEADER_SUFFIX = "}";
+  private static final String TAB           = "\\tab\n";
   // using undocumented way to denote line break on Mac (used e.g. by TextEdit) to resolve IDEA-165337
-  @NotNull private static final String NEW_LINE      = SystemInfo.isMac ? "\\\n" : "\\line\n";
-  @NotNull private static final String BOLD          = "\\b";
-  @NotNull private static final String ITALIC        = "\\i";
+  private static final String NEW_LINE      = SystemInfo.isMac ? "\\\n" : "\\line\n";
+  private static final String BOLD          = "\\b";
+  private static final String ITALIC        = "\\i";
 
   public RtfTransferableData(@NotNull SyntaxInfo syntaxInfo) {
     super(syntaxInfo, FLAVOR);
@@ -65,7 +65,7 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
   
   private static int[] getAdjustedColorComponents(Color color) {
     if (SystemInfo.isMac) {
-      // on Mac OS color components are expected in Apple's 'Generic RGB' color space
+      // on macOS color components are expected in Apple's 'Generic RGB' color space
       ColorSpace genericRgbSpace = MacOSApplicationProvider.getInstance().getGenericRgbColorSpace();
       if (genericRgbSpace != null) {
         float[] components = genericRgbSpace.fromRGB(color.getRGBColorComponents(null));
@@ -76,7 +76,7 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
         };
       }
     }
-    return new int[] {color.getRed(), color.getGreen(), color.getBlue()};
+    return new int[]{color.getRed(), color.getGreen(), color.getBlue()};
   }
   
   private static int colorComponentFloatToInt(float component) {
@@ -99,11 +99,9 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
   }
 
   private static class MyVisitor implements MarkupHandler {
-
     @NotNull private final StringBuilder myBuffer;
     @NotNull private final String        myRawText;
     private final int myMaxLength;
-
     private final int myDefaultBackgroundId;
     private final float myFontSize;
     private int myForegroundId = -1;
@@ -120,7 +118,7 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
     }
 
     @Override
-    public void handleText(int startOffset, int endOffset) throws Exception {
+    public void handleText(int startOffset, int endOffset) {
       myBuffer.append("\n");
       for (int i = startOffset; i < endOffset; i++) {
         char c = myRawText.charAt(i);
@@ -147,7 +145,7 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
     }
 
     @Override
-    public void handleBackground(int backgroundId) throws Exception {
+    public void handleBackground(int backgroundId) {
       if (backgroundId == myDefaultBackgroundId) {
         myBuffer.append("\\plain"); // we cannot use \chcbpat with default background id, as it doesn't work in MS Word,
                                     // and we cannot use \chcbpat0 as it doesn't work in OpenOffice
@@ -171,19 +169,19 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
     }
 
     @Override
-    public void handleForeground(int foregroundId) throws Exception {
+    public void handleForeground(int foregroundId) {
       myBuffer.append("\\cf").append(foregroundId).append('\n');
       myForegroundId = foregroundId;
     }
 
     @Override
-    public void handleFont(int fontNameId) throws Exception {
+    public void handleFont(int fontNameId) {
       myBuffer.append("\\f").append(fontNameId).append('\n');
       myFontNameId = fontNameId;
     }
 
     @Override
-    public void handleStyle(int style) throws Exception {
+    public void handleStyle(int style) {
       myBuffer.append(ITALIC);
       if ((style & Font.ITALIC) == 0) {
         myBuffer.append('0');
@@ -205,4 +203,4 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
       return true;
     }
   }
-}
+}
\ No newline at end of file
index 9011beb45db56689c5c5734fcb3fbbbe2ddc1988..bf923610a59b1aaa8bb40a14cc911ae7808af766 100644 (file)
@@ -23,8 +23,8 @@ import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.platform.ProjectTemplate;
 import com.intellij.platform.ProjectTemplatesFactory;
 import com.intellij.ui.CollectionListModel;
-import com.intellij.ui.ColoredListCellRenderer;
 import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.ui.SimpleListCellRenderer;
 import com.intellij.ui.ToolbarDecorator;
 import com.intellij.ui.components.JBList;
 import com.intellij.util.ui.JBUI;
@@ -45,7 +45,7 @@ import java.util.Arrays;
 class ManageProjectTemplatesDialog extends DialogWrapper {
 
   private final JPanel myPanel;
-  private final JBList myTemplatesList;
+  private final JBList<ProjectTemplate> myTemplatesList;
   private final JTextPane myDescriptionPane;
 
   ManageProjectTemplatesDialog() {
@@ -53,7 +53,7 @@ class ManageProjectTemplatesDialog extends DialogWrapper {
     setTitle("Manage Project Templates");
     final ProjectTemplate[] templates =
       new ArchivedTemplatesFactory().createTemplates(ProjectTemplatesFactory.CUSTOM_GROUP, new WizardContext(null, getDisposable()));
-    myTemplatesList = new JBList(new CollectionListModel<ProjectTemplate>(Arrays.asList(templates)) {
+    myTemplatesList = new JBList<>(new CollectionListModel<ProjectTemplate>(Arrays.asList(templates)) {
       @Override
       public void remove(int index) {
         ProjectTemplate template = getElementAt(index);
@@ -64,12 +64,7 @@ class ManageProjectTemplatesDialog extends DialogWrapper {
       }
     });
     myTemplatesList.setEmptyText("No user-defined project templates");
-    myTemplatesList.setCellRenderer(new ColoredListCellRenderer() {
-      @Override
-      protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
-        append(((ProjectTemplate)value).getName());
-      }
-    });
+    myTemplatesList.setCellRenderer(SimpleListCellRenderer.create("", ProjectTemplate::getName));
     myTemplatesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
       @Override
       public void valueChanged(ListSelectionEvent e) {
index 91fbb1e8013a6c995fa4e2b2db8f444fc32d5205..65ae0659355f019a44710cac8be7b8c1ab4435ef 100644 (file)
@@ -49,6 +49,16 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
                                                         @NotNull PsiFile file,
                                                         @NotNull DataContext context,
                                                         @NotNull String place) {
+    if (ActionPlaces.isPopupPlace(place)) {
+      final RefactoringActionHandler handler = getHandler(context);
+      if (handler instanceof ContextAwareActionHandler) {
+        ContextAwareActionHandler contextAwareActionHandler = (ContextAwareActionHandler)handler;
+        if (!contextAwareActionHandler.isAvailableForQuickList(editor, file, context)) {
+          return false;
+        }
+      }
+    }
+
     return isAvailableOnElementInEditorAndFile(element, editor, file, context);
   }
 
@@ -163,33 +173,18 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
         disableAction(e);
       }
       else {
-        updateActionText(e, elements);
+        updateActionText(e);
       }
     }
     else {
-      PsiElement element = e.getData(CommonDataKeys.PSI_ELEMENT);
-      Language[] languages = e.getData(LangDataKeys.CONTEXT_LANGUAGES);
-      if (element == null || !isAvailableForLanguage(element.getLanguage())) {
-        if (file == null) {
-          hideAction(e);
-          return;
-        }
-        element = getElementAtCaret(editor, file);
-      }
-
-      if (element == null || element instanceof SyntheticElement || languages == null) {
-        hideAction(e);
-        return;
-      }
-
-      boolean isVisible = ContainerUtil.find(languages, myLanguageCondition) != null;
-      if (isVisible) {
+      PsiElement element = findRefactoringTargetInEditor(dataContext);
+      if (element != null) {
         boolean isEnabled = file != null && isAvailableOnElementInEditorAndFile(element, editor, file, dataContext, e.getPlace());
         if (!isEnabled) {
           disableAction(e);
         }
         else {
-          updateActionText(e, new PsiElement[] { element });
+          updateActionText(e);
         }
       }
       else {
@@ -198,15 +193,37 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
     }
   }
 
-  private void updateActionText(AnActionEvent e, PsiElement[] elements) {
-    String actionText = getActionName(elements);
+  protected PsiElement findRefactoringTargetInEditor(DataContext dataContext) {
+    Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
+    PsiFile file = dataContext.getData(CommonDataKeys.PSI_FILE);
+    PsiElement element = dataContext.getData(CommonDataKeys.PSI_ELEMENT);
+    Language[] languages = dataContext.getData(LangDataKeys.CONTEXT_LANGUAGES);
+    if (element == null || !isAvailableForLanguage(element.getLanguage())) {
+      if (file == null || editor == null) {
+        return null;
+      }
+      element = getElementAtCaret(editor, file);
+    }
+
+    if (element == null || element instanceof SyntheticElement || languages == null) {
+      return null;
+    }
+
+    if (ContainerUtil.find(languages, myLanguageCondition) == null) {
+      return null;
+    }
+    return element;
+  }
+
+  private void updateActionText(AnActionEvent e) {
+    String actionText = getActionName(e.getDataContext());
     if (actionText != null) {
       e.getPresentation().setText(actionText);
     }
   }
 
   @Nullable
-  protected String getActionName(@NotNull PsiElement[] elements) {
+  protected String getActionName(@NotNull DataContext dataContext) {
     return null;
   }
 
@@ -223,7 +240,7 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
     return false;
   }
 
-  public static PsiElement getElementAtCaret(final Editor editor, final PsiFile file) {
+  public static PsiElement getElementAtCaret(@NotNull final Editor editor, final PsiFile file) {
     final int offset = fixCaretOffset(editor);
     PsiElement element = file.findElementAt(offset);
     if (element == null && offset == file.getTextLength()) {
@@ -236,7 +253,7 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
     return element;
   }
 
-  private static int fixCaretOffset(final Editor editor) {
+  private static int fixCaretOffset(@NotNull final Editor editor) {
     final int caret = editor.getCaretModel().getOffset();
     if (editor.getSelectionModel().hasSelection()) {
       if (caret == editor.getSelectionModel().getSelectionEnd()) {
index 6338f7798d6e53e756de118cda0a962659a74657..ac40b35131dace10931dca4bbf41a2d227b55182 100644 (file)
@@ -7,6 +7,7 @@ import com.intellij.lang.refactoring.InlineActionHandler;
 import com.intellij.lang.refactoring.InlineHandler;
 import com.intellij.lang.refactoring.InlineHandlers;
 import com.intellij.lang.refactoring.RefactoringSupportProvider;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.PsiElement;
@@ -46,9 +47,15 @@ public class InlineAction extends BasePlatformRefactoringAction {
         return true;
       }
     }
-    return InlineHandlers.getInlineHandlers(
-      editorLanguage != null ? editorLanguage :element.getLanguage()
-    ).size() > 0;
+    List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(
+      editorLanguage != null ? editorLanguage : element.getLanguage()
+    );
+    for (InlineHandler handler : handlers) {
+      if (handler.canInlineElement(element)) {
+        return true;
+      }
+    }
+    return false;
   }
 
   @Override
@@ -73,4 +80,20 @@ public class InlineAction extends BasePlatformRefactoringAction {
     }
     return InlineHandlers.getInlineHandlers(language).size() > 0;
   }
+
+  @Nullable
+  @Override
+  protected String getActionName(@NotNull DataContext dataContext) {
+    Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
+    PsiElement element = findRefactoringTargetInEditor(dataContext);
+    if (element != null && editor != null) {
+      for (InlineActionHandler handler: InlineActionHandler.EP_NAME.getExtensionList()) {
+        if (handler.isEnabledOnElement(element, editor)) {
+          return handler.getActionName(element);
+        }
+      }
+    }
+
+    return super.getActionName(dataContext);
+  }
 }
index 144449adeb76572b302f2ce55741116f2cfe1082..c9df13293cbf84d623df39af48b1deb01c778a27 100644 (file)
@@ -3,7 +3,9 @@ package com.intellij.refactoring.actions;
 
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiNamedElement;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.changeSignature.ParameterInfo;
@@ -30,6 +32,16 @@ public class IntroduceParameterObjectAction extends BaseRefactoringAction {
   }
 
   @Override
+  protected boolean isAvailableOnElementInEditorAndFile(@NotNull PsiElement element,
+                                                        @NotNull Editor editor,
+                                                        @NotNull PsiFile file,
+                                                        @NotNull DataContext context,
+                                                        @NotNull String place) {
+    final IntroduceParameterObjectDelegate delegate = IntroduceParameterObjectDelegate.findDelegate(element);
+    return delegate != null && delegate.isEnabledOn(element);
+  }
+
+  @Override
   protected RefactoringActionHandler getHandler(@NotNull DataContext context) {
     final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(context);
     if (element == null) {
index 9b03bad15f2fef0c1063950fc7f1a3d1849121eb..a26e259d03ce29aad532ba6bb3ded6401292cd02 100644 (file)
@@ -63,7 +63,7 @@ public class MoveAction extends BaseRefactoringAction {
 
   @Nullable
   @Override
-  protected String getActionName(@NotNull PsiElement[] elements) {
-    return MoveHandler.getActionName(elements);
+  protected String getActionName(@NotNull DataContext dataContext) {
+    return MoveHandler.getActionName(dataContext);
   }
 }
\ No newline at end of file
index 84861e96dad80dad77d950773d6af7b5cd912acf..a4f0e7c28adab8d2f27c261bc4e499ca8b468deb 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.psi.*;
 import com.intellij.psi.impl.file.PsiDirectoryFactory;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesHandler;
 import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import com.intellij.util.IncorrectOperationException;
@@ -372,4 +373,10 @@ public class CopyFilesOrDirectoriesHandler extends CopyHandlerDelegateBase {
     }
     return defaultTargetDirectory;
   }
+
+  @Nullable
+  @Override
+  public String getActionName(PsiElement[] elements) {
+    return MoveFilesOrDirectoriesHandler.getMoveOrCopyActionName(elements, "Copy");
+  }
 }
index a1e9a966d79c2b208e31c0fd8cbb903c0bc9a9ff..0b8c3b86d9ede8ccae18298af458966790a2156a 100644 (file)
@@ -2,25 +2,26 @@
 
 package com.intellij.refactoring.move;
 
+import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ScrollType;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiReference;
+import com.intellij.psi.*;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.refactoring.actions.BaseRefactoringAction;
 import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 public class MoveHandler implements RefactoringActionHandler {
@@ -38,40 +39,41 @@ public class MoveHandler implements RefactoringActionHandler {
       element = file;
     }
 
-    final TextRange range = element.getTextRange();
-    if (range != null) {
-      int relative = offset - range.getStartOffset();
-      final PsiReference reference = element.findReferenceAt(relative);
-      if (reference != null) {
-        final PsiElement refElement = reference.resolve();
-        if (refElement != null && tryToMoveElement(refElement, project, dataContext, reference, editor)) return;
+    PsiReference reference = findReferenceAtCaret(element, offset);
+    if (reference != null) {
+      PsiElement refElement = reference.resolve();
+      for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
+        if (delegate.tryToMove(refElement, project, dataContext, reference, editor)) {
+          return;
+        }
       }
     }
 
-    while(true){
+    List<MoveHandlerDelegate> candidateHandlers = findHandlersForLanguage(element);
+    while (true) {
       if (element == null) {
         String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("the.caret.should.be.positioned.at.the.class.method.or.field.to.be.refactored"));
         CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);
         return;
       }
 
-      if (tryToMoveElement(element, project, dataContext, null, editor)) {
-        return;
+      for(MoveHandlerDelegate delegate: candidateHandlers) {
+        if (delegate.tryToMove(element, project, dataContext, null, editor)) {
+          return;
+        }
       }
 
       element = element.getParent();
     }
   }
 
-  private static boolean tryToMoveElement(final PsiElement element, final Project project, final DataContext dataContext,
-                                          final PsiReference reference, final Editor editor) {
-    for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
-      if (delegate.tryToMove(element, project, dataContext, reference, editor)) {
-        return true;
-      }
+  private static PsiReference findReferenceAtCaret(PsiElement element, int caretOffset) {
+    final TextRange range = element.getTextRange();
+    if (range != null) {
+      int relative = caretOffset - range.getStartOffset();
+      return element.findReferenceAt(relative);
     }
-
-    return false;
+    return null;
   }
 
   /**
@@ -112,7 +114,7 @@ public class MoveHandler implements RefactoringActionHandler {
     if (elements.length == 0) return;
 
     for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
-      if (delegate.canMove(elements, targetContainer)) {
+      if (delegate.canMove(elements, targetContainer, null)) {
         delegate.doMove(project, elements, delegate.adjustTargetForMove(dataContext, targetContainer), callback);
         break;
       }
@@ -126,7 +128,7 @@ public class MoveHandler implements RefactoringActionHandler {
   @Nullable
   public static PsiElement[] adjustForMove(Project project, final PsiElement[] sourceElements, final PsiElement targetElement) {
     for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
-      if (delegate.canMove(sourceElements, targetElement)) {
+      if (delegate.canMove(sourceElements, targetElement, null)) {
         return delegate.adjustForMove(project, sourceElements, targetElement);
       }
     }
@@ -138,24 +140,69 @@ public class MoveHandler implements RefactoringActionHandler {
    * target container can be null => means that container is not determined yet and must be spacify by the user
    */
   public static boolean canMove(@NotNull PsiElement[] elements, PsiElement targetContainer) {
-    for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
-      if (delegate.canMove(elements, targetContainer)) {
-        return true;
+    return findDelegate(elements, targetContainer, null) != null;
+  }
+
+  @Nullable
+  private static MoveHandlerDelegate findDelegate(@NotNull PsiElement[] elements, @Nullable PsiElement targetContainer, @Nullable PsiReference reference) {
+    for (MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
+      if (delegate.canMove(elements, targetContainer, reference)) {
+        return delegate;
       }
     }
 
-    return false;
+    return null;
   }
 
   @Nullable
-  public static String getActionName(@NotNull PsiElement[] elements) {
-    for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
-      if (delegate.canMove(elements, null)) return delegate.getActionName(elements);
+  public static String getActionName(@NotNull DataContext dataContext) {
+    Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
+    if (editor != null) {
+      Project project = dataContext.getData(CommonDataKeys.PROJECT);
+      if (project == null) return null;
+      PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
+      if (file == null) return null;
+      PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
+      if (element == null) element = file;
+
+      PsiReference reference = findReferenceAtCaret(element, editor.getCaretModel().getOffset());
+      if (reference != null) {
+        PsiElement refElement = reference.resolve();
+        MoveHandlerDelegate refDelegate = findDelegate(new PsiElement[]{refElement}, null, reference);
+        if (refDelegate != null) {
+          return refDelegate.getActionName(new PsiElement[] { refElement });
+        }
+      }
+
+      // invoke() uses regular findElementAtCaret() instead of BaseRefactoringAction.getElementAtCaret(), match it
+      List<MoveHandlerDelegate> candidateHandlers = findHandlersForLanguage(element);
+      while (element != null) {
+        PsiElement[] elementArray = {element};
+        for (MoveHandlerDelegate handler : candidateHandlers) {
+          if (handler.canMove(elementArray, null, reference)) {
+            return handler.getActionName(elementArray);
+          }
+        }
+        element = element.getParent();
+      }
+      return null;
+    }
+
+    PsiElement[] elements = BaseRefactoringAction.getPsiElementArray(dataContext);
+    List<MoveHandlerDelegate> delegates = MoveHandlerDelegate.EP_NAME.getExtensionList();
+    for(MoveHandlerDelegate delegate: delegates) {
+      if (delegate.canMove(elements, null, null)) return delegate.getActionName(elements);
     }
 
     return null;
   }
 
+  @NotNull
+  private static List<MoveHandlerDelegate> findHandlersForLanguage(@NotNull PsiElement element) {
+    return ContainerUtil.filter(MoveHandlerDelegate.EP_NAME.getExtensionList(),
+                                (delegate) -> delegate.supportsLanguage(element.getLanguage()));
+  }
+
   public static boolean isValidTarget(final PsiElement psiElement, PsiElement[] elements) {
     if (psiElement != null) {
       for(MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
index 3528cbb7a0e111d7255a44553cf4f95a00d26f23..11c5a9b110ad321c159a199600dd694ccd2ce56c 100644 (file)
 
 package com.intellij.refactoring.move;
 
+import com.intellij.lang.Language;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiReference;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Set;
@@ -32,6 +34,14 @@ import java.util.Set;
 public abstract class MoveHandlerDelegate {
   public static final ExtensionPointName<MoveHandlerDelegate> EP_NAME = ExtensionPointName.create("com.intellij.refactoring.moveHandler");
 
+  public boolean canMove(PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) {
+    return canMove(elements, targetContainer);
+  }
+
+  /**
+   * @deprecated Please overload the method with 'reference' parameter instead
+   */
+  @Deprecated
   public boolean canMove(PsiElement[] elements, @Nullable final PsiElement targetContainer) {
     return isValidTarget(targetContainer, elements);
   }
@@ -72,9 +82,12 @@ public abstract class MoveHandlerDelegate {
     return false;
   }
 
-
   @Nullable
-  public String getActionName(PsiElement[] elements) {
+  public String getActionName(@NotNull PsiElement[] elements) {
     return null;
   }
+
+  public boolean supportsLanguage(@NotNull Language language) {
+    return true;
+  }
 }
index 466b6d8d0aebccc13b67b4cba1e962b469a4859e..141674a5a43c1632438a76ac08067024bda7fa0c 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.refactoring.move.MoveCallback;
 import com.intellij.refactoring.move.MoveHandlerDelegate;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Arrays;
@@ -37,7 +38,7 @@ public class MoveFilesOrDirectoriesHandler extends MoveHandlerDelegate {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesHandler");
 
   @Override
-  public boolean canMove(final PsiElement[] elements, final PsiElement targetContainer) {
+  public boolean canMove(final PsiElement[] elements, final PsiElement targetContainer, @Nullable PsiReference reference) {
     HashSet<String> names = new HashSet<>();
     for (PsiElement element : elements) {
       if (element instanceof PsiFile) {
@@ -53,7 +54,7 @@ public class MoveFilesOrDirectoriesHandler extends MoveHandlerDelegate {
       }
     }
 
-    return super.canMove(elements, targetContainer);
+    return super.canMove(elements, targetContainer, reference);
   }
 
   @Override
@@ -110,4 +111,30 @@ public class MoveFilesOrDirectoriesHandler extends MoveHandlerDelegate {
     }
     return false;
   }
+
+  @Nullable
+  @Override
+  public String getActionName(@NotNull PsiElement[] elements) {
+    return getMoveOrCopyActionName(elements, "Move");
+  }
+
+  @NotNull
+  public static String getMoveOrCopyActionName(@NotNull PsiElement[] elements, final String verb) {
+    int fileCount = 0, directoryCount = 0;
+    for (PsiElement element : elements) {
+      if (element instanceof PsiFile) {
+        fileCount++;
+      }
+      else if (element instanceof PsiDirectory) {
+        directoryCount++;
+      }
+    }
+    if (directoryCount == 0) {
+      return fileCount == 1 ? verb + " File..." : verb + " Files...";
+    }
+    if (fileCount == 0) {
+      return directoryCount == 1 ? verb + " Directory..." : verb + " Directories...";
+    }
+    return verb + " Files and Directories...";
+  }
 }
index 6c301715659ecba20a6f646e45d216f72db3d498..2b2c590c65a207fcf9cc6d8b6ea555ea290503da 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiReference;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.util.ArrayUtil;
 import gnu.trove.THashSet;
@@ -35,8 +36,8 @@ import java.util.Set;
 
 public class MoveRelatedFilesHandler extends MoveFilesOrDirectoriesHandler {
   @Override
-  public boolean canMove(PsiElement[] elements, PsiElement targetContainer) {
-    if (!super.canMove(elements, targetContainer)) return false;
+  public boolean canMove(PsiElement[] elements, PsiElement targetContainer, @Nullable PsiReference reference) {
+    if (!super.canMove(elements, targetContainer, reference)) return false;
 
     for (PsiElement element : elements) {
       if (element instanceof PsiFile &&
diff --git a/platform/object-serializer/intellij.platform.objectSerializer.iml b/platform/object-serializer/intellij.platform.objectSerializer.iml
new file mode 100644 (file)
index 0000000..e438f77
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/testSnapshots" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
+    <orderEntry type="library" name="ion" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.util" />
+    <orderEntry type="library" name="kotlin-reflect" level="project" />
+    <orderEntry type="library" name="JDOM" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.util.ex" />
+    <orderEntry type="module" module-name="intellij.platform.core" />
+    <orderEntry type="module" module-name="intellij.platform.projectModel" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/platform/object-serializer/intellij.platform.objectSerializer.tests.iml b/platform/object-serializer/intellij.platform.objectSerializer.tests.iml
new file mode 100644 (file)
index 0000000..7f89d6a
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$/testSrc">
+      <sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" packagePrefix="com.intellij.util.serialization" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
+    <orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.testExtensions" scope="TEST" />
+    <orderEntry type="library" scope="TEST" name="assertJ" level="project" />
+    <orderEntry type="module" module-name="intellij.platform.objectSerializer" scope="TEST" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/platform/object-serializer/src/AccessorWrapperBinding.kt b/platform/object-serializer/src/AccessorWrapperBinding.kt
new file mode 100644 (file)
index 0000000..4dee322
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.util.serialization
+
+internal data class AccessorWrapperBinding(private val binding: RootBinding) : NestedBinding {
+  override fun serialize(hostObject: Any, property: MutableAccessor, context: WriteContext) {
+    write(hostObject, property, context) {
+      binding.serialize(it, context)
+    }
+  }
+
+  override fun deserialize(hostObject: Any, property: MutableAccessor, context: ReadContext) {
+    read(hostObject, property, context) {
+      binding.deserialize(context)
+    }
+  }
+}
\ No newline at end of file
diff --git a/platform/object-serializer/src/BaseBeanBinding.kt b/platform/object-serializer/src/BaseBeanBinding.kt
new file mode 100644 (file)
index 0000000..a4b3f56
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.util.serialization
+
+import java.lang.reflect.Constructor
+import kotlin.reflect.full.primaryConstructor
+import kotlin.reflect.jvm.isAccessible
+
+open class BaseBeanBinding(protected val beanClass: Class<*>) {
+  // kotlin data class constructor is never cached, because we have (and it is good) very limited number of such classes
+  @Volatile
+  private var constructor: Constructor<*>? = null
+
+  fun newInstance(): Any {
+    var constructor = constructor
+    if (constructor != null) {
+      return constructor.newInstance()
+    }
+
+    try {
+      constructor = beanClass.getDeclaredConstructor()!!
+      try {
+        constructor.isAccessible = true
+      }
+      catch (ignored: SecurityException) {
+        return beanClass.newInstance()
+      }
+
+      val instance = constructor.newInstance()
+      // cache only if constructor is valid and applicable
+      this.constructor = constructor
+      return instance
+    }
+    catch (e: RuntimeException) {
+      return createUsingKotlin(beanClass) ?: throw e
+    }
+    catch (e: NoSuchMethodException) {
+      return createUsingKotlin(beanClass) ?: throw e
+    }
+  }
+}
+
+// ReflectionUtil uses another approach to do it - unreliable because located in util module, where Kotlin cannot be used.
+// Here we use Kotlin reflection and this approach is more reliable because we are prepared for future Kotlin versions.
+private fun createUsingKotlin(clazz: Class<*>): Any? {
+  // if cannot create data class
+  val kClass = clazz.kotlin
+  val kFunction = kClass.primaryConstructor ?: kClass.constructors.first()
+  try {
+    kFunction.isAccessible = true
+  }
+  catch (ignored: SecurityException) {
+  }
+  return kFunction.callBy(emptyMap())
+}
\ No newline at end of file
diff --git a/platform/object-serializer/src/BeanBinding.kt b/platform/object-serializer/src/BeanBinding.kt
new file mode 100644 (file)
index 0000000..db41db2
--- /dev/null
@@ -0,0 +1,92 @@
+// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.util.serialization
+
+import com.intellij.util.containers.ObjectIntHashMap
+import software.amazon.ion.IonType
+import java.lang.reflect.Type
+
+internal class BeanBinding(beanClass: Class<*>) : BaseBeanBinding(beanClass), RootBinding {
+  private lateinit var bindings: Array<NestedBinding>
+  private lateinit var nameToBindingIndex: ObjectIntHashMap<String>
+  private lateinit var accessors: List<MutableAccessor>
+
+  override fun init(originalType: Type, context: BindingInitializationContext) {
+    val list = context.propertyCollector.collect(beanClass)
+    accessors = list
+    val nameToBindingIndex = ObjectIntHashMap<String>(list.size)
+    bindings = Array(list.size) { index ->
+      val accessor = list.get(index)
+      val binding = context.bindingProducer.getNestedBinding(accessor)
+      nameToBindingIndex.put(accessor.name, index)
+      binding
+    }
+    this.nameToBindingIndex = nameToBindingIndex
+  }
+
+  override fun serialize(obj: Any, context: WriteContext) {
+    val writer = context.writer
+
+    val objectIdWriter = context.objectIdWriter
+    if (objectIdWriter != null) {
+      val alreadySerializedReference = objectIdWriter.getId(obj)
+      if (alreadySerializedReference != -1) {
+        writer.writeInt(alreadySerializedReference.toLong())
+        return
+      }
+    }
+
+    writer.stepIn(IonType.STRUCT)
+
+    if (objectIdWriter != null) {
+      // id as field because annotation supports only string, but it is not efficient
+      writer.setFieldName("@id")
+      writer.writeInt(objectIdWriter.registerObject(obj).toLong())
+    }
+
+    val bindings = bindings
+    val accessors = accessors
+    for (i in 0 until bindings.size) {
+      bindings[i].serialize(obj, accessors[i], context)
+    }
+    writer.stepOut()
+  }
+
+  override fun deserialize(context: ReadContext): Any {
+    val reader = context.reader
+
+    if (reader.type == IonType.INT) {
+      // reference
+      return context.objectIdReader.getObject(reader.intValue())
+    }
+
+    reader.stepIn()
+
+    val obj = newInstance()
+    val nameToBindingIndex = nameToBindingIndex
+    val bindings = bindings
+    val accessors = accessors
+
+    while (true) {
+      reader.next() ?: break
+