Merge remote-tracking branch 'origin/master'
authorKonstantin Kolosovsky <konstantin.kolosovsky@jetbrains.com>
Tue, 23 Dec 2014 18:16:07 +0000 (21:16 +0300)
committerKonstantin Kolosovsky <konstantin.kolosovsky@jetbrains.com>
Tue, 23 Dec 2014 18:16:07 +0000 (21:16 +0300)
463 files changed:
build/scripts/utils.gant
images/src/org/intellij/images/thumbnail/actions/EnterAction.java
java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
java/compiler/impl/src/com/intellij/compiler/options/JavaCompilersTab.java
java/compiler/openapi/src/com/intellij/openapi/deployment/DeploymentUtil.java
java/debugger/impl/src/com/intellij/debugger/actions/JavaReferringObjectsValue.java
java/debugger/impl/src/com/intellij/debugger/actions/ViewAsGroup.java
java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArgumentValueDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/EvaluationDescriptor.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/LocalVariableDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MethodReturnValueDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ThisDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ThrownExceptionValueDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/UserExpressionDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java
java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java [new file with mode: 0644]
java/idea-ui/src/com/intellij/framework/FrameworkGroup.java
java/idea-ui/src/com/intellij/framework/FrameworkOrGroup.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/InferenceFromSourceUtil.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullityInference.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/PurityInference.java
java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
java/java-impl/src/com/intellij/codeInsight/completion/JavadocCompletionConfidence.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java
java/java-impl/src/com/intellij/codeInsight/template/impl/JavaTemplateUtil.java
java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java
java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
java/java-impl/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodDialog.java
java/java-impl/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java
java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java
java/java-impl/src/com/intellij/refactoring/move/MoveDialogBase.java [new file with mode: 0644]
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.form
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryDialog.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryForm.form
java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.form
java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.java
java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialog.java
java/java-impl/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java
java/java-impl/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersProcessor.java
java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamer.java [new file with mode: 0644]
java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamerFactory.java [new file with mode: 0644]
java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java
java/java-psi-api/src/com/intellij/psi/PsiElementFinder.java
java/java-psi-api/src/com/intellij/psi/PsiPackage.java
java/java-psi-api/src/com/intellij/psi/augment/PsiAugmentProvider.java
java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiFacadeImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java [new file with mode: 0644]
java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocTokenImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaTreeGenerator.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/javaDoc/LinksInJavaDoc.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterMethodTypeParamWithNestedClass.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeMethodTypeParamWithNestedClass.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod-out.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/after/p/Foo.java [new file with mode: 0644]
java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/before/p/Foo.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/daemon/JavadocHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java
java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/ForeachTemplateTest.java
java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIntegrationTest.java
java/java-tests/testSrc/com/intellij/ide/fileTemplates/impl/FileTemplateTestUtil.java
java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodTest.java
java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceParameterTest.java
java/java-tests/testSrc/com/intellij/refactoring/RenameMethodMultiTest.java
java/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java
java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java
jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java
platform/analysis-api/src/com/intellij/psi/search/GlobalSearchScopesCore.java
platform/core-api/src/com/intellij/openapi/project/DumbService.java
platform/core-api/src/com/intellij/psi/search/NonClasspathDirectoriesScope.java
platform/core-impl/src/com/intellij/mock/MockDumbService.java
platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java
platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
platform/core-impl/src/com/intellij/openapi/progress/util/TooManyUsagesStatus.java
platform/core-impl/src/com/intellij/pom/tree/events/impl/TreeChangeImpl.java
platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java
platform/icons/src/javaee/JavaeeAppModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/JavaeeAppModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/JavaeeAppModule@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/JavaeeAppModule_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebService.png [changed mode: 0644->0755]
platform/icons/src/javaee/WebService2.png [new file with mode: 0755]
platform/icons/src/javaee/WebService2@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebService2@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebService@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient.png [changed mode: 0644->0755]
platform/icons/src/javaee/WebServiceClient2.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebService_dark.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/application_xml@2x.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml_dark.png [new file with mode: 0755]
platform/icons/src/javaee/buildOnFrameDeactivation.png [changed mode: 0644->0755]
platform/icons/src/javaee/dataSourceImport.png [changed mode: 0644->0755]
platform/icons/src/javaee/dataSourceImport@2x.png [new file with mode: 0755]
platform/icons/src/javaee/databaseSchemaImportLegend.png [changed mode: 0644->0755]
platform/icons/src/javaee/dbSchemaImportBig.png [changed mode: 0644->0755]
platform/icons/src/javaee/dbSchemaImportBig@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejb-jar_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejb-jar_xml@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejbClass.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejbClass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejbModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejbModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay.png [changed mode: 0644->0755]
platform/icons/src/javaee/embeddedAttributeOverlay@2x.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/entityBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig.png [changed mode: 0644->0755]
platform/icons/src/javaee/entityBeanBig@2x.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean_dark.png [new file with mode: 0755]
platform/icons/src/javaee/home.png [changed mode: 0644->0755]
platform/icons/src/javaee/home@2x.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay.png [changed mode: 0644->0755]
platform/icons/src/javaee/inheritedAttributeOverlay@2x.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay_dark.png [new file with mode: 0755]
platform/icons/src/javaee/interceptorClass.png [changed mode: 0644->0755]
platform/icons/src/javaee/interceptorClass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/interceptorMethod.png [changed mode: 0644->0755]
platform/icons/src/javaee/interceptorMethod@2x.png [new file with mode: 0755]
platform/icons/src/javaee/jpaFacet.png [changed mode: 0644->0755]
platform/icons/src/javaee/jpaFacet@2x.png [new file with mode: 0755]
platform/icons/src/javaee/local.png [changed mode: 0644->0755]
platform/icons/src/javaee/local@2x.png [new file with mode: 0755]
platform/icons/src/javaee/local@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/localHome.png [changed mode: 0644->0755]
platform/icons/src/javaee/localHome@2x.png [new file with mode: 0755]
platform/icons/src/javaee/localHome@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/localHome_dark.png [new file with mode: 0755]
platform/icons/src/javaee/local_dark.png [new file with mode: 0755]
platform/icons/src/javaee/messageBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/messageBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceAttribute.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceAttribute@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEmbeddable@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEntity@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntityListener.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEntityListener@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceId@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceIdRelationship@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceMappedSuperclass.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceMappedSuperclass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceRelationship.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceRelationship@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceUnit.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceUnit@2x.png [new file with mode: 0755]
platform/icons/src/javaee/remote.png [changed mode: 0644->0755]
platform/icons/src/javaee/remote@2x.png [new file with mode: 0755]
platform/icons/src/javaee/remote@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/remote_dark.png [new file with mode: 0755]
platform/icons/src/javaee/sessionBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/sessionBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/updateRunningApplication.png [changed mode: 0644->0755]
platform/icons/src/javaee/updateRunningApplication@2x.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/webModuleGroup.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModuleGroup@2x.png [new file with mode: 0755]
platform/icons/src/javaee/web_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/web_xml@2x.png [changed mode: 0644->0755]
platform/lang-api/src/com/intellij/execution/filters/UrlFilter.java
platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java
platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java
platform/lang-api/src/com/intellij/lang/folding/CustomFoldingSurroundDescriptor.java
platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/ArrangementSettingsPanel.java
platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesPanel.java
platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/ArbitraryPlaceUrlReferenceProvider.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoTypeDeclarationAction.java
platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateManager.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java
platform/lang-impl/src/com/intellij/ide/scratch/NewScratchFileAction.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.form
platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java
platform/lang-impl/src/com/intellij/openapi/paths/GlobalPathReferenceProvider.java
platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java
platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesProcessor.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java
platform/lang-impl/src/com/intellij/webcore/packaging/ManagePackagesDialog.java
platform/platform-api/src/com/intellij/notification/Notifications.java
platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java
platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java
platform/platform-api/src/com/intellij/openapi/ui/Messages.java
platform/platform-api/src/com/intellij/ui/MessageException.java [moved from platform/platform-impl/src/com/intellij/ui/mac/MacMessageException.java with 82% similarity]
platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/CompressibleSingleRowLayout.java
platform/platform-api/src/com/intellij/util/io/HttpRequests.java
platform/platform-api/src/com/intellij/util/io/ProgressMonitorInputStream.java [new file with mode: 0644]
platform/platform-api/src/com/intellij/util/ui/ButtonlessScrollBarUI.java
platform/platform-impl/src/com/intellij/diagnostic/DevelopersLoader.java
platform/platform-impl/src/com/intellij/ide/actions/ToggleDistractionFreeModeAction.java
platform/platform-impl/src/com/intellij/ide/plugins/InstallPluginAction.java
platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java
platform/platform-impl/src/com/intellij/notification/impl/GotItStateKeeper.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java
platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/Change.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ChangeSide.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/DiffRangeMarker.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/AddRectangularSelectionOnMouseDragAction.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/ForcedSoftWrapsNotificationProvider.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ActionShortcutRestrictionsImpl.java
platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableCardPanel.java
platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressStream.java [deleted file]
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/DetectedPluginsPanel.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoDialog.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java
platform/platform-impl/src/com/intellij/ui/CardLayoutPanel.java
platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java
platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.form [new file with mode: 0644]
platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.java [new file with mode: 0644]
platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/EditorBundle.properties
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-resources-en/src/messages/RefactoringBundle.properties
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/platform-resources/src/brokenPlugins.txt
platform/platform-resources/src/idea/Keymap_Default.xml
platform/platform-resources/src/idea/PlatformActions.xml
platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatFilesWithFiltersTest.java
platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java
platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/SimpleTemplatesTest.java [moved from java/java-tests/testSrc/com/intellij/ide/fileTemplates/SimpleTemplatesTest.java with 90% similarity]
platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.java [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.java
platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java
platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentBase.java
platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentWithDeployment.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeNode.java
platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudApplicationRuntimeBase.java
platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudApplicationRuntimeImpl.java
platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudMultiSourceServerRuntimeInstance.java
platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudServerRuntimeInstance.java
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTestProxy.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java
platform/structuralsearch/source/messages/SSRBundle.properties
platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
platform/testFramework/src/com/intellij/testFramework/fixtures/EditorMouseFixture.java
platform/testFramework/testSrc/com/intellij/testFramework/vcs/AbstractVcsTestCase.java
platform/testRunner/src/com/intellij/execution/testframework/actions/ViewAssertEqualsDiffAction.java
platform/usageView/src/com/intellij/usages/UsageLimitUtil.java
platform/usageView/src/com/intellij/usages/impl/SearchForUsagesRunnable.java
platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/icons/AllIcons.java
platform/util/src/com/intellij/openapi/util/JDOMExternalizableStringList.java
platform/util/src/com/intellij/openapi/util/JDOMUtil.java
platform/util/src/com/intellij/ui/Graphics2DDelegate.java
platform/util/src/com/intellij/util/CloseableProcessor.java [new file with mode: 0644]
platform/util/src/com/intellij/util/xmlb/BeanBinding.java
platform/util/src/com/intellij/util/xmlb/JDOMExternalizableStringListBinding.java [new file with mode: 0644]
platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java
platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java
platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ImportIntoShelfAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowser.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/RefreshVFsSynchronously.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFileFilter.java [deleted file]
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java
platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUtil.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsStructureChooser.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogFileFilter.java [new file with mode: 0644]
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/BranchesPanel.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/HtmlTableBuilder.java [new file with mode: 0644]
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/ambiguous_field_access/AmbiguousFieldAccess.java
plugins/coverage/src/com/intellij/coverage/JavaCoverageEngineExtension.java
plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java
plugins/coverage/src/com/intellij/coverage/view/JavaCoverageViewExtension.java
plugins/devkit/src/dom/generator/DTDModelLoader.java
plugins/devkit/src/inspections/TitleCapitalizationInspection.java
plugins/devkit/testData/inspections/capitalization/MultipleReturns.java [new file with mode: 0644]
plugins/devkit/testData/inspections/capitalization/MultipleReturns_after.java [new file with mode: 0644]
plugins/devkit/testSources/inspections/CapitalizationInspectionTest.java
plugins/git4idea/src/git4idea/GitUtil.java
plugins/git4idea/src/git4idea/annotate/GitAnnotationProvider.java
plugins/git4idea/src/git4idea/branch/DeepComparator.java
plugins/git4idea/src/git4idea/branch/DeepCompareAction.java
plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
plugins/git4idea/src/git4idea/commands/GitHandler.java
plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java
plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
plugins/git4idea/src/git4idea/merge/GitConflictResolver.java
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePatcher.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleOrderEnumeratorHandler.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectDataService.java
plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleProjectSettings.java
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit SetUp Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit TearDown Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit Test Case.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit Test Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy New Method Body.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock Test Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock cleanup Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock_SetUp_Method.groovy.html
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/groovydoc/lexer/GroovyDocLexer.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java
plugins/groovy/src/org/jetbrains/plugins/groovy/ivy/AbstractAttachSourceProvider.java
plugins/groovy/test/org/jetbrains/plugins/groovy/GroovyActionsTest.groovy
plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java
plugins/hg4idea/src/org/zmlx/hg4idea/branch/HgBranchPopup.java
plugins/hg4idea/src/org/zmlx/hg4idea/branch/HgBranchPopupActions.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommitCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCloseBranchExecutor.java [new file with mode: 0644]
plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTest.java
plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaReferenceContributor.java
plugins/junit/src/com/intellij/execution/junit2/TestProxy.java
plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java
plugins/junit/src/fileTemplates/code/JUnit3 SetUp Method.java.html
plugins/junit/src/fileTemplates/code/JUnit3 TearDown Method.java.html
plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html
plugins/junit/src/fileTemplates/code/JUnit3 Test Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Parameters Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 SetUp Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 TearDown Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Test Method.java.html
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java
plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepositoryEditor.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloUtil.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloList.java
plugins/terminal/resources/icons/OpenTerminal_13x13@2x_dark.png
plugins/terminal/resources/icons/OpenTerminal_13x13_dark.png
plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
plugins/testng/src/com/theoryinpractice/testng/model/TestProxy.java
plugins/testng/src/fileTemplates/code/TestNG Parameters Method.java.html
plugins/testng/src/fileTemplates/code/TestNG SetUp Method.java.html
plugins/testng/src/fileTemplates/code/TestNG TearDown Method.java.html
plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html
plugins/testng/src/fileTemplates/code/TestNG Test Method.java.html
python/edu/build/idea.nsi
python/edu/course-creator/resources/fileTemplates/internal/test_helper.py.ft
python/edu/learn-python/resources/courses/introduction_course.zip
python/edu/learn-python/src/com/jetbrains/python/edu/StudyInitialConfigurator.java
python/edu/learn-python/src/com/jetbrains/python/edu/StudyNames.java [new file with mode: 0644]
python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java
python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java
python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java
python/edu/learn-python/src/com/jetbrains/python/edu/course/Course.java
python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskWindow.java
python/helpers/pydev/_pydev_imps/_pydev_django_oscar_patch.py [deleted file]
python/helpers/pydev/_pydev_imps/_pydev_pluginbase.py
python/helpers/pydev/pydev_monkey_qt.py
python/helpers/pydev/pydevd.py
python/helpers/pydev/pydevd_comm.py
python/helpers/pydev/pydevd_io.py
python/src/com/jetbrains/python/PyBundle.properties
python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java
python/src/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureDialog.java
python/src/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureUsageProcessor.java
python/src/com/jetbrains/python/refactoring/changeSignature/PyMethodDescriptor.java
python/testData/refactoring/changeSignature/duplicateNamesOfStarredParameters.py [new file with mode: 0644]
python/testData/refactoring/changeSignature/multipleDoubleStarredParameters.py [new file with mode: 0644]
python/testData/refactoring/changeSignature/multipleSingleStarredParameters.py [new file with mode: 0644]
python/testData/refactoring/changeSignature/parameterNameWithMoreThanTwoStars.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java
resources-en/src/messages/CompilerBundle.properties
resources/src/META-INF/IdeaPlugin.xml
spellchecker/src/com/intellij/spellchecker/jetbrains.dic
xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java
xml/xml-psi-impl/src/com/intellij/embedding/IndentEatingLexer.java

index a1e04fd29841f7184a1fc9158c35eaf18d38a591..45a529ff3d231ca4e0b42f1b15218c60521050a3 100644 (file)
  * limitations under the License.
  */
 
+
 import org.jetbrains.jps.gant.JpsGantTool
 import org.jetbrains.jps.gant.TeamCityBuildInfoPrinter
 import org.jetbrains.jps.model.java.JavaSourceRootType
+import org.jetbrains.jps.model.java.JpsJavaExtensionService
 import org.jetbrains.jps.model.module.JpsModule
 
 includeTool << JpsGantTool
@@ -139,6 +141,10 @@ binding.setVariable("loadProject", {
   projectBuilder.setupAdditionalLogging(new File("${p("teamcity.build.tempDir", p("java.io.tmpdir"))}/system/build-log/build.log"),
                                         p("jps.build.debug.logging.categories", ""))
   loadProjectFromPath(home)
+
+  def compilerOptions = JpsJavaExtensionService.instance.getOrCreateCompilerConfiguration(project).currentCompilerOptions
+  compilerOptions.GENERATE_NO_WARNINGS = true
+  compilerOptions.DEPRECATION = false
 })
 
 boolean hasSourceRoots(JpsModule module) {
@@ -627,6 +633,23 @@ binding.setVariable("zipSources", { String home, String targetDir ->
   notifyArtifactBuilt(sources)
 })
 
+binding.setVariable("zipSourcesOfModules", { String home, String targetFilePath, Collection<String> modules ->
+  projectBuilder.stage("zip sources of ${modules.size()} modules to $targetFilePath")
+
+  ant.mkdir(dir: new File(targetFilePath).getParent())
+  ant.delete(file: targetFilePath)
+  ant.zip(destfile: targetFilePath) {
+    modules.each {
+      JpsModule module = findModule(it)
+      module.getSourceRoots(JavaSourceRootType.SOURCE).flatten().collect {it.file}.each { File srcRoot ->
+        zipfileset(prefix: module.name, dir: srcRoot.absolutePath)
+      }
+    }
+  }
+
+  notifyArtifactBuilt(targetFilePath)
+})
+
 /**
  * E.g.
  *
index b608b82f97c76b05a7fff59405426869d694db16..d0cb098f33a45bb10e148ad34ca21ddc415989d2 100644 (file)
@@ -57,7 +57,7 @@ public final class EnterAction extends AnAction {
             if (selection.length > 0) {
                 if (selection.length == 1 && selection[0].isDirectory()) {
                     presentation.setVisible(true);
-                } else if (selection.length > 0) {
+                } else {
                     boolean notImages = false;
                     ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
                     for (VirtualFile file : selection) {
@@ -65,9 +65,6 @@ public final class EnterAction extends AnAction {
                     }
                     presentation.setEnabled(!notImages);
                     presentation.setVisible(false);
-                } else {
-                    presentation.setVisible(false);
-                    presentation.setEnabled(false);
                 }
             } else {
                 presentation.setVisible(false);
index 87eae631d3043b53c6cf010801ffea7c88f9403f..4edda91e2dd6097e49d503ca0459465b26a701f4 100644 (file)
@@ -270,6 +270,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
       addWildcardResourcePattern("!?*.flex");
       addWildcardResourcePattern("!?*.kt");
       addWildcardResourcePattern("!?*.clj");
+      addWildcardResourcePattern("!?*.aj");
     }
     catch (MalformedPatternException e) {
       LOG.error(e);
index f54cae8988aba2e43ef683ab848c58b1d6061278..13dcc5051dc503b48abb2976adb72bc353bbfdbf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -135,14 +135,13 @@ public class JavaCompilersTab implements SearchableConfigurable, Configurable.No
   }
 
   public void apply() throws ConfigurationException {
-    boolean modified = false;
     try {
       for (Configurable configurable : myConfigurables) {
         if (configurable.isModified()) {
-          modified = true;
           configurable.apply();
         }
       }
+
       myCompilerConfiguration.setDefaultCompiler(mySelectedCompiler);
       myCompilerConfiguration.setProjectBytecodeTarget(myTargetLevelComponent.getProjectBytecodeTarget());
       myCompilerConfiguration.setModulesBytecodeTargetMap(myTargetLevelComponent.getModulesBytecodeTargetMap());
@@ -151,9 +150,7 @@ public class JavaCompilersTab implements SearchableConfigurable, Configurable.No
       myTargetLevelComponent.setModuleTargetLevels(myCompilerConfiguration.getModulesBytecodeTargetMap());
     }
     finally {
-      if (modified) {
-        BuildManager.getInstance().clearState(myProject);
-      }
+      BuildManager.getInstance().clearState(myProject);
     }
   }
 
index 4919789ca176142dfa48be789205cefa807590f0..9b3532808f05afddb3dd99fbc5ee1ba95fab8dca 100644 (file)
@@ -34,6 +34,7 @@ public abstract class DeploymentUtil {
     return ServiceManager.getService(DeploymentUtil.class);
   }
 
+  @Deprecated
   public abstract void copyFile(@NotNull File fromFile,
                                 @NotNull File toFile,
                                 @NotNull CompileContext context,
@@ -47,6 +48,7 @@ public abstract class DeploymentUtil {
     return path;
   }
 
+  @Deprecated
   public abstract void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module);
 
   public static String concatPaths(String... paths) {
@@ -119,6 +121,7 @@ public abstract class DeploymentUtil {
     }
   }
 
+  @Deprecated
   public abstract void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module);
 
 }
index 34959665d0cf02318cb40057f24c0b3489e760c3..1a64a6cf0bf61d4ab6c8d74105bb10fedfa1e946 100644 (file)
@@ -99,11 +99,6 @@ public class JavaReferringObjectsValue extends JavaValue {
                   return "Ref";
                 }
 
-                @Override
-                public String calcValueName() {
-                  return "Ref";
-                }
-
                 @Override
                 public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
                   return null;
index c4217a179f0fdffd6b6eb68cadfa42fe87f4e172..8c884fdef1f2aebf195ed4cd8b9132fff84e0eb3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -75,15 +75,23 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
 
       final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
       final List<JavaValue> values = getSelectedValues(e);
+      final List<XValueNodeImpl> selectedNodes = XDebuggerTreeActionBase.getSelectedNodes(e.getDataContext());
 
       LOG.assertTrue(debuggerContext != null && !values.isEmpty());
 
-      debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
+      DebugProcessImpl process = debuggerContext.getDebugProcess();
+      if (process == null) {
+        return;
+      }
+
+      process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
           public void threadAction() {
-            for (JavaValue value : values) {
-              value.getDescriptor().setRenderer(myNodeRenderer);
+            for (final XValueNodeImpl node : selectedNodes) {
+              final XValue container = node.getValueContainer();
+              if (container instanceof JavaValue) {
+                ((JavaValue)container).setRenderer(myNodeRenderer, node);
+              }
             }
-            DebuggerAction.refreshViews(e);
           }
         }
       );
@@ -106,6 +114,9 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
       boolean allApp = true;
 
       for (JavaValue value : values) {
+        if (value instanceof JavaReferringObjectsValue) { // disable for any referrers at all
+          return AnAction.EMPTY_ARRAY;
+        }
         ValueDescriptorImpl valueDescriptor = value.getDescriptor();
         anyValueDescriptor = true;
         if (!valueDescriptor.isValueValid() || !nodeRenderer.isApplicable(valueDescriptor.getType())) {
index d43a1bb0b6ee54ef12e09be3979f296db2aa8f85..aabdc0fcb17555455e92875dd96d23e7421c1799 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.debugger.engine;
 
+import com.intellij.debugger.MultiRequestPositionManager;
 import com.intellij.debugger.NoDataException;
 import com.intellij.debugger.PositionManager;
 import com.intellij.debugger.SourcePosition;
@@ -38,7 +39,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-public class CompoundPositionManager extends PositionManagerEx {
+public class CompoundPositionManager extends PositionManagerEx implements MultiRequestPositionManager{
   private static final Logger LOG = Logger.getInstance(CompoundPositionManager.class);
 
   private final ArrayList<PositionManager> myPositionManagers = new ArrayList<PositionManager>();
@@ -168,6 +169,38 @@ public class CompoundPositionManager extends PositionManagerEx {
     return null;
   }
 
+  @NotNull
+  @Override
+  public List<ClassPrepareRequest> createPrepareRequests(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) {
+    for (PositionManager positionManager : myPositionManagers) {
+      try {
+        if (positionManager instanceof MultiRequestPositionManager) {
+          return ((MultiRequestPositionManager)positionManager).createPrepareRequests(requestor, position);
+        }
+        else {
+          ClassPrepareRequest prepareRequest = positionManager.createPrepareRequest(requestor, position);
+          if (prepareRequest == null) {
+            return Collections.emptyList();
+          }
+          return Collections.singletonList(prepareRequest);
+        }
+      }
+      catch (NoDataException ignored) {
+      }
+      catch (VMDisconnectedException e) {
+        throw e;
+      }
+      catch (Exception e) {
+        LOG.error(e);
+      }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
+    }
+
+    return Collections.emptyList();
+  }
+
   @Nullable
   @Override
   public XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location) {
index 45166acce45d1e09fb1e5efd2d0a3da014b11bbb..b325a696ec14a4da2a54a8dbde30e74711d36455 100644 (file)
@@ -288,7 +288,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
     return myValueDescriptor.getValueText();
   }
 
-  private int currentStart = 0;
+  private int myCurrentChildrenStart = 0;
 
   @Override
   public void computeChildren(@NotNull final XCompositeNode node) {
@@ -326,9 +326,9 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
 
           @Override
           public void initChildrenArrayRenderer(ArrayRenderer renderer) {
-            renderer.START_INDEX = currentStart;
-            renderer.END_INDEX = currentStart + XCompositeNode.MAX_CHILDREN_TO_SHOW - 1;
-            currentStart += XCompositeNode.MAX_CHILDREN_TO_SHOW;
+            renderer.START_INDEX = myCurrentChildrenStart;
+            renderer.END_INDEX = myCurrentChildrenStart + XCompositeNode.MAX_CHILDREN_TO_SHOW - 1;
+            myCurrentChildrenStart += XCompositeNode.MAX_CHILDREN_TO_SHOW;
           }
 
           @Override
@@ -456,14 +456,14 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
   public String getEvaluationExpression() {
     if (evaluationExpression == null) {
       // TODO: change API to allow to calculate it asynchronously
-      myEvaluationContext.getManagerThread().invokeAndWait(new DebuggerCommandImpl() {
+      myEvaluationContext.getManagerThread().invokeAndWait(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
         @Override
         public Priority getPriority() {
           return Priority.HIGH;
         }
 
         @Override
-        protected void action() throws Exception {
+        public void contextAction() throws Exception {
           evaluationExpression = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
             @Override
             public String compute() {
@@ -536,4 +536,17 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
       }
     };
   }
+
+  public void setRenderer(NodeRenderer nodeRenderer, final XValueNodeImpl node) {
+    DebuggerManagerThreadImpl.assertIsManagerThread();
+    myValueDescriptor.setRenderer(nodeRenderer);
+    myCurrentChildrenStart = 0;
+    node.getTree().getLaterInvocator().offer(new Runnable() {
+      @Override
+      public void run() {
+        node.clearChildren();
+        computePresentation(node, XValuePlace.TREE);
+      }
+    });
+  }
 }
index c4e08c03d931b335dfc9fde4eb2d52447c18d59a..9ef6ab90be05dc805372b81a0b164c7f6058d0de 100644 (file)
@@ -38,10 +38,7 @@ import com.sun.jdi.event.ClassPrepareEvent;
 import com.sun.jdi.request.*;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author lex
@@ -307,15 +304,17 @@ public class RequestManagerImpl extends DebugProcessAdapterImpl implements Reque
 
   public void callbackOnPrepareClasses(final ClassPrepareRequestor requestor, final SourcePosition classPosition) {
     DebuggerManagerThreadImpl.assertIsManagerThread();
-    ClassPrepareRequest prepareRequest = myDebugProcess.getPositionManager().createPrepareRequest(requestor, classPosition);
 
-    if(prepareRequest == null) {
+    List<ClassPrepareRequest> prepareRequests = myDebugProcess.getPositionManager().createPrepareRequests(requestor, classPosition);
+    if(prepareRequests.isEmpty()) {
       setInvalid(requestor, DebuggerBundle.message("status.invalid.breakpoint.out.of.class"));
       return;
     }
 
-    registerRequest(requestor, prepareRequest);
-    prepareRequest.enable();
+    for (ClassPrepareRequest prepareRequest : prepareRequests) {
+      registerRequest(requestor, prepareRequest);
+      prepareRequest.enable();
+    }
   }
 
   public void callbackOnPrepareClasses(ClassPrepareRequestor requestor, String classOrPatternToBeLoaded) {
index 525abba6613f884e0ee2afb7e902acca30c7b333..a92abe492c45c62534df57da94e25e6541ca56d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -97,10 +97,6 @@ public class ArgumentValueDescriptorImpl extends ValueDescriptorImpl{
     return myName;
   }
 
-  public String calcValueName() {
-    return getName();
-  }
-
   public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
     if (!myParameterNameCalcutated) {
       return null;
index f26d81292e35bfdb30f9eaf6e8eac2c2a244d195..95d0c20ef125f374225fef54193c9d12b34f582a 100644 (file)
@@ -145,10 +145,6 @@ public abstract class EvaluationDescriptor extends ValueDescriptorImpl{
     }
   }
 
-  public String calcValueName() {
-    return getName();
-  }
-
   public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
     PsiElement evaluationCode = getEvaluationCode(context);
     if(evaluationCode instanceof PsiExpressionCodeFragment) {
index da88267615d167db91c58532b84fca35e13ef584..5aa8711e5ae5afae8509393ab46df14e92adb16b 100644 (file)
@@ -33,7 +33,6 @@ import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiElementFactory;
 import com.intellij.psi.PsiExpression;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.StringBuilderSpinAllocator;
 import com.sun.jdi.Field;
 import com.sun.jdi.ObjectCollectedException;
 import com.sun.jdi.ObjectReference;
@@ -125,19 +124,10 @@ public class FieldDescriptorImpl extends ValueDescriptorImpl implements FieldDes
 
   @Override
   public String calcValueName() {
-    final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
-    StringBuilder buf = StringBuilderSpinAllocator.alloc();
-    try {
-      buf.append(getName());
-      if (classRenderer.SHOW_DECLARED_TYPE) {
-        buf.append(": ");
-        buf.append(classRenderer.renderTypeName(myField.typeName()));
-      }
-      return buf.toString();
-    }
-    finally {
-      StringBuilderSpinAllocator.dispose(buf);
+    if (NodeRendererSettings.getInstance().getClassRenderer().SHOW_DECLARED_TYPE) {
+      return addDeclaredType(myField.typeName());
     }
+    return super.calcValueName();
   }
 
   @Override
index cf4c8864d8f2cf366061252817db12fdec85750c..21e4aa7395ea61d08a645d99540a0364aad19fd7 100644 (file)
@@ -26,13 +26,11 @@ import com.intellij.debugger.jdi.StackFrameProxyImpl;
 import com.intellij.debugger.settings.NodeRendererSettings;
 import com.intellij.debugger.ui.tree.LocalVariableDescriptor;
 import com.intellij.debugger.ui.tree.NodeDescriptor;
-import com.intellij.debugger.ui.tree.render.ClassRenderer;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiElementFactory;
 import com.intellij.psi.PsiExpression;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.StringBuilderSpinAllocator;
 import com.sun.jdi.Value;
 import org.jetbrains.annotations.NotNull;
 
@@ -99,19 +97,10 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements
 
   @Override
   public String calcValueName() {
-    final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
-    StringBuilder buf = StringBuilderSpinAllocator.alloc();
-    try {
-      buf.append(getName());
-      if (classRenderer.SHOW_DECLARED_TYPE) {
-        buf.append(": ");
-        buf.append(classRenderer.renderTypeName(myTypeName));
-      }
-      return buf.toString();
-    }
-    finally {
-      StringBuilderSpinAllocator.dispose(buf);
+    if (NodeRendererSettings.getInstance().getClassRenderer().SHOW_DECLARED_TYPE) {
+      return addDeclaredType(myTypeName);
     }
+    return super.calcValueName();
   }
 
   @Override
index 2ab0b025648574922321a8d9c571fdb4533a074d..5ac7dcd5d4a6d9941cfebc787be810a2b5c88f6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -49,10 +49,6 @@ public class MethodReturnValueDescriptorImpl extends ValueDescriptorImpl{
     return myMethod.toString();
   }
 
-  public String calcValueName() {
-    return getName();
-  }
-
   public Type getType() {
     if (myValue == null) {
       try {
index 67e8304ff5bfc73abb617655382ed160d809ade8..52d824b4620021c49046f1a300de942842b116ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,10 +45,6 @@ public class ThisDescriptorImpl extends ValueDescriptorImpl{
     return "this"; 
   }
 
-  public String calcValueName() {
-    return getName();
-  }
-
   public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
     PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
     try {
index 1cb48edbbc4ccbe99453ff23a7345de8806a95bb..1cf33c672f9103af383c41cb3efc30b10d5e1846 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,10 +57,6 @@ public class ThrownExceptionValueDescriptorImpl extends ValueDescriptorImpl{
     return myExceptionObj.referenceType();
   }
 
-  public String calcValueName() {
-    return getName();
-  }
-
   public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
     throw new EvaluateException("Evaluation not supported for thrown exception object");
   }
index 35e73c2b637805eca0e0d37dbd333f511741b6e6..574ab19839a51597b2fd93e01ba1f33b679473b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,11 +29,9 @@ import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
 import com.intellij.debugger.engine.evaluation.TextWithImports;
 import com.intellij.debugger.settings.NodeRendererSettings;
 import com.intellij.debugger.ui.tree.UserExpressionDescriptor;
-import com.intellij.debugger.ui.tree.render.ClassRenderer;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiCodeFragment;
-import com.intellij.util.StringBuilderSpinAllocator;
 import com.sun.jdi.ObjectReference;
 import com.sun.jdi.Value;
 
@@ -53,22 +51,15 @@ public class UserExpressionDescriptorImpl extends EvaluationDescriptor implement
     return myName;
   }
 
+  @Override
   public String calcValueName() {
-    StringBuilder buffer = StringBuilderSpinAllocator.alloc();
-    try {
-      buffer.append(getName());
-      buffer.append(": ");
-      final Value value = getValue();
-      if(value != null) {
-        final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
-        buffer.append(classRenderer.renderTypeName(value.type().name()));
+    if (NodeRendererSettings.getInstance().getClassRenderer().SHOW_DECLARED_TYPE) {
+      Value value = getValue();
+      if (value != null) {
+        return addDeclaredType(value.type().name());
       }
-
-      return buffer.toString();
-    }
-    finally {
-      StringBuilderSpinAllocator.dispose(buffer);
     }
+    return super.calcValueName();
   }
 
   protected PsiCodeFragment getEvaluationCode(final StackFrameContext context) throws EvaluateException {
index e881787357ae8966757f51e21a053e66f2ad96fa..7013598d3797084a360f7049374550e8e1f532a8 100644 (file)
@@ -335,11 +335,6 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
         return myValue;
       }
 
-      @Override
-      public String calcValueName() {
-        return null;
-      }
-
       @Override
       public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
         return null;
@@ -375,7 +370,9 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
     return myValueIcon;
   }
 
-  public abstract String calcValueName();
+  public String calcValueName() {
+    return getName();
+  };
 
   @Override
   public void displayAs(NodeDescriptor descriptor) {
@@ -583,4 +580,16 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
   public Project getProject() {
     return myProject;
   }
+
+  protected String addDeclaredType(String typeName) {
+    final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
+    StringBuilder buf = StringBuilderSpinAllocator.alloc();
+    try {
+      buf.append(getName()).append(": ").append(classRenderer.renderTypeName(typeName));
+      return buf.toString();
+    }
+    finally {
+      StringBuilderSpinAllocator.dispose(buf);
+    }
+  }
 }
diff --git a/java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java b/java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java
new file mode 100644 (file)
index 0000000..0052a77
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger;
+
+import com.intellij.debugger.requests.ClassPrepareRequestor;
+import com.sun.jdi.request.ClassPrepareRequest;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public interface MultiRequestPositionManager extends PositionManager {
+
+  /**
+   * @see PositionManager#createPrepareRequest
+   */
+  @NotNull
+  List<ClassPrepareRequest> createPrepareRequests(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position)
+    throws NoDataException;
+}
index a3705c263cbd1b08f1fd3996f25ebe2ef2ddd6e9..ac8d6b63c475d2648fe89e133cba176f1dd352de 100644 (file)
@@ -8,6 +8,10 @@ import java.util.Collections;
 import java.util.List;
 
 /**
+ * Represents a group of frameworks. in the frameworks tree ("Additional Libraries and Frameworks"
+ * in the New Project dialog or the tree displayed in the "Add Framework Support" dialog).
+ * Frameworks in a group can have a common version number.
+ *
  * @author nik
  */
 public abstract class FrameworkGroup<V extends FrameworkVersion> implements FrameworkOrGroup {
@@ -26,6 +30,10 @@ public abstract class FrameworkGroup<V extends FrameworkVersion> implements Fram
   @NotNull
   public abstract Icon getIcon();
 
+  /**
+   * Returns the list of known versions of the framework group. The list is shown to the user
+   * and allows them to choose the version used in their project.
+   */
   @NotNull
   public List<V> getGroupVersions() {
     return Collections.emptyList();
index 8265b71d4658bec8cb92636b97bc347836954b14..9b491f602a84f989c7ed70eb0fe151d7f88913bf 100644 (file)
@@ -20,8 +20,11 @@ import org.jetbrains.annotations.NotNull;
 import javax.swing.*;
 
 /**
+ * Represents a single node (framework or group) in the frameworks tree ("Additional Libraries and Frameworks"
+ * in the New Project dialog or the tree displayed in the "Add Framework Support" dialog).
+ *
  * @author Dmitry Avdeev
- *         Date: 09.10.13
+ * @since 09.10.13
  */
 public interface FrameworkOrGroup {
   @NotNull
index 1fc3ea1765039ea7cca93e526e0647eac5edd600..7dcf36afb4ee1a1154e8ab43c39e2af9cebd7e3b 100644 (file)
@@ -17,17 +17,12 @@ package com.intellij.codeInspection.dataFlow;
 
 import com.intellij.codeInsight.NullableNotNullManager;
 import com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
-import com.intellij.openapi.roots.FileIndexFacade;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.RecursionManager;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.util.CachedValueProvider;
-import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiModificationTracker;
-import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.psi.util.*;
 import com.intellij.util.Function;
 import com.intellij.util.NullableFunction;
 import com.intellij.util.containers.ContainerUtil;
@@ -47,10 +42,10 @@ public class ContractInference {
 
   @NotNull
   public static List<MethodContract> inferContracts(@NotNull final PsiMethod method) {
-    if (isLibraryCode(method)) {
+    if (!InferenceFromSourceUtil.shouldInferFromSource(method)) {
       return Collections.emptyList();
     }
-
+    
     return CachedValuesManager.getCachedValue(method, new CachedValueProvider<List<MethodContract>>() {
       @Nullable
       @Override
@@ -66,12 +61,6 @@ public class ContractInference {
       }
     });
   }
-
-  static boolean isLibraryCode(@NotNull PsiMethod method) {
-    if (method instanceof PsiCompiledElement) return true;
-    VirtualFile virtualFile = PsiUtilCore.getVirtualFile(method);
-    return virtualFile != null && FileIndexFacade.getInstance(method.getProject()).isInLibrarySource(virtualFile);
-  }
 }
 
 class ContractInferenceInterpreter {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/InferenceFromSourceUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/InferenceFromSourceUtil.java
new file mode 100644 (file)
index 0000000..4082776
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.dataFlow;
+
+import com.intellij.openapi.roots.FileIndexFacade;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.searches.MethodReferencesSearch;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.PsiUtilCore;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author peter
+ */
+public class InferenceFromSourceUtil {
+  static boolean shouldInferFromSource(@NotNull PsiMethod method) {
+    if (isLibraryCode(method) ||
+        method.hasModifierProperty(PsiModifier.ABSTRACT) ||
+        PsiUtil.canBeOverriden(method) ||
+        method.getBody() == null) {
+      return false;
+    }
+    
+    if (method.hasModifierProperty(PsiModifier.STATIC)) return true;
+
+    return !isUnusedInAnonymousClass(method);
+  }
+
+  private static boolean isUnusedInAnonymousClass(@NotNull PsiMethod method) {
+    PsiClass containingClass = method.getContainingClass();
+    return containingClass instanceof PsiAnonymousClass &&
+           MethodReferencesSearch.search(method, new LocalSearchScope(containingClass), false).findFirst() == null;
+  }
+
+  private static boolean isLibraryCode(@NotNull PsiMethod method) {
+    if (method instanceof PsiCompiledElement) return true;
+    VirtualFile virtualFile = PsiUtilCore.getVirtualFile(method);
+    return virtualFile != null && FileIndexFacade.getInstance(method.getProject()).isInLibrarySource(virtualFile);
+  }
+}
index 5b79e8637678fc10cf03ce8931922c405aa04aa9..ab02b5bf7648085b8bf030c880d7407a8a876e9d 100644 (file)
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 public class NullityInference {
 
   public static Nullness inferNullity(final PsiMethod method) {
-    if (ContractInference.isLibraryCode(method)) {
+    if (!InferenceFromSourceUtil.shouldInferFromSource(method)) {
       return Nullness.UNKNOWN;
     }
 
index 6ceaeec72ae504a4b745425f2b4195a9f3cf520a..ee81e7c09fd34d13b643d8ae6195720c8b02b2fd 100644 (file)
@@ -34,7 +34,10 @@ import java.util.List;
 public class PurityInference {
 
   public static boolean inferPurity(@NotNull final PsiMethod method) {
-    if (ContractInference.isLibraryCode(method) || method.getReturnType() == PsiType.VOID || method.getBody() == null || method.isConstructor()) {
+    if (!InferenceFromSourceUtil.shouldInferFromSource(method) ||
+        method.getReturnType() == PsiType.VOID ||
+        method.getBody() == null ||
+        method.isConstructor()) {
       return false;
     }
 
index b4f318de8e4ba950136cfc2152e6b133c5c12e07..33ca812d78d2a012557f7aede8025ded1aa5137f 100644 (file)
@@ -38,6 +38,7 @@ import com.intellij.psi.*;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.ui.awt.RelativePoint;
 import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.xml.util.XmlStringUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -50,7 +51,24 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
   private static final Function<PsiElement, String> ourTooltipProvider = new Function<PsiElement, String>() {
     @Override
     public String fun(PsiElement nameIdentifier) {
-      return XmlStringUtil.wrapInHtml(JavaDocInfoGenerator.generateSignature(nameIdentifier.getParent()));
+      PsiModifierListOwner owner = (PsiModifierListOwner)nameIdentifier.getParent();
+      
+      boolean hasInferred = false;
+      boolean hasExternal = false;
+      for (PsiAnnotation annotation : findSignatureNonCodeAnnotations(owner)) {
+        hasExternal |= AnnotationUtil.isExternalAnnotation(annotation);
+        hasInferred |= AnnotationUtil.isInferredAnnotation(annotation);
+      }
+      
+      String header;
+      if (hasInferred && hasExternal) {
+        header = "External and <i>inferred</i>";
+      } else if (hasInferred) {
+        header = "<i>Inferred</i>";
+      } else {
+        header = "External";
+      }
+      return XmlStringUtil.wrapInHtml(header + " annotations available. Full signature:<p>\n" + JavaDocInfoGenerator.generateSignature(owner));
     }
   };
 
@@ -65,7 +83,7 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
     PsiElement nameIdentifier = ((PsiNameIdentifierOwner)owner).getNameIdentifier();
     if (nameIdentifier == null || !nameIdentifier.getTextRange().equals(element.getTextRange())) return null;
 
-    if (!shouldShowSignature((PsiModifierListOwner)owner)) {
+    if (findSignatureNonCodeAnnotations((PsiModifierListOwner)owner).isEmpty()) {
       return null;
     }
 
@@ -76,38 +94,35 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
                                           GutterIconRenderer.Alignment.RIGHT);
   }
 
-  private static boolean shouldShowSignature(PsiModifierListOwner owner) {
-    if (hasNonCodeAnnotations(owner)) {
-      return true;
-    }
+  private static List<PsiAnnotation> findSignatureNonCodeAnnotations(PsiModifierListOwner owner) {
+    List<PsiAnnotation> result = ContainerUtil.newArrayList(findOwnNonCodeAnnotations(owner));
 
     if (owner instanceof PsiMethod) {
       for (PsiParameter parameter : ((PsiMethod)owner).getParameterList().getParameters()) {
-        if (hasNonCodeAnnotations(parameter)) {
-          return true;
-        }
+        result.addAll(findOwnNonCodeAnnotations(parameter));
       }
     }
 
-    return false;
+    return result;
   }
 
-  private static boolean hasNonCodeAnnotations(@NotNull PsiModifierListOwner element) {
+  private static List<PsiAnnotation> findOwnNonCodeAnnotations(@NotNull PsiModifierListOwner element) {
+    List<PsiAnnotation> result = ContainerUtil.newArrayList();
     Project project = element.getProject();
     PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(project).findExternalAnnotations(element);
     if (externalAnnotations != null) {
       for (PsiAnnotation annotation : externalAnnotations) {
         if (isVisibleAnnotation(annotation)) {
-          return true;
+          result.add(annotation);
         }
       }
     }
     for (PsiAnnotation annotation : InferredAnnotationsManager.getInstance(project).findInferredAnnotations(element)) {
       if (isVisibleAnnotation(annotation)) {
-        return true;
+        result.add(annotation);
       }
     }
-    return false;
+    return result;
   }
 
   private static boolean isVisibleAnnotation(@NotNull PsiAnnotation annotation) {
index b2c1bfa970bd695570c76409e5e5fd95a804f434..c1a0ead516e2062c671c72a61aecb7fd3c6a894d 100644 (file)
@@ -20,11 +20,14 @@ import com.intellij.psi.JavaDocTokenType;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiJavaCodeReferenceElement;
+import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef;
 import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.ThreeState;
 import org.jetbrains.annotations.NotNull;
 
+import static com.intellij.patterns.PsiJavaPatterns.psiElement;
+import static com.intellij.patterns.StandardPatterns.or;
+
 /**
  * @author peter
  */
@@ -33,8 +36,9 @@ public class JavadocCompletionConfidence extends CompletionConfidence {
   @NotNull
   @Override
   public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
-    if (PsiTreeUtil.findElementOfClassAtOffset(psiFile, offset - 1, PsiDocTag.class, false) != null &&
-        PsiTreeUtil.findElementOfClassAtOffset(psiFile, offset - 1, PsiJavaCodeReferenceElement.class, false) != null) {
+    if (psiElement().inside(PsiDocTag.class).inside(
+      or(psiElement(PsiJavaCodeReferenceElement.class), psiElement(PsiDocMethodOrFieldRef.class)))
+      .accepts(contextElement)) {
       return ThreeState.NO;
     }
     if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) {
index 6ae88736d1f4cb77092cc3f30cb344e6cffe5e57..bed7658c1c8c53e87fbbc3586cb914f93949743e 100644 (file)
@@ -29,7 +29,6 @@ import com.intellij.openapi.editor.colors.EditorColorsScheme;
 import com.intellij.openapi.editor.markup.GutterIconRenderer;
 import com.intellij.openapi.editor.markup.SeparatorPlacement;
 import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.TextRange;
@@ -54,7 +53,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
-public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
+public class JavaLineMarkerProvider implements LineMarkerProvider {
 
   protected final DaemonCodeAnalyzerSettings myDaemonSettings;
   protected final EditorColorsManager myColorsManager;
@@ -68,8 +67,7 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
   @Nullable
   public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
     PsiElement parent;
-    if (element instanceof PsiIdentifier && (parent = element.getParent()) instanceof PsiMethod && 
-        !DumbService.getInstance(element.getProject()).isDumb()) {
+    if (element instanceof PsiIdentifier && (parent = element.getParent()) instanceof PsiMethod) {
       PsiMethod method = (PsiMethod)parent;
       MethodSignatureBackedByPsiMethod superSignature = SuperMethodsSearch.search(method, null, true, false).findFirst();
       if (superSignature != null) {
@@ -151,10 +149,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
   public void collectSlowLineMarkers(@NotNull final List<PsiElement> elements, @NotNull final Collection<LineMarkerInfo> result) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
 
-    if (elements.isEmpty() || DumbService.getInstance(elements.get(0).getProject()).isDumb()) {
-      return;
-    }
-
     Set<PsiMethod> methods = new HashSet<PsiMethod>();
     //noinspection ForLoopReplaceableByForEach
     for (int i = 0; i < elements.size(); i++) {
index ab9e5b7ceb6e276be954ab3e0c7fbf3952e987e7..b93b364a636627bfa5ee2995f3cad1bf44aa0bb0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -68,27 +68,33 @@ public class JavaTemplateUtil {
           PsiElement element = file.findElementAt(segmentStart);
           PsiMethod method = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
           if (method != null) {
-            if (((PsiTypeParameter)aClass).getOwner() instanceof PsiMethod || method.hasModifierProperty(PsiModifier.STATIC)) {
-              PsiTypeParameterList paramList = method.getTypeParameterList();
-              PsiTypeParameter[] params = paramList != null ? paramList.getTypeParameters() : PsiTypeParameter.EMPTY_ARRAY;
-              for (PsiTypeParameter param : params) {
-                if (param.getName().equals(aClass.getName())) return;
+            if (!method.hasModifierProperty(PsiModifier.STATIC)) {
+              PsiTypeParameterListOwner owner = ((PsiTypeParameter)aClass).getOwner();
+              if (PsiTreeUtil.isAncestor(owner, method, false)) {
+                continue;
               }
-              try {
-                if (paramList == null) {
-                  final PsiTypeParameterList newList =
-                    JVMElementFactories.getFactory(method.getLanguage(), project).createTypeParameterList();
-                  paramList = (PsiTypeParameterList)method.addAfter(newList, method.getModifierList());
-                }
-                paramList.add(aClass.copy());
-                PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document);
-              }
-              catch (IncorrectOperationException e) {
-                LOG.error(e);
+            }
+
+            PsiTypeParameterList paramList = method.getTypeParameterList();
+            PsiTypeParameter[] params = paramList != null ? paramList.getTypeParameters() : PsiTypeParameter.EMPTY_ARRAY;
+            for (PsiTypeParameter param : params) {
+              if (param.getName().equals(aClass.getName())) return;
+            }
+            try {
+              if (paramList == null) {
+                final PsiTypeParameterList newList =
+                  JVMElementFactories.getFactory(method.getLanguage(), project).createTypeParameterList();
+                paramList = (PsiTypeParameterList)method.addAfter(newList, method.getModifierList());
               }
+              paramList.add(aClass.copy());
+              PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document);
+            }
+            catch (IncorrectOperationException e) {
+              LOG.error(e);
             }
           }
-        } else if (!noImport) {
+        }
+        else if (!noImport) {
           addImportForClass(document, aClass, segmentStart, segmentEnd);
           PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document);
         }
index 19c1fec11a4cc68f40d19dd328a788ba2acfe5b9..3c5d138e2b13d0bf1c899a3a7bd37f93a6aedaa0 100644 (file)
@@ -1,7 +1,6 @@
 package com.intellij.jarFinder;
 
 import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.util.ProgressStream;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.util.io.HttpRequests;
 import org.jdom.Document;
@@ -10,7 +9,6 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
-import java.io.InputStream;
 
 /**
  * @author Sergey Evdokimov
@@ -25,15 +23,15 @@ public abstract class SourceSearcher {
   @Nullable
   protected abstract String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version) throws SourceSearchException;
 
+  @NotNull
   protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException {
     return HttpRequests.request(url)
       .accept("application/xml")
       .connect(new HttpRequests.RequestProcessor<Document>() {
         @Override
         public Document process(@NotNull HttpRequests.Request request) throws IOException {
-          InputStream inputStream = request.getInputStream();
           try {
-            return JDOMUtil.loadDocument(new ProgressStream(0, request.getConnection().getContentLength(), inputStream, indicator));
+            return JDOMUtil.loadDocument(request.getReader(indicator));
           }
           catch (JDOMException e) {
             throw new IOException(e);
index 07461178c32a6517abc54a4613c653c2df180b47..7453c329b0d00a3ab224827633ee911009c3638a 100644 (file)
@@ -101,6 +101,7 @@ public class JavaRefactoringSettings implements PersistentStateComponent<JavaRef
   @SuppressWarnings({"WeakerAccess"}) public boolean RENAME_PARAMETER_IN_HIERARCHY = true;
   @SuppressWarnings({"WeakerAccess"}) public boolean RENAME_VARIABLES = true;
   @SuppressWarnings({"WeakerAccess"}) public boolean RENAME_TESTS = true;
+  @SuppressWarnings({"WeakerAccess"}) public boolean RENAME_OVERLOADS = true;
 
   public static JavaRefactoringSettings getInstance() {
     return ServiceManager.getService(JavaRefactoringSettings.class);
@@ -145,4 +146,12 @@ public class JavaRefactoringSettings implements PersistentStateComponent<JavaRef
   public void setRenameTests(boolean renameTests) {
     this.RENAME_TESTS = renameTests;
   }
+
+  public void setRenameOverloads(boolean renameOverloads) {
+    RENAME_OVERLOADS = renameOverloads;
+  }
+
+  public boolean isRenameOverloads() {
+    return RENAME_OVERLOADS;
+  }
 }
\ No newline at end of file
index be2b088dd6b4fbc0ec3b17e0c71957983a8732ef..d054943e6a7fae5fd519cb3fbe93b64ec7743d60 100644 (file)
@@ -78,4 +78,14 @@ public class ConvertToInstanceMethodDialog  extends MoveInstanceMethodDialogBase
     }.installOn(variableChooser);
     return variableChooser;
   }
+
+  @Override
+  protected String getMovePropertySuffix() {
+    return null;
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return null;
+  }
 }
index 5804445d714159d2486e5c4da69554d46412ea5d..ff362fbf3fe49b0904d8878aaca13add1971a245 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.refactoring.convertToInstanceMethod;
 import com.intellij.codeInsight.ChangeContextUtil;
 import com.intellij.history.LocalHistory;
 import com.intellij.history.LocalHistoryAction;
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
@@ -231,6 +232,7 @@ public class ConvertToInstanceMethodProcessor extends BaseRefactoringProcessor {
     if (!myTargetClass.isInterface()) {
       PsiMethod method = addMethodToClass(myTargetClass);
       fixVisibility(method, usages);
+      EditorHelper.openInEditor(method);
     }
     else {
       final PsiMethod interfaceMethod = addMethodToClass(myTargetClass);
@@ -240,6 +242,8 @@ public class ConvertToInstanceMethodProcessor extends BaseRefactoringProcessor {
       modifierList.setModifierProperty(PsiModifier.PROTECTED, false);
       RefactoringUtil.makeMethodAbstract(myTargetClass, interfaceMethod);
 
+      EditorHelper.openInEditor(interfaceMethod);
+
       for (final PsiClass psiClass : inheritors) {
         final PsiMethod newMethod = addMethodToClass(psiClass);
         PsiUtil.setModifierProperty(newMethod, myNewVisibility != null && !myNewVisibility.equals(VisibilityUtil.ESCALATE_VISIBILITY) ? myNewVisibility
index f8d67168628f6b8a135b589ed3b46141dc93afc2..59afecefda75442cc9393c339c69899435a8b617 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.Splitter;
-import com.intellij.openapi.ui.VerticalFlowLayout;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiFormatUtil;
@@ -216,7 +215,9 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
 
     myVisibilityPanel = createVisibilityPanel();
     final JPanel visibilityAndReturnType = new JPanel(new BorderLayout(2, 0));
-    visibilityAndReturnType.add(myVisibilityPanel, BorderLayout.WEST);
+    if (!myTargetClass.isInterface()) {
+      visibilityAndReturnType.add(myVisibilityPanel, BorderLayout.WEST);
+    }
     final JPanel returnTypePanel = createReturnTypePanel();
     if (returnTypePanel != null) {
       visibilityAndReturnType.add(returnTypePanel, BorderLayout.EAST);
@@ -430,7 +431,7 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
   }
 
   public String getVisibility() {
-    return myVisibilityPanel.getVisibility();
+    return myTargetClass.isInterface() ? PsiModifier.PUBLIC : myVisibilityPanel.getVisibility();
   }
 
 
@@ -525,7 +526,7 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
       buffer.append(StringUtil.getShortName(myNullness == Nullness.NULLABLE ? nullManager.getDefaultNullable() : nullManager.getDefaultNotNull()));
       buffer.append("\n");
     }
-    final String visibilityString = VisibilityUtil.getVisibilityString(myVisibilityPanel.getVisibility());
+    final String visibilityString = VisibilityUtil.getVisibilityString(getVisibility());
     buffer.append(visibilityString);
     if (buffer.length() > 0) {
       buffer.append(" ");
index 6b3e2e709d1311973c2299364fd3c24738f06cfe..7804e23aedd4ffea780d5c556a87b642b4d357ee 100644 (file)
@@ -1339,7 +1339,10 @@ public class ExtractMethodProcessor implements MatchProvider {
     }
 
     if (myTargetClass.isInterface() && PsiUtil.isLanguageLevel8OrHigher(myTargetClass)) {
-      PsiUtil.setModifierProperty(newMethod, PsiModifier.DEFAULT, true);
+      final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(myCodeFragmentMember, PsiMethod.class, false);
+      if (containingMethod != null && containingMethod.hasModifierProperty(PsiModifier.DEFAULT)) {
+        PsiUtil.setModifierProperty(newMethod, PsiModifier.DEFAULT, true);
+      }
     }
     return (PsiMethod)myStyleManager.reformat(newMethod);
   }
@@ -1579,24 +1582,34 @@ public class ExtractMethodProcessor implements MatchProvider {
     myStatic = shouldBeStatic();
     final Set<PsiField> fields = new LinkedHashSet<PsiField>();
     if (!PsiUtil.isLocalOrAnonymousClass(myTargetClass) && (myTargetClass.getContainingClass() == null || myTargetClass.hasModifierProperty(PsiModifier.STATIC))) {
-      ElementNeedsThis needsThis = new ElementNeedsThis(myTargetClass) {
-        @Override
-        protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
-          if (classMember instanceof PsiField && !classMember.hasModifierProperty(PsiModifier.STATIC)) {
-            final PsiExpression expression = PsiTreeUtil.getParentOfType(classMemberReference, PsiExpression.class, false);
-            if (expression == null || !PsiUtil.isAccessedForWriting(expression)) {
-              fields.add((PsiField)classMember);
-              return;
+      boolean canBeStatic = true;
+      if (myTargetClass.isInterface()) {
+        final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(myCodeFragmentMember, PsiMethod.class, false);
+        canBeStatic = containingMethod == null || containingMethod.hasModifierProperty(PsiModifier.STATIC);
+      }
+      if (canBeStatic) {
+        ElementNeedsThis needsThis = new ElementNeedsThis(myTargetClass) {
+          @Override
+          protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
+            if (classMember instanceof PsiField && !classMember.hasModifierProperty(PsiModifier.STATIC)) {
+              final PsiExpression expression = PsiTreeUtil.getParentOfType(classMemberReference, PsiExpression.class, false);
+              if (expression == null || !PsiUtil.isAccessedForWriting(expression)) {
+                fields.add((PsiField)classMember);
+                return;
+              }
             }
+            super.visitClassMemberReferenceElement(classMember, classMemberReference);
           }
-          super.visitClassMemberReferenceElement(classMember, classMemberReference);
+        };
+        for (int i = 0; i < myElements.length && !needsThis.usesMembers(); i++) {
+          PsiElement element = myElements[i];
+          element.accept(needsThis);
         }
-      };
-      for (int i = 0; i < myElements.length && !needsThis.usesMembers(); i++) {
-        PsiElement element = myElements[i];
-        element.accept(needsThis);
+        myCanBeStatic = !needsThis.usesMembers();
+      }
+      else {
+        myCanBeStatic = false;
       }
-      myCanBeStatic = !needsThis.usesMembers();
     }
     else {
       myCanBeStatic = false;
index 5528a93cae6b683338bf7a2dace275ac56457be9..54ae5167601da80a8ecaa1904ee687af545ebb81 100644 (file)
@@ -97,9 +97,11 @@ public class InplaceIntroduceParameterPopup extends AbstractJavaInplaceIntroduce
 
       protected TIntArrayList getParametersToRemove() {
         TIntArrayList parameters = new TIntArrayList();
-        for (int i = 0; i < myParametersToRemove.length; i++) {
-          if (myParametersToRemove[i] != null) {
-            parameters.add(i);
+        if (myCbReplaceAllOccurences == null || myCbReplaceAllOccurences.isSelected()) {
+          for (int i = 0; i < myParametersToRemove.length; i++) {
+            if (myParametersToRemove[i] != null) {
+              parameters.add(i);
+            }
           }
         }
         return parameters;
index 10def5808511b59b90fa8674cebcc11e9ddf75f4..af4c559bbc807f33a59a7e47a7d3865ebd588400 100644 (file)
@@ -243,6 +243,9 @@ public abstract class IntroduceParameterSettingsUI {
   }
 
   public boolean isParamToRemove(PsiParameter param) {
+    if (myCbReplaceAllOccurences != null && !myCbReplaceAllOccurences.isSelected()) {
+      return false;
+    }
     if (param.isVarArgs()) {
       return myParametersToRemove[myParametersToRemove.length - 1] != null;
     }
diff --git a/java/java-impl/src/com/intellij/refactoring/move/MoveDialogBase.java b/java/java-impl/src/com/intellij/refactoring/move/MoveDialogBase.java
new file mode 100644 (file)
index 0000000..256aacb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.refactoring.move;
+
+import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.openapi.project.Project;
+import com.intellij.refactoring.ui.RefactoringDialog;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+public abstract class MoveDialogBase extends RefactoringDialog {
+
+  private JCheckBox myOpenEditorCb;
+
+  protected abstract String getMovePropertySuffix();
+  protected abstract String getCbTitle();
+  
+  protected JCheckBox initOpenInEditorCb() {
+    myOpenEditorCb = new JCheckBox(getCbTitle(), PropertiesComponent.getInstance().getBoolean("Move" + getMovePropertySuffix() +".OpenInEditor",
+                                                                                              isEnabledByDefault()));
+    return myOpenEditorCb;
+  }
+
+  protected boolean isEnabledByDefault() {
+    return true;
+  }
+
+  protected void saveOpenInEditorOption() {
+    if (myOpenEditorCb != null) {
+      PropertiesComponent.getInstance().setValue("Move" + getMovePropertySuffix() +".OpenInEditor", String.valueOf(myOpenEditorCb.isSelected()));
+    }
+  }
+
+  protected boolean isOpenInEditor() {
+    return myOpenEditorCb != null && myOpenEditorCb.isSelected();
+  }
+
+  protected MoveDialogBase(@NotNull Project project, boolean canBeParent) {
+    super(project, canBeParent);
+  }
+}
index 48ab4c42887a2f15cd89f5102d35330a605cb8ed..03739a7ab5d11f5d9e556b7f6693396883e1a122 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.move.moveClassesOrPackages;
 
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -39,6 +40,7 @@ import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.Processor;
 import com.intellij.util.VisibilityUtil;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.MultiMap;
 import org.jetbrains.annotations.NotNull;
 
@@ -60,6 +62,7 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor {
   private final boolean mySearchInNonJavaFiles;
   private NonCodeUsageInfo[] myNonCodeUsages;
   private final MoveCallback myMoveCallback;
+  private boolean myOpenInEditor;
 
   public MoveClassToInnerProcessor(Project project,
                                    final PsiClass[] classesToMove,
@@ -167,6 +170,13 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor {
           element.delete();
         }
       }
+
+      if (myOpenInEditor && !oldToNewElementsMapping.isEmpty()) {
+        final PsiElement item = ContainerUtil.getFirstItem(oldToNewElementsMapping.values());
+        if (item != null) {
+          EditorHelper.openInEditor(item);
+        }
+      }
     }
     catch (IncorrectOperationException e) {
       LOG.error(e);
@@ -324,6 +334,10 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor {
     });
   }
 
+  public void setOpenInEditor(boolean openInEditor) {
+    myOpenInEditor = openInEditor;
+  }
+
   private static class ConflictsCollector {
     private final PsiClass myClassToMove;
     private final MultiMap<PsiElement, String> myConflicts;
index a69d2e8726687094bc8c7bad6901e3eda7acb5d8..60a7d8d5e2a8cd35ed1534c6409d6820ebb743b7 100644 (file)
           </grid>
         </children>
       </grid>
-      <grid id="ce694" binding="myTargetPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+      <grid id="ce694" binding="myTargetPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
         <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
           <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties/>
           </component>
+          <grid id="58f9b" binding="myOpenInEditorPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
+            <constraints>
+              <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties/>
+            <border type="none"/>
+            <children/>
+          </grid>
         </children>
       </grid>
       <vspacer id="fdc31">
index 3bbcf743506cce4a2c1fc94a68dd8608482a00ab..e0d206e733c15fcf8b06502fb2acd250103783a1 100644 (file)
@@ -39,6 +39,7 @@ import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.refactoring.*;
 import com.intellij.refactoring.move.MoveCallback;
 import com.intellij.refactoring.move.MoveClassesOrPackagesCallback;
+import com.intellij.refactoring.move.MoveDialogBase;
 import com.intellij.refactoring.move.MoveHandler;
 import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil;
 import com.intellij.refactoring.ui.ClassNameReferenceEditor;
@@ -64,7 +65,7 @@ import java.awt.event.ActionListener;
 import java.util.List;
 import java.util.Set;
 
-public class MoveClassesOrPackagesDialog extends RefactoringDialog {
+public class MoveClassesOrPackagesDialog extends MoveDialogBase {
   @NonNls private static final String RECENTS_KEY = "MoveClassesOrPackagesDialog.RECENTS_KEY";
   private final PsiElement[] myElementsToMove;
   private final MoveCallback myMoveCallback;
@@ -90,6 +91,7 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
   private ComboboxWithBrowseButton myDestinationFolderCB;
   private JPanel myTargetPanel;
   private JLabel myTargetDestinationLabel;
+  private JPanel myOpenInEditorPanel;
   private boolean myHavePackages;
   private boolean myTargetDirectoryFixed;
   private boolean mySuggestToMoveToAnotherRoot;
@@ -138,6 +140,13 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
         myInnerClassChooser.requestFocus();
       }
     });
+
+    for (PsiElement element : elementsToMove) {
+      if (element.getContainingFile() != null) {
+        myOpenInEditorPanel.add(initOpenInEditorCb(), BorderLayout.EAST);
+        break;
+      }
+    }
   }
 
   private void updateControlsEnabled() {
@@ -376,6 +385,7 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
   }
 
   protected void doAction() {
+    saveOpenInEditorOption();
     if (isMoveToPackage()) {
       invokeMoveToPackage();
     }
@@ -419,6 +429,7 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
 
       MoveClassesOrPackagesProcessor processor = createMoveToPackageProcessor(destination, myElementsToMove, myMoveCallback);
       if (processor.verifyValidPackageName()) {
+        processor.setOpenInEditor(isOpenInEditor());
         invokeRefactoring(processor);
       }
     }
@@ -476,7 +487,9 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
     for (int i = 0; i < myElementsToMove.length; i++) {
       classesToMove[i] = (PsiClass)myElementsToMove[i];
     }
-    invokeRefactoring(createMoveToInnerProcessor(targetClass, classesToMove, myMoveCallback));
+    final MoveClassToInnerProcessor processor = createMoveToInnerProcessor(targetClass, classesToMove, myMoveCallback);
+    processor.setOpenInEditor(isOpenInEditor());
+    invokeRefactoring(processor);
   }
 
   //for scala plugin
@@ -510,4 +523,14 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog {
   private List<VirtualFile> getSourceRoots() {
     return JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject);
   }
+
+  @Override
+  protected String getMovePropertySuffix() {
+    return "Class";
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return "Open moved in editor";
+  }
 }
index 54ddf03a5c573ca0a2e999bc924344fbc18dbaef..1d4548b23abf8682762f28655459ee758898adb5 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.move.moveClassesOrPackages;
 
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.project.Project;
@@ -71,6 +72,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
   private final MoveCallback myMoveCallback;
   protected @NotNull final MoveDestination myMoveDestination;
   protected NonCodeUsageInfo[] myNonCodeUsages;
+  private boolean myOpenInEditor;
 
   public MoveClassesOrPackagesProcessor(Project project,
                                         PsiElement[] elements,
@@ -203,6 +205,10 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
     return myMoveDestination.getTargetPackage();
   }
 
+  public void setOpenInEditor(boolean openInEditor) {
+    myOpenInEditor = openInEditor;
+  }
+
   protected static class ConflictsUsageInfo extends UsageInfo {
     private final Collection<String> myConflicts;
 
@@ -540,6 +546,15 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
       }
 
       myNonCodeUsages = CommonMoveUtil.retargetUsages(usages, oldToNewElementsMapping);
+
+      if (myOpenInEditor) {
+        for (PsiElement element : myElementsToMove) {
+          if (element.getContainingFile() != null) {
+            EditorHelper.openInEditor(element);
+            break;
+          }
+        }
+      }
     }
     catch (IncorrectOperationException e) {
       myNonCodeUsages = new NonCodeUsageInfo[0];
index 2640b2492a3497cc407d5e4430357b8e4a585c85..b70564343ac1d99bea1b50f3e165d92c74cd521b 100644 (file)
@@ -33,6 +33,7 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.refactoring.*;
 import com.intellij.refactoring.move.MoveCallback;
+import com.intellij.refactoring.move.MoveDialogBase;
 import com.intellij.refactoring.move.MoveHandler;
 import com.intellij.refactoring.ui.RefactoringDialog;
 import com.intellij.ui.DocumentAdapter;
@@ -43,6 +44,7 @@ import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import javax.swing.event.DocumentEvent;
+import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.HashSet;
@@ -51,7 +53,7 @@ import java.util.Set;
 /**
  * @author ven
  */
-public class MoveClassesOrPackagesToNewDirectoryDialog extends RefactoringDialog {
+public class MoveClassesOrPackagesToNewDirectoryDialog extends MoveDialogBase {
   private static final Logger LOG = Logger.getInstance("com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesToNewDirectoryDialog");
 
   private final PsiDirectory myDirectory;
@@ -124,6 +126,12 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends RefactoringDialog
       myPreserveSourceRoot.setSelected(sameModule);
     }
     init();
+    for (PsiElement element : elementsToMove) {
+      if (element.getContainingFile() != null) {
+        myOpenInEditor.add(initOpenInEditorCb(), BorderLayout.WEST);
+        break;
+      }
+    }
   }
 
   private TextFieldWithBrowseButton myDestDirectoryField;
@@ -132,6 +140,7 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends RefactoringDialog
   private JPanel myRootPanel;
   private JLabel myNameLabel;
   private JCheckBox myPreserveSourceRoot;
+  private JPanel myOpenInEditor;
 
   private boolean isSearchInNonJavaFiles() {
     return mySearchForTextOccurrencesCheckBox.isSelected();
@@ -179,6 +188,7 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends RefactoringDialog
     final boolean searchForTextOccurences = isSearchInNonJavaFiles();
     refactoringSettings.MOVE_SEARCH_IN_COMMENTS = searchInComments;
     refactoringSettings.MOVE_SEARCH_FOR_TEXT = searchForTextOccurences;
+    saveOpenInEditorOption();
     invokeRefactoring(createRefactoringProcessor(project, directory, aPackage, searchInComments, searchForTextOccurences));
   }
 
@@ -218,12 +228,28 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends RefactoringDialog
 
     MoveClassesOrPackagesProcessor processor = createMoveClassesOrPackagesProcessor(myDirectory.getProject(), myElementsToMove, destination,
         searchInComments, searchForTextOccurences, myMoveCallback);
-
+    
+    processor.setOpenInEditor(isOpenInEditor());
     if (processor.verifyValidPackageName()) {
       return processor;
     }
     return null;
   }
+
+  @Override
+  protected String getMovePropertySuffix() {
+    return "ClassWithTarget";
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return "Open moved classes in editor";
+  }
+
+  @Override
+  protected boolean isEnabledByDefault() {
+    return false;
+  }
 }
 
 
index 75f157521894e18b7deaf41ae159abdbb1c893c0..069ddf6153dbb096b4a45693a36cc61a90e8353a 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesToNewDirectoryDialog">
-  <grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="5" left="5" bottom="5" right="5"/>
     <constraints>
-      <xy x="20" y="20" width="666" height="148"/>
+      <xy x="20" y="20" width="666" height="168"/>
     </constraints>
     <properties/>
     <border type="none"/>
       </component>
       <vspacer id="c1dce">
         <constraints>
-          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
         </constraints>
       </vspacer>
+      <grid id="60268" binding="myOpenInEditor" layout-manager="BorderLayout" hgap="0" vgap="0">
+        <constraints>
+          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children/>
+      </grid>
     </children>
   </grid>
   <inspectionSuppressions>
index 7e30dc6901cc1961a36cbf2b718f8dc97b5be6ab..8fb954645c7ba08e475709d864acef291e595c2d 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.refactoring.move.moveInner.MoveInnerDialog">
-  <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="10" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
       <xy x="20" y="20" width="500" height="400"/>
@@ -23,7 +23,7 @@
       </hspacer>
       <vspacer id="34c3">
         <constraints>
-          <grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="9" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
         </constraints>
       </vspacer>
       <component id="8093b" class="com.intellij.ui.EditorTextField" binding="myClassNameField">
         </constraints>
         <properties/>
       </component>
+      <grid id="f9ba1" binding="myOpenInEditorPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
+        <constraints>
+          <grid row="8" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children/>
+      </grid>
     </children>
   </grid>
 </form>
index cb502377f83bd273857d1a377a4474b4dbf80fee..71539abd98c0eaee9500d9b980b69e586bd38456 100644 (file)
@@ -20,6 +20,7 @@
  */
 package com.intellij.refactoring.move.moveInner;
 
+import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.help.HelpManager;
 import com.intellij.openapi.project.Project;
@@ -37,6 +38,7 @@ import com.intellij.refactoring.HelpID;
 import com.intellij.refactoring.JavaRefactoringSettings;
 import com.intellij.refactoring.PackageWrapper;
 import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.refactoring.move.MoveDialogBase;
 import com.intellij.refactoring.move.MoveInstanceMembersUtil;
 import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil;
 import com.intellij.refactoring.ui.NameSuggestionsField;
@@ -52,13 +54,14 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class MoveInnerDialog extends RefactoringDialog {
+public class MoveInnerDialog extends MoveDialogBase {
   private final Project myProject;
   private final PsiClass myInnerClass;
   private final PsiElement myTargetContainer;
@@ -74,11 +77,22 @@ public class MoveInnerDialog extends RefactoringDialog {
   private JLabel myPackageNameLabel;
   private JLabel myClassNameLabel;
   private JLabel myParameterNameLabel;
+  private JPanel myOpenInEditorPanel;
   private SuggestedNameInfo mySuggestedNameInfo;
   private final PsiClass myOuterClass;
 
   @NonNls private static final String RECENTS_KEY = "MoveInnerDialog.RECENTS_KEY";
 
+  @Override
+  protected String getMovePropertySuffix() {
+    return "Inner";
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return "Open moved member in editor";
+  }
+
   public MoveInnerDialog(Project project, PsiClass innerClass, MoveInnerProcessor processor, final PsiElement targetContainer) {
     super(project, true);
     myProject = project;
@@ -91,6 +105,7 @@ public class MoveInnerDialog extends RefactoringDialog {
     myPackageNameLabel.setLabelFor(myPackageNameField.getChildComponent());
     myClassNameLabel.setLabelFor(myClassNameField);
     myParameterNameLabel.setLabelFor(myParameterField);
+    myOpenInEditorPanel.add(initOpenInEditorCb(), BorderLayout.EAST);
   }
 
   public boolean isSearchInComments() {
@@ -297,6 +312,10 @@ public class MoveInnerDialog extends RefactoringDialog {
     if (target == null) return;
     myProcessor.setup(getInnerClass(), className, isPassOuterClass(), parameterName,
                       isSearchInComments(), isSearchInNonJavaFiles(), target);
+
+    final boolean openInEditor = isOpenInEditor();
+    saveOpenInEditorOption();
+    myProcessor.setOpenInEditor(openInEditor);
     invokeRefactoring(myProcessor);
   }
 
index d56b8c02844efaaa4725a8769f671c9e8986fdc6..a95d6ef78a7fee3f8b8b0fd4f61e8a626e7bdac7 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.refactoring.move.moveInner;
 
 import com.intellij.codeInsight.ChangeContextUtil;
 import com.intellij.codeInsight.CodeInsightUtilCore;
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.lang.findUsages.DescriptiveNameUtil;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileEditor.FileEditorManager;
@@ -70,6 +71,7 @@ public class MoveInnerProcessor extends BaseRefactoringProcessor {
   private boolean mySearchInComments;
   private boolean mySearchInNonJavaFiles;
   private NonCodeUsageInfo[] myNonCodeUsages;
+  private boolean myOpenInEditor;
 
   public MoveInnerProcessor(Project project, MoveCallback moveCallback) {
     super(project);
@@ -267,9 +269,9 @@ public class MoveInnerProcessor extends BaseRefactoringProcessor {
         ChangeContextUtil.decodeContextInfo(newClass, null, null);
       }
 
-      PsiFile targetFile = newClass.getContainingFile();
-      OpenFileDescriptor descriptor = new OpenFileDescriptor(myProject, targetFile.getVirtualFile(), newClass.getTextOffset());
-      FileEditorManager.getInstance(myProject).openTextEditor(descriptor, true);
+      if (myOpenInEditor) {
+        EditorHelper.openInEditor(newClass);
+      }
 
       if (myMoveCallback != null) {
         myMoveCallback.refactoringCompleted();
@@ -530,4 +532,8 @@ public class MoveInnerProcessor extends BaseRefactoringProcessor {
   public String getParameterName() {
     return myParameterNameOuterClass;
   }
+
+  public void setOpenInEditor(boolean openInEditor) {
+    myOpenInEditor = openInEditor;
+  }
 }
\ No newline at end of file
index 1c058d2fe855ec1f5684c85fdbfbe4bd32010741..7a82ff79d60f4755d1c830f7a95122cfb2b0eabc 100644 (file)
@@ -85,6 +85,8 @@ public class MoveInstanceMethodDialog extends MoveInstanceMethodDialogBase {
       mainPanel.add(parametersPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0));
     }
 
+    mainPanel.add(initOpenInEditorCb(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0));
+
     separator.setLabelFor(myList);
     validateTextFields(myList.getSelectedIndex());
 
@@ -148,8 +150,10 @@ public class MoveInstanceMethodDialog extends MoveInstanceMethodDialogBase {
     final MoveInstanceMethodProcessor processor = new MoveInstanceMethodProcessor(myMethod.getProject(),
                                                                                   myMethod, targetVariable,
                                                                                   myVisibilityPanel.getVisibility(),
+                                                                                  isOpenInEditor(),
                                                                                   parameterNames);
     if (!verifyTargetClass(processor.getTargetClass())) return;
+    saveOpenInEditorOption();
     invokeRefactoring(processor);
   }
 
@@ -167,4 +171,14 @@ public class MoveInstanceMethodDialog extends MoveInstanceMethodDialogBase {
   protected void doHelpAction() {
     HelpManager.getInstance().invokeHelp(HelpID.MOVE_INSTANCE_METHOD);
   }
+
+  @Override
+  protected String getMovePropertySuffix() {
+    return "Instance";
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return "Open moved method in editor";
+  }
 }
index b839f3bdfe0d057ddf6ce0ecd109cfe4849aa3ec..a02fceb859d27478bb7fdd4343acf2f5607a96bf 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.psi.PsiVariable;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.refactoring.move.MoveDialogBase;
 import com.intellij.refactoring.ui.JavaVisibilityPanel;
 import com.intellij.refactoring.ui.RefactoringDialog;
 import com.intellij.ui.ScrollPaneFactory;
@@ -38,7 +39,7 @@ import java.awt.*;
 /**
  * @author dsl
  */
-public abstract class MoveInstanceMethodDialogBase extends RefactoringDialog {
+public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase {
   protected final PsiMethod myMethod;
   protected final PsiVariable[] myVariables;
 
index ca844f0a5bb9e719f9b099318f9f204a836e72eb..3aa806ed98f8248679afeb8e82e86d8e0624775e 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.refactoring.move.moveInstanceMethod;
 
 import com.intellij.codeInsight.ChangeContextUtil;
 import com.intellij.codeInsight.generation.OverrideImplementUtil;
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
@@ -62,16 +63,27 @@ public class MoveInstanceMethodProcessor extends BaseRefactoringProcessor{
   private PsiVariable myTargetVariable;
   private PsiClass myTargetClass;
   private final String myNewVisibility;
+  private final boolean myOpenInEditor;
   private final Map<PsiClass, String> myOldClassParameterNames;
 
+  public MoveInstanceMethodProcessor(final Project project,
+                                   final PsiMethod method,
+                                   final PsiVariable targetVariable,
+                                   final String newVisibility,
+                                   final Map<PsiClass, String> oldClassParameterNames) {
+    this(project, method, targetVariable, newVisibility, false, oldClassParameterNames);
+  }
+
   public MoveInstanceMethodProcessor(final Project project,
                                      final PsiMethod method,
                                      final PsiVariable targetVariable,
                                      final String newVisibility,
+                                     boolean openInEditor, 
                                      final Map<PsiClass, String> oldClassParameterNames) {
     super(project);
     myMethod = method;
     myTargetVariable = targetVariable;
+    myOpenInEditor = openInEditor;
     myOldClassParameterNames = oldClassParameterNames;
     LOG.assertTrue(myTargetVariable instanceof PsiParameter || myTargetVariable instanceof PsiField);
     LOG.assertTrue(myTargetVariable.getType() instanceof PsiClassType);
@@ -247,6 +259,10 @@ public class MoveInstanceMethodProcessor extends BaseRefactoringProcessor{
         reference.bindToElement(method);
       }
       VisibilityUtil.fixVisibility(UsageViewUtil.toElements(usages), method, myNewVisibility);
+
+      if (myOpenInEditor) {
+        EditorHelper.openInEditor(method);
+      }
     }
     catch (IncorrectOperationException e) {
       LOG.error(e);
index a8daa9e733fede9af1653d362876a6fe5340e60c..f5eb13ce73766696f633cff22923a29763ebdab7 100644 (file)
  */
 package com.intellij.refactoring.move.moveMembers;
 
-import com.intellij.ide.util.ClassFilter;
-import com.intellij.ide.util.PackageUtil;
-import com.intellij.ide.util.TreeClassChooser;
-import com.intellij.ide.util.TreeClassChooserFactory;
+import com.intellij.ide.util.*;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.editor.event.DocumentAdapter;
@@ -38,6 +35,7 @@ import com.intellij.refactoring.JavaRefactoringSettings;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.classMembers.MemberInfoChange;
 import com.intellij.refactoring.move.MoveCallback;
+import com.intellij.refactoring.move.MoveDialogBase;
 import com.intellij.refactoring.ui.JavaVisibilityPanel;
 import com.intellij.refactoring.ui.MemberSelectionPanel;
 import com.intellij.refactoring.ui.MemberSelectionTable;
@@ -61,7 +59,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
-public class MoveMembersDialog extends RefactoringDialog implements MoveMembersOptions {
+public class MoveMembersDialog extends MoveDialogBase implements MoveMembersOptions {
   @NonNls private static final String RECENTS_KEY = "MoveMembersDialog.RECENTS_KEY";
   private MyMemberInfoModel myMemberInfoModel;
 
@@ -76,6 +74,16 @@ public class MoveMembersDialog extends RefactoringDialog implements MoveMembersO
   JavaVisibilityPanel myVisibilityPanel;
   private final JCheckBox myIntroduceEnumConstants = new JCheckBox(RefactoringBundle.message("move.enum.constant.cb"), true);
 
+  @Override
+  protected String getMovePropertySuffix() {
+    return "Member";
+  }
+
+  @Override
+  protected String getCbTitle() {
+    return "Open moved members in editor";
+  }
+
   public MoveMembersDialog(Project project,
                            PsiClass sourceClass,
                            final PsiClass initialTargetClass,
@@ -195,6 +203,7 @@ public class MoveMembersDialog extends RefactoringDialog implements MoveMembersO
     myVisibilityPanel = new JavaVisibilityPanel(true, true);
     myVisibilityPanel.setVisibility(null);
     panel.add(myVisibilityPanel, BorderLayout.EAST);
+    panel.add(initOpenInEditorCb(), BorderLayout.SOUTH);
 
     return panel;
   }
@@ -246,8 +255,9 @@ public class MoveMembersDialog extends RefactoringDialog implements MoveMembersO
       public String getTargetClassName() {
         return MoveMembersDialog.this.getTargetClassName();
       }
-    }));
+    }, isOpenInEditor()));
 
+    saveOpenInEditorOption();
     JavaRefactoringSettings.getInstance().MOVE_PREVIEW_USAGES = isPreviewUsages();
   }
 
index cc594a37c1073a0ccaec1ea154c1bc6987c8c5c9..3e7dba171d64f6968954d75c076cbfd454b7a617 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.move.moveMembers;
 
+import com.intellij.ide.util.EditorHelper;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Ref;
@@ -56,6 +57,7 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
   private PsiClass myTargetClass;
   private final Set<PsiMember> myMembersToMove = new LinkedHashSet<PsiMember>();
   private final MoveCallback myMoveCallback;
+  private final boolean myOpenInEditor;
   private String myNewVisibility; // "null" means "as is"
   private String myCommandName = MoveMembersImpl.REFACTORING_NAME;
   private MoveMembersOptions myOptions;
@@ -65,8 +67,13 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
   }
 
   public MoveMembersProcessor(Project project, @Nullable MoveCallback moveCallback, MoveMembersOptions options) {
+    this(project, moveCallback, options, false);
+  }
+
+  public MoveMembersProcessor(Project project, @Nullable MoveCallback moveCallback, MoveMembersOptions options, boolean openInEditor) {
     super(project);
     myMoveCallback = moveCallback;
+    myOpenInEditor = openInEditor;
     setOptions(options);
   }
 
@@ -231,6 +238,13 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
       if (myMoveCallback != null) {
         myMoveCallback.refactoringCompleted();
       }
+
+      if (myOpenInEditor && !movedMembers.isEmpty()) {
+        final PsiMember item = ContainerUtil.getFirstItem(movedMembers.values());
+        if (item != null) {
+          EditorHelper.openInEditor(item);
+        }
+      }
     }
     catch (IncorrectOperationException e) {
       LOG.error(e);
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamer.java b/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamer.java
new file mode 100644 (file)
index 0000000..f85ad5c
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 12-Jan-2010
+ */
+package com.intellij.refactoring.rename.naming;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMethod;
+
+public class AutomaticOverloadsRenamer extends AutomaticRenamer {
+  public AutomaticOverloadsRenamer(PsiMethod method, String newName) {
+    final PsiClass containingClass = method.getContainingClass();
+    if (containingClass != null) {
+      final PsiMethod[] overloads = containingClass.findMethodsByName(method.getName(), false);
+      for (PsiMethod overload : overloads) {
+        if (overload != method) {
+          myElements.add(overload);
+          suggestAllNames(overload.getName(), newName);
+        }
+      }
+    }
+  }
+
+  public String getDialogTitle() {
+    return "Rename overloads";
+  }
+
+  public String getDialogDescription() {
+    return "Rename overloads to:";
+  }
+
+  @Override
+  public String entityName() {
+    return "Overload";
+  }
+
+  @Override
+  public boolean isSelectedByDefault() {
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamerFactory.java b/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticOverloadsRenamerFactory.java
new file mode 100644 (file)
index 0000000..fab97ba
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 12-Jan-2010
+ */
+package com.intellij.refactoring.rename.naming;
+
+import com.intellij.psi.*;
+import com.intellij.refactoring.JavaRefactoringSettings;
+import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.usageView.UsageInfo;
+
+import java.util.Collection;
+
+public class AutomaticOverloadsRenamerFactory implements AutomaticRenamerFactory{
+  public boolean isApplicable(PsiElement element) {
+    if (element instanceof PsiMethod && !((PsiMethod)element).isConstructor()) {
+      final PsiClass containingClass = ((PsiMethod)element).getContainingClass();
+      return containingClass != null && containingClass.findMethodsByName(((PsiMethod)element).getName(), false).length > 1;
+    }
+    return false;
+  }
+
+  public String getOptionName() {
+    return RefactoringBundle.message("rename.overloads");
+  }
+
+  public boolean isEnabled() {
+    return JavaRefactoringSettings.getInstance().isRenameOverloads();
+  }
+
+  public void setEnabled(boolean enabled) {
+    JavaRefactoringSettings.getInstance().setRenameOverloads(enabled);
+  }
+
+  public AutomaticRenamer createRenamer(PsiElement element, String newName, Collection<UsageInfo> usages) {
+    return new AutomaticOverloadsRenamer((PsiMethod)element, newName);
+  }
+}
\ No newline at end of file
index dee26d6d80bb042c28a43880de5e348b2bd32c7c..00993f51fbebb3a78b83557ff7e6e30104ae5fa4 100644 (file)
@@ -49,8 +49,10 @@ import com.intellij.usageView.UsageInfo;
 import com.intellij.usageView.UsageViewUtil;
 import com.intellij.usages.*;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.containers.MultiMap;
 import com.intellij.util.ui.tree.TreeUtil;
@@ -291,7 +293,28 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
         if (!dialog.showAndGet()) {
           return null;
         }
-        result.addAll(dialog.getSelected());
+        final ArrayList<UsageInfo> selected = dialog.getSelected();
+        final Set<UsageInfo> unselected = new HashSet<UsageInfo>(overridingMethods);
+        unselected.removeAll(selected);
+
+        if (!unselected.isEmpty()) {
+          final List<PsiMethod> unselectedMethods = ContainerUtil.map(unselected, new Function<UsageInfo, PsiMethod>() {
+            @Override
+            public PsiMethod fun(UsageInfo info) {
+              return ((SafeDeleteOverridingMethodUsageInfo)info).getOverridingMethod();
+            }
+          });
+
+          for (Iterator<UsageInfo> iterator = result.iterator(); iterator.hasNext(); ) {
+            final UsageInfo info = iterator.next();
+            if (info instanceof SafeDeleteOverrideAnnotation &&
+                !allSuperMethodsSelectedToDelete(unselectedMethods, ((SafeDeleteOverrideAnnotation)info).getMethod())) {
+              iterator.remove();
+            }
+          }
+        }
+
+        result.addAll(selected);
       }
     }
 
@@ -356,6 +379,12 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
     return result.toArray(new UsageInfo[result.size()]);
   }
 
+  private static boolean allSuperMethodsSelectedToDelete(List<PsiMethod> unselectedMethods, PsiMethod method) {
+    final ArrayList<PsiMethod> superMethods = new ArrayList<PsiMethod>(Arrays.asList(method.findSuperMethods()));
+    superMethods.retainAll(unselectedMethods);
+    return superMethods.isEmpty();
+  }
+
   public void prepareForDeletion(final PsiElement element) throws IncorrectOperationException {
     if (element instanceof PsiVariable) {
       ((PsiVariable)element).normalizeDeclaration();
index 8ae3ca80e17555a2bb5b7b1ee4d34175f5d76d7e..85b5cf1b6e42a7d029b3c82ff8debee27bd5cd2f 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.Predicate;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -99,6 +100,37 @@ public abstract class PsiElementFinder {
     return PsiClass.EMPTY_ARRAY;
   }
 
+  /**
+   * Returns a list of children (classes, subpackages and possibly other elements) belonging to the specified package.
+   *
+   * @param psiPackage the package to return the list of children for.
+   * @param scope      the scope in which children are searched.
+   * @return the list of children.
+   * @since 14.1
+   */
+  @NotNull
+  public PsiNamedElement[] getChildren(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    Set<PsiNamedElement> children = new HashSet<PsiNamedElement>();
+    Collections.addAll(children, getSubPackages(psiPackage, scope));
+    Collections.addAll(children, getClasses(psiPackage, scope));
+    return children.toArray(new PsiNamedElement[children.size()]);
+  }
+
+  /**
+   * Returns the filter to use for filtering the list of children for a given package produced by other PsiElementFinder
+   * implementations. (For example, the list of children for a Kotlin package includes files directly, rather than classes,
+   * so the classes located by the standard Java package children finder need to be excluded.)
+   *
+   * @param psiPackage the package to return the list of children for.
+   * @param scope      the scope in which children are searched.
+   * @return the filter to use, or null if no additional filtering is necessary.
+   * @since 14.1
+   */
+  @Nullable
+  public Predicate<PsiNamedElement> getPackageChildrenFilter(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    return null;
+  }
+
   /**
    * A method to optimize resolve (to only search classes in a package which might be there)
    */
index 65e0af8265ad50e4b31af767c9ea5ae8dd0dde66..cab1728ad650d6c521cb93556c2cf703c75f49ef 100644 (file)
@@ -83,6 +83,14 @@ public interface PsiPackage extends PsiCheckedRenameElement, NavigationItem, Psi
   @NotNull
   PsiClass[] getClasses(@NotNull GlobalSearchScope scope);
 
+  /**
+   * Returns the list of all elements (classes, subpackages and potentially other elements) belonging to this package
+   * (non-recursively), restricted by the specified scope.
+   *
+   * @since 14.1
+   */
+  PsiElement[] getChildren(@NotNull GlobalSearchScope scope);
+
   /**
    * Returns the list of package-level annotations for the package.
    *
index b404c94b83d25eea011fbd4af13fd9b769a31352..3a0824a3f114a0fb2701e79f7637a3fa63d099f8 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.psi.augment;
 
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.psi.PsiElement;
@@ -29,6 +30,7 @@ import java.util.List;
 
 
 public abstract class PsiAugmentProvider {
+  private static final Logger LOG = Logger.getInstance("#" + PsiAugmentProvider.class.getName());
   public static final ExtensionPointName<PsiAugmentProvider> EP_NAME = ExtensionPointName.create("com.intellij.lang.psiAugmentProvider");
 
   @NotNull
@@ -55,6 +57,8 @@ public abstract class PsiAugmentProvider {
    * @param typeElement place where inference takes place, 
    *                    also nested PsiTypeElement-s (e.g. for List<String> PsiTypeElements corresponding to both List and String would be suggested)
    * @return inferred type or null, if inference is not applicable
+   * 
+   * @since 14.1
    */
   @Nullable
   protected PsiType inferType(PsiTypeElement typeElement) {
@@ -64,9 +68,14 @@ public abstract class PsiAugmentProvider {
   @Nullable
   public static PsiType getInferredType(PsiTypeElement typeElement) {
     for (PsiAugmentProvider provider : Extensions.getExtensions(EP_NAME)) {
-      final PsiType type = provider.inferType(typeElement);
-      if (type != null) {
-        return type;
+      try {
+        final PsiType type = provider.inferType(typeElement);
+        if (type != null) {
+          return type;
+        }
+      }
+      catch (Exception e) {
+        LOG.error("provider: " + provider, e);
       }
     }
     return null;
index bf75430563edd348755aad9783c1269913e9ef25..028e067666fc6e6b58c0213e28ac3109e940b3d2 100644 (file)
 package com.intellij.psi.impl;
 
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.application.ReadActionProcessor;
 import com.intellij.openapi.progress.ProgressIndicatorProvider;
-import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.FileIndexFacade;
-import com.intellij.openapi.roots.PackageIndex;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileFilter;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.file.impl.JavaFileManager;
@@ -34,15 +29,14 @@ import com.intellij.psi.impl.source.JavaDummyHolder;
 import com.intellij.psi.impl.source.JavaDummyHolderFactory;
 import com.intellij.psi.impl.source.resolve.FileContextUtil;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.stubs.StubTreeLoader;
 import com.intellij.psi.util.PsiModificationTracker;
-import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.reference.SoftReference;
 import com.intellij.util.ConcurrencyUtil;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
+import com.intellij.util.containers.Predicate;
 import com.intellij.util.messages.MessageBus;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
@@ -94,7 +88,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
     ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly
 
-    if (DumbService.getInstance(getProject()).isDumb()) {
+    if (shouldUseSlowResolve()) {
       PsiClass[] classes = findClassesInDumbMode(qualifiedName, scope);
       if (classes.length != 0) {
         return classes[0];
@@ -134,7 +128,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   @Override
   @NotNull
   public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-    if (DumbService.getInstance(getProject()).isDumb()) {
+    if (shouldUseSlowResolve()) {
       return findClassesInDumbMode(qualifiedName, scope);
     }
 
@@ -147,6 +141,11 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
     return classes.toArray(new PsiClass[classes.size()]);
   }
 
+  private boolean shouldUseSlowResolve() {
+    DumbService dumbService = DumbService.getInstance(getProject());
+    return dumbService.isDumb() && dumbService.isAlternativeResolveEnabled();
+  }
+
   @NotNull
   private PsiElementFinder[] finders() {
     PsiElementFinder[] answer = myElementFinders;
@@ -161,7 +160,6 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   @NotNull
   private PsiElementFinder[] calcFinders() {
     List<PsiElementFinder> elementFinders = new ArrayList<PsiElementFinder>();
-    elementFinders.add(new PsiElementFinderImpl());
     ContainerUtil.addAll(elementFinders, myProject.getExtensions(PsiElementFinder.EP_NAME));
     return elementFinders.toArray(new PsiElementFinder[elementFinders.size()]);
   }
@@ -245,6 +243,56 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
     return result == null ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
   }
 
+  private static class AndPredicate implements Predicate<PsiNamedElement> {
+    private final List<Predicate<PsiNamedElement>> myComponents = new SmartList<Predicate<PsiNamedElement>>();
+
+    public AndPredicate(Predicate<PsiNamedElement> filter1, Predicate<PsiNamedElement> filter2) {
+      myComponents.add(filter1);
+      myComponents.add(filter2);
+    }
+
+    @Override
+    public boolean apply(@Nullable PsiNamedElement input) {
+      for (Predicate<PsiNamedElement> component : myComponents) {
+        if (!component.apply(input)) {
+          return false;
+        }
+      }
+      return true;
+    }
+  }
+
+  @NotNull
+  public PsiElement[] getPackageChildren(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    Map<String, PsiNamedElement> result = new HashMap<String, PsiNamedElement>();
+    Predicate<PsiNamedElement> filter = null;
+
+    for (PsiElementFinder finder : filteredFinders()) {
+      Predicate<PsiNamedElement> finderFilter = finder.getPackageChildrenFilter(psiPackage, scope);
+      if (finderFilter != null) {
+        if (filter == null) {
+          filter = finderFilter;
+        }
+        else if (filter instanceof AndPredicate) {
+          ((AndPredicate) filter).myComponents.add(finderFilter);
+        }
+        else {
+          filter = new AndPredicate(filter, finderFilter);
+        }
+      }
+    }
+
+    for (PsiElementFinder finder : filteredFinders()) {
+      PsiNamedElement[] children = finder.getChildren(psiPackage, scope);
+      for (PsiNamedElement child : children) {
+        if (!result.containsKey(child.getName()) && (filter == null || filter.apply(child))) {
+          result.put(child.getName(), child);
+        }
+      }
+    }
+    return result.values().toArray(new PsiElement[result.size()]);
+  }
+
   public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
                                            @NotNull GlobalSearchScope scope,
                                            @NotNull Processor<PsiDirectory> consumer,
@@ -274,146 +322,6 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
     return result.values().toArray(new PsiPackage[result.size()]);
   }
 
-  public PsiClass[] findClassByShortName(String name, PsiPackage psiPackage, GlobalSearchScope scope) {
-    List<PsiClass> result = null;
-    for (PsiElementFinder finder : filteredFinders()) {
-      PsiClass[] classes = finder.getClasses(name, psiPackage, scope);
-      if (classes.length == 0) continue;
-      if (result == null) result = new ArrayList<PsiClass>();
-      ContainerUtil.addAll(result, classes);
-    }
-
-    return result == null ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
-  }
-
-  private class PsiElementFinderImpl extends PsiElementFinder implements DumbAware {
-    @Override
-    public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-      return myFileManager.findClass(qualifiedName, scope);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-      return myFileManager.findClasses(qualifiedName, scope);
-    }
-
-    @Override
-    public PsiPackage findPackage(@NotNull String qualifiedName) {
-      return myFileManager.findPackage(qualifiedName);
-    }
-
-    @Override
-    @NotNull
-    public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-      final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
-      final String qualifiedName = psiPackage.getQualifiedName();
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        PsiDirectory[] subDirs = dir.getSubdirectories();
-        for (PsiDirectory subDir : subDirs) {
-          final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(subDir);
-          if (aPackage != null) {
-            final String subQualifiedName = aPackage.getQualifiedName();
-            if (subQualifiedName.startsWith(qualifiedName) && !packagesMap.containsKey(subQualifiedName)) {
-              packagesMap.put(aPackage.getQualifiedName(), aPackage);
-            }
-          }
-        }
-      }
-
-      packagesMap.remove(qualifiedName);    // avoid SOE caused by returning a package as a subpackage of itself
-      return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
-      return getClasses(null, psiPackage, scope);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] getClasses(@Nullable String shortName, @NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
-      List<PsiClass> list = null;
-      String packageName = psiPackage.getQualifiedName();
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(dir);
-        if (classes.length == 0) continue;
-        if (list == null) list = new ArrayList<PsiClass>();
-        for (PsiClass aClass : classes) {
-          // class file can be located in wrong place inside file system
-          String qualifiedName = aClass.getQualifiedName();
-          if (qualifiedName != null) qualifiedName = StringUtil.getPackageName(qualifiedName);
-          if (Comparing.strEqual(qualifiedName, packageName)) {
-            if (shortName == null || shortName.equals(aClass.getName())) list.add(aClass);
-          }
-        }
-      }
-      if (list == null) {
-        return PsiClass.EMPTY_ARRAY;
-      }
-
-      if (list.size() > 1) {
-        ContainerUtil.quickSort(list, new Comparator<PsiClass>() {
-          @Override
-          public int compare(PsiClass o1, PsiClass o2) {
-            VirtualFile file1 = PsiUtilCore.getVirtualFile(o1);
-            VirtualFile file2 = PsiUtilCore.getVirtualFile(o2);
-            return file1 == null ? file2 == null ? 0 : -1 : file2 == null ? 1 : scope.compare(file2, file1);
-          }
-        });
-      }
-
-      return list.toArray(new PsiClass[list.size()]);
-    }
-
-    @NotNull
-    @Override
-    public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-      Set<String> names = null;
-      FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        for (PsiFile file : dir.getFiles()) {
-          if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
-            VirtualFile vFile = file.getVirtualFile();
-            if (vFile != null &&
-                !(file instanceof PsiCompiledElement) &&
-                !facade.isInSourceContent(vFile) &&
-                (!scope.isForceSearchingInLibrarySources() ||
-                 !StubTreeLoader.getInstance().canHaveStub(vFile))) {
-              continue;
-            }
-
-            Set<String> inFile = file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());
-
-            if (inFile.isEmpty()) continue;
-            if (names == null) names = new HashSet<String>();
-            names.addAll(inFile);
-          }
-        }
-
-      }
-      return names == null ? Collections.<String>emptySet() : names;
-    }
-
-    @Override
-    public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
-                                             @NotNull final GlobalSearchScope scope,
-                                             @NotNull final Processor<PsiDirectory> consumer,
-                                             boolean includeLibrarySources) {
-      final PsiManager psiManager = PsiManager.getInstance(getProject());
-      return PackageIndex.getInstance(getProject()).getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
-        .forEach(new ReadActionProcessor<VirtualFile>() {
-          @Override
-          public boolean processInReadAction(final VirtualFile dir) {
-            if (!scope.contains(dir)) return true;
-            PsiDirectory psiDir = psiManager.findDirectory(dir);
-            return psiDir == null || consumer.process(psiDir);
-          }
-        });
-    }
-  }
-
   @Override
   public boolean isPartOfPackagePrefix(@NotNull String packageName) {
     final Collection<String> packagePrefixes = myFileManager.getNonTrivialPackagePrefixes();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java
new file mode 100644 (file)
index 0000000..2c48236
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl;
+
+import com.intellij.openapi.application.ReadActionProcessor;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.FileIndexFacade;
+import com.intellij.openapi.roots.PackageIndex;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.file.impl.JavaFileManager;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StubTreeLoader;
+import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * Created by kosyakov on 05.12.14.
+ */
+public class PsiElementFinderImpl extends PsiElementFinder implements DumbAware {
+
+  private final Project myProject;
+  private final JavaFileManager myFileManager;
+
+  public PsiElementFinderImpl(Project project, JavaFileManager javaFileManager) {
+    this.myProject = project;
+    this.myFileManager = javaFileManager;
+  }
+
+  @Override
+  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    return myFileManager.findClass(qualifiedName, scope);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    return myFileManager.findClasses(qualifiedName, scope);
+  }
+
+  @Override
+  public PsiPackage findPackage(@NotNull String qualifiedName) {
+    return myFileManager.findPackage(qualifiedName);
+  }
+
+  @Override
+  @NotNull
+  public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
+    final String qualifiedName = psiPackage.getQualifiedName();
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      PsiDirectory[] subDirs = dir.getSubdirectories();
+      for (PsiDirectory subDir : subDirs) {
+        final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(subDir);
+        if (aPackage != null) {
+          final String subQualifiedName = aPackage.getQualifiedName();
+          if (subQualifiedName.startsWith(qualifiedName) && !packagesMap.containsKey(subQualifiedName)) {
+            packagesMap.put(aPackage.getQualifiedName(), aPackage);
+          }
+        }
+      }
+    }
+
+    packagesMap.remove(qualifiedName);    // avoid SOE caused by returning a package as a subpackage of itself
+    return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
+    return getClasses(null, psiPackage, scope);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] getClasses(@Nullable String shortName, @NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
+    List<PsiClass> list = null;
+    String packageName = psiPackage.getQualifiedName();
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(dir);
+      if (classes.length == 0) continue;
+      if (list == null) list = new ArrayList<PsiClass>();
+      for (PsiClass aClass : classes) {
+        // class file can be located in wrong place inside file system
+        String qualifiedName = aClass.getQualifiedName();
+        if (qualifiedName != null) qualifiedName = StringUtil.getPackageName(qualifiedName);
+        if (Comparing.strEqual(qualifiedName, packageName)) {
+          if (shortName == null || shortName.equals(aClass.getName())) list.add(aClass);
+        }
+      }
+    }
+    if (list == null) {
+      return PsiClass.EMPTY_ARRAY;
+    }
+
+    if (list.size() > 1) {
+      ContainerUtil.quickSort(list, new Comparator<PsiClass>() {
+        @Override
+        public int compare(PsiClass o1, PsiClass o2) {
+          VirtualFile file1 = PsiUtilCore.getVirtualFile(o1);
+          VirtualFile file2 = PsiUtilCore.getVirtualFile(o2);
+          return file1 == null ? file2 == null ? 0 : -1 : file2 == null ? 1 : scope.compare(file2, file1);
+        }
+      });
+    }
+
+    return list.toArray(new PsiClass[list.size()]);
+  }
+
+  @NotNull
+  @Override
+  public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    Set<String> names = null;
+    FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      for (PsiFile file : dir.getFiles()) {
+        if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
+          VirtualFile vFile = file.getVirtualFile();
+          if (vFile != null &&
+              !(file instanceof PsiCompiledElement) &&
+              !facade.isInSourceContent(vFile) &&
+              (!scope.isForceSearchingInLibrarySources() || !StubTreeLoader.getInstance().canHaveStub(vFile))) {
+            continue;
+          }
+
+          Set<String> inFile =
+            file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());
+
+          if (inFile.isEmpty()) continue;
+          if (names == null) names = new HashSet<String>();
+          names.addAll(inFile);
+        }
+      }
+
+    }
+    return names == null ? Collections.<String>emptySet() : names;
+  }
+
+  @Override
+  public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
+                                           @NotNull final GlobalSearchScope scope,
+                                           @NotNull final Processor<PsiDirectory> consumer,
+                                           boolean includeLibrarySources) {
+    final PsiManager psiManager = PsiManager.getInstance(myProject);
+    return PackageIndex.getInstance(myProject).getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
+      .forEach(new ReadActionProcessor<VirtualFile>() {
+        @Override
+        public boolean processInReadAction(final VirtualFile dir) {
+          if (!scope.contains(dir)) return true;
+          PsiDirectory psiDir = psiManager.findDirectory(dir);
+          return psiDir == null || consumer.process(psiDir);
+        }
+      });
+  }
+}
index f0862c14ab79347dc6b2084ec56e4b342cb0776a..d1b0a3553a13fc0a4cfe34ae1ed98fb5d4970c42 100644 (file)
@@ -153,6 +153,17 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
     return getFacade().getClasses(this, scope);
   }
 
+  @NotNull
+  @Override
+  public PsiElement[] getChildren() {
+    return getChildren(allScope());
+  }
+
+  @Override
+  public PsiElement[] getChildren(@NotNull GlobalSearchScope scope) {
+    return getFacade().getPackageChildren(this, scope);
+  }
+
   @Override
   @Nullable
   public PsiModifierList getAnnotationList() {
index 85301458d047e86a4a97cdf1977bf67784b2ba4e..4225844fe754cc8533417e6d7b183eec60487246 100644 (file)
  */
 package com.intellij.psi.impl.source.javadoc;
 
+import com.intellij.psi.JavaDocTokenType;
 import com.intellij.psi.JavaElementVisitor;
 import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
 import com.intellij.psi.impl.source.tree.LeafPsiElement;
 import com.intellij.psi.javadoc.PsiDocToken;
 import com.intellij.psi.tree.IElementType;
@@ -42,6 +45,15 @@ public class PsiDocTokenImpl extends LeafPsiElement implements PsiDocToken{
     }
   }
 
+  @NotNull
+  @Override
+  public PsiReference[] getReferences() {
+    if (getTokenType() == JavaDocTokenType.DOC_COMMENT_DATA) {
+      return ReferenceProvidersRegistry.getReferencesFromProviders(this, PsiDocToken.class);
+    }
+    return super.getReferences();
+  }
+
   public String toString(){
     return "PsiDocToken:" + getTokenType().toString();
   }
index c310f5effc08e56a0ba0efc946f7861f99a0ab72..b5ca2ea117c316ed0b81733a232b8cb88e9ddd29 100644 (file)
@@ -61,6 +61,9 @@ public class JavaTreeGenerator implements TreeGenerator {
       final LanguageLevel level = PsiUtil.getLanguageLevel(original);
       final DummyHolder holder = DummyHolderFactory.createHolder(original.getManager(), new JavaDummyElement(text, MOD_LIST, level), null);
       final TreeElement modifierListElement = holder.getTreeElement().getFirstChildNode();
+      if (modifierListElement == null) {
+        throw new AssertionError("No modifier list for \"" + text + '\"');
+      }
       return markGeneratedIfNeeded(original, modifierListElement);
     }
 
@@ -148,7 +151,7 @@ public class JavaTreeGenerator implements TreeGenerator {
     return Factory.createSingleLeafElement(type, text, 0, text.length(), table, manager, CodeEditUtil.isNodeGenerated(original.getNode()));
   }
 
-  private static TreeElement markGeneratedIfNeeded(PsiElement original, TreeElement copy) {
+  private static TreeElement markGeneratedIfNeeded(@NotNull PsiElement original, @NotNull TreeElement copy) {
     if (CodeEditUtil.isNodeGenerated(original.getNode())) {
       copy.acceptTree(new GeneratedMarkerVisitor());
     }
index 9bbb90a677cd994cb9aa9d003f5624c93a92f90c..f8dbb9d2c1f3df5d35b4367160033511c89e5f9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -97,8 +97,9 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements
   @NotNull
   public PsiExpressionList getArgumentList() {
     PsiExpressionList list = (PsiExpressionList)findChildByRoleAsPsiElement(ChildRole.ARGUMENT_LIST);
-    if (list != null) return list;
-    LOG.error("Invalid PSI. Children:" + DebugUtil.psiToString(this, false));
+    if (list == null) {
+      LOG.error("Invalid PSI for'" + getText() + ". Parent:" + DebugUtil.psiToString(getParent(), false));
+    }
     return list;
   }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/javaDoc/LinksInJavaDoc.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/javaDoc/LinksInJavaDoc.java
new file mode 100644 (file)
index 0000000..f4d84f9
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * <a href="http://www.unicode.org/unicode/standard/standard.html">
+ * <i>The Unicode Standard</i></a>
+ */
+class LinksInJavaDoc {
+  // Since Java 7 classloading is parallel on parallel capable classloader (http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html)
+  // Parallel classloading avoids deadlocks like https://youtrack.jetbrains.com/issue/IDEA-131621,
+  // Use mailto:webmaster@jetbrains.com to report abuse
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterMethodTypeParamWithNestedClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterMethodTypeParamWithNestedClass.java
new file mode 100644 (file)
index 0000000..84d779f
--- /dev/null
@@ -0,0 +1,15 @@
+// "Create method 'f'" "true"
+public class CreateMethodTest {
+  public <T> void aMethod(final T t) {
+    class Nested {
+        public T call() {
+            T result = f(t);
+            return result;
+        }
+
+        private T f(T t) {
+            <selection>return null;</selection>
+        }
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeMethodTypeParamWithNestedClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeMethodTypeParamWithNestedClass.java
new file mode 100644 (file)
index 0000000..8af0154
--- /dev/null
@@ -0,0 +1,11 @@
+// "Create method 'f'" "true"
+public class CreateMethodTest {
+  public <T> void aMethod(final T t) {
+    class Nested {
+        public T call() {
+            T result = f<caret>(t);
+            return result;
+        }
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod-out.java b/java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod-out.java
new file mode 100644 (file)
index 0000000..0905286
--- /dev/null
@@ -0,0 +1,13 @@
+import java.util.List;
+
+class Foo {
+    <T> void method1(final T[] val) {
+        class Inner {
+            void method2() {
+                for (T t : <selection>val</selection><caret>) {
+
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod.java b/java/java-tests/testData/codeInsight/template/IterParameterizedInnerInMethod.java
new file mode 100644 (file)
index 0000000..1156365
--- /dev/null
@@ -0,0 +1,11 @@
+import java.util.List;
+
+class Foo {
+    <T> void method1(final T[] val) {
+        class Inner {
+            void method2() {
+                <caret>
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable.java
new file mode 100644 (file)
index 0000000..8c04272
--- /dev/null
@@ -0,0 +1,10 @@
+class Example {
+    <T> void test(T[] foo) {
+        new Runnable() {
+            @Override
+            public void run() {
+                foo.for<caret>
+            }
+        };
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/for/inAnonymousRunnable_after.java
new file mode 100644 (file)
index 0000000..0430bf5
--- /dev/null
@@ -0,0 +1,12 @@
+class Example {
+    <T> void test(T[] foo) {
+        new Runnable() {
+            @Override
+            public void run() {
+                for (T t : foo) {
+                    <caret>
+                }
+            }
+        };
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant.java b/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant.java
new file mode 100644 (file)
index 0000000..3ea40dd
--- /dev/null
@@ -0,0 +1,3 @@
+interface I {
+    String FOO = <selection>"hello";</selection>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant_after.java b/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromConstant_after.java
new file mode 100644 (file)
index 0000000..fc47db8
--- /dev/null
@@ -0,0 +1,10 @@
+import org.jetbrains.annotations.NotNull;
+
+interface I {
+    String FOO = newMethod();
+
+    @NotNull
+    private static String newMethod() {
+        return "hello";
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic.java b/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic.java
new file mode 100644 (file)
index 0000000..1272d81
--- /dev/null
@@ -0,0 +1,5 @@
+interface I {
+    static void foo () {
+        <selection>System.out.println("hello");</selection>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic_after.java b/java/java-tests/testData/refactoring/extractMethod/Method2InterfaceFromStatic_after.java
new file mode 100644 (file)
index 0000000..ba4666f
--- /dev/null
@@ -0,0 +1,9 @@
+interface I {
+    static void foo () {
+        newMethod();
+    }
+
+    private static void newMethod() {
+        System.out.println("hello");
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete.java b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete.java
new file mode 100644 (file)
index 0000000..fedc19b
--- /dev/null
@@ -0,0 +1,6 @@
+class Test {
+    void foo(int i) {
+        System.out.println(<caret>i);
+        System.out.println(i);
+    }
+}
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete_after.java b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/replaceOneLeaveParamToDelete_after.java
new file mode 100644 (file)
index 0000000..f759299
--- /dev/null
@@ -0,0 +1,6 @@
+class Test {
+    void foo(int i, int i1) {
+        System.out.println(i1);
+        System.out.println(i);
+    }
+}
diff --git a/java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/after/p/Foo.java b/java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/after/p/Foo.java
new file mode 100644 (file)
index 0000000..32d92b2
--- /dev/null
@@ -0,0 +1,13 @@
+package p;
+
+class Foo {
+  void bar() {}
+  void bar(int i){
+    bar();
+  }
+
+  {
+    bar();
+    bar(1);
+  }
+}
diff --git a/java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/before/p/Foo.java b/java/java-tests/testData/refactoring/renameMethod/multi/automaticallyRenamedOverloads/before/p/Foo.java
new file mode 100644 (file)
index 0000000..b4a1cea
--- /dev/null
@@ -0,0 +1,13 @@
+package p;
+
+class Foo {
+  void foo() {}
+  void foo(int i){
+    foo();
+  }
+
+  {
+    foo();
+    foo(1);
+  }
+}
index 3c077f1ca801b27d1d5446dae2460d0187c755a3..6be767a7248ef1f3f60f2b20e411aea4994dba4f 100644 (file)
@@ -259,6 +259,19 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase {
     assert lookup
   }
 
+  public void "test popup in javadoc local reference"() {
+    myFixture.configureByText("a.java", """
+    /**
+    * {@link #<caret>}
+    */
+      class Foo {
+        void foo() {}
+      }
+    """)
+    type 'f'
+    assert lookup
+  }
+
   public void "test autopopup in javadoc tag name"() {
     myFixture.configureByText("a.java", """
     /**
index 10d5bc064dcd5fabc43628d552242808099bf428..52c201d3cb54719a1348e08b3a914ec34da0b114 100644 (file)
@@ -4,10 +4,17 @@ import com.intellij.JavaTestUtil;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
 import com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection;
+import com.intellij.openapi.paths.WebReference;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiRecursiveElementWalkingVisitor;
+import com.intellij.psi.PsiReference;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.ArrayList;
+import java.util.List;
+
 
 public class JavadocHighlightingTest extends LightDaemonAnalyzerTestCase {
   private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/javaDoc";
@@ -107,6 +114,35 @@ public class JavadocHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
+  public void testLinksInJavaDoc() throws Exception {
+    configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+    final List<WebReference> refs = new ArrayList<WebReference>();
+    myFile.accept(new PsiRecursiveElementWalkingVisitor() {
+      @Override
+      public void visitElement(PsiElement element) {
+        for(PsiReference ref:element.getReferences()) {
+          if (ref instanceof WebReference) refs.add((WebReference)ref);
+        }
+
+        super.visitElement(element);
+      }
+    });
+
+    String[] targets = {"http://www.unicode.org/unicode/standard/standard.html",
+      "http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html",
+      "https://youtrack.jetbrains.com/issue/IDEA-131621",
+      "mailto:webmaster@jetbrains.com"
+    };
+    assertTrue(refs.size() == targets.length);
+    int i = 0;
+
+    for(WebReference ref:refs) {
+      assertEquals(ref.getCanonicalText(), targets[i++]);
+      assertTrue(ref.isSoft());
+      assertNotNull(ref.resolve());
+    }
+  }
+
   protected void doTest() throws Exception {
     super.doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
   }
index 9d51c0ccb5082a1c6e9907277f5ae6d8be641257..540f1e3caa313d61726e8d5f3c5b00eb4ff49d45 100644 (file)
@@ -71,8 +71,8 @@ public class ExternalJavadocPresentationTest extends LightCodeInsightTestCase {
       }
 
       @Override
-      public void doBuildFromStream(String url, Reader input, StringBuilder data, boolean search4Encoding) throws IOException {
-        super.doBuildFromStream(url, input, data, search4Encoding);
+      public void doBuildFromStream(String url, Reader input, StringBuilder data, boolean searchForEncoding) throws IOException {
+        super.doBuildFromStream(url, input, data, searchForEncoding);
       }
     }
     JavadocExternalTestFilter filter = new JavadocExternalTestFilter(getProject());
index 5b2ff9d54ff06b7dd11da8d186ebe08ac10d26a8..e2ccb58f981a2917c24b0e97dc2c79585381587f 100644 (file)
@@ -385,6 +385,13 @@ class Foo {
     checkResult();
   }
 
+  public void testIterParameterizedInnerInMethod() {
+    configure();
+    startTemplate("iter", "iterations")
+    stripTrailingSpaces();
+    checkResult();
+  }
+
   public void testAsListToar() {
     configure();
     startTemplate("toar", "other")
@@ -955,6 +962,4 @@ class Foo {
 }
 """)
   }
-
-
 }
index bf8c755556186227cf535d20c6e9af2dfb294bed..ff29755dd05e6f797a06040e9bcad4f77b064214 100644 (file)
@@ -34,6 +34,10 @@ public class ForeachTemplateTest extends PostfixTemplateTestCase {
     doTest();
   }
 
+  public void testInAnonymousRunnable() {
+    doTest();
+  }
+
   public void testFinalLocals() {
     CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
     boolean oldGenerateFinalLocals = settings.GENERATE_FINAL_LOCALS;
index 1ee47eccb835cbffae02a0b9bd93b6d2eb3a61e5..2d2aeb7c92e559830257e84464b395861bc52262 100644 (file)
@@ -16,6 +16,8 @@
 package com.intellij.codeInspection
 
 import com.intellij.codeInspection.dataFlow.ContractInference
+import com.intellij.psi.PsiAnonymousClass
+import com.intellij.psi.util.PsiTreeUtil
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 
 /**
@@ -448,6 +450,27 @@ public static boolean isBlank(String s) {
     assert c == ['null -> true']
   }
 
+  public void "test no inference for unused anonymous class methods where annotations won't be used anyway"() {
+    def method = PsiTreeUtil.findChildOfType(myFixture.addClass("""
+class Foo {{
+  new Object() {
+    Object foo() { return null;}
+  };
+}}"""), PsiAnonymousClass).methods[0]
+    assert ContractInference.inferContracts(method).collect { it as String } == []
+  }
+
+  public void "test inference for used anonymous class methods"() {
+    def method = PsiTreeUtil.findChildOfType(myFixture.addClass("""
+class Foo {{
+  new Object() {
+    Object foo() { return null;}
+    Object bar() { return foo();}
+  };
+}}"""), PsiAnonymousClass).methods[0]
+    assert ContractInference.inferContracts(method).collect { it as String } == [' -> null']
+  }
+
   private String inferContract(String method) {
     return assertOneElement(inferContracts(method))
   }
index 8a7340c76093ffa92ae413358bb286d176617712..c3d5bc8cafd2b5674e70f0cb830dbc793248ab8e 100644 (file)
@@ -132,14 +132,16 @@ public class BytecodeAnalysisIntegrationTest extends JavaCodeInsightFixtureTestC
   public void testInferredAnnoGutter() {
     setUpLibraries();
     openDecompiledClass("org.apache.velocity.util.ExceptionUtils");
-    checkHasGutter("<html><i>@Contract(&quot;null,_,_-&gt;null&quot;)</i>&nbsp;\n" +
+    checkHasGutter("<html><i>Inferred</i> annotations available. Full signature:<p>\n" +
+                   "<i>@Contract(&quot;null,_,_-&gt;null&quot;)</i>&nbsp;\n" +
                    "public static&nbsp;Throwable&nbsp;<b>createWithCause</b>(");
   }
 
   public void testExternalAnnoGutter() {
     setUpExternalUpAnnotations();
     openDecompiledClass("java.lang.Boolean");
-    checkHasGutter("<html>@org.jetbrains.annotations.Contract(&quot;null-&gt;false&quot;)&nbsp;\n" +
+    checkHasGutter("<html>External and <i>inferred</i> annotations available. Full signature:<p>\n" +
+                   "@org.jetbrains.annotations.Contract(&quot;null-&gt;false&quot;)&nbsp;\n" +
                    "private static&nbsp;boolean&nbsp;<b>toBoolean</b>(@org.jetbrains.annotations.Nullable&nbsp;String&nbsp;var0)</html>");
   }
 
index 305454563ab8f6baa9261f3cb1a0038c6200ea54..77be162dce7c0f123746f2b9148bea9cf3a0b891 100644 (file)
@@ -39,11 +39,6 @@ public class FileTemplateTestUtil {
     public File getConfigRoot(boolean create) {
       return myTestConfigDir;
     }
-
-    @Override
-    public void saveTemplates() {
-      super.saveTemplates();
-    }
   }
 
   public static void loadCustomizedContent(FTManager templateManager) {
index 220956b56aa447d65c187d716d24b9a4cd18456f..327ab42363f371af1025e532877ab743f524d9e0 100644 (file)
@@ -581,6 +581,14 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
   public void testMethod2Interface() throws Exception {
     doTest();
   }
+  
+  public void testMethod2InterfaceFromStatic() throws Exception {
+    doTest();
+  }
+
+  public void testMethod2InterfaceFromConstant() throws Exception {
+    doTest();
+  }
 
   public void testParamDetection() throws Exception {
     doTest();
index b0749bf56f728cc2936d67c6de48aef15b94c0b7..6eb55cf539d21bb28d53cd2c17e7d31987b74174 100644 (file)
@@ -60,6 +60,14 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
     });
   }
 
+  public void testReplaceOneLeaveParamToDelete() throws Exception {
+    doTest(new Pass<AbstractInplaceIntroducer>() {
+      @Override
+      public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
+      }
+    });
+  }
+
   public void testReplaceAllBrokenIdentifier() throws Exception {
     doTest(new Pass<AbstractInplaceIntroducer>() {
       @Override
index cb354a6c0b7f69993b38b2ea7cffef38391a69df..9df3bebcd6dd253be48d883fd78d5a4bce50d68e 100644 (file)
 package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
+import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.refactoring.rename.RenameProcessor;
+import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
 import org.jetbrains.annotations.NotNull;
 import org.junit.Assert;
 
@@ -84,6 +87,10 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
     doTest("void test123(int i, int j)", "test123asd");
   }
 
+  public void testAutomaticallyRenamedOverloads() throws Exception {
+    doAutomaticRenameMethod("p.Foo", "void foo()", "bar");
+  }
+
   private void doTest(final String methodSignature, final String newName) throws Exception {
     doTest(getTestName(false), methodSignature, newName);
   }
@@ -105,4 +112,27 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
     });
   }
 
+  private void doAutomaticRenameMethod(final String className, final String methodSignature, final String newName) throws Exception {
+    doTest(new PerformAction() {
+      @Override
+      public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
+        final JavaPsiFacade manager = getJavaFacade();
+        final PsiClass aClass = manager.findClass(className, GlobalSearchScope.moduleScope(myModule));
+        assertNotNull(aClass);
+        final PsiMethod methodBySignature = aClass.findMethodBySignature(manager.getElementFactory().createMethodFromText(
+          methodSignature + "{}", null), false);
+        assertNotNull(methodBySignature);
+
+        final RenameProcessor processor = new RenameProcessor(myProject, methodBySignature, newName, false, false);
+        for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
+          processor.addRenamerFactory(factory);
+        }
+        processor.run();
+        PsiDocumentManager.getInstance(myProject).commitAllDocuments();
+        FileDocumentManager.getInstance().saveAllDocuments();
+      }
+    });
+  }
+
+
 }
index 3164a297a8b9105a92804424d590c23d6d3b40d7..e1494de5a0a1bfd4a63cea2632bda4a90c1c43b8 100644 (file)
@@ -468,19 +468,19 @@ public class JavaReplaceHandler extends StructuralReplaceHandler {
     final int elementOffset = affectedElement.getTextOffset();
     final int finalStartOffset = startOffset + elementOffset;
     final int finalEndOffset = endOffset + elementOffset;
-    final List<PsiReferenceExpression> references = new ArrayList<PsiReferenceExpression>();
+    final List<PsiJavaCodeReferenceElement> references = new ArrayList<PsiJavaCodeReferenceElement>();
     final JavaRecursiveElementVisitor collector = new JavaRecursiveElementVisitor() {
       @Override
-      public void visitReferenceExpression(PsiReferenceExpression expression) {
-        final int offset = expression.getTextOffset();
+      public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
+        final int offset = reference.getTextOffset();
         if (offset > finalEndOffset) {
           return;
         }
-        super.visitReferenceExpression(expression);
-        if (offset + expression.getTextLength() < finalStartOffset) {
+        super.visitReferenceElement(reference);
+        if (offset + reference.getTextLength() < finalStartOffset) {
           return;
         }
-        final PsiElement target = expression.resolve();
+        final PsiElement target = reference.resolve();
         if (!(target instanceof PsiMember)) {
           return;
         }
@@ -488,14 +488,14 @@ public class JavaReplaceHandler extends StructuralReplaceHandler {
         if (!member.hasModifierProperty(PsiModifier.STATIC)) {
           return;
         }
-        if (expression.getQualifierExpression<