mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
Merge remote-tracking branch 'origin/master' into vlan/cond-resolve
This commit is contained in:
-5
@@ -55,7 +55,6 @@
|
||||
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLibraryCustomView" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMangledCRLF" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintManifestOrder" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMenuTitle" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -527,9 +526,6 @@
|
||||
<inspection_tool class="PointlessBitwiseExpressionJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpression" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
@@ -698,7 +694,6 @@
|
||||
<inspection_tool class="ShiftOutOfRangeJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Since15" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="SingletonInjectsScoped" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SocketResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="insideTryAllowed" value="false" />
|
||||
|
||||
@@ -529,9 +529,6 @@
|
||||
<inspection_tool class="PointlessBitwiseExpressionJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpression" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
@@ -672,7 +669,6 @@
|
||||
<inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableConditionalExpression" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Since15" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="SingletonInjectsScoped" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SocketResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="insideTryAllowed" value="false" />
|
||||
|
||||
Generated
+9
-8
@@ -51,8 +51,8 @@
|
||||
<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$/python/educational/course-creator/course-creator.iml" filepath="$PROJECT_DIR$/python/educational/course-creator/course-creator.iml" group="plugins/python/educational/educational-core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/edu/course-creator-python/course-creator-python.iml" filepath="$PROJECT_DIR$/python/edu/course-creator-python/course-creator-python.iml" group="plugins/python/educational/python-educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-core/course-creator/course-creator.iml" filepath="$PROJECT_DIR$/python/educational-core/course-creator/course-creator.iml" group="plugins/python/educational/educational-core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-python/course-creator-python/course-creator-python.iml" filepath="$PROJECT_DIR$/python/educational-python/course-creator-python/course-creator-python.iml" group="plugins/python/educational/educational-python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/coverage/coverage.iml" filepath="$PROJECT_DIR$/plugins/coverage/coverage.iml" group="plugins/coverage" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/coverage-common/coverage-common.iml" filepath="$PROJECT_DIR$/plugins/coverage-common/coverage-common.iml" group="plugins/coverage" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/coverage/coverage_rt/coverage_rt.iml" filepath="$PROJECT_DIR$/plugins/coverage/coverage_rt/coverage_rt.iml" group="plugins/coverage" />
|
||||
@@ -82,7 +82,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/editor-ui-api/editor-ui-api.iml" filepath="$PROJECT_DIR$/platform/editor-ui-api/editor-ui-api.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/editor-ui-ex/editor-ui-ex.iml" filepath="$PROJECT_DIR$/platform/editor-ui-ex/editor-ui-ex.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/editorconfig/editorconfig.iml" filepath="$PROJECT_DIR$/plugins/editorconfig/editorconfig.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational/educational.iml" filepath="$PROJECT_DIR$/python/educational/educational.iml" group="plugins/python/educational/educational-core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-core/educational-core.iml" filepath="$PROJECT_DIR$/python/educational-core/educational-core.iml" group="plugins/python/educational/educational-core" />
|
||||
<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" />
|
||||
@@ -114,8 +114,8 @@
|
||||
<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/IntelliLang/intellilang-jps-plugin/intellilang-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/intellilang-jps-plugin/intellilang-jps-plugin.iml" group="jps" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational/interactive-learning/interactive-learning.iml" filepath="$PROJECT_DIR$/python/educational/interactive-learning/interactive-learning.iml" group="plugins/python/educational/educational-core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/edu/interactive-learning-python/interactive-learning-python.iml" filepath="$PROJECT_DIR$/python/edu/interactive-learning-python/interactive-learning-python.iml" group="plugins/python/educational/python-educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-core/student/student.iml" filepath="$PROJECT_DIR$/python/educational-core/student/student.iml" group="plugins/python/educational/educational-core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-python/student-python/student-python.iml" filepath="$PROJECT_DIR$/python/educational-python/student-python/student-python.iml" group="plugins/python/educational/educational-python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/ipnb/ipnb.iml" filepath="$PROJECT_DIR$/python/ipnb/ipnb.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-analysis-api/java-analysis-api.iml" filepath="$PROJECT_DIR$/java/java-analysis-api/java-analysis-api.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-analysis-impl/java-analysis-impl.iml" filepath="$PROJECT_DIR$/java/java-analysis-impl/java-analysis-impl.iml" group="java" />
|
||||
@@ -164,7 +164,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/android/android/main_AndroidStudio.iml" filepath="$PROJECT_DIR$/android/android/main_AndroidStudio.iml" group="android" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/main_idea_python_plugin.iml" filepath="$PROJECT_DIR$/python/main_idea_python_plugin.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/main_pycharm_ce.iml" filepath="$PROJECT_DIR$/python/main_pycharm_ce.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/edu/main_pycharm_edu.iml" filepath="$PROJECT_DIR$/python/edu/main_pycharm_edu.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-python/main_pycharm_edu.iml" filepath="$PROJECT_DIR$/python/educational-python/main_pycharm_edu.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/manifest/manifest.iml" filepath="$PROJECT_DIR$/java/manifest/manifest.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android/tools-base/build-system/manifest-merger/manifest-merger.iml" filepath="$PROJECT_DIR$/android/tools-base/build-system/manifest-merger/manifest-merger.iml" group="android/sdktools" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven.iml" filepath="$PROJECT_DIR$/plugins/maven/maven.iml" group="plugins/maven" />
|
||||
@@ -201,8 +201,8 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/python/pluginJava/python-community-plugin-java.iml" filepath="$PROJECT_DIR$/python/pluginJava/python-community-plugin-java.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/python-community-plugin-resources.iml" filepath="$PROJECT_DIR$/python/python-community-plugin-resources.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/testSrc/python-community-tests.iml" filepath="$PROJECT_DIR$/python/testSrc/python-community-tests.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/edu/build/python-edu-build.iml" filepath="$PROJECT_DIR$/python/edu/build/python-edu-build.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/edu/python-educational.iml" filepath="$PROJECT_DIR$/python/edu/python-educational.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-python/build/python-edu-build.iml" filepath="$PROJECT_DIR$/python/educational-python/build/python-edu-build.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/educational-python/educational-python.iml" filepath="$PROJECT_DIR$/python/educational-python/educational-python.iml" group="python/educational" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/python-helpers.iml" filepath="$PROJECT_DIR$/python/python-helpers.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/ide/python-ide-community.iml" filepath="$PROJECT_DIR$/python/ide/python-ide-community.iml" group="python" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/openapi/python-openapi.iml" filepath="$PROJECT_DIR$/python/openapi/python-openapi.iml" group="python" />
|
||||
@@ -214,6 +214,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/remote-servers/agent-rt/remote-servers-agent-rt.iml" filepath="$PROJECT_DIR$/platform/remote-servers/agent-rt/remote-servers-agent-rt.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/remote-servers/api/remote-servers-api.iml" filepath="$PROJECT_DIR$/platform/remote-servers/api/remote-servers-api.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/remote-servers-git/remote-servers-git.iml" filepath="$PROJECT_DIR$/plugins/git4idea/remote-servers-git/remote-servers-git.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/remote-servers-git-java/remote-servers-git-java.iml" filepath="$PROJECT_DIR$/plugins/git4idea/remote-servers-git-java/remote-servers-git-java.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/remote-servers/impl/remote-servers-impl.iml" filepath="$PROJECT_DIR$/platform/remote-servers/impl/remote-servers-impl.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/remote-servers/api/remote-servers-java-api.iml" filepath="$PROJECT_DIR$/java/remote-servers/api/remote-servers-java-api.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/remote-servers/impl/remote-servers-java-impl.iml" filepath="$PROJECT_DIR$/java/remote-servers/impl/remote-servers-java-impl.iml" group="java" />
|
||||
|
||||
@@ -5,4 +5,4 @@ IDC_WINLAUNCHER=__IDE-NAME___LAUNCHER
|
||||
IDS_PROPS_ENV_VAR=__IDE-NAME___PROPERTIES
|
||||
IDS_VM_OPTIONS_ENV_VAR=__IDE-NAME___VM_OPTIONS
|
||||
IDS_ERROR_LAUNCHING_APP=Error launching __IDE-NAME__
|
||||
IDS_VM_OPTIONS=-Didea.paths.selector=__PRODUCT_PATHS_SELECTOR__
|
||||
IDS_VM_OPTIONS=-Didea.paths.selector=__PRODUCT_PATHS_SELECTOR__ -Didea.jre.check=true
|
||||
|
||||
@@ -6,4 +6,4 @@ IDC_WINLAUNCHER=__IDE-NAME___LAUNCHER
|
||||
IDS_PROPS_ENV_VAR=__IDE-NAME___PROPERTIES
|
||||
IDS_VM_OPTIONS_ENV_VAR=__IDE-NAME__64_VM_OPTIONS
|
||||
IDS_ERROR_LAUNCHING_APP=Error launching __IDE-NAME__
|
||||
IDS_VM_OPTIONS=-Didea.paths.selector=__PRODUCT_PATHS_SELECTOR__
|
||||
IDS_VM_OPTIONS=-Didea.paths.selector=__PRODUCT_PATHS_SELECTOR__ -Didea.jre.check=true
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<string>@@class_path@@</string>
|
||||
|
||||
<key>JVMVersion</key>
|
||||
<string>1.6*,1.7+</string>
|
||||
<string>1.8*,1.8+</string>
|
||||
|
||||
<key>MainClass</key>
|
||||
<string>com.intellij.idea.Main</string>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
!define INSTALL_OPTION_ELEMENTS 4
|
||||
|
||||
|
||||
Function customInstallActions
|
||||
DetailPrint "There are no custom install actions."
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function ConfirmDesktopShortcut
|
||||
!insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 1" "Text" "$(create_desktop_shortcut)"
|
||||
call winVersion
|
||||
${If} $0 == "1"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Type" "Label"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" ""
|
||||
${Else}
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "$(create_quick_launch_shortcut)"
|
||||
${EndIf}
|
||||
StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
|
||||
StrCpy $R0 3
|
||||
push "${ASSOCIATION}"
|
||||
loop:
|
||||
call SplitStr
|
||||
Pop $0
|
||||
StrCmp $0 "" done
|
||||
IntOp $R0 $R0 + 1
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0"
|
||||
goto loop
|
||||
skip_association:
|
||||
StrCpy $R0 2
|
||||
call winVersion
|
||||
${If} $0 == "1"
|
||||
IntOp $R0 $R0 - 1
|
||||
${EndIf}
|
||||
done:
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0"
|
||||
!insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini"
|
||||
FunctionEnd
|
||||
+12
-49
@@ -12,7 +12,6 @@
|
||||
; thus ${PRODUCT_WITH_VER} is used for uninstall registry information
|
||||
!define PRODUCT_REG_VER "${MUI_PRODUCT}\${VER_BUILD}"
|
||||
|
||||
!define INSTALL_OPTION_ELEMENTS 4
|
||||
Name "${MUI_PRODUCT}"
|
||||
SetCompressor lzma
|
||||
; http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
|
||||
@@ -28,6 +27,8 @@ RequestExecutionLevel user
|
||||
!include StrFunc.nsh
|
||||
!include LogicLib.nsh
|
||||
|
||||
!include "customInstallActions.nsi"
|
||||
|
||||
${UnStrStr}
|
||||
${UnStrLoc}
|
||||
${UnStrRep}
|
||||
@@ -686,9 +687,9 @@ FunctionEnd
|
||||
|
||||
Function ProductRegistration
|
||||
StrCmp "${PRODUCT_WITH_VER}" "${MUI_PRODUCT} ${VER_BUILD}" eapInfo releaseInfo
|
||||
eapInfo:
|
||||
eapInfo:
|
||||
StrCpy $3 "${PRODUCT_WITH_VER}(EAP)"
|
||||
goto createRegistration
|
||||
goto createRegistration
|
||||
releaseInfo:
|
||||
StrCpy $3 "${PRODUCT_WITH_VER}"
|
||||
createRegistration:
|
||||
@@ -742,31 +743,34 @@ Section "IDEA Files" CopyIdeaFiles
|
||||
skip_desktop_shortcut:
|
||||
; OS is not win7
|
||||
Call winVersion
|
||||
${If} $0 == "0"
|
||||
${If} $0 == "0"
|
||||
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 2" "State"
|
||||
StrCmp $R2 1 "" skip_quicklaunch_shortcut
|
||||
CreateShortCut "$QUICKLAUNCH\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \
|
||||
"$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" "" SW_SHOWNORMAL
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
skip_quicklaunch_shortcut:
|
||||
!insertmacro INSTALLOPTIONS_READ $R1 "Desktop.ini" "Settings" "NumFields"
|
||||
IntCmp $R1 ${INSTALL_OPTION_ELEMENTS} do_association done do_association
|
||||
do_association:
|
||||
StrCpy $R2 ${INSTALL_OPTION_ELEMENTS}
|
||||
StrCpy $R2 ${INSTALL_OPTION_ELEMENTS}
|
||||
get_user_choice:
|
||||
!insertmacro INSTALLOPTIONS_READ $R3 "Desktop.ini" "Field $R2" "State"
|
||||
StrCmp $R3 1 "" next_association
|
||||
!insertmacro INSTALLOPTIONS_READ $R4 "Desktop.ini" "Field $R2" "Text"
|
||||
call ProductAssociation
|
||||
next_association:
|
||||
next_association:
|
||||
IntOp $R2 $R2 + 1
|
||||
IntCmp $R1 $R2 get_user_choice done get_user_choice
|
||||
|
||||
done:
|
||||
|
||||
Call customInstallActions
|
||||
|
||||
;registration application to be presented in Open With list
|
||||
call ProductRegistration
|
||||
;reset icon cache
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
; $STARTMENU_FOLDER stores name of IDEA folder in Start Menu,
|
||||
; save it name in the "MenuFolder" RegValue
|
||||
@@ -864,47 +868,6 @@ skip_properties:
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Descriptions of sections
|
||||
;------------------------------------------------------------------------------
|
||||
; LangString DESC_CopyRuntime ${LANG_ENGLISH} "${MUI_PRODUCT} files"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; custom install pages
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
Function ConfirmDesktopShortcut
|
||||
!insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 1" "Text" "$(create_desktop_shortcut)"
|
||||
call winVersion
|
||||
${If} $0 == "1"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Type" "Label"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" ""
|
||||
${Else}
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "$(create_quick_launch_shortcut)"
|
||||
${EndIf}
|
||||
StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
|
||||
StrCpy $R0 3
|
||||
push "${ASSOCIATION}"
|
||||
loop:
|
||||
call SplitStr
|
||||
Pop $0
|
||||
StrCmp $0 "" done
|
||||
IntOp $R0 $R0 + 1
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0"
|
||||
goto loop
|
||||
skip_association:
|
||||
StrCpy $R0 2
|
||||
call winVersion
|
||||
${If} $0 == "1"
|
||||
IntOp $R0 $R0 - 1
|
||||
${EndIf}
|
||||
done:
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0"
|
||||
!insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini"
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; custom uninstall functions
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,6 +70,9 @@ def loadProductProperties(String home, String buildNumber) {
|
||||
throw new BuildException("No product specific properties file found at: " + productPropertiesPath)
|
||||
}
|
||||
setProperty("productProperties", includeFile(productPropertiesPath).getProperties(home, buildNumber))
|
||||
productProperties.ideJvmArgs = productProperties.ideJvmArgs != null ?
|
||||
productProperties.ideJvmArgs + " -Didea.jre.check=true" :
|
||||
"-Didea.jre.check=true"
|
||||
}
|
||||
|
||||
target(compile: "Compile project") {
|
||||
@@ -204,9 +207,11 @@ def layoutAll(Map args, String home, String out, Paths _paths = null, buildJps =
|
||||
buildMacZip(macAppRoot, macZip, [paths.distAll], paths.distMac, productProperties.extraMacBins)
|
||||
|
||||
buildTarGz(linuxAppRoot, "$paths.artifacts/${archiveName}-no-jdk.tar", [paths.distAll, paths.distUnix], productProperties.extraLinuxBins)
|
||||
requireProperty("jdk.linux", "false")
|
||||
if (p("jdk.linux") != "false") {
|
||||
buildTarGz(linuxAppRoot, "$paths.artifacts/${archiveName}.tar", [paths.distAll, paths.distUnix, "${paths.sandbox}/jdk.linux"], ["jre/jre/bin/*"] + productProperties.extraLinuxBins)
|
||||
}
|
||||
requireProperty("jdk.custom.linux", "false")
|
||||
if (p("jdk.custom.linux") != "false") {
|
||||
buildTarGz(linuxAppRoot, "$paths.artifacts/${archiveName}-custom-jdk-linux.tar", [paths.distAll, paths.distUnix, "${paths.sandbox}/jdk.custom.linux"], ["jre/jre/bin/*"] + productProperties.extraLinuxBins)
|
||||
}
|
||||
@@ -263,6 +268,7 @@ private layoutMac(Map _args, String home, Paths paths) {
|
||||
</dict>
|
||||
"""
|
||||
args."idea.properties.path" = "${paths.distAll}/bin/idea.properties"
|
||||
args."idea.properties" = ["idea.jre.check": true];
|
||||
args.urlSchemes = ["idea"]
|
||||
args.mac_no_yjp = true
|
||||
args.executable = prefix
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ import com.intellij.util.text.VersionComparatorUtil
|
||||
import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
|
||||
includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
|
||||
|
||||
String kotlinBuildConfigurationOnPublicTeamCity = "Kotlin_Beta4_Idea142branch150versionNoTests"
|
||||
String kotlinBuildConfigurationOnPublicTeamCity = "Kotlin_Rc_Idea142branch150versionNoTests"
|
||||
|
||||
target('default': 'Ensures that build/kotlinc directory contains JARs from Kotlin plugin compatible with current IDEA sources. These JARs are used by build scripts.') {
|
||||
def communityHome = guessHome(this)
|
||||
|
||||
@@ -454,6 +454,7 @@ public def layoutCommunityPlugins(String home, boolean maySkipAndroidPlugin = fa
|
||||
}
|
||||
jar("remote-servers-git.jar") {
|
||||
moduleOptional("remote-servers-git")
|
||||
moduleOptional("remote-servers-git-java")
|
||||
}
|
||||
fileset(dir: "$home/plugins/git4idea/lib") {
|
||||
include(name: "trilead-ssh2.jar")
|
||||
|
||||
@@ -22,12 +22,9 @@ def nsis_installer(pathsToInclude, stringsFile, pathsFile, outNamePrefix, includ
|
||||
ant.mkdir(dir: "$box/nsiconf")
|
||||
|
||||
if (!hasBundledJRE) {
|
||||
ant.mkdir(dir: "$box/jre")
|
||||
ant.unzip(dest: "$box/jre", src: winJDK)
|
||||
|
||||
ant.copy(todir: "$box/bin") {
|
||||
fileset(dir: "$box/jre/jre/bin") {
|
||||
include(name: "msvcr71.dll")
|
||||
fileset(dir: "${box}/jdk.win/jre") {
|
||||
include(name: "**/msvcr71.dll")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,12 +57,7 @@ def nsis_installer(pathsToInclude, stringsFile, pathsFile, outNamePrefix, includ
|
||||
}
|
||||
fileset(dir: box, includes: "bin/msvcr71.dll")
|
||||
if (!hasBundledJRE) {
|
||||
fileset(dir: box, includes: "jre/**/*")
|
||||
if (includeToolsJar) {
|
||||
fileset(dir: box) {
|
||||
include(name: "jre/lib/tools.jar")
|
||||
}
|
||||
}
|
||||
fileset(dir: "${box}/jdk.win", includes: "jre/**/*")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-15
@@ -495,7 +495,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
|
||||
String archs = """
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>"""
|
||||
(args.archs != null ? args.archs : ["x86_64", "i386"]).each {
|
||||
(args.archs != null ? args.archs : ["x86_64"]).each {
|
||||
archs += "<string>${it}</string>"
|
||||
}
|
||||
archs +="</array>\n"
|
||||
@@ -873,34 +873,39 @@ binding.setVariable("signExecutableFiles", { String binDir ->
|
||||
})
|
||||
|
||||
binding.setVariable("bundledJDKs"){
|
||||
bundledJDK(false)
|
||||
}
|
||||
|
||||
binding.setVariable("bundledJDK64s"){
|
||||
bundledJDK(true)
|
||||
}
|
||||
|
||||
private bundledJDK(boolean win64) {
|
||||
requireProperty("artifact.linux.no.jdk", "true")
|
||||
requireProperty("artifact.mac.no.jdk", "true")
|
||||
requireProperty("jdk.win", "1.8")
|
||||
requireProperty("jdk.mac", "1.8")
|
||||
requireProperty("jdk.win", "jdk1.8")
|
||||
requireProperty("jdk.mac", "openjdk.1.8")
|
||||
requireProperty("jdk.linux", "1.8")
|
||||
requireProperty("jdk.custom.linux", "1.8")
|
||||
requireProperty("jdk.custom.linux", "openjdk.1.8")
|
||||
|
||||
if (new File("${home}/build/jdk").exists()) {
|
||||
if (p("jdk.win") != "false") {
|
||||
setProperty("winJDK", getPathToBundledJDK(new File("${home}/build/jdk/win"), "jdk" + p("jdk.win"), "x32.zip"))
|
||||
setProperty("winJDK", getPathToBundledJDK(new File("${home}/build/jdk/win"), p("jdk.win"), (win64 ? "x64.zip": "x32.zip") ))
|
||||
extractRedistJre(winJDK, "${paths.sandbox}/jdk.win/jre")
|
||||
}
|
||||
if (p("jdk.linux") != "false") {
|
||||
setProperty("linuxJDK", getPathToBundledJDK(new File("${home}/build/jdk/linux"), "jdk" + p("jdk.linux"), ".tar"))
|
||||
extractRedistJre(linuxJDK, "${paths.sandbox}/jdk.linux/jre")
|
||||
}
|
||||
def customJdkDir = new File("${home}/build/jdk/custom")
|
||||
def customJdkDir = new File("${home}/build/jdk/mac/custom")
|
||||
if (p("jdk.mac") != "false" && (customJdkDir.exists() && customJdkDir.isDirectory())) {
|
||||
setProperty("macCustomJDK", getPathToBundledJDK(customJdkDir, "openjdk.1.8", ".tar.gz"))
|
||||
setProperty("macCustomJDK", getPathToBundledJDK(customJdkDir, p("jdk.mac"), ".tar.gz"))
|
||||
}
|
||||
customJdkDir = new File("${home}/build/jdk/custom/linux")
|
||||
customJdkDir = new File("${home}/build/jdk/linux/custom")
|
||||
if (p("jdk.custom.linux") != "false" && (customJdkDir.exists() && customJdkDir.isDirectory())) {
|
||||
setProperty("linuxCustomJDK", getPathToBundledJDK(customJdkDir, "openjdk.1.8", ".tar.gz"))
|
||||
setProperty("linuxCustomJDK", getPathToBundledJDK(customJdkDir, p("jdk.custom.linux"), ".tar.gz"))
|
||||
extractRedistJre(linuxCustomJDK, "${paths.sandbox}/jdk.custom.linux")
|
||||
}
|
||||
/* if (p("jdk.bundled.mac") != "false") {
|
||||
setProperty("macJDK", getPathToBundledJDK(new File("${home}/build/jdk/mac"), "jdk" + p("jdk.bundled.mac"), ".tar"))
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1187,9 +1192,12 @@ binding.setVariable("collectUsedJars", { List modules, List approvedJars, List f
|
||||
return usedJars
|
||||
})
|
||||
|
||||
final def javaRT = "java-runtime" // that is used by build system in "buildSearchableOptions"
|
||||
|
||||
binding.setVariable("buildModulesAndCollectUsedJars", { List modules, List approvedJars, List forbiddenJars ->
|
||||
def modulesToBuild = []
|
||||
def usedJars = collectUsedJars(modules, approvedJars, forbiddenJars, modulesToBuild)
|
||||
def modulesNames = modules.contains(javaRT) ? modules : [*modules, javaRT]
|
||||
def usedJars = collectUsedJars(modulesNames, approvedJars, forbiddenJars, modulesToBuild)
|
||||
clearBuildCaches()
|
||||
projectBuilder.cleanOutput()
|
||||
projectBuilder.buildModules(modulesToBuild)
|
||||
@@ -1199,7 +1207,8 @@ binding.setVariable("buildModulesAndCollectUsedJars", { List modules, List appro
|
||||
|
||||
binding.setVariable("buildSearchableOptions", { String target, List licenses, Closure cp, String jvmArgs = null,
|
||||
def paths = getProperty("paths") ->
|
||||
projectBuilder.stage("Building searchable options")
|
||||
def pathToJRT = "${projectBuilder.moduleOutput(findModule(javaRT))}"
|
||||
projectBuilder.stage("Building searchable options JRT:" + pathToJRT)
|
||||
|
||||
String targetFile = "${target}/searchableOptions.xml"
|
||||
ant.delete(file: targetFile)
|
||||
@@ -1228,7 +1237,7 @@ binding.setVariable("buildSearchableOptions", { String target, List licenses, Cl
|
||||
arg(value: "${target}/searchableOptions.xml")
|
||||
|
||||
classpath() {
|
||||
pathelement(location: "${projectBuilder.moduleOutput(findModule("java-runtime"))}")
|
||||
pathelement(location: "${pathToJRT}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -117,9 +117,10 @@
|
||||
<orderEntry type="module" module-name="diff-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="built-in-server-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="updater" scope="TEST" />
|
||||
<orderEntry type="module" module-name="coverage" scope="TEST" />
|
||||
<orderEntry type="module" module-name="coverage" />
|
||||
<orderEntry type="module" module-name="android-gradle-jps" scope="TEST" />
|
||||
<orderEntry type="module" module-name="android-jps-plugin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="script-debugger-ui" scope="TEST" />
|
||||
<orderEntry type="module" module-name="remote-servers-git-java" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -80,6 +80,7 @@ com.android.tools.idea.editors.theme.ThemeEditorStyleTest
|
||||
com.android.tools.idea.editors.theme.ThemeEditorUtilsTest
|
||||
com.android.tools.idea.editors.theme.qualifiers.QualifierUtilsTest
|
||||
com.android.tools.idea.gradle.IdeaAndroidProjectTest
|
||||
com.android.tools.idea.gradle.project.AndroidGradleProjectImportingTest
|
||||
com.android.tools.idea.gradle.project.GradleProjectSyncDataTest
|
||||
com.android.tools.idea.npw.ConfigureAndroidModuleStepTest
|
||||
com.android.tools.idea.npw.ConfigureAndroidModuleStepDynamicTest
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -46,6 +46,7 @@ import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -74,7 +75,7 @@ import java.util.*;
|
||||
name = "CompilerConfiguration",
|
||||
storages = {
|
||||
@Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
@Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED)
|
||||
@Storage(file = "compiler.xml", scheme = StorageScheme.DIRECTORY_BASED)
|
||||
}
|
||||
)
|
||||
public class CompilerConfigurationImpl extends CompilerConfiguration implements PersistentStateComponent<Element>, ProjectComponent {
|
||||
@@ -82,6 +83,9 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
public static final String TESTS_EXTERNAL_COMPILER_HOME_PROPERTY_NAME = "tests.external.compiler.home";
|
||||
public static final int DEFAULT_BUILD_PROCESS_HEAP_SIZE = 700;
|
||||
|
||||
private static final List<String> DEFAULT_WILDCARD_PATTERNS =
|
||||
Arrays.asList("!?*.java", "!?*.form", "!?*.class", "!?*.groovy", "!?*.scala", "!?*.flex", "!?*.kt", "!?*.clj", "!?*.aj");
|
||||
|
||||
private BackendCompiler myDefaultJavaCompiler;
|
||||
private State myState = new State();
|
||||
|
||||
@@ -142,11 +146,13 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
final boolean savingStateInNewFormatAllowed = Registry.is("saving.state.in.new.format.is.allowed", false);
|
||||
|
||||
Element state = new Element("state");
|
||||
XmlSerializer.serializeInto(myState, state, new SkipDefaultValuesSerializationFilters() {
|
||||
@Override
|
||||
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
|
||||
if (myState.compilerWasSpecified && "DEFAULT_COMPILER".equals(accessor.getName())) {
|
||||
if (!savingStateInNewFormatAllowed && myState.compilerWasSpecified && "DEFAULT_COMPILER".equals(accessor.getName())) {
|
||||
return true;
|
||||
}
|
||||
return super.accepts(accessor, bean);
|
||||
@@ -162,24 +168,43 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
myExcludesConfiguration.getDelegate().writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE));
|
||||
}
|
||||
|
||||
final Element newChild = addChild(state, JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS);
|
||||
for (final String pattern : getRegexpPatterns()) {
|
||||
addChild(newChild, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern);
|
||||
Element resourceExtensions = new Element(JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS);
|
||||
for (String pattern : getRegexpPatterns()) {
|
||||
addChild(resourceExtensions, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern);
|
||||
}
|
||||
if (!savingStateInNewFormatAllowed || !JDOMUtil.isEmpty(resourceExtensions)) {
|
||||
state.addContent(resourceExtensions);
|
||||
}
|
||||
|
||||
if (myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) {
|
||||
if ((myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) &&
|
||||
(!savingStateInNewFormatAllowed || !DEFAULT_WILDCARD_PATTERNS.equals(myWildcardPatterns))) {
|
||||
final Element wildcardPatterns = addChild(state, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS);
|
||||
for (final String wildcardPattern : myWildcardPatterns) {
|
||||
addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern);
|
||||
addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY)
|
||||
.setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern);
|
||||
}
|
||||
}
|
||||
|
||||
final Element annotationProcessingSettings = addChild(state, JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
|
||||
final Element defaultProfileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "true");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, defaultProfileElem);
|
||||
Element annotationProcessingSettings = new Element(JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
|
||||
|
||||
Element profileElement = new Element("profile");
|
||||
profileElement.setAttribute("default", "true");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, profileElement);
|
||||
if (!savingStateInNewFormatAllowed || !JDOMUtil.isEmpty(profileElement, 2)) {
|
||||
annotationProcessingSettings.addContent(profileElement);
|
||||
}
|
||||
|
||||
for (ProcessorConfigProfile profile : myModuleProcessorProfiles) {
|
||||
final Element profileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "false");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(profile, profileElem);
|
||||
Element element = new Element("profile");
|
||||
if (!savingStateInNewFormatAllowed) {
|
||||
element.setAttribute("default", "false");
|
||||
}
|
||||
AnnotationProcessorProfileSerializer.writeExternal(profile, element);
|
||||
annotationProcessingSettings.addContent(element);
|
||||
}
|
||||
|
||||
if (!savingStateInNewFormatAllowed || !JDOMUtil.isEmpty(annotationProcessingSettings)) {
|
||||
state.addContent(annotationProcessingSettings);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) {
|
||||
@@ -206,6 +231,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
readExternal(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBuildProcessHeapSize(final int javacPreferredHeapSize) {
|
||||
final int heapSize = myState.BUILD_PROCESS_HEAP_SIZE;
|
||||
if (heapSize != DEFAULT_BUILD_PROCESS_HEAP_SIZE) {
|
||||
@@ -215,14 +241,17 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
return Math.max(heapSize, javacPreferredHeapSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildProcessHeapSize(int size) {
|
||||
myState.BUILD_PROCESS_HEAP_SIZE = size > 0? size : DEFAULT_BUILD_PROCESS_HEAP_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildProcessVMOptions() {
|
||||
return myState.BUILD_PROCESS_ADDITIONAL_VM_OPTIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildProcessVMOptions(String options) {
|
||||
myState.BUILD_PROCESS_ADDITIONAL_VM_OPTIONS = options == null? "" : options.trim();
|
||||
}
|
||||
@@ -287,15 +316,9 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
removeWildcardPatterns();
|
||||
}
|
||||
try {
|
||||
addWildcardResourcePattern("!?*.java");
|
||||
addWildcardResourcePattern("!?*.form");
|
||||
addWildcardResourcePattern("!?*.class");
|
||||
addWildcardResourcePattern("!?*.groovy");
|
||||
addWildcardResourcePattern("!?*.scala");
|
||||
addWildcardResourcePattern("!?*.flex");
|
||||
addWildcardResourcePattern("!?*.kt");
|
||||
addWildcardResourcePattern("!?*.clj");
|
||||
addWildcardResourcePattern("!?*.aj");
|
||||
for (String pattern : DEFAULT_WILDCARD_PATTERNS) {
|
||||
addWildcardResourcePattern(pattern);
|
||||
}
|
||||
}
|
||||
catch (MalformedPatternException e) {
|
||||
LOG.error(e);
|
||||
@@ -719,8 +742,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
node = parentNode.getChild(JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS);
|
||||
if (node != null) {
|
||||
myWildcardPatternsInitialized = true;
|
||||
for (final Object o : node.getChildren(JpsJavaCompilerConfigurationSerializer.ENTRY)) {
|
||||
final Element element = (Element)o;
|
||||
for (Element element : node.getChildren(JpsJavaCompilerConfigurationSerializer.ENTRY)) {
|
||||
String pattern = element.getAttributeValue(JpsJavaCompilerConfigurationSerializer.NAME);
|
||||
if (!StringUtil.isEmpty(pattern)) {
|
||||
addWildcardResourcePattern(pattern);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerMessageImpl;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.ProblemsView;
|
||||
import com.intellij.compiler.progress.CompilerTask;
|
||||
@@ -37,25 +36,21 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CompileContextImpl extends UserDataHolderBase implements CompileContextEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileContextImpl");
|
||||
private final Project myProject;
|
||||
private final CompilerTask myBuildSession;
|
||||
private final Map<CompilerMessageCategory, Collection<CompilerMessage>> myMessages = new EnumMap<CompilerMessageCategory, Collection<CompilerMessage>>(CompilerMessageCategory.class);
|
||||
private final MessagesContainer myMessages;
|
||||
private final boolean myShouldUpdateProblemsView;
|
||||
private CompileScope myCompileScope;
|
||||
private final boolean myMake;
|
||||
@@ -63,9 +58,6 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
private final boolean myIsAnnotationProcessorsEnabled;
|
||||
private boolean myRebuildRequested;
|
||||
private String myRebuildReason;
|
||||
private final Map<VirtualFile, Module> myRootToModuleMap = new HashMap<VirtualFile, Module>();
|
||||
private final Map<Module, Set<VirtualFile>> myModuleToRootsMap = new HashMap<Module, Set<VirtualFile>>();
|
||||
private final Set<VirtualFile> myGeneratedTestRoots = new HashSet<VirtualFile>();
|
||||
private final ProjectFileIndex myProjectFileIndex; // cached for performance reasons
|
||||
private final ProjectCompileScope myProjectCompileScope;
|
||||
private final long myStartCompilationStamp;
|
||||
@@ -76,6 +68,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
@NotNull CompileScope compileScope,
|
||||
boolean isMake, boolean isRebuild) {
|
||||
myProject = project;
|
||||
myMessages = new MessagesContainer(project);
|
||||
myBuildSession = compilerSession;
|
||||
myCompileScope = compileScope;
|
||||
myMake = isMake;
|
||||
@@ -117,37 +110,17 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
|
||||
@Override
|
||||
public CompilerMessage[] getMessages(CompilerMessageCategory category) {
|
||||
Collection<CompilerMessage> collection = myMessages.get(category);
|
||||
if (collection == null) {
|
||||
return CompilerMessage.EMPTY_ARRAY;
|
||||
}
|
||||
return collection.toArray(new CompilerMessage[collection.size()]);
|
||||
return myMessages.getMessages(category).toArray(CompilerMessage.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum) {
|
||||
final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, null);
|
||||
addMessage(msg);
|
||||
addMessage(category, message, url, lineNum, columnNum, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum,
|
||||
Navigatable navigatable) {
|
||||
final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, navigatable);
|
||||
addMessage(msg);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static VirtualFile findFileByUrl(@Nullable String url) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
if (file == null) {
|
||||
// groovy stubs may be placed in completely random directories which aren't refreshed automatically
|
||||
return VirtualFileManager.getInstance().refreshAndFindFileByUrl(url);
|
||||
}
|
||||
return file;
|
||||
public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum, Navigatable navigatable) {
|
||||
myMessages.addMessage(category, message, url, lineNum, columnNum, navigatable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,13 +128,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
LOG.info("addMessage: " + msg + " this=" + this);
|
||||
}
|
||||
|
||||
Collection<CompilerMessage> messages = myMessages.get(msg.getCategory());
|
||||
if (messages == null) {
|
||||
messages = new LinkedHashSet<CompilerMessage>();
|
||||
myMessages.put(msg.getCategory(), messages);
|
||||
}
|
||||
if (messages.add(msg)) {
|
||||
if (myMessages.addMessage(msg)) {
|
||||
myBuildSession.addMessage(msg);
|
||||
}
|
||||
if (myShouldUpdateProblemsView && msg.getCategory() == CompilerMessageCategory.ERROR) {
|
||||
@@ -171,17 +138,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
|
||||
@Override
|
||||
public int getMessageCount(CompilerMessageCategory category) {
|
||||
if (category != null) {
|
||||
Collection<CompilerMessage> collection = myMessages.get(category);
|
||||
return collection != null ? collection.size() : 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (Collection<CompilerMessage> collection : myMessages.values()) {
|
||||
if (collection != null) {
|
||||
count += collection.size();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return myMessages.getMessageCount(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,59 +183,9 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
LOG.assertTrue(!module.isDisposed());
|
||||
return module;
|
||||
}
|
||||
for (final VirtualFile root : myRootToModuleMap.keySet()) {
|
||||
if (VfsUtilCore.isAncestor(root, file, false)) {
|
||||
final Module mod = myRootToModuleMap.get(root);
|
||||
if (mod != null) {
|
||||
LOG.assertTrue(!mod.isDisposed());
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private final Map<Module, VirtualFile[]> myModuleToRootsCache = new HashMap<Module, VirtualFile[]>();
|
||||
|
||||
@Override
|
||||
public VirtualFile[] getSourceRoots(Module module) {
|
||||
VirtualFile[] cachedRoots = myModuleToRootsCache.get(module);
|
||||
if (cachedRoots != null) {
|
||||
if (areFilesValid(cachedRoots)) {
|
||||
return cachedRoots;
|
||||
}
|
||||
else {
|
||||
myModuleToRootsCache.remove(module); // clear cache for this module and rebuild list of roots
|
||||
}
|
||||
}
|
||||
|
||||
Set<VirtualFile> additionalRoots = myModuleToRootsMap.get(module);
|
||||
VirtualFile[] moduleRoots = ModuleRootManager.getInstance(module).getSourceRoots();
|
||||
if (additionalRoots == null || additionalRoots.isEmpty()) {
|
||||
myModuleToRootsCache.put(module, moduleRoots);
|
||||
return moduleRoots;
|
||||
}
|
||||
|
||||
final VirtualFile[] allRoots = new VirtualFile[additionalRoots.size() + moduleRoots.length];
|
||||
System.arraycopy(moduleRoots, 0, allRoots, 0, moduleRoots.length);
|
||||
int index = moduleRoots.length;
|
||||
for (final VirtualFile additionalRoot : additionalRoots) {
|
||||
allRoots[index++] = additionalRoot;
|
||||
}
|
||||
myModuleToRootsCache.put(module, allRoots);
|
||||
return allRoots;
|
||||
}
|
||||
|
||||
private static boolean areFilesValid(VirtualFile[] files) {
|
||||
for (VirtualFile file : files) {
|
||||
if (!file.isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile getModuleOutputDirectory(Module module) {
|
||||
return CompilerPaths.getModuleOutputDirectory(module, false);
|
||||
@@ -294,6 +201,11 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
return myMake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutomake() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRebuild() {
|
||||
return myIsRebuild;
|
||||
@@ -309,22 +221,6 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
myCompileScope = new CompositeScope(myCompileScope, additionalScope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTestSourceContent(@NotNull final VirtualFile fileOrDir) {
|
||||
if (myProjectFileIndex.isInTestSourceContent(fileOrDir)) {
|
||||
return true;
|
||||
}
|
||||
return VfsUtilCore.isUnder(fileOrDir, myGeneratedTestRoots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInSourceContent(@NotNull final VirtualFile fileOrDir) {
|
||||
if (myProjectFileIndex.isInSourceContent(fileOrDir)) {
|
||||
return true;
|
||||
}
|
||||
return VfsUtilCore.isUnder(fileOrDir, myRootToModuleMap.keySet());
|
||||
}
|
||||
|
||||
public UUID getSessionId() {
|
||||
return mySessionId;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.compiler.*;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.ModuleCompilerUtil;
|
||||
import com.intellij.compiler.ModuleSourceSet;
|
||||
import com.intellij.compiler.ProblemsView;
|
||||
import com.intellij.compiler.progress.CompilerTask;
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.compiler.server.DefaultMessageHandler;
|
||||
@@ -489,27 +492,10 @@ public class CompileDriver {
|
||||
if (!outputs.isEmpty()) {
|
||||
final ProgressIndicator indicator = compileContext.getProgressIndicator();
|
||||
indicator.setText("Synchronizing output directories...");
|
||||
CompilerUtil.refreshOutputDirectories(outputs, _status == ExitStatus.CANCELLED);
|
||||
CompilerUtil.refreshOutputDirectories(outputs, false);
|
||||
indicator.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
if (compileContext.isAnnotationProcessorsEnabled() && !myProject.isDisposed()) {
|
||||
final Set<File> genSourceRoots = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
|
||||
for (Module module : affectedModules) {
|
||||
if (!module.isDisposed() && config.getAnnotationProcessingConfiguration(module).isEnabled()) {
|
||||
final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
|
||||
if (path != null) {
|
||||
genSourceRoots.add(new File(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!genSourceRoots.isEmpty()) {
|
||||
// refresh generates source roots asynchronously; needed for error highlighting update
|
||||
LocalFileSystem.getInstance().refreshIoFiles(genSourceRoots, true, true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.compiler.impl;
|
||||
|
||||
import com.intellij.compiler.CompilerMessageImpl;
|
||||
import com.intellij.openapi.compiler.CompilerMessage;
|
||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 27-Jan-16
|
||||
*/
|
||||
public class MessagesContainer {
|
||||
private final Project myProject;
|
||||
private final Map<CompilerMessageCategory, Collection<CompilerMessage>> myMessages = new EnumMap<CompilerMessageCategory, Collection<CompilerMessage>>(CompilerMessageCategory.class);
|
||||
|
||||
public MessagesContainer(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<CompilerMessage> getMessages(CompilerMessageCategory category) {
|
||||
final Collection<CompilerMessage> collection = myMessages.get(category);
|
||||
if (collection == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Collections.unmodifiableCollection(collection);
|
||||
}
|
||||
|
||||
public CompilerMessage addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum, Navigatable navigatable) {
|
||||
final CompilerMessageImpl msg =
|
||||
new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, navigatable);
|
||||
addMessage(msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
public boolean addMessage(CompilerMessage msg) {
|
||||
Collection<CompilerMessage> messages = myMessages.get(msg.getCategory());
|
||||
if (messages == null) {
|
||||
messages = new LinkedHashSet<CompilerMessage>();
|
||||
myMessages.put(msg.getCategory(), messages);
|
||||
}
|
||||
return messages.add(msg);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static VirtualFile findFileByUrl(@Nullable String url) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
if (file == null) {
|
||||
// groovy stubs may be placed in completely random directories which aren't refreshed automatically
|
||||
return VirtualFileManager.getInstance().refreshAndFindFileByUrl(url);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
public int getMessageCount(CompilerMessageCategory category) {
|
||||
if (category != null) {
|
||||
Collection<CompilerMessage> collection = myMessages.get(category);
|
||||
return collection != null ? collection.size() : 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (Collection<CompilerMessage> collection : myMessages.values()) {
|
||||
if (collection != null) {
|
||||
count += collection.size();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,21 +18,21 @@ package com.intellij.compiler.server;
|
||||
import com.intellij.compiler.CompilerMessageImpl;
|
||||
import com.intellij.compiler.ProblemsView;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.openapi.compiler.CompilationStatusListener;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||
import com.intellij.openapi.compiler.CompilerTopics;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
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;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.problems.Problem;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.api.CmdlineRemoteProto;
|
||||
import org.jetbrains.jps.api.GlobalOptions;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -46,12 +46,14 @@ class AutoMakeMessageHandler extends DefaultMessageHandler {
|
||||
private final Project myProject;
|
||||
private final WolfTheProblemSolver myWolf;
|
||||
private volatile boolean myUnprocessedFSChangesDetected = false;
|
||||
private final AutomakeCompileContext myContext;
|
||||
|
||||
public AutoMakeMessageHandler(Project project) {
|
||||
super(project);
|
||||
myProject = project;
|
||||
myBuildStatus = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.SUCCESS;
|
||||
myWolf = WolfTheProblemSolver.getInstance(project);
|
||||
myContext = new AutomakeCompileContext(project);
|
||||
}
|
||||
|
||||
public boolean unprocessedFSChangesDetected() {
|
||||
@@ -69,9 +71,27 @@ class AutoMakeMessageHandler extends DefaultMessageHandler {
|
||||
}
|
||||
switch (event.getEventType()) {
|
||||
case BUILD_COMPLETED:
|
||||
myContext.getProgressIndicator().stop();
|
||||
if (event.hasCompletionStatus()) {
|
||||
myBuildStatus = event.getCompletionStatus();
|
||||
final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status = event.getCompletionStatus();
|
||||
myBuildStatus = status;
|
||||
if (status == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED) {
|
||||
myContext.getProgressIndicator().cancel();
|
||||
}
|
||||
}
|
||||
final int errors = myContext.getMessageCount(CompilerMessageCategory.ERROR);
|
||||
final int warnings = myContext.getMessageCount(CompilerMessageCategory.WARNING);
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProject.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
final CompilationStatusListener publisher = myProject.getMessageBus().syncPublisher(CompilerTopics.COMPILATION_STATUS);
|
||||
publisher.automakeCompilationFinished(errors, warnings, myContext);
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
||||
case FILES_GENERATED:
|
||||
@@ -112,14 +132,29 @@ class AutoMakeMessageHandler extends DefaultMessageHandler {
|
||||
view.setProgress(message.getText());
|
||||
}
|
||||
}
|
||||
else if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR) {
|
||||
informWolf(myProject, message);
|
||||
else {
|
||||
final CompilerMessageCategory category = convertToCategory(kind);
|
||||
if (category != null) { // only process supported kinds of messages
|
||||
final String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;
|
||||
final String url = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(sourceFilePath)) : null;
|
||||
final long line = message.hasLine() ? message.getLine() : -1;
|
||||
final long column = message.hasColumn() ? message.getColumn() : -1;
|
||||
final CompilerMessage msg = myContext.createAndAddMessage(category, message.getText(), url, (int)line, (int)column, null);
|
||||
if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR) {
|
||||
informWolf(myProject, message);
|
||||
ProblemsView.SERVICE.getInstance(myProject).addMessage(msg, sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;
|
||||
final VirtualFile vFile = sourceFilePath != null? LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(sourceFilePath)) : null;
|
||||
final long line = message.hasLine() ? message.getLine() : -1;
|
||||
final long column = message.hasColumn() ? message.getColumn() : -1;
|
||||
ProblemsView.SERVICE.getInstance(myProject).addMessage(new CompilerMessageImpl(myProject, CompilerMessageCategory.ERROR, message.getText(), vFile, (int)line, (int)column, null), sessionId);
|
||||
@Nullable
|
||||
private static CompilerMessageCategory convertToCategory(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind) {
|
||||
switch(kind) {
|
||||
case ERROR: return CompilerMessageCategory.ERROR;
|
||||
case INFO: return CompilerMessageCategory.INFORMATION;
|
||||
case WARNING: return CompilerMessageCategory.WARNING;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.compiler.server;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.impl.MessagesContainer;
|
||||
import com.intellij.compiler.impl.ProjectCompileScope;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 27-Jan-16
|
||||
*/
|
||||
final class AutomakeCompileContext extends UserDataHolderBase implements CompileContext {
|
||||
private final Project myProject;
|
||||
private final ProjectCompileScope myScope;
|
||||
private final MessagesContainer myMessages;
|
||||
private final EmptyProgressIndicator myIndicator;
|
||||
private final boolean myAnnotationProcessingEnabled;
|
||||
|
||||
public AutomakeCompileContext(Project project) {
|
||||
myProject = project;
|
||||
myScope = new ProjectCompileScope(project);
|
||||
myMessages = new MessagesContainer(project);
|
||||
myIndicator = new EmptyProgressIndicator();
|
||||
myAnnotationProcessingEnabled = CompilerConfiguration.getInstance(project).isAnnotationProcessorsEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompileScope getCompileScope() {
|
||||
return getProjectCompileScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompileScope getProjectCompileScope() {
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMake() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutomake() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum) {
|
||||
addMessage(category, message, url, lineNum, columnNum, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable) {
|
||||
createAndAddMessage(category, message, url, lineNum, columnNum, navigatable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompilerMessage[] getMessages(CompilerMessageCategory category) {
|
||||
return myMessages.getMessages(category).toArray(CompilerMessage.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
public CompilerMessage createAndAddMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable) {
|
||||
return myMessages.addMessage(category, message, url, lineNum, columnNum, navigatable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMessageCount(CompilerMessageCategory category) {
|
||||
return myMessages.getMessageCount(category);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ProgressIndicator getProgressIndicator() {
|
||||
return myIndicator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestRebuildNextTime(String message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRebuildRequested() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getRebuildReason() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module getModuleByFile(VirtualFile file) {
|
||||
return ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(file);
|
||||
}
|
||||
|
||||
public VirtualFile getModuleOutputDirectory(final Module module) {
|
||||
return CompilerPaths.getModuleOutputDirectory(module, false);
|
||||
}
|
||||
|
||||
public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
|
||||
return CompilerPaths.getModuleOutputDirectory(module, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnnotationProcessorsEnabled() {
|
||||
return myAnnotationProcessingEnabled;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -42,6 +42,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.compiler.CompilationStatusListener;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerPaths;
|
||||
import com.intellij.openapi.compiler.CompilerTopics;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
@@ -342,7 +343,7 @@ public class BuildManager implements Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
JobScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
|
||||
JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runCommand(myGCTask);
|
||||
@@ -1504,22 +1505,50 @@ public class BuildManager implements Disposable {
|
||||
});
|
||||
conn.subscribe(CompilerTopics.COMPILATION_STATUS, new CompilationStatusListener() {
|
||||
private final Set<String> myRootsToRefresh = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
|
||||
@Override
|
||||
public void automakeCompilationFinished(int errors, int warnings, CompileContext compileContext) {
|
||||
if (!compileContext.getProgressIndicator().isCanceled()) {
|
||||
refreshSources(compileContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
|
||||
final String[] roots;
|
||||
refreshSources(compileContext);
|
||||
}
|
||||
|
||||
private void refreshSources(CompileContext compileContext) {
|
||||
if (project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
final Set<String> candidates = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
synchronized (myRootsToRefresh) {
|
||||
roots = ArrayUtil.toStringArray(myRootsToRefresh);
|
||||
candidates.addAll(myRootsToRefresh);
|
||||
myRootsToRefresh.clear();
|
||||
}
|
||||
if (roots.length != 0) {
|
||||
if (compileContext.isAnnotationProcessorsEnabled()) {
|
||||
// annotation processors may have re-generated code
|
||||
final CompilerConfiguration config = CompilerConfiguration.getInstance(project);
|
||||
for (Module module : compileContext.getCompileScope().getAffectedModules()) {
|
||||
if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
|
||||
final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
|
||||
if (path != null) {
|
||||
candidates.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!candidates.isEmpty()) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
final List<File> rootFiles = new ArrayList<File>(roots.length);
|
||||
for (String root : roots) {
|
||||
final List<File> rootFiles = new ArrayList<File>(candidates.size());
|
||||
for (String root : candidates) {
|
||||
rootFiles.add(new File(root));
|
||||
}
|
||||
// this will ensure that we'll be able to obtain VirtualFile for existing roots
|
||||
|
||||
@@ -18,20 +18,11 @@ package com.intellij.openapi.compiler.ex;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompileScope;
|
||||
import com.intellij.openapi.compiler.CompilerMessage;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface CompileContextEx extends CompileContext {
|
||||
|
||||
void addMessage(CompilerMessage message);
|
||||
|
||||
/**
|
||||
* the same as FileIndex.isInTestSourceContent(), but takes into account generated output dirs
|
||||
*/
|
||||
boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir);
|
||||
|
||||
boolean isInSourceContent(@NotNull VirtualFile fileOrDir);
|
||||
|
||||
void addScope(CompileScope additionalScope);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
@@ -161,5 +161,4 @@
|
||||
<option name="useAlternate" value="false" />
|
||||
</LanguageOptions>
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -16,6 +16,9 @@
|
||||
package com.intellij.openapi.compiler;
|
||||
|
||||
public class CompilationStatusAdapter implements CompilationStatusListener {
|
||||
public void automakeCompilationFinished(int errors, int warnings, CompileContext compileContext) {
|
||||
}
|
||||
|
||||
public void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -31,7 +31,12 @@ public interface CompilationStatusListener extends EventListener {
|
||||
* @param warnings warning count
|
||||
* @param compileContext context for the finished compilation
|
||||
*/
|
||||
void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext);
|
||||
default void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext){
|
||||
}
|
||||
|
||||
void fileGenerated(String outputRoot, String relativePath);
|
||||
default void automakeCompilationFinished(int errors, int warnings, final CompileContext compileContext) {
|
||||
}
|
||||
|
||||
default void fileGenerated(String outputRoot, String relativePath) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,13 +114,6 @@ public interface CompileContext extends UserDataHolder {
|
||||
*/
|
||||
Module getModuleByFile(VirtualFile file);
|
||||
|
||||
/**
|
||||
* Returns the source roots for the specified module.
|
||||
*
|
||||
* @return module's source roots as well as source roots for generated sources that are attributed to the module
|
||||
*/
|
||||
VirtualFile[] getSourceRoots(Module module);
|
||||
|
||||
/**
|
||||
* Returns the output directory for the specified module.
|
||||
*
|
||||
@@ -147,6 +140,8 @@ public interface CompileContext extends UserDataHolder {
|
||||
*/
|
||||
boolean isMake();
|
||||
|
||||
boolean isAutomake();
|
||||
|
||||
boolean isRebuild();
|
||||
|
||||
Project getProject();
|
||||
|
||||
@@ -112,6 +112,9 @@ public class CompilerPaths {
|
||||
@Nullable
|
||||
public static VirtualFile getModuleOutputDirectory(final Module module, boolean forTestClasses) {
|
||||
final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
|
||||
if (compilerModuleExtension == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualFile outPath;
|
||||
if (forTestClasses) {
|
||||
final VirtualFile path = compilerModuleExtension.getCompilerOutputPathForTests();
|
||||
@@ -144,6 +147,9 @@ public class CompilerPaths {
|
||||
final String outPathUrl;
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
|
||||
if (extension == null) {
|
||||
return null;
|
||||
}
|
||||
if (forTestClasses) {
|
||||
if (application.isDispatchThread()) {
|
||||
final String url = extension.getCompilerOutputUrlForTests();
|
||||
|
||||
@@ -94,10 +94,6 @@ public class DummyCompileContext implements CompileContext {
|
||||
return false;
|
||||
}
|
||||
|
||||
public VirtualFile[] getSourceRoots(Module module) {
|
||||
return VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
public VirtualFile getModuleOutputDirectory(final Module module) {
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
|
||||
public VirtualFile compute() {
|
||||
@@ -121,6 +117,11 @@ public class DummyCompileContext implements CompileContext {
|
||||
return false; // stub implementation
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutomake() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
import com.intellij.codeInsight.daemon.impl.JavaHighlightInfoTypes;
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
@@ -269,7 +269,7 @@ public class JavaMarkObjectActionHandler extends MarkObjectActionHandler {
|
||||
|
||||
public static Color getAutoMarkupColor() {
|
||||
final EditorColorsManager manager = EditorColorsManager.getInstance();
|
||||
final TextAttributes textAttributes = manager.getGlobalScheme().getAttributes(HighlightInfoType.STATIC_FIELD.getAttributesKey());
|
||||
final TextAttributes textAttributes = manager.getGlobalScheme().getAttributes(JavaHighlightInfoTypes.STATIC_FIELD.getAttributesKey());
|
||||
return textAttributes.getForegroundColor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -313,7 +313,7 @@ public class PopFrameAction extends DebuggerAction {
|
||||
boolean enable = false;
|
||||
|
||||
StackFrameProxyImpl proxy = getStackFrameProxy(e);
|
||||
if (proxy != null && !proxy.isBottom() && isAtBreakpoint(e)) {
|
||||
if (proxy != null && !proxy.isBottom() /*&& isAtBreakpoint(e)*/) {
|
||||
enable = proxy.getVirtualMachine().canPopFrames();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class ClassInstanceMethodFilter extends ConstructorStepMethodFilter imple
|
||||
try {
|
||||
ObjectReference reference = proxy.thisObject();
|
||||
if (reference != null) {
|
||||
DebugProcessImpl debugProcess = context.getDebugProcessNoAssert();
|
||||
DebugProcessImpl debugProcess = context.getDebugProcess();
|
||||
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(debugProcess.getProject()).getBreakpointManager();
|
||||
StepIntoBreakpoint breakpoint = breakpointManager.addStepIntoBreakpoint(myMethodFilter);
|
||||
if (breakpoint != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -181,11 +181,12 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
return;
|
||||
}
|
||||
|
||||
LocatableEvent locatableEvent = getLocatableEvent(eventSet);
|
||||
if (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) {
|
||||
// check if there is already one request with policy SUSPEND_ALL
|
||||
for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
|
||||
if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
|
||||
if (Registry.is("debugger.step.resumes.one.thread") && getStepEvent(eventSet) != null) {
|
||||
if (Registry.is("debugger.step.resumes.one.thread") && locatableEvent != null) {
|
||||
// if step event is present - switch context
|
||||
getSuspendManager().resume(context);
|
||||
//((SuspendManagerImpl)getSuspendManager()).popContext(context);
|
||||
@@ -201,10 +202,9 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
|
||||
SuspendContextImpl suspendContext = null;
|
||||
|
||||
StepEvent stepEvent = getStepEvent(eventSet);
|
||||
if (Registry.is("debugger.step.resumes.one.thread") && stepEvent != null) {
|
||||
if (Registry.is("debugger.step.resumes.one.thread") && locatableEvent != null) {
|
||||
for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
|
||||
ThreadReferenceProxyImpl threadProxy = getVirtualMachineProxy().getThreadReferenceProxy(stepEvent.thread());
|
||||
ThreadReferenceProxyImpl threadProxy = getVirtualMachineProxy().getThreadReferenceProxy(locatableEvent.thread());
|
||||
if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL &&
|
||||
context.isExplicitlyResumed(threadProxy)) {
|
||||
context.myResumedThreads.remove(threadProxy);
|
||||
@@ -526,10 +526,10 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static StepEvent getStepEvent(EventSet eventSet) {
|
||||
private static LocatableEvent getLocatableEvent(EventSet eventSet) {
|
||||
for (Event event : eventSet) {
|
||||
if (event instanceof StepEvent) {
|
||||
return (StepEvent)event;
|
||||
if (event instanceof LocatableEvent) {
|
||||
return (LocatableEvent)event;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -921,8 +921,10 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
}
|
||||
|
||||
private static int getInvokePolicy(SuspendContext suspendContext) {
|
||||
//return ThreadReference.INVOKE_SINGLE_THREADED;
|
||||
return suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? ObjectReference.INVOKE_SINGLE_THREADED : 0;
|
||||
if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || Registry.is("debugger.step.resumes.one.thread")) {
|
||||
return ObjectReference.INVOKE_SINGLE_THREADED;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -995,6 +997,10 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
throw EvaluateExceptionUtil.NESTED_EVALUATION_ERROR;
|
||||
}
|
||||
|
||||
if (!suspendContext.suspends(invokeThread)) {
|
||||
throw EvaluateExceptionUtil.THREAD_WAS_RESUMED;
|
||||
}
|
||||
|
||||
Set<SuspendContextImpl> suspendingContexts = SuspendManagerUtil.getSuspendingContexts(getSuspendManager(), invokeThread);
|
||||
final ThreadReference invokeThreadRef = invokeThread.getThreadReference();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.engine;
|
||||
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.sun.jdi.TypeComponent;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
|
||||
@@ -30,8 +30,7 @@ public class DefaultSyntheticProvider implements SyntheticTypeComponentProvider
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
ReferenceType type = typeComponent.declaringType();
|
||||
if (type.name().contains("$$Lambda$")) {
|
||||
if (DebuggerUtilsEx.isLambdaClassName(typeComponent.declaringType().name())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -59,8 +59,8 @@ import com.intellij.xdebugger.frame.XValueMarkerProvider;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import com.intellij.xdebugger.ui.XDebugTabLayouter;
|
||||
import com.sun.jdi.event.BreakpointEvent;
|
||||
import com.sun.jdi.event.Event;
|
||||
import com.sun.jdi.event.LocatableEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.JavaDebuggerEditorsProvider;
|
||||
@@ -123,8 +123,8 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
if (item != null) {
|
||||
XBreakpoint xBreakpoint = item.getFirst().getXBreakpoint();
|
||||
Event second = item.getSecond();
|
||||
if (xBreakpoint != null && second instanceof BreakpointEvent &&
|
||||
threadProxy != null && ((BreakpointEvent)second).thread() == threadProxy.getThreadReference()) {
|
||||
if (xBreakpoint != null && second instanceof LocatableEvent &&
|
||||
threadProxy != null && ((LocatableEvent)second).thread() == threadProxy.getThreadReference()) {
|
||||
((XDebugSessionImpl)getSession()).breakpointReachedNoProcessing(xBreakpoint, newSuspendContext);
|
||||
unsetPausedIfNeeded(newContext);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -87,7 +87,7 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator {
|
||||
TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
|
||||
NodeManagerImpl nodeManager = process.getNodeManager();
|
||||
WatchItemDescriptor descriptor = nodeManager.getWatchItemDescriptor(null, text, null);
|
||||
EvaluationContextImpl evalContext = myStackFrame.getFrameDebuggerContext().createEvaluationContext();
|
||||
EvaluationContextImpl evalContext = myStackFrame.getFrameDebuggerContext(getDebuggerContext()).createEvaluationContext();
|
||||
if (evalContext == null) {
|
||||
callback.errorOccurred("Context is not available");
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -139,18 +139,20 @@ public class JavaStackFrame extends XStackFrame {
|
||||
public void threadAction() {
|
||||
if (node.isObsolete()) return;
|
||||
XValueChildrenList children = new XValueChildrenList();
|
||||
buildVariablesThreadAction(getFrameDebuggerContext(), children, node);
|
||||
buildVariablesThreadAction(getFrameDebuggerContext(getDebuggerContext()), children, node);
|
||||
node.addChildren(children, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DebuggerContextImpl getFrameDebuggerContext() {
|
||||
DebuggerContextImpl getFrameDebuggerContext(@Nullable DebuggerContextImpl context) {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
DebuggerContextImpl context = myDebugProcess.getDebuggerContext();
|
||||
if (context == null) {
|
||||
context = myDebugProcess.getDebuggerContext();
|
||||
}
|
||||
if (context.getFrameProxy() != getStackFrameProxy()) {
|
||||
SuspendContextImpl threadSuspendContext = SuspendManagerUtil.getSuspendContextForThread(context.getSuspendContext(),
|
||||
getStackFrameProxy().threadProxy());
|
||||
SuspendContextImpl threadSuspendContext =
|
||||
SuspendManagerUtil.findContextByThread(myDebugProcess.getSuspendManager(), getStackFrameProxy().threadProxy());
|
||||
context = DebuggerContextImpl.createDebuggerContext(
|
||||
myDebugProcess.mySession,
|
||||
threadSuspendContext,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -401,9 +401,15 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
|
||||
protected static boolean scheduleCommand(EvaluationContextImpl evaluationContext,
|
||||
@NotNull final XCompositeNode node,
|
||||
final SuspendContextCommandImpl command) {
|
||||
if (node.isObsolete()) {
|
||||
return false;
|
||||
}
|
||||
evaluationContext.getManagerThread().schedule(new SuspendContextCommandImpl(command.getSuspendContext()) {
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
if (node.isObsolete()) {
|
||||
return;
|
||||
}
|
||||
command.contextAction();
|
||||
}
|
||||
|
||||
@@ -596,7 +602,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
|
||||
}
|
||||
}
|
||||
}
|
||||
EvaluationContextImpl evaluationContext = ((JavaStackFrame)frame).getFrameDebuggerContext().createEvaluationContext();
|
||||
EvaluationContextImpl evaluationContext = ((JavaStackFrame)frame).getFrameDebuggerContext(null).createEvaluationContext();
|
||||
if (evaluationContext != null) {
|
||||
callback.evaluated(create(inspectDescriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.EmptyIterable;
|
||||
import com.sun.jdi.AbsentInformationException;
|
||||
@@ -432,7 +433,15 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.error("Local or anonymous class has no non-local parent");
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
PsiTreeUtil.treeWalkUp(psiClass, null, new PairProcessor<PsiElement, PsiElement>() {
|
||||
@Override
|
||||
public boolean process(PsiElement element, PsiElement element2) {
|
||||
sb.append('\n').append(element);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
LOG.info("Local or anonymous class " + psiClass + " has no non-local parent, parents:" + sb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -126,11 +126,6 @@ public abstract class SuspendContextImpl extends XSuspendContext implements Susp
|
||||
@Override
|
||||
@NotNull
|
||||
public DebugProcessImpl getDebugProcess() {
|
||||
assertNotResumed();
|
||||
return myDebugProcess;
|
||||
}
|
||||
|
||||
public DebugProcessImpl getDebugProcessNoAssert() {
|
||||
return myDebugProcess;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -185,10 +185,9 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
SuspendManagerUtil.prepareForResume(context);
|
||||
|
||||
myDebugProcess.logThreads();
|
||||
final int suspendPolicy = context.getSuspendPolicy();
|
||||
popContext(context);
|
||||
context.resume();
|
||||
myDebugProcess.clearCashes(suspendPolicy);
|
||||
myDebugProcess.clearCashes(context.getSuspendPolicy());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -126,14 +126,6 @@ public class SuspendManagerUtil {
|
||||
return resumeData;
|
||||
}
|
||||
|
||||
public static SuspendContextImpl getSuspendContextForThread(SuspendContextImpl suspendContext, ThreadReferenceProxyImpl thread) {
|
||||
if (suspendContext == null) {
|
||||
return null;
|
||||
}
|
||||
SuspendContextImpl context = findContextByThread(suspendContext.getDebugProcess().getSuspendManager(), thread);
|
||||
return context != null && !context.myInProgress ? context : suspendContext;
|
||||
}
|
||||
|
||||
public static SuspendContextImpl getEvaluatingContext(SuspendManager suspendManager, ThreadReferenceProxyImpl thread) {
|
||||
for (SuspendContextImpl suspendContext : suspendManager.getEventContexts()) {
|
||||
if (!suspendContext.isResumed() && suspendContext.isEvaluating() && suspendContext.getThread() == thread) {
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -64,6 +65,7 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory {
|
||||
return myDelegate.isContextAccepted(contextElement);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LanguageFileType getFileType() {
|
||||
return myDelegate.getFileType();
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.PairFunction;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -119,6 +120,7 @@ public class DefaultCodeFragmentFactory extends CodeFragmentFactory {
|
||||
return true; // default factory works everywhere debugger can stop
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LanguageFileType getFileType() {
|
||||
return StdFileTypes.JAVA;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -62,7 +62,7 @@ public final class EvaluationContextImpl implements EvaluationContext{
|
||||
}
|
||||
|
||||
public DebuggerManagerThreadImpl getManagerThread() {
|
||||
return getSuspendContext().getDebugProcessNoAssert().getManagerThread();
|
||||
return getDebugProcess().getManagerThread();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -66,12 +66,6 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
|
||||
@Override
|
||||
public final void contextAction() throws Exception {
|
||||
// with custom thread we have the right context already
|
||||
if (myCustomThread != null) {
|
||||
threadAction();
|
||||
return;
|
||||
}
|
||||
|
||||
SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
|
||||
boolean isSuspendedByContext;
|
||||
try {
|
||||
@@ -89,8 +83,9 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
threadAction();
|
||||
}
|
||||
else {
|
||||
// there are no suspend context currently registered
|
||||
SuspendContextImpl suspendContextForThread = SuspendManagerUtil.findContextByThread(suspendManager, getThread());
|
||||
// no suspend context currently available
|
||||
SuspendContextImpl suspendContextForThread = myCustomThread != null ? getSuspendContext() :
|
||||
SuspendManagerUtil.findContextByThread(suspendManager, getThread());
|
||||
if (suspendContextForThread != null) {
|
||||
suspendContextForThread.postponeCommand(this);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -37,9 +36,7 @@ import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class DebuggerContextUtil {
|
||||
public static void setStackFrame(final DebuggerStateManager manager, final StackFrameProxyImpl stackFrame) {
|
||||
@@ -56,8 +53,10 @@ public class DebuggerContextUtil {
|
||||
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
SuspendContextImpl threadSuspendContext = SuspendManagerUtil.getSuspendContextForThread(context.getSuspendContext(), stackFrame.threadProxy());
|
||||
final DebuggerContextImpl newContext = DebuggerContextImpl.createDebuggerContext(session, threadSuspendContext, stackFrame.threadProxy(), stackFrame);
|
||||
SuspendContextImpl threadSuspendContext =
|
||||
SuspendManagerUtil.findContextByThread(session.getProcess().getSuspendManager(), stackFrame.threadProxy());
|
||||
final DebuggerContextImpl newContext =
|
||||
DebuggerContextImpl.createDebuggerContext(session, threadSuspendContext, stackFrame.threadProxy(), stackFrame);
|
||||
DebuggerInvocationUtil.swingInvokeLater(session.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -98,11 +97,8 @@ public class DebuggerContextUtil {
|
||||
//final Editor editor = fileEditor instanceof TextEditorImpl ? ((TextEditorImpl)fileEditor).getEditor() : null;
|
||||
if (editor != null && position != null && file.getVirtualFile().equals(position.getFile())) {
|
||||
PsiMethod method = PsiTreeUtil.getParentOfType(PositionUtil.getContextElement(context), PsiMethod.class, false);
|
||||
final Couple<Collection<TextRange>> usages =
|
||||
IdentifierHighlighterPass.getHighlightUsages(psi, method != null ? method : file, false);
|
||||
final List<TextRange> ranges = new ArrayList<TextRange>();
|
||||
ranges.addAll(usages.first);
|
||||
ranges.addAll(usages.second);
|
||||
final Collection<TextRange> ranges =
|
||||
IdentifierHighlighterPass.getUsages(psi, method != null ? method : file, false);
|
||||
final int breakPointLine = position.getLine();
|
||||
int bestLine = -1;
|
||||
int bestOffset = -1;
|
||||
|
||||
@@ -100,7 +100,6 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
return suitableFactories;
|
||||
}
|
||||
|
||||
|
||||
public static PsiMethod findPsiMethod(PsiFile file, int offset) {
|
||||
PsiElement element = null;
|
||||
|
||||
@@ -461,22 +460,30 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
|
||||
public abstract EvaluatorBuilder getEvaluatorBuilder();
|
||||
|
||||
public static CodeFragmentFactory getCodeFragmentFactory(@Nullable PsiElement context, @Nullable FileType fileType) {
|
||||
DefaultCodeFragmentFactory defaultFactory = DefaultCodeFragmentFactory.getInstance();
|
||||
if (fileType == null) {
|
||||
if (context == null) {
|
||||
return defaultFactory;
|
||||
}
|
||||
else {
|
||||
fileType = context.getContainingFile().getFileType();
|
||||
}
|
||||
}
|
||||
for (CodeFragmentFactory factory : ApplicationManager.getApplication().getExtensions(CodeFragmentFactory.EXTENSION_POINT_NAME)) {
|
||||
if (factory != defaultFactory && factory.getFileType().equals(fileType) && factory.isContextAccepted(context)) {
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
return defaultFactory;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CodeFragmentFactory findAppropriateCodeFragmentFactory(final TextWithImports text, final PsiElement context) {
|
||||
CodeFragmentFactory factory = ApplicationManager.getApplication().runReadAction(new Computable<CodeFragmentFactory>() {
|
||||
@Override
|
||||
public CodeFragmentFactory compute() {
|
||||
final FileType fileType = text.getFileType();
|
||||
final List<CodeFragmentFactory> factories = getCodeFragmentFactories(context);
|
||||
if (fileType == null) {
|
||||
return factories.get(0);
|
||||
}
|
||||
for (CodeFragmentFactory factory : factories) {
|
||||
if (factory.getFileType().equals(fileType)) {
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
return DefaultCodeFragmentFactory.getInstance();
|
||||
return getCodeFragmentFactory(context, text.getFileType());
|
||||
}
|
||||
});
|
||||
return new CodeFragmentFactoryContextWrapper(factory);
|
||||
@@ -801,6 +808,15 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLambdaClassName(String typeName) {
|
||||
return getLambdaBaseClassName(typeName) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLambdaBaseClassName(String typeName) {
|
||||
return StringUtil.substringBefore(typeName, "$$Lambda$");
|
||||
}
|
||||
|
||||
public static List<PsiLambdaExpression> collectLambdas(@NotNull SourcePosition position, final boolean onlyOnTheLine) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
PsiFile file = position.getFile();
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
package com.intellij.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -36,7 +39,10 @@ import java.util.Map;
|
||||
@State(
|
||||
name = "DebuggerSettings",
|
||||
defaultStateAsResource = true,
|
||||
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml")
|
||||
storages = {
|
||||
@Storage(file = "debugger.xml"),
|
||||
@Storage(file = "other.xml", deprecated = true)
|
||||
}
|
||||
)
|
||||
public class DebuggerSettings implements Cloneable, PersistentStateComponent<Element> {
|
||||
private static final Logger LOG = Logger.getInstance(DebuggerSettings.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -67,7 +67,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
@NonNls private static final String RENDERER_ID = "ID";
|
||||
|
||||
private final EventDispatcher<NodeRendererSettingsListener> myDispatcher = EventDispatcher.create(NodeRendererSettingsListener.class);
|
||||
private final List<NodeRenderer> myPluginRenderers = new ArrayList<NodeRenderer>();
|
||||
private RendererConfiguration myCustomRenderers = new RendererConfiguration(this);
|
||||
|
||||
// base renderers
|
||||
@@ -110,20 +109,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
return ServiceManager.getService(NodeRendererSettings.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* use {@link NodeRenderer} extension
|
||||
* @param renderer
|
||||
*/
|
||||
@Deprecated
|
||||
public void addPluginRenderer(NodeRenderer renderer) {
|
||||
myPluginRenderers.add(renderer);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void removePluginRenderer(NodeRenderer renderer) {
|
||||
myPluginRenderers.remove(renderer);
|
||||
}
|
||||
|
||||
public void setAlternateCollectionViewsEnabled(boolean enabled) {
|
||||
for (NodeRenderer myAlternateCollectionRenderer : myAlternateCollectionRenderers) {
|
||||
myAlternateCollectionRenderer.setEnabled(enabled);
|
||||
@@ -227,10 +212,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
}
|
||||
}
|
||||
|
||||
public List<NodeRenderer> getPluginRenderers() {
|
||||
return new ArrayList<NodeRenderer>(myPluginRenderers);
|
||||
}
|
||||
|
||||
public PrimitiveRenderer getPrimitiveRenderer() {
|
||||
return myPrimitiveRenderer;
|
||||
}
|
||||
@@ -272,7 +253,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
});
|
||||
|
||||
// plugins registered renderers come after that
|
||||
allRenderers.addAll(myPluginRenderers);
|
||||
Collections.addAll(allRenderers, NodeRenderer.EP_NAME.getExtensions());
|
||||
|
||||
// now all predefined stuff
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,10 @@
|
||||
package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.evaluation.*;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentFactoryContextWrapper;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -287,22 +290,12 @@ public abstract class DebuggerEditorImpl extends CompletionEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static CodeFragmentFactory findAppropriateFactory(@NotNull TextWithImports text, @Nullable PsiElement context) {
|
||||
for (CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context)) {
|
||||
if (factory.getFileType().equals(text.getFileType())) {
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
return DefaultCodeFragmentFactory.getInstance();
|
||||
}
|
||||
|
||||
protected void restoreFactory(TextWithImports text) {
|
||||
FileType fileType = text.getFileType();
|
||||
if (fileType == null) return;
|
||||
if (myContext == null) return;
|
||||
|
||||
setFactory(findAppropriateFactory(text, myContext));
|
||||
setFactory(DebuggerUtilsEx.getCodeFragmentFactory(myContext, text.getFileType()));
|
||||
}
|
||||
|
||||
private void setFactory(@NotNull CodeFragmentFactory factory) {
|
||||
|
||||
+5
-26
@@ -78,7 +78,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
return new JavaLineBreakpointProperties();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public JavaLineBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
|
||||
return new JavaLineBreakpointProperties();
|
||||
@@ -165,32 +165,9 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
return DebuggerUtilsEx.getContainingMethod(position);
|
||||
}
|
||||
|
||||
public class JavaBreakpointVariant extends XLineBreakpointVariant {
|
||||
protected final XSourcePosition mySourcePosition;
|
||||
|
||||
public class JavaBreakpointVariant extends XLineBreakpointAllVariant {
|
||||
public JavaBreakpointVariant(XSourcePosition position) {
|
||||
mySourcePosition = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "All";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextRange getHighlightRange() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaLineBreakpointProperties createProperties() {
|
||||
return createBreakpointProperties(mySourcePosition.getFile(),
|
||||
mySourcePosition.getLine());
|
||||
super(position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +196,11 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
return myElement.getTextRange();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JavaLineBreakpointProperties createProperties() {
|
||||
JavaLineBreakpointProperties properties = super.createProperties();
|
||||
assert properties != null;
|
||||
properties.setLambdaOrdinal(myLambdaOrdinal);
|
||||
return properties;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -99,8 +99,8 @@ public class ThreadDescriptorImpl extends NodeDescriptorImpl implements ThreadDe
|
||||
myIsSuspended = false;
|
||||
}
|
||||
myIsExpandable = calcExpandable(myIsSuspended);
|
||||
mySuspendContext = SuspendManagerUtil.getSuspendContextForThread(suspendContext, thread);
|
||||
myIsAtBreakpoint = suspendManager != null? SuspendManagerUtil.findContextByThread(suspendManager, thread) != null : thread.isAtBreakpoint();
|
||||
mySuspendContext = suspendManager != null ? SuspendManagerUtil.findContextByThread(suspendManager, thread) : suspendContext;
|
||||
myIsAtBreakpoint = thread.isAtBreakpoint();
|
||||
myIsCurrent = suspendContext != null? suspendContext.getThread() == thread : false;
|
||||
myIsFrozen = suspendManager != null? suspendManager.isFrozen(thread) : myIsSuspended;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.jdi.StackFrameProxy;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.MessageDescriptor;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
|
||||
@@ -80,6 +81,11 @@ public class ClassRenderer extends NodeRendererImpl{
|
||||
if (SHOW_FQ_TYPE_NAMES) {
|
||||
return typeName;
|
||||
}
|
||||
String baseLambdaClassName = DebuggerUtilsEx.getLambdaBaseClassName(typeName);
|
||||
if (baseLambdaClassName != null) {
|
||||
return renderTypeName(baseLambdaClassName) + "$lambda";
|
||||
}
|
||||
|
||||
final int dotIndex = typeName.lastIndexOf('.');
|
||||
if (dotIndex > 0) {
|
||||
return typeName.substring(dotIndex + 1);
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaCodeFragment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class CodeFragmentFactory {
|
||||
public static final ExtensionPointName<CodeFragmentFactory> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.debugger.codeFragmentFactory");
|
||||
@@ -31,6 +32,7 @@ public abstract class CodeFragmentFactory {
|
||||
|
||||
public abstract boolean isContextAccepted(PsiElement contextElement);
|
||||
|
||||
@NotNull
|
||||
public abstract LanguageFileType getFileType();
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,8 +55,8 @@ public class JUnitUtil {
|
||||
public static final String BEFORE_ANNOTATION_NAME = "org.junit.Before";
|
||||
public static final String AFTER_ANNOTATION_NAME = "org.junit.After";
|
||||
public static final String PARAMETRIZED_PARAMETERS_ANNOTATION_NAME = "org.junit.runners.Parameterized.Parameters";
|
||||
private static final String AFTER_CLASS_ANNOTATION_NAME = "org.junit.AfterClass";
|
||||
private static final String BEFORE_CLASS_ANNOTATION_NAME = "org.junit.BeforeClass";
|
||||
public static final String AFTER_CLASS_ANNOTATION_NAME = "org.junit.AfterClass";
|
||||
public static final String BEFORE_CLASS_ANNOTATION_NAME = "org.junit.BeforeClass";
|
||||
private static final Collection<String> CONFIGURATIONS_ANNOTATION_NAME = Collections.unmodifiableList(
|
||||
Arrays.asList(DATA_POINT, AFTER_ANNOTATION_NAME, BEFORE_ANNOTATION_NAME, AFTER_CLASS_ANNOTATION_NAME, BEFORE_CLASS_ANNOTATION_NAME));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class JavaTestLocator implements SMTestLocator {
|
||||
PsiClass aClass = ClassUtil.findPsiClass(PsiManager.getInstance(project), className, null, true, scope);
|
||||
if (aClass != null) {
|
||||
results = ContainerUtil.newSmartList();
|
||||
PsiMethod[] methods = aClass.findMethodsByName(methodName, true);
|
||||
PsiMethod[] methods = aClass.findMethodsByName(methodName.trim(), true);
|
||||
if (methods.length > 0) {
|
||||
for (PsiMethod method : methods) {
|
||||
results.add(paramName != null ? new PsiMemberParameterizedLocation(project, method, aClass, paramName)
|
||||
|
||||
@@ -45,7 +45,7 @@ class RecentTestRunnerImpl implements RecentTestRunner {
|
||||
private static AnAction RUN = ActionManager.getInstance().getAction("RunClass");
|
||||
private static AnAction DEBUG = ActionManager.getInstance().getAction("DebugClass");
|
||||
|
||||
protected AnAction myCurrentAction = DEBUG;
|
||||
protected AnAction myCurrentAction = RUN;
|
||||
private final Project myProject;
|
||||
|
||||
public RecentTestRunnerImpl(Project project) {
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.testIntegration;
|
||||
|
||||
import com.intellij.execution.testframework.sm.runner.states.TestStateInfo;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.execution.testframework.sm.runner.states.TestStateInfo.Magnitude.*;
|
||||
import static com.intellij.testIntegration.TestInfo.select;
|
||||
import static com.intellij.testIntegration.TestInfo.selectNot;
|
||||
|
||||
public class RecentTestsData {
|
||||
private static Comparator<TestInfo> TEST_BY_PATH_COMPARATOR = new Comparator<TestInfo>() {
|
||||
@Override
|
||||
public int compare(TestInfo o1, TestInfo o2) {
|
||||
String path1 = VirtualFileManager.extractPath(o1.getUrl());
|
||||
String path2 = VirtualFileManager.extractPath(o2.getUrl());
|
||||
return path1.compareTo(path2);
|
||||
}
|
||||
};
|
||||
|
||||
private static Comparator<SuiteInfo> SUITE_BY_RECENT_COMPARATOR = new Comparator<SuiteInfo>() {
|
||||
@Override
|
||||
public int compare(SuiteInfo o1, SuiteInfo o2) {
|
||||
return -o1.getMostRecentRunDate().compareTo(o2.getMostRecentRunDate());
|
||||
}
|
||||
};
|
||||
|
||||
private static Comparator<TestInfo> TEST_BY_RECENT_COMPARATOR = new Comparator<TestInfo>() {
|
||||
@Override
|
||||
public int compare(TestInfo o1, TestInfo o2) {
|
||||
return -o1.getRunDate().compareTo(o2.getRunDate());
|
||||
}
|
||||
};
|
||||
|
||||
private final RecentTestRunner myRunner;
|
||||
private final Map<String, SuiteInfo> mySuites = ContainerUtil.newHashMap();
|
||||
|
||||
private List<TestInfo> myTestsWithoutSuites = ContainerUtil.newArrayList();
|
||||
|
||||
public RecentTestsData(RecentTestRunner runner) {
|
||||
myRunner = runner;
|
||||
}
|
||||
|
||||
public void addTest(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
if (myRunner.isSuite(url)) {
|
||||
mySuites.put(url, new SuiteInfo(url, magnitude, runDate));
|
||||
return;
|
||||
}
|
||||
|
||||
TestInfo testInfo = new TestInfo(url, magnitude, runDate);
|
||||
|
||||
SuiteInfo suite = getSuite(url);
|
||||
if (suite != null) {
|
||||
suite.addTest(testInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
myTestsWithoutSuites.add(testInfo);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SuiteInfo getSuite(String url) {
|
||||
String testName = VirtualFileManager.extractPath(url);
|
||||
|
||||
for (SuiteInfo info : mySuites.values()) {
|
||||
String suiteName = info.getSuiteName();
|
||||
if (testName.startsWith(suiteName)) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> calculateTestList() {
|
||||
distributeUnmatchedTests();
|
||||
|
||||
List<SuiteInfo> suites = ContainerUtil.newArrayList(mySuites.values());
|
||||
Collections.sort(suites, TEST_BY_PATH_COMPARATOR);
|
||||
Collections.sort(myTestsWithoutSuites, TEST_BY_PATH_COMPARATOR);
|
||||
|
||||
Collections.sort(suites, SUITE_BY_RECENT_COMPARATOR);
|
||||
Collections.sort(myTestsWithoutSuites, TEST_BY_RECENT_COMPARATOR);
|
||||
|
||||
List<String> result = ContainerUtil.newArrayList();
|
||||
|
||||
fillWithSuites(result, select(suites, ERROR_INDEX));
|
||||
fillWithTests(result, select(myTestsWithoutSuites, ERROR_INDEX));
|
||||
|
||||
fillWithSuites(result, selectNot(suites, ERROR_INDEX, COMPLETE_INDEX, PASSED_INDEX));
|
||||
fillWithTests(result, selectNot(myTestsWithoutSuites, COMPLETE_INDEX, PASSED_INDEX));
|
||||
|
||||
fillWithSuites(result, select(suites, COMPLETE_INDEX, PASSED_INDEX));
|
||||
fillWithTests(result, select(myTestsWithoutSuites, COMPLETE_INDEX, PASSED_INDEX));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void fillWithTests(List<String> result, List<TestInfo> tests) {
|
||||
for (TestInfo info : tests) {
|
||||
result.add(info.getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
private static void fillWithSuites(List<String> result, List<SuiteInfo> suites) {
|
||||
for (SuiteInfo suite : suites) {
|
||||
result.addAll(suiteToTestList(suite));
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> suiteToTestList(SuiteInfo suite) {
|
||||
List<String> result = ContainerUtil.newArrayList();
|
||||
|
||||
TestStateInfo.Magnitude suiteMagnitude = suite.getMagnitude();
|
||||
Set<TestInfo> allTests = suite.getTests();
|
||||
|
||||
List<TestInfo> sameMagnitudeTests = suite.getTests(suiteMagnitude);
|
||||
if (sameMagnitudeTests.size() == allTests.size()) {
|
||||
result.add(suite.getUrl());
|
||||
}
|
||||
else {
|
||||
result.add(suite.getUrl());
|
||||
Collections.sort(sameMagnitudeTests, TEST_BY_RECENT_COMPARATOR);
|
||||
for (TestInfo test : sameMagnitudeTests) {
|
||||
result.add(test.getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void distributeUnmatchedTests() {
|
||||
List<TestInfo> noSuites = ContainerUtil.newSmartList();
|
||||
|
||||
for (TestInfo test : myTestsWithoutSuites) {
|
||||
String url = test.getUrl();
|
||||
SuiteInfo suite = getSuite(url);
|
||||
if (suite != null) {
|
||||
suite.addTest(test);
|
||||
}
|
||||
else {
|
||||
noSuites.add(test);
|
||||
}
|
||||
}
|
||||
|
||||
myTestsWithoutSuites = noSuites;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SuiteInfo extends TestInfo {
|
||||
private final String mySuiteName;
|
||||
private Set<TestInfo> tests = ContainerUtil.newHashSet();
|
||||
|
||||
public SuiteInfo(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
super(url, magnitude, runDate);
|
||||
mySuiteName = VirtualFileManager.extractPath(url);
|
||||
}
|
||||
|
||||
public Date getMostRecentRunDate() {
|
||||
Date mostRecent = getRunDate();
|
||||
for (TestInfo test : tests) {
|
||||
Date testDate = test.getRunDate();
|
||||
if (testDate.compareTo(mostRecent) > 0) {
|
||||
mostRecent = testDate;
|
||||
}
|
||||
}
|
||||
return mostRecent;
|
||||
}
|
||||
|
||||
public String getSuiteName() {
|
||||
return mySuiteName;
|
||||
}
|
||||
|
||||
public void addTest(TestInfo info) {
|
||||
tests.add(info);
|
||||
}
|
||||
|
||||
public Set<TestInfo> getTests() {
|
||||
return tests;
|
||||
}
|
||||
|
||||
public List<TestInfo> getTests(TestStateInfo.Magnitude magnitude) {
|
||||
return select(tests, magnitude);
|
||||
}
|
||||
}
|
||||
|
||||
class TestInfo {
|
||||
private final Date runDate;
|
||||
private final String url;
|
||||
private final TestStateInfo.Magnitude magnitude;
|
||||
|
||||
public TestInfo(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
this.url = url;
|
||||
this.magnitude = magnitude;
|
||||
this.runDate = runDate;
|
||||
}
|
||||
|
||||
public Date getRunDate() {
|
||||
return runDate;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public TestStateInfo.Magnitude getMagnitude() {
|
||||
return magnitude;
|
||||
}
|
||||
|
||||
public static <T extends TestInfo> List<T> select(Collection<T> infos, final TestStateInfo.Magnitude... magnitudes) {
|
||||
return ContainerUtil.filter(infos, new Condition<T>() {
|
||||
@Override
|
||||
public boolean value(T t) {
|
||||
for (TestStateInfo.Magnitude magnitude : magnitudes) {
|
||||
if (t.getMagnitude() == magnitude) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static <T extends TestInfo> List<T> selectNot(Collection<T> infos, final TestStateInfo.Magnitude... magnitudes) {
|
||||
return ContainerUtil.filter(infos, new Condition<T>() {
|
||||
@Override
|
||||
public boolean value(T t) {
|
||||
for (TestStateInfo.Magnitude magnitude : magnitudes) {
|
||||
if (t.getMagnitude() == magnitude) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -22,22 +22,14 @@ import com.intellij.execution.testframework.sm.runner.states.TestStateInfo;
|
||||
import com.intellij.openapi.ui.popup.PopupStep;
|
||||
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
private static Comparator<String> TEST_BY_PATH_COMPARATOR = new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
String path1 = VirtualFileManager.extractPath(o1);
|
||||
String path2 = VirtualFileManager.extractPath(o2);
|
||||
return path1.compareTo(path2);
|
||||
}
|
||||
};
|
||||
|
||||
private final Map<String, TestStateStorage.Record> myRecords;
|
||||
private final RecentTestRunner myRunner;
|
||||
|
||||
@@ -48,50 +40,15 @@ public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
}
|
||||
|
||||
private static List<String> getUrls(Map<String, TestStateStorage.Record> records, RecentTestRunner runner) {
|
||||
TestGroup groups = toTestGroups(records, runner);
|
||||
|
||||
List<String> failed = ContainerUtil.newArrayList(groups.failedTests);
|
||||
Collections.sort(failed, TEST_BY_PATH_COMPARATOR);
|
||||
List<String> other = ContainerUtil.newArrayList(groups.otherTests);
|
||||
Collections.sort(other, TEST_BY_PATH_COMPARATOR);
|
||||
List<String> passed = ContainerUtil.newArrayList(groups.passedTests);
|
||||
Collections.sort(passed, TEST_BY_PATH_COMPARATOR);
|
||||
|
||||
failed.addAll(other);
|
||||
failed.addAll(passed);
|
||||
return failed;
|
||||
}
|
||||
RecentTestsData data = new RecentTestsData(runner);
|
||||
|
||||
private static TestGroup toTestGroups(Map<String, TestStateStorage.Record> records, RecentTestRunner runner) {
|
||||
Set<String> failedTests = ContainerUtil.newHashSet();
|
||||
Set<String> passedSuites = ContainerUtil.newHashSet();
|
||||
Set<String> otherSuites = ContainerUtil.newHashSet();
|
||||
|
||||
for (Map.Entry<String, TestStateStorage.Record> item : records.entrySet()) {
|
||||
String url = item.getKey();
|
||||
TestStateInfo.Magnitude magnitude = getMagnitude(item.getValue().magnitude);
|
||||
if (magnitude == null) continue;
|
||||
switch (magnitude) {
|
||||
case COMPLETE_INDEX:
|
||||
if (runner.isSuite(url)) {
|
||||
passedSuites.add(url);
|
||||
}
|
||||
break;
|
||||
case PASSED_INDEX:
|
||||
if (runner.isSuite(url)) {
|
||||
passedSuites.add(url);
|
||||
}
|
||||
break;
|
||||
case ERROR_INDEX:
|
||||
failedTests.add(url);
|
||||
break;
|
||||
default:
|
||||
otherSuites.add(url);
|
||||
break;
|
||||
}
|
||||
for (Map.Entry<String, TestStateStorage.Record> entry : records.entrySet()) {
|
||||
String url = entry.getKey();
|
||||
TestStateStorage.Record record = entry.getValue();
|
||||
data.addTest(url, getMagnitude(record.magnitude), record.date);
|
||||
}
|
||||
|
||||
return new TestGroup(failedTests, passedSuites, otherSuites);
|
||||
|
||||
return data.calculateTestList();
|
||||
}
|
||||
|
||||
private static TestStateInfo.Magnitude getMagnitude(int magnitude) {
|
||||
|
||||
@@ -19,12 +19,14 @@ import com.intellij.execution.Location;
|
||||
import com.intellij.execution.TestStateStorage;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.keymap.MacKeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.ListPopupStep;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.popup.list.ListPopupImpl;
|
||||
import com.intellij.util.PsiNavigateUtil;
|
||||
import com.intellij.util.Time;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -39,9 +41,14 @@ public class ShowRecentTests extends AnAction {
|
||||
return new Date(System.currentTimeMillis() - Time.DAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(e.getProject() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
Map<String, TestStateStorage.Record> records = TestStateStorage.getInstance(project).getRecentTests(TEST_LIMIT, getSinceDate());
|
||||
@@ -61,6 +68,9 @@ class RecentTestsListPopup extends ListPopupImpl {
|
||||
myTestRunner = testRunner;
|
||||
shiftReleased();
|
||||
registerActions(this);
|
||||
|
||||
String shift = SystemInfo.isMac ? MacKeymapUtil.SHIFT : "Shift";
|
||||
setAdText("Debug with " + shift + ", navigate with F4");
|
||||
}
|
||||
|
||||
private void registerActions(ListPopupImpl popup) {
|
||||
@@ -98,13 +108,13 @@ class RecentTestsListPopup extends ListPopupImpl {
|
||||
}
|
||||
|
||||
private void shiftPressed() {
|
||||
setCaption("Run Recent Tests");
|
||||
myTestRunner.setMode(RecentTestRunner.Mode.RUN);
|
||||
setCaption("Debug Recent Tests");
|
||||
myTestRunner.setMode(RecentTestRunner.Mode.DEBUG);
|
||||
}
|
||||
|
||||
private void shiftReleased() {
|
||||
setCaption("Debug Recent Tests");
|
||||
myTestRunner.setMode(RecentTestRunner.Mode.DEBUG);
|
||||
setCaption("Run Recent Tests");
|
||||
myTestRunner.setMode(RecentTestRunner.Mode.RUN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,7 @@ import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.options.UnnamedConfigurableGroup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.TabbedPaneWrapper;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -96,14 +97,14 @@ public class FacetEditorImpl extends UnnamedConfigurableGroup implements Unnamed
|
||||
}
|
||||
else if (myEditorTabs.length == 1) {
|
||||
editorComponent = myEditorTabs[0].createComponent();
|
||||
UIUtil.addInsets(editorComponent, new Insets(0, 5, 0, 0));
|
||||
UIUtil.addInsets(editorComponent, JBUI.insets(0, 5, 0, 0));
|
||||
}
|
||||
else {
|
||||
editorComponent = new JPanel();
|
||||
}
|
||||
|
||||
final JComponent errorComponent = myErrorPanel.getComponent();
|
||||
UIUtil.addInsets(errorComponent, new Insets(0, 5, 5, 0));
|
||||
UIUtil.addInsets(errorComponent, JBUI.insets(0, 5, 5, 0));
|
||||
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(BorderLayout.CENTER, editorComponent);
|
||||
|
||||
@@ -18,14 +18,12 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.options.newEditor.SettingsDialog;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ShowStructureSettingsAction extends AnAction implements DumbAware {
|
||||
@@ -39,18 +37,12 @@ public class ShowStructureSettingsAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
static void showDialog(Project project) {
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
new SingleConfigurableEditor(project, ProjectStructureConfigurable.getInstance(project), SettingsDialog.DIMENSION_KEY) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected DialogStyle getStyle() {
|
||||
return DialogStyle.COMPACT;
|
||||
}
|
||||
}.show();
|
||||
}
|
||||
else {
|
||||
ShowSettingsUtil
|
||||
.getInstance().editConfigurable(project, SettingsDialog.DIMENSION_KEY, ProjectStructureConfigurable.getInstance(project));
|
||||
}
|
||||
new SingleConfigurableEditor(project, ProjectStructureConfigurable.getInstance(project), SettingsDialog.DIMENSION_KEY) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected DialogStyle getStyle() {
|
||||
return DialogStyle.COMPACT;
|
||||
}
|
||||
}.show();
|
||||
}
|
||||
}
|
||||
@@ -604,40 +604,40 @@ public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, D
|
||||
}
|
||||
|
||||
void loadRemoteTemplates(final ChooseTemplateStep chooseTemplateStep) {
|
||||
myTemplatesList.setPaintBusy(true);
|
||||
chooseTemplateStep.getTemplateList().setPaintBusy(true);
|
||||
ProgressManager.getInstance().run(new Task.Backgroundable(myContext.getProject(), "Loading Templates") {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
try {
|
||||
myTemplatesList.setPaintBusy(true);
|
||||
chooseTemplateStep.getTemplateList().setPaintBusy(true);
|
||||
RemoteTemplatesFactory factory = new RemoteTemplatesFactory();
|
||||
for (String group : factory.getGroups()) {
|
||||
ProjectTemplate[] templates = factory.createTemplates(group, myContext);
|
||||
for (ProjectTemplate template : templates) {
|
||||
String id = ((ArchivedProjectTemplate)template).getCategory();
|
||||
for (TemplatesGroup templatesGroup : myTemplatesMap.keySet()) {
|
||||
if (Comparing.equal(id, templatesGroup.getId()) || Comparing.equal(group, templatesGroup.getName())) {
|
||||
myTemplatesMap.putValue(templatesGroup, template);
|
||||
}
|
||||
RemoteTemplatesFactory factory = new RemoteTemplatesFactory();
|
||||
for (String group : factory.getGroups()) {
|
||||
ProjectTemplate[] templates = factory.createTemplates(group, myContext);
|
||||
for (ProjectTemplate template : templates) {
|
||||
String id = ((ArchivedProjectTemplate)template).getCategory();
|
||||
for (TemplatesGroup templatesGroup : myTemplatesMap.keySet()) {
|
||||
if (Comparing.equal(id, templatesGroup.getId()) || Comparing.equal(group, templatesGroup.getName())) {
|
||||
myTemplatesMap.putValue(templatesGroup, template);
|
||||
}
|
||||
}
|
||||
}
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
TemplatesGroup group = getSelectedGroup();
|
||||
if (group == null) return;
|
||||
Collection<ProjectTemplate> templates = myTemplatesMap.get(group);
|
||||
setTemplatesList(group, templates, true);
|
||||
chooseTemplateStep.updateStep();
|
||||
}
|
||||
});
|
||||
}
|
||||
finally {
|
||||
myTemplatesList.setPaintBusy(false);
|
||||
chooseTemplateStep.getTemplateList().setPaintBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess();
|
||||
TemplatesGroup group = getSelectedGroup();
|
||||
if (group == null) return;
|
||||
Collection<ProjectTemplate> templates = myTemplatesMap.get(group);
|
||||
setTemplatesList(group, templates, true);
|
||||
chooseTemplateStep.updateStep();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished() {
|
||||
myTemplatesList.setPaintBusy(false);
|
||||
chooseTemplateStep.getTemplateList().setPaintBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.IdeaModifiableModelsProvider;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
@@ -176,7 +175,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
|
||||
private static void addAssociatedFrameworkComponent(JPanel component, JPanel panel) {
|
||||
panel.add(component, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0, GridBagConstraints.NORTHWEST,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
|
||||
GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
|
||||
}
|
||||
|
||||
protected void onFrameworkStateChanged() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.FieldPanel;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -91,11 +92,11 @@ public class NamePathComponent extends JPanel{
|
||||
myNameLabel = new JLabel(nameLabelText);
|
||||
if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
|
||||
myNameLabel.setLabelFor(myTfName);
|
||||
Insets insets = new Insets(0, 0, 5, 4);
|
||||
Insets insets = JBUI.insets(0, 0, 5, 4);
|
||||
this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
|
||||
insets, 0, 0));
|
||||
|
||||
insets = new Insets(0, 0, 5, 0);
|
||||
insets = JBUI.insets(0, 0, 5, 0);
|
||||
this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
|
||||
insets, 0, 0));
|
||||
// todo: review texts
|
||||
@@ -111,10 +112,10 @@ public class NamePathComponent extends JPanel{
|
||||
myPathLabel = new JLabel(pathLabelText);
|
||||
myPathLabel.setLabelFor(myTfPath);
|
||||
if (bold) myPathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
|
||||
insets = new Insets(0, 0, 5, 4);
|
||||
insets = JBUI.insets(0, 0, 5, 4);
|
||||
this.add(myPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
|
||||
insets, 0, 0));
|
||||
insets = new Insets(0, 0, 5, 0);
|
||||
insets = JBUI.insets(0, 0, 5, 0);
|
||||
this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
|
||||
insets, 0, 0));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,12 +19,12 @@ import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.highlighter.ModuleFileType;
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -55,9 +55,9 @@ public class ProjectNameStep extends ModuleWizardStep {
|
||||
ApplicationInfo info = ApplicationInfo.getInstance();
|
||||
String appName = info.getVersionName();
|
||||
myPanel.add(new JLabel(IdeBundle.message("label.please.enter.project.name", appName, wizardContext.getPresentationName())),
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0));
|
||||
|
||||
myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));
|
||||
myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0));
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.TabbedPaneWrapper;
|
||||
import com.intellij.ui.navigation.History;
|
||||
@@ -152,8 +151,8 @@ public class SdkEditor implements Configurable, Place.Navigator {
|
||||
myHomeComponent.getTextField().setEditable(false);
|
||||
|
||||
myHomeFieldLabel = new JLabel(getHomeFieldLabelValue());
|
||||
final int leftInset = Registry.is("ide.new.project.settings") ? 10 : 0;
|
||||
final int rightInset = Registry.is("ide.new.project.settings") ? 10 : 0;
|
||||
final int leftInset = 10;
|
||||
final int rightInset = 10;
|
||||
myMainPanel.add(myHomeFieldLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, leftInset, 2, 2), 0, 0));
|
||||
myMainPanel.add(myHomeComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, rightInset), 0, 0));
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.roots.impl.storage.ClasspathStorageProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.classpath.ClasspathPanelImpl;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -163,7 +164,7 @@ public class ClasspathEditor extends ModuleElementsEditor implements ModuleRootL
|
||||
super(new GridBagLayout());
|
||||
|
||||
add(new JLabel(ProjectBundle.message("project.roots.classpath.format.label")),
|
||||
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 6, 6, 0), 0, 0));
|
||||
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(10, 6, 6, 0), 0, 0));
|
||||
|
||||
formatIdToDescription.put(ClassPathStorageUtil.DEFAULT_STORAGE, ProjectBundle.message("project.roots.classpath.format.default.descr"));
|
||||
for (ClasspathStorageProvider provider : providers) {
|
||||
@@ -173,7 +174,7 @@ public class ClasspathEditor extends ModuleElementsEditor implements ModuleRootL
|
||||
comboBoxClasspathFormat = new ComboBox(formatIdToDescription.values().toArray());
|
||||
updateClasspathFormat();
|
||||
add(comboBoxClasspathFormat,
|
||||
new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 0), 0, 0));
|
||||
new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(6, 6, 6, 0), 0, 0));
|
||||
}
|
||||
|
||||
private void updateClasspathFormat() {
|
||||
|
||||
-12
@@ -17,7 +17,6 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot;
|
||||
import com.intellij.ide.util.projectWizard.importSources.JavaSourceRootDetectionUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.util.ProgressWindow;
|
||||
@@ -26,7 +25,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -35,8 +33,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -139,12 +135,4 @@ public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JPanel createBottomControl(Module module) {
|
||||
if (Registry.is("ide.new.project.settings")) return null;
|
||||
final JPanel innerPanel = new JPanel(new GridBagLayout());
|
||||
innerPanel.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 6));
|
||||
return innerPanel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.navigation.History;
|
||||
import com.intellij.ui.navigation.Place;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
@@ -261,11 +260,6 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
|
||||
|
||||
createEditors(getModule());
|
||||
|
||||
if (!Registry.is("ide.new.project.settings")) {
|
||||
JPanel northPanel = new JPanel(new GridBagLayout());
|
||||
myGenericSettingsPanel.add(northPanel, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
final JComponent component = createCenterPanel();
|
||||
myGenericSettingsPanel.add(component, BorderLayout.CENTER);
|
||||
myEditorsInitialized = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -49,7 +50,7 @@ public class OutputEditor extends ModuleElementsEditor {
|
||||
final JPanel panel = new JPanel(new GridBagLayout());
|
||||
panel.setBorder(new EmptyBorder(UIUtil.PANEL_SMALL_INSETS));
|
||||
final GridBagConstraints gc =
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0);
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0);
|
||||
panel.add(myCompilerOutputEditor.createComponentImpl(), gc);
|
||||
final JPanel javadocPanel = (JPanel)myJavadocEditor.createComponentImpl();
|
||||
javadocPanel.setBorder(IdeBorderFactory.createTitledBorder(myJavadocEditor.getDisplayName(), false));
|
||||
|
||||
+1
-2
@@ -44,7 +44,6 @@ import com.intellij.openapi.ui.DetailsComponent;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -118,7 +117,7 @@ public class ProjectConfigurable extends ProjectStructureElementConfigurable<Pro
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
myDetailsComponent = new DetailsComponent(!Registry.is("ide.new.project.settings"), !Registry.is("ide.new.project.settings"));
|
||||
myDetailsComponent = new DetailsComponent(false, false);
|
||||
myDetailsComponent.setContent(myPanel);
|
||||
myDetailsComponent.setText(getBannerSlogan());
|
||||
|
||||
|
||||
+5
-14
@@ -40,7 +40,6 @@ import com.intellij.openapi.ui.MasterDetailsComponent;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.ui.JBSplitter;
|
||||
@@ -177,7 +176,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
public JComponent createComponent() {
|
||||
myComponent = new MyPanel();
|
||||
|
||||
mySplitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false, .15f) : new JBSplitter(false, .15f);
|
||||
mySplitter = new OnePixelSplitter(false, .15f);
|
||||
mySplitter.setSplitterProportionKey("ProjectStructure.TopLevelElements");
|
||||
mySplitter.setHonorComponentsMinimumSize(true);
|
||||
|
||||
@@ -197,10 +196,8 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarGroup, true);
|
||||
toolbar.setTargetComponent(myComponent);
|
||||
myToolbarComponent = toolbar.getComponent();
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
left.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
myToolbarComponent.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
}
|
||||
left.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
myToolbarComponent.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
left.add(myToolbarComponent, BorderLayout.NORTH);
|
||||
left.add(mySidePanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -208,10 +205,6 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
mySplitter.setSecondComponent(myDetails);
|
||||
|
||||
myComponent.add(mySplitter, BorderLayout.CENTER);
|
||||
if (!Registry.is("ide.new.project.settings")) {
|
||||
myErrorsComponent = new ConfigurationErrorsComponent(myProject);
|
||||
myComponent.add(myErrorsComponent, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
myUiInitialized = true;
|
||||
|
||||
@@ -251,10 +244,8 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
}
|
||||
}
|
||||
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
mySidePanel.addSeparator("--");
|
||||
addErrorPane();
|
||||
}
|
||||
mySidePanel.addSeparator("--");
|
||||
addErrorPane();
|
||||
}
|
||||
|
||||
private void addArtifactsConfig() {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.ui.popup.ListItemDescriptor;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
@@ -58,10 +57,8 @@ public class SidePanel extends JPanel {
|
||||
|
||||
myModel = new DefaultListModel();
|
||||
myList = new JBList(myModel);
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
myList.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
myList.setBorder(new EmptyBorder(5, 0, 0, 0));
|
||||
}
|
||||
myList.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
|
||||
myList.setBorder(new EmptyBorder(5, 0, 0, 0));
|
||||
final ListItemDescriptor descriptor = new ListItemDescriptor() {
|
||||
@Override
|
||||
public String getTextFor(final Object value) {
|
||||
@@ -75,7 +72,7 @@ public class SidePanel extends JPanel {
|
||||
|
||||
@Override
|
||||
public Icon getIconFor(final Object value) {
|
||||
return Registry.is("ide.new.project.settings") ? EmptyIcon.create(16, 20) : null;
|
||||
return EmptyIcon.create(16, 20);
|
||||
//return myPlace2Presentation.get(value).getIcon();
|
||||
}
|
||||
|
||||
@@ -101,7 +98,7 @@ public class SidePanel extends JPanel {
|
||||
|
||||
@Override
|
||||
protected Color getForeground() {
|
||||
return Registry.is("ide.new.project.settings") ? new JBColor(Gray._60, Gray._140) : super.getForeground();
|
||||
return new JBColor(Gray._60, Gray._140);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,14 +108,10 @@ public class SidePanel extends JPanel {
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH);
|
||||
myExtraPanel.add(myComponent, BorderLayout.CENTER);
|
||||
myExtraPanel.add(myCountLabel, BorderLayout.EAST);
|
||||
myRendererComponent.add(myExtraPanel, BorderLayout.CENTER);
|
||||
} else {
|
||||
super.layout();
|
||||
}
|
||||
myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH);
|
||||
myExtraPanel.add(myComponent, BorderLayout.CENTER);
|
||||
myExtraPanel.add(myCountLabel, BorderLayout.EAST);
|
||||
myRendererComponent.add(myExtraPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,21 +144,19 @@ public class SidePanel extends JPanel {
|
||||
myCountLabel = new SidePanelCountLabel();
|
||||
final JComponent component = super.createItemComponent();
|
||||
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
myTextLabel.setForeground(Gray._240);
|
||||
myTextLabel.setOpaque(true);
|
||||
}
|
||||
myTextLabel.setForeground(Gray._240);
|
||||
myTextLabel.setOpaque(true);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBackground() {
|
||||
return Registry.is("ide.new.project.settings") ? UIUtil.SIDE_PANEL_BACKGROUND : super.getBackground();
|
||||
return UIUtil.SIDE_PANEL_BACKGROUND;
|
||||
}
|
||||
});
|
||||
|
||||
add(ScrollPaneFactory.createScrollPane(myList, Registry.is("ide.new.project.settings")), BorderLayout.CENTER);
|
||||
add(ScrollPaneFactory.createScrollPane(myList, true), BorderLayout.CENTER);
|
||||
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
myList.addListSelectionListener(new ListSelectionListener() {
|
||||
|
||||
+8
-13
@@ -39,7 +39,6 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
@@ -108,9 +107,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
myPropertiesEditors = new ArtifactPropertiesEditors(myContext, myOriginalArtifact, myOriginalArtifact);
|
||||
Disposer.register(this, mySourceItemsTree);
|
||||
Disposer.register(this, myLayoutTreeComponent);
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
myTopPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
|
||||
}
|
||||
myTopPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
|
||||
myBuildOnMakeCheckBox.setSelected(artifact.isBuildOnMake());
|
||||
final String outputPath = artifact.getOutputPath();
|
||||
myOutputDirectoryField.addBrowseFolderListener(CompilerBundle.message("dialog.title.output.directory.for.artifact"),
|
||||
@@ -207,7 +204,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
|
||||
myErrorPanelPlace.add(myValidationManager.getMainErrorPanel(), BorderLayout.CENTER);
|
||||
|
||||
final JBSplitter splitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false) : new JBSplitter(false);
|
||||
final JBSplitter splitter = new OnePixelSplitter(false);
|
||||
final JPanel leftPanel = new JPanel(new BorderLayout());
|
||||
JPanel treePanel = myLayoutTreeComponent.getTreePanel();
|
||||
if (UIUtil.isUnderDarcula()) {
|
||||
@@ -246,7 +243,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
labelPanel.add(link);
|
||||
rightTopPanel.add(labelPanel, BorderLayout.CENTER);
|
||||
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
|
||||
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, UIUtil.isUnderDarcula() || Registry.is("ide.new.project.settings"));
|
||||
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true);
|
||||
JPanel scrollPaneWrap = new JPanel(new BorderLayout());
|
||||
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
|
||||
if (UIUtil.isUnderDarcula()) {
|
||||
@@ -262,13 +259,11 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
rightPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));
|
||||
}
|
||||
splitter.setSecondComponent(rightPanel);
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
splitter.getDivider().setBackground(UIUtil.getPanelBackground());
|
||||
treePanel.setBorder(JBUI.Borders.empty());
|
||||
rightPanel.setBorder(JBUI.Borders.empty());
|
||||
scrollPaneWrap.setBorder(JBUI.Borders.empty());
|
||||
leftPanel.setBorder(JBUI.Borders.empty());
|
||||
}
|
||||
splitter.getDivider().setBackground(UIUtil.getPanelBackground());
|
||||
treePanel.setBorder(JBUI.Borders.empty());
|
||||
rightPanel.setBorder(JBUI.Borders.empty());
|
||||
scrollPaneWrap.setBorder(JBUI.Borders.empty());
|
||||
leftPanel.setBorder(JBUI.Borders.empty());
|
||||
|
||||
|
||||
myShowContentCheckBox.addActionListener(new ActionListener() {
|
||||
|
||||
+1
-4
@@ -41,7 +41,6 @@ import com.intellij.openapi.ui.ex.MultiLineLabel;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -159,9 +158,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
|
||||
ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(myTree).disableUpDownActions()
|
||||
.setRemoveActionName(ProjectBundle.message("library.remove.action"))
|
||||
.disableRemoveAction();
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
toolbarDecorator.setPanelBorder(new CustomLineBorder(1, 0, 0, 0));
|
||||
}
|
||||
toolbarDecorator.setPanelBorder(new CustomLineBorder(1, 0, 0, 0));
|
||||
final List<AttachRootButtonDescriptor> popupItems = new ArrayList<AttachRootButtonDescriptor>();
|
||||
for (AttachRootButtonDescriptor descriptor : myDescriptor.createAttachButtons()) {
|
||||
Icon icon = descriptor.getToolbarIcon();
|
||||
|
||||
+1
-2
@@ -34,7 +34,6 @@ import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.TreeSpeedSearch;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.navigation.Place;
|
||||
@@ -295,7 +294,7 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i
|
||||
result.addAll(copyActions);
|
||||
result.add(Separator.getInstance());
|
||||
|
||||
if (fromPopup || !Registry.is("ide.new.project.settings")) {
|
||||
if (fromPopup) {
|
||||
result.add(new MyFindUsagesAction(myTree));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -35,7 +35,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.FacetProje
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.openapi.ui.DetailsComponent;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
@@ -276,7 +275,7 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable {
|
||||
actions.add(new MyNavigateAction());
|
||||
}
|
||||
actions.add(new MyRemoveAction());
|
||||
if (fromPopup || !(Registry.is("ide.new.project.settings"))) {
|
||||
if (fromPopup) {
|
||||
actions.add(Separator.getInstance());
|
||||
addCollapseExpandActions(actions);
|
||||
}
|
||||
|
||||
+1
-2
@@ -52,7 +52,6 @@ import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.NullableComputable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -153,7 +152,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
@NotNull
|
||||
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
|
||||
final ArrayList<AnAction> result = super.createActions(fromPopup);
|
||||
if (fromPopup || !Registry.is("ide.new.project.settings")) {
|
||||
if (fromPopup) {
|
||||
result.add(Separator.getInstance());
|
||||
result.add(new MyGroupAction());
|
||||
addCollapseExpandActions(result);
|
||||
|
||||
+2
-8
@@ -34,7 +34,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.LibraryConfigurab
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
@@ -98,11 +97,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
final String name = StringUtil.escapeXml(libraryName);
|
||||
buffer.append("Library ");
|
||||
if (Registry.is("ide.new.project.settings")) {
|
||||
buffer.append("<a href='http://library/").append(name).append("'>").append(name).append("</a>");
|
||||
} else {
|
||||
buffer.append("'").append(name).append("'");
|
||||
}
|
||||
buffer.append("<a href='http://library/").append(name).append("'>").append(name).append("</a>");
|
||||
buffer.append(" has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
|
||||
for (String url : invalidClasses) {
|
||||
buffer.append("<br> ");
|
||||
@@ -159,8 +154,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
public ProjectStructureProblemDescription createUnusedElementWarning() {
|
||||
final List<ConfigurationErrorQuickFix> fixes = Arrays.asList(new AddLibraryToDependenciesFix(), new RemoveLibraryFix(), new RemoveAllUnusedLibrariesFix());
|
||||
final String name = StringUtil.escapeXml(myLibrary.getName());
|
||||
String libraryName = Registry.is("ide.new.project.settings") ? "<a href='http://library/" + name + "'>" + name + "</a>"
|
||||
: "'" + name + "'";
|
||||
String libraryName = "<a href='http://library/" + name + "'>" + name + "</a>";
|
||||
return new ProjectStructureProblemDescription("Library " + libraryName + " is not used", null, createPlace(),
|
||||
ProjectStructureProblemType.unused("unused-library"), ProjectStructureProblemDescription.ProblemLevel.PROJECT,
|
||||
fixes, false);
|
||||
|
||||
+50
-7
@@ -20,14 +20,57 @@ import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
|
||||
import com.intellij.ide.highlighter.JavaHighlightingColors;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author anna
|
||||
* Date: 01-Feb-2008
|
||||
*/
|
||||
public interface JavaHighlightInfoTypes {
|
||||
HighlightInfoType UNUSED_IMPORT = new HighlightInfoType.HighlightInfoTypeSeverityByKey(
|
||||
public final class JavaHighlightInfoTypes {
|
||||
private JavaHighlightInfoTypes() {
|
||||
}
|
||||
|
||||
public final static HighlightInfoType UNUSED_IMPORT = new HighlightInfoType.HighlightInfoTypeSeverityByKey(
|
||||
HighlightDisplayKey.findOrRegister(UnusedImportLocalInspection.SHORT_NAME, UnusedImportLocalInspection.DISPLAY_NAME), CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES);
|
||||
|
||||
HighlightInfoType JAVA_KEYWORD = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, JavaHighlightingColors.KEYWORD);
|
||||
public final static HighlightInfoType JAVA_KEYWORD = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, JavaHighlightingColors.KEYWORD);
|
||||
|
||||
public final static HighlightInfoType CLASS_NAME = createSymbolTypeInfo(JavaHighlightingColors.CLASS_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType LOCAL_VARIABLE = createSymbolTypeInfo(JavaHighlightingColors.LOCAL_VARIABLE_ATTRIBUTES);
|
||||
public final static HighlightInfoType INSTANCE_FIELD = createSymbolTypeInfo(JavaHighlightingColors.INSTANCE_FIELD_ATTRIBUTES);
|
||||
public final static HighlightInfoType INSTANCE_FINAL_FIELD = createSymbolTypeInfo(JavaHighlightingColors.INSTANCE_FINAL_FIELD_ATTRIBUTES);
|
||||
public final static HighlightInfoType STATIC_FIELD = createSymbolTypeInfo(JavaHighlightingColors.STATIC_FIELD_ATTRIBUTES);
|
||||
public final static HighlightInfoType STATIC_FINAL_FIELD = createSymbolTypeInfo(JavaHighlightingColors.STATIC_FINAL_FIELD_ATTRIBUTES);
|
||||
public final static HighlightInfoType PARAMETER = createSymbolTypeInfo(JavaHighlightingColors.PARAMETER_ATTRIBUTES);
|
||||
public final static HighlightInfoType METHOD_CALL = createSymbolTypeInfo(JavaHighlightingColors.METHOD_CALL_ATTRIBUTES);
|
||||
public final static HighlightInfoType METHOD_DECLARATION = createSymbolTypeInfo(JavaHighlightingColors.METHOD_DECLARATION_ATTRIBUTES);
|
||||
public final static HighlightInfoType CONSTRUCTOR_CALL = createSymbolTypeInfo(JavaHighlightingColors.CONSTRUCTOR_CALL_ATTRIBUTES);
|
||||
public final static HighlightInfoType CONSTRUCTOR_DECLARATION = createSymbolTypeInfo(JavaHighlightingColors.CONSTRUCTOR_DECLARATION_ATTRIBUTES);
|
||||
public final static HighlightInfoType STATIC_METHOD = createSymbolTypeInfo(JavaHighlightingColors.STATIC_METHOD_ATTRIBUTES);
|
||||
public final static HighlightInfoType ABSTRACT_METHOD = createSymbolTypeInfo(JavaHighlightingColors.ABSTRACT_METHOD_ATTRIBUTES);
|
||||
public final static HighlightInfoType INHERITED_METHOD = createSymbolTypeInfo(JavaHighlightingColors.INHERITED_METHOD_ATTRIBUTES);
|
||||
public final static HighlightInfoType ANONYMOUS_CLASS_NAME = createSymbolTypeInfo(JavaHighlightingColors.ANONYMOUS_CLASS_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType INTERFACE_NAME = createSymbolTypeInfo(JavaHighlightingColors.INTERFACE_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType ENUM_NAME = createSymbolTypeInfo(JavaHighlightingColors.ENUM_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType TYPE_PARAMETER_NAME
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.TYPE_PARAMETER_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType ABSTRACT_CLASS_NAME = createSymbolTypeInfo(JavaHighlightingColors.ABSTRACT_CLASS_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType ANNOTATION_NAME
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.ANNOTATION_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType ANNOTATION_ATTRIBUTE_NAME
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES);
|
||||
public final static HighlightInfoType REASSIGNED_LOCAL_VARIABLE
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.REASSIGNED_LOCAL_VARIABLE_ATTRIBUTES);
|
||||
public final static HighlightInfoType REASSIGNED_PARAMETER
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.REASSIGNED_PARAMETER_ATTRIBUTES);
|
||||
public final static HighlightInfoType IMPLICIT_ANONYMOUS_CLASS_PARAMETER
|
||||
= new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY,
|
||||
JavaHighlightingColors.IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES);
|
||||
|
||||
private static HighlightInfoType createSymbolTypeInfo(@NotNull TextAttributesKey attributesKey) {
|
||||
return new HighlightInfoType.HighlightInfoTypeImpl(HighlightInfoType.SYMBOL_TYPE_SEVERITY, attributesKey, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-5
@@ -168,10 +168,12 @@ public class HighlightMethodUtil {
|
||||
@NotNull TextRange range,
|
||||
@NotNull LanguageLevel languageLevel) {
|
||||
if (superReturnType == null) return null;
|
||||
if ("clone".equals(method.getName())) {
|
||||
final PsiClass superContainingClass = superMethod.getContainingClass();
|
||||
if (superContainingClass != null &&
|
||||
CommonClassNames.JAVA_LANG_OBJECT.equals(superContainingClass.getQualifiedName()) &&
|
||||
!superMethod.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
final PsiClass superContainingClass = superMethod.getContainingClass();
|
||||
if (containingClass != null && superContainingClass != null && containingClass.isInterface() && !superContainingClass.isInterface()) {
|
||||
if (containingClass != null && containingClass.isInterface() && !superContainingClass.isInterface()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -805,7 +807,7 @@ public class HighlightMethodUtil {
|
||||
|
||||
@Language("HTML")
|
||||
@NonNls String parensizedName = methodName + (parameters.length == 0 ? "( ) " : "");
|
||||
final String errorMessage = info != null ? info.getInferenceErrorMessage() : null;
|
||||
String errorMessage = info != null ? info.getParentInferenceErrorMessage(list) : null;
|
||||
return JavaErrorMessages.message(
|
||||
"argument.mismatch.html.tooltip",
|
||||
Integer.valueOf(cols - parameters.length + 1), parensizedName,
|
||||
@@ -917,7 +919,7 @@ public class HighlightMethodUtil {
|
||||
}
|
||||
|
||||
s+= "</table>";
|
||||
final String errorMessage = info != null ? info.getInferenceErrorMessage() : null;
|
||||
final String errorMessage = info != null ? info.getParentInferenceErrorMessage(list) : null;
|
||||
if (errorMessage != null) {
|
||||
s+= "reason: ";
|
||||
s += XmlStringUtil.escapeString(errorMessage).replaceAll("\n", "<br/>");
|
||||
|
||||
+20
-19
@@ -22,6 +22,7 @@ package com.intellij.codeInsight.daemon.impl.analysis;
|
||||
import com.intellij.application.options.colors.ScopeAttributesUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
import com.intellij.codeInsight.daemon.impl.JavaHighlightInfoTypes;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
@@ -171,32 +172,32 @@ public class HighlightNamesUtil {
|
||||
|
||||
private static HighlightInfoType getMethodNameHighlightType(@NotNull PsiMethod method, boolean isDeclaration, boolean isInheritedMethod) {
|
||||
if (method.isConstructor()) {
|
||||
return isDeclaration ? HighlightInfoType.CONSTRUCTOR_DECLARATION : HighlightInfoType.CONSTRUCTOR_CALL;
|
||||
return isDeclaration ? JavaHighlightInfoTypes.CONSTRUCTOR_DECLARATION : JavaHighlightInfoTypes.CONSTRUCTOR_CALL;
|
||||
}
|
||||
if (isDeclaration) return HighlightInfoType.METHOD_DECLARATION;
|
||||
if (isDeclaration) return JavaHighlightInfoTypes.METHOD_DECLARATION;
|
||||
if (method.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
return HighlightInfoType.STATIC_METHOD;
|
||||
return JavaHighlightInfoTypes.STATIC_METHOD;
|
||||
}
|
||||
if (isInheritedMethod) return HighlightInfoType.INHERITED_METHOD;
|
||||
if (isInheritedMethod) return JavaHighlightInfoTypes.INHERITED_METHOD;
|
||||
if(method.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
return HighlightInfoType.ABSTRACT_METHOD;
|
||||
return JavaHighlightInfoTypes.ABSTRACT_METHOD;
|
||||
}
|
||||
return HighlightInfoType.METHOD_CALL;
|
||||
return JavaHighlightInfoTypes.METHOD_CALL;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static HighlightInfoType getVariableNameHighlightType(PsiVariable var) {
|
||||
if (var instanceof PsiLocalVariable
|
||||
|| var instanceof PsiParameter && ((PsiParameter)var).getDeclarationScope() instanceof PsiForeachStatement) {
|
||||
return HighlightInfoType.LOCAL_VARIABLE;
|
||||
return JavaHighlightInfoTypes.LOCAL_VARIABLE;
|
||||
}
|
||||
if (var instanceof PsiField) {
|
||||
return var.hasModifierProperty(PsiModifier.STATIC)
|
||||
? var.hasModifierProperty(PsiModifier.FINAL) ? HighlightInfoType.STATIC_FINAL_FIELD : HighlightInfoType.STATIC_FIELD
|
||||
: var.hasModifierProperty(PsiModifier.FINAL) ? HighlightInfoType.INSTANCE_FINAL_FIELD : HighlightInfoType.INSTANCE_FIELD;
|
||||
? var.hasModifierProperty(PsiModifier.FINAL) ? JavaHighlightInfoTypes.STATIC_FINAL_FIELD : JavaHighlightInfoTypes.STATIC_FIELD
|
||||
: var.hasModifierProperty(PsiModifier.FINAL) ? JavaHighlightInfoTypes.INSTANCE_FINAL_FIELD : JavaHighlightInfoTypes.INSTANCE_FIELD;
|
||||
}
|
||||
if (var instanceof PsiParameter) {
|
||||
return HighlightInfoType.PARAMETER;
|
||||
return JavaHighlightInfoTypes.PARAMETER;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -204,27 +205,27 @@ public class HighlightNamesUtil {
|
||||
@NotNull
|
||||
private static HighlightInfoType getClassNameHighlightType(@Nullable PsiClass aClass, @Nullable PsiElement element) {
|
||||
if (element instanceof PsiJavaCodeReferenceElement && element.getParent() instanceof PsiAnonymousClass) {
|
||||
return HighlightInfoType.ANONYMOUS_CLASS_NAME;
|
||||
return JavaHighlightInfoTypes.ANONYMOUS_CLASS_NAME;
|
||||
}
|
||||
if (aClass != null) {
|
||||
if (aClass.isAnnotationType()) return HighlightInfoType.ANNOTATION_NAME;
|
||||
if (aClass.isInterface()) return HighlightInfoType.INTERFACE_NAME;
|
||||
if (aClass.isEnum()) return HighlightInfoType.ENUM_NAME;
|
||||
if (aClass instanceof PsiTypeParameter) return HighlightInfoType.TYPE_PARAMETER_NAME;
|
||||
if (aClass.isAnnotationType()) return JavaHighlightInfoTypes.ANNOTATION_NAME;
|
||||
if (aClass.isInterface()) return JavaHighlightInfoTypes.INTERFACE_NAME;
|
||||
if (aClass.isEnum()) return JavaHighlightInfoTypes.ENUM_NAME;
|
||||
if (aClass instanceof PsiTypeParameter) return JavaHighlightInfoTypes.TYPE_PARAMETER_NAME;
|
||||
final PsiModifierList modList = aClass.getModifierList();
|
||||
if (modList != null && modList.hasModifierProperty(PsiModifier.ABSTRACT)) return HighlightInfoType.ABSTRACT_CLASS_NAME;
|
||||
if (modList != null && modList.hasModifierProperty(PsiModifier.ABSTRACT)) return JavaHighlightInfoTypes.ABSTRACT_CLASS_NAME;
|
||||
}
|
||||
// use class by default
|
||||
return HighlightInfoType.CLASS_NAME;
|
||||
return JavaHighlightInfoTypes.CLASS_NAME;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static HighlightInfo highlightReassignedVariable(PsiVariable variable, PsiElement elementToHighlight) {
|
||||
if (variable instanceof PsiLocalVariable) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.REASSIGNED_LOCAL_VARIABLE).range(elementToHighlight).create();
|
||||
return HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.REASSIGNED_LOCAL_VARIABLE).range(elementToHighlight).create();
|
||||
}
|
||||
if (variable instanceof PsiParameter) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.REASSIGNED_PARAMETER).range(elementToHighlight).create();
|
||||
return HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.REASSIGNED_PARAMETER).range(elementToHighlight).create();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+22
-6
@@ -60,7 +60,10 @@ import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -1548,12 +1551,25 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
//or if there exists some other direct superclass or direct superinterface of T, J, such that J is a subtype of I.
|
||||
final PsiClass classT = PsiTreeUtil.getParentOfType(expr, PsiClass.class);
|
||||
if (classT != null) {
|
||||
final PsiElement parent = expr.getParent();
|
||||
final PsiElement resolved = parent instanceof PsiReferenceExpression ? ((PsiReferenceExpression)parent).resolve() : null;
|
||||
|
||||
for (PsiClass superClass : classT.getSupers()) {
|
||||
if (superClass.isInterface() && //check spec-javac relations
|
||||
superClass.isInheritor(aClass, true)) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(qualifier)
|
||||
.descriptionAndTooltip(JavaErrorMessages.message("bad.qualifier.in.super.method.reference", format(aClass), formatClass(superClass))).create();
|
||||
if (superClass.isInheritor(aClass, true)) {
|
||||
String cause = null;
|
||||
if (superClass.isInterface()) {
|
||||
cause = "redundant interface " + format(aClass) + " is extended by ";
|
||||
}
|
||||
else if (resolved instanceof PsiMethod &&
|
||||
MethodSignatureUtil.findMethodBySuperMethod(superClass, (PsiMethod)resolved, true) != resolved) {
|
||||
cause = "method " + ((PsiMethod)resolved).getName() + " is overridden in ";
|
||||
}
|
||||
|
||||
if (cause != null) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(qualifier)
|
||||
.descriptionAndTooltip(JavaErrorMessages.message("bad.qualifier.in.super.method.reference", cause + formatClass(superClass))).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-4
@@ -325,8 +325,13 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
final PsiCallExpression callExpression = parent instanceof PsiExpressionList && parent.getParent() instanceof PsiCallExpression ?
|
||||
(PsiCallExpression)parent.getParent() : null;
|
||||
final JavaResolveResult containingCallResolveResult = callExpression != null ? callExpression.resolveMethodGenerics() : null;
|
||||
final String errorMessage = containingCallResolveResult instanceof MethodCandidateInfo ?
|
||||
((MethodCandidateInfo)containingCallResolveResult).getInferenceErrorMessage() : null;
|
||||
final String errorMessage;
|
||||
if (containingCallResolveResult instanceof MethodCandidateInfo) {
|
||||
errorMessage = ((MethodCandidateInfo)containingCallResolveResult).getParentInferenceErrorMessage((PsiExpressionList)parent);
|
||||
}
|
||||
else {
|
||||
errorMessage = null;
|
||||
}
|
||||
if (errorMessage != null) {
|
||||
HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(expression).descriptionAndTooltip(errorMessage).create();
|
||||
@@ -926,7 +931,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (!myHolder.hasErrorResults()) {
|
||||
PsiIdentifier nameId = pair.getNameIdentifier();
|
||||
if (nameId != null) {
|
||||
HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ANNOTATION_ATTRIBUTE_NAME).range(nameId).create();
|
||||
HighlightInfo result = HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.ANNOTATION_ATTRIBUTE_NAME).range(nameId).create();
|
||||
myHolder.add(result);
|
||||
}
|
||||
}
|
||||
@@ -1080,7 +1085,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
!PsiTreeUtil.isAncestor(containingClass, variable, false) &&
|
||||
!(variable instanceof PsiField)) {
|
||||
if (!PsiTreeUtil.isAncestor(((PsiAnonymousClass) containingClass).getArgumentList(), ref, false)) {
|
||||
myHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.IMPLICIT_ANONYMOUS_CLASS_PARAMETER).range(ref).create());
|
||||
myHolder.add(HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.IMPLICIT_ANONYMOUS_CLASS_PARAMETER).range(ref).create());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-32
@@ -134,7 +134,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
return checker.hasForbiddenRefs();
|
||||
}
|
||||
|
||||
private static PsiType getInferredType(PsiAnonymousClass aClass) {
|
||||
private static PsiType getInferredType(PsiAnonymousClass aClass, PsiMethod method) {
|
||||
final PsiExpression expression = (PsiExpression)aClass.getParent();
|
||||
final PsiType psiType = PsiTypesUtil.getExpectedTypeByParent(expression);
|
||||
if (psiType != null) {
|
||||
@@ -151,35 +151,18 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
PsiExpressionList expressionList = (PsiExpressionList)parent;
|
||||
final PsiElement callExpr = expressionList.getParent();
|
||||
if (callExpr instanceof PsiCallExpression) {
|
||||
final JavaResolveResult result = ((PsiCallExpression)callExpr).resolveMethodGenerics();
|
||||
if (result instanceof MethodCandidateInfo) {
|
||||
final PsiMethod method = ((MethodCandidateInfo)result).getElement();
|
||||
PsiExpression[] expressions = expressionList.getExpressions();
|
||||
int i = ArrayUtilRt.find(expressions, topExpr);
|
||||
if (i < 0) return null;
|
||||
expressions[i] = null;
|
||||
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
final PsiSubstitutor substitutor = PsiResolveHelper.SERVICE.getInstance(aClass.getProject())
|
||||
.inferTypeArguments(method.getTypeParameters(), parameters, expressions,
|
||||
((MethodCandidateInfo)result).getSiteSubstitutor(), callExpr.getParent(),
|
||||
DefaultParameterTypeInferencePolicy.INSTANCE);
|
||||
PsiType paramType;
|
||||
if (i < parameters.length) {
|
||||
paramType = parameters[i].getType();
|
||||
}
|
||||
else if (parameters.length > 0) {
|
||||
paramType = parameters[parameters.length - 1].getType();
|
||||
if (!(paramType instanceof PsiEllipsisType)) {
|
||||
return null;
|
||||
}
|
||||
paramType = ((PsiEllipsisType)paramType).getComponentType();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return substitutor.substitute(paramType);
|
||||
PsiExpression[] expressions = expressionList.getExpressions();
|
||||
int i = ArrayUtilRt.find(expressions, topExpr);
|
||||
if (i < 0) return null;
|
||||
final PsiCallExpression copy = (PsiCallExpression)callExpr.copy();
|
||||
final PsiExpressionList argumentList = copy.getArgumentList();
|
||||
if (argumentList != null) {
|
||||
final PsiExpression classArg = argumentList.getExpressions()[i];
|
||||
PsiExpression lambda = JavaPsiFacade.getElementFactory(aClass.getProject())
|
||||
.createExpressionFromText(ReplaceWithLambdaFix.composeLambdaText(method), expression);
|
||||
lambda = (PsiExpression)classArg.replace(lambda);
|
||||
((PsiLambdaExpression)lambda).getBody().replace(method.getBody());
|
||||
return LambdaUtil.getFunctionalInterfaceType(lambda, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,7 +207,6 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
if (anonymousClass == null) return null;
|
||||
|
||||
ChangeContextUtil.encodeContextInfo(anonymousClass, true);
|
||||
final PsiElement lambdaContext = anonymousClass.getParent().getParent();
|
||||
final String canonicalText = anonymousClass.getBaseClassType().getCanonicalText();
|
||||
|
||||
final PsiMethod method;
|
||||
@@ -438,7 +420,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
PsiAnonymousClass aClass) {
|
||||
myMethod = method;
|
||||
myAnonymClass = aClass;
|
||||
final PsiType inferredType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(getInferredType(aClass));
|
||||
final PsiType inferredType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(getInferredType(aClass, method));
|
||||
final PsiClassType baseClassType = aClass.getBaseClassType();
|
||||
myInferredType = !baseClassType.equals(inferredType) ? inferredType : null;
|
||||
}
|
||||
@@ -511,6 +493,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
final PsiElement resolved = expression.resolve();
|
||||
if (resolved instanceof PsiField &&
|
||||
((PsiField)resolved).hasModifierProperty(PsiModifier.FINAL) &&
|
||||
((PsiField)resolved).getInitializer() == null &&
|
||||
((PsiField)resolved).getContainingClass() == method.getContainingClass()) {
|
||||
try {
|
||||
final PsiCodeBlock constructorBody = method.getBody();
|
||||
|
||||
+59
-16
@@ -126,12 +126,16 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
if (ExceptionUtil.getThrownCheckedExceptions(new PsiElement[] {body}).isEmpty()) {
|
||||
if (!(iteratedValueType instanceof PsiClassType && ((PsiClassType)iteratedValueType).isRaw()) &&
|
||||
isCollectCall(body, statement.getIterationParameter())) {
|
||||
holder.registerProblem(iteratedValue, "Can be replaced with collect call",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithCollectCallFix());
|
||||
boolean addAll = isAddAllCall(statement, body);
|
||||
holder.registerProblem(iteratedValue, "Can be replaced with " + (addAll ? "addAll call" : "collect call"),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new ReplaceWithCollectCallFix("Replace with " + (addAll ? "addAll" : "collect")));
|
||||
}
|
||||
else if (REPLACE_TRIVIAL_FOREACH || !isTrivial(body, statement.getIterationParameter())) {
|
||||
holder.registerProblem(iteratedValue, "Can be replaced with foreach call",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithForeachCallFix());
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new ReplaceWithForeachCallFix("forEach"),
|
||||
new ReplaceWithForeachCallFix("forEachOrdered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +149,17 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean isAddAllCall(PsiForeachStatement statement, PsiStatement body) {
|
||||
final PsiIfStatement ifStatement = extractIfStatement(body);
|
||||
if (ifStatement == null) {
|
||||
final PsiParameter parameter = statement.getIterationParameter();
|
||||
final PsiMethodCallExpression methodCallExpression = extractAddCall(body, null);
|
||||
LOG.assertTrue(methodCallExpression != null);
|
||||
return isIdentityMapping(parameter, methodCallExpression.getArgumentList().getExpressions()[0]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isCollectCall(PsiStatement body, final PsiParameter parameter) {
|
||||
PsiIfStatement ifStatement = extractIfStatement(body);
|
||||
final PsiMethodCallExpression methodCallExpression = extractAddCall(body, ifStatement);
|
||||
@@ -265,7 +280,17 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
}) != null;
|
||||
}
|
||||
|
||||
private static boolean isIdentityMapping(PsiParameter parameter, PsiExpression mapperCall) {
|
||||
return mapperCall instanceof PsiReferenceExpression && ((PsiReferenceExpression)mapperCall).resolve() == parameter;
|
||||
}
|
||||
|
||||
private static class ReplaceWithForeachCallFix implements LocalQuickFix {
|
||||
private final String myForEachMethodName;
|
||||
|
||||
private ReplaceWithForeachCallFix(String forEachMethodName) {
|
||||
myForEachMethodName = forEachMethodName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -275,7 +300,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Replace with forEach";
|
||||
return "Replace with " + myForEachMethodName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,7 +325,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
body = thenBranch;
|
||||
}
|
||||
|
||||
buffer.append(".forEach(");
|
||||
buffer.append("." + myForEachMethodName + "(");
|
||||
|
||||
final String functionalExpressionText = createForEachFunctionalExpressionText(project, body, parameter);
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
|
||||
@@ -360,6 +385,13 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
}
|
||||
|
||||
private static class ReplaceWithCollectCallFix implements LocalQuickFix {
|
||||
|
||||
private final String myName;
|
||||
|
||||
public ReplaceWithCollectCallFix(String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -369,7 +401,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Replace with collect";
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -377,15 +409,27 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
final PsiForeachStatement foreachStatement = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiForeachStatement.class);
|
||||
if (foreachStatement != null) {
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(foreachStatement)) return;
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
|
||||
PsiStatement body = foreachStatement.getBody();
|
||||
final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
|
||||
if (body != null && iteratedValue != null) {
|
||||
final PsiParameter parameter = foreachStatement.getIterationParameter();
|
||||
final StringBuilder builder = new StringBuilder(getIteratedValueText(iteratedValue) + ".stream()");
|
||||
|
||||
final PsiIfStatement ifStatement = extractIfStatement(body);
|
||||
final PsiMethodCallExpression methodCallExpression = extractAddCall(body, ifStatement);
|
||||
|
||||
if (methodCallExpression == null) return;
|
||||
|
||||
if (isAddAllCall(foreachStatement, body)) {
|
||||
restoreComments(foreachStatement, body);
|
||||
final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression();
|
||||
final String qualifierText = qualifierExpression != null ? qualifierExpression.getText() : "";
|
||||
final String callText = StringUtil.getQualifiedName(qualifierText, "addAll(" + getIteratedValueText(iteratedValue) + ");");
|
||||
PsiElement result = foreachStatement.replace(elementFactory.createStatementFromText(callText, foreachStatement));
|
||||
reformatWhenNeeded(project, result);
|
||||
return;
|
||||
}
|
||||
final StringBuilder builder = new StringBuilder(getIteratedValueText(iteratedValue) + ".stream()");
|
||||
|
||||
builder.append(createFiltersChainText(body, parameter, ifStatement));
|
||||
builder.append(createMapperFunctionalExpressionText(project, parameter, methodCallExpression.getArgumentList().getExpressions()[0]));
|
||||
|
||||
@@ -393,7 +437,6 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
PsiElement result = null;
|
||||
try {
|
||||
final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression();
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
|
||||
if (qualifierExpression instanceof PsiReferenceExpression) {
|
||||
final PsiElement resolve = ((PsiReferenceExpression)qualifierExpression).resolve();
|
||||
if (resolve instanceof PsiVariable) {
|
||||
@@ -420,14 +463,18 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
simplifyRedundantCast(result);
|
||||
}
|
||||
finally {
|
||||
if (result != null) {
|
||||
CodeStyleManager.getInstance(project).reformat(JavaCodeStyleManager.getInstance(project).shortenClassReferences(result));
|
||||
}
|
||||
reformatWhenNeeded(project, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void reformatWhenNeeded(@NotNull Project project, PsiElement result) {
|
||||
if (result != null) {
|
||||
CodeStyleManager.getInstance(project).reformat(JavaCodeStyleManager.getInstance(project).shortenClassReferences(result));
|
||||
}
|
||||
}
|
||||
|
||||
private static String createInitializerReplacementText(PsiType varType, PsiExpression initializer) {
|
||||
final PsiType initializerType = initializer.getType();
|
||||
final PsiClassType rawType = initializerType instanceof PsiClassType ? ((PsiClassType)initializerType).rawType() : null;
|
||||
@@ -470,10 +517,6 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
}
|
||||
return iteration;
|
||||
}
|
||||
|
||||
private static boolean isIdentityMapping(PsiParameter parameter, PsiExpression mapperCall) {
|
||||
return mapperCall instanceof PsiReferenceExpression && ((PsiReferenceExpression)mapperCall).resolve() == parameter;
|
||||
}
|
||||
}
|
||||
|
||||
private static void simplifyRedundantCast(PsiElement result) {
|
||||
|
||||
+8
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.codeInspection.bytecodeAnalysis;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.ThreadLocalCachedValue;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
@@ -28,8 +29,8 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis.LOG;
|
||||
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.*;
|
||||
import static com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis.LOG;
|
||||
|
||||
/**
|
||||
* @author lambdamix
|
||||
@@ -121,9 +122,9 @@ public class BytecodeAnalysisConverter {
|
||||
*/
|
||||
@NotNull
|
||||
public static HKey asmKey(@NotNull Key key, @NotNull MessageDigest md) {
|
||||
byte[] classDigest = md.digest(key.method.internalClassName.getBytes());
|
||||
md.update(key.method.methodName.getBytes());
|
||||
md.update(key.method.methodDesc.getBytes());
|
||||
byte[] classDigest = md.digest(key.method.internalClassName.getBytes(CharsetToolkit.UTF8_CHARSET));
|
||||
md.update(key.method.methodName.getBytes(CharsetToolkit.UTF8_CHARSET));
|
||||
md.update(key.method.methodDesc.getBytes(CharsetToolkit.UTF8_CHARSET));
|
||||
byte[] sigDigest = md.digest();
|
||||
byte[] digest = new byte[HASH_SIZE];
|
||||
System.arraycopy(classDigest, 0, digest, 0, CLASS_HASH_SIZE);
|
||||
@@ -161,7 +162,7 @@ public class BytecodeAnalysisConverter {
|
||||
if (descriptor == null) {
|
||||
return null;
|
||||
}
|
||||
return md.digest(descriptor.getBytes());
|
||||
return md.digest(descriptor.getBytes(CharsetToolkit.UTF8_CHARSET));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -170,7 +171,7 @@ public class BytecodeAnalysisConverter {
|
||||
if (descriptor == null) {
|
||||
return null;
|
||||
}
|
||||
return md.digest(descriptor.getBytes());
|
||||
return md.digest(descriptor.getBytes(CharsetToolkit.UTF8_CHARSET));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -62,7 +62,7 @@ public class FieldAccessNotGuardedInspection extends BaseJavaBatchLocalInspectio
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
final PsiElement referent = expression.resolve();
|
||||
if (referent == null || !(referent instanceof PsiField)) {
|
||||
if (!(referent instanceof PsiField)) {
|
||||
return;
|
||||
}
|
||||
final PsiField field = (PsiField)referent;
|
||||
@@ -132,7 +132,7 @@ public class FieldAccessNotGuardedInspection extends BaseJavaBatchLocalInspectio
|
||||
}
|
||||
tryStatement = PsiTreeUtil.getParentOfType(tryStatement, PsiTryStatement.class);
|
||||
}
|
||||
return tryStatement;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isLockGuardStatement(String guard, PsiElement element, final String lockMethodStart) {
|
||||
|
||||
+1
-1
@@ -1667,7 +1667,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
}
|
||||
|
||||
private void flushIncrementedValue(@Nullable PsiExpression operand) {
|
||||
if (operand instanceof PsiReferenceExpression) {
|
||||
if (operand instanceof PsiReferenceExpression && PsiUtil.isAccessedForWriting(operand)) {
|
||||
PsiVariable psiVariable = DfaValueFactory.resolveUnqualifiedVariable((PsiReferenceExpression)operand);
|
||||
if (psiVariable != null) {
|
||||
DfaVariableValue dfaVariable = myFactory.getVarFactory().createVariableValue(psiVariable, false);
|
||||
|
||||
+5
-2
@@ -435,9 +435,12 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
}
|
||||
|
||||
private void reportCallMayProduceNpe(ProblemsHolder holder, PsiMethodCallExpression callExpression, boolean onTheFly) {
|
||||
LocalQuickFix[] fix = createNPEFixes(callExpression.getMethodExpression().getQualifierExpression(), callExpression, onTheFly);
|
||||
PsiReferenceExpression methodExpression = callExpression.getMethodExpression();
|
||||
LocalQuickFix[] fix = createNPEFixes(methodExpression.getQualifierExpression(), callExpression, onTheFly);
|
||||
|
||||
holder.registerProblem(callExpression,
|
||||
PsiElement toHighlight = methodExpression.getReferenceNameElement();
|
||||
if (toHighlight == null) toHighlight = methodExpression;
|
||||
holder.registerProblem(toHighlight,
|
||||
InspectionsBundle.message("dataflow.message.npe.method.invocation"),
|
||||
fix);
|
||||
}
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ public class DfaExpressionFactory {
|
||||
}
|
||||
|
||||
if (!var.hasModifierProperty(PsiModifier.VOLATILE)) {
|
||||
if (var instanceof PsiVariable && var.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
if (var instanceof PsiVariable && var.hasModifierProperty(PsiModifier.FINAL) && !PsiUtil.isAccessedForWriting(refExpr)) {
|
||||
DfaValue constValue = myFactory.getConstFactory().create((PsiVariable)var);
|
||||
if (constValue != null) return constValue;
|
||||
}
|
||||
|
||||
+3
-2
@@ -101,8 +101,9 @@ public class SillyAssignmentInspectionBase extends BaseJavaBatchLocalInspectionT
|
||||
lExpression = PsiUtil.deparenthesizeExpression(lExpression);
|
||||
if (!(lExpression instanceof PsiReferenceExpression)) return;
|
||||
PsiReferenceExpression lRef = (PsiReferenceExpression)lExpression;
|
||||
final PsiVariable variable = (PsiVariable)lRef.resolve();
|
||||
if (variable == null) return;
|
||||
final PsiElement resolved = lRef.resolve();
|
||||
if (!(resolved instanceof PsiVariable)) return;
|
||||
final PsiVariable variable = (PsiVariable)resolved;
|
||||
|
||||
rExpression = deparenthesizeRExpr(rExpression, variable);
|
||||
|
||||
|
||||
+87
-21
@@ -16,7 +16,6 @@
|
||||
package com.intellij.ide.highlighter;
|
||||
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.SyntaxHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
|
||||
/**
|
||||
@@ -24,25 +23,92 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
*
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class JavaHighlightingColors {
|
||||
public static final TextAttributesKey LINE_COMMENT = SyntaxHighlighterColors.LINE_COMMENT;
|
||||
public static final TextAttributesKey JAVA_BLOCK_COMMENT = SyntaxHighlighterColors.JAVA_BLOCK_COMMENT;
|
||||
public static final TextAttributesKey DOC_COMMENT = SyntaxHighlighterColors.DOC_COMMENT;
|
||||
public static final TextAttributesKey KEYWORD = SyntaxHighlighterColors.KEYWORD;
|
||||
public static final TextAttributesKey NUMBER = SyntaxHighlighterColors.NUMBER;
|
||||
public static final TextAttributesKey STRING = SyntaxHighlighterColors.STRING;
|
||||
public static final TextAttributesKey OPERATION_SIGN = SyntaxHighlighterColors.OPERATION_SIGN;
|
||||
public static final TextAttributesKey PARENTHESES = SyntaxHighlighterColors.PARENTHS;
|
||||
public static final TextAttributesKey BRACKETS = SyntaxHighlighterColors.BRACKETS;
|
||||
public static final TextAttributesKey BRACES = SyntaxHighlighterColors.BRACES;
|
||||
public static final TextAttributesKey COMMA = SyntaxHighlighterColors.COMMA;
|
||||
public static final TextAttributesKey DOT = SyntaxHighlighterColors.DOT;
|
||||
public static final TextAttributesKey JAVA_SEMICOLON = SyntaxHighlighterColors.JAVA_SEMICOLON;
|
||||
public static final TextAttributesKey DOC_COMMENT_TAG = SyntaxHighlighterColors.DOC_COMMENT_TAG;
|
||||
public static final TextAttributesKey DOC_COMMENT_MARKUP = SyntaxHighlighterColors.DOC_COMMENT_MARKUP;
|
||||
public static final TextAttributesKey DOC_COMMENT_TAG_VALUE = TextAttributesKey.createTextAttributesKey(
|
||||
"DOC_COMMENT_TAG_VALUE", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG_VALUE);
|
||||
public static final TextAttributesKey VALID_STRING_ESCAPE = SyntaxHighlighterColors.VALID_STRING_ESCAPE;
|
||||
public static final TextAttributesKey INVALID_STRING_ESCAPE = SyntaxHighlighterColors.INVALID_STRING_ESCAPE;
|
||||
public static final TextAttributesKey LINE_COMMENT
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_LINE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
||||
public static final TextAttributesKey JAVA_BLOCK_COMMENT
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_BLOCK_COMMENT", DefaultLanguageHighlighterColors.BLOCK_COMMENT);
|
||||
public static final TextAttributesKey DOC_COMMENT
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_DOC_COMMENT", DefaultLanguageHighlighterColors.DOC_COMMENT);
|
||||
public static final TextAttributesKey KEYWORD
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_KEYWORD", DefaultLanguageHighlighterColors.KEYWORD);
|
||||
public static final TextAttributesKey NUMBER
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_NUMBER", DefaultLanguageHighlighterColors.NUMBER);
|
||||
public static final TextAttributesKey STRING
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_STRING", DefaultLanguageHighlighterColors.STRING);
|
||||
public static final TextAttributesKey OPERATION_SIGN
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_OPERATION_SIGN", DefaultLanguageHighlighterColors.OPERATION_SIGN);
|
||||
public static final TextAttributesKey PARENTHESES
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_PARENTH", DefaultLanguageHighlighterColors.PARENTHESES);
|
||||
public static final TextAttributesKey BRACKETS
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_BRACKETS", DefaultLanguageHighlighterColors.BRACKETS);
|
||||
public static final TextAttributesKey BRACES
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_BRACES", DefaultLanguageHighlighterColors.BRACES);
|
||||
public static final TextAttributesKey COMMA
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_COMMA", DefaultLanguageHighlighterColors.COMMA);
|
||||
public static final TextAttributesKey DOT
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_DOT", DefaultLanguageHighlighterColors.DOT);
|
||||
public static final TextAttributesKey JAVA_SEMICOLON
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_SEMICOLON", DefaultLanguageHighlighterColors.SEMICOLON);
|
||||
public static final TextAttributesKey DOC_COMMENT_TAG
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_DOC_TAG", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG);
|
||||
public static final TextAttributesKey DOC_COMMENT_MARKUP
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_DOC_MARKUP", DefaultLanguageHighlighterColors.DOC_COMMENT_MARKUP);
|
||||
public static final TextAttributesKey DOC_COMMENT_TAG_VALUE
|
||||
= TextAttributesKey.createTextAttributesKey("DOC_COMMENT_TAG_VALUE", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG_VALUE);
|
||||
public static final TextAttributesKey VALID_STRING_ESCAPE
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_VALID_STRING_ESCAPE", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
|
||||
public static final TextAttributesKey INVALID_STRING_ESCAPE
|
||||
= TextAttributesKey.createTextAttributesKey("JAVA_INVALID_STRING_ESCAPE", DefaultLanguageHighlighterColors.INVALID_STRING_ESCAPE);
|
||||
|
||||
public static final TextAttributesKey LOCAL_VARIABLE_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("LOCAL_VARIABLE_ATTRIBUTES", DefaultLanguageHighlighterColors.LOCAL_VARIABLE);
|
||||
public static final TextAttributesKey PARAMETER_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("PARAMETER_ATTRIBUTES", DefaultLanguageHighlighterColors.PARAMETER);
|
||||
public static final TextAttributesKey REASSIGNED_LOCAL_VARIABLE_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("REASSIGNED_LOCAL_VARIABLE_ATTRIBUTES", LOCAL_VARIABLE_ATTRIBUTES);
|
||||
public static final TextAttributesKey REASSIGNED_PARAMETER_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("REASSIGNED_PARAMETER_ATTRIBUTES", PARAMETER_ATTRIBUTES);
|
||||
public static final TextAttributesKey INSTANCE_FIELD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("INSTANCE_FIELD_ATTRIBUTES", DefaultLanguageHighlighterColors.INSTANCE_FIELD);
|
||||
public static final TextAttributesKey INSTANCE_FINAL_FIELD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("INSTANCE_FINAL_FIELD_ATTRIBUTES", INSTANCE_FIELD_ATTRIBUTES);
|
||||
public static final TextAttributesKey STATIC_FIELD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("STATIC_FIELD_ATTRIBUTES", DefaultLanguageHighlighterColors.STATIC_FIELD);
|
||||
public static final TextAttributesKey STATIC_FINAL_FIELD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("STATIC_FINAL_FIELD_ATTRIBUTES", STATIC_FIELD_ATTRIBUTES);
|
||||
public static final TextAttributesKey CLASS_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("CLASS_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.CLASS_NAME);
|
||||
public static final TextAttributesKey ANONYMOUS_CLASS_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ANONYMOUS_CLASS_NAME_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
|
||||
public static final TextAttributesKey IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
|
||||
public static final TextAttributesKey TYPE_PARAMETER_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("TYPE_PARAMETER_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.PARAMETER);
|
||||
public static final TextAttributesKey INTERFACE_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("INTERFACE_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.INTERFACE_NAME);
|
||||
public static final TextAttributesKey ENUM_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ENUM_NAME_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
|
||||
public static final TextAttributesKey ABSTRACT_CLASS_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ABSTRACT_CLASS_NAME_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
|
||||
public static final TextAttributesKey METHOD_CALL_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("METHOD_CALL_ATTRIBUTES", DefaultLanguageHighlighterColors.FUNCTION_CALL);
|
||||
public static final TextAttributesKey METHOD_DECLARATION_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("METHOD_DECLARATION_ATTRIBUTES", DefaultLanguageHighlighterColors.FUNCTION_DECLARATION);
|
||||
public static final TextAttributesKey STATIC_METHOD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("STATIC_METHOD_ATTRIBUTES", DefaultLanguageHighlighterColors.STATIC_METHOD);
|
||||
public static final TextAttributesKey ABSTRACT_METHOD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ABSTRACT_METHOD_ATTRIBUTES", METHOD_CALL_ATTRIBUTES);
|
||||
public static final TextAttributesKey INHERITED_METHOD_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("INHERITED_METHOD_ATTRIBUTES", METHOD_CALL_ATTRIBUTES);
|
||||
public static final TextAttributesKey CONSTRUCTOR_CALL_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("CONSTRUCTOR_CALL_ATTRIBUTES", DefaultLanguageHighlighterColors.FUNCTION_CALL);
|
||||
public static final TextAttributesKey CONSTRUCTOR_DECLARATION_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("CONSTRUCTOR_DECLARATION_ATTRIBUTES", DefaultLanguageHighlighterColors.FUNCTION_DECLARATION);
|
||||
public static final TextAttributesKey ANNOTATION_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ANNOTATION_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.METADATA);
|
||||
public static final TextAttributesKey ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.METADATA);
|
||||
public static final TextAttributesKey ANNOTATION_ATTRIBUTE_VALUE_ATTRIBUTES
|
||||
= TextAttributesKey.createTextAttributesKey("ANNOTATION_ATTRIBUTE_VALUE_ATTRIBUTES", DefaultLanguageHighlighterColors.METADATA);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
|
||||
@@ -17,6 +17,8 @@ package com.intellij.application.options;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaHighlightingColors;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.psi.codeStyle.PackageEntry;
|
||||
@@ -93,45 +95,58 @@ public abstract class ImportLayoutPanel extends JPanel {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
this.add(myCbLayoutStaticImportsSeparately, BorderLayout.NORTH);
|
||||
|
||||
add(myCbLayoutStaticImportsSeparately, BorderLayout.NORTH);
|
||||
|
||||
JPanel importLayoutPanel = ToolbarDecorator.createDecorator(myImportLayoutTable = createTableForPackageEntries(myImportLayoutList, this))
|
||||
.addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.package"), IconUtil.getAddPackageIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
addPackageToImportLayouts();
|
||||
}
|
||||
|
||||
this.add(
|
||||
ToolbarDecorator.createDecorator(myImportLayoutTable = createTableForPackageEntries(myImportLayoutList, this))
|
||||
.addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.package"), IconUtil.getAddPackageIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
addPackageToImportLayouts();
|
||||
}
|
||||
}).addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.blank"), IconUtil.getAddBlankLineIcon()) {
|
||||
@Override
|
||||
public ShortcutSet getShortcut() {
|
||||
return CommonShortcuts.getNewForDialogs();
|
||||
}
|
||||
})
|
||||
.addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.blank"), IconUtil.getAddBlankLineIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
addBlankLine();
|
||||
}
|
||||
}).setRemoveAction(new AnActionButtonRunnable() {
|
||||
})
|
||||
.setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
removeEntryFromImportLayouts();
|
||||
}
|
||||
}).setMoveUpAction(new AnActionButtonRunnable() {
|
||||
})
|
||||
.setMoveUpAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
moveRowUp();
|
||||
}
|
||||
}).setMoveDownAction(new AnActionButtonRunnable() {
|
||||
})
|
||||
.setMoveDownAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
moveRowDown();
|
||||
}
|
||||
}).setRemoveActionUpdater(new AnActionButtonUpdater() {
|
||||
})
|
||||
.setRemoveActionUpdater(new AnActionButtonUpdater() {
|
||||
@Override
|
||||
public boolean isEnabled(AnActionEvent e) {
|
||||
int selectedImport = myImportLayoutTable.getSelectedRow();
|
||||
PackageEntry entry = selectedImport < 0 ? null : myImportLayoutList.getEntryAt(selectedImport);
|
||||
return entry != null && entry != PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY && entry != PackageEntry.ALL_OTHER_IMPORTS_ENTRY;
|
||||
}
|
||||
}).setButtonComparator(ApplicationBundle.message("button.add.package"), ApplicationBundle.message("button.add.blank"),
|
||||
"Remove", "Up", "Down")
|
||||
.setPreferredSize(new Dimension(-1, 100)).createPanel(), BorderLayout.CENTER);
|
||||
})
|
||||
.setButtonComparator(ApplicationBundle.message("button.add.package"), ApplicationBundle.message("button.add.blank"), "Remove", "Up", "Down")
|
||||
.setPreferredSize(new Dimension(-1, 100)).createPanel();
|
||||
|
||||
|
||||
add(importLayoutPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-3
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.JavaAutoImportOptions">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="445" height="411"/>
|
||||
@@ -29,6 +29,14 @@
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.add.unambiguous.imports.on.the.fly"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="90edc" class="javax.swing.JCheckBox" binding="myCbAddMethodImports">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Show import suggestions for static methods and fields"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="2ef17" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="5" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
@@ -61,7 +69,7 @@
|
||||
</grid>
|
||||
<grid id="e67c2" binding="myExcludeFromImportAndCompletionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="150"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -71,7 +79,7 @@
|
||||
</grid>
|
||||
<component id="64f08" class="com.intellij.ui.TitledSeparator">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="exclude.from.completion.group"/>
|
||||
|
||||
@@ -39,6 +39,7 @@ public class JavaAutoImportOptions implements AutoImportOptionsProvider {
|
||||
private JCheckBox myCbShowImportPopup;
|
||||
private JPanel myWholePanel;
|
||||
private JCheckBox myCbAddUnambiguousImports;
|
||||
private JCheckBox myCbAddMethodImports;
|
||||
private JCheckBox myCbOptimizeImports;
|
||||
private JPanel myExcludeFromImportAndCompletionPanel;
|
||||
private final ExcludeTable myExcludePackagesTable;
|
||||
@@ -78,6 +79,7 @@ public class JavaAutoImportOptions implements AutoImportOptionsProvider {
|
||||
myCbShowImportPopup.setSelected(daemonSettings.isImportHintEnabled());
|
||||
myCbOptimizeImports.setSelected(codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY);
|
||||
myCbAddUnambiguousImports.setSelected(codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY);
|
||||
myCbAddMethodImports.setSelected(codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY);
|
||||
|
||||
myExcludePackagesTable.reset();
|
||||
}
|
||||
@@ -94,6 +96,7 @@ public class JavaAutoImportOptions implements AutoImportOptionsProvider {
|
||||
daemonSettings.setImportHintEnabled(myCbShowImportPopup.isSelected());
|
||||
codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = myCbOptimizeImports.isSelected();
|
||||
codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = myCbAddUnambiguousImports.isSelected();
|
||||
codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY = myCbAddMethodImports.isSelected();
|
||||
|
||||
myExcludePackagesTable.apply();
|
||||
|
||||
@@ -113,6 +116,7 @@ public class JavaAutoImportOptions implements AutoImportOptionsProvider {
|
||||
boolean isModified = isModified(myCbShowImportPopup, daemonSettings.isImportHintEnabled());
|
||||
isModified |= isModified(myCbOptimizeImports, codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY);
|
||||
isModified |= isModified(myCbAddUnambiguousImports, codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY);
|
||||
isModified |= isModified(myCbAddMethodImports, codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY);
|
||||
|
||||
isModified |= getSmartPasteValue() != codeInsightSettings.ADD_IMPORTS_ON_PASTE;
|
||||
isModified |= myExcludePackagesTable.isModified();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user