Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-06-19 14:16:21 +04:00
331 changed files with 4039 additions and 2250 deletions
+1 -5
View File
@@ -20,11 +20,7 @@
<entry name="!*.class" />
<entry name="!*.groovy" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
<annotationProcessing enabled="false" useClasspath="true" />
</component>
<component name="EclipseCompilerSettings">
<option name="GENERATE_NO_WARNINGS" value="true" />
+131 -232
View File
@@ -2,238 +2,137 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml"
filepath="$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml"
filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" group="plugins/IntelliLang"/>
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml"
filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" group="plugins/IntelliLang"/>
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml"
filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" group="plugins/IntelliLang"/>
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml"
filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" group="plugins/IntelliLang"/>
<module fileurl="file://$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml"
filepath="$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" filepath="$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml"/>
<module fileurl="file://$PROJECT_DIR$/plugins/android/android.iml" filepath="$PROJECT_DIR$/plugins/android/android.iml"
group="plugins/Android"/>
<module fileurl="file://$PROJECT_DIR$/plugins/android/common/android-common.iml"
filepath="$PROJECT_DIR$/plugins/android/common/android-common.iml" group="plugins/Android"/>
<module fileurl="file://$PROJECT_DIR$/plugins/android-designer/android-designer.iml"
filepath="$PROJECT_DIR$/plugins/android-designer/android-designer.iml" group="plugins/Android"/>
<module fileurl="file://$PROJECT_DIR$/plugins/android/jps-plugin/android-jps-plugin.iml"
filepath="$PROJECT_DIR$/plugins/android/jps-plugin/android-jps-plugin.iml" group="plugins/Android"/>
<module fileurl="file://$PROJECT_DIR$/plugins/android/rt/android-rt.iml" filepath="$PROJECT_DIR$/plugins/android/rt/android-rt.iml"
group="plugins/Android"/>
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml"
filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/jps/antLayout/antlayout.iml" filepath="$PROJECT_DIR$/jps/antLayout/antlayout.iml"/>
<module fileurl="file://$PROJECT_DIR$/platform/boot/boot.iml" filepath="$PROJECT_DIR$/platform/boot/boot.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" filepath="$PROJECT_DIR$/platform/bootstrap/bootstrap.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/build/build.iml" filepath="$PROJECT_DIR$/build/build.iml"/>
<module fileurl="file://$PROJECT_DIR$/plugins/commander/commander.iml" filepath="$PROJECT_DIR$/plugins/commander/commander.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/community-main.iml" filepath="$PROJECT_DIR$/community-main.iml"/>
<module fileurl="file://$PROJECT_DIR$/community-resources/community-resources.iml"
filepath="$PROJECT_DIR$/community-resources/community-resources.iml"/>
<module fileurl="file://$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml"
filepath="$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" group="java/compiler"/>
<module fileurl="file://$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml"
filepath="$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" group="java/compiler"/>
<module fileurl="file://$PROJECT_DIR$/plugins/copyright/copyright.iml" filepath="$PROJECT_DIR$/plugins/copyright/copyright.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/platform/core-api/core-api.iml" filepath="$PROJECT_DIR$/platform/core-api/core-api.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/core-impl/core-impl.iml" filepath="$PROJECT_DIR$/platform/core-impl/core-impl.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml"
group="plugins/VCS/cvs"/>
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml"
filepath="$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" group="plugins/VCS/cvs"/>
<module fileurl="file://$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml"
filepath="$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml"
filepath="$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" filepath="$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" group="xml"/>
<module fileurl="file://$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml" filepath="$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml"
group="xml"/>
<module fileurl="file://$PROJECT_DIR$/plugins/eclipse/eclipse.iml" filepath="$PROJECT_DIR$/plugins/eclipse/eclipse.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/java/execution/impl/execution-impl.iml"
filepath="$PROJECT_DIR$/java/execution/impl/execution-impl.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml"
filepath="$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/platform/extensions/extensions.iml" filepath="$PROJECT_DIR$/platform/extensions/extensions.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml"
filepath="$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" group="java/compiler"/>
<module fileurl="file://$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" filepath="$PROJECT_DIR$/platform/forms_rt/forms_rt.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml"
filepath="$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/git4idea.iml" filepath="$PROJECT_DIR$/plugins/git4idea/git4idea.iml"
group="plugins/VCS"/>
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/rt/git4idea-rt.iml"
filepath="$PROJECT_DIR$/plugins/git4idea/rt/git4idea-rt.iml" group="plugins/VCS"/>
<module fileurl="file://$PROJECT_DIR$/plugins/github/github.iml" filepath="$PROJECT_DIR$/plugins/github/github.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/gradle/gradle.iml" filepath="$PROJECT_DIR$/plugins/gradle/gradle.iml"/>
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml"
group="plugins/Groovy"/>
<module fileurl="file://$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" filepath="$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml"
group="plugins/VCS"/>
<module fileurl="file://$PROJECT_DIR$/platform/icons/icons.iml" filepath="$PROJECT_DIR$/platform/icons/icons.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/java/idea-ui/idea-ui.iml" filepath="$PROJECT_DIR$/java/idea-ui/idea-ui.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/images/images.iml" filepath="$PROJECT_DIR$/images/images.iml"/>
<module fileurl="file://$PROJECT_DIR$/platform/indexing-api/indexing-api.iml"
filepath="$PROJECT_DIR$/platform/indexing-api/indexing-api.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/indexing-impl/indexing-impl.iml"
filepath="$PROJECT_DIR$/platform/indexing-impl/indexing-impl.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/java/compiler/instrumentation-util/instrumentation-util.iml"
filepath="$PROJECT_DIR$/java/compiler/instrumentation-util/instrumentation-util.iml" group="java/compiler"/>
<module fileurl="file://$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" filepath="$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/java/java-impl/java-impl.iml" filepath="$PROJECT_DIR$/java/java-impl/java-impl.iml"
group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/java-indexing-impl/java-indexing-impl.iml"
filepath="$PROJECT_DIR$/java/java-indexing-impl/java-indexing-impl.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/java-psi-api/java-psi-api.iml" filepath="$PROJECT_DIR$/java/java-psi-api/java-psi-api.iml"
group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/java-psi-impl/java-psi-impl.iml"
filepath="$PROJECT_DIR$/java/java-psi-impl/java-psi-impl.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/java-runtime/java-runtime.iml" filepath="$PROJECT_DIR$/java/java-runtime/java-runtime.iml"
group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/java-tests/java-tests.iml" filepath="$PROJECT_DIR$/java/java-tests/java-tests.iml"
group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml"
group="java/compiler"/>
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml"
filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs"/>
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml"
group="plugins/Groovy"/>
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml"
filepath="$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" group="plugins/tasks"/>
<module fileurl="file://$PROJECT_DIR$/jps/jps.iml" filepath="$PROJECT_DIR$/jps/jps.iml" group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml"
filepath="$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml" group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml"
group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/model/jps-model.iml" filepath="$PROJECT_DIR$/jps/model/jps-model.iml" group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/model-api/jps-model-api.iml" filepath="$PROJECT_DIR$/jps/model-api/jps-model-api.iml"
group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/model-impl/jps-model-impl.iml" filepath="$PROJECT_DIR$/jps/model-impl/jps-model-impl.iml"
group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/model-serialization/jps-model-serialization.iml"
filepath="$PROJECT_DIR$/jps/model-serialization/jps-model-serialization.iml" group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml" filepath="$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml"
group="jps"/>
<module fileurl="file://$PROJECT_DIR$/jps/jps-tests.iml" filepath="$PROJECT_DIR$/jps/jps-tests.iml" group="jps"/>
<module fileurl="file://$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml"
filepath="$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml"
group="java"/>
<module fileurl="file://$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" filepath="$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/plugins/junit/junit.iml" filepath="$PROJECT_DIR$/plugins/junit/junit.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" filepath="$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/platform/lang-api/lang-api.iml" filepath="$PROJECT_DIR$/platform/lang-api/lang-api.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/lang-impl/lang-impl.iml" filepath="$PROJECT_DIR$/platform/lang-impl/lang-impl.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml" filepath="$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml" filepath="$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven.iml" filepath="$PROJECT_DIR$/plugins/maven/maven.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven-server-api/maven-server-api.iml"
filepath="$PROJECT_DIR$/plugins/maven/maven-server-api/maven-server-api.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven2-server-impl/maven2-server-impl.iml"
filepath="$PROJECT_DIR$/plugins/maven/maven2-server-impl/maven2-server-impl.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven3-server-impl/maven3-server-impl.iml"
filepath="$PROJECT_DIR$/plugins/maven/maven3-server-impl/maven3-server-impl.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/java/openapi/openapi.iml" filepath="$PROJECT_DIR$/java/openapi/openapi.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-api/platform-api.iml"
filepath="$PROJECT_DIR$/platform/platform-api/platform-api.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-impl/platform-impl.iml"
filepath="$PROJECT_DIR$/platform/platform-impl/platform-impl.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-main/platform-main.iml"
filepath="$PROJECT_DIR$/platform/platform-main/platform-main.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources/platform-resources.iml"
filepath="$PROJECT_DIR$/platform/platform-resources/platform-resources.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml"
filepath="$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/platform-tests/platform-tests.iml"
filepath="$PROJECT_DIR$/platform/platform-tests/platform-tests.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/projectModel-api/projectModel-api.iml"
filepath="$PROJECT_DIR$/platform/projectModel-api/projectModel-api.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/projectModel-impl/projectModel-impl.iml"
filepath="$PROJECT_DIR$/platform/projectModel-impl/projectModel-impl.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/properties/properties.iml" filepath="$PROJECT_DIR$/plugins/properties/properties.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/rearranger/rearranger.iml" filepath="$PROJECT_DIR$/plugins/rearranger/rearranger.iml"/>
<module fileurl="file://$PROJECT_DIR$/xml/relaxng/relaxng.iml" filepath="$PROJECT_DIR$/xml/relaxng/relaxng.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/resources/resources.iml" filepath="$PROJECT_DIR$/resources/resources.iml"/>
<module fileurl="file://$PROJECT_DIR$/resources-en/resources-en.iml" filepath="$PROJECT_DIR$/resources-en/resources-en.iml"/>
<module fileurl="file://$PROJECT_DIR$/platform/smRunner/smRunner.iml" filepath="$PROJECT_DIR$/platform/smRunner/smRunner.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml"
filepath="$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" group="plugins/VCS/cvs"/>
<module fileurl="file://$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml"
filepath="$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml"
group="plugins/VCS"/>
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml"
filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" group="plugins/VCS"/>
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml"
filepath="$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml" group="plugins/tasks"/>
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml"
filepath="$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml" group="plugins/tasks"/>
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml"
filepath="$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" group="plugins/tasks"/>
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml"
filepath="$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml" group="plugins/tasks"/>
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/testFramework.iml"
filepath="$PROJECT_DIR$/platform/testFramework/testFramework.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/java/testFramework/testFramework-java.iml"
filepath="$PROJECT_DIR$/java/testFramework/testFramework-java.iml" group="java"/>
<module fileurl="file://$PROJECT_DIR$/platform/testRunner/testRunner.iml" filepath="$PROJECT_DIR$/platform/testRunner/testRunner.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/testng/testng.iml" filepath="$PROJECT_DIR$/plugins/testng/testng.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" filepath="$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml"
filepath="$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml"
filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer-new/ui-designer-new.iml"
filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer-new/ui-designer-new.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/platform/usageView/usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/usageView.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/util/util.iml" filepath="$PROJECT_DIR$/platform/util/util.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/util-rt/util-rt.iml" filepath="$PROJECT_DIR$/platform/util-rt/util-rt.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/vcs-api/vcs-api.iml" filepath="$PROJECT_DIR$/platform/vcs-api/vcs-api.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/vcs-impl/vcs-impl.iml" filepath="$PROJECT_DIR$/platform/vcs-impl/vcs-impl.iml"
group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-api/xdebugger-api.iml"
filepath="$PROJECT_DIR$/platform/xdebugger-api/xdebugger-api.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml"
filepath="$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml" group="platform"/>
<module fileurl="file://$PROJECT_DIR$/xml/impl/xml.iml" filepath="$PROJECT_DIR$/xml/impl/xml.iml" group="xml"/>
<module fileurl="file://$PROJECT_DIR$/xml/openapi/xml-openapi.iml" filepath="$PROJECT_DIR$/xml/openapi/xml-openapi.iml" group="xml"/>
<module fileurl="file://$PROJECT_DIR$/xml/tests/xml-tests.iml" filepath="$PROJECT_DIR$/xml/tests/xml-tests.iml" group="xml"/>
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xpath.iml" filepath="$PROJECT_DIR$/plugins/xpath/xpath.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/xslt-debugger.iml"
filepath="$PROJECT_DIR$/plugins/xslt-debugger/xslt-debugger.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/engine/xslt-debugger-engine.iml"
filepath="$PROJECT_DIR$/plugins/xslt-debugger/engine/xslt-debugger-engine.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/engine/impl/xslt-debugger-engine-impl.iml"
filepath="$PROJECT_DIR$/plugins/xslt-debugger/engine/impl/xslt-debugger-engine-impl.iml" group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" filepath="$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml"
group="plugins"/>
<module fileurl="file://$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" filepath="$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" filepath="$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" filepath="$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/android/android.iml" filepath="$PROJECT_DIR$/plugins/android/android.iml" group="plugins/Android" />
<module fileurl="file://$PROJECT_DIR$/plugins/android/common/android-common.iml" filepath="$PROJECT_DIR$/plugins/android/common/android-common.iml" group="plugins/Android" />
<module fileurl="file://$PROJECT_DIR$/plugins/android-designer/android-designer.iml" filepath="$PROJECT_DIR$/plugins/android-designer/android-designer.iml" group="plugins/Android" />
<module fileurl="file://$PROJECT_DIR$/plugins/android/jps-plugin/android-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/android/jps-plugin/android-jps-plugin.iml" group="plugins/Android" />
<module fileurl="file://$PROJECT_DIR$/plugins/android/rt/android-rt.iml" filepath="$PROJECT_DIR$/plugins/android/rt/android-rt.iml" group="plugins/Android" />
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/jps/antLayout/antlayout.iml" filepath="$PROJECT_DIR$/jps/antLayout/antlayout.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/boot/boot.iml" filepath="$PROJECT_DIR$/platform/boot/boot.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" filepath="$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/build/build.iml" filepath="$PROJECT_DIR$/build/build.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/commander/commander.iml" filepath="$PROJECT_DIR$/plugins/commander/commander.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/community-main.iml" filepath="$PROJECT_DIR$/community-main.iml" />
<module fileurl="file://$PROJECT_DIR$/community-resources/community-resources.iml" filepath="$PROJECT_DIR$/community-resources/community-resources.iml" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" filepath="$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" filepath="$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/copyright/copyright.iml" filepath="$PROJECT_DIR$/plugins/copyright/copyright.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/core-api/core-api.iml" filepath="$PROJECT_DIR$/platform/core-api/core-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/core-impl/core-impl.iml" filepath="$PROJECT_DIR$/platform/core-impl/core-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" filepath="$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" filepath="$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" filepath="$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" group="xml" />
<module fileurl="file://$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml" filepath="$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml" group="xml" />
<module fileurl="file://$PROJECT_DIR$/plugins/eclipse/eclipse.iml" filepath="$PROJECT_DIR$/plugins/eclipse/eclipse.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/java/execution/impl/execution-impl.iml" filepath="$PROJECT_DIR$/java/execution/impl/execution-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" filepath="$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/platform/extensions/extensions.iml" filepath="$PROJECT_DIR$/platform/extensions/extensions.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" filepath="$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" filepath="$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" filepath="$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/git4idea.iml" filepath="$PROJECT_DIR$/plugins/git4idea/git4idea.iml" group="plugins/VCS" />
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/rt/git4idea-rt.iml" filepath="$PROJECT_DIR$/plugins/git4idea/rt/git4idea-rt.iml" group="plugins/VCS" />
<module fileurl="file://$PROJECT_DIR$/plugins/github/github.iml" filepath="$PROJECT_DIR$/plugins/github/github.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/gradle/gradle.iml" filepath="$PROJECT_DIR$/plugins/gradle/gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml" group="plugins/Groovy" />
<module fileurl="file://$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" filepath="$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" group="plugins/VCS" />
<module fileurl="file://$PROJECT_DIR$/platform/icons/icons.iml" filepath="$PROJECT_DIR$/platform/icons/icons.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/java/idea-ui/idea-ui.iml" filepath="$PROJECT_DIR$/java/idea-ui/idea-ui.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/images/images.iml" filepath="$PROJECT_DIR$/images/images.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/indexing-api/indexing-api.iml" filepath="$PROJECT_DIR$/platform/indexing-api/indexing-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/indexing-impl/indexing-impl.iml" filepath="$PROJECT_DIR$/platform/indexing-impl/indexing-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/instrumentation-util/instrumentation-util.iml" filepath="$PROJECT_DIR$/java/compiler/instrumentation-util/instrumentation-util.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" filepath="$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/java/java-impl/java-impl.iml" filepath="$PROJECT_DIR$/java/java-impl/java-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/java-indexing-impl/java-indexing-impl.iml" filepath="$PROJECT_DIR$/java/java-indexing-impl/java-indexing-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/java-psi-api/java-psi-api.iml" filepath="$PROJECT_DIR$/java/java-psi-api/java-psi-api.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/java-psi-impl/java-psi-impl.iml" filepath="$PROJECT_DIR$/java/java-psi-impl/java-psi-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/java-runtime/java-runtime.iml" filepath="$PROJECT_DIR$/java/java-runtime/java-runtime.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/java-tests/java-tests.iml" filepath="$PROJECT_DIR$/java/java-tests/java-tests.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" filepath="$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/jps/jps.iml" filepath="$PROJECT_DIR$/jps/jps.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml" filepath="$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/model/jps-model.iml" filepath="$PROJECT_DIR$/jps/model/jps-model.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/model-api/jps-model-api.iml" filepath="$PROJECT_DIR$/jps/model-api/jps-model-api.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/model-impl/jps-model-impl.iml" filepath="$PROJECT_DIR$/jps/model-impl/jps-model-impl.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/model-serialization/jps-model-serialization.iml" filepath="$PROJECT_DIR$/jps/model-serialization/jps-model-serialization.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml" filepath="$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-tests.iml" filepath="$PROJECT_DIR$/jps/jps-tests.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" filepath="$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/plugins/junit/junit.iml" filepath="$PROJECT_DIR$/plugins/junit/junit.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" filepath="$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/lang-api/lang-api.iml" filepath="$PROJECT_DIR$/platform/lang-api/lang-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/lang-impl/lang-impl.iml" filepath="$PROJECT_DIR$/platform/lang-impl/lang-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml" filepath="$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml" filepath="$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven.iml" filepath="$PROJECT_DIR$/plugins/maven/maven.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven-server-api/maven-server-api.iml" filepath="$PROJECT_DIR$/plugins/maven/maven-server-api/maven-server-api.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven2-server-impl/maven2-server-impl.iml" filepath="$PROJECT_DIR$/plugins/maven/maven2-server-impl/maven2-server-impl.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven3-server-impl/maven3-server-impl.iml" filepath="$PROJECT_DIR$/plugins/maven/maven3-server-impl/maven3-server-impl.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/java/openapi/openapi.iml" filepath="$PROJECT_DIR$/java/openapi/openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-api/platform-api.iml" filepath="$PROJECT_DIR$/platform/platform-api/platform-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-impl/platform-impl.iml" filepath="$PROJECT_DIR$/platform/platform-impl/platform-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-main/platform-main.iml" filepath="$PROJECT_DIR$/platform/platform-main/platform-main.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources/platform-resources.iml" filepath="$PROJECT_DIR$/platform/platform-resources/platform-resources.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml" filepath="$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-tests/platform-tests.iml" filepath="$PROJECT_DIR$/platform/platform-tests/platform-tests.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/projectModel-api/projectModel-api.iml" filepath="$PROJECT_DIR$/platform/projectModel-api/projectModel-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/projectModel-impl/projectModel-impl.iml" filepath="$PROJECT_DIR$/platform/projectModel-impl/projectModel-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/properties/properties.iml" filepath="$PROJECT_DIR$/plugins/properties/properties.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/rearranger/rearranger.iml" filepath="$PROJECT_DIR$/plugins/rearranger/rearranger.iml" />
<module fileurl="file://$PROJECT_DIR$/xml/relaxng/relaxng.iml" filepath="$PROJECT_DIR$/xml/relaxng/relaxng.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/resources/resources.iml" filepath="$PROJECT_DIR$/resources/resources.iml" />
<module fileurl="file://$PROJECT_DIR$/resources-en/resources-en.iml" filepath="$PROJECT_DIR$/resources-en/resources-en.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/smRunner/smRunner.iml" filepath="$PROJECT_DIR$/platform/smRunner/smRunner.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" filepath="$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" group="plugins/VCS" />
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" group="plugins/VCS" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/testFramework.iml" filepath="$PROJECT_DIR$/platform/testFramework/testFramework.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/java/testFramework/testFramework-java.iml" filepath="$PROJECT_DIR$/java/testFramework/testFramework-java.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/platform/testRunner/testRunner.iml" filepath="$PROJECT_DIR$/platform/testRunner/testRunner.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/testng/testng.iml" filepath="$PROJECT_DIR$/plugins/testng/testng.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" filepath="$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" filepath="$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer-new/ui-designer-new.iml" filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer-new/ui-designer-new.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/usageView/usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/usageView.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/util/util.iml" filepath="$PROJECT_DIR$/platform/util/util.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/util-rt/util-rt.iml" filepath="$PROJECT_DIR$/platform/util-rt/util-rt.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/vcs-api/vcs-api.iml" filepath="$PROJECT_DIR$/platform/vcs-api/vcs-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/vcs-impl/vcs-impl.iml" filepath="$PROJECT_DIR$/platform/vcs-impl/vcs-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-api/xdebugger-api.iml" filepath="$PROJECT_DIR$/platform/xdebugger-api/xdebugger-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml" filepath="$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/xml/impl/xml.iml" filepath="$PROJECT_DIR$/xml/impl/xml.iml" group="xml" />
<module fileurl="file://$PROJECT_DIR$/xml/openapi/xml-openapi.iml" filepath="$PROJECT_DIR$/xml/openapi/xml-openapi.iml" group="xml" />
<module fileurl="file://$PROJECT_DIR$/xml/tests/xml-tests.iml" filepath="$PROJECT_DIR$/xml/tests/xml-tests.iml" group="xml" />
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xpath.iml" filepath="$PROJECT_DIR$/plugins/xpath/xpath.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/xslt-debugger.iml" filepath="$PROJECT_DIR$/plugins/xslt-debugger/xslt-debugger.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/engine/xslt-debugger-engine.iml" filepath="$PROJECT_DIR$/plugins/xslt-debugger/engine/xslt-debugger-engine.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/xslt-debugger/engine/impl/xslt-debugger-engine-impl.iml" filepath="$PROJECT_DIR$/plugins/xslt-debugger/engine/impl/xslt-debugger-engine-impl.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" filepath="$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" group="plugins" />
</modules>
</component>
</project>
@@ -23,7 +23,7 @@ import com.intellij.lang.ParserDefinition;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.IncorrectOperationException;
import org.intellij.lang.regexp.RegExpLanguage;
@@ -76,7 +76,7 @@ public abstract class RegExpElementImpl extends ASTWrapperPsiElement implements
}
public final String getUnescapedText() {
if (InjectedLanguageUtil.isInInjectedLanguagePrefixSuffix(this)) {
if (InjectedLanguageFacadeImpl.isInInjectedLanguagePrefixSuffix(this)) {
// do not attempt to decode text if PsiElement is part of prefix/suffix
return getText();
}
@@ -26,7 +26,6 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
import junit.framework.TestCase;
import org.intellij.lang.regexp.RegExpFileType;
import java.io.File;
+2
View File
@@ -532,6 +532,8 @@ def layout_core_upsource(String home, String target) {
module("projectModel-api")
module("projectModel-impl")
module("java-indexing-impl")
module("platform-resources")
module("platform-resources-en")
}
jar("annotations.jar") {
@@ -648,7 +648,10 @@ public class CompileDriver {
new CompilerTask(myProject, compileInBackground, contentName, ApplicationManager.getApplication().isUnitTestMode());
StatusBar.Info.set("", myProject, "Compiler");
if (useOutOfProcessBuild() && BuildManager.getInstance().rescanRequired(myProject)) {
// ensure the project model seen by build process is up-to-date
myProject.save();
}
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
@@ -686,7 +689,7 @@ public class CompileDriver {
compileContext.addMessage(message);
}
final Collection<String> paths = fetchFiles(compileContext);
final List<Module> modules = paths.isEmpty()? Arrays.asList(compileContext.getCompileScope().getAffectedModules()) : Collections.<Module>emptyList();
final List<Module> modules = paths.isEmpty() && !isRebuild && !allProjectModulesAffected(compileContext)? Arrays.asList(compileContext.getCompileScope().getAffectedModules()) : Collections.<Module>emptyList();
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(myProject, compileContext.getCompileScope(), true);
final RequestFuture future = compileInExternalProcess(compileContext, modules, artifacts, paths, callback);
if (future != null) {
@@ -780,6 +783,12 @@ public class CompileDriver {
});
}
private static boolean allProjectModulesAffected(CompileContextImpl compileContext) {
final Set<Module> allModules = new HashSet<Module>(Arrays.asList(compileContext.getProjectCompileScope().getAffectedModules()));
allModules.removeAll(Arrays.asList(compileContext.getCompileScope().getAffectedModules()));
return allModules.isEmpty();
}
private static List<String> fetchFiles(CompileContextImpl context) {
if (context.isRebuild()) {
return Collections.emptyList();
@@ -21,6 +21,7 @@ import com.intellij.openapi.compiler.CompilerManager;
import com.intellij.openapi.compiler.CompilerTopics;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -36,6 +37,7 @@ import java.util.UUID;
* Date: 4/25/12
*/
class AutoMakeMessageHandler extends DefaultMessageHandler {
private static final Key<Notification> LAST_AUTO_MAKE_NOFITICATION = Key.create("LAST_AUTO_MAKE_NOFITICATION");
private CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status myBuildStatus;
private final Project myProject;
private final WolfTheProblemSolver myWolf;
@@ -111,6 +113,13 @@ class AutoMakeMessageHandler extends DefaultMessageHandler {
if (!myProject.isDisposed()) {
notification.notify(myProject);
}
myProject.putUserData(LAST_AUTO_MAKE_NOFITICATION, notification);
} else {
Notification notification = myProject.getUserData(LAST_AUTO_MAKE_NOFITICATION);
if (notification != null) {
notification.expire();
myProject.putUserData(LAST_AUTO_MAKE_NOFITICATION, null);
}
}
}
@@ -78,7 +78,8 @@ import org.jetbrains.jps.cmdline.BuildMain;
import org.jetbrains.jps.server.ClasspathBootstrap;
import org.jetbrains.jps.server.Server;
import javax.tools.*;
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -222,6 +223,14 @@ public class BuildManager implements ApplicationComponent{
}
}
public boolean rescanRequired(Project project) {
final String projectPath = getProjectPath(project);
synchronized (myProjectDataMap) {
final ProjectData data = myProjectDataMap.get(projectPath);
return data == null || data.myNeedRescan;
}
}
@Nullable
private static String getProjectPath(final Project project) {
final String path = project.getPresentableUrl();
@@ -25,12 +25,12 @@
<border type="none"/>
<children/>
</xy>
<component id="46592" class="javax.swing.JLabel">
<component id="f3923" class="com.intellij.ui.components.JBCheckBox" binding="myConditionCheckbox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Condition"/>
<text value="&amp;Condition"/>
</properties>
</component>
</children>
@@ -32,6 +32,8 @@ import com.intellij.debugger.ui.DebuggerExpressionComboBox;
import com.intellij.debugger.ui.DebuggerStatementEditor;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.ide.util.ClassFilter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.FixedSizeButton;
@@ -115,6 +117,7 @@ public abstract class BreakpointPropertiesPanel {
private JPanel myPassCountPanel;
private JPanel myConditionsPanel;
private JPanel myActionsPanel;
private JBCheckBox myConditionCheckbox;
ButtonGroup mySuspendPolicyGroup;
@NonNls public static final String CONTROL_LOG_MESSAGE = "logMessage";
@@ -275,6 +278,26 @@ public abstract class BreakpointPropertiesPanel {
});
myConditionCombo = new DebuggerExpressionComboBox(project, "LineBreakpoint condition");
myConditionCombo.addDocumentListener(new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent event) {
myConditionCheckbox.setSelected(true);
}
@Override
public void documentChanged(DocumentEvent event) {
}
});
myConditionCombo.getEditorComponent().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent event) {
myConditionCombo.setEnabled(true);
myConditionCheckbox.setSelected(true);
}
});
if (myCompact) {
myPanel.addFocusListener(new FocusAdapter() {
@Override
@@ -544,12 +567,13 @@ public abstract class BreakpointPropertiesPanel {
PsiElement context = breakpoint.getEvaluationElement();
myPassCountCheckbox.setSelected(breakpoint.COUNT_FILTER_ENABLED);
if (!breakpoint.CONDITION_ENABLED) {
myConditionCombo.setText(emptyText());
}
else {
myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : emptyText());
}
myConditionCheckbox.setSelected(breakpoint.CONDITION_ENABLED);
myConditionCombo.setEnabled(myBreakpoint.CONDITION_ENABLED);
myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : emptyText());
myConditionCombo.setContext(context);
mySuspendJBCheckBox.setSelected(!breakpoint.SUSPEND_POLICY.equals(DebuggerSettings.SUSPEND_NONE));
@@ -695,7 +719,7 @@ public abstract class BreakpointPropertiesPanel {
}
breakpoint.COUNT_FILTER_ENABLED = breakpoint.COUNT_FILTER > 0 && myPassCountCheckbox.isSelected();
breakpoint.setCondition(myConditionCombo.getText());
breakpoint.CONDITION_ENABLED = !breakpoint.getCondition().isEmpty();
breakpoint.CONDITION_ENABLED = myConditionCheckbox.isSelected();
breakpoint.setLogMessage(myLogExpressionCombo.getText());
breakpoint.LOG_EXPRESSION_ENABLED = !breakpoint.getLogMessage().isEmpty() && myLogExpressionCheckBox.isSelected();
breakpoint.LOG_ENABLED = myLogMessageCheckBox.isSelected();
@@ -861,10 +885,13 @@ public abstract class BreakpointPropertiesPanel {
myPassCountField.setEditable(myPassCountCheckbox.isSelected());
myPassCountField.setEnabled (myPassCountCheckbox.isSelected());
myConditionCombo.setEnabled(true);
myConditionMagnifierButton.setEnabled(true);
myInstanceFiltersField.setEnabled(myInstanceFiltersCheckBox.isSelected());
myInstanceFiltersField.getTextField().setEditable(myInstanceFiltersCheckBox.isSelected());
myClassFiltersField.setEnabled(myClassFiltersCheckBox.isSelected());
myClassFiltersField.getTextField().setEditable(myClassFiltersCheckBox.isSelected());
}
@@ -71,7 +71,7 @@ public class ModifierChooser {
return addKeywords(list, inInterface ? new String[][]{
new String[]{"public", "protected"},
new String[]{"static"},
new String[]{"final"}
new String[]{"final", "abstract"}
} : new String[][]{
new String[]{"public", "protected", "private"},
new String[]{"static"},
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiJavaCodeReferenceElement;
import com.intellij.psi.PsiReference;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -56,4 +57,19 @@ public class JavaReferenceImporter implements ReferenceImporter {
}
return false;
}
@Override
public boolean autoImportReferenceAt(@NotNull Editor editor, @NotNull PsiFile file, int offset) {
if (!file.getViewProvider().getLanguages().contains(StdLanguages.JAVA)) return false;
PsiReference element = file.findReferenceAt(offset);
if (element instanceof PsiJavaCodeReferenceElement) {
PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element;
if (ref.multiResolve(true).length == 0) {
new ImportClassFix(ref).doFix(editor, false, true);
return true;
}
}
return false;
}
}
@@ -34,7 +34,7 @@ import com.intellij.psi.*;
import com.intellij.psi.controlFlow.ControlFlowUtil;
import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef;
import com.intellij.psi.impl.source.jsp.jspJava.JspClass;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTagValue;
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
@@ -106,7 +106,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
}
private void registerReferencesFromInjectedFragments(final PsiElement element) {
InjectedLanguageUtil.enumerate(element, myFile, false, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
InjectedLanguageFacadeImpl.enumerate(element, myFile, false, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
@Override
public void visit(@NotNull final PsiFile injectedPsi, @NotNull final List<PsiLanguageInjectionHost.Shred> places) {
injectedPsi.accept(REGISTER_REFERENCES_VISITOR);
@@ -25,6 +25,7 @@ import com.intellij.codeInsight.generation.PsiMethodMember;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.impl.AssignFieldFromParameterAction;
import com.intellij.codeInsight.intention.impl.CreateFieldFromParameterAction;
import com.intellij.codeInsight.intention.impl.FieldFromParameterUtils;
import com.intellij.ide.util.MemberChooser;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
@@ -385,12 +386,12 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction {
}
if (o1 instanceof PsiField && o2 instanceof PsiParameter) {
final PsiField field = CreateFieldFromParameterAction.getParameterAssignedToField((PsiParameter)o2);
final PsiField field = FieldFromParameterUtils.getParameterAssignedToField((PsiParameter)o2);
if (field == null) return 1;
return o1.getTextOffset() - field.getTextOffset();
}
if (o1 instanceof PsiParameter && o2 instanceof PsiField) {
final PsiField field = CreateFieldFromParameterAction.getParameterAssignedToField((PsiParameter)o1);
final PsiField field = FieldFromParameterUtils.getParameterAssignedToField((PsiParameter)o1);
if (field == null) return -1;
return field.getTextOffset() - o2.getTextOffset();
}
@@ -36,12 +36,12 @@ public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceEleme
}
@Override
protected String getReferenceName(PsiJavaCodeReferenceElement reference) {
protected String getReferenceName(@NotNull PsiJavaCodeReferenceElement reference) {
return reference.getReferenceName();
}
@Override
protected PsiElement getReferenceNameElement(PsiJavaCodeReferenceElement reference) {
protected PsiElement getReferenceNameElement(@NotNull PsiJavaCodeReferenceElement reference) {
return reference.getReferenceNameElement();
}
@@ -56,7 +56,7 @@ public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceEleme
}
@Override
protected boolean hasTypeParameters(PsiJavaCodeReferenceElement reference) {
protected boolean hasTypeParameters(@NotNull PsiJavaCodeReferenceElement reference) {
final PsiReferenceParameterList refParameters = reference.getParameterList();
return refParameters != null && refParameters.getTypeParameterElements().length > 0;
}
@@ -97,8 +97,9 @@ public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceEleme
@Override
protected String getRequiredMemberName(PsiJavaCodeReferenceElement reference) {
if (reference.getParent() instanceof PsiJavaCodeReferenceElement) {
return ((PsiJavaCodeReferenceElement)reference.getParent()).getReferenceName();
PsiElement parent = reference.getParent();
if (parent instanceof PsiJavaCodeReferenceElement) {
return ((PsiJavaCodeReferenceElement)parent).getReferenceName();
}
return super.getRequiredMemberName(reference);
@@ -72,10 +72,9 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
}
@Nullable
protected abstract String getReferenceName(T reference);
protected abstract PsiElement getReferenceNameElement(T reference);
protected abstract boolean hasTypeParameters(T reference);
protected abstract String getReferenceName(@NotNull T reference);
protected abstract PsiElement getReferenceNameElement(@NotNull T reference);
protected abstract boolean hasTypeParameters(@NotNull T reference);
@NotNull
public List<PsiClass> getClassesToImport() {
@@ -145,7 +144,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
POPUP_NOT_SHOWN
}
public Result doFix(@NotNull final Editor editor, boolean doShow, final boolean allowCaretNearRef) {
public Result doFix(@NotNull final Editor editor, boolean allowPopup, final boolean allowCaretNearRef) {
List<PsiClass> classesToImport = getClassesToImport();
if (classesToImport.isEmpty()) return Result.POPUP_NOT_SHOWN;
@@ -194,7 +193,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
return Result.CLASS_AUTO_IMPORTED;
}
if (doShow && canImportHere) {
if (allowPopup && canImportHere) {
String hintText = ShowAutoImportPass.getMessage(classes.length > 1, classes[0].getQualifiedName());
if (!ApplicationManager.getApplication().isUnitTestMode() && !HintManager.getInstance().hasShownHintsThatWillHideByOtherHint(true)) {
HintManager.getInstance().showQuestionHint(editor, hintText, myRef.getTextOffset(),
@@ -261,7 +260,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
}
}
private boolean isCaretNearRef(Editor editor, T ref) {
private boolean isCaretNearRef(@NotNull Editor editor, @NotNull T ref) {
PsiElement nameElement = getReferenceNameElement(ref);
if (nameElement == null) return false;
TextRange range = nameElement.getTextRange();
@@ -32,7 +32,6 @@ import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiTypesUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -242,7 +242,7 @@ public class GenerateMembersUtil {
try {
final PsiMethod resultMethod = createMethod(factory, sourceMethod);
copyDocComment(resultMethod, sourceMethod);
copyDocComment(sourceMethod, resultMethod);
copyModifiers(sourceMethod.getModifierList(), resultMethod.getModifierList());
final PsiSubstitutor collisionResolvedSubstitutor =
substituteTypeParameters(factory, codeStyleManager, target, sourceMethod.getTypeParameterList(), resultMethod.getTypeParameterList(), substitutor);
@@ -36,34 +36,17 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AssignFieldFromParameterAction extends BaseIntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.AssignFieldFromParameterAction");
@Nullable
private static PsiType getType(final PsiParameter myParameter) {
if (myParameter == null) return null;
PsiType type = myParameter.getType();
if (type instanceof PsiEllipsisType) type = ((PsiEllipsisType)type).toArrayType();
return type;
}
private static final Logger LOG = Logger.getInstance(AssignFieldFromParameterAction.class);
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
PsiParameter myParameter = CreateFieldFromParameterAction.findParameterAtCursor(file, editor);
final PsiType type = getType(myParameter);
PsiClass targetClass = myParameter == null ? null : PsiTreeUtil.getParentOfType(myParameter, PsiClass.class);
if (myParameter == null
|| !myParameter.isValid()
|| !myParameter.getManager().isInProject(myParameter)
|| !(myParameter.getDeclarationScope() instanceof PsiMethod)
|| ((PsiMethod)myParameter.getDeclarationScope()).getBody() == null
|| type == null
|| !type.isValid()
|| targetClass == null
|| targetClass.isInterface()
|| CreateFieldFromParameterAction.getParameterAssignedToField(myParameter) != null) {
final PsiParameter myParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
final PsiType type = FieldFromParameterUtils.getType(myParameter);
final PsiClass targetClass = PsiTreeUtil.getParentOfType(myParameter, PsiClass.class);
if (!FieldFromParameterUtils.isAvailable(myParameter, type, targetClass)) {
return false;
}
PsiField field = findFieldToAssign(myParameter);
final PsiField field = findFieldToAssign(project, myParameter);
if (field == null) return false;
if (!field.getLanguage().isKindOf(JavaLanguage.INSTANCE)) return false;
setText(CodeInsightBundle.message("intention.assign.field.from.parameter.text", field.getName()));
@@ -79,12 +62,12 @@ public class AssignFieldFromParameterAction extends BaseIntentionAction {
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
PsiParameter myParameter = CreateFieldFromParameterAction.findParameterAtCursor(file, editor);
final PsiParameter myParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
if (!CodeInsightUtilBase.prepareFileForWrite(myParameter.getContainingFile())) return;
IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
try {
PsiField field = findFieldToAssign(myParameter);
PsiField field = findFieldToAssign(project, myParameter);
if (field != null) addFieldAssignmentStatement(project, field, myParameter, editor);
}
catch (IncorrectOperationException e) {
@@ -92,53 +75,18 @@ public class AssignFieldFromParameterAction extends BaseIntentionAction {
}
}
public static void addFieldAssignmentStatement(@NotNull Project project,
@NotNull PsiField field,
@NotNull PsiParameter parameter,
@NotNull Editor editor) throws IncorrectOperationException {
final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
PsiCodeBlock methodBody = method.getBody();
if (methodBody == null) return;
PsiManager psiManager = PsiManager.getInstance(project);
PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
String fieldName = field.getName();
String parameterName = parameter.getName();
final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
PsiClass targetClass = method.getContainingClass();
String stmtText = fieldName + " = " + parameterName + ";";
if (Comparing.strEqual(fieldName, parameterName) || JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(fieldName, methodBody) != field) {
@NonNls String prefix = isMethodStatic ? targetClass.getName() == null ? "" : targetClass.getName() + "." : "this.";
stmtText = prefix + stmtText;
}
PsiStatement assignmentStmt = factory.createStatementFromText(stmtText, methodBody);
assignmentStmt = (PsiStatement)CodeStyleManager.getInstance(project).reformat(assignmentStmt);
PsiStatement[] statements = methodBody.getStatements();
int i = CreateFieldFromParameterAction.findFieldAssignmentAnchor(statements, null, targetClass, parameter);
PsiElement inserted;
if (i == statements.length) {
inserted = methodBody.add(assignmentStmt);
}
else {
inserted = methodBody.addAfter(assignmentStmt, i > 0 ? statements[i - 1] : null);
}
editor.getCaretModel().moveToOffset(inserted.getTextRange().getEndOffset());
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
@Nullable
private static PsiField findFieldToAssign(final PsiParameter myParameter) {
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(myParameter.getProject());
private static PsiField findFieldToAssign(@NotNull Project project,
@NotNull PsiParameter myParameter) {
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
final String parameterName = myParameter.getName();
String propertyName = styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER);
final String propertyName = styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER);
final PsiMethod method = (PsiMethod)myParameter.getDeclarationScope();
final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
VariableKind kind = isMethodStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
SuggestedNameInfo suggestedNameInfo = styleManager.suggestVariableName(kind, propertyName, null, getType(myParameter));
final VariableKind kind = isMethodStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
final SuggestedNameInfo suggestedNameInfo = styleManager.suggestVariableName(kind, propertyName, null, FieldFromParameterUtils.getSubstitutedType(myParameter));
final String fieldName = suggestedNameInfo.names[0];
@@ -151,5 +99,37 @@ public class AssignFieldFromParameterAction extends BaseIntentionAction {
return field;
}
public static void addFieldAssignmentStatement(@NotNull Project project,
@NotNull PsiField field,
@NotNull PsiParameter parameter,
@NotNull Editor editor) throws IncorrectOperationException {
final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
final PsiCodeBlock methodBody = method.getBody();
if (methodBody == null) return;
final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
final String fieldName = field.getName();
final String parameterName = parameter.getName();
final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
final PsiClass targetClass = method.getContainingClass();
if (targetClass == null) return;
String stmtText = fieldName + " = " + parameterName + ";";
if (Comparing.strEqual(fieldName, parameterName) || JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(fieldName, methodBody) != field) {
@NonNls String prefix = isMethodStatic ? targetClass.getName() == null ? "" : targetClass.getName() + "." : "this.";
stmtText = prefix + stmtText;
}
final PsiStatement assignmentStmt = (PsiStatement)CodeStyleManager.getInstance(project).reformat(factory.createStatementFromText(stmtText, methodBody));
final PsiStatement[] statements = methodBody.getStatements();
final int i = FieldFromParameterUtils.findFieldAssignmentAnchor(statements, null, targetClass, parameter);
final PsiElement inserted;
if (i == statements.length) {
inserted = methodBody.add(assignmentStmt);
}
else {
inserted = methodBody.addAfter(assignmentStmt, i > 0 ? statements[i - 1] : null);
}
editor.getCaretModel().moveToOffset(inserted.getTextRange().getEndOffset());
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
}
@@ -27,9 +27,9 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocToken;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.XmlEntityDecl;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.IncorrectOperationException;
@@ -44,7 +44,6 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.ConvertToBasicLatinAction");
@@ -156,13 +155,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction {
@Override
public PsiElement findApplicable(final PsiElement element) {
if (element instanceof PsiDocComment) return element;
if (element instanceof PsiDocToken) return element.getParent();
if (element instanceof PsiWhiteSpace) {
final PsiElement parent = element.getParent();
if (parent instanceof PsiDocComment) return parent;
}
return null;
return PsiTreeUtil.getParentOfType(element, PsiDocComment.class, false);
}
@Override
@@ -0,0 +1,298 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.intention.impl;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.generation.ClassMember;
import com.intellij.codeInsight.generation.MemberChooserObject;
import com.intellij.codeInsight.generation.PsiMethodMember;
import com.intellij.ide.util.MemberChooser;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Key;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.SuggestedNameInfo;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ConcurrentWeakHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.*;
/**
* @author Danila Ponomarenko
*/
public class CreateAssignFieldsFromParametersAction extends BaseIntentionAction {
private static final Logger LOG = Logger.getInstance(CreateFieldFromParameterAction.class);
private static final Key<Map<SmartPsiElementPointer<PsiParameter>, Boolean>> PARAMS = Key.create("FIELDS_FROM_PARAMS");
private static final Object LOCK = new Object();
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
PsiParameter psiParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
PsiMethod method = findMethod(psiParameter, editor, file);
if (method == null) return false;
final List<PsiParameter> parameters = getAvailableParameters(method);
synchronized (LOCK) {
final Collection<SmartPsiElementPointer<PsiParameter>> params = getUnboundedParams(method);
params.clear();
for (PsiParameter parameter : parameters) {
params.add(SmartPointerManager.getInstance(project).createSmartPsiElementPointer(parameter));
}
if (params.isEmpty()) return false;
if (params.size() == 1 && psiParameter != null) return false;
if (psiParameter == null) {
psiParameter = params.iterator().next().getElement();
LOG.assertTrue(psiParameter != null);
}
setText(CodeInsightBundle.message("intention.create.assign.fields.from.parameters.text", method.isConstructor() ? "Constructor" : "Method"));
}
return isAvailable(psiParameter);
}
@Nullable
private static PsiMethod findMethod(@Nullable PsiParameter parameter, @NotNull Editor editor, @NotNull PsiFile file) {
if (parameter == null) {
final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset());
if (elementAt instanceof PsiIdentifier) {
final PsiElement parent = elementAt.getParent();
if (parent instanceof PsiMethod) {
return (PsiMethod)parent;
}
}
}
else {
final PsiElement declarationScope = parameter.getDeclarationScope();
if (declarationScope instanceof PsiMethod) {
return (PsiMethod)declarationScope;
}
}
return null;
}
@NotNull
private static List<PsiParameter> getAvailableParameters(@NotNull PsiMethod method) {
final List<PsiParameter> parameters = new ArrayList<PsiParameter>();
for (PsiParameter parameter : method.getParameterList().getParameters()) {
if (isAvailable(parameter)) {
parameters.add(parameter);
}
}
return parameters;
}
private static boolean isAvailable(PsiParameter psiParameter) {
final PsiType type = FieldFromParameterUtils.getSubstitutedType(psiParameter);
final PsiClass targetClass = PsiTreeUtil.getParentOfType(psiParameter, PsiClass.class);
return FieldFromParameterUtils.isAvailable(psiParameter, type, targetClass) &&
psiParameter.getLanguage().isKindOf(JavaLanguage.INSTANCE);
}
@NotNull
private static Collection<SmartPsiElementPointer<PsiParameter>> getUnboundedParams(PsiMethod psiMethod) {
Map<SmartPsiElementPointer<PsiParameter>, Boolean> params = psiMethod.getUserData(PARAMS);
if (params == null) psiMethod.putUserData(PARAMS, params = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiParameter>, Boolean>(1));
final Map<SmartPsiElementPointer<PsiParameter>, Boolean> finalParams = params;
return new AbstractCollection<SmartPsiElementPointer<PsiParameter>>() {
@Override
public boolean add(SmartPsiElementPointer<PsiParameter> psiVariable) {
return finalParams.put(psiVariable, Boolean.TRUE) == null;
}
@Override
public Iterator<SmartPsiElementPointer<PsiParameter>> iterator() {
return finalParams.keySet().iterator();
}
@Override
public int size() {
return finalParams.size();
}
@Override
public void clear() {
finalParams.clear();
}
};
}
@Override
@NotNull
public String getFamilyName() {
return CodeInsightBundle.message("intention.create.assign.fields.from.parameters.family");
}
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
invoke(project, editor, file, !ApplicationManager.getApplication().isUnitTestMode());
}
private static void invoke(final Project project, Editor editor, PsiFile file, boolean isInteractive) {
PsiParameter myParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
if (!CodeInsightUtilBase.prepareFileForWrite(file)) return;
final PsiMethod method = myParameter != null ? (PsiMethod)myParameter.getDeclarationScope() : PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiMethod.class);
LOG.assertTrue(method != null);
final Collection<SmartPsiElementPointer<PsiParameter>> unboundedParams;
synchronized (LOCK) {
unboundedParams = getUnboundedParams(method);
if (unboundedParams.isEmpty()) return;
if (myParameter == null) {
myParameter = unboundedParams.iterator().next().getElement();
}
}
if (unboundedParams.size() > 1 && isInteractive) {
ClassMember[] members = new ClassMember[unboundedParams.size()];
ClassMember selection = null;
int i = 0;
for (SmartPsiElementPointer<PsiParameter> pointer : unboundedParams) {
final PsiParameter parameter = pointer.getElement();
final ParameterClassMember classMember = new ParameterClassMember(parameter);
members[i++] = classMember;
if (parameter == myParameter) {
selection = classMember;
}
}
final PsiParameterList parameterList = method.getParameterList();
Arrays.sort(members, new Comparator<ClassMember>() {
@Override
public int compare(ClassMember o1, ClassMember o2) {
return parameterList.getParameterIndex(((ParameterClassMember)o1).getParameter()) -
parameterList.getParameterIndex(((ParameterClassMember)o2).getParameter());
}
});
final MemberChooser<ClassMember> chooser = new MemberChooser<ClassMember>(members, false, true, project);
if (selection != null) {
chooser.selectElements(new ClassMember[]{selection});
}
chooser.setTitle("Choose " + (method.isConstructor() ? "Constructor" : "Method") + " Parameters");
chooser.setCopyJavadocVisible(false);
chooser.show();
if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;
final List<ClassMember> selectedElements = chooser.getSelectedElements();
if (selectedElements == null) return;
final HashSet<String> usedNames = new HashSet<String>();
for (ClassMember selectedElement : selectedElements) {
processParameter(project, ((ParameterClassMember)selectedElement).getParameter(), usedNames);
}
}
else {
processParameter(project, myParameter);
}
synchronized (LOCK) {
unboundedParams.clear();
}
}
private static void processParameter(final Project project,
final PsiParameter myParameter) {
processParameter(project, myParameter, new HashSet<String>());
}
private static void processParameter(final Project project,
final PsiParameter myParameter,
final Set<String> usedNames) {
IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
final PsiType type = FieldFromParameterUtils.getSubstitutedType(myParameter);
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
final String parameterName = myParameter.getName();
String propertyName = styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER);
final PsiClass targetClass = PsiTreeUtil.getParentOfType(myParameter, PsiClass.class);
final PsiMethod method = (PsiMethod)myParameter.getDeclarationScope();
final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
VariableKind kind = isMethodStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
SuggestedNameInfo suggestedNameInfo = styleManager.suggestVariableName(kind, propertyName, null, type);
String[] names = suggestedNameInfo.names;
final boolean isFinal = !isMethodStatic && method.isConstructor();
final String fieldName = usedNames.add(names[0]) ? names[0] : JavaCodeStyleManager.getInstance(project).suggestUniqueVariableName(names[0], myParameter, true);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
FieldFromParameterUtils.createFieldAndAddAssignment(
project,
targetClass,
method,
myParameter,
type,
fieldName,
isMethodStatic,
isFinal);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
});
}
@Override
public boolean startInWriteAction() {
return false;
}
private static class ParameterClassMember implements ClassMember {
private PsiParameter myParameter;
private ParameterClassMember(PsiParameter parameter) {
myParameter = parameter;
}
@Override
public MemberChooserObject getParentNodeDelegate() {
return new PsiMethodMember((PsiMethod)myParameter.getDeclarationScope());
}
@Override
public void renderTreeNode(SimpleColoredComponent component, JTree tree) {
SpeedSearchUtil.appendFragmentsForSpeedSearch(tree, getText(), SimpleTextAttributes.REGULAR_ATTRIBUTES, false, component);
component.setIcon(myParameter.getIcon(0));
}
@Override
public String getText() {
return myParameter.getName();
}
public PsiParameter getParameter() {
return myParameter;
}
}
}
@@ -17,212 +17,45 @@ package com.intellij.codeInsight.intention.impl;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInsight.generation.ClassMember;
import com.intellij.codeInsight.generation.MemberChooserObject;
import com.intellij.codeInsight.generation.PsiMethodMember;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.ide.util.MemberChooser;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.SuggestedNameInfo;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ConcurrentWeakHashMap;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CreateFieldFromParameterAction implements IntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.CreateFieldFromParameterAction");
private static final Key<Map<SmartPsiElementPointer<PsiParameter>, Boolean>> PARAMS = Key.create("FIELDS_FROM_PARAMS");
private static final Object LOCK = new Object();
private String myName = "";
private boolean myConstructor = false;
@Nullable
private static PsiType[] getTypes(final PsiParameter parameter) {
if (parameter == null) return null;
PsiType type = parameter.getType();
if (type instanceof PsiEllipsisType) type = ((PsiEllipsisType)type).toArrayType();
if (type instanceof PsiArrayType) return new PsiType[]{type};
final PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(type);
final PsiClass psiClass = result.getElement();
if (psiClass == null) return new PsiType[] {type};
final HashSet<PsiTypeParameter> usedTypeParameters = new HashSet<PsiTypeParameter>();
RefactoringUtil.collectTypeParameters(usedTypeParameters, parameter);
for (Iterator<PsiTypeParameter> iterator = usedTypeParameters.iterator(); iterator.hasNext();) {
PsiTypeParameter usedTypeParameter = iterator.next();
if (parameter.getDeclarationScope() != usedTypeParameter.getOwner()) {
iterator.remove();
}
}
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(parameter.getProject());
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
for (PsiTypeParameter usedTypeParameter : usedTypeParameters) {
subst = subst.put(usedTypeParameter, TypeConversionUtil.typeParameterErasure(usedTypeParameter));
}
PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
final Map<PsiTypeParameter, PsiType> typeMap = result.getSubstitutor().getSubstitutionMap();
for (PsiTypeParameter typeParameter : typeMap.keySet()) {
final PsiType psiType = typeMap.get(typeParameter);
substitutor = substitutor.put(typeParameter, psiType != null ? subst.substitute(psiType) : null);
}
return new PsiType[]{psiClass instanceof PsiTypeParameter ? subst.substitute((PsiTypeParameter)psiClass) : elementFactory.createType(psiClass, substitutor)};
}
@Override
@NotNull
public String getText() {
if (myName == null) {
return CodeInsightBundle.message("intention.create.fields.from.parameters.text", myConstructor ? "Constructor" : "Method") ;
}
return CodeInsightBundle.message("intention.create.field.from.parameter.text", myName);
}
public class CreateFieldFromParameterAction extends BaseIntentionAction {
private static final Logger LOG = Logger.getInstance(CreateFieldFromParameterAction.class);
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
PsiParameter psiParameter = findParameterAtCursor(file, editor);
PsiMethod method = null;
if (psiParameter == null) {
final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset());
if (elementAt instanceof PsiIdentifier) {
final PsiElement parent = elementAt.getParent();
if (parent instanceof PsiMethod) {
method = (PsiMethod)parent;
}
}
} else {
final PsiElement declarationScope = psiParameter.getDeclarationScope();
if (declarationScope instanceof PsiMethod) {
method = (PsiMethod)declarationScope;
}
final PsiParameter parameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
if (parameter == null || !isAvailable(parameter)) {
return false;
}
if (method == null) return false;
setText(CodeInsightBundle.message("intention.create.field.from.parameter.text", parameter.getName()));
final List<PsiParameter> parameters = new ArrayList<PsiParameter>();
for (PsiParameter parameter : method.getParameterList().getParameters()) {
if (isAvailable(parameter)) {
parameters.add(parameter);
}
}
synchronized (LOCK) {
final Collection<SmartPsiElementPointer<PsiParameter>> params = getUnboundedParams(method);
params.clear();
for (PsiParameter parameter : parameters) {
params.add(SmartPointerManager.getInstance(project).createSmartPsiElementPointer(parameter));
}
if (params.isEmpty()) return false;
if (psiParameter == null) {
psiParameter = params.iterator().next().getElement();
LOG.assertTrue(psiParameter != null);
}
myName = params.size() > 1 && !ApplicationManager.getApplication().isUnitTestMode() ? null : psiParameter.getName();
myConstructor = method.isConstructor();
}
return isAvailable(psiParameter);
return true;
}
private static boolean isAvailable(PsiParameter psiParameter) {
final PsiType[] types = getTypes(psiParameter);
PsiClass targetClass = PsiTreeUtil.getParentOfType(psiParameter, PsiClass.class);
return psiParameter.isValid()
&& psiParameter.getLanguage().isKindOf(JavaLanguage.INSTANCE)
&& psiParameter.getDeclarationScope() instanceof PsiMethod
&& ((PsiMethod)psiParameter.getDeclarationScope()).getBody() != null
&& psiParameter.getManager().isInProject(psiParameter)
&& types != null
&& types[0].isValid()
&& getParameterAssignedToField(psiParameter) == null
&& targetClass != null
&& !targetClass.isInterface()
;
}
@NotNull
private static Collection<SmartPsiElementPointer<PsiParameter>> getUnboundedParams(PsiMethod psiMethod) {
Map<SmartPsiElementPointer<PsiParameter>, Boolean> params = psiMethod.getUserData(PARAMS);
if (params == null) psiMethod.putUserData(PARAMS, params = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiParameter>, Boolean>(1));
final Map<SmartPsiElementPointer<PsiParameter>, Boolean> finalParams = params;
return new AbstractCollection<SmartPsiElementPointer<PsiParameter>>() {
@Override
public boolean add(SmartPsiElementPointer<PsiParameter> psiVariable) {
return finalParams.put(psiVariable, Boolean.TRUE) == null;
}
@Override
public Iterator<SmartPsiElementPointer<PsiParameter>> iterator() {
return finalParams.keySet().iterator();
}
@Override
public int size() {
return finalParams.size();
}
@Override
public void clear() {
finalParams.clear();
}
};
}
@Nullable
public static PsiField getParameterAssignedToField(final PsiParameter parameter) {
for (PsiReference reference : ReferencesSearch.search(parameter, new LocalSearchScope(parameter.getDeclarationScope()), false)) {
if (!(reference instanceof PsiReferenceExpression)) continue;
final PsiReferenceExpression expression = (PsiReferenceExpression)reference;
if (!(expression.getParent() instanceof PsiAssignmentExpression)) continue;
final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expression.getParent();
if (assignmentExpression.getRExpression() != expression) continue;
final PsiExpression lExpression = assignmentExpression.getLExpression();
if (!(lExpression instanceof PsiReferenceExpression)) continue;
final PsiElement element = ((PsiReferenceExpression)lExpression).resolve();
if (element instanceof PsiField) return (PsiField)element;
}
return null;
}
@Nullable
static PsiParameter findParameterAtCursor(final PsiFile file, final Editor editor) {
final int offset = editor.getCaretModel().getOffset();
final PsiParameterList parameterList = PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiParameterList.class, false);
if (parameterList == null) return null;
final PsiParameter[] parameters = parameterList.getParameters();
for (PsiParameter parameter : parameters) {
final TextRange range = parameter.getTextRange();
if (range.getStartOffset() <= offset && offset <= range.getEndOffset()) return parameter;
}
return null;
final PsiType type = FieldFromParameterUtils.getSubstitutedType(psiParameter);
final PsiClass targetClass = PsiTreeUtil.getParentOfType(psiParameter, PsiClass.class);
return FieldFromParameterUtils.isAvailable(psiParameter, type, targetClass) &&
psiParameter.getLanguage().isKindOf(JavaLanguage.INSTANCE);
}
@Override
@@ -233,97 +66,35 @@ public class CreateFieldFromParameterAction implements IntentionAction {
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
invoke(project, editor, file, !ApplicationManager.getApplication().isUnitTestMode());
}
final PsiParameter myParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
if (myParameter == null || !CodeInsightUtilBase.prepareFileForWrite(file)) return;
private static void invoke(final Project project, Editor editor, PsiFile file, boolean isInteractive) {
PsiParameter myParameter = findParameterAtCursor(file, editor);
if (!CodeInsightUtilBase.prepareFileForWrite(file)) return;
final PsiMethod method = myParameter != null ? (PsiMethod)myParameter.getDeclarationScope() : PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiMethod.class);
LOG.assertTrue(method != null);
final Collection<SmartPsiElementPointer<PsiParameter>> unboundedParams;
synchronized (LOCK) {
unboundedParams = getUnboundedParams(method);
if (unboundedParams.isEmpty()) return;
if (myParameter == null) {
myParameter = unboundedParams.iterator().next().getElement();
}
}
if (unboundedParams.size() > 1 && !ApplicationManager.getApplication().isUnitTestMode()) {
ClassMember[] members = new ClassMember[unboundedParams.size()];
ClassMember selection = null;
int i = 0;
for (SmartPsiElementPointer<PsiParameter> pointer : unboundedParams) {
final PsiParameter parameter = pointer.getElement();
final ParameterClassMember classMember = new ParameterClassMember(parameter);
members[i++] = classMember;
if (parameter == myParameter) {
selection = classMember;
}
}
final PsiParameterList parameterList = method.getParameterList();
Arrays.sort(members, new Comparator<ClassMember>() {
@Override
public int compare(ClassMember o1, ClassMember o2) {
return parameterList.getParameterIndex(((ParameterClassMember)o1).getParameter()) -
parameterList.getParameterIndex(((ParameterClassMember)o2).getParameter());
}
});
final MemberChooser<ClassMember> chooser = new MemberChooser<ClassMember>(members, false, true, project);
if (selection != null) {
chooser.selectElements(new ClassMember[] {selection});
}
chooser.setTitle("Choose " + (method.isConstructor() ? "Constructor" : "Method") + " Parameters to Generate Fields");
chooser.setCopyJavadocVisible(false);
chooser.show();
if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;
final List<ClassMember> selectedElements = chooser.getSelectedElements();
if (selectedElements == null) return;
if (selectedElements.size() == 1) {
processParameter(project, ((ParameterClassMember)selectedElements.get(0)).getParameter(), isInteractive);
} else {
//do not ask for names in batch
final HashSet<String> usedNames = new HashSet<String>();
for (ClassMember selectedElement : selectedElements) {
processParameter(project, ((ParameterClassMember)selectedElement).getParameter(), false, usedNames);
}
}
}
else {
processParameter(project, myParameter, isInteractive);
}
synchronized (LOCK) {
unboundedParams.clear();
}
}
private static void processParameter(final Project project,
final PsiParameter myParameter,
boolean isInteractive) {
processParameter(project, myParameter, isInteractive, new HashSet<String>());
}
private static void processParameter(final Project project,
final PsiParameter myParameter,
boolean isInteractive,
final Set<String> usedNames) {
IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
final PsiType[] types = getTypes(myParameter);
try {
processParameter(project, myParameter, !ApplicationManager.getApplication().isUnitTestMode());
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
private static void processParameter(final @NotNull Project project,
final @NotNull PsiParameter myParameter,
final boolean isInteractive) {
final PsiType type = FieldFromParameterUtils.getSubstitutedType(myParameter);
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
final String parameterName = myParameter.getName();
String propertyName = styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER);
String fieldNameToCalc;
boolean isFinalToCalc;
PsiType type;
final PsiClass targetClass = PsiTreeUtil.getParentOfType(myParameter, PsiClass.class);
final PsiMethod method = (PsiMethod)myParameter.getDeclarationScope();
final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
VariableKind kind = isMethodStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
SuggestedNameInfo suggestedNameInfo = styleManager.suggestVariableName(kind, propertyName, null, types[0]);
SuggestedNameInfo suggestedNameInfo = styleManager.suggestVariableName(kind, propertyName, null, type);
String[] names = suggestedNameInfo.names;
if (isInteractive) {
@@ -338,16 +109,16 @@ public class CreateFieldFromParameterAction implements IntentionAction {
}
names = ArrayUtil.toStringArray(namesList);
boolean myBeFinal = method.isConstructor();
CreateFieldFromParameterDialog dialog = new CreateFieldFromParameterDialog(
final CreateFieldFromParameterDialog dialog = new CreateFieldFromParameterDialog(
project,
names,
targetClass, myBeFinal, types);
targetClass,
method.isConstructor(),
type
);
dialog.show();
if (!dialog.isOK()) return;
type = dialog.getType();
if (type == null) return;
fieldNameToCalc = dialog.getEnteredName();
isFinalToCalc = dialog.isDeclareFinal();
@@ -355,94 +126,24 @@ public class CreateFieldFromParameterAction implements IntentionAction {
}
else {
isFinalToCalc = !isMethodStatic && method.isConstructor();
if (usedNames.add(names[0])) {
fieldNameToCalc = names[0];
}
else {
fieldNameToCalc = JavaCodeStyleManager.getInstance(project).suggestUniqueVariableName(names[0], myParameter, true);
}
type= types[0];
fieldNameToCalc = names[0];
}
final boolean isFinal = isFinalToCalc;
final String fieldName = fieldNameToCalc;
final PsiType fieldType = type;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
PsiManager psiManager = PsiManager.getInstance(project);
PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
PsiField field = factory.createField(fieldName, fieldType);
PsiModifierList modifierList = field.getModifierList();
modifierList.setModifierProperty(PsiModifier.STATIC, isMethodStatic);
modifierList.setModifierProperty(PsiModifier.FINAL, isFinal);
final NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
final String nullable = manager.getNullable(myParameter);
if (nullable != null) {
modifierList.addAfter(factory.createAnnotationFromText("@" + nullable, field), null);
} else if (isFinal) {
final String notNull = manager.getNotNull(myParameter);
if (notNull != null) {
modifierList.addAfter(factory.createAnnotationFromText("@" + notNull, field), null);
}
}
PsiCodeBlock methodBody = method.getBody();
if (methodBody == null) return;
PsiStatement[] statements = methodBody.getStatements();
Ref<Pair<PsiField, Boolean>> anchorRef = new Ref<Pair<PsiField, Boolean>>();
int i = findFieldAssignmentAnchor(statements, anchorRef, targetClass, myParameter);
Pair<PsiField, Boolean> fieldAnchor = anchorRef.get();
String stmtText = fieldName + " = " + parameterName + ";";
if (fieldName.equals(parameterName)) {
@NonNls String prefix = isMethodStatic ? targetClass.getName() == null ? "" : targetClass.getName() + "." : "this.";
stmtText = prefix + stmtText;
}
PsiStatement assignmentStmt = factory.createStatementFromText(stmtText, methodBody);
assignmentStmt = (PsiStatement)CodeStyleManager.getInstance(project).reformat(assignmentStmt);
if (i == statements.length) {
methodBody.add(assignmentStmt);
}
else {
methodBody.addAfter(assignmentStmt, i > 0 ? statements[i - 1] : null);
}
if (fieldAnchor != null) {
PsiVariable psiVariable = fieldAnchor.getFirst();
psiVariable.normalizeDeclaration();
}
boolean found = false;
final PsiField[] fields = targetClass.getFields();
for (PsiField f : fields) {
if (f.getName().equals(field.getName())) {
found = true;
break;
}
}
if (!found) {
if (fieldAnchor != null) {
Boolean insertBefore = fieldAnchor.getSecond();
PsiField inField = fieldAnchor.getFirst();
if (insertBefore.booleanValue()) {
targetClass.addBefore(field, inField);
}
else {
targetClass.addAfter(field, inField);
}
}
else {
targetClass.add(field);
}
}
FieldFromParameterUtils.createFieldAndAddAssignment(
project,
targetClass,
method,
myParameter,
type,
fieldName,
isMethodStatic,
isFinal);
}
catch (IncorrectOperationException e) {
LOG.error(e);
@@ -451,90 +152,8 @@ public class CreateFieldFromParameterAction implements IntentionAction {
});
}
static int findFieldAssignmentAnchor(final PsiStatement[] statements, @Nullable final Ref<Pair<PsiField, Boolean>> anchorRef,
final PsiClass targetClass, final PsiParameter myParameter) {
int i = 0;
for (; i < statements.length; i++) {
PsiStatement psiStatement = statements[i];
if (psiStatement instanceof PsiExpressionStatement) {
PsiExpressionStatement expressionStatement = (PsiExpressionStatement)psiStatement;
PsiExpression expression = expressionStatement.getExpression();
if (expression instanceof PsiMethodCallExpression) {
PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)expression;
@NonNls String text = methodCallExpression.getMethodExpression().getText();
if (text.equals("super") || text.equals("this")) {
continue;
}
}
else if (expression instanceof PsiAssignmentExpression) {
PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expression;
PsiExpression lExpression = assignmentExpression.getLExpression();
PsiExpression rExpression = assignmentExpression.getRExpression();
if (!(lExpression instanceof PsiReferenceExpression)) break;
if (!(rExpression instanceof PsiReferenceExpression)) break;
PsiReferenceExpression lReference = (PsiReferenceExpression)lExpression;
PsiReferenceExpression rReference = (PsiReferenceExpression)rExpression;
PsiElement lElement = lReference.resolve();
PsiElement rElement = rReference.resolve();
if (!(lElement instanceof PsiField) || ((PsiField)lElement).getContainingClass() != targetClass) break;
if (!(rElement instanceof PsiParameter)) break;
if (myParameter.getTextRange().getStartOffset() < rElement.getTextRange().getStartOffset()) {
if (anchorRef != null) {
anchorRef.set(Pair.create((PsiField)lElement, Boolean.TRUE));
}
break;
}
if (anchorRef != null) {
anchorRef.set(Pair.create((PsiField)lElement, Boolean.FALSE));
}
continue;
}
}
break;
}
return i;
}
@Override
public boolean startInWriteAction() {
return false;
}
private static class ParameterClassMember implements ClassMember {
private PsiParameter myParameter;
private ParameterClassMember(PsiParameter parameter) {
myParameter = parameter;
}
@Override
public MemberChooserObject getParentNodeDelegate() {
return new PsiMethodMember((PsiMethod)myParameter.getDeclarationScope());
}
@Override
public void renderTreeNode(SimpleColoredComponent component, JTree tree) {
SpeedSearchUtil.appendFragmentsForSpeedSearch(tree, getText(), SimpleTextAttributes.REGULAR_ATTRIBUTES, false, component);
component.setIcon(myParameter.getIcon(0));
}
@Override
public String getText() {
return myParameter.getName();
}
public PsiParameter getParameter() {
return myParameter;
}
}
}
@@ -50,7 +50,8 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
public CreateFieldFromParameterDialog(Project project,
String[] names,
PsiClass targetClass,
final boolean fieldMayBeFinal, PsiType... types) {
boolean fieldMayBeFinal,
PsiType... types) {
super(project, true);
myProject = project;
myNames = names;
@@ -66,7 +67,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
@Override
protected void doOKAction() {
if (myCbFinal.isEnabled()) {
PropertiesComponent.getInstance().setValue(PROPERTY_NAME, ""+myCbFinal.isSelected());
PropertiesComponent.getInstance().setValue(PROPERTY_NAME, "" + myCbFinal.isSelected());
}
final PsiField[] fields = myTargetClass.getFields();
@@ -97,11 +98,11 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
public String getEnteredName() {
if (myNameField instanceof JComboBox) {
JComboBox combobox = (JComboBox) myNameField;
return (String) combobox.getEditor().getItem();
JComboBox combobox = (JComboBox)myNameField;
return (String)combobox.getEditor().getItem();
}
else {
return ((JTextField) myNameField).getText();
return ((JTextField)myNameField).getText();
}
}
@@ -123,46 +124,46 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
combobox.setMaximumRowCount(8);
combobox.registerKeyboardAction(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (combobox.isPopupVisible()) {
combobox.setPopupVisible(false);
}
else {
doCancelAction();
}
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (combobox.isPopupVisible()) {
combobox.setPopupVisible(false);
}
},
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
else {
doCancelAction();
}
}
},
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
);
combobox.addItemListener(
new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
updateOkStatus();
}
new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
updateOkStatus();
}
}
);
combobox.getEditor().getEditorComponent().addKeyListener(
new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
updateOkStatus();
}
@Override
public void keyReleased(KeyEvent e) {
updateOkStatus();
}
@Override
public void keyTyped(KeyEvent e) {
updateOkStatus();
}
new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
updateOkStatus();
}
@Override
public void keyReleased(KeyEvent e) {
updateOkStatus();
}
@Override
public void keyTyped(KeyEvent e) {
updateOkStatus();
}
}
);
}
else {
@@ -203,7 +204,8 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
if (myTypes.length > 1) {
myTypeSelector = new TypeSelector(myProject);
myTypeSelector.setTypes(myTypes);
} else {
}
else {
myTypeSelector = new TypeSelector(myTypes[0], myProject);
}
panel.add(myTypeSelector.getComponent(), gbConstraints);
@@ -240,7 +242,8 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
myCbFinal = new JCheckBox(CodeInsightBundle.message("dialog.create.field.from.parameter.declare.final.checkbox"));
if (myFieldMayBeFinal) {
myCbFinal.setSelected(PropertiesComponent.getInstance().isTrueValue(PROPERTY_NAME));
} else {
}
else {
myCbFinal.setSelected(false);
myCbFinal.setEnabled(false);
}
@@ -264,7 +267,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper {
myNameField.requestFocusInWindow();
}
else {
((JComboBox) myNameField).getEditor().getEditorComponent().requestFocusInWindow();
((JComboBox)myNameField).getEditor().getEditorComponent().requestFocusInWindow();
}
}
@@ -0,0 +1,272 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.intention.impl;
import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
/**
* @author Danila Ponomarenko
*/
public final class FieldFromParameterUtils {
@Nullable
public static PsiParameter findParameterAtCursor(@NotNull PsiFile file, @NotNull Editor editor) {
final int offset = editor.getCaretModel().getOffset();
final PsiParameterList parameterList = PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiParameterList.class, false);
if (parameterList == null) return null;
final PsiParameter[] parameters = parameterList.getParameters();
for (PsiParameter parameter : parameters) {
final TextRange range = parameter.getTextRange();
if (range.getStartOffset() <= offset && offset <= range.getEndOffset()) return parameter;
}
return null;
}
@Nullable
public static PsiType getType(@Nullable PsiParameter myParameter) {
if (myParameter == null) return null;
PsiType type = myParameter.getType();
return type instanceof PsiEllipsisType ? ((PsiEllipsisType)type).toArrayType() : type;
}
@Nullable
public static PsiType getSubstitutedType(@Nullable PsiParameter parameter) {
if (parameter == null) return null;
final PsiType type = getType(parameter);
if (type instanceof PsiArrayType) {
return type;
}
final PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(type);
final PsiClass psiClass = result.getElement();
if (psiClass == null) return type;
final HashSet<PsiTypeParameter> usedTypeParameters = new HashSet<PsiTypeParameter>();
RefactoringUtil.collectTypeParameters(usedTypeParameters, parameter);
for (Iterator<PsiTypeParameter> iterator = usedTypeParameters.iterator(); iterator.hasNext(); ) {
PsiTypeParameter usedTypeParameter = iterator.next();
if (parameter.getDeclarationScope() != usedTypeParameter.getOwner()) {
iterator.remove();
}
}
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(parameter.getProject());
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
for (PsiTypeParameter usedTypeParameter : usedTypeParameters) {
subst = subst.put(usedTypeParameter, TypeConversionUtil.typeParameterErasure(usedTypeParameter));
}
PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
final Map<PsiTypeParameter, PsiType> typeMap = result.getSubstitutor().getSubstitutionMap();
for (PsiTypeParameter typeParameter : typeMap.keySet()) {
final PsiType psiType = typeMap.get(typeParameter);
substitutor = substitutor.put(typeParameter, psiType != null ? subst.substitute(psiType) : null);
}
return psiClass instanceof PsiTypeParameter ? subst.substitute((PsiTypeParameter)psiClass) : elementFactory.createType(psiClass, substitutor);
}
@Nullable
public static PsiField getParameterAssignedToField(final PsiParameter parameter) {
for (PsiReference reference : ReferencesSearch.search(parameter, new LocalSearchScope(parameter.getDeclarationScope()), false)) {
if (!(reference instanceof PsiReferenceExpression)) continue;
final PsiReferenceExpression expression = (PsiReferenceExpression)reference;
if (!(expression.getParent() instanceof PsiAssignmentExpression)) continue;
final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expression.getParent();
if (assignmentExpression.getRExpression() != expression) continue;
final PsiExpression lExpression = assignmentExpression.getLExpression();
if (!(lExpression instanceof PsiReferenceExpression)) continue;
final PsiElement element = ((PsiReferenceExpression)lExpression).resolve();
if (element instanceof PsiField) return (PsiField)element;
}
return null;
}
public static int findFieldAssignmentAnchor(final PsiStatement[] statements,
final @Nullable Ref<Pair<PsiField, Boolean>> anchorRef,
final PsiClass targetClass,
final PsiParameter myParameter) {
int i = 0;
for (; i < statements.length; i++) {
PsiStatement psiStatement = statements[i];
if (psiStatement instanceof PsiExpressionStatement) {
PsiExpressionStatement expressionStatement = (PsiExpressionStatement)psiStatement;
PsiExpression expression = expressionStatement.getExpression();
if (expression instanceof PsiMethodCallExpression) {
PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)expression;
@NonNls String text = methodCallExpression.getMethodExpression().getText();
if (text.equals("super") || text.equals("this")) {
continue;
}
}
else if (expression instanceof PsiAssignmentExpression) {
PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expression;
PsiExpression lExpression = assignmentExpression.getLExpression();
PsiExpression rExpression = assignmentExpression.getRExpression();
if (!(lExpression instanceof PsiReferenceExpression)) break;
if (!(rExpression instanceof PsiReferenceExpression)) break;
PsiReferenceExpression lReference = (PsiReferenceExpression)lExpression;
PsiReferenceExpression rReference = (PsiReferenceExpression)rExpression;
PsiElement lElement = lReference.resolve();
PsiElement rElement = rReference.resolve();
if (!(lElement instanceof PsiField) || ((PsiField)lElement).getContainingClass() != targetClass) break;
if (!(rElement instanceof PsiParameter)) break;
if (myParameter.getTextRange().getStartOffset() < rElement.getTextRange().getStartOffset()) {
if (anchorRef != null) {
anchorRef.set(Pair.create((PsiField)lElement, Boolean.TRUE));
}
break;
}
if (anchorRef != null) {
anchorRef.set(Pair.create((PsiField)lElement, Boolean.FALSE));
}
continue;
}
}
break;
}
return i;
}
public static void createFieldAndAddAssignment(final @NotNull Project project,
final @NotNull PsiClass targetClass,
final @NotNull PsiMethod method,
final @NotNull PsiParameter parameter,
final @NotNull PsiType fieldType, final @NotNull String fieldName,
final boolean isStatic, final boolean isFinal) throws IncorrectOperationException {
PsiManager psiManager = PsiManager.getInstance(project);
PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
PsiField field = factory.createField(fieldName, fieldType);
PsiModifierList modifierList = field.getModifierList();
if (modifierList == null) return;
modifierList.setModifierProperty(PsiModifier.STATIC, isStatic);
modifierList.setModifierProperty(PsiModifier.FINAL, isFinal);
final NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
final String nullable = manager.getNullable(parameter);
if (nullable != null) {
modifierList.addAfter(factory.createAnnotationFromText("@" + nullable, field), null);
}
else if (isFinal) {
final String notNull = manager.getNotNull(parameter);
if (notNull != null) {
modifierList.addAfter(factory.createAnnotationFromText("@" + notNull, field), null);
}
}
PsiCodeBlock methodBody = method.getBody();
if (methodBody == null) return;
PsiStatement[] statements = methodBody.getStatements();
Ref<Pair<PsiField, Boolean>> anchorRef = new Ref<Pair<PsiField, Boolean>>();
int i = findFieldAssignmentAnchor(statements, anchorRef, targetClass, parameter);
Pair<PsiField, Boolean> fieldAnchor = anchorRef.get();
String stmtText = fieldName + " = " + parameter.getName() + ";";
if (fieldName.equals(parameter.getName())) {
@NonNls String prefix = isStatic ? targetClass.getName() == null ? "" : targetClass.getName() + "." : "this.";
stmtText = prefix + stmtText;
}
PsiStatement assignmentStmt = factory.createStatementFromText(stmtText, methodBody);
assignmentStmt = (PsiStatement)CodeStyleManager.getInstance(project).reformat(assignmentStmt);
if (i == statements.length) {
methodBody.add(assignmentStmt);
}
else {
methodBody.addAfter(assignmentStmt, i > 0 ? statements[i - 1] : null);
}
if (fieldAnchor != null) {
PsiVariable psiVariable = fieldAnchor.getFirst();
psiVariable.normalizeDeclaration();
}
boolean found = false;
final PsiField[] fields = targetClass.getFields();
for (PsiField f : fields) {
if (f.getName().equals(field.getName())) {
found = true;
break;
}
}
if (!found) {
if (fieldAnchor != null) {
Boolean insertBefore = fieldAnchor.getSecond();
PsiField inField = fieldAnchor.getFirst();
if (insertBefore.booleanValue()) {
targetClass.addBefore(field, inField);
}
else {
targetClass.addAfter(field, inField);
}
}
else {
targetClass.add(field);
}
}
}
public static boolean isAvailable(@Nullable PsiParameter myParameter,
@Nullable PsiType type,
@Nullable PsiClass targetClass){
return myParameter != null
&& myParameter.isValid()
&& myParameter.getManager().isInProject(myParameter)
&& myParameter.getDeclarationScope() instanceof PsiMethod
&& ((PsiMethod)myParameter.getDeclarationScope()).getBody() != null
&& type != null
&& type.isValid()
&& targetClass != null
&& !targetClass.isInterface()
&& getParameterAssignedToField(myParameter) == null;
}
private FieldFromParameterUtils() {
}
}
@@ -34,7 +34,7 @@ import com.intellij.psi.formatter.java.wrap.ReservedWrapsProvider;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.codeStyle.ShiftIndentInsideHelper;
import com.intellij.psi.impl.source.tree.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.psi.impl.source.tree.java.ClassElement;
import com.intellij.psi.jsp.JspElementType;
import com.intellij.psi.tree.IElementType;
@@ -172,7 +172,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
if (isStatement(child, child.getTreeParent())) {
return new CodeBlockBlock(child, wrap, alignment, actualIndent, settings);
}
if (child instanceof PsiComment && child instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)child)) {
if (child instanceof PsiComment && child instanceof PsiLanguageInjectionHost && InjectedLanguageFacadeImpl
.hasInjections((PsiLanguageInjectionHost)child)) {
return new CommentWithInjectionBlock(child, wrap, alignment, indent, settings);
}
if (child instanceof LeafElement) {
@@ -2,7 +2,6 @@ package com.intellij.psi.impl.search;
import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.searches.ReferencesSearch;
@@ -75,12 +75,12 @@ public class ChangeSignatureUtil {
}
}
} else {
if (newElements.size() > 1) {
if (newElements.size() > 1 && (!elements.isEmpty() || index < newElements.size() - 1)) {
PsiElement anchor;
if (index == 0) {
anchor = list.getFirstChild();
} else {
anchor = elements.get(index - 1);
anchor = index - 1 < elements.size() ? elements.get(index - 1) : null;
}
final PsiElement psi = Factory
.createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, SharedImplUtil.findCharTableByTree(list.getNode()), list.getManager())
@@ -253,8 +253,12 @@ class DetectedJavaChangeInfo extends JavaChangeInfoImpl {
final PsiMethod currentMethod = (PsiMethod)initialChangeInfo.getMethod();
if (silently || ApplicationManager.getApplication().isUnitTestMode()) {
final TextRange signatureRange = JavaChangeSignatureDetector.getSignatureRange(currentMethod);
final String currentSignature = currentMethod.getContainingFile().getText().substring(signatureRange.getStartOffset(),
signatureRange.getEndOffset());
temporallyRevertChanges(currentMethod, oldText);
createChangeSignatureProcessor(method).run();
temporallyRevertChanges(currentMethod, currentSignature, JavaChangeSignatureDetector.getSignatureRange(currentMethod));
return true;
}
final JavaMethodDescriptor descriptor = new JavaMethodDescriptor(currentMethod) {
@@ -289,6 +293,12 @@ class DetectedJavaChangeInfo extends JavaChangeInfoImpl {
}
private static void temporallyRevertChanges(final PsiElement psiElement, final String oldText) {
temporallyRevertChanges(psiElement, oldText, psiElement.getTextRange());
}
private static void temporallyRevertChanges(final PsiElement psiElement,
final String oldText,
final TextRange textRange) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -296,7 +306,6 @@ class DetectedJavaChangeInfo extends JavaChangeInfoImpl {
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(psiElement.getProject());
final Document document = documentManager.getDocument(file);
if (document != null) {
final TextRange textRange = psiElement.getTextRange();
document.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), oldText);
documentManager.commitDocument(document);
}
@@ -258,7 +258,7 @@ class JavaChangeInfoImpl implements JavaChangeInfo {
}
protected void setupPropagationEnabled(final PsiParameter[] parameters, final ParameterInfoImpl[] newParms) {
if (parameters.length >= newParms.length) {
if (parameters.length != newParms.length) {
isPropagationEnabled = false;
}
else {
@@ -145,7 +145,7 @@ public class JavaChangeSignatureDetector implements LanguageChangeSignatureDetec
textRange.getEndOffset() <= method.getTextRange().getEndOffset();
}
private static TextRange getSignatureRange(PsiMethod method) {
public static TextRange getSignatureRange(PsiMethod method) {
final PsiCodeBlock body = method.getBody();
if (body != null) {
return new TextRange(method.getTextRange().getStartOffset(), body.getTextOffset());
@@ -29,6 +29,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
@@ -593,12 +594,10 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
String def = item.parameter.defaultValue;
def = def.trim();
if (!(type instanceof PsiEllipsisType)) {
if (def.length() == 0) {
return RefactoringBundle.message("changeSignature.no.default.value", item.parameter.getName());
}
try {
factory.createExpressionFromText(def, null);
if (!StringUtil.isEmpty(def)) {
factory.createExpressionFromText(def, null);
}
}
catch (IncorrectOperationException e) {
return e.getMessage();
@@ -661,6 +660,21 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
return null;
}
@Override
protected ValidationInfo doValidate() {
for (final ParameterTableModelItemBase<ParameterInfoImpl> item : myParametersTableModel.getItems()) {
if (item.parameter.oldParameterIndex < 0) {
if (StringUtil.isEmpty(item.defaultValueCodeFragment.getText())) return new ValidationInfo("Default value is missed. In the method call place new parameter value would be leaved blank");
}
}
return super.doValidate();
}
@Override
protected boolean postponeValidation() {
return false;
}
@Override
protected String calculateSignature() {
return doCalculateSignature(myMethod.getMethod());
@@ -20,12 +20,15 @@ import com.intellij.lang.StdLanguages;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.scope.processor.VariablesProcessor;
import com.intellij.psi.scope.util.PsiScopesUtil;
import com.intellij.psi.util.*;
@@ -790,7 +793,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
methodThrowsList.getTextRange().getEndOffset());
}
private static void fixJavadocsForChangedMethod(PsiMethod method, JavaChangeInfo changeInfo, int newParamsLength) throws IncorrectOperationException {
private static void fixJavadocsForChangedMethod(final PsiMethod method, final JavaChangeInfo changeInfo, int newParamsLength) throws IncorrectOperationException {
final PsiParameter[] parameters = method.getParameterList().getParameters();
final JavaParameterInfo[] newParms = changeInfo.getNewParameters();
LOG.assertTrue(parameters.length <= newParamsLength);
@@ -799,11 +802,19 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
for (int i = 0; i < newParamsLength; i++) {
JavaParameterInfo newParm = newParms[i];
if (newParm.getOldIndex() < 0 ||
!newParm.getName().equals(oldParameterNames[newParm.getOldIndex()])) {
!(newParm.getName().equals(oldParameterNames[newParm.getOldIndex()]) || newParm.getOldIndex() == i || newParm.getTypeText().equals(changeInfo.getOldParameterTypes()[newParm.getOldIndex()]))) {
newParameters.add(parameters[i]);
}
}
RefactoringUtil.fixJavadocsForParams(method, newParameters);
RefactoringUtil.fixJavadocsForParams(method, newParameters, new Condition<Pair<PsiParameter, String>>() {
@Override
public boolean value(Pair<PsiParameter, String> pair) {
final PsiParameter parameter = pair.first;
final String oldParamName = pair.second;
final int idx = Arrays.binarySearch(oldParameterNames, oldParamName);
return idx >= 0 && (parameter.getType().equalsToText(changeInfo.getOldParameterTypes()[idx]) || idx == method.getParameterList().getParameterIndex(parameter));
}
});
}
private static PsiParameter createNewParameter(JavaChangeInfo changeInfo, JavaParameterInfo newParm,
@@ -29,8 +29,6 @@ import com.intellij.refactoring.HelpID;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import java.util.Collection;
/**
* @author ven
*/
@@ -45,7 +45,6 @@ import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduceParameter.Util;
import com.intellij.refactoring.rename.NonCodeUsageInfoFactory;
import com.intellij.refactoring.rename.RenameJavaVariableProcessor;
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceSimpleDeleteUsageInfo;
import com.intellij.refactoring.util.*;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewDescriptor;
@@ -31,6 +31,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
@@ -42,6 +43,7 @@ import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.controlFlow.ControlFlowUtil;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.javadoc.PsiDocTagValue;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
@@ -889,6 +891,7 @@ public class RefactoringUtil {
final Iterable<PsiTypeParameter> parametersIterable,
final PsiSubstitutor substitutor,
final PsiElementFactory factory) {
final Map<PsiElement, PsiElement> replacement = new LinkedHashMap<PsiElement, PsiElement>();
for (PsiTypeParameter parameter : parametersIterable) {
PsiType substitutedType = substitutor.substitute(parameter);
if (substitutedType == null) {
@@ -898,12 +901,17 @@ public class RefactoringUtil {
final PsiElement element = reference.getElement();
final PsiElement parent = element.getParent();
if (parent instanceof PsiTypeElement) {
parent.replace(factory.createTypeElement(substitutedType));
replacement.put(parent, factory.createTypeElement(substitutedType));
} else if (element instanceof PsiJavaCodeReferenceElement && substitutedType instanceof PsiClassType) {
element.replace(factory.createReferenceElementByType((PsiClassType)substitutedType));
replacement.put(element, factory.createReferenceElementByType((PsiClassType)substitutedType));
}
}
}
for (PsiElement element : replacement.keySet()) {
if (element.isValid()) {
element.replace(replacement.get(element));
}
}
}
@Nullable
@@ -1046,6 +1054,12 @@ public class RefactoringUtil {
}
public static void fixJavadocsForParams(PsiMethod method, Set<PsiParameter> newParameters) throws IncorrectOperationException {
fixJavadocsForParams(method, newParameters, Condition.FALSE);
}
public static void fixJavadocsForParams(PsiMethod method,
Set<PsiParameter> newParameters,
Condition<Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
final PsiDocComment docComment = method.getDocComment();
if (docComment == null) return;
final PsiParameter[] parameters = method.getParameterList().getParameters();
@@ -1061,6 +1075,16 @@ public class RefactoringUtil {
break;
}
}
if (!found) {
for (PsiDocTag paramTag : paramTags) {
final String paramName = getNameOfReferencedParameter(paramTag);
if (eqCondition.value(new Pair<PsiParameter, String>(parameter, paramName))) {
tagForParam.put(parameter, paramTag);
found = true;
break;
}
}
}
if (!found && !newParameters.contains(parameter)) {
tagForParam.put(parameter, null);
}
@@ -1071,11 +1095,16 @@ public class RefactoringUtil {
if (tagForParam.containsKey(parameter)) {
final PsiDocTag psiDocTag = tagForParam.get(parameter);
if (psiDocTag != null) {
newTags.add((PsiDocTag)psiDocTag.copy());
final PsiDocTag copy = (PsiDocTag)psiDocTag.copy();
final PsiDocTagValue valueElement = copy.getValueElement();
if (valueElement != null) {
valueElement.replace(createParamTag(parameter).getValueElement());
}
newTags.add(copy);
}
}
else {
newTags.add(JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createParamTag(parameter.getName(), ""));
newTags.add(createParamTag(parameter));
}
}
PsiElement anchor = paramTags.length > 0 ? paramTags[0].getPrevSibling() : null;
@@ -1087,6 +1116,10 @@ public class RefactoringUtil {
}
}
private static PsiDocTag createParamTag(PsiParameter parameter) {
return JavaPsiFacade.getInstance(parameter.getProject()).getElementFactory().createParamTag(parameter.getName(), "");
}
public static PsiDirectory createPackageDirectoryInSourceRoot(PackageWrapper aPackage, final VirtualFile sourceRoot)
throws IncorrectOperationException {
final PsiDirectory[] directories = aPackage.getDirectories();
@@ -25,7 +25,7 @@ import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.vcs.FileStatus;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.psi.jsp.JspFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.usageView.UsageInfo;
@@ -48,7 +48,7 @@ public class ClassGroupingRule implements UsageGroupingRule {
}
final PsiElement psiElement = ((PsiElementUsage)usage).getElement();
final PsiFile containingFile = psiElement.getContainingFile();
PsiFile topLevelFile = InjectedLanguageUtil.getTopLevelFile(containingFile);
PsiFile topLevelFile = InjectedLanguageFacadeImpl.getTopLevelFile(containingFile);
if (!(topLevelFile instanceof PsiJavaFile) || topLevelFile instanceof JspFile) {
return null;
@@ -28,7 +28,7 @@ import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Segment;
import com.intellij.openapi.vcs.FileStatus;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.psi.util.PsiFormatUtilBase;
import com.intellij.psi.util.PsiTreeUtil;
@@ -51,7 +51,7 @@ public class MethodGroupingRule implements UsageGroupingRule {
if (!(usage instanceof PsiElementUsage)) return null;
PsiElement psiElement = ((PsiElementUsage)usage).getElement();
PsiFile containingFile = psiElement.getContainingFile();
PsiFile topLevelFile = InjectedLanguageUtil.getTopLevelFile(containingFile);
PsiFile topLevelFile = InjectedLanguageFacadeImpl.getTopLevelFile(containingFile);
if (topLevelFile instanceof PsiJavaFile) {
PsiElement containingMethod = topLevelFile == containingFile ? psiElement : InjectedLanguageManager
.getInstance(containingFile.getProject()).getInjectionHost(containingFile);
@@ -0,0 +1,3 @@
interface I {
<caret>
}
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class C {
/**
* Some method.
*
* @param value some (©)<caret> param.
*/
abstract void m(int value);
}
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class C {
/**
* Some method.
*
* @param value some (&copy;) param.
*/
abstract void m(int value);
}
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'id'" "true"
// "Create Field for Parameter 'id'" "true"
class Person {
private String __fname;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'test'" "true"
// "Create Field for Parameter 'test'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'length'" "true"
// "Create Field for Parameter 'length'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
private final int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
private static int p1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
private String[] myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test{
@@ -1,10 +0,0 @@
// "Create Field For Parameter 'p1'" "true"
class Test{
private String myP1;
<T extends String> void f(T p1){
myP1 = p1;
}
}
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test<T>{
private T myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test<T>{
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test{
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'name'" "true"
// "Create Field for Parameter 'name'" "true"
import org.jetbrains.annotations.NotNull;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'name'" "true"
// "Create Field for Parameter 'name'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
private Object myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
private String myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'id'" "true"
// "Create Field for Parameter 'id'" "true"
class Person {
private String __fname, __lname, __street;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'test'" "true"
// "Create Field for Parameter 'test'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'length'" "true"
// "Create Field for Parameter 'length'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
int myP2;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "false"
// "Create Field for Parameter 'p1'" "false"
class Test{
int myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
static void f(int p<caret>1){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
void f(String[] p<caret>1){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test{
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "false"
class Test{
<T extends String> void <caret>f(T p1){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "false"
// "Create Field for Parameter 'p1'" "false"
class Test{
private final String myP1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "false"
// "Create Field for Parameter 'p1'" "false"
class Test{
<T extends String> void <caret>f(){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test<T>{
void f(T p<caret>1){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test<T>{
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
import java.util.*;
class Test{
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'name'" "true"
// "Create Field for Parameter 'name'" "true"
import org.jetbrains.annotations.NotNull;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'name'" "true"
// "Create Field for Parameter 'name'" "true"
package codeInsight.createFieldFromParameterAction.test1;
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
<T> void f(T p<caret>1){
@@ -1,4 +1,4 @@
// "Create Field For Parameter 'p1'" "true"
// "Create Field for Parameter 'p1'" "true"
class Test{
<T extends String> void f(T p<caret>1){
@@ -0,0 +1,13 @@
class X {
/**
* Has a method called {@link #mymethod(int)}.
*/
public class TestRefactorLink {
/**
* @return nothing
* @param y yparam
*/
public void <caret>mymethod(int y) { }
}
}
@@ -0,0 +1,13 @@
class X {
/**
* Has a method called {@link #mymethod(boolean)}.
*/
public class TestRefactorLink {
/**
* @return nothing
* @param z yparam
*/
public void mymethod(boolean z) { }
}
}
@@ -5,7 +5,7 @@ public class Parent {
}
class Child extends Parent {
public void foo(float j, String s) {
public void foo(float j, String s ) {
}
void bar() {
@@ -0,0 +1,27 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package refactoring.changeSignatureGesture;
interface I {
void add(<caret>);
}
public class IImpl implements I {
public void add(){}
void foo() {
add();
}
}
@@ -0,0 +1,27 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package refactoring.changeSignatureGesture;
interface I {
void add(int x, int y);
}
public class IImpl implements I {
public void add(int x, int y){}
void foo() {
add(, );
}
}
@@ -1,7 +1,7 @@
class Test {
/**
* foo comment
* @param param
* @param param long description
*/
void foo(Param param) {
bar(param.getS());
@@ -0,0 +1,7 @@
interface Bar<T> { }
interface Base<T> { }
class Foo<T,U> implements Base<U> {
void fo<caret>o(Bar<U> bar) { }
}
@@ -0,0 +1,10 @@
interface Bar<T> { }
interface Base<T> {
void foo(Bar<T> bar);
}
class Foo<T,U> implements Base<U> {
@Override
public void foo(Bar<U> bar) { }
}
@@ -68,8 +68,8 @@ Full thread dump Java HotSpot(TM) 64-Bit Server VM (17.1-b03-307 mixed mode):
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:206)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:340)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:316)
at com.intellij.concurrency.JobUtil$3.call(JobUtil.java:134)
at com.intellij.concurrency.JobUtil$3.call(JobUtil.java:131)
at com.intellij.concurrency.JobLauncher$3.call(JobUtil.java:134)
at com.intellij.concurrency.JobLauncher$3.call(JobUtil.java:131)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
@@ -724,8 +724,8 @@ Java stack information for the threads listed above:
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:206)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:340)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:316)
at com.intellij.concurrency.JobUtil$3.call(JobUtil.java:134)
at com.intellij.concurrency.JobUtil$3.call(JobUtil.java:131)
at com.intellij.concurrency.JobLauncher$3.call(JobUtil.java:134)
at com.intellij.concurrency.JobLauncher$3.call(JobUtil.java:131)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
@@ -90,6 +90,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testNullInMethodCall() throws Exception { doTest(false); }
public void testNullInMethodCall2() throws Exception { doTest(false); }
public void testNewInMethodRefs() throws Exception { doTest(false); }
public void testAbstractInInterface() throws Exception { doTest(1, "abstract"); }
public void testTryInExpression() throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
@@ -5,6 +5,7 @@ import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase;
import com.intellij.codeInsight.generation.actions.CommentByBlockCommentAction;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
import com.intellij.openapi.application.ApplicationManager;
@@ -306,6 +307,31 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
}
}
public void testAutoImportAfterUncomment() throws Throwable {
@NonNls String text = "class S { /*ArrayList l; HashMap h; <caret>*/ }";
configureByText(StdFileTypes.JAVA, text);
boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
try {
doHighlighting();
assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
CommentByBlockCommentAction action = new CommentByBlockCommentAction();
action.actionPerformedImpl(getProject(), getEditor());
assertEmpty(highlightErrors());
assertNotSame(0, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
}
public void testAutoImportWorks() throws Throwable {
@NonNls final String text = "class S { JFrame x; <caret> }";
configureByText(StdFileTypes.JAVA, text);
@@ -325,6 +351,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase {
assertFalse(((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).canChangeFileSilently(getFile()));//CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
public void testAutoImportOfGenericReference() throws Throwable {
@NonNls final String text = "class S {{ new ArrayList<caret><> }}";
configureByText(StdFileTypes.JAVA, text);
@@ -0,0 +1,46 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
/**
* @author Danila Ponomarenko
*/
public class CreateAssignFieldsFromParametersTest extends LightIntentionActionTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.FIELD_NAME_PREFIX = "my";
}
@Override
protected void tearDown() throws Exception {
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.FIELD_NAME_PREFIX = "";
super.tearDown();
}
public void test() throws Exception { doAllTests(); }
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/createAssignFieldsFromParameters";
}
}
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.intention;
import com.intellij.JavaTestUtil;
@@ -22,7 +21,6 @@ import com.intellij.openapi.vfs.encoding.EncodingManager;
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
public class ConvertToBasicLatinTest extends JavaCodeInsightFixtureTestCase {
private String myIntention;
@@ -33,24 +31,19 @@ public class ConvertToBasicLatinTest extends JavaCodeInsightFixtureTestCase {
EncodingManager.getInstance().setDefaultCharsetName("UTF-8");
}
public void testConvertCharLiteral() throws Exception {
CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "CharLiteral.java", "CharLiteral_after.java");
}
public void testConvertStringLiteral() throws Exception {
CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "StringLiteral.java", "StringLiteral_after.java");
}
public void testConvertPlainComment() throws Exception {
CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "PlainComment.java", "PlainComment_after.java");
}
public void testConvertDocComment() throws Exception {
CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, "DocComment.java", "DocComment_after.java");
}
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/convertToBasicLatin/";
}
public void testCharLiteral() { doTest(); }
public void testStringLiteral() { doTest(); }
public void testPlainComment() { doTest(); }
public void testDocComment() { doTest(); }
public void testDocTag() { doTest(); }
private void doTest() {
final String name = getTestName(false);
CodeInsightTestUtil.doIntentionTest(myFixture, myIntention, name + ".java", name + "_after.java");
}
}
@@ -12,6 +12,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.cache.CacheManager;
import com.intellij.psi.impl.cache.TodoCacheManager;
import com.intellij.psi.impl.cache.impl.id.IdIndex;
import com.intellij.psi.impl.cache.impl.todo.TodoIndex;
import com.intellij.psi.search.GlobalSearchScope;
@@ -49,7 +50,7 @@ public class IdCacheTest extends CodeInsightTestCase{
}
public void testBuildCache() throws Exception {
checkCache(CacheManager.SERVICE.getInstance(myProject));
checkCache(CacheManager.SERVICE.getInstance(myProject), TodoCacheManager.SERVICE.getInstance(myProject));
}
public void testLoadCacheNoTodo() throws Exception {
@@ -62,7 +63,7 @@ public class IdCacheTest extends CodeInsightTestCase{
public void testUpdateCache1() throws Exception {
myRootDir.createChildData(null, "4.java");
Thread.sleep(1000);
checkCache(CacheManager.SERVICE.getInstance(myProject));
checkCache(CacheManager.SERVICE.getInstance(myProject), TodoCacheManager.SERVICE.getInstance(myProject));
}
public void testUpdateCache2() throws Exception {
@@ -73,6 +74,7 @@ public class IdCacheTest extends CodeInsightTestCase{
FileDocumentManager.getInstance().saveAllDocuments();
final CacheManager cache = CacheManager.SERVICE.getInstance(myProject);
final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
final GlobalSearchScope scope = GlobalSearchScope.projectScope(myProject);
checkResult(new String[] {"1.java"}, convert(cache.getFilesWithWord("xxx", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{}, convert(cache.getFilesWithWord("a", UsageSearchContext.ANY, scope, false)));
@@ -81,10 +83,10 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY,scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY,scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"3.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
public void testUpdateCache3() throws Exception {
@@ -92,6 +94,7 @@ public class IdCacheTest extends CodeInsightTestCase{
child.delete(null);
final CacheManager cache2 = CacheManager.SERVICE.getInstance(myProject);
final TodoCacheManager todocache2 = TodoCacheManager.SERVICE.getInstance(myProject);
final GlobalSearchScope scope = GlobalSearchScope.projectScope(myProject);
checkResult(ArrayUtil.EMPTY_STRING_ARRAY, convert(cache2.getFilesWithWord("xxx", UsageSearchContext.ANY, scope, false)));
checkResult(ArrayUtil.EMPTY_STRING_ARRAY, convert(cache2.getFilesWithWord("a", UsageSearchContext.ANY, scope, false)));
@@ -100,9 +103,9 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache2.getFilesWithWord("d", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache2.getFilesWithWord("e", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache2.getFilesWithTodoItems()));
assertEquals(0, cache2.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache2.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"3.java"}, convert(todocache2.getFilesWithTodoItems()));
assertEquals(0, todocache2.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache2.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
public void testUpdateCacheNoTodo() throws Exception {
@@ -118,11 +121,11 @@ public class IdCacheTest extends CodeInsightTestCase{
TodoConfiguration.getInstance().setTodoPatterns(new TodoPattern[]{pattern});
try{
final CacheManager cache = CacheManager.SERVICE.getInstance(myProject);
checkResult(new String[]{"2.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(1, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
checkResult(new String[]{"2.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(1, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
finally{
TodoConfiguration.getInstance().setTodoPatterns(oldPatterns);
@@ -131,11 +134,12 @@ public class IdCacheTest extends CodeInsightTestCase{
public void testFileModification() throws Exception {
final CacheManager cache = CacheManager.SERVICE.getInstance(myProject);
checkCache(cache);
final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
checkCache(cache, todocache);
VirtualFile child = myRootDir.findChild("1.java");
checkCache(cache);
checkCache(cache, todocache);
VfsUtil.saveText(child, "xxx");
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
@@ -148,15 +152,16 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"3.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
public void testFileDeletion() throws Exception {
final CacheManager cache = CacheManager.SERVICE.getInstance(myProject);
checkCache(cache);
final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
checkCache(cache, todocache);
VirtualFile child = myRootDir.findChild("1.java");
child.delete(null);
@@ -169,14 +174,15 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"3.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
public void testFileCreation() throws Exception {
final CacheManager cache = CacheManager.SERVICE.getInstance(myProject);
checkCache(cache);
final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
checkCache(cache, todocache);
VirtualFile child = myRootDir.createChildData(null, "4.java");
VfsUtil.saveText(child, "xxx //todo");
@@ -190,11 +196,11 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"1.java", "3.java", "4.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(1, cache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(1, cache.getTodoCount(myRootDir.findChild("4.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"1.java", "3.java", "4.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(1, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(1, todocache.getTodoCount(myRootDir.findChild("4.java"), TodoIndexPatternProvider.getInstance()));
}
public void testCrash() throws Exception {
@@ -203,7 +209,7 @@ public class IdCacheTest extends CodeInsightTestCase{
System.gc();
}
private void checkCache(CacheManager cache) {
private void checkCache(CacheManager cache, TodoCacheManager todocache) {
final GlobalSearchScope scope = GlobalSearchScope.projectScope(myProject);
checkResult(ArrayUtil.EMPTY_STRING_ARRAY, convert(cache.getFilesWithWord("xxx", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"1.java"}, convert(cache.getFilesWithWord("a", UsageSearchContext.ANY, scope, false)));
@@ -212,10 +218,10 @@ public class IdCacheTest extends CodeInsightTestCase{
checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY, scope, false)));
checkResult(new String[]{"1.java", "3.java"}, convert(cache.getFilesWithTodoItems()));
assertEquals(1, cache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, cache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, cache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
checkResult(new String[]{"1.java", "3.java"}, convert(todocache.getFilesWithTodoItems()));
assertEquals(1, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
}
private static VirtualFile[] convert(PsiFile[] psiFiles) {
@@ -233,7 +233,7 @@ public class UpdateCacheTest extends PsiTestCase{
}
public void testAddExcludeRoot() throws Exception{
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
ProjectRootManagerEx rootManager = (ProjectRootManagerEx)ProjectRootManager.getInstance(myProject);
final VirtualFile root = rootManager.getContentRoots()[0];
@@ -266,7 +266,7 @@ public class UpdateCacheTest extends PsiTestCase{
PsiTestUtil.addExcludedRoot(myModule, dir);
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
new WriteCommandAction.Simple(getProject()) {
@Override
@@ -278,7 +278,7 @@ public class UpdateCacheTest extends PsiTestCase{
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
@@ -324,7 +324,7 @@ public class UpdateCacheTest extends PsiTestCase{
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTestUtil.addSourceRoot(myModule, root);
@@ -338,7 +338,7 @@ public class UpdateCacheTest extends PsiTestCase{
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
final VirtualFile root = rootManager.getContentRoots()[0];
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
new WriteCommandAction.Simple(getProject()) {
@Override
@@ -350,7 +350,7 @@ public class UpdateCacheTest extends PsiTestCase{
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
@@ -423,7 +423,7 @@ public class UpdateCacheTest extends PsiTestCase{
ProjectRootManagerEx rootManager = (ProjectRootManagerEx)ProjectRootManager.getInstance(myProject);
final VirtualFile root = rootManager.getContentRoots()[0];
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches
new WriteCommandAction.Simple(getProject()) {
@Override
@@ -435,7 +435,7 @@ public class UpdateCacheTest extends PsiTestCase{
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches
PsiTestUtil.addExcludedRoot(myModule, root);
@@ -474,7 +474,7 @@ public class UpdateCacheTest extends PsiTestCase{
}
private void checkTodos(@NonNls String[] expectedFiles){
PsiSearchHelper helper = PsiSearchHelper.SERVICE.getInstance(myProject);
PsiTodoSearchHelper helper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);
PsiFile[] files = helper.findFilesWithTodoItems();
@@ -88,6 +88,10 @@ public class ChangeSignatureGestureTest extends LightCodeInsightFixtureTestCase
public void testOccurrencesInSameFile() {
doTypingTest("int param");
}
public void testMultiParams() {
doTypingTest("int x, int y");
}
public void testAddParameter2Constructor() {
doTypingTest("int param");
@@ -148,6 +148,12 @@ public class ChangeSignatureTest extends LightRefactoringTestCase {
}, false);
}
public void testParamJavadoc1() throws Exception {
doTest(null, new ParameterInfoImpl[]{
new ParameterInfoImpl(0, "z", PsiType.BOOLEAN)
}, false);
}
public void testSuperCallFromOtherMethod() throws Exception {
doTest(null, new ParameterInfoImpl[] {
new ParameterInfoImpl(-1, "nnn", PsiType.INT, "-222"),
@@ -115,6 +115,10 @@ public class PullUpTest extends LightRefactoringTestCase {
doTest(false, new RefactoringTestUtil.MemberDescriptor("I", PsiClass.class));
}
public void testTypeParamsConflictingNames() throws Exception {
doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
}
private void doTest(RefactoringTestUtil.MemberDescriptor... membersToFind) throws Exception {
doTest(true, membersToFind);
}
@@ -80,7 +80,7 @@ public class JarVersionDetectionUtil {
return null;
}
try {
final ZipEntry zipEntry = zipFile.getEntry(JarFile.MANIFEST_NAME);
final com.intellij.openapi.vfs.JarFile.JarEntry zipEntry = zipFile.getEntry(JarFile.MANIFEST_NAME);
if (zipEntry == null) {
return null;
}
@@ -25,7 +25,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.testFramework.ExpectedHighlightingData;
import com.intellij.testFramework.FileTreeAccessFilter;
import com.intellij.testFramework.HighlightTestInfo;
@@ -144,7 +144,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
PsiFile file = getFile();
if (editor instanceof EditorWindow) {
editor = ((EditorWindow)editor).getDelegate();
file = InjectedLanguageUtil.getTopLevelFile(file);
file = InjectedLanguageFacadeImpl.getTopLevelFile(file);
}
return CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, toIgnore, false);
@@ -29,7 +29,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageFacadeImpl;
import com.intellij.rt.execution.junit.FileComparisonFailure;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.IncorrectOperationException;
@@ -107,7 +107,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
}
public static Pair<String, Boolean> parseActionHint(final PsiFile file, String contents, @NonNls @RegExp String actionPattern) {
PsiFile hostFile = InjectedLanguageUtil.getTopLevelFile(file);
PsiFile hostFile = InjectedLanguageFacadeImpl.getTopLevelFile(file);
final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage());
String comment = commenter.getLineCommentPrefix();
@@ -2,6 +2,8 @@ package org.jetbrains.jps.incremental;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -14,6 +16,7 @@ import org.jetbrains.jps.incremental.messages.FileGeneratedEvent;
import org.jetbrains.jps.incremental.messages.ProgressMessage;
import org.jetbrains.jps.incremental.messages.UptoDateFilesSavedEvent;
import org.jetbrains.jps.incremental.storage.BuildDataManager;
import org.jetbrains.jps.incremental.storage.ModuleOutputRootsLayout;
import org.jetbrains.jps.incremental.storage.SourceToOutputMapping;
import org.jetbrains.jps.incremental.storage.Timestamps;
import org.jetbrains.jps.server.ProjectDescriptor;
@@ -350,17 +353,20 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
for (Module module : chunk.getModules()) {
if (isProjectRebuild()) {
markDirtyFiles(module, myTimestamps, true, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, null);
updateOutputRootsLayout(module);
}
else {
if (isMake()) {
if (myProjectDescriptor.fsState.markInitialScanPerformed(module.getName(), isCompilingTests())) {
initModuleFSState(module);
updateOutputRootsLayout(module);
}
}
else {
// forced compilation mode
if (getScope().isRecompilationForced(module.getName())) {
markDirtyFiles(module, myTimestamps, true, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, null);
updateOutputRootsLayout(module);
}
}
}
@@ -368,9 +374,24 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
}
private void initModuleFSState(Module module) throws IOException {
final HashSet<File> currentFiles = new HashSet<File>();
markDirtyFiles(module, myTimestamps, false, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, currentFiles);
boolean forceMarkDirty = false;
final File currentOutput = getProjectPaths().getModuleOutputDir(module, isCompilingTests());
if (currentOutput != null) {
Pair<String, String> outputsPair = getDataManager().getOutputRootsLayout().getState(module.getName());
if (outputsPair != null) {
final String previousPath = isCompilingTests() ? outputsPair.second : outputsPair.first;
forceMarkDirty = StringUtil.isEmpty(previousPath) || !FileUtil.filesEqual(currentOutput, new File(previousPath));
}
else {
forceMarkDirty = true;
}
}
final HashSet<File> currentFiles = new HashSet<File>();
markDirtyFiles(module, myTimestamps, forceMarkDirty, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, currentFiles);
// handle deleted paths
myProjectDescriptor.fsState.clearDeletedPaths(module.getName(), isCompilingTests());
final SourceToOutputMapping sourceToOutputMap = getDataManager().getSourceToOutputMap(module.getName(), isCompilingTests());
for (final Iterator<String> it = sourceToOutputMap.getKeysIterator(); it.hasNext();) {
final String path = it.next();
@@ -382,6 +403,27 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
}
}
private void updateOutputRootsLayout(Module module) throws IOException {
final File currentOutput = getProjectPaths().getModuleOutputDir(module, isCompilingTests());
if (currentOutput == null) {
return;
}
final ModuleOutputRootsLayout outputRootsLayout = getDataManager().getOutputRootsLayout();
Pair<String, String> outputsPair = outputRootsLayout.getState(module.getName());
// update data
final String productionPath;
final String testPath;
if (isCompilingTests()) {
productionPath = outputsPair != null? outputsPair.first : "";
testPath = FileUtil.toSystemIndependentName(currentOutput.getPath());
}
else {
productionPath = FileUtil.toSystemIndependentName(currentOutput.getPath());
testPath = outputsPair != null? outputsPair.second : "";
}
outputRootsLayout.update(module.getName(), Pair.create(productionPath, testPath));
}
public boolean hasRemovedSources() {
final Map<String, Collection<String>> removed = Utils.REMOVED_SOURCES_KEY.get(this);
return removed != null && !removed.isEmpty();
@@ -447,7 +489,6 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
continue;
}
myProjectDescriptor.fsState.clearRecompile(rd);
myProjectDescriptor.fsState.clearDeletedPaths(module.getName(), isCompilingTests());
traverseRecursively(rd, rd.root, excludes, tsStorage, forceMarkDirty, currentFiles);
}
}
@@ -218,6 +218,22 @@ public class IncProjectBuilder {
context.processMessage(new ProgressMessage("Running 'after' tasks"));
runTasks(context, myBuilderRegistry.getAfterTasks());
// cleanup output roots layout, commented for efficiency
//final ModuleOutputRootsLayout outputRootsLayout = context.getDataManager().getOutputRootsLayout();
//try {
// final Iterator<String> keysIterator = outputRootsLayout.getKeysIterator();
// final Map<String, Module> modules = myProjectDescriptor.project.getModules();
// while (keysIterator.hasNext()) {
// final String moduleName = keysIterator.next();
// if (modules.containsKey(moduleName)) {
// outputRootsLayout.remove(moduleName);
// }
// }
//}
//catch (IOException e) {
// throw new ProjectBuildException(e);
//}
}
finally {
for (ProjectLevelBuilder builder : myBuilderRegistry.getProjectLevelBuilders()) {

Some files were not shown because too many files have changed in this diff Show More