Merge remote-tracking branch 'origin/master' into diff-cleanup
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 18 Jun 2015 14:52:56 +0000 (17:52 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 18 Jun 2015 14:52:56 +0000 (17:52 +0300)
404 files changed:
bin/linux/fsnotifier-arm [new file with mode: 0644]
build/scripts/utils.gant
java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java
java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java
java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java
java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java
java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaLineBreakpointProperties.java
java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java
java/execution/openapi/src/com/intellij/execution/JavaExecutionUtil.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionToCatchFix.java
java/java-impl/src/com/intellij/codeInsight/generation/GenerateEqualsHandler.java
java/java-impl/src/com/intellij/codeInsight/generation/GenerateGetterSetterHandlerBase.java
java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
java/java-impl/src/com/intellij/codeInsight/generation/JavaImplementMethodsHandler.java
java/java-impl/src/com/intellij/codeInsight/generation/JavaOverrideMethodsHandler.java
java/java-impl/src/com/intellij/refactoring/IntroduceHandlerBase.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ControlFlowWrapper.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodHandler.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectHandler.java
java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectHandler.java
java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java
java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java [moved from plugins/junit/src/com/intellij/execution/junit/JUnitRunLineMarkerProvider.java with 67% similarity]
java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java
java/java-psi-api/src/com/intellij/psi/PsiExpression.java
java/java-psi-api/src/com/intellij/psi/PsiSuperExpression.java
java/java-psi-api/src/com/intellij/psi/PsiThisExpression.java
java/java-psi-impl/src/com/intellij/lang/java/parser/ExpressionParser.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassObjectAccessExpressionImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/PsiReferenceListImpl.java
java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt
java/java-tests/testData/psi/parser-full/annotationParsing/annotation/ParameterizedMethod.txt
java/java-tests/testData/psi/parser-full/annotationParsing/annotation/QualifiedAnnotation.txt
java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt
java/java-tests/testData/psi/parser-full/commonParsing/RefParamsAfterError.txt
java/java-tests/testData/psi/parser-full/declarationParsing/class/Errors0.txt
java/java-tests/testData/psi/parser-full/declarationParsing/class/Errors1.txt
java/java-tests/testData/psi/parser-full/declarationParsing/class/Errors2.txt
java/java-tests/testData/psi/parser-full/declarationParsing/class/ParametrizedClass.txt
java/java-tests/testData/psi/parser-full/declarationParsing/class/Pines.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/CompletionHack.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/CompletionHack1.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/Errors0.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/Errors1.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/Errors2.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/GenericMethod.txt
java/java-tests/testData/psi/parser-full/declarationParsing/method/GenericMethodErrors.txt
java/java-tests/testData/psi/parser-full/expressionParsing/AnonymousErrors.txt
java/java-tests/testData/psi/parser-full/expressionParsing/AnonymousErrors1.txt
java/java-tests/testData/psi/parser-full/expressionParsing/QualifiedSuperMethodCall1.txt
java/java-tests/testData/psi/parser-full/javadocParsing/TypeParam.txt
java/java-tests/testData/psi/parser-partial/declarations/CompletionHack0.txt
java/java-tests/testData/psi/parser-partial/declarations/CompletionHack1.txt
java/java-tests/testData/psi/parser-partial/declarations/Errors.txt
java/java-tests/testData/psi/parser-partial/declarations/GenericMethod.txt
java/java-tests/testData/psi/parser-partial/declarations/GenericMethodErrors.txt
java/java-tests/testData/psi/parser-partial/declarations/ParameterizedClass.txt
java/java-tests/testData/psi/parser-partial/declarations/ParameterizedMethod.txt
java/java-tests/testData/psi/parser-partial/declarations/Pines.txt
java/java-tests/testData/psi/parser-partial/declarations/TypeAnno.txt
java/java-tests/testData/psi/parser-partial/expressions/QualifiedSuperMethodCall1.txt
java/java-tests/testData/psi/parser-partial/expressions/QualifiedSuperMethodCall3.txt [new file with mode: 0644]
java/java-tests/testData/psi/parser-partial/references/AnyType.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams0.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams1.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams2.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams3.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams4.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams5.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams6.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams7.txt
java/java-tests/testData/psi/parser-partial/references/TypeParams8.txt
java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/extractMethod/GuardMethodDuplicates1_after.java
java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplement15Test.java
java/java-tests/testSrc/com/intellij/codeInsight/navigation/JavaGotoSuperTest.java
java/java-tests/testSrc/com/intellij/lang/java/parser/partial/ExpressionParserTest.java
java/java-tests/testSrc/com/intellij/navigation/GotoImplementationTest.java
java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/AbstractNewLineBlocksIteratorTest.java [moved from java/java-tests/testSrc/com/intellij/psi/autodetect/AbstractNewLineBlocksIteratorTest.java with 98% similarity]
java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/DetectIndentAndTypeTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/JavaAutoDetectIndentTest.java [moved from java/java-tests/testSrc/com/intellij/psi/autodetect/JavaAutoDetectIndentTest.java with 97% similarity]
java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/NewLineBlocksIteratorTest.java [moved from java/java-tests/testSrc/com/intellij/psi/autodetect/NewLineBlocksIteratorTest.java with 96% similarity]
java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodTest.java
java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java
java/java-tests/testSrc/com/intellij/unscramble/UnscrambleDialogTest.java
java/openapi/src/com/intellij/codeInsight/generation/actions/BaseGenerateAction.java
java/testFramework/src/com/intellij/JavaTestUtil.java [moved from java/java-tests/testSrc/com/intellij/JavaTestUtil.java with 83% similarity]
java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java
java/testFramework/src/com/intellij/debugger/DebuggerTestCase.java
java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java
jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
jps/jps-builders/src/org/jetbrains/jps/javac/ExternalJavacManager.java [moved from jps/jps-builders/src/org/jetbrains/jps/javac/ExternalJavacServer.java with 59% similarity]
jps/jps-builders/src/org/jetbrains/jps/javac/JavacServerBootstrap.java [deleted file]
jps/model-api/src/org/jetbrains/jps/service/SharedThreadPool.java
jps/model-api/src/org/jetbrains/jps/service/ThreadExecutor.java [moved from platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointVariant.java with 57% similarity]
lib/jna.jar
lib/serviceMessages.jar
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightingSessionImpl.java
platform/core-api/src/com/intellij/openapi/options/ExternalInfo.java
platform/core-api/src/com/intellij/openapi/vfs/impl/ArchiveHandler.java
platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java
platform/core-impl/src/com/intellij/core/CoreProjectEnvironment.java
platform/core-impl/src/com/intellij/core/CorePsiDocumentManager.java
platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java
platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java
platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java
platform/core-impl/src/com/intellij/util/DocumentUtil.java
platform/editor-ui-api/src/com/intellij/openapi/editor/bidi/BidiRegionsSeparator.java [new file with mode: 0644]
platform/editor-ui-api/src/com/intellij/openapi/editor/bidi/LanguageBidiRegionsSeparator.java [new file with mode: 0644]
platform/indexing-impl/src/com/intellij/psi/impl/search/CachesBasedRefSearcher.java
platform/lang-api/src/com/intellij/codeInsight/CodeInsightActionHandler.java
platform/lang-api/src/com/intellij/codeInsight/actions/CodeInsightAction.java
platform/lang-api/src/com/intellij/formatting/Indent.java
platform/lang-api/src/com/intellij/lang/ContextAwareActionHandler.java [new file with mode: 0644]
platform/lang-api/src/com/intellij/lang/ExpressionTypeProvider.java
platform/lang-api/src/com/intellij/refactoring/RefactoringActionHandler.java
platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/EditorTracker.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/SmartPointerEditorTracker.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableActionHandlerBasedAction.java
platform/lang-impl/src/com/intellij/codeInsight/hint/ShowExpressionTypeHandler.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
platform/lang-impl/src/com/intellij/execution/lineMarker/RunLineMarkerInfo.java
platform/lang-impl/src/com/intellij/find/replaceInProject/ReplaceInProjectManager.java
platform/lang-impl/src/com/intellij/formatting/IndentImpl.java
platform/lang-impl/src/com/intellij/formatting/contextConfiguration/CodeFragmentCodeStyleSettingsPanel.java
platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleOnSelectedFragment.java
platform/lang-impl/src/com/intellij/formatting/contextConfiguration/SelectedTextFormatter.java
platform/lang-impl/src/com/intellij/ide/extensionResources/ExtensionsRootType.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/extensionResources/ResourceVersions.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/extensionResources/RestoreBundledExtensionsAction.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java
platform/lang-impl/src/com/intellij/openapi/editor/bidi/PlainTextBidiRegionsSeparator.java [moved from platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointVariantsProvider.java with 61% similarity]
platform/lang-impl/src/com/intellij/openapi/editor/bidi/TokenSetBidiRegionsSeparator.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeConfigurable.java
platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectableIndentOptionsProvider.java
platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/FormatterBasedLineIndentInfoBuilder.java
platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/IndentOptionsDetectorImpl.java
platform/lang-impl/src/com/intellij/psi/formatter/common/NewLineBlocksIterator.java
platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java
platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java
platform/lang-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java
platform/platform-api/src/com/intellij/openapi/fileTypes/UserFileType.java
platform/platform-api/src/com/intellij/ui/CollectionListModel.java
platform/platform-api/src/com/intellij/util/config/ToggleBooleanProperty.java
platform/platform-api/src/com/intellij/util/config/ToggleInvertedBooleanProperty.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/IntelliJLaf.java
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonLeft.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonLeft@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonMiddle.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonMiddle@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonRight.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/buttonRight@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonLeft.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonLeft@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonMiddle.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonMiddle@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonRight.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/selectedButtonRight@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJButtonBorder.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJButtonUI.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJLabelUI.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf_mac.properties
platform/platform-impl/src/com/intellij/openapi/editor/actions/ChangeEditorFontSizeAction.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/ComplementaryFontsRegistry.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorView.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java
platform/platform-impl/src/com/intellij/util/Urls.java
platform/platform-resources-en/src/messages/ExecutionBundle.properties
platform/platform-resources-en/src/messages/FindBundle.properties
platform/platform-resources-en/src/messages/ToolsBundle.properties
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/META-INF/XmlPlugin.xml
platform/platform-resources/src/brokenPlugins.txt
platform/platform-resources/src/checkedPlugins.txt
platform/platform-resources/src/componentSets/Lang.xml
platform/platform-resources/src/idea/Keymap_Xcode.xml
platform/platform-resources/src/idea/LangActions.xml
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java
platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NonProjectFileAccessTest.java
platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkImpl.java
platform/remote-servers/impl/resources/resources/cloud.properties
platform/remote-servers/impl/resources/tips/UploadSshKey.html [deleted file]
platform/remote-servers/impl/resources/tips/images/SSHKeyUpload.png [deleted file]
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/deployment/DeployToServerSettingsEditor.java
platform/remote-servers/impl/src/com/intellij/remoteServer/statistics/CloudFeaturesProvider.java [deleted file]
platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudsTriggerKeys.java [new file with mode: 0644]
platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java
platform/script-debugger/protocol/protocol-model-generator/src/DomainGenerator.kt
platform/script-debugger/protocol/protocol-model-generator/src/ResolveAndGenerateScope.kt
platform/script-debugger/protocol/protocol-model-generator/src/StandaloneTypeBinding.kt
platform/script-debugger/protocol/protocol-model-generator/src/TypeVisitor.kt
platform/script-debugger/protocol/protocol-reader/src/MethodHandler.kt
platform/script-debugger/protocol/protocol-reader/src/TextOutput.kt
platform/script-debugger/protocol/schema-reader-generator/src/ItemDescriptor.kt
platform/script-debugger/protocol/schema-reader-generator/src/ProtocolMetaModel.kt
platform/script-debugger/protocol/schema-reader-generator/src/SchemaReaderGenerator.kt
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/ShowStatisticsAction.java
platform/testFramework/src/com/intellij/TestAll.java
platform/testFramework/src/com/intellij/TestCaseLoader.java
platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/HeavyIdeaTestFixtureImpl.java
platform/testRunner/src/com/intellij/execution/testframework/ToolbarPanel.java
platform/testRunner/src/com/intellij/execution/testframework/stacktrace/DiffHyperlink.java
platform/util-rt/src/com/intellij/openapi/util/Conditions.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java
platform/util/src/com/intellij/execution/process/ProcessWaitFor.java
platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java
platform/util/src/com/intellij/util/containers/JBIterable.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/util/testSrc/com/intellij/execution/process/ProcessWaitForTest.java [deleted file]
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/ApplyBinaryFilePatch.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/ApplyBinaryShelvedFilePatch.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/ApplyFilePatchBase.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/ApplyTextFilePatch.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/AbstractFilePatchInProgress.java [moved from platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java with 73% similarity]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDefaultExecutor.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchExecutor.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/AutoMatchIterator.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/AutoMatchStrategy.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryFilePatchInProgress.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/DefaultPatchStrategy.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ImportToShelfExecutor.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/IndividualPiecesStrategy.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/OneBaseStrategy.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/TextFilePatchInProgress.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/UnshelveWithDialogAction.java
platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/ConvertExcludedToIgnoredTest.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/MemberSignature.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/SerialVersionUIDBuilder.java
plugins/InspectionGadgets/test/com/siyeh/igfixes/serialization/serialVersionUID/ClassAccess.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/serialization/serialVersionUID/ClassAccess.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/serialization/AddSerialVersionUIDFixTest.java [new file with mode: 0644]
plugins/cucumber-jvm-formatter/src/org/jetbrains/plugins/cucumber/java/run/CucumberJvmSMFormatter.java
plugins/devkit/src/testAssistant/NavigateToTestDataAction.java
plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java
plugins/git4idea/src/META-INF/plugin.xml
plugins/git4idea/src/git4idea/branch/GitBranchUiHandler.java
plugins/git4idea/src/git4idea/stash/GitShelveUtils.java
plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java
plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java [new file with mode: 0644]
plugins/git4idea/src/git4idea/util/GitPreservingProcess.java
plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.groovy [deleted file]
plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java [new file with mode: 0644]
plugins/git4idea/tests/git4idea/test/GitScenarios.groovy [deleted file]
plugins/git4idea/tests/git4idea/test/GitScenarios.java [new file with mode: 0644]
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/AbstractJavaFXTestCase.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXCollapseSubtagToAttributeTest.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXDaemonAnalyzerTestCase.java [deleted file]
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXExpandAttributeTest.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXImportTest.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXQuickfixTest.java
plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXRenameTest.java
plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/descriptors/JavaFxPropertyAttributeDescriptor.java
plugins/junit/src/META-INF/plugin.xml
plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationProducer.java
plugins/junit/src/com/intellij/execution/junit/TestMethods.java
plugins/junit/src/com/intellij/execution/junit/TestPackage.java
plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java
plugins/junit_rt/junit_rt.iml
plugins/junit_rt/src/com/intellij/junit3/JUnit3IdeaTestRunner.java
plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java
plugins/junit_rt/src/com/intellij/rt/execution/junit/MapSerializerUtil.java [new file with mode: 0644]
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryAttachHandler.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/WrongPropertyKeyValueDelimiterInspection.java
plugins/properties/src/META-INF/plugin.xml
plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form
plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopyFormat.java
plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java
plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfiguration.java
plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationProducer.java
plugins/testng/src/com/theoryinpractice/testng/inspection/TestNGDataProviderInspection.java
plugins/testng/testSources/com/theoryinpractice/testng/configuration/TestNGTreeHierarchyTest.java
plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java
plugins/testng_rt/src/org/testng/MapSerializerUtil.java [new file with mode: 0644]
plugins/testng_rt/testng_rt.iml
python/pluginResources/META-INF/plugin.xml
python/pluginTestResources/app.yaml [moved from python/pluginResources/app.yaml with 100% similarity]
python/pluginTestResources/main.py [moved from python/pluginResources/main.py with 100% similarity]
python/psi-api/src/com/jetbrains/python/psi/resolve/RatedResolveResult.java
python/python-community-plugin-resources.iml [new file with mode: 0644]
python/python-plugin-tests.iml
python/resources/idea/PyCharmCoreApplicationInfo.xml
python/src/com/jetbrains/python/PyBundle.properties
python/src/com/jetbrains/python/formatter/PyBlock.java
python/src/com/jetbrains/python/formatter/PyCodeStyleSettings.java
python/src/com/jetbrains/python/formatter/PyLanguageCodeStyleSettingsProvider.java
python/src/com/jetbrains/python/formatter/PythonFormattingModelBuilder.java
python/src/com/jetbrains/python/psi/PsiQuery.java
python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java
python/src/com/jetbrains/python/refactoring/move/PyMoveFileHandler.java
python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersProcessor.java
python/src/com/jetbrains/python/refactoring/move/PyMoveSymbolProcessor.java
python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
python/testData/addImport/localFromImport.after.py
python/testData/addImport/localImport.after.py
python/testData/addImport/localImportInlineBranch.after.py
python/testData/addImport/localImportInlineFunctionBody.after.py
python/testData/formatter/noBlankLinesAfterLocalImports.py [new file with mode: 0644]
python/testData/formatter/noBlankLinesAfterLocalImports_after.py [new file with mode: 0644]
python/testData/formatter/twoLinesBetweenTopLevelStatementAndDeclarationsWithComment.py [new file with mode: 0644]
python/testData/formatter/twoLinesBetweenTopLevelStatementAndDeclarationsWithComment_after.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/after/src/Animals/Cat.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/after/src/Animals/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/after/src/Animals/test/Carnivore.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/after/src/Animals/test/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/before/src/Animals/Carnivore.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/before/src/Animals/Cat.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/before/src/Animals/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/moveModuleWithSameNameAsSymbolInside/before/src/Animals/test/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/after/src/a.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/after/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/after/src/pkg/b.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/after/src/pkg/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/after/src/pkg/subpkg/c.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/before/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/before/src/pkg/a.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/before/src/pkg/b.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/before/src/pkg/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/oldStyleRelativeImport/before/src/pkg/subpkg/c.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsInsideMovedModule/after/src/subpkg1/mod1.py
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/pkg/m5.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/m1.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/m2.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/m3.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/subsubpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/after/src/subpkg/subsubpkg/m4.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/m5.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/m1.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/m2.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/m3.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/subsubpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/relativeImportsToModulesInSameMovedPackageNotUpdated/before/src/pkg/subpkg/subsubpkg/m4.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/after/src/m1.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/after/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/after/src/pkg/m2.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/after/src/pkg/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/after/src/pkg/subpkg/m3.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/before/src/pkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/before/src/pkg/m1.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/before/src/pkg/m2.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/before/src/pkg/subpkg/__init__.py [new file with mode: 0644]
python/testData/refactoring/move/usagesOfUnqualifiedOldStyleRelativeImportsInsideMovedModule/before/src/pkg/subpkg/m3.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/PyFormatterTest.java
python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java
resources-en/src/messages/QuickFixBundle.properties
resources/src/META-INF/IdeaPlugin.xml
resources/src/idea/RunManager.xml
spellchecker/src/com/intellij/spellchecker/inspections/SpellCheckingInspection.java
spellchecker/testData/inspection/commentsWithMistakes/SPITest1.java
xml/dom-tests/tests/com/intellij/util/xml/DomFileDescriptionTest.java
xml/impl/src/com/intellij/openapi/editor/bidi/XmlBidiRegionsSeparator.java [new file with mode: 0644]

diff --git a/bin/linux/fsnotifier-arm b/bin/linux/fsnotifier-arm
new file mode 100644 (file)
index 0000000..a71b582
Binary files /dev/null and b/bin/linux/fsnotifier-arm differ
index f6156766438ad185077ad535b2f6cd318ee5189a..342a02b94098c1a7f8da945d43bd7ecbe56544f0 100644 (file)
@@ -318,6 +318,7 @@ binding.setVariable("wireBuildDate", { String buildNumber, String appInfoFile ->
 binding.setVariable("commonJvmArgsForTests", {
   def jdwp = "-Xrunjdwp:transport=dt_socket,server=y,suspend=$debugSuspend"
   if (debugPort != null) jdwp += ",address=$debugPort"
+
   return [
     "-ea",
     "-Dio.netty.leakDetectionLevel=PARANOID",
index 92d1bcd74d890082f9f626d15b9408a7793956f6..120b5960190eeccfbeb7379410010a2d28999be4 100644 (file)
@@ -232,21 +232,23 @@ public class BuildManager implements ApplicationComponent{
           return pathname.isDirectory() && !TEMP_DIR_NAME.equals(pathname.getName());
         }
       });
-      final Date now = new Date();
-      for (File buildDataProjectDir : dirs) {
-        final File usageFile = getUsageFile(buildDataProjectDir);
-        if (usageFile.exists()) {
-          final Pair<Date, File> usageData = readUsageFile(usageFile);
-          if (usageData != null) {
-            final File projectFile = usageData.second;
-            if ((projectFile != null && !projectFile.exists()) || DateFormatUtil.getDifferenceInDays(usageData.first, now) > unusedThresholdDays) {
-              LOG.info("Clearing project build data because the project does not exist or was not opened for more than " + unusedThresholdDays + " days: " + buildDataProjectDir.getPath());
-              FileUtil.delete(buildDataProjectDir);
+      if (dirs != null) {
+        final Date now = new Date();
+        for (File buildDataProjectDir : dirs) {
+          final File usageFile = getUsageFile(buildDataProjectDir);
+          if (usageFile.exists()) {
+            final Pair<Date, File> usageData = readUsageFile(usageFile);
+            if (usageData != null) {
+              final File projectFile = usageData.second;
+              if ((projectFile != null && !projectFile.exists()) || DateFormatUtil.getDifferenceInDays(usageData.first, now) > unusedThresholdDays) {
+                LOG.info("Clearing project build data because the project does not exist or was not opened for more than " + unusedThresholdDays + " days: " + buildDataProjectDir.getPath());
+                FileUtil.delete(buildDataProjectDir);
+              }
             }
           }
-        }
-        else {
-          updateUsageFile(null, buildDataProjectDir); // set usage stamp to start countdown
+          else {
+            updateUsageFile(null, buildDataProjectDir); // set usage stamp to start countdown
+          }
         }
       }
     }
@@ -1443,6 +1445,7 @@ public class BuildManager implements ApplicationComponent{
 
     @Override
     public void projectOpened(final Project project) {
+      if (ApplicationManager.getApplication().isUnitTestMode()) return;
       final MessageBusConnection conn = project.getMessageBus().connect();
       myConnections.put(project, conn);
       conn.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
index 22fd6c6527efcaf32a5c0b644f7f5185f8ae9073..74ad7cfae9b1f4f0b9dc266773839e559aeff7e7 100644 (file)
@@ -22,6 +22,7 @@ package com.intellij.compiler;
 import com.intellij.openapi.components.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.util.xmlb.XmlSerializerUtil;
 
 @State(
@@ -60,6 +61,6 @@ public class CompilerWorkspaceConfiguration implements PersistentStateComponent<
   }
 
   public boolean allowAutoMakeWhileRunningApplication() {
-    return false;/*ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION*/
+    return Registry.is("compiler.automake.allow.when.app.running", false);/*ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION*/
   }
 }
index f39eb4b336fdf7ac10e2a5ed8a4bcb100fc6bf37..e917fb2a1df77f5552839c0ecb47c8a9801ae996 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,13 +21,9 @@ import com.intellij.debugger.engine.BasicStepMethodFilter;
 import com.intellij.debugger.engine.LambdaMethodFilter;
 import com.intellij.debugger.engine.MethodFilter;
 import com.intellij.debugger.impl.DebuggerSession;
-import com.intellij.openapi.actionSystem.ActionManager;
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.fileEditor.TextEditor;
-import com.intellij.openapi.keymap.KeymapUtil;
-import com.intellij.openapi.ui.popup.ListPopup;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
 import com.intellij.ui.awt.RelativePoint;
@@ -38,10 +34,8 @@ import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import javax.swing.*;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
-import java.awt.event.ActionEvent;
 import java.util.Collections;
 import java.util.List;
 
@@ -78,27 +72,9 @@ public abstract class JvmSmartStepIntoHandler {
             session.stepInto(true, createMethodFilter(chosenTarget));
           }
         });
-        final ListPopup popup = new ListPopupImpl(popupStep) {
-          @Override
-          protected JComponent createContent() {
-            registerExtraHandleShortcuts(XDebuggerActions.STEP_INTO);
-            registerExtraHandleShortcuts(XDebuggerActions.SMART_STEP_INTO);
-            return super.createContent();
-          }
-
-          private void registerExtraHandleShortcuts(String actionName) {
-            AnAction action = ActionManager.getInstance().getAction(actionName);
-            KeyStroke stroke = KeymapUtil.getKeyStroke(action.getShortcutSet());
-            if (stroke != null) {
-              registerAction("handleSelection " + stroke, stroke, new AbstractAction() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                  handleSelect(true);
-                }
-              });
-            }
-          }
-        };
+        ListPopupImpl popup = new ListPopupImpl(popupStep);
+        DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.STEP_INTO);
+        DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.SMART_STEP_INTO);
         popup.addListSelectionListener(new ListSelectionListener() {
           public void valueChanged(ListSelectionEvent e) {
             popupStep.getScopeHighlighter().dropHighlight();
index 23aceb88dd3a218f05cfac0906ce3a44ee9bfc1b..8a9947dc717a58b8a9ea03c504d5fb5c61a3fc0f 100644 (file)
@@ -38,9 +38,7 @@ import com.intellij.execution.ui.RunnerLayoutUi;
 import com.intellij.execution.ui.layout.PlaceInGrid;
 import com.intellij.icons.AllIcons;
 import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Pair;
@@ -171,12 +169,14 @@ public class JavaDebugProcess extends XDebugProcess {
         }
       }
 
-      private void showAlternativeNotification(XStackFrame frame) {
-        XSourcePosition position = frame.getSourcePosition();
-        if (position != null) {
-          VirtualFile file = position.getFile();
-          if (!AlternativeSourceNotificationProvider.fileProcessed(file)) {
-            EditorNotifications.getInstance(session.getProject()).updateNotifications(file);
+      private void showAlternativeNotification(@Nullable XStackFrame frame) {
+        if (frame != null) {
+          XSourcePosition position = frame.getSourcePosition();
+          if (position != null) {
+            VirtualFile file = position.getFile();
+            if (!AlternativeSourceNotificationProvider.fileProcessed(file)) {
+              EditorNotifications.getInstance(session.getProject()).updateNotifications(file);
+            }
           }
         }
       }
index 2ed9b5283ada45664e4b2466f23aa622d26f0945..da915026b9d3acec9fc0eccc4ddfbf2f02622d7b 100644 (file)
@@ -27,10 +27,6 @@ import com.intellij.execution.filters.LineNumbersMapping;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.impl.DocumentMarkupModel;
-import com.intellij.openapi.editor.markup.HighlighterTargetArea;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
-import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.*;
 import com.intellij.openapi.util.text.StringUtil;
@@ -42,7 +38,6 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.EmptyIterable;
 import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter;
-import com.intellij.xdebugger.ui.DebuggerColors;
 import com.sun.jdi.AbsentInformationException;
 import com.sun.jdi.Location;
 import com.sun.jdi.Method;
@@ -286,20 +281,11 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
 
     @Nullable
     @Override
-    public RangeHighlighter createHighlighter(Document document, Project project, TextAttributes attributes) {
+    public TextRange getHighlightRange() {
       PsiElement element = getElementAt();
       NavigatablePsiElement method = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiLambdaExpression.class);
       if (method instanceof PsiLambdaExpression) {
-        TextRange range = method.getTextRange();
-        int startOffset = document.getLineStartOffset(getLine());
-        int endOffset = document.getLineEndOffset(getLine());
-        int hlStart = Math.max(startOffset, range.getStartOffset());
-        int hlEnd = Math.min(endOffset, range.getEndOffset());
-        if (hlStart != startOffset || hlEnd != endOffset) {
-          return DocumentMarkupModel.forDocument(document, project, true).
-            addRangeHighlighter(hlStart, hlEnd, DebuggerColors.EXECUTION_LINE_HIGHLIGHTERLAYER, attributes,
-                                HighlighterTargetArea.EXACT_RANGE);
-        }
+        return method.getTextRange();
       }
       return null;
     }
index 359f61fdf403d4e52b8ddee316946a8b370988fb..ce8a1dfe9a3da1f1f3bdce6565150e69e8987776 100644 (file)
@@ -46,8 +46,6 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
-import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.StdFileTypes;
@@ -63,6 +61,7 @@ import com.intellij.ui.classFilter.ClassFilter;
 import com.intellij.ui.content.Content;
 import com.intellij.unscramble.ThreadDumpPanel;
 import com.intellij.unscramble.ThreadState;
+import com.intellij.util.DocumentUtil;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.xdebugger.XSourcePosition;
@@ -751,9 +750,9 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
 
     @Nullable
     @Override
-    public RangeHighlighter createHighlighter(Document document, Project project, TextAttributes attributes) {
+    public TextRange getHighlightRange() {
       if (mySourcePosition instanceof ExecutionPointHighlighter.HighlighterProvider) {
-        return ((ExecutionPointHighlighter.HighlighterProvider)mySourcePosition).createHighlighter(document, project, attributes);
+        return ((ExecutionPointHighlighter.HighlighterProvider)mySourcePosition).getHighlightRange();
       }
       return null;
     }
@@ -789,16 +788,16 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
     return null;
   }
 
-  public static List<PsiLambdaExpression> collectLambdas(SourcePosition position, final boolean onlyOnTheLine) {
+  public static List<PsiLambdaExpression> collectLambdas(@NotNull SourcePosition position, final boolean onlyOnTheLine) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
     PsiFile file = position.getFile();
-    int line = position.getLine();
-    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
+    final int line = position.getLine();
+    final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
     if (document == null || line >= document.getLineCount()) {
       return Collections.emptyList();
     }
     PsiElement element = position.getElementAt();
-    final TextRange lineRange = new TextRange(document.getLineStartOffset(line), document.getLineEndOffset(line));
+    final TextRange lineRange = DocumentUtil.getLineTextRange(document, line);
     do {
       PsiElement parent = element.getParent();
       if (parent == null || (parent.getTextOffset() < lineRange.getStartOffset())) {
@@ -813,7 +812,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
       @Override
       public void visitLambdaExpression(PsiLambdaExpression expression) {
         super.visitLambdaExpression(expression);
-        if (!onlyOnTheLine || lineRange.intersects(expression.getTextRange())) {
+        if (!onlyOnTheLine || getFirstElementOnTheLine(expression, document, line) != null) {
           lambdas.add(expression);
         }
       }
@@ -825,7 +824,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
       lambdas.add((PsiLambdaExpression)method);
     }
     for (PsiElement sibling = getNextElement(element); sibling != null; sibling = getNextElement(sibling)) {
-      if (!lineRange.intersects(sibling.getTextRange())) {
+      if (!intersects(lineRange, sibling)) {
         break;
       }
       sibling.accept(lambdaCollector);
@@ -833,22 +832,36 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
     return lambdas;
   }
 
+  public static boolean intersects(@NotNull TextRange range, @NotNull PsiElement elem) {
+    TextRange elemRange = elem.getTextRange();
+    return elemRange != null && elemRange.intersects(range);
+  }
+
   @Nullable
   public static PsiElement getFirstElementOnTheLine(PsiLambdaExpression lambda, Document document, int line) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
-    TextRange lineRange = new TextRange(document.getLineStartOffset(line), document.getLineEndOffset(line));
-    if (!lineRange.intersects(lambda.getTextRange())) return null;
+    TextRange lineRange = DocumentUtil.getLineTextRange(document, line);
+    if (!intersects(lineRange, lambda)) return null;
     PsiElement body = lambda.getBody();
+    if (body == null || !intersects(lineRange, body)) return null;
     if (body instanceof PsiCodeBlock) {
       for (PsiStatement statement : ((PsiCodeBlock)body).getStatements()) {
-        if (lineRange.intersects(statement.getTextRange())) {
+        if (intersects(lineRange, statement)) {
           return statement;
         }
       }
+      return null;
     }
     return body;
   }
 
+  public static boolean inTheMethod(@NotNull SourcePosition pos, @NotNull PsiElement method) {
+    PsiElement elem = pos.getElementAt();
+    if (elem == null) return false;
+    NavigatablePsiElement elemMethod = PsiTreeUtil.getParentOfType(elem, PsiMethod.class, PsiLambdaExpression.class);
+    return Comparing.equal(elemMethod, method);
+  }
+
   public static boolean inTheSameMethod(@NotNull SourcePosition pos1, @NotNull SourcePosition pos2) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
     PsiElement elem1 = pos1.getElementAt();
index ff1b10d1d8d684d1c55a2368f67142b527af8ac1..29d6ff4aac046dcb0bb8af187b2b618d9384b6ab 100644 (file)
@@ -33,11 +33,8 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
 import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
 import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
 import com.intellij.xdebugger.impl.XSourcePositionImpl;
-import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointVariant;
-import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointVariantsProvider;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
 import org.jetbrains.java.debugger.breakpoints.properties.JavaLineBreakpointProperties;
 
 import javax.swing.*;
@@ -48,8 +45,7 @@ import java.util.List;
  * Base class for java line-connected exceptions (line, method, field)
  * @author egor
  */
-public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreakpointProperties>
-  implements JavaBreakpointType, XLineBreakpointVariantsProvider<JavaLineBreakpointType.JavaBreakpointVariant> {
+public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineBreakpointProperties> implements JavaBreakpointType {
   public JavaLineBreakpointType() {
     super("java-line", DebuggerBundle.message("line.breakpoints.tab.title"));
   }
@@ -65,7 +61,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
   }
 
   @Override
-  public List<XBreakpointGroupingRule<XLineBreakpoint<JavaBreakpointProperties>, ?>> getGroupingRules() {
+  public List<XBreakpointGroupingRule<XLineBreakpoint<JavaLineBreakpointProperties>, ?>> getGroupingRules() {
     return XDebuggerUtil.getInstance().getGroupingByFileRuleAsList();
   }
 
@@ -94,7 +90,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
 
   @NotNull
   @Override
-  public List<JavaBreakpointVariant> computeLineBreakpointVariants(@NotNull Project project, @NotNull XSourcePosition position) {
+  public List<JavaBreakpointVariant> computeVariants(@NotNull Project project, @NotNull XSourcePosition position) {
     PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
     if (file == null) {
       return Collections.emptyList();
@@ -121,12 +117,13 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
     res.add(new JavaBreakpointVariant(position)); //all
 
     if (startMethod instanceof PsiMethod) {
-      res.add(new ExactJavaBreakpointVariant(position, startMethod)); // base method
+      res.add(new ExactJavaBreakpointVariant(position, startMethod, -1)); // base method
     }
 
+    int ordinal = 0;
     for (PsiLambdaExpression lambda : lambdas) { //lambdas
       PsiElement firstElem = DebuggerUtilsEx.getFirstElementOnTheLine(lambda, document, position.getLine());
-      res.add(new ExactJavaBreakpointVariant(XSourcePositionImpl.createByElement(firstElem), lambda));
+      res.add(new ExactJavaBreakpointVariant(XSourcePositionImpl.createByElement(firstElem), lambda, ordinal++));
     }
 
     return res;
@@ -163,10 +160,12 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
 
   private class ExactJavaBreakpointVariant extends JavaBreakpointVariant {
     private final PsiElement myElement;
+    private final Integer myLambdaOrdinal;
 
-    public ExactJavaBreakpointVariant(XSourcePosition position, PsiElement element) {
+    public ExactJavaBreakpointVariant(XSourcePosition position, PsiElement element, Integer lambdaOrdinal) {
       super(position);
       myElement = element;
+      myLambdaOrdinal = lambdaOrdinal;
     }
 
     @Override
@@ -187,8 +186,27 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
     @Override
     public JavaLineBreakpointProperties createProperties() {
       JavaLineBreakpointProperties properties = super.createProperties();
-      properties.setOffset(mySourcePosition.getOffset());
+      properties.setLambdaOrdinal(myLambdaOrdinal);
       return properties;
     }
   }
+
+  @Nullable
+  @Override
+  public TextRange getHighlightRange(XLineBreakpoint<JavaLineBreakpointProperties> breakpoint) {
+    JavaLineBreakpointProperties properties = breakpoint.getProperties();
+    if (properties != null) {
+      Integer ordinal = properties.getLambdaOrdinal();
+      if (ordinal != null) {
+        Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
+        if (javaBreakpoint instanceof LineBreakpoint) {
+          PsiElement method = ((LineBreakpoint)javaBreakpoint).getContainingMethod();
+          if (method != null) {
+            return method.getTextRange();
+          }
+        }
+      }
+    }
+    return null;
+  }
 }
index 8cf083f49710d99f66b3786f127709a69de1ba5b..03b277e676d7520eea5d40b29ea40984bebea43e 100644 (file)
@@ -210,21 +210,35 @@ public class LineBreakpoint extends BreakpointWithHighlighter {
       @Override
       public Boolean compute() {
         if (getProperties() instanceof JavaLineBreakpointProperties) {
-          Integer offset = ((JavaLineBreakpointProperties)getProperties()).getOffset();
-          if (offset == null) return true;
-          PsiFile file = getPsiFile();
-          if (file != null) {
-            SourcePosition exactPosition = SourcePosition.createFromOffset(file, offset);
-            SourcePosition position = debugProcess.getPositionManager().getSourcePosition(loc);
-            if (position == null) return false;
-            return DebuggerUtilsEx.inTheSameMethod(exactPosition, position);
-          }
+          Integer ordinal = ((JavaLineBreakpointProperties)getProperties()).getLambdaOrdinal();
+          if (ordinal == null) return true;
+          PsiElement containingMethod = getContainingMethod();
+          if (containingMethod == null) return false;
+          SourcePosition position = debugProcess.getPositionManager().getSourcePosition(loc);
+          if (position == null) return false;
+          return DebuggerUtilsEx.inTheMethod(position, containingMethod);
         }
         return true;
       }
     });
   }
 
+  @Nullable
+  public PsiElement getContainingMethod() {
+    SourcePosition position = getSourcePosition();
+    if (position == null) return null;
+    if (getProperties() instanceof JavaLineBreakpointProperties) {
+      Integer ordinal = ((JavaLineBreakpointProperties)getProperties()).getLambdaOrdinal();
+      if (ordinal > -1) {
+        List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
+        if (ordinal < lambdas.size()) {
+          return lambdas.get(ordinal);
+        }
+      }
+    }
+    return PsiTreeUtil.getParentOfType(position.getElementAt(), PsiMethod.class, PsiLambdaExpression.class);
+  }
+
   private boolean isInScopeOf(DebugProcessImpl debugProcess, String className) {
     final SourcePosition position = getSourcePosition();
     if (position != null) {
index 1ddf268f589529096d130d0d001de569b879dfab..f33e37c9f289a88384c26169f54e5a79c6b8b04b 100644 (file)
@@ -21,14 +21,17 @@ import com.intellij.util.xmlb.annotations.OptionTag;
  * @author egor
  */
 public class JavaLineBreakpointProperties extends JavaBreakpointProperties<JavaLineBreakpointProperties> {
-  private Integer myOffset = null;
+  // null - stop at all positions on the line
+  // -1 - stop only at the base position (first on the line)
+  // 0 or more - index of the lambda on the line to stop at
+  private Integer myLambdaOrdinal = null;
 
-  @OptionTag("offset")
-  public Integer getOffset() {
-    return myOffset;
+  @OptionTag("lambda-ordinal")
+  public Integer getLambdaOrdinal() {
+    return myLambdaOrdinal;
   }
 
-  public void setOffset(Integer offset) {
-    myOffset = offset;
+  public void setLambdaOrdinal(Integer lambdaOrdinal) {
+    myLambdaOrdinal = lambdaOrdinal;
   }
 }
index 827fd3f2dfd7fff4365eed5b03a24608b757ef14..a43e62da7138ba832a2d9b224894972e26cf10b7 100644 (file)
@@ -109,7 +109,6 @@ public abstract class JavaTestFrameworkRunnableState<T extends ModuleBasedConfig
       return null;
     }
     getJavaParameters().getVMParametersList().addProperty("idea." + getFrameworkId() + ".sm_runner");
-    getJavaParameters().getClassPath().addFirst(PathUtil.getJarPathForClass(ServiceMessageTypes.class));
 
     final RunnerSettings runnerSettings = getRunnerSettings();
 
index 453cbcb0d6cd2958cf1eb6d5a1c15261fee8ee24..118aca3ce6abe291fc93cc67a17846697299da21 100644 (file)
@@ -28,13 +28,14 @@ import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.util.ClassUtil;
-import com.intellij.psi.util.PsiClassUtil;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -183,6 +184,7 @@ public class JavaExecutionUtil {
     return name == null || name.startsWith(ExecutionBundle.message("run.configuration.unnamed.name.prefix"));
   }
 
+  @Nullable
   public static Location stepIntoSingleClass(@NotNull final Location location) {
     PsiElement element = location.getPsiElement();
     if (!(element instanceof PsiClassOwner)) {
@@ -190,6 +192,11 @@ public class JavaExecutionUtil {
       element = PsiTreeUtil.getParentOfType(element, PsiClassOwner.class);
       if (element == null) return location;
     }
+    final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
+    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(location.getProject()).getFileIndex();
+    if (virtualFile == null || !fileIndex.isInSource(virtualFile)) {
+      return null;
+    }
     final PsiClassOwner psiFile = (PsiClassOwner)element;
     final PsiClass[] classes = psiFile.getClasses();
     if (classes.length != 1) return location;
index 77ccbe6cbdffd021335d380e7594993f19613091..e4bc32587611a9d42f7fe6ac9927d228f3ebad80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
     final JScrollPane pane = ScrollPaneFactory.createScrollPane(myContent, true);
     pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
     add(pane);
-    myAlarm = new Alarm(this);
+    myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this);
     project.getMessageBus().connect(this).subscribe(ConfigurationErrors.TOPIC, this);
     myContent.addHyperlinkListener(new HyperlinkAdapter() {
       @Override
@@ -110,28 +110,31 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
     myAlarm.addRequest(new Runnable() {
       @Override
       public void run() {
-        String html = "<html>" +
-                      "<header><style type='text/css'>" +
-                      "body {" +
-                      "  color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" +
-                      "  font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" +
-                      "  font-size: " + UIUtil.getLabelFont().getSize() + ";" +
-                      "}" +
-                      "li {" +
-                      "  margin-bottom: 5;" +
-                      "}" +
-                      "ol {" +
-                      "}" +
-                      "a {" +
-                      " text-decoration: none;" +
-                      "}" +
-                      "</style>" +
-                      "</header>" +
-                      "<body>";
+        final String header = "<html>" +
+                            "<header><style type='text/css'>" +
+                            "body {" +
+                            "  color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" +
+                            "  font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" +
+                            "  font-size: " + UIUtil.getLabelFont().getSize() + ";" +
+                            "}" +
+                            "li {" +
+                            "  margin-bottom: 5;" +
+                            "}" +
+                            "ol {" +
+                            "}" +
+                            "a {" +
+                            " text-decoration: none;" +
+                            "}" +
+                            "</style>" +
+                            "</header>" +
+                            "<body>";
+        final StringBuilder html = new StringBuilder(header);
         int i = 0;
-        html += "<ol>";
+        html.append("<ol>");
         for (ConfigurationError error : myErrors) {
           i++;
+          if (i > 100) break;
+          html.append("<li>");
           String description = error.getDescription();
           if (description.startsWith("<html>") && description.endsWith("</html>")) {
             description = description.substring(6, description.length() - 7);
@@ -146,10 +149,17 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
           if (error.canBeFixed()) {
             description += " <a href='http://fix/" + i + "'>[Fix]</a>";
           }
-          html+= "<li>" + description + "</li>";
+          html.append(description).append("</li>");
         }
-        html += "</ol></body></html>";
-        myContent.setText(html);
+        html.append("</ol></body></html>");
+        //noinspection SSBasedInspection
+        SwingUtilities.invokeLater(new Runnable() {
+          public void run() {
+            if (!Disposer.isDisposed(ErrorPaneConfigurable.this)) {
+              myContent.setText(html.toString());
+            }
+          }
+        });
         if (myOnErrorsChanged != null) {
           myOnErrorsChanged.run();
         }
index 496fc408aa3ca1b6ba1194a2ccce5d0c40433a67..c2edc7bf31bf69a183134de48895f3146ebbb216 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -128,9 +128,10 @@ public class SidePanel extends JPanel {
         final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
         if ("Problems".equals(descriptor.getTextFor(value))) {
           final ErrorPaneConfigurable errorPane = (ErrorPaneConfigurable)((Place)value).getPath("category");
-          if (errorPane != null && errorPane.getErrorsCount() > 0) {
+          int errorsCount;
+          if (errorPane != null && (errorsCount = errorPane.getErrorsCount()) > 0) {
             myCountLabel.setSelected(isSelected);
-            myCountLabel.setText(String.valueOf(errorPane.getErrorsCount()));
+            myCountLabel.setText(errorsCount > 100 ? "100+" : String.valueOf(errorsCount));
           }
         }
         if (UIUtil.getClientProperty(list, ExpandableItemsHandler.EXPANDED_RENDERER) == Boolean.TRUE) {
index b6dacbe717fb7595acaf9c0fe4e4501cca9a591b..dd29fa70d4051bf0c88fcbe60602fff1e7842ecc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1019,89 +1019,90 @@ public class HighlightUtil extends HighlightUtilBase {
             parent instanceof PsiPrefixExpression &&
             ((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
         if (text.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
-          final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
         if (text.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
-          final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
         if (value == null || text.equals(PsiLiteralExpressionImpl._2_IN_31)) {
-          final String message = JavaErrorMessages.message("integer.number.too.large");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("integer.number.too.large");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
       }
     }
     else if (type == JavaTokenType.LONG_LITERAL) {
-      final String mText = text.endsWith("l") ? text.substring(0, text.length() - 1) : text;
+      String mText = text.endsWith("l") ? text.substring(0, text.length() - 1) : text;
       //literal 9223372036854775808L may appear only as the operand of the unary negation operator -.
       if (!(mText.equals(PsiLiteralExpressionImpl._2_IN_63) &&
             parent instanceof PsiPrefixExpression &&
             ((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
         if (mText.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
-          final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
         if (mText.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
-          final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
         if (value == null || mText.equals(PsiLiteralExpressionImpl._2_IN_63)) {
-          final String message = JavaErrorMessages.message("long.number.too.large");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("long.number.too.large");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
       }
     }
     else if (isFP) {
       if (value == null) {
-        final String message = JavaErrorMessages.message("malformed.floating.point.literal");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+        String message = JavaErrorMessages.message("malformed.floating.point.literal");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       }
     }
     else if (type == JavaTokenType.CHARACTER_LITERAL) {
-      // todo[r.sh] clean this mess up
       if (value != null) {
         if (!StringUtil.endsWithChar(text, '\'')) {
-          final String message = JavaErrorMessages.message("unclosed.char.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("unclosed.char.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
       }
       else {
-        if (!StringUtil.startsWithChar(text, '\'')) return null;
+        if (!StringUtil.startsWithChar(text, '\'')) {
+          return null;
+        }
         if (StringUtil.endsWithChar(text, '\'')) {
           if (text.length() == 1) {
-            final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
-              return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+            String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
+            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
           }
           text = text.substring(1, text.length() - 1);
         }
         else {
-          final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
+
         StringBuilder chars = new StringBuilder();
-        final boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
+        boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
         if (!success) {
-          final String message = JavaErrorMessages.message("illegal.escape.character.in.character.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("illegal.escape.character.in.character.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
         int length = chars.length();
         if (length > 1) {
-          final String message = JavaErrorMessages.message("too.many.characters.in.character.literal");
-          final HighlightInfo info =
-            HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("too.many.characters.in.character.literal");
+          HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
           QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createConvertToStringLiteralAction());
           return info;
         }
         else if (length == 0) {
-          final String message = JavaErrorMessages.message("empty.character.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("empty.character.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
       }
     }
     else if (type == JavaTokenType.STRING_LITERAL) {
       if (value == null) {
-        for (final PsiElement element : expression.getChildren()) {
+        for (PsiElement element : expression.getChildren()) {
           if (element instanceof OuterLanguageElement) {
             return null;
           }
@@ -1110,44 +1111,45 @@ public class HighlightUtil extends HighlightUtilBase {
         if (!StringUtil.startsWithChar(text, '\"')) return null;
         if (StringUtil.endsWithChar(text, '\"')) {
           if (text.length() == 1) {
-            final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
-              return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+            String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
+            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
           }
           text = text.substring(1, text.length() - 1);
         }
         else {
-          final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
+
         StringBuilder chars = new StringBuilder();
         boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
         if (!success) {
-          final String message = JavaErrorMessages.message("illegal.escape.character.in.string.literal");
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+          String message = JavaErrorMessages.message("illegal.escape.character.in.string.literal");
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
         }
       }
     }
 
     if (value instanceof Float) {
-      final Float number = (Float)value;
+      Float number = (Float)value;
       if (number.isInfinite()) {
-        final String message = JavaErrorMessages.message("floating.point.number.too.large");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+        String message = JavaErrorMessages.message("floating.point.number.too.large");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       }
       if (number.floatValue() == 0 && !TypeConversionUtil.isFPZero(text)) {
-        final String message = JavaErrorMessages.message("floating.point.number.too.small");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+        String message = JavaErrorMessages.message("floating.point.number.too.small");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       }
     }
     else if (value instanceof Double) {
-      final Double number = (Double)value;
+      Double number = (Double)value;
       if (number.isInfinite()) {
-        final String message = JavaErrorMessages.message("floating.point.number.too.large");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+        String message = JavaErrorMessages.message("floating.point.number.too.large");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       }
       if (number.doubleValue() == 0 && !TypeConversionUtil.isFPZero(text)) {
-        final String message = JavaErrorMessages.message("floating.point.number.too.small");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+        String message = JavaErrorMessages.message("floating.point.number.too.small");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       }
     }
 
@@ -1749,23 +1751,22 @@ public class HighlightUtil extends HighlightUtilBase {
   }
 
   @Nullable
-  static HighlightInfo checkExpressionRequired(@NotNull PsiReferenceExpression expression,
-                                               @NotNull JavaResolveResult resultForIncompleteCode) {
+  static HighlightInfo checkExpressionRequired(@NotNull PsiReferenceExpression expression, @NotNull JavaResolveResult resultForIncompleteCode) {
     if (expression.getNextSibling() instanceof PsiErrorElement) return null;
+
     PsiElement resolved = resultForIncompleteCode.getElement();
-    if (resolved == null) return null;
+    if (resolved == null || resolved instanceof PsiVariable) return null;
+
     PsiElement parent = expression.getParent();
     // String.class or String() are both correct
     if (parent instanceof PsiReferenceExpression || parent instanceof PsiMethodCallExpression) return null;
-    if (resolved instanceof PsiVariable) return null;
+
     String description = JavaErrorMessages.message("expression.expected");
-    final HighlightInfo info =
-      HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
+    HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
     UnresolvedReferenceQuickFixProvider.registerReferenceFixes(expression, new QuickFixActionRegistrarImpl(info));
     return info;
   }
 
-
   @Nullable
   static HighlightInfo checkArrayInitializerApplicable(@NotNull PsiArrayInitializerExpression expression) {
     /*
@@ -1782,8 +1783,7 @@ public class HighlightUtil extends HighlightUtilBase {
     }
 
     String description = JavaErrorMessages.message("array.initializer.not.allowed");
-    HighlightInfo info =
-      HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
+    HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
     QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createAddNewArrayExpressionFix(expression));
     return info;
   }
index cc43f962fc195c40c94ef57fbf33ee1eb68469af..605e7686ac94321582b077c1fcddfedb84e878d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -56,6 +56,8 @@ public class AddExceptionToCatchFix extends BaseIntentionAction {
 
     PsiTryStatement tryStatement = (PsiTryStatement)element.getParent();
     List<PsiClassType> unhandledExceptions = new ArrayList<PsiClassType>(ExceptionUtil.collectUnhandledExceptions(element, null));
+    if (unhandledExceptions.isEmpty()) return;
+
     ExceptionUtil.sortExceptionsByHierarchy(unhandledExceptions);
 
     IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
index eb96eef575b104bd0f060d00c282dda0ba107448..b8f5a477097d013c1a1baf807126c176b52856a5 100644 (file)
@@ -91,13 +91,7 @@ public class GenerateEqualsHandler extends GenerateMembersHandlerBase {
         return null;
       }
     }
-    boolean hasNonStaticFields = false;
-    for (PsiField field : aClass.getFields()) {
-      if (!field.hasModifierProperty(PsiModifier.STATIC)) {
-        hasNonStaticFields = true;
-        break;
-      }
-    }
+    boolean hasNonStaticFields = hasNonStaticFields(aClass);
     if (!hasNonStaticFields) {
       HintManager.getInstance().showErrorHint(editor, "No fields to include in equals/hashCode have been found");
       return null;
@@ -113,6 +107,20 @@ public class GenerateEqualsHandler extends GenerateMembersHandlerBase {
     return DUMMY_RESULT;
   }
 
+  private static boolean hasNonStaticFields(PsiClass aClass) {
+    for (PsiField field : aClass.getFields()) {
+      if (!field.hasModifierProperty(PsiModifier.STATIC)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  @Override
+  protected boolean hasMembers(@NotNull PsiClass aClass) {
+    return hasNonStaticFields(aClass);
+  }
+
   @Override
   @NotNull
   protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] originalMembers) throws IncorrectOperationException {
index 791ea0c8e9593d0d29570f7d5d506a4e64f04695..8ed38446b21c08fb09b39266e0254abefefd435a 100644 (file)
@@ -74,6 +74,11 @@ public abstract class GenerateGetterSetterHandlerBase extends GenerateMembersHan
     super(chooserTitle);
   }
 
+  @Override
+  protected boolean hasMembers(@NotNull PsiClass aClass) {
+    return !GenerateAccessorProviderRegistrar.getEncapsulatableClassMembers(aClass).isEmpty();
+  }
+
   @Override
   protected String getHelpId() {
     return "Getter and Setter Templates Dialog";
index 90eb770891c01e3cf9d73039d74762cf3e52a1df..65c4eb3ed3cbc04c03141ec150979f82c7080648 100644 (file)
@@ -23,6 +23,8 @@ import com.intellij.codeInsight.template.TemplateEditingAdapter;
 import com.intellij.codeInsight.template.TemplateManager;
 import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
 import com.intellij.ide.util.MemberChooser;
+import com.intellij.lang.ContextAwareActionHandler;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.command.WriteCommandAction;
@@ -47,7 +49,7 @@ import javax.swing.*;
 import java.util.ArrayList;
 import java.util.List;
 
-public abstract class GenerateMembersHandlerBase implements CodeInsightActionHandler {
+public abstract class GenerateMembersHandlerBase implements CodeInsightActionHandler, ContextAwareActionHandler {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.GenerateMembersHandlerBase");
 
   private final String myChooserTitle;
@@ -57,6 +59,16 @@ public abstract class GenerateMembersHandlerBase implements CodeInsightActionHan
     myChooserTitle = chooserTitle;
   }
 
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, false);
+    return aClass != null && hasMembers(aClass);
+  }
+
+  protected boolean hasMembers(@NotNull PsiClass aClass) {
+    return true;
+  }
+
   @Override
   public final void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
     if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
index 8723c66aa37e070a378fc1a9be83695eddfd345d..aaaf61737a053ac6a3da0025795d218f5882f683 100644 (file)
@@ -16,7 +16,9 @@
 package com.intellij.codeInsight.generation;
 
 import com.intellij.codeInsight.hint.HintManager;
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.lang.LanguageCodeInsightActionHandler;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiClass;
@@ -29,15 +31,14 @@ import org.jetbrains.annotations.NotNull;
 /**
  * @author yole
  */
-public class JavaImplementMethodsHandler implements LanguageCodeInsightActionHandler {
+public class JavaImplementMethodsHandler implements ContextAwareActionHandler, LanguageCodeInsightActionHandler {
   @Override
   public boolean isValidFor(final Editor editor, final PsiFile file) {
     if (!(file instanceof PsiJavaFile) && !(file instanceof PsiCodeFragment)) {
       return false;
     }
 
-    PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, PsiUtil.isLanguageLevel8OrHigher(file));
-    return aClass != null && !OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty();
+    return OverrideImplementUtil.getContextClass(file.getProject(), editor, file, PsiUtil.isLanguageLevel8OrHigher(file)) != null;
   }
 
   @Override
@@ -57,4 +58,10 @@ public class JavaImplementMethodsHandler implements LanguageCodeInsightActionHan
   public boolean startInWriteAction() {
     return false;
   }
+
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, PsiUtil.isLanguageLevel8OrHigher(file));
+    return aClass != null && !OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty();
+  }
 }
index 4c6185aee0b3e39e42a14623f311e7a7094d3f2e..d7aefabfd00f2d63b18979427a8559aeb3ceb009 100644 (file)
@@ -16,7 +16,9 @@
 package com.intellij.codeInsight.generation;
 
 import com.intellij.codeInsight.hint.HintManager;
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.lang.LanguageCodeInsightActionHandler;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiClass;
@@ -28,15 +30,14 @@ import org.jetbrains.annotations.NotNull;
 /**
  * @author yole
  */
-public class JavaOverrideMethodsHandler implements LanguageCodeInsightActionHandler {
+public class JavaOverrideMethodsHandler implements ContextAwareActionHandler, LanguageCodeInsightActionHandler {
   @Override
   public boolean isValidFor(final Editor editor, final PsiFile file) {
     if (!(file instanceof PsiJavaFile) && !(file instanceof PsiCodeFragment)) {
       return false;
     }
 
-    PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true);
-    return aClass != null && !OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty();
+    return OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true) != null;
   }
 
   @Override
@@ -55,4 +56,10 @@ public class JavaOverrideMethodsHandler implements LanguageCodeInsightActionHand
   public boolean startInWriteAction() {
     return false;
   }
+
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true);
+    return aClass != null && !OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty();
+  }
 }
index 6eef977c656679e35e592614a1eb2c4cab91def3..d452f465d0dd501983b692dd89b0cf9616083d6f 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring;
 
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
@@ -23,6 +24,7 @@ import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.extractMethod.ExtractMethodHandler;
 import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.TestOnly;
@@ -30,9 +32,15 @@ import org.jetbrains.annotations.TestOnly;
 /**
  * @author dsl
  */
-public abstract class IntroduceHandlerBase implements RefactoringActionHandler {
+public abstract class IntroduceHandlerBase implements RefactoringActionHandler, ContextAwareActionHandler {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.IntroduceHandlerBase");
 
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiElement[] elements = ExtractMethodHandler.getElements(file.getProject(), editor, file);
+    return elements != null && elements.length > 0;
+  }
+
   public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
     LOG.assertTrue(elements.length >= 1 && elements[0] instanceof PsiExpression, "incorrect invoke() parameters");
     final PsiElement tempExpr = elements[0];
index eb16437e6a33c2d255166e3d4fcae42b36d9b475..11df15fbd9ac5cba54ae544e1956aa47011f8187 100644 (file)
@@ -242,10 +242,10 @@ public class ControlFlowWrapper {
     return true;
   }
 
-  public List<PsiVariable> getInputVariables(final PsiElement codeFragment, PsiElement[] elements) {
+  public List<PsiVariable> getInputVariables(final PsiElement codeFragment, PsiElement[] elements, PsiVariable[] outputVariables) {
     final List<PsiVariable> inputVariables = ControlFlowUtil.getInputVariables(myControlFlow, myFlowStart, myFlowEnd);
     List<PsiVariable> myInputVariables;
-    if (myGenerateConditionalExit) {
+    if (skipVariablesFromExitStatements(outputVariables)) {
       List<PsiVariable> inputVariableList = new ArrayList<PsiVariable>(inputVariables);
       removeParametersUsedInExitsOnly(codeFragment, inputVariableList);
       myInputVariables = inputVariableList;
@@ -341,8 +341,16 @@ public class ControlFlowWrapper {
     return getUsedVariables(myFlowEnd);
   }
 
-  public List<PsiVariable> getUsedVariablesInBody() {
-    return getUsedVariables(myFlowStart, myFlowEnd);
+  public List<PsiVariable> getUsedVariablesInBody(PsiElement codeFragment, PsiVariable[] outputVariables) {
+    final List<PsiVariable> variables = getUsedVariables(myFlowStart, myFlowEnd);
+    if (skipVariablesFromExitStatements(outputVariables)) {
+      removeParametersUsedInExitsOnly(codeFragment, variables);
+    }
+    return variables;
+  }
+
+  private boolean skipVariablesFromExitStatements(PsiVariable[] outputVariables) {
+    return myGenerateConditionalExit && outputVariables.length == 0;
   }
 
   public Collection<ControlFlowUtil.VariableInfo> getInitializedTwice() {
index c9a44d9eb6bce816671d1eea23844723f8677ebb..3e42023d392aba1cf7787ab8d5dcfed9cd5c7b46 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.refactoring.extractMethod;
 import com.intellij.codeInsight.CodeInsightUtil;
 import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
 import com.intellij.codeInsight.highlighting.HighlightManager;
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
@@ -56,7 +57,7 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.List;
 
-public class ExtractMethodHandler implements RefactoringActionHandler {
+public class ExtractMethodHandler implements RefactoringActionHandler, ContextAwareActionHandler {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.extractMethod.ExtractMethodHandler");
 
   public static final String REFACTORING_NAME = RefactoringBundle.message("extract.method.title");
@@ -103,10 +104,21 @@ public class ExtractMethodHandler implements RefactoringActionHandler {
       }
     }
 
+    PsiDocumentManager.getInstance(project).commitAllDocuments();
+
+    callback.pass(getElements(project, editor, file));
+  }
+
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiElement[] elements = getElements(file.getProject(), editor, file);
+    return elements != null && elements.length > 0;
+  }
+
+  public static PsiElement[] getElements(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
     int startOffset = editor.getSelectionModel().getSelectionStart();
     int endOffset = editor.getSelectionModel().getSelectionEnd();
 
-    PsiDocumentManager.getInstance(project).commitAllDocuments();
 
     PsiElement[] elements;
     PsiExpression expr = CodeInsightUtil.findExpressionInRange(file, startOffset, endOffset);
@@ -125,7 +137,7 @@ public class ExtractMethodHandler implements RefactoringActionHandler {
         }
       }
     }
-    callback.pass(elements);
+    return elements;
   }
 
   private static void invokeOnElements(final Project project, final Editor editor, PsiFile file, PsiElement[] elements) {
index 987e7157303c523df5d01094017e654e60644f4e..61fb8703159dbc9dcef45ea600bc3d3e8664b0b9 100644 (file)
@@ -1438,7 +1438,7 @@ public class ExtractMethodProcessor implements MatchProvider {
   }
 
   private boolean chooseTargetClass(PsiElement codeFragment, final Pass<ExtractMethodProcessor> extractPass) throws PrepareFailedException {
-    final List<PsiVariable> inputVariables = myControlFlowWrapper.getInputVariables(codeFragment, myElements);
+    final List<PsiVariable> inputVariables = myControlFlowWrapper.getInputVariables(codeFragment, myElements, myOutputVariables);
 
     myNeedChangeContext = false;
     myTargetClass = myCodeFragmentMember instanceof PsiMember
@@ -1513,7 +1513,7 @@ public class ExtractMethodProcessor implements MatchProvider {
   }
 
   private void declareNecessaryVariablesInsideBody(PsiCodeBlock body) throws IncorrectOperationException {
-    List<PsiVariable> usedVariables = myControlFlowWrapper.getUsedVariablesInBody();
+    List<PsiVariable> usedVariables = myControlFlowWrapper.getUsedVariablesInBody(ControlFlowUtil.findCodeFragment(myElements[0]), myOutputVariables);
     for (PsiVariable variable : usedVariables) {
       boolean toDeclare = !isDeclaredInside(variable) && myInputVariables.toDeclareInsideBody(variable);
       if (toDeclare) {
index 070a519dcdc5cecfcd284f1d4bdd34f77f9e9607..d6a3ac5da79e46dc37be9285ffb07a2e5139750e 100644 (file)
@@ -20,6 +20,7 @@
  */
 package com.intellij.refactoring.extractMethodObject;
 
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
@@ -42,7 +43,7 @@ import com.intellij.refactoring.util.duplicates.DuplicatesImpl;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 
-public class ExtractMethodObjectHandler implements RefactoringActionHandler {
+public class ExtractMethodObjectHandler implements RefactoringActionHandler, ContextAwareActionHandler {
   private static final Logger LOG = Logger.getInstance("#" + ExtractMethodObjectHandler.class.getName());
 
   public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file, final DataContext dataContext) {
@@ -53,6 +54,12 @@ public class ExtractMethodObjectHandler implements RefactoringActionHandler {
     });
   }
 
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiElement[] elements = ExtractMethodHandler.getElements(file.getProject(), editor, file);
+    return elements != null && elements.length > 0;
+  }
+
   private static void invokeOnElements(@NotNull final Project project,
                                        @NotNull final Editor editor,
                                        @NotNull PsiFile file,
index dcf6f2b893dc319cdd0b3802824bd21e7eb964c0..d0e70f512e5e5c10c346d07f8085ccc297b661e8 100644 (file)
 package com.intellij.refactoring.introduceparameterobject;
 
 import com.intellij.ide.util.SuperMethodWarningUtil;
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.LangDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.CaretModel;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ScrollType;
@@ -34,12 +33,33 @@ import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import org.jetbrains.annotations.NotNull;
 
-public class IntroduceParameterObjectHandler implements RefactoringActionHandler {
+public class IntroduceParameterObjectHandler implements RefactoringActionHandler, ContextAwareActionHandler {
   private static final String REFACTORING_NAME = RefactorJBundle.message("introduce.parameter.object");
 
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiMethod selectedMethod = getSelectedMethod(editor, file, dataContext);
+    if (selectedMethod != null) {
+      final PsiMethod[] deepestSuperMethods = selectedMethod.findDeepestSuperMethods();
+      return deepestSuperMethods.length > 0 || getErrorMessage(selectedMethod) == null;
+    }
+    return false;
+  }
+
   public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
     final ScrollingModel scrollingModel = editor.getScrollingModel();
     scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE);
+    PsiMethod selectedMethod = getSelectedMethod(editor, file, dataContext);
+    if (selectedMethod == null) {
+      final String message = RefactorJBundle.message("cannot.perform.the.refactoring") +
+                             RefactorJBundle.message("the.caret.should.be.positioned.at.the.name.of.the.method.to.be.refactored");
+      CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.IntroduceParameterObject);
+      return;
+    }
+    invoke(project, selectedMethod, editor);
+  }
+
+  private static PsiMethod getSelectedMethod(Editor editor, PsiFile file, DataContext dataContext) {
     final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
     PsiMethod selectedMethod = null;
     if (element instanceof PsiMethod) {
@@ -63,13 +83,7 @@ public class IntroduceParameterObjectHandler implements RefactoringActionHandler
         }
       }
     }
-    if (selectedMethod == null) {
-      final String message = RefactorJBundle.message("cannot.perform.the.refactoring") +
-                             RefactorJBundle.message("the.caret.should.be.positioned.at.the.name.of.the.method.to.be.refactored");
-      CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.IntroduceParameterObject);
-      return;
-    }
-    invoke(project, selectedMethod, editor);
+    return selectedMethod;
   }
 
   public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
@@ -87,20 +101,26 @@ public class IntroduceParameterObjectHandler implements RefactoringActionHandler
   private static void invoke(final Project project, final PsiMethod selectedMethod, Editor editor) {
     PsiMethod newMethod = SuperMethodWarningUtil.checkSuperMethod(selectedMethod, RefactoringBundle.message("to.refactor"));
     if (newMethod == null) return;
+    final String message = getErrorMessage(newMethod);
+    if (message != null) {
+      CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.IntroduceParameterObject);
+      return;
+    }
     if (!CommonRefactoringUtil.checkReadOnlyStatus(project, newMethod)) return;
 
+    new IntroduceParameterObjectDialog(newMethod).show();
+  }
+
+  private static String getErrorMessage(PsiMethod newMethod) {
     final PsiParameter[] parameters = newMethod.getParameterList().getParameters();
     if (parameters.length == 0) {
-      final String message =
-        RefactorJBundle.message("cannot.perform.the.refactoring") + RefactorJBundle.message("method.selected.has.no.parameters");
-      CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.IntroduceParameterObject);
-      return;
+     return RefactorJBundle.message("cannot.perform.the.refactoring") +
+            RefactorJBundle.message("method.selected.has.no.parameters");
     }
     if (newMethod instanceof PsiCompiledElement) {
-      CommonRefactoringUtil.showErrorHint(project, editor, RefactorJBundle.message("cannot.perform.the.refactoring") + RefactorJBundle.message(
-          "the.selected.method.cannot.be.wrapped.because.it.is.defined.in.a.non.project.class"), REFACTORING_NAME, HelpID.IntroduceParameterObject);
-      return;
+      return RefactorJBundle.message("cannot.perform.the.refactoring") +
+             RefactorJBundle.message("the.selected.method.cannot.be.wrapped.because.it.is.defined.in.a.non.project.class");
     }
-    new IntroduceParameterObjectDialog(newMethod).show();
+    return null;
   }
 }
index 11568aedf84f47caa5ebb89cf731b933df2a8945..a6d97af3d961ce676e6402686a45b80ca05b6123 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.analysis.AnalysisUIOptions;
 import com.intellij.analysis.BaseAnalysisActionDialog;
 import com.intellij.history.LocalHistory;
 import com.intellij.history.LocalHistoryAction;
+import com.intellij.lang.ContextAwareActionHandler;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ApplicationNamesInfo;
@@ -55,10 +56,16 @@ import java.util.*;
 /**
  * @author dsl
  */
-public class MethodDuplicatesHandler implements RefactoringActionHandler {
+public class MethodDuplicatesHandler implements RefactoringActionHandler, ContextAwareActionHandler {
   public static final String REFACTORING_NAME = RefactoringBundle.message("replace.method.code.duplicates.title");
   private static final Logger LOG = Logger.getInstance("#" + MethodDuplicatesHandler.class.getName());
 
+  @Override
+  public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
+    final PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
+    return getCannotRefactorMessage(PsiTreeUtil.getParentOfType(element, PsiMember.class)) == null;
+  }
+
   @Override
   public void invoke(@NotNull final Project project, final Editor editor, PsiFile file, DataContext dataContext) {
     final int offset = editor.getCaretModel().getOffset();
similarity index 67%
rename from plugins/junit/src/com/intellij/execution/junit/JUnitRunLineMarkerProvider.java
rename to java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java
index d83b7ea49d40bd78b32deef02682935dfaa6e08c..c47045c658054d820244f47b4f24c96714ecf554 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.execution.junit;
+package com.intellij.testIntegration;
 
+import com.intellij.codeInsight.TestFrameworks;
 import com.intellij.codeInsight.daemon.LineMarkerInfo;
 import com.intellij.codeInsight.daemon.LineMarkerProvider;
-import com.intellij.execution.PsiLocation;
 import com.intellij.execution.lineMarker.RunLineMarkerInfo;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiIdentifier;
 import com.intellij.psi.PsiMethod;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.Function;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -33,7 +34,7 @@ import java.util.List;
 /**
  * @author Dmitry Avdeev
  */
-public class JUnitRunLineMarkerProvider implements LineMarkerProvider {
+public class TestRunLineMarkerProvider implements LineMarkerProvider {
 
   private static final Function<PsiElement, String> TOOLTIP_PROVIDER = new Function<PsiElement, String>() {
     @Override
@@ -47,11 +48,17 @@ public class JUnitRunLineMarkerProvider implements LineMarkerProvider {
   public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement e) {
     if (e instanceof PsiIdentifier) {
       PsiElement element = e.getParent();
-      if (element instanceof PsiClass && JUnitUtil.isTestClass((PsiClass)element, false, true)) {
-        return new RunLineMarkerInfo(e, JUnitConfigurationType.getInstance().getIcon(), TOOLTIP_PROVIDER);
+      if (element instanceof PsiClass) {
+        TestFramework framework = TestFrameworks.detectFramework((PsiClass)element);
+        if (framework != null && framework.isTestClass(element)) {
+          return new RunLineMarkerInfo(e, framework.getIcon(), TOOLTIP_PROVIDER);
+        }
       }
-      if (element instanceof PsiMethod && JUnitUtil.isTestMethod(new PsiLocation<PsiMethod>((PsiMethod)element))) {
-        return new RunLineMarkerInfo(e, JUnitConfigurationType.getInstance().getIcon(), TOOLTIP_PROVIDER);
+      if (element instanceof PsiMethod) {
+        TestFramework framework = TestFrameworks.detectFramework(PsiTreeUtil.getParentOfType(element, PsiClass.class));
+        if (framework != null && framework.isTestMethod(element)) {
+          return new RunLineMarkerInfo(e, framework.getIcon(), TOOLTIP_PROVIDER);
+        }
       }
     }
     return null;
index 8019dfa7698a87674cff2ef61b75680fc0643d4a..d23abdcc7a5c451fd2ba003a5a22cc3fc1d8c846 100644 (file)
@@ -460,7 +460,12 @@ public class CreateTestDialog extends DialogWrapper {
     }
 
     if (errorMessage != null) {
-      Messages.showMessageDialog(myProject, errorMessage, CommonBundle.getErrorTitle(), Messages.getErrorIcon());
+      final int result = Messages
+        .showOkCancelDialog(myProject, errorMessage + ". Update existing class?", CommonBundle.getErrorTitle(), Messages.getErrorIcon());
+      if (result == Messages.CANCEL) {
+        super.close(CANCEL_EXIT_CODE);
+        return;
+      }
     }
 
     saveDefaultLibraryName();
index cff6e10d1eeea082a6f2ff9e6274f9c11afbd00e..6f7fdf3eea8fbb48b57f962a6de066e184f81189 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ public interface PsiExpression extends PsiAnnotationMemberValue {
     @NotNull
     @Override
     public PsiExpression[] create(final int count) {
-      return count == 0 ? PsiExpression.EMPTY_ARRAY : new PsiExpression[count];
+      return count == 0 ? EMPTY_ARRAY : new PsiExpression[count];
     }
   };
 
index 0e6512779cdb8f39b41061d444be1fa4d58f0061..34be7bcdf2ed2c1ed02de18d323d57303cfd4cfa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,15 +18,12 @@ package com.intellij.psi;
 import org.jetbrains.annotations.Nullable;
 
 /**
- * Represents a Java <code>super</code> expression in a super method call. Note that the qualifier of
- * a super constructor call is represented as a {@link PsiKeyword} rather than a <code>PsiSuperExpression</code>.  
+ * Represents a Java {@code super} expression in a superclass member reference (but not in a super constructor call,
+ * where the {@code super} qualifier is represented as a {@link PsiKeyword} wrapped in a {@link PsiReferenceExpression}).
  */
 public interface PsiSuperExpression extends PsiQualifiedExpression {
   /**
-   * Returns the expression representing the class name qualifying the <code>super</code>
-   * expression.
-   *
-   * @return the qualifier, or null if the expression has no qualifier.
+   * Returns an expression representing a type name qualifying the {@code super} expression.
    */
   @Override
   @Nullable
index a32b29e8f3fc05da6f8ea737afbe42d6f9ab9bf9..3d64548318d77ddd3c01bb8a9ac331c35df8afe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,14 +18,11 @@ package com.intellij.psi;
 import org.jetbrains.annotations.Nullable;
 
 /**
- * Represents a Java <code>this</code> expression.
+ * Represents a Java {@code this} expression.
  */
 public interface PsiThisExpression extends PsiQualifiedExpression {
   /**
-   * Returns the expression representing the class name qualifying the <code>this</code>
-   * expression.
-   *
-   * @return the qualifier, or null if the expression has no qualifier.
+   * Returns an expression representing a type name qualifying the {@code this} expression.
    */
   @Override
   @Nullable
index 9ebe8673af225d3ac8580796e8f494e9691cee28..dc919245f5c9a497127b95d53beffbb474281f29 100644 (file)
@@ -315,11 +315,10 @@ public class ExpressionParser {
     return operand;
   }
 
-  private enum BreakPoint {P1, P2, P3, P4}
+  private enum BreakPoint {P1, P2, P4}
 
-  // todo[r.sh] make 'this', 'super' and 'class' reference expressions
   @Nullable
-  private PsiBuilder.Marker parsePrimary(final PsiBuilder builder, @Nullable final BreakPoint breakPoint, final int breakOffset) {
+  private PsiBuilder.Marker parsePrimary(PsiBuilder builder, @Nullable BreakPoint breakPoint, int breakOffset) {
     PsiBuilder.Marker startMarker = builder.mark();
 
     PsiBuilder.Marker expr = parsePrimaryExpressionStart(builder);
@@ -365,6 +364,14 @@ public class ExpressionParser {
           dotPos.drop();
           expr = parseNew(builder, expr);
         }
+        else if (dotTokenType == JavaTokenType.SUPER_KEYWORD && builder.lookAhead(1) == JavaTokenType.LPARENTH) {
+          dotPos.drop();
+          PsiBuilder.Marker refExpr = expr.precede();
+          builder.mark().done(JavaElementType.REFERENCE_PARAMETER_LIST);
+          builder.advanceLexer();
+          refExpr.done(JavaElementType.REFERENCE_EXPRESSION);
+          expr = refExpr;
+        }
         else if (THIS_OR_SUPER.contains(dotTokenType) && exprType(expr) == JavaElementType.REFERENCE_EXPRESSION) {
           if (breakPoint == BreakPoint.P2 && builder.getCurrentOffset() == breakOffset) {
             dotPos.rollbackTo();
@@ -372,11 +379,11 @@ public class ExpressionParser {
             return expr;
           }
 
-          final PsiBuilder.Marker copy = startMarker.precede();
-          final int offset = builder.getCurrentOffset();
+          PsiBuilder.Marker copy = startMarker.precede();
+          int offset = builder.getCurrentOffset();
           startMarker.rollbackTo();
 
-          final PsiBuilder.Marker ref = myParser.getReferenceParser().parseJavaCodeReference(builder, false, true, false, false);
+          PsiBuilder.Marker ref = myParser.getReferenceParser().parseJavaCodeReference(builder, false, true, false, false);
           if (ref == null || builder.getTokenType() != JavaTokenType.DOT || builder.getCurrentOffset() != dotOffset) {
             copy.rollbackTo();
             return parsePrimary(builder, BreakPoint.P2, offset);
@@ -393,17 +400,10 @@ public class ExpressionParser {
           expr = ref.precede();
           expr.done(dotTokenType == JavaTokenType.THIS_KEYWORD ? JavaElementType.THIS_EXPRESSION : JavaElementType.SUPER_EXPRESSION);
         }
-        else if (dotTokenType == JavaTokenType.SUPER_KEYWORD) {
-          dotPos.drop();
-          final PsiBuilder.Marker refExpr = expr.precede();
-          builder.mark().done(JavaElementType.REFERENCE_PARAMETER_LIST);
-          builder.advanceLexer();
-          refExpr.done(JavaElementType.REFERENCE_EXPRESSION);
-          expr = refExpr;
-        }
         else {
           dotPos.drop();
-          final PsiBuilder.Marker refExpr = expr.precede();
+          PsiBuilder.Marker refExpr = expr.precede();
+
           myParser.getReferenceParser().parseReferenceParameterList(builder, false, false);
 
           if (!expectOrError(builder, ID_OR_SUPER, "expected.identifier")) {
@@ -418,40 +418,11 @@ public class ExpressionParser {
       }
       else if (tokenType == JavaTokenType.LPARENTH) {
         if (exprType(expr) != JavaElementType.REFERENCE_EXPRESSION) {
-          if (exprType(expr) == JavaElementType.SUPER_EXPRESSION) {
-            if (breakPoint == BreakPoint.P3) {
-              startMarker.drop();
-              return expr;
-            }
-
-            final PsiBuilder.Marker copy = startMarker.precede();
-            startMarker.rollbackTo();
-
-            final PsiBuilder.Marker qualifier = parsePrimaryExpressionStart(builder);
-            if (qualifier != null) {
-              final PsiBuilder.Marker refExpr = qualifier.precede();
-              if (builder.getTokenType() == JavaTokenType.DOT) {
-                builder.advanceLexer();
-                if (builder.getTokenType() == JavaTokenType.SUPER_KEYWORD) {
-                  builder.advanceLexer();
-                  refExpr.done(JavaElementType.REFERENCE_EXPRESSION);
-                  expr = refExpr;
-                  startMarker = copy;
-                  continue;
-                }
-              }
-            }
-
-            copy.rollbackTo();
-            return parsePrimary(builder, BreakPoint.P3, -1);
-          }
-          else {
-            startMarker.drop();
-            return expr;
-          }
+          startMarker.drop();
+          return expr;
         }
 
-        final PsiBuilder.Marker callExpr = expr.precede();
+        PsiBuilder.Marker callExpr = expr.precede();
         parseArgumentList(builder);
         callExpr.done(JavaElementType.METHOD_CALL_EXPRESSION);
         expr = callExpr;
index dba1d05fd1d0211637c4a49048bd8ecabf6ab114..cba5c8d9db02a8f89c1015807653adc9d5fb5b39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -357,7 +357,6 @@ public class PsiImplUtil {
     return TargetType.UNKNOWN;
   }
 
-  // todo[r.sh] cache?
   @Nullable
   public static Set<TargetType> getAnnotationTargets(@NotNull PsiClass annotationType) {
     if (!annotationType.isAnnotationType()) return null;
@@ -393,38 +392,38 @@ public class PsiImplUtil {
     PsiUtilCore.ensureValid(expression);
     PsiUtil.ensureValidType(type);
 
-    PsiExpression toplevel = expression;
-    while (toplevel.getParent() instanceof PsiArrayAccessExpression &&
-           ((PsiArrayAccessExpression)toplevel.getParent()).getArrayExpression() == toplevel) {
-      toplevel = (PsiExpression)toplevel.getParent();
+    PsiExpression topLevel = expression;
+    while (topLevel.getParent() instanceof PsiArrayAccessExpression &&
+           ((PsiArrayAccessExpression)topLevel.getParent()).getArrayExpression() == topLevel) {
+      topLevel = (PsiExpression)topLevel.getParent();
     }
 
-    if (toplevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(toplevel)) {
+    if (topLevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(topLevel)) {
       return PsiUtil.captureToplevelWildcards(type, expression);
     }
 
-    final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
+    final PsiType normalized = doNormalizeWildcardByPosition(type, expression, topLevel);
     LOG.assertTrue(normalized.isValid(), type);
-    if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
+    if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(topLevel)) {
       return PsiUtil.captureToplevelWildcards(normalized, expression);
     }
 
     return normalized;
   }
 
-  private static PsiType doNormalizeWildcardByPosition(final PsiType type, @NotNull PsiExpression expression, final PsiExpression toplevel) {
+  private static PsiType doNormalizeWildcardByPosition(PsiType type, @NotNull PsiExpression expression, PsiExpression topLevel) {
     if (type instanceof PsiCapturedWildcardType) {
       final PsiWildcardType wildcardType = ((PsiCapturedWildcardType)type).getWildcard();
       if (expression instanceof PsiReferenceExpression && LambdaUtil.isLambdaReturnExpression(expression)) {
         return type;
       }
 
-      if (PsiUtil.isAccessedForWriting(toplevel)) {
+      if (PsiUtil.isAccessedForWriting(topLevel)) {
         return wildcardType.isSuper() ? wildcardType.getBound() : PsiCapturedWildcardType.create(wildcardType, expression);
       }
       else {
         final PsiType upperBound = ((PsiCapturedWildcardType)type).getUpperBound();
-        return upperBound instanceof PsiWildcardType ? doNormalizeWildcardByPosition(upperBound, expression, toplevel) : upperBound;
+        return upperBound instanceof PsiWildcardType ? doNormalizeWildcardByPosition(upperBound, expression, topLevel) : upperBound;
       }
     }
 
@@ -432,7 +431,7 @@ public class PsiImplUtil {
     if (type instanceof PsiWildcardType) {
       final PsiWildcardType wildcardType = (PsiWildcardType)type;
 
-      if (PsiUtil.isAccessedForWriting(toplevel)) {
+      if (PsiUtil.isAccessedForWriting(topLevel)) {
         return wildcardType.isSuper() ? wildcardType.getBound() : PsiCapturedWildcardType.create(wildcardType, expression);
       }
       else {
@@ -446,7 +445,7 @@ public class PsiImplUtil {
     }
     else if (type instanceof PsiArrayType) {
       final PsiType componentType = ((PsiArrayType)type).getComponentType();
-      final PsiType normalizedComponentType = doNormalizeWildcardByPosition(componentType, expression, toplevel);
+      final PsiType normalizedComponentType = doNormalizeWildcardByPosition(componentType, expression, topLevel);
       if (normalizedComponentType != componentType) {
         return normalizedComponentType.createArrayType();
       }
@@ -521,26 +520,34 @@ public class PsiImplUtil {
                                                                    @Nullable String attributeName,
                                                                    @Nullable PsiAnnotationMemberValue value,
                                                                    @NotNull PairFunction<Project, String, PsiAnnotation> annotationCreator) {
-    final PsiAnnotationMemberValue existing = psiAnnotation.findDeclaredAttributeValue(attributeName);
+    PsiAnnotationMemberValue existing = psiAnnotation.findDeclaredAttributeValue(attributeName);
     if (value == null) {
       if (existing == null) {
         return null;
       }
       existing.getParent().delete();
-    } else {
+    }
+    else {
       if (existing != null) {
         ((PsiNameValuePair)existing.getParent()).setValue(value);
-      } else {
-        final PsiNameValuePair[] attributes = psiAnnotation.getParameterList().getAttributes();
-        if (attributes.length == 1 && attributes[0].getName() == null) {
-          attributes[0].replace(createNameValuePair(attributes[0].getValue(), PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME + "=", annotationCreator));
+      }
+      else {
+        PsiNameValuePair[] attributes = psiAnnotation.getParameterList().getAttributes();
+        if (attributes.length == 1) {
+          PsiNameValuePair attribute = attributes[0];
+          if (attribute.getName() == null) {
+            PsiAnnotationMemberValue defValue = attribute.getValue();
+            assert defValue != null : attribute;
+            attribute.replace(createNameValuePair(defValue, PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME + "=", annotationCreator));
+          }
         }
 
         boolean allowNoName = attributes.length == 0 && ("value".equals(attributeName) || null == attributeName);
         final String namePrefix;
         if (allowNoName) {
           namePrefix = "";
-        } else {
+        }
+        else {
           namePrefix = attributeName + "=";
         }
         psiAnnotation.getParameterList().addBefore(createNameValuePair(value, namePrefix, annotationCreator), null);
@@ -709,7 +716,8 @@ public class PsiImplUtil {
     if (typeName.indexOf('<') != -1 || typeName.indexOf('[') != -1 || typeName.indexOf('.') == -1) {
       try {
         return JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createTypeFromText(typeName, context);
-      } catch(Exception ex) {} // invalid syntax will produce unresolved class type
+      }
+      catch(Exception ignored) { } // invalid syntax will produce unresolved class type
     }
 
     PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(typeName, context.getResolveScope());
index 79fe17419af090c56cb010a16b8a3e1c68e01cd3..6c660776f966093333f81a8606ad386619966eee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -77,6 +77,7 @@ public class ClsClassObjectAccessExpressionImpl extends ClsElementImpl implement
     return myTypeElement;
   }
 
+  @NotNull
   @Override
   public PsiType getType() {
     return PsiImplUtil.getType(this);
index 2b8fcbb0a6298a1b13616b0fff7256d26dc2f368..45af142ce662e759ef1a6094c8173b7ade745dc6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -92,8 +92,8 @@ public class PsiReferenceListImpl extends JavaStubPsiElement<PsiClassReferenceLi
     }
   }
 
+  @Override
   public String toString() {
-    return getElementType() == JavaElementType.EXTENDS_BOUND_LIST ? "PsiElement(EXTENDS_BOUND_LIST)"
-                                                                  : "PsiReferenceList"; // todo[r.sh] fix test data
+    return "PsiReferenceList";
   }
 }
index 678025fdf06a7f00a922c792d0691f2f7eda8d9b..21146dca40146345686be9cbc076ccc03a9d23ea 100644 (file)
@@ -77,7 +77,7 @@ PsiJavaFile:Errors.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:error
           PsiIdentifier:error('error')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
     PsiModifierList:@EJB
@@ -130,7 +130,7 @@ PsiJavaFile:Errors.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:T
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
     PsiWhiteSpace(' ')
index e76d78c17425c69d112d301d9a7421f5b8f5cdd2..621c125024e073139897728749bb29819d1aeee9 100644 (file)
@@ -31,7 +31,7 @@ PsiJavaFile:ParameterizedMethod.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:T
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiWhiteSpace(' ')
index 67c13080c6818e37ec50e133007af277c0c17b96..fcfa7054ac7489748ad420ebdb1173c3c1c23a11 100644 (file)
@@ -46,7 +46,7 @@ PsiJavaFile:QualifiedAnnotation.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:T
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiWhiteSpace(' ')
index 0cc33a82fa2c82bcf9b96a9004278ddda4ee7654..09fc9ccd01c0b2a4d300b870986dc8b481a77c0b 100644 (file)
@@ -191,7 +191,7 @@ PsiJavaFile:TypeAnnotations.java
         PsiTypeParameter:F
           PsiIdentifier:F('F')
           PsiWhiteSpace(' ')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             PsiKeyword:extends('extends')
             PsiWhiteSpace(' ')
             PsiJavaCodeReferenceElement:@Existing File
@@ -259,7 +259,7 @@ PsiJavaFile:TypeAnnotations.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:T
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiReferenceList
@@ -1067,7 +1067,7 @@ PsiJavaFile:TypeAnnotations.java
           PsiJavaToken:LT('<')
           PsiTypeParameter:T
             PsiIdentifier:T('T')
-            PsiElement(EXTENDS_BOUND_LIST)
+            PsiReferenceList
               <empty list>
           PsiJavaToken:GT('>')
         PsiWhiteSpace(' ')
@@ -1107,7 +1107,7 @@ PsiJavaFile:TypeAnnotations.java
           PsiJavaToken:LT('<')
           PsiTypeParameter:T
             PsiIdentifier:T('T')
-            PsiElement(EXTENDS_BOUND_LIST)
+            PsiReferenceList
               <empty list>
           PsiJavaToken:GT('>')
         PsiWhiteSpace(' ')
@@ -1591,7 +1591,7 @@ PsiJavaFile:TypeAnnotations.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:T
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiWhiteSpace(' ')
@@ -1659,7 +1659,7 @@ PsiJavaFile:TypeAnnotations.java
               <empty list>
           PsiWhiteSpace(' ')
           PsiIdentifier:T('T')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiReferenceList
@@ -1690,7 +1690,7 @@ PsiJavaFile:TypeAnnotations.java
               <empty list>
           PsiWhiteSpace(' ')
           PsiIdentifier:E('E')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiReferenceList
index 38e287efd51cd75aece03192b781e751765a949f..38607e1de5f161a560d227931919901179d41c7b 100644 (file)
@@ -38,7 +38,7 @@ PsiJavaFile:RefParamsAfterError.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:error
           PsiIdentifier:error('error')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiErrorElement:'>' expected.
           <empty list>
index d94bbafd54bd1f78c4beab7a30f6b302d7ed6c9b..c7875476ac56c913612342ccebfc21d95ef57b84 100644 (file)
@@ -16,7 +16,7 @@ PsiJavaFile:Errors0.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:caret
       PsiIdentifier:caret('caret')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
   PsiErrorElement:'class' or 'interface' expected
index df6b1ac6fcf1c8a842682c44bdf640b5703311d2..b18c8d0cb778f991ff4b4fe1434756ecdaada36c 100644 (file)
@@ -13,7 +13,7 @@ PsiJavaFile:Errors1.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:caret
         PsiIdentifier:caret('caret')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiJavaToken:GT('>')
     PsiReferenceList
index 64ff57387dd009c6c8034f773f6a52c8928f5c47..fe928a1df5f44c0afe274ab7a021f8fe541eabf1 100644 (file)
@@ -31,7 +31,7 @@ PsiJavaFile:Errors2.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:caret
           PsiIdentifier:caret('caret')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
     PsiWhiteSpace('\n')
index d7e6b256bd32763dd7f5df82c77dd5905f28444f..abec056ee65b31565e857e0de626930f25fbd683 100644 (file)
@@ -14,7 +14,7 @@ PsiJavaFile:ParametrizedClass.java
       PsiTypeParameter:T
         PsiIdentifier:T('T')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:java.util.List
index f90fd252e076e9463f86add34c1929a90a54529d..4a4940eee445c8e5fe67a2db8c693b65c2255705 100644 (file)
@@ -12,7 +12,7 @@ PsiJavaFile:Pines.java
       PsiTypeParameter:T
         PsiIdentifier:T('T')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:List<String>
index ce601f3b183a3e38df74499c86b138be7b54f8d5..dd542eca8983f05de8b226c4df32820d976cc4a9 100644 (file)
@@ -24,7 +24,7 @@ PsiJavaFile:CompletionHack.java
           PsiJavaToken:LT('<')
           PsiTypeParameter:X
             PsiIdentifier:X('X')
-            PsiElement(EXTENDS_BOUND_LIST)
+            PsiReferenceList
               <empty list>
           PsiWhiteSpace(' ')
           PsiErrorElement:Unexpected identifier
index ae22ee1a63f4a42b0b4686ad06526e2a61575948..1bfde5a07c8a62a11c5154bc56620cabc12ce4a7 100644 (file)
@@ -24,7 +24,7 @@ PsiJavaFile:CompletionHack1.java
           PsiJavaToken:LT('<')
           PsiTypeParameter:X
             PsiIdentifier:X('X')
-            PsiElement(EXTENDS_BOUND_LIST)
+            PsiReferenceList
               <empty list>
           PsiErrorElement:'>' expected.
             <empty list>
index a18a705db37eef0e6568b999f330f4414e3bda5d..3a62daa1af6d207f9a72d52e087ec1e1d99b394c 100644 (file)
@@ -31,7 +31,7 @@ PsiJavaFile:Errors0.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:error
           PsiIdentifier:error('error')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiErrorElement:'>' expected.
           <empty list>
index 8075a982d8b97b88ad36834947732f317cd436e2..6d62842e53620d89f3efd590590c03da82b5b09e 100644 (file)
@@ -9,7 +9,7 @@ PsiJavaFile:Errors1.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:error
       PsiIdentifier:error('error')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
@@ -42,7 +42,7 @@ PsiJavaFile:Errors1.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:error
       PsiIdentifier:error('error')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
@@ -75,7 +75,7 @@ PsiJavaFile:Errors1.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:error
       PsiIdentifier:error('error')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
index fdd9015c8d0f95774fd472f7befbd7266b4d0db6..43b660cfa3bf60ff750b5ee4d219660e3d4cf5ce 100644 (file)
@@ -29,7 +29,7 @@ PsiJavaFile:Errors2.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:caret
           PsiIdentifier:caret('caret')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiIdentifier:Configuration('Configuration')
index 4fc4d7314f63a2033195bbf81bddf242d64302bc..0cf0ab7fae1a15ad1711bf384f751ec4cbc24279 100644 (file)
@@ -27,7 +27,7 @@ PsiJavaFile:GenericMethod.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:E
           PsiIdentifier:E('E')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiWhiteSpace(' ')
@@ -50,7 +50,7 @@ PsiJavaFile:GenericMethod.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:E
           PsiIdentifier:E('E')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiJavaToken:GT('>')
       PsiWhiteSpace(' ')
@@ -77,7 +77,7 @@ PsiJavaFile:GenericMethod.java
         PsiTypeParameter:E1
           PsiIdentifier:E1('E1')
           PsiWhiteSpace(' ')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             PsiKeyword:extends('extends')
             PsiWhiteSpace(' ')
             PsiJavaCodeReferenceElement:Integer
@@ -89,7 +89,7 @@ PsiJavaFile:GenericMethod.java
         PsiTypeParameter:E2
           PsiIdentifier:E2('E2')
           PsiWhiteSpace(' ')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             PsiKeyword:extends('extends')
             PsiWhiteSpace(' ')
             PsiJavaCodeReferenceElement:Runnable
index b803ec76dfc38cdb1c4ffd39b9e60150fe314602..2ac01ae2b41cfcfc1ee9f12df8b9b991874e4545 100644 (file)
@@ -24,7 +24,7 @@ PsiJavaFile:GenericMethodErrors.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:Error
           PsiIdentifier:Error('Error')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiErrorElement:'>' expected.
           <empty list>
index 3e36753dd3387030f939c1025f0bdb38022b4b4a..04b8745ab8a99863e8262ddff66bc08d288016cc 100644 (file)
@@ -60,7 +60,7 @@ PsiJavaFile:AnonymousErrors.java
                     PsiJavaToken:LT('<')
                     PsiTypeParameter:error
                       PsiIdentifier:error('error')
-                      PsiElement(EXTENDS_BOUND_LIST)
+                      PsiReferenceList
                         <empty list>
                     PsiJavaToken:GT('>')
                 PsiWhiteSpace(' ')
index 1e1e343ba4ee99aca1fff87b7d8f39517d9cc39d..f930d3923a1ca3c903f2d59627952e59ce8d1f04 100644 (file)
@@ -81,7 +81,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
@@ -211,7 +211,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
@@ -275,7 +275,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
@@ -358,7 +358,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
@@ -420,7 +420,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
@@ -505,7 +505,7 @@ PsiJavaFile:AnonymousErrors1.java
                   PsiJavaToken:LT('<')
                   PsiTypeParameter:error
                     PsiIdentifier:error('error')
-                    PsiElement(EXTENDS_BOUND_LIST)
+                    PsiReferenceList
                       <empty list>
                   PsiErrorElement:'>' expected.
                     <empty list>
index faac0de388c1a4f8b975b5b0809f725f1ec7ca1b..f8e41ac609c191f8c13d0d2112fceff48f520dc4 100644 (file)
@@ -60,6 +60,8 @@ PsiJavaFile:QualifiedSuperMethodCall1.java
                   <empty list>
                 PsiIdentifier:d('d')
               PsiJavaToken:DOT('.')
+              PsiReferenceParameterList
+                <empty list>
               PsiKeyword:super('super')
             PsiExpressionList
               PsiJavaToken:LPARENTH('(')
index cd0a4bfe1b1997382b05f7f73a97467388868756..986c7b335c20c1c51792a4f8ea8c5f38cc56523c 100644 (file)
@@ -27,7 +27,7 @@ PsiJavaFile:TypeParam.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:V
         PsiIdentifier:V('V')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiJavaToken:GT('>')
     PsiReferenceList
index 7b9cfccf79def7b6db22e0ad22ae642b2dac5af5..e61716a2fa1dff2661b104713c44ed41f2b09425 100644 (file)
@@ -9,7 +9,7 @@ PsiJavaFile:CompletionHack0.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:X
           PsiIdentifier:X('X')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiWhiteSpace(' ')
         PsiErrorElement:Unexpected identifier
index 127827743962eaed94704f8017664667a36f32d4..43a2335cedde2b811a14c9056f159687842aab8d 100644 (file)
@@ -9,7 +9,7 @@ PsiJavaFile:CompletionHack1.java
         PsiJavaToken:LT('<')
         PsiTypeParameter:X
           PsiIdentifier:X('X')
-          PsiElement(EXTENDS_BOUND_LIST)
+          PsiReferenceList
             <empty list>
         PsiErrorElement:'>' expected.
           <empty list>
index 609379fee3fa771b84cdbf22948cf3f1dc774d7e..9d1bd3c5c14ada870238a143857b1f3ef5e08f04 100644 (file)
@@ -11,7 +11,7 @@ PsiJavaFile:Errors.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:error
         PsiIdentifier:error('error')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiErrorElement:'>' expected.
         <empty list>
index 7504f3612d97a378334cec438e9b0deb8520591b..4860a0a19f3ab86de36b20d7883f69d32e908f36 100644 (file)
@@ -11,7 +11,7 @@ PsiJavaFile:GenericMethod.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:E
         PsiIdentifier:E('E')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiJavaToken:GT('>')
     PsiWhiteSpace(' ')
@@ -30,7 +30,7 @@ PsiJavaFile:GenericMethod.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:E
         PsiIdentifier:E('E')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiJavaToken:GT('>')
     PsiWhiteSpace(' ')
@@ -53,7 +53,7 @@ PsiJavaFile:GenericMethod.java
       PsiTypeParameter:E1
         PsiIdentifier:E1('E1')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:Integer
@@ -65,7 +65,7 @@ PsiJavaFile:GenericMethod.java
       PsiTypeParameter:E2
         PsiIdentifier:E2('E2')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:Runnable
index 5be504737907c2b22200fc5311ee9bd93c5504d9..0709b466573eed12bc31de03948a0790263ead0c 100644 (file)
@@ -8,7 +8,7 @@ PsiJavaFile:GenericMethodErrors.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:Error
         PsiIdentifier:Error('Error')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiErrorElement:'>' expected.
         <empty list>
index 262c0c8ce39d77f135830c6bed32a96529e0f156..194b11a2d3a1ed0621601e74fa270fa6243e676e 100644 (file)
@@ -14,7 +14,7 @@ PsiJavaFile:ParameterizedClass.java
       PsiTypeParameter:T
         PsiIdentifier:T('T')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:java.util.List
index 0128264c46b5792d50368b50fbd00de4159f6429..62f4bfd5228748815d41692f2dc1f2e9bb88ee51 100644 (file)
@@ -16,7 +16,7 @@ PsiJavaFile:ParameterizedMethod.java
       PsiJavaToken:LT('<')
       PsiTypeParameter:T
         PsiIdentifier:T('T')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           <empty list>
       PsiJavaToken:GT('>')
     PsiWhiteSpace(' ')
index afbe40ee6412e9ced9b4dbd2def972e75aa1a2eb..32549f1d89bbebe62a7cce7e52e43d4957ac28fc 100644 (file)
@@ -12,7 +12,7 @@ PsiJavaFile:Pines.java
       PsiTypeParameter:T
         PsiIdentifier:T('T')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:List<String>
index b44cea753f5f3f19356335eaf0bd6b9cf5985c22..858047d4f619588f187bdd73fbfb65fd629fc8b3 100644 (file)
@@ -21,7 +21,7 @@ PsiJavaFile:TypeAnno.java
         PsiWhiteSpace(' ')
         PsiIdentifier:T('T')
         PsiWhiteSpace(' ')
-        PsiElement(EXTENDS_BOUND_LIST)
+        PsiReferenceList
           PsiKeyword:extends('extends')
           PsiWhiteSpace(' ')
           PsiJavaCodeReferenceElement:@F Object
index c08eb71cc2205ed2710e8e32e42810ff1b8efc1b..a5ef807409eb220fc0bfb1e090a454aa217c6eaf 100644 (file)
@@ -6,9 +6,11 @@ PsiJavaFile:QualifiedSuperMethodCall1.java
           <empty list>
         PsiIdentifier:d('d')
       PsiJavaToken:DOT('.')
+      PsiReferenceParameterList
+        <empty list>
       PsiKeyword:super('super')
     PsiExpressionList
       PsiJavaToken:LPARENTH('(')
       PsiLiteralExpression:0
         PsiJavaToken:INTEGER_LITERAL('0')
-      PsiJavaToken:RPARENTH(')')
+      PsiJavaToken:RPARENTH(')')
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/parser-partial/expressions/QualifiedSuperMethodCall3.txt b/java/java-tests/testData/psi/parser-partial/expressions/QualifiedSuperMethodCall3.txt
new file mode 100644 (file)
index 0000000..e885d4b
--- /dev/null
@@ -0,0 +1,19 @@
+PsiJavaFile:QualifiedSuperMethodCall3.java
+  PsiMethodCallExpression:C.A.super()
+    PsiReferenceExpression:C.A.super
+      PsiReferenceExpression:C.A
+        PsiReferenceExpression:C
+          PsiReferenceParameterList
+            <empty list>
+          PsiIdentifier:C('C')
+        PsiJavaToken:DOT('.')
+        PsiReferenceParameterList
+          <empty list>
+        PsiIdentifier:A('A')
+      PsiJavaToken:DOT('.')
+      PsiReferenceParameterList
+        <empty list>
+      PsiKeyword:super('super')
+    PsiExpressionList
+      PsiJavaToken:LPARENTH('(')
+      PsiJavaToken:RPARENTH(')')
\ No newline at end of file
index f08d6209fc8f86efe63d5457b963786e6ff3bda2..e8ffbdfec6c887aa26898594743b020c9594eb7a 100644 (file)
@@ -6,6 +6,6 @@ PsiJavaFile:AnyType.java
         PsiIdentifier:any('any')
       PsiWhiteSpace(' ')
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
\ No newline at end of file
index 508d8cd3fbae5e587ec7b83c9b73f0758cc32437..b5edddd686bfe0e124ee6d93ca3e348d43566e62 100644 (file)
@@ -3,6 +3,6 @@ PsiJavaFile:TypeParams0.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
\ No newline at end of file
index 0dd4209d39f465985d95ccc10c1beeb243d213b2..0643e308526e1116a570e533a5ec8c824f2d3cd4 100644 (file)
@@ -3,12 +3,12 @@ PsiJavaFile:TypeParams1.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:COMMA(',')
     PsiWhiteSpace(' ')
     PsiTypeParameter:U
       PsiIdentifier:U('U')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
\ No newline at end of file
index 16ac8bead2bfcc6d50bdd3e79624a2cd2a05bc6f..d26d5f430883e6094ea8558c4456651029690c7d 100644 (file)
@@ -3,7 +3,7 @@ PsiJavaFile:TypeParams2.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
\ No newline at end of file
index b24e3661f7ebd6b54911b74020452c08d6b0f88d..714e4ff07692c570c7c0673617a3373fdba86f8a 100644 (file)
@@ -3,7 +3,7 @@ PsiJavaFile:TypeParams3.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiWhiteSpace(' ')
     PsiErrorElement:Unexpected identifier
index 3f60da4b3fcbcce357484884f15040e5b9c8662a..1b7e282c51077f99d3802fd8df117849b4ccdbf7 100644 (file)
@@ -3,7 +3,7 @@ PsiJavaFile:TypeParams4.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
index a7329da61f08eba21e6586d44025c9577b705ce8..8b5d95fbe855f301836bbf470d75ba47df522a7b 100644 (file)
@@ -4,7 +4,7 @@ PsiJavaFile:TypeParams5.java
     PsiTypeParameter:T
       PsiIdentifier:T('T')
       PsiWhiteSpace(' ')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         PsiKeyword:extends('extends')
         PsiWhiteSpace(' ')
         PsiJavaCodeReferenceElement:X
index a5b46b98efd079bacff911b3955b08970bb425cc..cc04d07503b0109d16a5987acddc0417cf7967db 100644 (file)
@@ -3,7 +3,7 @@ PsiJavaFile:TypeParams6.java
     PsiJavaToken:LT('<')
     PsiTypeParameter:T
       PsiIdentifier:T('T')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiErrorElement:'>' expected.
       <empty list>
index aaea7b8c3d5d731d71395c3ffaf88dfa0489777c..69c26751efc3db4185087dae5d7cabce48c38032 100644 (file)
@@ -4,7 +4,7 @@ PsiJavaFile:TypeParams7.java
     PsiTypeParameter:T
       PsiIdentifier:T('T')
       PsiWhiteSpace(' ')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         PsiKeyword:extends('extends')
         PsiWhiteSpace(' ')
         PsiJavaCodeReferenceElement:X
@@ -15,6 +15,6 @@ PsiJavaFile:TypeParams7.java
     PsiWhiteSpace(' ')
     PsiTypeParameter:Y
       PsiIdentifier:Y('Y')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
\ No newline at end of file
index 9389898f2c158c1d4bab417dba4ca33bb99feb77..a6b518dd482cc27b5d249863398e21ef8aa2e772 100644 (file)
@@ -3,6 +3,6 @@ PsiJavaFile:TypeParams8.java
     PsiJavaToken:LT('<')
     PsiErrorElement:Unexpected wildcard
       PsiJavaToken:QUEST('?')
-      PsiElement(EXTENDS_BOUND_LIST)
+      PsiReferenceList
         <empty list>
     PsiJavaToken:GT('>')
diff --git a/java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements.java b/java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements.java
new file mode 100644 (file)
index 0000000..831178c
--- /dev/null
@@ -0,0 +1,12 @@
+class X {
+  static String guessTestDataName(String method, String testName, String[] methods) {
+    for (String psiMethod : methods) {
+      <selection>String strings = method;
+      if (strings != null && !strings.isEmpty()) {
+        return strings.substring(0) + testName;
+      }
+      </selection>
+    }
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements_after.java b/java/java-tests/testData/refactoring/extractMethod/ConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements_after.java
new file mode 100644 (file)
index 0000000..db3cef1
--- /dev/null
@@ -0,0 +1,21 @@
+import org.jetbrains.annotations.Nullable;
+
+class X {
+  static String guessTestDataName(String method, String testName, String[] methods) {
+    for (String psiMethod : methods) {
+        String strings = newMethod(method, testName);
+        if (strings != null) return strings;
+      
+    }
+    return null;
+  }
+
+    @Nullable
+    private static String newMethod(String method, String testName) {
+        String strings = method;
+        if (strings != null && !strings.isEmpty()) {
+          return strings.substring(0) + testName;
+        }
+        return null;
+    }
+}
index 6ad32250004a769d0bb10ac9ac0cb5fd6b154fac..37d1a9bdcca932b5f77715a9927e1ca6238a2055 100644 (file)
@@ -7,7 +7,6 @@ public class Test {
     }
 
     private boolean newMethod() {
-        Object result;
         if (test1()) return true;
         if (test2()) return true;
         return false;
index 9bd0d80724d24e5eade4db8c52801bf7e715242f..f0c40c723f11a4ca45ef5b513682f9ccdf57ed4f 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.generation.OverrideImplementUtil;
 import com.intellij.codeInsight.generation.PsiMethodMember;
 import com.intellij.codeInsight.intention.impl.ImplementAbstractMethodHandler;
 import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -29,6 +30,7 @@ import com.intellij.psi.util.MethodSignature;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.testFramework.LightCodeInsightTestCase;
+import com.intellij.testFramework.MapDataContext;
 import com.intellij.util.FunctionUtil;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.Nullable;
@@ -134,7 +136,9 @@ public class OverrideImplement15Test extends LightCodeInsightTestCase {
     PsiElement context = getFile().findElementAt(offset);
     final PsiClass aClass = PsiTreeUtil.getParentOfType(context, PsiClass.class);
     assertTrue(aClass != null && aClass.isAnnotationType());
-    assertFalse(new JavaOverrideMethodsHandler().isValidFor(getEditor(), getFile()));
+    final JavaOverrideMethodsHandler handler = new JavaOverrideMethodsHandler();
+    assertTrue(handler.isValidFor(getEditor(), getFile()));
+    assertFalse(handler.isAvailableForQuickList(getEditor(), getFile(), new MapDataContext()));
   }
 
   private void doTest(boolean copyJavadoc) { doTest(copyJavadoc, null); }
index 5adce674ae4f81f806dc92bc2eb674d0934fef35..3a39db7a73ebf32970c8f18cc686e6c9b7e03b04 100644 (file)
@@ -7,7 +7,10 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo;
 import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
 import com.intellij.lang.CodeInsightActions;
 import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.Shortcut;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.keymap.KeymapUtil;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
@@ -36,8 +39,11 @@ public class JavaGotoSuperTest extends LightDaemonAnalyzerTestCase {
     List<LineMarkerInfo> markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject());
     for (LineMarkerInfo info : markers) {
       if (info.endOffset >= offset && info.startOffset <= offset) {
+        Shortcut shortcut = ActionManager.getInstance().getAction("GotoSuperMethod").getShortcutSet().getShortcuts()[0];
         assertEquals(
-          "<html><body>Overrides method in <a href=\"#javaClass/I\">I</a><br><div style='margin-top: 5px'><font size='2'>Click or press Ctrl+U to navigate</font></div></body></html>",
+          "<html><body>Overrides method in <a href=\"#javaClass/I\">I</a><br><div style='margin-top: 5px'><font size='2'>Click or press " +
+          KeymapUtil.getShortcutText(shortcut) +
+          " to navigate</font></div></body></html>",
           info.getLineMarkerTooltip());
         return;
       }
index 3290863f153fd2228ccd626c661a15d9c564d159..9208946195708122ac287f5b391bdc05b4096367 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package com.intellij.lang.java.parser.partial;
 import com.intellij.lang.PsiBuilder;
 import com.intellij.lang.java.parser.JavaParser;
 import com.intellij.lang.java.parser.JavaParsingTestCase;
-import org.jetbrains.annotations.NonNls;
 
 public class ExpressionParserTest extends JavaParsingTestCase {
   public ExpressionParserTest() {
@@ -112,6 +111,7 @@ public class ExpressionParserTest extends JavaParsingTestCase {
   public void testQualifiedSuperMethodCall0() { doParserTest("new D().super(0)"); }
   public void testQualifiedSuperMethodCall1() { doParserTest("d.super(0)"); }
   public void testQualifiedSuperMethodCall2() { doParserTest("(new O()).<T>super()"); }
+  public void testQualifiedSuperMethodCall3() { doParserTest("C.A.super()"); }
   public void testSuperMethodCallTypeParameterList() { doParserTest("super()"); }
   public void testPrimitiveClassObjectAccess() { doParserTest("int.class"); }
   public void testPrimitiveFieldAccess() { doParserTest("int.x"); }
@@ -149,9 +149,10 @@ public class ExpressionParserTest extends JavaParsingTestCase {
   public void testLambdaExpression19() { doParserTest("(@A T t) -> (null)"); }
   public void testAmbiguousLambdaExpression() { doParserTest("f( (x) < y , z > (w) -> v )"); }
 
-  private void doParserTest(@NonNls final String text) {
+  private void doParserTest(String text) {
     doParserTest(text, new MyTestParser());
   }
+
   private static class MyTestParser implements TestParser {
     @Override
     public void parse(final PsiBuilder builder) {
index 37eac2578997132a9d34827865530cb32453f5e7..b9c70c9a0225132607f54363306033928ef57c3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.navigation.ClassImplementationsSearch;
 import com.intellij.codeInsight.navigation.MethodImplementationsSearch;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.module.impl.ModuleManagerImpl;
 import com.intellij.openapi.project.ex.ProjectManagerEx;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -58,19 +57,11 @@ public class GotoImplementationTest extends CodeInsightTestCase {
     VirtualFile projectFile = vfsRoot.findChild("test.ipr");
     myProject = ProjectManagerEx.getInstanceEx().loadProject(projectFile.getPath());
 
-    simulateProjectOpen();
     ProjectManagerEx.getInstanceEx().openTestProject(myProject);
     UIUtil.dispatchAllInvocationEvents(); // startup activities
   }
 
-  @Override
-  protected void tearDown() throws Exception {
-    ((ModuleManagerImpl)ModuleManager.getInstance(myProject)).projectClosed();
-    super.tearDown();
-  }
-
   public void test() throws Exception {
-
     ModuleManager moduleManager = ModuleManager.getInstance(getProject());
     Module[] modules = moduleManager.getModules();
     assertEquals(3, modules.length);
similarity index 98%
rename from java/java-tests/testSrc/com/intellij/psi/autodetect/AbstractNewLineBlocksIteratorTest.java
rename to java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/AbstractNewLineBlocksIteratorTest.java
index 2b6350e05e1ab99a01634000cbffaf5645e27e7a..7e7e7a35ef2c1dcf64dcdbba37c8941c304f0d09 100644 (file)
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.psi.autodetect;
+package com.intellij.psi.codeStyle.autodetect;
 
 import com.intellij.formatting.Block;
 import com.intellij.formatting.FormattingModel;
diff --git a/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/DetectIndentAndTypeTest.java b/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/DetectIndentAndTypeTest.java
new file mode 100644 (file)
index 0000000..0a13972
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.codeStyle.autodetect;
+
+import com.intellij.ide.highlighter.JavaFileType;
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTestCase {
+
+  private CodeStyleSettings mySettings;
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(new CodeStyleSettings());
+    mySettings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
+    mySettings.AUTODETECT_INDENTS = true;
+    DetectableIndentOptionsProvider optionsProvider = DetectableIndentOptionsProvider.getInstance();
+    if (optionsProvider != null) {
+      optionsProvider.setEnabledInTest(true);
+    }
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings();
+    DetectableIndentOptionsProvider optionsProvider = DetectableIndentOptionsProvider.getInstance();
+    if (optionsProvider != null) {
+      optionsProvider.setEnabledInTest(false);
+    }
+    super.tearDown();
+  }
+
+  public void testWhenTabsDetected_SetIndentSizeToTabSize() {
+    CommonCodeStyleSettings common = mySettings.getCommonSettings(JavaLanguage.INSTANCE);
+    CommonCodeStyleSettings.IndentOptions indentOptions = common.getIndentOptions();
+
+    assert indentOptions != null;
+
+    indentOptions.INDENT_SIZE = 1;
+    indentOptions.TAB_SIZE = 2;
+
+    myFixture.configureByText(JavaFileType.INSTANCE,
+                              "public class T {\n" +
+                              "\tvoid run() {\n" +
+                              "\t\tint a = 2;<caret>\n" +
+                              "\t}\n" +
+                              "}\n");
+    myFixture.type('\n');
+    myFixture.checkResult("public class T {\n" +
+                          "\tvoid run() {\n" +
+                          "\t\tint a = 2;\n" +
+                          "\t\t<caret>\n" +
+                          "\t}\n" +
+                          "}\n");
+  }
+
+  public void testWhenTabsDetected_SetContinuationIndentSizeToDoubleTabSize() {
+    CommonCodeStyleSettings common = mySettings.getCommonSettings(JavaLanguage.INSTANCE);
+    CommonCodeStyleSettings.IndentOptions indentOptions = common.getIndentOptions();
+
+    assert indentOptions != null;
+
+    indentOptions.INDENT_SIZE = 1;
+    indentOptions.TAB_SIZE = 2;
+    indentOptions.CONTINUATION_INDENT_SIZE = 8;
+
+    myFixture.configureByText(JavaFileType.INSTANCE,
+                              "public class T {\n" +
+                              "\tvoid run() {\n" +
+                              "\t\tint a = 2 <caret>+ 2;\n" +
+                              "\t}\n" +
+                              "}\n");
+    myFixture.type('\n');
+    myFixture.checkResult("public class T {\n" +
+                          "\tvoid run() {\n" +
+                          "\t\tint a = 2 \n" +
+                          "\t\t\t\t<caret>+ 2;\n" +
+                          "\t}\n" +
+                          "}\n");
+  }
+}
similarity index 97%
rename from java/java-tests/testSrc/com/intellij/psi/autodetect/JavaAutoDetectIndentTest.java
rename to java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/JavaAutoDetectIndentTest.java
index f1b90dced63d527226fd9ba69bbe060c2ab7f91a..70bca2a7fd66a7e68e7663bd10ce0e48afe9b890 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.psi.autodetect;
+package com.intellij.psi.codeStyle.autodetect;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.openapi.fileTypes.PlainTextLanguage;
+import com.intellij.psi.autodetect.AbstractIndentAutoDetectionTest;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.psi.codeStyle.autodetect.LineIndentInfo;
 import com.intellij.psi.codeStyle.autodetect.LineIndentInfoBuilder;
similarity index 96%
rename from java/java-tests/testSrc/com/intellij/psi/autodetect/NewLineBlocksIteratorTest.java
rename to java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/NewLineBlocksIteratorTest.java
index 25c4416ad73a24550f20c11e2a4d6195cffb168f..2e3269ff02b9724368539a025f4714054f270cdc 100644 (file)
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.psi.autodetect;
+package com.intellij.psi.codeStyle.autodetect;
 
 import com.intellij.JavaTestUtil;
 import org.jetbrains.annotations.NotNull;
index cad137eae2ab11b15f1dbc95b041beb56bff641a..6a232ae4b830d7885766ae23abdcb3e1cf365cd6 100644 (file)
@@ -749,6 +749,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
     }
   }
 
+  public void testConditionalExitCombinedWithNullabilityShouldPreserveVarsUsedInExitStatements() throws Exception {
+    doTest();
+  }
+
   private void doTestDisabledParam() throws PrepareFailedException {
     final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
     settings.ELSE_ON_NEW_LINE = true;
index b095f7df0820ce33b9676838ad7582f707221a6e..c1273eb10eac909ee4c84d88b0150e498e17347d 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.roots;
 
 import com.intellij.ProjectTopics;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ex.PathManagerEx;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
@@ -33,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.ModuleTestCase;
 import com.intellij.util.messages.MessageBusConnection;
+import com.intellij.util.ui.UIUtil;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,21 +43,19 @@ import java.io.IOException;
  * @author dsl
  */
 public class RootsChangedTest extends ModuleTestCase {
-  private MessageBusConnection myConnection;
   private MyModuleRootListener myModuleRootListener;
 
   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    myConnection = myProject.getMessageBus().connect();
+    MessageBusConnection connection = myProject.getMessageBus().connect(myTestRootDisposable);
     myModuleRootListener = new MyModuleRootListener();
-    myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, myModuleRootListener);
+    connection.subscribe(ProjectTopics.PROJECT_ROOTS, myModuleRootListener);
   }
 
   @Override
-  protected void tearDown() throws Exception {
-    myConnection.disconnect();
-    super.tearDown();
+  protected boolean isRunInWriteAction() {
+    return false;
   }
 
   public void testEventsAfterFileModifications() throws Exception {
@@ -70,11 +70,12 @@ public class RootsChangedTest extends ModuleTestCase {
     myModuleRootListener.reset();
 
     ModuleRootModificationUtil.addContentRoot(moduleA, vDir1.getPath());
+    UIUtil.dispatchAllInvocationEvents();
 
     assertEventsCount(1);
     assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir1);
     
-    vDir1.delete(null);
+    delete(vDir1);
     assertEventsCount(1);
     assertEmpty(ModuleRootManager.getInstance(moduleA).getContentRoots());
  
@@ -83,12 +84,12 @@ public class RootsChangedTest extends ModuleTestCase {
     VirtualFile vDir2 = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir2);
     assertNotNull(vDir2);
 
-    vDir2.rename(null, "dir1");
+    rename(vDir2, "dir1");
     assertEventsCount(1);
     assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
 
     // when the existing root is renamed, it remains a root
-    vDir2.rename(null, "dir2");
+    rename(vDir2, "dir2");
     assertEventsCount(0);
     assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
  
@@ -98,7 +99,7 @@ public class RootsChangedTest extends ModuleTestCase {
     VirtualFile vSubdir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(subdir);
     assertNotNull(vSubdir);
 
-    vDir2.move(null, vSubdir);
+    move(vDir2, vSubdir);
     assertEventsCount(0);
     assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
   }
@@ -124,85 +125,105 @@ public class RootsChangedTest extends ModuleTestCase {
   }
 
   public void testEditLibraryForModuleLoadFromXml() throws IOException {
-    File moduleFile = PathManagerEx.findFileUnderProjectHome("java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml", getClass());
-    Module a = loadModule(moduleFile, true);
-    assertEventsCount(1);
-
-    final Sdk jdk = IdeaTestUtil.getMockJdk17();
-    ProjectJdkTable.getInstance().addJdk(jdk);
-    assertEventsCount(0);
-
-    ModuleRootModificationUtil.setModuleSdk(a, jdk);
-    assertEventsCount(1);
+    final File tempDirectory = createTempDirectory();
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        File moduleFile =
+          PathManagerEx.findFileUnderProjectHome("java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml", RootsChangedTest.this.getClass());
+        Module a = loadModule(moduleFile, true);
+        assertEventsCount(1);
+
+        final Sdk jdk = IdeaTestUtil.getMockJdk17();
+        ProjectJdkTable.getInstance().addJdk(jdk);
+        assertEventsCount(0);
+
+        ModuleRootModificationUtil.setModuleSdk(a, jdk);
+        assertEventsCount(1);
+
+        final SdkModificator sdkModificator = jdk.getSdkModificator();
+        sdkModificator.addRoot(getVirtualFile(tempDirectory), OrderRootType.CLASSES);
+        sdkModificator.commitChanges();
+      }
+    });
 
-    final SdkModificator sdkModificator = jdk.getSdkModificator();
-    sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
-    sdkModificator.commitChanges();
     assertEventsCount(1);
   }
 
   public void testModuleJdkEditing() throws Exception {
-    final Module moduleA = createModule("a.iml");
-    final Module moduleB = createModule("b.iml");
-    assertEventsCount(2);
-
-    final Sdk jdk = IdeaTestUtil.getMockJdk17();
-    ProjectJdkTable.getInstance().addJdk(jdk);
-    assertEventsCount(0);
-
-    final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
-    final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
-    rootModelA.setSdk(jdk);
-    rootModelB.setSdk(jdk);
-    ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
-    ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
-    assertEventsCount(1);
-
-    final SdkModificator sdkModificator = jdk.getSdkModificator();
-    sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
-    sdkModificator.commitChanges();
-    assertEventsCount(1);
-
-    ProjectJdkTable.getInstance().removeJdk(jdk);
-    assertEventsCount(1);
+    final File tempDirectory = createTempDirectory();
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        final Module moduleA = createModule("a.iml");
+        final Module moduleB = createModule("b.iml");
+        assertEventsCount(2);
+
+        final Sdk jdk = IdeaTestUtil.getMockJdk17();
+        ProjectJdkTable.getInstance().addJdk(jdk);
+        assertEventsCount(0);
+
+        final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
+        final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
+        rootModelA.setSdk(jdk);
+        rootModelB.setSdk(jdk);
+        ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
+        ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
+        assertEventsCount(1);
+
+        final SdkModificator sdkModificator = jdk.getSdkModificator();
+        sdkModificator.addRoot(getVirtualFile(tempDirectory), OrderRootType.CLASSES);
+        sdkModificator.commitChanges();
+        assertEventsCount(1);
+
+        ProjectJdkTable.getInstance().removeJdk(jdk);
+        assertEventsCount(1);
+      }
+    });
   }
 
   public void testInheritedJdkEditing() throws Exception {
-    final Module moduleA = createModule("a.iml");
-    final Module moduleB = createModule("b.iml");
-    assertEventsCount(2);
-
-    final Sdk jdk = IdeaTestUtil.getMockJdk17("AAA");
-    ProjectJdkTable.getInstance().addJdk(jdk);
-    assertEventsCount(0);
-
-    final Sdk jdkBBB = IdeaTestUtil.getMockJdk17("BBB");
-    ProjectJdkTable.getInstance().addJdk(jdk);
-    assertEventsCount(0);
-
-    ProjectRootManager.getInstance(myProject).setProjectSdk(jdkBBB);
-    assertEventsCount(0);
-
-    final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
-    final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
-    rootModelA.inheritSdk();
-    rootModelB.inheritSdk();
-    ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
-    if (rootModels.length > 0) {
-      ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
-    }
-    assertEventsCount(1);
-
-    ProjectRootManager.getInstance(myProject).setProjectSdk(jdk);
-    assertEventsCount(1);
-
-    final SdkModificator sdkModificator = jdk.getSdkModificator();
-    sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
-    sdkModificator.commitChanges();
-    assertEventsCount(1);
-
-    ProjectJdkTable.getInstance().removeJdk(jdk);
-    assertEventsCount(1);
+    final File tempDirectory = createTempDirectory();
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        final Module moduleA = createModule("a.iml");
+        final Module moduleB = createModule("b.iml");
+        assertEventsCount(2);
+
+        final Sdk jdk = IdeaTestUtil.getMockJdk17("AAA");
+        ProjectJdkTable.getInstance().addJdk(jdk);
+        assertEventsCount(0);
+
+        final Sdk jdkBBB = IdeaTestUtil.getMockJdk17("BBB");
+        ProjectJdkTable.getInstance().addJdk(jdk);
+        assertEventsCount(0);
+
+        ProjectRootManager.getInstance(myProject).setProjectSdk(jdkBBB);
+        assertEventsCount(0);
+
+        final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
+        final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
+        rootModelA.inheritSdk();
+        rootModelB.inheritSdk();
+        ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
+        if (rootModels.length > 0) {
+          ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
+        }
+        assertEventsCount(1);
+
+        ProjectRootManager.getInstance(myProject).setProjectSdk(jdk);
+        assertEventsCount(1);
+
+        final SdkModificator sdkModificator = jdk.getSdkModificator();
+        sdkModificator.addRoot(getVirtualFile(tempDirectory), OrderRootType.CLASSES);
+        sdkModificator.commitChanges();
+        assertEventsCount(1);
+
+        ProjectJdkTable.getInstance().removeJdk(jdk);
+        assertEventsCount(1);
+      }
+    });
   }
 
   private void verifyLibraryTableEditing(final LibraryTable libraryTable) throws IOException {
@@ -210,86 +231,103 @@ public class RootsChangedTest extends ModuleTestCase {
     final Module moduleB = createModule("b.iml");
     assertEventsCount(2);
 
-    final Library libraryA = libraryTable.createLibrary("A");
-    final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
-    libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
-    libraryModifiableModel.commit();
-    assertEventsCount(0);
-
-    final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
-    final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
-    rootModelA.addLibraryEntry(libraryA);
-    rootModelB.addLibraryEntry(libraryA);
-    rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
-    rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
-    ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
-    if (rootModels.length > 0) {
-      ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
-    }
-    assertEventsCount(1);
-
-    final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
-    final File tmpDir = FileUtil.createTempDirectory(getTestName(true), "");
-    try {
-      final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpDir);
-      assertNotNull(file);
-      
-      libraryModifiableModel2.addRoot(file.getUrl(), OrderRootType.CLASSES);
-      libraryModifiableModel2.commit();
-      assertEventsCount(1);
-    }
-    finally {
-      FileUtil.delete(tmpDir);
-    }
-
-    libraryTable.removeLibrary(libraryA);
-    assertEventsCount(1);
-
-    final Library libraryQ = libraryTable.createLibrary("Q");
-    assertEventsCount(1);
-
-    libraryTable.removeLibrary(libraryQ);
-    assertEventsCount(1);
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        final Library libraryA = libraryTable.createLibrary("A");
+        final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
+        libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
+        libraryModifiableModel.commit();
+        assertEventsCount(0);
+
+        final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
+        final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
+        rootModelA.addLibraryEntry(libraryA);
+        rootModelB.addLibraryEntry(libraryA);
+        rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
+        rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
+        ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
+        if (rootModels.length > 0) {
+          ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
+        }
+        assertEventsCount(1);
+
+        final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
+        final File tmpDir;
+        try {
+          tmpDir = FileUtil.createTempDirectory(getTestName(true), "");
+        }
+        catch (IOException e) {
+          throw new RuntimeException(e);
+        }
+
+        try {
+          final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpDir);
+          assertNotNull(file);
+
+          libraryModifiableModel2.addRoot(file.getUrl(), OrderRootType.CLASSES);
+          libraryModifiableModel2.commit();
+          assertEventsCount(1);
+        }
+        finally {
+          FileUtil.delete(tmpDir);
+        }
+
+        libraryTable.removeLibrary(libraryA);
+        assertEventsCount(1);
+
+        final Library libraryQ = libraryTable.createLibrary("Q");
+        assertEventsCount(1);
+
+        libraryTable.removeLibrary(libraryQ);
+        assertEventsCount(1);
+      }
+    });
   }
 
   private void verifyLibraryTableEditingInUncommittedModel(final LibraryTable libraryTable) {
-    final Module moduleA = createModule("a.iml");
-    final Module moduleB = createModule("b.iml");
-    assertEventsCount(2);
-
-    final Library libraryA = libraryTable.createLibrary("A");
-    final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
-    libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
-    libraryModifiableModel.commit();
-    assertEventsCount(0);
-
-    final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
-    final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
-    rootModelA.addLibraryEntry(libraryA);
-    rootModelB.addLibraryEntry(libraryA);
-    final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
-    libraryModifiableModel2.addRoot("file:///b", OrderRootType.CLASSES);
-    libraryModifiableModel2.commit();
-    assertEventsCount(0);
-
-    libraryTable.removeLibrary(libraryA);
-    assertEventsCount(0);
-
-    rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
-    rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
-    assertEventsCount(0);
-
-    final Library libraryQ = libraryTable.createLibrary("Q");
-    assertEventsCount(0);
-
-    ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
-    if (rootModels.length > 0) {
-      ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
-    }
-    assertEventsCount(1);
-
-    libraryTable.removeLibrary(libraryQ);
-    assertEventsCount(1);
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        final Module moduleA = createModule("a.iml");
+        final Module moduleB = createModule("b.iml");
+        assertEventsCount(2);
+
+        final Library libraryA = libraryTable.createLibrary("A");
+        final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
+        libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
+        libraryModifiableModel.commit();
+        assertEventsCount(0);
+
+        final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
+        final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
+        rootModelA.addLibraryEntry(libraryA);
+        rootModelB.addLibraryEntry(libraryA);
+        final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
+        libraryModifiableModel2.addRoot("file:///b", OrderRootType.CLASSES);
+        libraryModifiableModel2.commit();
+        assertEventsCount(0);
+
+        libraryTable.removeLibrary(libraryA);
+        assertEventsCount(0);
+
+        rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
+        rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
+        assertEventsCount(0);
+
+        final Library libraryQ = libraryTable.createLibrary("Q");
+        assertEventsCount(0);
+
+        ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
+        if (rootModels.length > 0) {
+          ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
+        }
+        assertEventsCount(1);
+
+        libraryTable.removeLibrary(libraryQ);
+        assertEventsCount(1);
+      }
+    });
   }
 
   private void assertEventsCount(int count) {
index 7124d3b6692bb00de4e1ebee53885ffd91bc11dc..3c32b92fd013f75aba15c26af9816e9020540a4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,45 +29,52 @@ import java.io.File;
  *         Date: 4/9/12
  */
 public class UnscrambleDialogTest extends JavaCodeInsightFixtureTestCase {
+  private RunContentDescriptor myContent;
+
+  @Override
+  protected void tearDown() throws Exception {
+    Disposer.dispose(myContent);
+    super.tearDown();
+  }
 
   public void testStacktrace() throws Exception {
-    RunContentDescriptor content = showText("");
-    Icon icon = content.getIcon();
-    String name = content.getDisplayName();
+    showText("");
+    Icon icon = myContent.getIcon();
+    String name = myContent.getDisplayName();
     assertEquals(null, icon);
     assertEquals("<Stacktrace>", name);
   }
 
   public void testException() throws Exception {
-    RunContentDescriptor content = showText("java.lang.NullPointerException\n" +
+    showText("java.lang.NullPointerException\n" +
                                             "\tat com.intellij.psi.css.resolve.impl.XhtmlFileInfo.findOneStyleSheet(XhtmlFileInfo.java:291)\n" +
                                             "\tat com.intellij.psi.css.resolve.impl.XhtmlFileInfo.getStylesheets(XhtmlFileInfo.java:174)\n" +
                                             "\tat com.intellij.psi.css.resolve.impl.XhtmlFileInfo.initStylesheets(XhtmlFileInfo.java:119)");
-    assertIcon("exception.png", content.getIcon());
-    assertEquals("NPE", content.getDisplayName());
+    assertIcon("exception.png", myContent.getIcon());
+    assertEquals("NPE", myContent.getDisplayName());
   }
 
   public void testThreadDump() throws Exception {
     File file = new File(getTestDataPath() + "threaddump.txt");
     String s = FileUtil.loadFile(file);
-    RunContentDescriptor content = showText(s);
-    assertIcon("threaddump.png", content.getIcon());
-    assertEquals("<Threads>", content.getDisplayName());
+    showText(s);
+    assertIcon("threaddump.png", myContent.getIcon());
+    assertEquals("<Threads>", myContent.getDisplayName());
   }
 
   public void testDeadlock() throws Exception {
     File file = new File(getTestDataPath() + "deadlock.txt");
     String s = FileUtil.loadFile(file);
-    RunContentDescriptor content = showText(s);
-    assertIcon("killProcess.png", content.getIcon());
-    assertEquals("<Deadlock>", content.getDisplayName());
+    showText(s);
+    assertIcon("killProcess.png", myContent.getIcon());
+    assertEquals("<Deadlock>", myContent.getDisplayName());
   }
 
-  private RunContentDescriptor showText(String unscramble) {
+  private void showText(String unscramble) {
     RunContentDescriptor descriptor = UnscrambleDialog.showUnscrambledText(null, "foo", getProject(), unscramble);
     assertNotNull(descriptor);
-    Disposer.register(myModule, descriptor);
-    return descriptor;
+    Disposer.register(getTestRootDisposable(), descriptor);
+    myContent = descriptor;
   }
 
   private static void assertIcon(String s, Icon icon) {