Merge remote-tracking branch 'origin/master'

This commit is contained in:
Sascha Weinreuter
2013-01-21 09:07:12 +01:00
418 changed files with 8459 additions and 4144 deletions
+11
View File
@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="JSch">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jsch-0.1.49.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/jsch-0.1.49-sources.jar!/" />
</SOURCES>
</library>
</component>
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -278,7 +278,6 @@ public def layoutCommunityPlugins(String home) {
}
fileset(dir: "$home/plugins/git4idea/lib/jgit") {
include(name: "org.eclipse.jgit*.jar")
include(name: "jsch*.jar")
exclude(name: "*.zip")
}
}
+1 -1
View File
@@ -195,7 +195,7 @@ libraryLicense(name: "JGoodies Forms", libraryName: "jgoodies-forms", version: "
libraryLicense(name: "JGoodies Looks", libraryName: "jgoodies-looks", version: "2.4.2", license: "BSD ", url: "http://www.jgoodies.com/freeware/looks/", licenseUrl: "http://www.jgoodies.com/downloads/libraries.html")
libraryLicense(name: "JGoodies Common", libraryName: "jgoodies-common", version: "1.2.1", license: "BSD ", url: "http://www.jgoodies.com/freeware/looks/", licenseUrl: "http://www.jgoodies.com/downloads/libraries.html")
libraryLicense(name: "JNA", libraryName: "jna", version: "3.4.0", license: "LGPL 2.1", url: "https://jna.dev.java.net/", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php")
libraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.44", license: "BSD", url: "http://www.jcraft.com/jsch/", licenseUrl: "http://www.jcraft.com/jsch/LICENSE.txt")
libraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.49", license: "BSD", url: "http://www.jcraft.com/jsch/", licenseUrl: "http://www.jcraft.com/jsch/LICENSE.txt")
libraryLicense(name: "JUnit", libraryName: "JUnit3", version: "3.8.1", license: "CPL 1.0", url: "http://junit.org/")
libraryLicense(name: "JUnit", libraryName: "JUnit4", version: "4.8", license: "CPL 1.0", url: "http://junit.org/")
libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2", license: "Apache 2.0", url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://logging.apache.org/license.html")
+2 -2
View File
@@ -635,7 +635,7 @@ binding.setVariable("buildMacZip", { String zipRoot, String zipPath, List paths,
zipfileset(dir: it, prefix: zipRoot) {
exclude(name: "bin/*.sh")
exclude(name: "bin/fsnotifier")
exclude(name: "bin/relaunch")
exclude(name: "bin/restarter")
exclude(name: "Contents/MacOS/*")
extraBins.each {
exclude(name: it)
@@ -648,7 +648,7 @@ binding.setVariable("buildMacZip", { String zipRoot, String zipPath, List paths,
zipfileset(dir: it, filemode: "755", prefix: zipRoot) {
include(name: "bin/*.sh")
include(name: "bin/fsnotifier")
include(name: "bin/relaunch")
include(name: "bin/restarter")
include(name: "Contents/MacOS/*")
extraBins.each {
include(name: it)
+1 -1
View File
@@ -37,5 +37,5 @@ if [ "$OS_TYPE" = "Linux" ]; then
elif [ "$OS_TYPE" = "Darwin" ]; then
cp -a $DEV_IDEA_HOME/bin/mac/*.jnilib $WORK_IDEA_HOME/bin
cp -a $DEV_IDEA_HOME/bin/mac/fsnotifier $WORK_IDEA_HOME/bin
cp -a $DEV_IDEA_HOME/bin/mac/relaunch $WORK_IDEA_HOME/bin
cp -a $DEV_IDEA_HOME/bin/mac/restarter $WORK_IDEA_HOME/bin
fi
+4 -18
View File
@@ -2059,7 +2059,7 @@
</option>
<option name="RUBY_EXPR_IN_STRING">
<value>
<option name="FOREGROUND" value="519f50" />
<option name="FOREGROUND" />
<option name="BACKGROUND" />
<option name="FONT_TYPE" value="0" />
<option name="EFFECT_COLOR" />
@@ -2297,14 +2297,10 @@
<option name="ERROR_STRIPE_COLOR" />
</value>
</option>
<option name="RUBY_STRING">
<option name="RUBY_INTERPOLATED_STRING">
<value>
<option name="FOREGROUND" value="a5c261" />
<option name="BACKGROUND" />
<option name="FONT_TYPE" value="0" />
<option name="EFFECT_COLOR" />
<option name="EFFECT_TYPE" value="0" />
<option name="ERROR_STRIPE_COLOR" />
<option name="FOREGROUND" value="52A12E"/>
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="RUBY_SYMBOL">
@@ -2317,16 +2313,6 @@
<option name="ERROR_STRIPE_COLOR" />
</value>
</option>
<option name="RUBY_WORDS">
<value>
<option name="FOREGROUND" value="a5c261" />
<option name="BACKGROUND" />
<option name="FONT_TYPE" value="0" />
<option name="EFFECT_COLOR" />
<option name="EFFECT_TYPE" value="0" />
<option name="ERROR_STRIPE_COLOR" />
</value>
</option>
<option name="SASS_ATTRIBUTE">
<value>
<option name="FOREGROUND" value="6d9cbe" />
@@ -66,6 +66,9 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value />
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -238,6 +241,11 @@
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="9933CC" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -513,6 +521,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="3387CC" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -783,6 +796,9 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value />
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="9933CC" />
@@ -991,6 +1007,11 @@
<option name="FOREGROUND" value="3387CC" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value>
<option name="BACKGROUND" value="000000" />
@@ -1043,16 +1064,122 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value />
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value />
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value />
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="9933CC" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value />
</option>
<option name="OC.FUNCTION">
<value />
</option>
<option name="OC.FUNCTION">
<value />
</option>
<option name="OC.GLOBAL_VARIABLE">
<value />
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="9933CC" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value />
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="3387CC" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value>
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value />
</option>
<option name="OC.SELFSUPERTHIS">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="66CC33" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="3387CC" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="66CC33" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1156,6 +1283,9 @@
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value />
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -1930,6 +2060,9 @@
<option name="FOREGROUND" value="66CC33" />
</value>
</option>
<option name="TYPEDEF">
<value />
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
@@ -66,6 +66,11 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -236,6 +241,11 @@
<option name="COFFEESCRIPT.THIS">
<value />
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="AEAEAE" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -511,6 +521,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="D8FA3C" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -743,6 +758,9 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value />
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="AEAEAE" />
@@ -949,6 +967,11 @@
<option name="FOREGROUND" value="D8FA3C" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value />
</option>
@@ -996,16 +1019,126 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value />
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="AEAEAE" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value />
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="OC.GLOBAL_VARIABLE">
<value />
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="AEAEAE" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value />
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="D8FA3C" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value />
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value />
</option>
<option name="OC.SELFSUPERTHIS">
<value />
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="61CE3C" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="D8FA3C" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="61CE3C" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1109,6 +1242,11 @@
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value>
<option name="FOREGROUND" value="FF6400" />
</value>
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -1887,6 +2025,11 @@
<option name="FOREGROUND" value="61CE3C" />
</value>
</option>
<option name="TYPEDEF">
<value>
<option name="FOREGROUND" value="FBDE2D" />
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
+163
View File
@@ -69,6 +69,11 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F8" />
@@ -270,6 +275,12 @@
<option name="FOREGROUND" value="FF80E1" />
</value>
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="0088FF" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -554,6 +565,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="FF628C" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -804,6 +820,11 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="0088FF" />
@@ -1043,6 +1064,11 @@
<option name="FOREGROUND" value="FF628C" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="FF9D00" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value>
<option name="BACKGROUND" value="223545" />
@@ -1098,16 +1124,143 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F8" />
<option name="BACKGROUND" value="800F00" />
</value>
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="0088FF" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="FF9D00" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="FF9D00" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="OC.GLOBAL_VARIABLE">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="FF9D00" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="0088FF" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="FF628C" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value>
<option name="FOREGROUND" value="CCCCCC" />
</value>
</option>
<option name="OC.SELFSUPERTHIS">
<value>
<option name="FOREGROUND" value="FF80E1" />
</value>
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="3AD900" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="FF628C" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="3AD900" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1220,6 +1373,11 @@
<option name="FOREGROUND" value="FF9D00" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value>
<option name="FOREGROUND" value="FFDD00" />
</value>
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F8" />
@@ -2109,6 +2267,11 @@
<option name="FOREGROUND" value="3AD900" />
</value>
</option>
<option name="TYPEDEF">
<value>
<option name="FOREGROUND" value="FFEE80" />
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
+152
View File
@@ -67,6 +67,13 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value>
<option name="FOREGROUND" value="A6E22E" />
<option name="EFFECT_TYPE" value="1" />
<option name="EFFECT_COLOR" value="A6E22E" />
</value>
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F0" />
@@ -240,6 +247,11 @@
<option name="COFFEESCRIPT.THIS">
<value />
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="75715E" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -520,6 +532,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="AE81FF" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -754,6 +771,9 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value />
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="75715E" />
@@ -964,6 +984,11 @@
<option name="FOREGROUND" value="AE81FF" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="F92672" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value />
</option>
@@ -1011,16 +1036,132 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value>
<option name="FOREGROUND" value="A6E22E" />
</value>
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value>
<option name="FOREGROUND" value="A6E22E" />
</value>
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F0" />
<option name="BACKGROUND" value="F92672" />
</value>
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="75715E" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="F92672" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="F92672" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value />
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="A6E22E" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="A6E22E" />
</value>
</option>
<option name="OC.GLOBAL_VARIABLE">
<value />
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="F92672" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="75715E" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value />
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="AE81FF" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value>
<option name="FOREGROUND" value="FD971F" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value />
</option>
<option name="OC.SELFSUPERTHIS">
<value />
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="E6DB74" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="AE81FF" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="E6DB74" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1123,6 +1264,11 @@
<option name="FOREGROUND" value="F92672" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value>
<option name="FOREGROUND" value="A6E22E" />
</value>
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="F8F8F0" />
@@ -1913,6 +2059,12 @@
<option name="FOREGROUND" value="E6DB74" />
</value>
</option>
<option name="TYPEDEF">
<value>
<option name="FOREGROUND" value="66D9EF" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
+161 -4
View File
@@ -69,6 +69,11 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value>
<option name="FOREGROUND" value="FFFFFF" />
</value>
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="FFFFFF" />
@@ -111,8 +116,6 @@
<option name="COFFEESCRIPT.ESCAPE_SEQUENCE">
<value>
<option name="FOREGROUND" value="519F50" />
<option name="EFFECT_TYPE" value="1" />
<option name="EFFECT_COLOR" value="519F50" />
</value>
</option>
<option name="COFFEESCRIPT.EXISTENTIAL">
@@ -248,6 +251,12 @@
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="BC9458" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -529,6 +538,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="6D9CBE" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -770,6 +784,11 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="BC9458" />
@@ -847,8 +866,6 @@
<option name="JAVA_VALID_STRING_ESCAPE">
<value>
<option name="FOREGROUND" value="519F50" />
<option name="EFFECT_TYPE" value="1" />
<option name="EFFECT_COLOR" value="519F50" />
</value>
</option>
<option name="JS.ATTRIBUTE">
@@ -988,6 +1005,11 @@
<option name="FOREGROUND" value="519F50" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value>
<option name="BACKGROUND" value="232323" />
@@ -1042,16 +1064,141 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value>
<option name="FOREGROUND" value="FFC66D" />
</value>
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value>
<option name="FOREGROUND" value="FFC66D" />
</value>
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value>
<option name="FOREGROUND" value="FFFFFF" />
<option name="BACKGROUND" value="990000" />
</value>
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="BC9458" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FFC66D" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="FFC66D" />
</value>
</option>
<option name="OC.GLOBAL_VARIABLE">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="BC9458" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="A5C261" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value />
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="OC.SELFSUPERTHIS">
<value>
<option name="FOREGROUND" value="D0D0FF" />
</value>
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="A5C261" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="6D9CBE" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="A5C261" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1158,6 +1305,11 @@
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value>
<option name="FOREGROUND" value="FFFFFF" />
</value>
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="FOREGROUND" value="FFFFFF" />
@@ -1966,6 +2118,11 @@
<option name="FOREGROUND" value="A5C261" />
</value>
</option>
<option name="TYPEDEF">
<value>
<option name="FOREGROUND" value="CC7833" />
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
+160
View File
@@ -68,6 +68,11 @@
<option name="CLASS_NAME_ATTRIBUTES">
<value />
</option>
<option name="CLASS_REFERENCE">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="COFFEESCRIPT.BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -246,6 +251,12 @@
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="CONDITIONALLY_NOT_COMPILED">
<value>
<option name="FOREGROUND" value="5F5A60" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="CONSOLE_BLUE_OUTPUT">
<value>
<option name="FOREGROUND" value="c7c7ff" />
@@ -528,6 +539,11 @@
<option name="BACKGROUND" value="30322b" />
</value>
</option>
<option name="ENUM_CONST">
<value>
<option name="FOREGROUND" value="CF6A4C" />
</value>
</option>
<option name="ERRORS_ATTRIBUTES">
<value>
<option name="EFFECT_TYPE" value="2" />
@@ -768,6 +784,11 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="IVAR">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="JAVA_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="5F5A60" />
@@ -982,6 +1003,11 @@
<option name="FOREGROUND" value="CF6A4C" />
</value>
</option>
<option name="LABEL">
<value>
<option name="FOREGROUND" value="CDA869" />
</value>
</option>
<option name="LESS_INJECTED_CODE">
<value>
<option name="BACKGROUND" value="202020" />
@@ -1036,16 +1062,140 @@
<option name="LOCAL_VARIABLE_ATTRIBUTES">
<value />
</option>
<option name="MACRONAME">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="MACRO_PARAMETER">
<value />
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="3a6da0" />
</value>
</option>
<option name="MESSAGE_ARGUMENT">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="80807f" />
</value>
</option>
<option name="OC.BADCHARACTER">
<value />
</option>
<option name="OC.BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="5F5A60" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.BRACES">
<value />
</option>
<option name="OC.BRACKETS">
<value />
</option>
<option name="OC.COMMA">
<value />
</option>
<option name="OC.CPP_KEYWORD">
<value>
<option name="FOREGROUND" value="CDA869" />
</value>
</option>
<option name="OC.DIRECTIVE">
<value>
<option name="FOREGROUND" value="CDA869" />
</value>
</option>
<option name="OC.DOT">
<value />
</option>
<option name="OC.EXTERN_VARIABLE">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="OC.FUNCTION">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="OC.GLOBAL_VARIABLE">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.KEYWORD">
<value>
<option name="FOREGROUND" value="CDA869" />
</value>
</option>
<option name="OC.LINE_COMMENT">
<value>
<option name="FOREGROUND" value="5F5A60" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="OC.LOCAL_VARIABLE">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.NUMBER">
<value>
<option name="FOREGROUND" value="CF6A4C" />
</value>
</option>
<option name="OC.OPERATION_SIGN">
<value />
</option>
<option name="OC.PARAMETER">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.PARENTHS">
<value />
</option>
<option name="OC.PROPERTY">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.SELFSUPERTHIS">
<value>
<option name="FOREGROUND" value="7587A6" />
</value>
</option>
<option name="OC.SEMICOLON">
<value />
</option>
<option name="OC.STRING">
<value>
<option name="FOREGROUND" value="8F9D6A" />
</value>
</option>
<option name="OC.STRUCT_FIELD">
<value>
<option name="FOREGROUND" value="CF6A4C" />
</value>
</option>
<option name="OC_FORMAT_TOKEN">
<value>
<option name="FOREGROUND" value="8F9D6A" />
</value>
</option>
<option name="PARAMETER_ATTRIBUTES">
<value />
</option>
@@ -1151,6 +1301,11 @@
<option name="FOREGROUND" value="CDA869" />
</value>
</option>
<option name="PROTOCOL_REFERENCE">
<value>
<option name="FOREGROUND" value="9B703F" />
</value>
</option>
<option name="PUPPET_BAD_CHARACTER">
<value>
<option name="BACKGROUND" value="6e3b3b" />
@@ -1957,6 +2112,11 @@
<option name="FOREGROUND" value="8F9D6A" />
</value>
</option>
<option name="TYPEDEF">
<value>
<option name="FOREGROUND" value="F9EE98" />
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="583535" />
@@ -135,6 +135,7 @@ public class CompilerTask extends Task.Backgroundable {
try {
try {
final Application app = ApplicationManager.getApplication();
while (!acquired) {
acquired = semaphore.tryAcquire(500, TimeUnit.MILLISECONDS);
if (indicator.isCanceled()) {
@@ -142,6 +143,9 @@ public class CompilerTask extends Task.Backgroundable {
// let compile work begin in order to stop gracefuly on cancel event
break;
}
if (app.isDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
}
}
}
catch (InterruptedException ignored) {
@@ -115,6 +115,7 @@ import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage
*/
public class BuildManager implements ApplicationComponent{
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.BuildManager");
private static final String COMPILER_PROCESS_JDK_PROPERTY = "compiler.process.jdk";
private static final String SYSTEM_ROOT = "compile-server";
private static final String LOGGER_CONFIG = "log.xml";
private static final String DEFAULT_LOGGER_CONFIG = "defaultLogConfig.xml";
@@ -123,7 +124,7 @@ public class BuildManager implements ApplicationComponent{
private static final String IWS_EXTENSION = ".iws";
private static final String IPR_EXTENSION = ".ipr";
private static final String IDEA_PROJECT_DIR_PATTERN = "/.idea/";
private static final Function<String, Boolean> PATH_FILTER =
private static final Function<String, Boolean> PATH_FILTER =
SystemInfo.isFileSystemCaseSensitive?
new Function<String, Boolean>() {
@Override
@@ -173,7 +174,7 @@ public class BuildManager implements ApplicationComponent{
mySystemDirectory = system;
projectManager.addProjectManagerListener(new ProjectWatcher());
final MessageBusConnection conn = ApplicationManager.getApplication().getMessageBus().connect();
conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
@Override
@@ -193,7 +194,7 @@ public class BuildManager implements ApplicationComponent{
if (eventFile == null || ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
continue;
}
if (activeProjects == null) {
activeProjects = getActiveProjects();
if (activeProjects.isEmpty()) {
@@ -684,72 +685,83 @@ public class BuildManager implements ApplicationComponent{
}
private OSProcessHandler launchBuildProcess(Project project, final int port, final UUID sessionId) throws ExecutionException {
// choosing sdk with which the build process should be run
Sdk projectJdk = null;
final String compilerPath;
final String vmExecutablePath;
JavaSdkVersion sdkVersion = null;
int sdkMinorVersion = 0;
final Set<Sdk> candidates = new HashSet<Sdk>();
final Sdk defaultSdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (defaultSdk != null && defaultSdk.getSdkType() instanceof JavaSdk) {
candidates.add(defaultSdk);
}
final String forcedCompiledJdkHome = Registry.stringValue(COMPILER_PROCESS_JDK_PROPERTY);
for (Module module : ModuleManager.getInstance(project).getModules()) {
final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
candidates.add(sdk);
if (StringUtil.isEmptyOrSpaces(forcedCompiledJdkHome)) {
// choosing sdk with which the build process should be run
Sdk projectJdk = null;
int sdkMinorVersion = 0;
final Set<Sdk> candidates = new HashSet<Sdk>();
final Sdk defaultSdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (defaultSdk != null && defaultSdk.getSdkType() instanceof JavaSdk) {
candidates.add(defaultSdk);
}
}
// now select the latest version from the sdks that are used in the project, but not older than the internal sdk version
for (Sdk candidate : candidates) {
final String vs = candidate.getVersionString();
if (vs != null) {
final JavaSdkVersion candidateVersion = ((JavaSdk)candidate.getSdkType()).getVersion(vs);
if (candidateVersion != null) {
final int candidateMinorVersion = getMinorVersion(vs);
if (projectJdk == null) {
sdkVersion = candidateVersion;
sdkMinorVersion = candidateMinorVersion;
projectJdk = candidate;
}
else {
final int result = candidateVersion.compareTo(sdkVersion);
if (result > 0 || (result == 0 && candidateMinorVersion > sdkMinorVersion)) {
for (Module module : ModuleManager.getInstance(project).getModules()) {
final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
candidates.add(sdk);
}
}
// now select the latest version from the sdks that are used in the project, but not older than the internal sdk version
for (Sdk candidate : candidates) {
final String vs = candidate.getVersionString();
if (vs != null) {
final JavaSdkVersion candidateVersion = ((JavaSdk)candidate.getSdkType()).getVersion(vs);
if (candidateVersion != null) {
final int candidateMinorVersion = getMinorVersion(vs);
if (projectJdk == null) {
sdkVersion = candidateVersion;
sdkMinorVersion = candidateMinorVersion;
projectJdk = candidate;
}
else {
final int result = candidateVersion.compareTo(sdkVersion);
if (result > 0 || (result == 0 && candidateMinorVersion > sdkMinorVersion)) {
sdkVersion = candidateVersion;
sdkMinorVersion = candidateMinorVersion;
projectJdk = candidate;
}
}
}
}
}
}
final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) {
projectJdk = internalJdk;
}
// validate tools.jar presence
final String compilerPath;
if (projectJdk.equals(internalJdk)) {
final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler();
if (systemCompiler == null) {
throw new ExecutionException("No system java compiler is provided by the JRE. Make sure tools.jar is present in IntelliJ IDEA classpath.");
final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) {
projectJdk = internalJdk;
}
compilerPath = ClasspathBootstrap.getResourcePath(systemCompiler.getClass());
// validate tools.jar presence
if (projectJdk.equals(internalJdk)) {
final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler();
if (systemCompiler == null) {
throw new ExecutionException("No system java compiler is provided by the JRE. Make sure tools.jar is present in IntelliJ IDEA classpath.");
}
compilerPath = ClasspathBootstrap.getResourcePath(systemCompiler.getClass());
}
else {
compilerPath = ((JavaSdk)projectJdk.getSdkType()).getToolsPath(projectJdk);
if (compilerPath == null) {
throw new ExecutionException("Cannot determine path to 'tools.jar' library for " + projectJdk.getName() + " (" + projectJdk.getHomePath() + ")");
}
}
vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
}
else {
compilerPath = ((JavaSdk)projectJdk.getSdkType()).getToolsPath(projectJdk);
if (compilerPath == null) {
throw new ExecutionException("Cannot determine path to 'tools.jar' library for " + projectJdk.getName() + " (" + projectJdk.getHomePath() + ")");
}
compilerPath = new File(forcedCompiledJdkHome, "lib/tools.jar").getAbsolutePath();
vmExecutablePath = new File(forcedCompiledJdkHome, "bin/java").getAbsolutePath();
}
final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project);
final GeneralCommandLine cmdLine = new GeneralCommandLine();
final String vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
cmdLine.setExePath(vmExecutablePath);
//cmdLine.addParameter("-XX:MaxPermSize=150m");
//cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -63,6 +63,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.PropertyKey;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.intellij.util.containers.ContainerUtil.newTroveSet;
@@ -833,27 +835,35 @@ public class HighlightUtil extends HighlightUtilBase {
@Nullable
public static HighlightInfo checkLiteralExpressionParsingError(@NotNull final PsiLiteralExpression expression) {
final Object value = expression.getValue();
final PsiElement literal = expression.getFirstChild();
PsiElement literal = expression.getFirstChild();
assert literal instanceof PsiJavaToken : literal;
final IElementType type = ((PsiJavaToken)literal).getTokenType();
String text = PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type) ? literal.getText().toLowerCase() : literal.getText();
IElementType type = ((PsiJavaToken)literal).getTokenType();
if (type == JavaTokenType.TRUE_KEYWORD || type == JavaTokenType.FALSE_KEYWORD || type == JavaTokenType.NULL_KEYWORD) {
return null;
}
if (PsiLiteralExpressionImpl.REAL_LITERALS.contains(type)) {
boolean isInt = PsiLiteralExpressionImpl.INTEGER_LITERALS.contains(type);
boolean isFP = PsiLiteralExpressionImpl.REAL_LITERALS.contains(type);
String text = isInt || isFP ? literal.getText().toLowerCase() : literal.getText();
Object value = expression.getValue();
if (isFP) {
if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
final HighlightInfo info = checkFeature(expression, Feature.HEX_FP_LITERALS);
if (info != null) return info;
}
}
if (PsiLiteralExpressionImpl.INTEGER_LITERALS.contains(type)) {
if (isInt) {
if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) {
final HighlightInfo info = checkFeature(expression, Feature.BIN_LITERALS);
if (info != null) return info;
}
}
if (PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type)) {
if (isInt || isFP) {
if (text.contains("_")) {
final HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES);
HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES);
if (info != null) return info;
info = checkUnderscores(expression, text, isInt);
if (info != null) return info;
}
}
@@ -898,15 +908,12 @@ public class HighlightUtil extends HighlightUtilBase {
}
}
}
else if (type == JavaTokenType.FLOAT_LITERAL || type == JavaTokenType.DOUBLE_LITERAL) {
else if (isFP) {
if (value == null) {
final String message = JavaErrorMessages.message("malformed.floating.point.literal");
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
else if (type == JavaTokenType.TRUE_KEYWORD || type == JavaTokenType.FALSE_KEYWORD || type == JavaTokenType.NULL_KEYWORD) {
return null;
}
else if (type == JavaTokenType.CHARACTER_LITERAL) {
// todo[r.sh] clean this mess up
if (value != null) {
@@ -1003,6 +1010,43 @@ public class HighlightUtil extends HighlightUtilBase {
return null;
}
private static final Pattern FP_LITERAL_PARTS =
Pattern.compile("(?:" +
"(?:0x([_\\p{XDigit}]*)\\.?([_\\p{XDigit}]*)p[+-]?([_\\d]*))" +
"|" +
"(?:([_\\d]*)\\.?([_\\d]*)e?[+-]?([_\\d]*))" +
")[fd]?");
@Nullable
private static HighlightInfo checkUnderscores(PsiElement expression, String text, boolean isInt) {
String[] parts = ArrayUtil.EMPTY_STRING_ARRAY;
if (isInt) {
int start = 0, end = text.length();
if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX) || text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) start += 2;
if (StringUtil.endsWithChar(text, 'l')) --end;
parts = new String[]{text.substring(start, end)};
}
else {
Matcher matcher = FP_LITERAL_PARTS.matcher(text);
if (matcher.matches()) {
parts = new String[matcher.groupCount()];
for (int i = 0; i < matcher.groupCount(); i++) {
parts[i] = matcher.group(i + 1);
}
}
}
for (String part : parts) {
if (part != null && (StringUtil.startsWithChar(part, '_') || StringUtil.endsWithChar(part, '_'))) {
String message = JavaErrorMessages.message("illegal.underscore");
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
return null;
}
// true if floating point literal consists of zeros only
public static boolean isFPZero(@NotNull final String text) {
for (int i = 0; i < text.length(); i++) {
@@ -18,8 +18,8 @@ package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.IntentionAndQuickFixAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
@@ -35,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
public class CreateMethodQuickFix implements LocalQuickFix {
public class CreateMethodQuickFix extends IntentionAndQuickFixAction {
protected final PsiClass myTargetClass;
protected final String mySignature;
protected final String myBody;
@@ -66,10 +66,10 @@ public class CreateMethodQuickFix implements LocalQuickFix {
}
@Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
public void applyFix(Project project, PsiFile file, @Nullable Editor editor) {
if (!CodeInsightUtilBase.preparePsiElementForWrite(myTargetClass.getContainingFile())) return;
PsiMethod method = createMethod(project);
PsiMethod method = createMethod(project);
List<Pair<PsiExpression, PsiType>> arguments =
ContainerUtil.map2List(method.getParameterList().getParameters(), new Function<PsiParameter, Pair<PsiExpression, PsiType>>() {
@Override
@@ -549,10 +549,13 @@ public class ExpressionParser {
final PsiBuilder.Marker mark = builder.mark();
final ReferenceParser.TypeInfo typeInfo = myParser.getReferenceParser().parseTypeInfo(builder, 0);
if (typeInfo != null && (typeInfo.isPrimitive || !typeInfo.hasErrors && typeInfo.isParameterized)) {
final PsiBuilder.Marker result = continueClassAccessOrMethodReference(builder, mark, typeInfo.isPrimitive);
if (result != null) {
return result;
if (typeInfo != null) {
boolean optionalClassKeyword = typeInfo.isPrimitive || typeInfo.isArray;
if (optionalClassKeyword || !typeInfo.hasErrors && typeInfo.isParameterized) {
final PsiBuilder.Marker result = continueClassAccessOrMethodReference(builder, mark, optionalClassKeyword);
if (result != null) {
return result;
}
}
}
@@ -776,10 +779,10 @@ public class ExpressionParser {
@Nullable
private PsiBuilder.Marker continueClassAccessOrMethodReference(final PsiBuilder builder,
final PsiBuilder.Marker expr,
final boolean primitive) {
final boolean optionalClassKeyword) {
final IElementType tokenType = builder.getTokenType();
if (tokenType == JavaTokenType.DOT) {
return parseClassObjectAccess(builder, expr, primitive);
return parseClassObjectAccess(builder, expr, optionalClassKeyword);
}
else if (tokenType == JavaTokenType.DOUBLE_COLON) {
return parseMethodReference(builder, expr);
@@ -789,7 +792,7 @@ public class ExpressionParser {
}
@Nullable
private static PsiBuilder.Marker parseClassObjectAccess(PsiBuilder builder, PsiBuilder.Marker expr, boolean primitive) {
private static PsiBuilder.Marker parseClassObjectAccess(PsiBuilder builder, PsiBuilder.Marker expr, boolean optionalClassKeyword) {
final PsiBuilder.Marker mark = builder.mark();
builder.advanceLexer();
@@ -798,7 +801,7 @@ public class ExpressionParser {
builder.advanceLexer();
}
else {
if (!primitive) return null;
if (!optionalClassKeyword) return null;
mark.rollbackTo();
builder.error(".class expected");
}
@@ -1,4 +1,18 @@
/* It's an automatically generated code. Do not modify it. */
/*
* Copyright 2000-2013 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.lexer;
import com.intellij.pom.java.LanguageLevel;
@@ -43,38 +57,24 @@ DOC_COMMENT="/*""*"+("/"|([^"/""*"]{COMMENT_TAIL}))?
COMMENT_TAIL=([^"*"]*("*"+[^"*""/"])?)*("*"+"/")?
END_OF_LINE_COMMENT="/""/"[^\r\n]*
DIGIT=[0-9]
DIGIT_OR_UNDERSCORE=[_0-9]
OCTAL_DIGIT=[0-7]
OCTAL_DIGIT_OR_UNDERSCORE=[_0-7]
HEX_DIGIT=[0-9A-Fa-f]
HEX_DIGIT_OR_UNDERSCORE=[_0-9A-Fa-f]
BINARY_DIGIT=[01]
BINARY_DIGIT_OR_UNDERSCORE=[_01]
DIGIT = [0-9]
DIGIT_OR_UNDERSCORE = [_0-9]
DIGITS = {DIGIT} | {DIGIT} {DIGIT_OR_UNDERSCORE}*
HEX_DIGIT_OR_UNDERSCORE = [_0-9A-Fa-f]
DIGITS={DIGIT}|({DIGIT}{DIGIT_OR_UNDERSCORE}*{DIGIT})
HEX_DIGITS={HEX_DIGIT}|({HEX_DIGIT}{HEX_DIGIT_OR_UNDERSCORE}*{HEX_DIGIT})
BINARY_DIGITS={BINARY_DIGIT}|({BINARY_DIGIT}{BINARY_DIGIT_OR_UNDERSCORE}*{BINARY_DIGIT})
INTEGER_LITERAL = {DIGITS} | {HEX_INTEGER_LITERAL} | {BIN_INTEGER_LITERAL}
LONG_LITERAL = {INTEGER_LITERAL} [Ll]
HEX_INTEGER_LITERAL = 0 [Xx] {HEX_DIGIT_OR_UNDERSCORE}*
BIN_INTEGER_LITERAL = 0 [Bb] {DIGIT_OR_UNDERSCORE}*
INTEGER_LITERAL={DECIMAL_INTEGER_LITERAL}|{OCTAL_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}|{BINARY_INTEGER_LITERAL}
DECIMAL_INTEGER_LITERAL=0|([1-9]({DIGIT_OR_UNDERSCORE}*{DIGIT})?)
OCTAL_INTEGER_LITERAL=0{OCTAL_DIGIT_OR_UNDERSCORE}*{OCTAL_DIGIT}
HEX_INTEGER_LITERAL=0[Xx]{HEX_DIGITS}?
BINARY_INTEGER_LITERAL=0[Bb]{BINARY_DIGITS}?
LONG_LITERAL={INTEGER_LITERAL}[Ll]
FLOAT_LITERAL=({FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3}|{FLOATING_POINT_LITERAL4})[Ff]
DOUBLE_LITERAL=(({FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3})[Dd]?)|({FLOATING_POINT_LITERAL4}[Dd])
FLOATING_POINT_LITERAL1={DIGITS}"."{DIGITS}?{EXPONENT_PART}?
FLOATING_POINT_LITERAL2="."{DIGITS}{EXPONENT_PART}?
FLOATING_POINT_LITERAL3={DIGITS}{EXPONENT_PART}
FLOATING_POINT_LITERAL4={DIGITS}
EXPONENT_PART=[Ee]["+""-"]?{DIGITS}?
HEX_FLOAT_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Ff]
HEX_DOUBLE_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Dd]?
BINARY_EXPONENT=[Pp][+-]?{DIGITS}
HEX_SIGNIFICAND={HEX_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}.|0[Xx]{HEX_DIGITS}?.{HEX_DIGITS}
FLOAT_LITERAL = ({DEC_FP_LITERAL} | {HEX_FP_LITERAL}) [Ff] | {DIGITS} [Ff]
DOUBLE_LITERAL = ({DEC_FP_LITERAL} | {HEX_FP_LITERAL}) [Dd]? | {DIGITS} [Dd]
DEC_FP_LITERAL = {DIGITS} {DEC_EXPONENT} | {DEC_SIGNIFICAND} {DEC_EXPONENT}?
DEC_SIGNIFICAND = "." {DIGITS} | {DIGITS} "." {DIGIT_OR_UNDERSCORE}*
DEC_EXPONENT = [Ee] [+-]? {DIGIT_OR_UNDERSCORE}*
HEX_FP_LITERAL = {HEX_SIGNIFICAND} {HEX_EXPONENT}
HEX_SIGNIFICAND = 0 [Xx] ({HEX_DIGIT_OR_UNDERSCORE}+ "."? | {HEX_DIGIT_OR_UNDERSCORE}* "." {HEX_DIGIT_OR_UNDERSCORE}+)
HEX_EXPONENT = [Pp] [+-]? {DIGIT_OR_UNDERSCORE}*
CHARACTER_LITERAL="'"([^\\\'\r\n]|{ESCAPE_SEQUENCE})*("'"|\\)?
STRING_LITERAL=\"([^\\\"\r\n]|{ESCAPE_SEQUENCE})*(\"|\\)?
@@ -91,10 +91,7 @@ ESCAPE_SEQUENCE=\\[^\r\n]
<YYINITIAL> {LONG_LITERAL} { return JavaTokenType.LONG_LITERAL; }
<YYINITIAL> {INTEGER_LITERAL} { return JavaTokenType.INTEGER_LITERAL; }
<YYINITIAL> {FLOAT_LITERAL} { return JavaTokenType.FLOAT_LITERAL; }
<YYINITIAL> {HEX_FLOAT_LITERAL} { return JavaTokenType.FLOAT_LITERAL; }
<YYINITIAL> {DOUBLE_LITERAL} { return JavaTokenType.DOUBLE_LITERAL; }
<YYINITIAL> {HEX_DOUBLE_LITERAL} { return JavaTokenType.DOUBLE_LITERAL; }
<YYINITIAL> {CHARACTER_LITERAL} { return JavaTokenType.CHARACTER_LITERAL; }
<YYINITIAL> {STRING_LITERAL} { return JavaTokenType.STRING_LITERAL; }
File diff suppressed because it is too large Load Diff
@@ -40,7 +40,7 @@ import javax.swing.*;
public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub> implements PsiParameter {
private PsiTypeElement myType = null;
private String myName;
private String myMirrorName = null;
private volatile String myMirrorName = null;
public ClsParameterImpl(@NotNull PsiParameterStub stub) {
super(stub);
@@ -142,43 +142,52 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub>
}
private String getMirrorName() {
synchronized (LAZY_BUILT_LOCK) {
if (myMirrorName == null) {
@NonNls String name;
final PsiParameterStubImpl stub = (PsiParameterStubImpl)getStub();
if (!stub.isAutoGeneratedName() || DumbService.getInstance(getProject()).isDumb()) {
name = stub.getName();
String mirrorName = myMirrorName;
if (mirrorName == null) {
// avoid calculation of nice parameter name under lock as we might need indices for coolness
// and latter might produce deadlock, see IDEA-99248
mirrorName = calcNiceParameterName();
synchronized (LAZY_BUILT_LOCK) {
if (myMirrorName == null) {
myMirrorName = mirrorName;
}
else {
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject());
String[] nameSuggestions = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, getType()).names;
}
}
return mirrorName;
}
name = "p";
if (nameSuggestions.length > 0) {
name = nameSuggestions[0];
}
private String calcNiceParameterName() {
@NonNls String name;
PsiParameter[] parameters = ((PsiParameterList) getParent()).getParameters();
AttemptsLoop:
while (true) {
for (PsiParameter parameter : parameters) {
if (parameter == this) break AttemptsLoop;
String name1 = ((ClsParameterImpl) parameter).getMirrorName();
if (name.equals(name1)) {
name = nextName(name);
continue AttemptsLoop;
}
}
}
}
final PsiParameterStubImpl stub = (PsiParameterStubImpl)getStub();
if (!stub.isAutoGeneratedName() || DumbService.getInstance(getProject()).isDumb()) {
name = stub.getName();
}
else {
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject());
String[] nameSuggestions = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, getType()).names;
assert name != null : stub;
myMirrorName = name;
name = "p";
if (nameSuggestions.length > 0) {
name = nameSuggestions[0];
}
return myMirrorName;
PsiParameter[] parameters = ((PsiParameterList) getParent()).getParameters();
AttemptsLoop:
while (true) {
for (PsiParameter parameter : parameters) {
if (parameter == this) break AttemptsLoop;
String name1 = ((ClsParameterImpl) parameter).getMirrorName();
if (name.equals(name1)) {
name = nextName(name);
continue AttemptsLoop;
}
}
}
}
assert name != null : stub;
return name;
}
private static String nextName(String name) {
@@ -278,6 +278,7 @@ unclosed.char.literal=Unclosed character literal
illegal.escape.character.in.string.literal=Illegal escape character in string literal
floating.point.number.too.large=Floating point number too large
floating.point.number.too.small=Floating point number too small
illegal.underscore=Illegal underscore
import.statement.identifier.or.asterisk.expected.=Identifier or '*' expected
@@ -0,0 +1,5 @@
public class Util {
int goo() {
String[].<caret>x
}
}
@@ -1,24 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// assignment compatible types
import java.io.*;
import java.net.*;
public class a {
public class NumericLiterals {
final int FI = 2;
final int FIBIG = 200000000;
@@ -38,7 +18,8 @@ public class a {
int i13 = <error descr="Integer number too large">040000000000</error>;
int i14 = 020000000000;
int i15 = <error descr="Integer number too large">0xf044332211</error>;
int octale = 017777777777; // negative
int oi1 = 017777777777;
int oi2 = <error descr="Integer number too large">08</error>;
int bi1 = <error descr="Binary literals are not supported at this language level">0b0010</error>;
int bi2 = <error descr="Binary literals are not supported at this language level">0B0010</error>;
int bi3 = <error descr="Underscores in literals are not supported at this language level">1_2</error>;
@@ -53,8 +34,8 @@ public class a {
long l8 = 0xffffffffffffffffL;
long l9 = <error descr="Long number too large">0xffffffffffffffff9L</error>;
long l10 = 0x8000000000000000L;
long octalValue = 01777777777777777777600L;
long octalValua = 01777777777777777777777L;
long ol1 = 01777777777777777777600L;
long ol2 = 01777777777777777777777L;
long bl1 = <error descr="Binary literals are not supported at this language level">0b0010l</error>;
long bl2 = <error descr="Binary literals are not supported at this language level">0B0010L</error>;
long bl3 = <error descr="Underscores in literals are not supported at this language level">10_24L</error>;
@@ -63,7 +44,8 @@ public class a {
float f2 = <error descr="Floating point number too large">1e39f</error>;
float f3 = 0E1F;
float f4 = <error descr="Hexadecimal floating point literals are not supported at this language level">0xabc.defP2f</error>;
float bf1 = <error descr="Underscores in literals are not supported at this language level">3.141_592f</error>;
float f5 = <error descr="Underscores in literals are not supported at this language level">3.141_592f</error>;
float f6 = .0f;
double dd1 = <error descr="Floating point number too small">1e-324</error>;
double dd2 = <error descr="Floating point number too large">1e309</error>;
@@ -81,5 +63,6 @@ public class a {
double d10 = <error descr="Malformed floating point literal">1e-F</error>;
double d11 = <error descr="Malformed floating point literal">1e-f</error>;
double d12 = <error descr="Underscores in literals are not supported at this language level">3.141_592_653_589_793d</error>;
double d13 = <error descr="Malformed floating point literal">.0e</error>;
}
}
@@ -7,6 +7,11 @@ public class NumericLiterals {
int i5 = 0b0001_0010_0100_1000;
int i6 = <error descr="Binary numbers must contain at least one binary digit">0b</error>;
int i7 = <error descr="Integer number too large">0b1_1111_1111_1111_1111_1111_1111_1111_1111</error>;
int i8 = <error descr="Illegal underscore">0_</error>;
int i9 = <error descr="Integer number too large">0_8</error>;
int i10 = <error descr="Illegal underscore">0x_f</error>;
int i11 = <error descr="Illegal underscore">0b_1</error>;
int i12 = <error descr="Integer number too large">0B2</error>;
long l1 = 1_2L;
long l2 = 012__34l;
@@ -41,5 +46,7 @@ public class NumericLiterals {
double d10 = 0x.a_bcP1___23d;
double d11 = <error descr="Floating point number too small">1e-3_2_4</error>;
double d12 = <error descr="Floating point number too large">0xa_bc.de_fP1_234D</error>;
double d13 = <error descr="Illegal underscore">0x1.0_p-1</error>;
double d14 = <error descr="Illegal underscore">1.0e_1022</error>;
}
}
@@ -114,6 +114,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testIntInClassArray() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInClassArray2() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInClassArray3() throws Throwable { doTest(2, "int", "char", "final"); }
public void testArrayClass() throws Throwable { doTest(1, "class", "interface"); }
public void testIntInGenerics() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInGenerics2() throws Throwable { doTest(2, "int", "char", "final"); }
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -52,6 +52,17 @@ public class JavaLexerTest extends LexerTestCase {
"DOUBLE_LITERAL ('3.14')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1e-9d')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1e137')");
doTest(". e0 x1 ax .e .p 08 .0e .0f",
"DOT ('.')\nWHITE_SPACE (' ')\n" +
"IDENTIFIER ('e0')\nWHITE_SPACE (' ')\n" +
"IDENTIFIER ('x1')\nWHITE_SPACE (' ')\n" +
"IDENTIFIER ('ax')\nWHITE_SPACE (' ')\n" +
"DOT ('.')\nIDENTIFIER ('e')\nWHITE_SPACE (' ')\n" +
"DOT ('.')\nIDENTIFIER ('p')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('08')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('.0e')\nWHITE_SPACE (' ')\n" +
"FLOAT_LITERAL ('.0f')");
}
public void testTigerNumericLiterals() {
@@ -66,6 +77,9 @@ public class JavaLexerTest extends LexerTestCase {
"DOUBLE_LITERAL ('0xab.P12')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0x.abcP123d')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0xabc.defP1234D')");
doTest("p0",
"IDENTIFIER ('p0')");
}
public void testCoinNumericLiterals() {
@@ -116,15 +130,18 @@ public class JavaLexerTest extends LexerTestCase {
}
public void testMalformedCoinLiterals() {
doTest("0_ _1 0_8 0x_f 0b_1 0B2 0x1.0_p-1 1.0e_1022",
"INTEGER_LITERAL ('0')\nIDENTIFIER ('_')\nWHITE_SPACE (' ')\n" +
doTest("_1 _b ._ 0_ 0_8 0x_f 0b_1 0B2 0x1.0_p-1 1.0e_1022 0._1",
"IDENTIFIER ('_1')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0')\nIDENTIFIER ('_8')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0x')\nIDENTIFIER ('_f')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0b')\nIDENTIFIER ('_1')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0B')\nINTEGER_LITERAL ('2')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0x1')\nDOUBLE_LITERAL ('.0')\nIDENTIFIER ('_p')\nMINUS ('-')\nINTEGER_LITERAL ('1')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1.0e')\nIDENTIFIER ('_1022')");
"IDENTIFIER ('_b')\nWHITE_SPACE (' ')\n" +
"DOT ('.')\nIDENTIFIER ('_')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0_')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0_8')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0x_f')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0b_1')\nWHITE_SPACE (' ')\n" +
"INTEGER_LITERAL ('0B2')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0x1.0_p-1')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1.0e_1022')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0._1')");
}
public void testMalformedOperators() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -41,6 +41,14 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class PsiConcurrencyStressTest extends PsiTestCase {
private static final boolean SKIP = "true".equalsIgnoreCase(System.getProperty("skip.psi.concurrency.test"));
@Override
public void runBare() throws Throwable {
if (!SKIP) {
super.runBare();
}
}
@Override
protected void setUp() throws Exception {
@@ -1,33 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item name='javax.swing.plaf.basic.BasicArrowButton void setDirection(int) 0'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicArrowButton BasicArrowButton(int) 0">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
<item name='javax.swing.plaf.basic.BasicArrowButton void getDirection()'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicArrowButton BasicArrowButton(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color) 0">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
<item
name='javax.swing.plaf.basic.BasicArrowButton BasicArrowButton(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color) 0'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicArrowButton void getDirection()">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
<item name='javax.swing.plaf.basic.BasicArrowButton BasicArrowButton(int) 0'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicArrowButton void setDirection(int) 0">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
<item name='javax.swing.plaf.basic.BasicScrollBarUI javax.swing.JButton createDecreaseButton(int) 0'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicScrollBarUI javax.swing.JButton createDecreaseButton(int) 0">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
<item name='javax.swing.plaf.basic.BasicScrollBarUI javax.swing.JButton createIncreaseButton(int) 0'>
<annotation name='org.intellij.lang.annotations.MagicConstant'>
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}"/>
<item name="javax.swing.plaf.basic.BasicScrollBarUI javax.swing.JButton createIncreaseButton(int) 0">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="intValues" val="{javax.swing.SwingConstants.NORTH,javax.swing.SwingConstants.SOUTH,javax.swing.SwingConstants.EAST,javax.swing.SwingConstants.WEST}" />
</annotation>
</item>
</root>
</root>
@@ -1,5 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item name="javax.swing.tree.TreePath TreePath(java.lang.Object) 0">
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name="javax.swing.tree.TreePath TreePath(java.lang.Object[]) 0">
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name="javax.swing.tree.TreePath TreePath(java.lang.Object[], int) 0">
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name="javax.swing.tree.TreePath TreePath(javax.swing.tree.TreePath, java.lang.Object) 1">
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name="javax.swing.tree.TreePath javax.swing.tree.TreePath pathByAddingChild(java.lang.Object) 0">
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name="javax.swing.tree.TreeSelectionModel int getSelectionMode()">
<annotation name="org.intellij.lang.annotations.MagicConstant">
<val name="valuesFromClass" val="javax.swing.tree.TreeSelectionModel.class" />
@@ -15,7 +15,6 @@
*/
package org.jetbrains.jps.incremental;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileSystemUtil;
import com.intellij.openapi.util.io.FileUtil;
import gnu.trove.THashSet;
@@ -44,7 +43,7 @@ import java.util.Set;
* Date: 7/8/12
*/
public class FSOperations {
public static final Key<Set<File>> ALL_OUTPUTS_KEY = Key.create("_all_project_output_dirs_");
public static final GlobalContextKey<Set<File>> ALL_OUTPUTS_KEY = GlobalContextKey.create("_all_project_output_dirs_");
public static void markDirty(CompileContext context, final File file) throws IOException {
final JavaSourceRootDescriptor rd = context.getProjectDescriptor().getBuildRootIndex().findJavaRootDescriptor(context, file);
@@ -1,11 +1,11 @@
/*
* Copyright 2001-2012 the original author or authors.
* Copyright 2000-2013 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
* 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,
@@ -13,24 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.generate.tostring.inspection;
package org.jetbrains.jps.incremental;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* Base class to extend for different types of quick fixes.
This is type of the key for data that must be visible to all threads
*/
public abstract class AbstractGenerateToStringQuickFix implements LocalQuickFix {
public final class GlobalContextKey<T> extends Key<T> {
public GlobalContextKey(@NotNull @NonNls String name) {
super(name);
}
@NotNull
public String getName() {
return "Generate toString()";
}
@NotNull
public String getFamilyName() {
return "Generate";
}
public static <T> GlobalContextKey<T> create(@NotNull @NonNls String name) {
return new GlobalContextKey<T>(name);
}
}
@@ -16,7 +16,6 @@
package org.jetbrains.jps.incremental;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.util.UserDataHolderBase;
@@ -80,7 +79,7 @@ public class IncProjectBuilder {
private static final String CLASSPATH_INDEX_FINE_NAME = "classpath.index";
private static final boolean GENERATE_CLASSPATH_INDEX = Boolean.parseBoolean(System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION, "false"));
private static final Key<Set<BuildTarget<?>>> TARGET_WITH_CLEARED_OUTPUT = Key.create("_targets_with_cleared_output_");
private static final GlobalContextKey<Set<BuildTarget<?>>> TARGET_WITH_CLEARED_OUTPUT = GlobalContextKey.create("_targets_with_cleared_output_");
private static final int MAX_BUILDER_THREADS;
static {
int maxThreads = 6;
@@ -1058,14 +1057,6 @@ public class IncProjectBuilder {
BuildOperations.markTargetsUpToDate(context, chunk);
}
private static final Set<Key> GLOBAL_CONTEXT_KEYS = new HashSet<Key>();
static {
// keys for data that must be visible to all threads
GLOBAL_CONTEXT_KEYS.add(ExternalJavacDescriptor.KEY);
GLOBAL_CONTEXT_KEYS.add(FSOperations.ALL_OUTPUTS_KEY);
GLOBAL_CONTEXT_KEYS.add(TARGET_WITH_CLEARED_OUTPUT);
}
private static CompileContext createContextWrapper(final CompileContext delegate) {
final ClassLoader loader = delegate.getClass().getClassLoader();
final UserDataHolderBase localDataHolder = new UserDataHolderBase();
@@ -1078,8 +1069,7 @@ public class IncProjectBuilder {
final Class<?> declaringClass = method.getDeclaringClass();
if (dataHolderInterface.equals(declaringClass)) {
final Object firstArgument = args[0];
final boolean isGlobalContextKey = firstArgument instanceof Key && GLOBAL_CONTEXT_KEYS.contains((Key)firstArgument);
if (!isGlobalContextKey) {
if (!(firstArgument instanceof GlobalContextKey)) {
final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/;
if (isWriteOperation) {
if (args[1] == null) {
@@ -16,7 +16,7 @@
package org.jetbrains.jps.incremental.java;
import com.intellij.execution.process.BaseOSProcessHandler;
import com.intellij.openapi.util.Key;
import org.jetbrains.jps.incremental.GlobalContextKey;
import org.jetbrains.jps.javac.JavacServerClient;
/**
@@ -24,7 +24,7 @@ import org.jetbrains.jps.javac.JavacServerClient;
* Date: 1/24/12
*/
public class ExternalJavacDescriptor {
public static final Key<ExternalJavacDescriptor> KEY = Key.create("_external_javac_descriptor_");
public static final GlobalContextKey<ExternalJavacDescriptor> KEY = GlobalContextKey.create("_external_javac_descriptor_");
public final BaseOSProcessHandler process;
public final JavacServerClient client;
@@ -22,9 +22,13 @@ import com.intellij.util.SmartList;
import gnu.trove.THashSet;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.incremental.GlobalContextKey;
import java.io.*;
import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/**
* @author nik
@@ -35,6 +39,7 @@ public class BuildTargetConfiguration {
private final BuildTargetsState myTargetsState;
private String myConfiguration;
private volatile String myCurrentState;
private static final GlobalContextKey<Set<File>> ALL_DELETED_ROOTS_KEY = GlobalContextKey.create("_all_deleted_output_roots_");
public BuildTargetConfiguration(BuildTarget<?> target, BuildTargetsState targetsState) {
myTarget = target;
@@ -121,9 +126,7 @@ public class BuildTargetConfiguration {
}
File file = getNonexistentOutputsFile();
if (nonexistentOutputRoots.isEmpty()) {
if (file.exists()) {
FileUtil.delete(file);
}
file.delete();
}
else {
FileUtil.writeToFile(file, StringUtil.join(nonexistentOutputRoots, "\n"));
@@ -132,12 +135,31 @@ public class BuildTargetConfiguration {
public boolean outputRootWasDeleted(CompileContext context) throws IOException {
List<String> nonexistentOutputRoots = new SmartList<String>();
for (File outputRoot : myTarget.getOutputRoots(context)) {
if (!outputRoot.exists()) {
nonexistentOutputRoots.add(outputRoot.getAbsolutePath());
final Collection<File> targetRoots = myTarget.getOutputRoots(context);
synchronized (ALL_DELETED_ROOTS_KEY) {
Set<File> allDeletedRoots = ALL_DELETED_ROOTS_KEY.get(context);
for (File outputRoot : targetRoots) {
boolean wasDeleted = allDeletedRoots != null && allDeletedRoots.contains(outputRoot);
if (!wasDeleted) {
wasDeleted = !outputRoot.exists();
if (wasDeleted) {
if (allDeletedRoots == null) { // lazy init
allDeletedRoots = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
ALL_DELETED_ROOTS_KEY.set(context, allDeletedRoots);
}
allDeletedRoots.add(outputRoot);
}
}
if (wasDeleted) {
nonexistentOutputRoots.add(outputRoot.getAbsolutePath());
}
}
}
if (nonexistentOutputRoots.isEmpty()) return false;
if (nonexistentOutputRoots.isEmpty()) {
return false;
}
Set<String> storedNonExistentOutputs;
File file = getNonexistentOutputsFile();
@@ -18,11 +18,13 @@ package org.jetbrains.jps.builders;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.MessageHandler;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.messages.DoneSomethingNotification;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -69,4 +71,9 @@ public class BuildResult implements MessageHandler {
Assert.assertTrue("Build failed. \nErrors:\n" + StringUtil.join(myErrorMessages, toStringFunction, "\n") +
"\nInfo messages:\n" + StringUtil.join(myInfoMessages, toStringFunction, "\n"), isSuccessful());
}
@NotNull
public List<BuildMessage> getErrorMessages() {
return Collections.unmodifiableList(myErrorMessages);
}
}
@@ -22,6 +22,7 @@ import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
import org.jetbrains.jps.model.serialization.JpsProjectExtensionSerializer;
@@ -55,16 +56,7 @@ public class JpsJavaCompilerConfigurationSerializer extends JpsProjectExtensionS
configuration.setAddNotNullAssertions(Boolean.parseBoolean(addNotNullTag.getAttributeValue(ENABLED, "true")));
}
Element excludeFromCompileTag = componentTag.getChild(EXCLUDE_FROM_COMPILE);
if (excludeFromCompileTag != null) {
for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) {
configuration.getCompilerExcludes().addExcludedFile(fileTag.getAttributeValue("url"));
}
for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) {
boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories"));
configuration.getCompilerExcludes().addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively);
}
}
readExcludes(componentTag.getChild(EXCLUDE_FROM_COMPILE), configuration.getCompilerExcludes());
Element resourcePatternsTag = componentTag.getChild(WILDCARD_RESOURCE_PATTERNS);
for (Element entry : JDOMUtil.getChildren(resourcePatternsTag, ENTRY)) {
@@ -105,6 +97,18 @@ public class JpsJavaCompilerConfigurationSerializer extends JpsProjectExtensionS
}
}
public static void readExcludes(Element excludeFromCompileTag, JpsCompilerExcludes excludes) {
if (excludeFromCompileTag != null) {
for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) {
excludes.addExcludedFile(fileTag.getAttributeValue("url"));
}
for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) {
boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories"));
excludes.addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively);
}
}
}
@Override
public void saveExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
}
Binary file not shown.
+1
View File
@@ -19,6 +19,7 @@ jgoodies-forms.jar
jh.jar
jna-utils.jar
jna.jar
jsch-0.1.49.jar
jsr173_1.0_api.jar
junit.jar
junit-4.10.jar
Binary file not shown.
+27 -10
View File
@@ -71,6 +71,7 @@ static void unregister_roots();
static bool register_roots(array* new_roots, array* unwatchable, array* mounts);
static array* unwatchable_mounts();
static void inotify_callback(char* path, int event);
static void report_event(char* event, char* path);
static void output(const char* format, ...);
@@ -103,7 +104,6 @@ int main(int argc, char** argv) {
}
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
roots = array_create(20);
if (init_inotify() && roots != NULL) {
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
unregister_roots();
}
else {
printf("GIVEUP\n");
output("GIVEUP\n");
}
close_inotify();
array_delete(roots);
@@ -398,26 +398,23 @@ static array* unwatchable_mounts() {
static void inotify_callback(char* path, int event) {
if (event & IN_CREATE || event & IN_MOVED_TO) {
output("CREATE\n%s\nCHANGE\n%s\n", path, path);
userlog(LOG_DEBUG, "CREATE: %s", path);
report_event("CREATE", path);
report_event("CHANGE", path);
return;
}
if (event & IN_MODIFY) {
output("CHANGE\n%s\n", path);
userlog(LOG_DEBUG, "CHANGE: %s", path);
report_event("CHANGE", path);
return;
}
if (event & IN_ATTRIB) {
output("STATS\n%s\n", path);
userlog(LOG_DEBUG, "STATS: %s", path);
report_event("STATS", path);
return;
}
if (event & IN_DELETE || event & IN_MOVED_FROM) {
output("DELETE\n%s\n", path);
userlog(LOG_DEBUG, "DELETE: %s", path);
report_event("DELETE", path);
return;
}
@@ -428,6 +425,24 @@ static void inotify_callback(char* path, int event) {
}
}
static void report_event(char* event, char* path) {
userlog(LOG_DEBUG, "%s: %s", event, path);
int len = strlen(path);
for (char* p = path; *p != '\0'; p++) {
if (*p == '\n') {
*p = '\0';
}
}
fputs(event, stdout);
fputc('\n', stdout);
fwrite(path, len, 1, stdout);
fputc('\n', stdout);
fflush(stdout);
}
static void output(const char* format, ...) {
if (self_test) {
@@ -438,4 +453,6 @@ static void output(const char* format, ...) {
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
}
+27 -12
View File
@@ -20,6 +20,30 @@
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static void reportEvent(char *event, char *path) {
int len = 0;
if (path != NULL) {
len = strlen(path);
for (char* p = path; *p != '\0'; p++) {
if (*p == '\n') {
*p = '\0';
}
}
}
pthread_mutex_lock(&lock);
fputs(event, stdout);
fputc('\n', stdout);
if (path != NULL) {
fwrite(path, len, 1, stdout);
fputc('\n', stdout);
}
fflush(stdout);
pthread_mutex_unlock(&lock);
}
static void callback(ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
@@ -32,22 +56,13 @@ static void callback(ConstFSEventStreamRef streamRef,
// TODO[max] Lion has much more detailed flags we need accurately process. For now just reduce to SL events range.
FSEventStreamEventFlags flags = eventFlags[i] & 0xFF;
if ((flags & kFSEventStreamEventFlagMustScanSubDirs) != 0) {
pthread_mutex_lock(&lock);
printf("RECDIRTY\n%s\n", paths[i]);
fflush(stdout);
pthread_mutex_unlock(&lock);
reportEvent("RECDIRTY", paths[i]);
}
else if (flags != kFSEventStreamEventFlagNone) {
pthread_mutex_lock(&lock);
printf("RESET\n");
fflush(stdout);
pthread_mutex_unlock(&lock);
reportEvent("RESET", NULL);
}
else {
pthread_mutex_lock(&lock);
printf("DIRTY\n%s\n", paths[i]);
fflush(stdout);
pthread_mutex_unlock(&lock);
reportEvent("DIRTY", paths[i]);
}
}
}
-21
View File
@@ -1,21 +0,0 @@
// gcc -Wall -arch i386 -arch ppc -mmacosx-version-min=10.4 -Os -framework AppKit -o relaunch relaunch.m
#import <AppKit/AppKit.h>
int main(int argc, const char *argv[]) {
if (argc != 2) return EXIT_FAILURE;
unsigned int interval = 500; // check every 0.5 second
unsigned int slept = 0;
while (getppid() != 1) {
usleep(interval * 1000);
slept += interval;
// if (slept > 10 * 1000 /* wait for maximum 10 seconds */) return EXIT_FAILURE;
}
char const *pathToRelaunch = argv[1];
[[NSWorkspace sharedWorkspace] launchApplication:[NSString stringWithUTF8String:pathToRelaunch]];
return EXIT_SUCCESS;
}
+1
View File
@@ -6,3 +6,4 @@ _UpgradeReport_Files
UpgradeLog.xml
ipch
*.sdf
xuserdata
+58 -25
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 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,12 +15,38 @@
*/
#include "stdafx.h"
#include <process.h>
_TCHAR **convert_args(int argc, _TCHAR **argv) {
_TCHAR** result = new _TCHAR* [argc+1];
for(int i = 0; i < argc; i++)
{
if (_tcschr(argv[i], ' '))
{
int len = _tcslen(argv[i]) + 3;
TCHAR *arg = new TCHAR[len];
arg[0] = '\"';
_tcscpy_s(arg+1, len, argv[i]);
_tcscat_s(arg, len, _T("\""));
result[i] = arg;
}
else
{
result[i] = argv[i];
}
}
result[argc] = '\0';
return result;
}
// usage "pid_to_wait (commands_num commands...)*
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 3) return 0;
int ppid = _ttoi(argv [1]);
int arg_index = 1;
int ppid = _ttoi(argv [arg_index++]);
HANDLE parent_process = OpenProcess(SYNCHRONIZE, FALSE, ppid);
if (parent_process)
{
@@ -28,32 +54,39 @@ int _tmain(int argc, _TCHAR* argv[])
CloseHandle(parent_process);
}
int child_argc = argc-2;
_TCHAR** child_argv = new _TCHAR* [child_argc+1];
for(int i = 0; i < child_argc; i++)
{
if (_tcschr(argv[i+2], ' '))
{
int len = _tcslen(argv[i+2]) + 3;
TCHAR *arg = new TCHAR[len];
arg[0] = '\"';
_tcscpy_s(arg+1, len, argv[i+2]);
_tcscat_s(arg, len, _T("\""));
child_argv[i] = arg;
}
else
{
child_argv[i] = argv[i+2];
FILE *file = 0;
#ifdef _DEBUG
file = fopen("c:/restarter_debug.txt", "w");
#endif
while (arg_index < argc - 1) {
int argc_to_perform = _ttoi(argv[arg_index++]);
if (argc_to_perform > 0) {
_TCHAR *command_to_perform = argv[arg_index];
_TCHAR **argv_to_perform = convert_args(argc_to_perform, &argv[arg_index]);
arg_index += argc_to_perform;
if (file) {
_fwprintf_p(file, L"=================\n");
_fwprintf_p(file, L"argc:%d\n", argc_to_perform);
for(int ii = 0; ii < argc_to_perform; ii++) {
_fwprintf_p(file, L" %s\n", argv_to_perform[ii]);
}
fflush(file);
}
int last = arg_index >= argc - 1;
int rc = _tspawnv(last ? _P_NOWAIT : _P_WAIT, command_to_perform, argv_to_perform);
if (file && rc == -1) {
_fwprintf_p(file, L"Error restarting process: errno is %d\n", errno);
fflush(file);
}
}
}
child_argv[child_argc] = '\0';
int rc = _texecv(argv [2], child_argv);
if (rc == -1)
{
_tprintf(_T("Error restarting process: errno is %d"), errno);
if (file) {
_fwprintf_p(file, L"Finished\n");
fclose(file);
}
return 0;
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright 2000-2013 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.
*/
#import <AppKit/AppKit.h>
int main(int argc, const char *argv[]) {
if (argc < 2) return EXIT_FAILURE;
unsigned int interval = 500; // check every 0.5 second
unsigned int slept = 0;
while (getppid() != 1) {
usleep(interval * 1000);
slept += interval;
}
if (argc > 2) {
NSString *launchPath = [NSString stringWithUTF8String:argv[2]];
NSMutableArray *arguments = [NSMutableArray array];
for (int i = 3; i < argc; i++) {
[arguments addObject:[NSString stringWithUTF8String:argv[i]]];
}
NSTask *task = [NSTask launchedTaskWithLaunchPath:launchPath arguments:arguments];
[task waitUntilExit];
}
NSString *pathToRelaunch = [NSString stringWithUTF8String:argv[1]];
[[NSWorkspace sharedWorkspace] launchApplication:pathToRelaunch];
return EXIT_SUCCESS;
}
+3 -3
View File
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "restarter", "restarter.vcproj", "{1B2485B2-CFED-4B2F-8FFD-00F1C9E1BD0C}"
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "restarter", "restarter.vcxproj", "{1B2485B2-CFED-4B2F-8FFD-00F1C9E1BD0C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -7,25 +7,27 @@
objects = {
/* Begin PBXBuildFile section */
3A6C10B4148122790074811C /* relaunch.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6C10B3148122790074811C /* relaunch.m */; };
3A6C10B4148122790074811C /* restarter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6C10B3148122790074811C /* restarter.m */; };
3A6C10B7148122940074811C /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A6C10B6148122940074811C /* AppKit.framework */; };
3ABC975E16A5A3CD0088619F /* restarter in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A6C10AE148122660074811C /* restarter */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CF2F99674C3F98D5739C1B44 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
buildActionMask = 12;
dstPath = "$(PROJECT_DIR)/../../bin/mac";
dstSubfolderSpec = 0;
files = (
3ABC975E16A5A3CD0088619F /* restarter in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3A6C10AE148122660074811C /* relaunch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = relaunch; sourceTree = BUILT_PRODUCTS_DIR; };
3A6C10B3148122790074811C /* relaunch.m */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.c.objc; path = relaunch.m; sourceTree = "<group>"; };
3A6C10AE148122660074811C /* restarter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = restarter; sourceTree = BUILT_PRODUCTS_DIR; };
3A6C10B3148122790074811C /* restarter.m */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.c.objc; path = restarter.m; sourceTree = "<group>"; };
3A6C10B6148122940074811C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@@ -44,7 +46,7 @@
CF2F99674C3F98D5739C1B39 = {
isa = PBXGroup;
children = (
3A6C10B3148122790074811C /* relaunch.m */,
3A6C10B3148122790074811C /* restarter.m */,
CF2F99674C3F98D5739C1B3A /* Products */,
CF2F99674C3F98D5739C1B45 /* Frameworks */,
3A6C10B6148122940074811C /* AppKit.framework */,
@@ -54,7 +56,7 @@
CF2F99674C3F98D5739C1B3A /* Products */ = {
isa = PBXGroup;
children = (
3A6C10AE148122660074811C /* relaunch */,
3A6C10AE148122660074811C /* restarter */,
);
name = Products;
sourceTree = "<group>";
@@ -69,9 +71,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
CF2F99674C3F98D5739C1B3E /* relaunch */ = {
CF2F99674C3F98D5739C1B3E /* restarter */ = {
isa = PBXNativeTarget;
buildConfigurationList = CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */;
buildConfigurationList = CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "restarter" */;
buildPhases = (
CF2F99674C3F98D5739C1B42 /* Sources */,
CF2F99674C3F98D5739C1B43 /* Frameworks */,
@@ -81,9 +83,9 @@
);
dependencies = (
);
name = relaunch;
productName = relaunch;
productReference = 3A6C10AE148122660074811C /* relaunch */;
name = restarter;
productName = restarter;
productReference = 3A6C10AE148122660074811C /* restarter */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
@@ -91,7 +93,7 @@
/* Begin PBXProject section */
CF2F99674C3F98D5739C1B37 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */;
buildConfigurationList = CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "restarter" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@@ -103,7 +105,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
CF2F99674C3F98D5739C1B3E /* relaunch */,
CF2F99674C3F98D5739C1B3E /* restarter */,
);
};
/* End PBXProject section */
@@ -113,7 +115,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3A6C10B4148122790074811C /* relaunch.m in Sources */,
3A6C10B4148122790074811C /* restarter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -129,14 +131,14 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = 4.0;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx10.4;
SDKROOT = macosx;
};
name = Release;
};
@@ -155,14 +157,14 @@
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = 4.0;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx10.4;
SDKROOT = macosx;
};
name = Debug;
};
@@ -185,7 +187,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */ = {
CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "restarter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B3B /* Release */,
@@ -194,7 +196,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */ = {
CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "restarter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B40 /* Release */,
+6
View File
@@ -0,0 +1,6 @@
*.aps
*.vcxproj.user
Release
*.suo
*.opensdf
*.sdf
+14
View File
@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by runnerw.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runnerw", "runnerw.vcxproj", "{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Debug|Win32.ActiveCfg = Debug|Win32
{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Debug|Win32.Build.0 = Debug|Win32
{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Release|Win32.ActiveCfg = Release|Win32
{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+82
View File
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="runnerw.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="runnerw.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="runnerw.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="runnerw.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
@@ -17,9 +17,10 @@
package com.intellij.idea;
import com.intellij.ide.Bootstrap;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.Restarter;
import org.jetbrains.annotations.NonNls;
@@ -27,11 +28,7 @@ import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -39,37 +36,11 @@ import java.util.List;
public class Main {
private static boolean isHeadless;
private Main() { }
private Main() {
}
@SuppressWarnings("MethodNamesDifferingOnlyByCase")
public static void main(final String[] args) {
final int[] restartCode = {Restarter.getRestartCode()};
Runnable restart = new Runnable() {
@Override
public void run() {
if (restartCode[0] == 0) {
try {
if (Restarter.restart()) restartCode[0] = 1;
}
catch (Throwable ignore) {
}
}
}
};
if (installPatch(restart)) {
if (restartCode[0] == 0) {
try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable ignore) { }
String msg = "Patch has been applied successfully, please restart application.";
JOptionPane.showMessageDialog(null, msg, "Update", JOptionPane.INFORMATION_MESSAGE);
}
System.exit(restartCode[0]);
return;
}
isHeadless = isHeadless(args);
if (isHeadless) {
System.setProperty("java.awt.headless", Boolean.TRUE.toString());
@@ -78,6 +49,40 @@ public class Main {
throw new HeadlessException("Unable to detect graphics environment");
}
if (!isHeadless) {
try {
installPatch();
}
catch (IOException e) {
e.printStackTrace();
File log = null;
try {
log = FileUtilRt.createTempFile("patch", ".log", false);
PrintWriter writer = new PrintWriter(log);
try {
e.printStackTrace(writer);
}
finally {
writer.close();
}
}
catch (IOException ignore) {
ignore.printStackTrace();
}
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Throwable ignore) {
}
String message = e.getMessage()
+ "\n" + (log == null ? "Log cannot be saved" : "Log is saved in " + log)
+ "\n\nPlease download and install update manually" ;
JOptionPane.showMessageDialog(null, message, "Cannot Apply Patch", JOptionPane.ERROR_MESSAGE);
}
}
Bootstrap.main(args, Main.class.getName() + "Impl", "start");
}
@@ -112,100 +117,34 @@ public class Main {
return isHeadless;
}
private static boolean installPatch(Runnable restart) {
try {
File ideaHomeDir = getIdeaHomeDir();
if (ideaHomeDir == null) return false;
private static void installPatch() throws IOException {
String platform = System.getProperty("idea.platform.prefix", "idea");
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
File originalPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName);
File copyPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName + "_copy");
String platform = System.getProperty("idea.platform.prefix", "idea");
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
File patchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName);
// always delete previous patch copy
if (!FileUtilRt.delete(copyPatchFile)) throw new IOException("Cannot create temporary patch file");
if (!patchFile.exists()) return false;
if (!originalPatchFile.exists()) return;
try {
List<String> args = new ArrayList<String>();
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
File launcherFile = new File(ideaHomeDir, "bin/vistalauncher.exe");
File launcherCopy = FileUtil.createTempFile("vistalauncher", ".exe");
launcherCopy.deleteOnExit();
FileUtil.copy(launcherFile, launcherCopy);
args.add(launcherCopy.getPath());
}
restart.run();
Collections.addAll(args,
System.getProperty("java.home") + "/bin/java",
"-classpath",
patchFile.getPath(),
"com.intellij.updater.Runner",
"install",
ideaHomeDir.getPath());
Process process = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out));
Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err));
outThread.start();
errThread.start();
try {
process.waitFor();
}
finally {
outThread.join();
errThread.join();
}
return true;
}
finally {
patchFile.delete();
}
}
catch (Exception e) {
e.printStackTrace();
}
return false;
}
private static class StreamRedirector implements Runnable {
private final InputStream myIn;
private final OutputStream myOut;
private StreamRedirector(InputStream in, OutputStream out) {
myIn = in;
myOut = out;
if (!originalPatchFile.renameTo(copyPatchFile) || !FileUtilRt.delete(originalPatchFile)) {
throw new IOException("Cannot create temporary patch file");
}
public void run() {
try {
StreamUtil.copyStreamContent(myIn, myOut);
}
catch (IOException e) {
e.printStackTrace();
}
List<String> args = new ArrayList<String>();
if (SystemInfo.isWindows) {
args.add(Restarter.createTempExecutable(new File(PathManager.getBinPath(), "vistalauncher.exe")).getPath());
}
}
private static File getIdeaHomeDir() throws IOException {
URL url = Bootstrap.class.getResource("");
if (url == null || !"jar".equals(url.getProtocol())) return null;
Collections.addAll(args,
System.getProperty("java.home") + "/bin/java",
"-classpath",
copyPatchFile.getPath(),
"com.intellij.updater.Runner",
"install",
PathManager.getHomePath());
String path = url.getPath();
int start = path.indexOf("file:/");
int end = path.indexOf("!/");
if (start == -1 || end == -1) return null;
String jarFileUrl = path.substring(start, end);
try {
File bootstrapJar = new File(new URI(jarFileUrl));
return bootstrapJar.getParentFile().getParentFile();
}
catch (URISyntaxException e) {
return null;
}
System.exit(Restarter.scheduleRestart(args.toArray(new String[args.size()])));
}
}
@@ -110,10 +110,6 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey>, J
*/
public TextAttributes getDefaultAttributes() {
if (myDefaultAttributes == NULL_ATTRIBUTES) {
if (myFallbackAttributeKey != null) {
TextAttributes fallbackAttributes = myFallbackAttributeKey.getDefaultAttributes();
if (fallbackAttributes != null && !fallbackAttributes.isEmpty()) return fallbackAttributes;
}
// E.g. if one text key reuse default attributes of some other predefined key
myDefaultAttributes = null;
final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue();
@@ -166,34 +162,6 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey>, J
return key;
}
/**
* Similar to <code>createTextAttributesKey(externalName, fallbackAttributeKey)</code> but allows to specify attributes which will be used
* in default scheme as well as in a scheme created as a copy of default scheme. If specified, shadows a fallback attribute: a scheme
* designer may need to clear the attributes to restore dependency on the fallback key. It is strongly recommended to use this method
* only if absolutely necessary to define specific highlighting attributes which can not be referenced by any of the keys in
* <code>DefaultLanguageHighlighterColors</code>.
* <p>
* If a scheme doesn't have the specified key if, for example, it was designed without an installed language plug-in, a fallback key
* will be used instead of default text attributes specified here.
* </p>
*
* @param externalName The unique identifier of the key.
* @param fallbackAttributeKey The fallback key to use if text attributes for this key are not defined.
* @param defaultAttributes The default text attributes associated with the key.
* @return
*/
@NotNull
public static TextAttributesKey createTextAttributesKey(@NonNls @NotNull String externalName,
TextAttributesKey fallbackAttributeKey,
TextAttributes defaultAttributes) {
TextAttributesKey key = find(externalName);
key.setFallbackAttributeKey(fallbackAttributeKey);
if (key.myDefaultAttributes == null || key.myDefaultAttributes == NULL_ATTRIBUTES) {
key.myDefaultAttributes = defaultAttributes;
}
return key;
}
public TextAttributesKey getFallbackAttributeKey() {
return myFallbackAttributeKey;
}
@@ -32,6 +32,8 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
public static final TextAttributes ERASE_MARKER = new TextAttributes();
private boolean myEnforcedDefaults = false;
/**
* Merges (layers) the two given text attributes.
*
@@ -175,6 +177,10 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
return getForegroundColor() == null && getBackgroundColor() == null && getEffectColor() == null && getFontType() == Font.PLAIN;
}
public boolean isFallbackEnabled() {
return isEmpty() && !myEnforcedDefaults;
}
public void reset() {
setForegroundColor(null);
setBackgroundColor(null);
@@ -251,6 +257,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
public TextAttributes clone() {
TextAttributes cloned = new TextAttributes();
cloned.myAttrs = myAttrs;
cloned.myEnforcedDefaults = myEnforcedDefaults;
return cloned;
}
@@ -276,6 +283,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
ext.EFFECT_COLOR,
ext.getEffectType(),
ext.ERROR_STRIPE_COLOR);
if (isEmpty()) myEnforcedDefaults = true;
}
@Override
@@ -37,7 +37,7 @@ public class ElementManipulators extends ClassExtension<ElementManipulator> {
}
public static <T extends PsiElement> ElementManipulator<T> getManipulator(@NotNull T element) {
return ElementManipulators.INSTANCE.forClass(element.getClass());
return INSTANCE.forClass(element.getClass());
}
public static int getOffsetInElement(final PsiElement element) {
@@ -48,8 +48,7 @@ public class ElementManipulators extends ClassExtension<ElementManipulator> {
public static TextRange getValueTextRange(final PsiElement element) {
final ElementManipulator<PsiElement> manipulator = getManipulator(element);
assert manipulator != null: element.getClass().getName();
return manipulator.getRangeInElement(element);
return manipulator == null ? TextRange.from(0, element.getTextLength()) : manipulator.getRangeInElement(element);
}
public static String getValueText(final PsiElement element) {
@@ -23,10 +23,10 @@ import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.NonCancelableSection;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiInvalidElementAccessException;
@@ -71,38 +71,34 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
if (node == null) {
ApplicationManager.getApplication().assertReadAccessAllowed();
PsiFileImpl file = (PsiFileImpl)getContainingFile();
synchronized (file.getStubLock()) {
node = myNode;
if (node == null) {
NonCancelableSection criticalSection = ProgressIndicatorProvider.startNonCancelableSectionIfSupported();
try {
if (!file.isValid()) throw new PsiInvalidElementAccessException(this);
FileElement treeElement = file.getTreeElement();
StubTree stubTree = file.getStubTree();
if (treeElement != null) {
return notBoundInExistingAst(file, treeElement, stubTree);
}
final FileElement fileElement = file.calcTreeElement();
node = myNode;
if (node == null) {
@NonNls String message = "Failed to bind stub to AST for element " + getClass() + " in " +
(file.getVirtualFile() == null ? "<unknown file>" : file.getVirtualFile().getPath()) +
"\nFile stub tree:\n" +
(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
"\nLoaded file AST:\n" + StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
throw new IllegalArgumentException(message);
}
}
finally {
criticalSection.done();
}
}
if (!file.isValid()) throw new PsiInvalidElementAccessException(this);
FileElement treeElement = file.getTreeElement();
StubTree stubTree = file.getStubTree();
if (treeElement != null && myNode == null) {
return notBoundInExistingAst(file, treeElement, stubTree);
}
final FileElement fileElement = file.calcTreeElement();
node = myNode;
if (node == null) {
return failedToBindStubToAst(file, stubTree, fileElement);
}
}
return node;
}
private ASTNode failedToBindStubToAst(PsiFileImpl file, StubTree stubTree, FileElement fileElement) {
VirtualFile vFile = file.getVirtualFile();
@NonNls String message = "Failed to bind stub to AST for element " + getClass() + " in " +
(vFile == null ? "<unknown file>" : vFile.getPath()) +
"\nFile stub tree:\n" +
(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
"\nLoaded file AST:\n" + StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
throw new IllegalArgumentException(message);
}
private ASTNode notBoundInExistingAst(PsiFileImpl file, FileElement treeElement, StubTree stubTree) {
@NonNls String message = "this=" + this.getClass() + "; file.isPhysical=" + file.isPhysical() + "; node=" + myNode + "; file=" + file +
"; tree=" + treeElement + "; stubTree=" + stubTree;
@@ -119,7 +115,7 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
throw new AssertionError(message);
}
public void setNode(final ASTNode node) {
public final void setNode(final ASTNode node) {
myNode = node;
}
@@ -241,7 +237,7 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
return myStub;
}
public void setStub(@Nullable T stub) {
public final void setStub(@Nullable T stub) {
myStub = stub;
}
@@ -30,6 +30,8 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.progress.NonCancelableSection;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Key;
@@ -79,7 +81,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
protected PsiFile myOriginalFile = null;
private final FileViewProvider myViewProvider;
private static final Key<Document> HARD_REFERENCE_TO_DOCUMENT = new Key<Document>("HARD_REFERENCE_TO_DOCUMENT");
private final Object myStubLock = new Object();
private volatile SoftReference<StubTree> myStub;
protected final PsiManagerEx myManager;
private volatile Object myTreeElementPointer; // SoftReference/WeakReference to ASTNode or a strong reference to a tree if the file is a DummyHolder
@@ -124,12 +125,12 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement node = derefTreeElement();
if (node != null) return node;
synchronized (myStubLock) {
node = derefTreeElement();
if (node == null && !getViewProvider().isPhysical()) {
return loadTreeElementUnderLock();
}
return node;
if (!getViewProvider().isPhysical()) {
return loadTreeElement();
}
synchronized (PsiLock.LOCK) {
return derefTreeElement();
}
}
@@ -142,7 +143,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement treeElement = (FileElement)((Reference)pointer).get();
if (treeElement != null) return treeElement;
synchronized (myStubLock) {
synchronized (PsiLock.LOCK) {
if (myTreeElementPointer == pointer) {
myTreeElementPointer = null;
}
@@ -186,11 +187,8 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
return derefTreeElement() != null;
}
private FileElement loadTreeElementUnderLock() {
FileElement treeElement = derefTreeElement();
if (treeElement != null) {
return treeElement;
}
private FileElement loadTreeElement() {
ApplicationManager.getApplication().assertReadAccessAllowed();
final FileViewProvider viewProvider = getViewProvider();
if (viewProvider.isPhysical() && myManager.isAssertOnFileLoading(viewProvider.getVirtualFile())) {
@@ -198,34 +196,39 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
}
final Document document = viewProvider.isEventSystemEnabled() ? viewProvider.getDocument() : null;
treeElement = createFileElement(viewProvider.getContents());
FileElement treeElement = createFileElement(viewProvider.getContents());
if (document != null) {
treeElement.putUserData(HARD_REFERENCE_TO_DOCUMENT, document);
}
treeElement.setPsi(this);
StubTree stub = derefStub();
if (stub != null) {
ApplicationManager.getApplication().assertReadAccessAllowed();
final Iterator<StubElement<?>> stubs = stub.getPlainList().iterator();
stubs.next(); // Skip file stub;
synchronized (PsiLock.LOCK) {
switchFromStubToAST(treeElement, stubs);
synchronized (PsiLock.LOCK) {
FileElement existing = derefTreeElement();
if (existing != null) {
return existing;
}
myStub = null;
}
myTreeElementPointer = createTreeElementPointer(treeElement);
NonCancelableSection section = ProgressIndicatorProvider.startNonCancelableSectionIfSupported();
try {
switchFromStubToAST(treeElement);
if (LOG.isDebugEnabled() && getViewProvider().isPhysical()) {
LOG.debug("Loaded text for file " + getViewProvider().getVirtualFile().getPresentableUrl());
}
myStub = null;
myTreeElementPointer = createTreeElementPointer(treeElement);
if (document != null && isPhysical()) {
TextBlock.get(this).clear();
if (document != null && isPhysical()) {
TextBlock.get(this).clear();
}
if (LOG.isDebugEnabled() && viewProvider.isPhysical()) {
LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl());
}
return treeElement;
}
finally {
section.done();
}
}
return treeElement;
}
@Override
@@ -255,13 +258,20 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
return null;
}
private void switchFromStubToAST(final ASTNode root, final Iterator<StubElement<?>> stubs) {
private void switchFromStubToAST(final ASTNode root) {
StubTree stubTree = derefStub();
if (stubTree == null) {
return;
}
final Iterator<StubElement<?>> stubs = stubTree.getPlainList().iterator();
stubs.next(); // Skip file stub;
final IElementType contentElementType = getContentElementType();
if (!(contentElementType instanceof IStubFileElementType)) {
final VirtualFile vFile = getVirtualFile();
throw new AssertionError("A stub in a non-stub file '" + vFile +"'; isValid()=" + (vFile != null? vFile.isValid() : "null") +
" type: "+contentElementType+"; content:<<<\n"+
StringUtil.first(getViewProvider().getContents(),200,true)+
throw new AssertionError("A stub in a non-stub file '" + vFile + "'; isValid()=" + (vFile != null ? vFile.isValid() : "null") +
" type: " + contentElementType + "; content:<<<\n" +
StringUtil.first(getViewProvider().getContents(), 200, true) +
"\n>>>; stubs=" + ContainerUtil.collect(stubs));
}
final StubBuilder builder = ((IStubFileElementType)contentElementType).getBuilder();
@@ -329,7 +339,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
LOG.assertTrue(getTreeElement() != null);
clearCaches();
myViewProvider.beforeContentsSynchronized();
synchronized (myStubLock) {
synchronized (PsiLock.LOCK) {
myTreeElementPointer = null;
clearStub();
}
@@ -393,7 +403,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
tree.clearCaches();
}
synchronized (myStubLock) {
synchronized (PsiLock.LOCK) {
clearStub();
if (tree != null) {
tree.putUserData(STUB_TREE_IN_PARSED_TREE, null);
@@ -672,7 +682,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
"\n>>>; stubs=" + stubHolder.getPlainList());
}
synchronized (myStubLock) {
synchronized (PsiLock.LOCK) {
if (getTreeElement() != null) return null;
final StubTree derefdOnLock = derefStub();
@@ -689,7 +699,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
private StubTree derefStub() {
if (myStub == null) return null;
synchronized (myStubLock) {
synchronized (PsiLock.LOCK) {
return myStub != null ? myStub.get() : null;
}
}
@@ -714,10 +724,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
: new PatchedSoftReference<ASTNode>(treeElement);
}
public Object getStubLock() {
return myStubLock;
}
@Override
public PsiManager getManager() {
return myManager;
@@ -738,9 +744,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement treeElement = getTreeElement();
if (treeElement != null) return treeElement;
synchronized (myStubLock) {
return loadTreeElementUnderLock();
}
return loadTreeElement();
}
@Override
@@ -955,8 +959,8 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
private static final Key<StubTree> STUB_TREE_IN_PARSED_TREE = new Key<StubTree>("STUB_TREE_IN_PARSED_TREE");
public StubTree calcStubTree() {
synchronized (myStubLock) {
final FileElement fileElement = calcTreeElement();
final FileElement fileElement = calcTreeElement();
synchronized (PsiLock.LOCK) {
StubTree tree = fileElement.getUserData(STUB_TREE_IN_PARSED_TREE);
if (tree == null) {
IElementType contentElementType = getContentElementType();
@@ -32,7 +32,7 @@ public class PatchedWeakReference<T> extends WeakReference<T>{
private static final ReferenceQueue ourQueue = new ReferenceQueue();
static {
JobScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
processQueue();
@@ -42,9 +42,6 @@ public class PatchedWeakReference<T> extends WeakReference<T>{
public PatchedWeakReference(T referent) {
super(referent, ourQueue);
if(ourRefsList.size() % 100 == 0) {
int i = 0;
}
synchronized(ourQueue) {
ourRefsList.add(this);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 727 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

@@ -146,6 +146,7 @@ public abstract class InspectionProfileEntry {
}
/**
* This method is called each time UI is shown.
* @return null if no UI options required.
*/
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -209,6 +209,10 @@ public class ProblemsHolder {
return !myProblems.isEmpty();
}
public int getResultCount() {
return myProblems.size();
}
public boolean isOnTheFly() {
return myOnTheFly;
}
@@ -114,7 +114,10 @@ public class ListWrappingTableModel extends AbstractTableModel {
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
list.get(columnIndex).set(rowIndex, String.valueOf(value));
fireTableCellUpdated(rowIndex, columnIndex);
List<String> strings = list.get(columnIndex);
if (rowIndex >= 0 && rowIndex < strings.size()) {
strings.set(rowIndex, String.valueOf(value));
fireTableCellUpdated(rowIndex, columnIndex);
}
}
}
@@ -16,48 +16,48 @@
package com.intellij.openapi.editor;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
/**
* Base highlighter colors for multiple languages.
*
* @author Rustam Vishnyakov
*/
@SuppressWarnings("deprecation") // SyntaxHighlighterColors is used for compatibility with old schemes
public class DefaultLanguageHighlighterColors {
public final static TextAttributesKey TEMPLATE_LANGUAGE_COLOR =
TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR");
TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR", HighlighterColors.TEXT);
public final static TextAttributesKey IDENTIFIER =
TextAttributesKey.createTextAttributesKey("DEFAULT_IDENTIFIER", HighlighterColors.TEXT);
public final static TextAttributesKey NUMBER =
TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER", SyntaxHighlighterColors.NUMBER.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER");
public final static TextAttributesKey KEYWORD =
TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD", SyntaxHighlighterColors.KEYWORD.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD");
public final static TextAttributesKey STRING =
TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", SyntaxHighlighterColors.STRING.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", HighlighterColors.TEXT);
public final static TextAttributesKey BLOCk_COMMENT =
TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT", SyntaxHighlighterColors.JAVA_BLOCK_COMMENT.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT");
public final static TextAttributesKey LINE_COMMENT =
TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT", SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT");
public final static TextAttributesKey DOC_COMMENT =
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT", SyntaxHighlighterColors.DOC_COMMENT.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT");
public final static TextAttributesKey OPERATION_SIGN =
TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN", SyntaxHighlighterColors.OPERATION_SIGN.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN");
public final static TextAttributesKey BRACES =
TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES", SyntaxHighlighterColors.BRACES.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES");
public final static TextAttributesKey DOT =
TextAttributesKey.createTextAttributesKey("DEFAULT_DOT", SyntaxHighlighterColors.DOT.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_DOT");
public final static TextAttributesKey SEMICOLON =
TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON", SyntaxHighlighterColors.JAVA_SEMICOLON.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON");
public final static TextAttributesKey COMMA =
TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA", SyntaxHighlighterColors.COMMA.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA");
public final static TextAttributesKey PARENTHESES =
TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS", SyntaxHighlighterColors.PARENTHS.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS");
public final static TextAttributesKey BRACKETS =
TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS", SyntaxHighlighterColors.BRACKETS.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS");
public final static TextAttributesKey LABEL =
TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL");
TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL", IDENTIFIER);
public final static TextAttributesKey CONSTANT =
TextAttributesKey.createTextAttributesKey("DEFAULT_CONSTANT", IDENTIFIER);
public final static TextAttributesKey LOCAL_VARIABLE =
@@ -87,15 +87,15 @@ public class DefaultLanguageHighlighterColors {
TextAttributesKey.createTextAttributesKey("DEFAULT_STATIC_FIELD", IDENTIFIER);
public final static TextAttributesKey DOC_COMMENT_MARKUP =
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP", SyntaxHighlighterColors.DOC_COMMENT_MARKUP.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP");
public final static TextAttributesKey DOC_COMMENT_TAG =
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG", SyntaxHighlighterColors.DOC_COMMENT_TAG.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG");
public final static TextAttributesKey DOC_COMMENT_TAG_VALUE =
TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG_VALUE");
public final static TextAttributesKey VALID_STRING_ESCAPE =
TextAttributesKey
.createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE", SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE");
public final static TextAttributesKey INVALID_STRING_ESCAPE =
TextAttributesKey
.createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE", SyntaxHighlighterColors.INVALID_STRING_ESCAPE.getDefaultAttributes());
TextAttributesKey.createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE");
public final static TextAttributesKey PREDEFINED_SYMBOL =
TextAttributesKey.createTextAttributesKey("DEFAULT_PREDEFINED_SYMBOL", IDENTIFIER);
@@ -815,7 +815,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
@Override
public boolean isInherited() {
return myFallbackAttributes != null && getTextAttributes().isEmpty();
return myFallbackAttributes != null && getTextAttributes().isFallbackEnabled();
}
@Nullable
@@ -598,24 +598,20 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
@Nullable
public HighlightInfo findHighlightByOffset(@NotNull Document document, final int offset, final boolean includeFixRange) {
return findHighlightByOffset(document, offset, includeFixRange, true);
return findHighlightByOffset(document, offset, includeFixRange, HighlightSeverity.INFORMATION);
}
@Nullable
public HighlightInfo findHighlightByOffset(@NotNull Document document,
final int offset,
final boolean includeFixRange,
final boolean includeAllButInformation) {
@NotNull HighlightSeverity minSeverity) {
final List<HighlightInfo> foundInfoList = new SmartList<HighlightInfo>();
processHighlightsNearOffset(document, myProject, HighlightSeverity.INFORMATION, offset, includeFixRange,
processHighlightsNearOffset(document, myProject, minSeverity, offset, includeFixRange,
new Processor<HighlightInfo>() {
@Override
public boolean process(@NotNull HighlightInfo info) {
if (includeAllButInformation) {
if (HighlightSeverity.INFORMATION.compareTo(info.getSeverity()) >= 0) {
return true;
}
} else if (!foundInfoList.isEmpty()) {
if (!foundInfoList.isEmpty()) {
HighlightInfo foundInfo = foundInfoList.get(0);
int compare = foundInfo.getSeverity().compareTo(info.getSeverity());
if (compare < 0) {
@@ -17,6 +17,7 @@
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
@@ -94,7 +95,7 @@ public class StatusBarUpdater implements Disposable {
int offset = editor.getCaretModel().getOffset();
DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false, false);
HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false, HighlightSeverity.WARNING);
String text = info != null && info.description != null ? info.description : "";
StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.problems.WolfTheProblemSolver;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
@@ -36,6 +37,7 @@ class WolfHighlightingPass extends ProgressableTextEditorHighlightingPass implem
@Override
protected void collectInformationWithProgress(final ProgressIndicator progress) {
if (!Registry.is("wolf.the.problem.solver", true)) return;
final WolfTheProblemSolver solver = WolfTheProblemSolver.getInstance(myProject);
if (solver instanceof WolfTheProblemSolverImpl) {
((WolfTheProblemSolverImpl)solver).startCheckingIfVincentSolvedProblemsYet(progress, this);
@@ -20,12 +20,15 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.lang.parameterInfo.*;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.event.*;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiDocumentManager;
@@ -178,32 +181,8 @@ public class ParameterInfoController {
myEditorCaretListener = new CaretListener(){
@Override
public void caretPositionChanged(CaretEvent e) {
if (!myHandler.tracksParameterIndex()) {
myAlarm.cancelAllRequests();
addAlarmRequest();
return;
}
int oldOffset = e.getEditor().logicalPositionToOffset(e.getOldPosition());
int newOffset = e.getEditor().logicalPositionToOffset(e.getNewPosition());
if (newOffset <= myLbraceMarker.getStartOffset()){
myAlarm.cancelAllRequests();
addAlarmRequest();
return;
}
int offset1 = Math.min(oldOffset, newOffset);
int offset2 = Math.max(oldOffset, newOffset);
CharSequence chars = e.getEditor().getDocument().getCharsSequence();
int offset = CharArrayUtil.shiftForwardUntil(chars, offset1, myParameterCloseChars);
if (offset < offset2){
myAlarm.cancelAllRequests();
addAlarmRequest();
}
else{
if (myAlarm.cancelAllRequests() > 0){
addAlarmRequest();
}
}
myAlarm.cancelAllRequests();
addAlarmRequest();
}
};
myEditor.getCaretModel().addCaretListener(myEditorCaretListener);
@@ -211,27 +190,8 @@ public class ParameterInfoController {
myEditorDocumentListener = new DocumentAdapter(){
@Override
public void documentChanged(DocumentEvent e) {
if (!myHandler.tracksParameterIndex()) {
myAlarm.cancelAllRequests();
addAlarmRequest();
return;
}
CharSequence oldS = e.getOldFragment();
if (CharArrayUtil.shiftForwardUntil(oldS, 0, myParameterCloseChars) < oldS.length()){
myAlarm.cancelAllRequests();
addAlarmRequest();
return;
}
CharSequence newS = e.getNewFragment();
if (CharArrayUtil.shiftForwardUntil(newS, 0, myParameterCloseChars) < newS.length()){
myAlarm.cancelAllRequests();
addAlarmRequest();
return;
}
if (myAlarm.cancelAllRequests() > 0){
addAlarmRequest();
}
myAlarm.cancelAllRequests();
addAlarmRequest();
}
};
myEditor.getDocument().addDocumentListener(myEditorDocumentListener);
@@ -250,6 +210,14 @@ public class ParameterInfoController {
LookupManager.getInstance(project).addPropertyChangeListener(myLookupListener);
updateComponent();
if (myEditor instanceof EditorImpl) {
Disposer.register(((EditorImpl)myEditor).getDisposable(), new Disposable() {
@Override
public void dispose() {
ParameterInfoController.this.dispose();
}
});
}
}
private void dispose(){
@@ -17,19 +17,22 @@
package com.intellij.codeInsight.intention;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
/**
* User: anna
* Date: May 11, 2005
*/
public final class EmptyIntentionAction implements IntentionAction, LowPriorityAction{
public final class EmptyIntentionAction implements IntentionAction, LowPriorityAction, Iconable {
private final String myName;
public EmptyIntentionAction(@NotNull String name) {
@@ -80,4 +83,9 @@ public final class EmptyIntentionAction implements IntentionAction, LowPriorityA
public EmptyIntentionAction(@NotNull final String name, @NotNull List<IntentionAction> options) {
myName = name;
}
@Override
public Icon getIcon(@IconFlags int flags) {
return AllIcons.Actions.RealIntentionBulb;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -124,23 +124,22 @@ public class LookupCellRenderer implements ListCellRenderer {
myIsSelected = isSelected;
final LookupElement item = (LookupElement)value;
final boolean dark = UIUtil.isUnderDarcula();
final Color foreground = getForegroundColor(isSelected);
final Color background = isSelected ? SELECTED_BACKGROUND_COLOR : dark ? BACKGROUND_COLOR_DARK_VARIANT : BACKGROUND_COLOR;
final Color background = isSelected ? SELECTED_BACKGROUND_COLOR : new JBColor(BACKGROUND_COLOR, BACKGROUND_COLOR_DARK_VARIANT);
int allowedWidth = list.getWidth() - AFTER_TAIL - AFTER_TYPE - getIconIndent();
final LookupElementPresentation presentation = new RealLookupElementPresentation(isSelected ? getMaxWidth() : allowedWidth, myNormalMetrics, myBoldMetrics, myLookup);
if (item.isValid()) {
item.renderElement(presentation);
} else {
presentation.setItemTextForeground(Color.RED);
presentation.setItemTextForeground(JBColor.RED);
presentation.setItemText("Invalid");
}
myNameComponent.clear();
myNameComponent.setIcon(augmentIcon(presentation.getIcon(), myEmptyIcon));
myNameComponent.setBackground(background);
allowedWidth -= setItemTextLabel(item, dark ? foreground : isSelected ? SELECTED_FOREGROUND_COLOR : presentation.getItemTextForeground(), isSelected, presentation, allowedWidth);
allowedWidth -= setItemTextLabel(item, new JBColor(isSelected ? SELECTED_FOREGROUND_COLOR : presentation.getItemTextForeground(), foreground), isSelected, presentation, allowedWidth);
myTypeLabel.clear();
if (allowedWidth > 0) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -35,10 +35,15 @@ import com.intellij.openapi.command.undo.DocumentReferenceManager;
import com.intellij.openapi.command.undo.UndoManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.editor.markup.HighlighterLayer;
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -59,9 +64,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.*;
import java.util.List;
public class TemplateState implements Disposable {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.template.impl.TemplateState");
@@ -969,7 +972,8 @@ public class TemplateState implements Disposable {
}
private RangeHighlighter getSegmentHighlighter(int segmentNumber, boolean isSelected, boolean isEnd) {
TextAttributes attributes = isSelected ? new TextAttributes(null, null, Color.red, EffectType.BOXED, Font.PLAIN) : new TextAttributes();
final TextAttributes lvAttr = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.LIVE_TEMPLATE_ATTRIBUTES);
TextAttributes attributes = isSelected ? lvAttr : new TextAttributes();
TextAttributes endAttributes = new TextAttributes();
int start = mySegments.getSegmentStart(segmentNumber);
@@ -1072,6 +1072,11 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
myMinimizedButtonsPlaceholder.clear();
myCommonActionsPlaceholder.clear();
myContextActions.clear();
myOriginal = null;
myTopActions = null;
myAdditonalFocusActions = null;
myLeftToolbarActions = null;
}
public void restoreLayout() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -279,7 +279,7 @@ public class CommanderPanel extends JPanel {
myParentTitle = new MyTitleLabel(myTitlePanel);
myParentTitle.setText(" ");
myParentTitle.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
myParentTitle.setForeground(Color.black);
myParentTitle.setForeground(JBColor.foreground);
myParentTitle.setUI(new RightAlignedLabelUI());
final JPanel panel1 = new JPanel(new BorderLayout());
panel1.setOpaque(false);
@@ -392,7 +392,7 @@ public class CommanderPanel extends JPanel {
LOG.assertTrue(color != null);
myTitlePanel.setBackground(color);
myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, color.brighter(), color.darker()));
myParentTitle.setForeground(Color.black);
myParentTitle.setForeground(JBColor.foreground);
}
final int[] selectedIndices = myList.getSelectedIndices();
if (selectedIndices.length == 0 && myList.getModel().getSize() > 0) {
@@ -22,6 +22,7 @@ import com.intellij.ide.structureView.impl.StructureViewFactoryImpl;
import com.intellij.ide.structureView.impl.StructureViewState;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.ui.customization.CustomizationUtil;
import com.intellij.ide.util.FileStructurePopup;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.ide.util.treeView.NodeDescriptorProvidingKey;
@@ -52,6 +53,7 @@ import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import com.intellij.util.EditSourceOnDoubleClickHandler;
import com.intellij.util.OpenSourceUtil;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.tree.TreeUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
@@ -182,7 +184,17 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
myAutoScrollFromSourceHandler.install();
TreeUtil.installActions(getTree());
new TreeSpeedSearch(getTree());
new TreeSpeedSearch(getTree(), new Convertor<TreePath, String>() {
public String convert(final TreePath treePath) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
final Object userObject = node.getUserObject();
if (userObject != null) {
return FileStructurePopup.getSpeedSearchText(userObject);
}
return null;
}
});
addTreeKeyListener();
addTreeMouseListeners();
@@ -626,7 +638,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
return myAbstractTreeBuilder.getTreeStructure();
}
public JTree getTree() {
public Tree getTree() {
return myTree;
}
@@ -29,6 +29,7 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.NodeRenderer;
import com.intellij.ide.util.treeView.smartTree.*;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.LocationPresentation;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.MnemonicHelper;
import com.intellij.openapi.actionSystem.*;
@@ -771,27 +772,38 @@ public class FileStructurePopup implements Disposable {
}
@Nullable
private static String getText(final Object node) {
String text = String.valueOf(node);
public static String getSpeedSearchText(final Object userObject) {
String text = String.valueOf(userObject);
if (text != null) {
if (node instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)node).getValue();
if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue();
if (value instanceof PsiTreeElementBase && ((PsiTreeElementBase)value).isSearchInLocationString()) {
final String string = ((PsiTreeElementBase)value).getLocationString();
if (!StringUtil.isEmpty(string)) {
return text + " (" + string + ")";
final String locationString = ((PsiTreeElementBase)value).getLocationString();
if (!StringUtil.isEmpty(locationString)) {
String locationPrefix = null;
String locationSuffix = null;
if (value instanceof LocationPresentation) {
locationPrefix = ((LocationPresentation)value).getLocationPrefix();
locationSuffix = ((LocationPresentation)value).getLocationSuffix();
}
return text +
StringUtil.notNullize(locationPrefix, LocationPresentation.DEFAULT_LOCATION_PREFIX) +
locationString +
StringUtil.notNullize(locationSuffix, LocationPresentation.DEFAULT_LOCATION_SUFFIX);
}
}
}
return text;
}
if (node instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Nullable
@Override
public String compute() {
final ItemPresentation presentation = ((StructureViewComponent.StructureViewTreeElementWrapper)node).getValue().getPresentation();
final ItemPresentation presentation =
((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue().getPresentation();
return presentation.getPresentableText();
}
});
@@ -819,7 +831,7 @@ public class FileStructurePopup implements Disposable {
return true;
}
final String text = getText(value);
final String text = getSpeedSearchText(value);
if (text == null) return false;
if (matches(text)) {
@@ -863,7 +875,7 @@ public class FileStructurePopup implements Disposable {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
final Object userObject = node.getUserObject();
if (userObject instanceof FilteringTreeStructure.FilteringNode) {
return getText(((FilteringTreeStructure.FilteringNode)userObject).getDelegate());
return getSpeedSearchText(((FilteringTreeStructure.FilteringNode)userObject).getDelegate());
}
return "";
}
@@ -65,8 +65,8 @@ public class GithubTagListProvider {
public void run() {
final String[] urls = formatTagListDownloadUrls();
String firstErrorMessage = null;
String errorMessage = null;
for (String url : urls) {
String errorMessage;
try {
final ImmutableSet<GithubTagInfo> tags = fetchGithubTagsByUrl(url);
LOG.info(getGeneratorName() + "Cache has been successfully updated");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -80,6 +80,7 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptior.identifier.under.caret.write"), EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.text.search.result"), EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.live.template"), EditorColors.LIVE_TEMPLATE_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.template.variable"), TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.injected.language.fragment"), EditorColors.INJECTED_LANGUAGE_FRAGMENT),
@@ -316,11 +316,7 @@ public class RegistryUi implements Disposable {
LaterInvocator.invokeLater(new Runnable() {
@Override
public void run() {
if (app.isRestartCapable()) {
app.restart();
} else {
app.exit(true);
}
app.restart(true);
}
}, ModalityState.NON_MODAL);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -765,7 +765,7 @@ public class DependenciesPanel extends JPanel implements Disposable, DataProvide
}
});
final JEditorPane pane = new JEditorPane(UIUtil.HTML_MIME, "<html>" + buf.toString()+ "</html>");
pane.setForeground(Color.black);
pane.setForeground(JBColor.foreground);
pane.setBackground(HintUtil.INFORMATION_COLOR);
pane.setOpaque(true);
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(pane);
@@ -1119,7 +1119,7 @@ public class SingleInspectionProfilePanel extends JPanel {
private class MyFilterComponent extends FilterComponent {
private MyFilterComponent() {
super(INSPECTION_FILTER_HISTORY, 10);
setHistory(Arrays.asList("\"New in 11\""));
setHistory(Arrays.asList("\"New in 12\""));
}
public void filter() {
@@ -201,7 +201,6 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar, ModificationT
VirtualFileWindowImpl virtualFile = new VirtualFileWindowImpl(myHostVirtualFile, documentWindow, myLanguage, outChars);
Language forcedLanguage = myContextElement.getUserData(InjectedFileViewProvider.LANGUAGE_FOR_INJECTED_COPY_KEY);
myLanguage = forcedLanguage == null ? LanguageSubstitutors.INSTANCE.substituteLanguage(myLanguage, virtualFile, myProject) : forcedLanguage;
virtualFile.setLanguage(myLanguage);
DocumentImpl decodedDocument;
if (StringUtil.indexOf(outChars, '\r') == -1) {
@@ -96,18 +96,20 @@ public abstract class BaseRefactoringAction extends AnAction {
return;
}
final LookupEx lookup = LookupManager.getActiveLookup(editor);
if (lookup instanceof LookupImpl) {
Runnable command = new Runnable() {
@Override
public void run() {
((LookupImpl)lookup).finishLookup(Lookup.NORMAL_SELECT_CHAR);
}
};
assert editor != null;
Document doc = editor.getDocument();
DocCommandGroupId group = DocCommandGroupId.noneGroupId(doc);
CommandProcessor.getInstance().executeCommand(editor.getProject(), command, "Completion", group, UndoConfirmationPolicy.DEFAULT, doc);
if (InplaceRefactoring.getActiveInplaceRenamer(editor) == null) {
final LookupEx lookup = LookupManager.getActiveLookup(editor);
if (lookup instanceof LookupImpl) {
Runnable command = new Runnable() {
@Override
public void run() {
((LookupImpl)lookup).finishLookup(Lookup.NORMAL_SELECT_CHAR);
}
};
assert editor != null;
Document doc = editor.getDocument();
DocCommandGroupId group = DocCommandGroupId.noneGroupId(doc);
CommandProcessor.getInstance().executeCommand(editor.getProject(), command, "Completion", group, UndoConfirmationPolicy.DEFAULT, doc);
}
}
@@ -42,6 +42,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.refactoring.rename.inplace.InplaceRefactoring;
import com.intellij.ui.DottedBorder;
import com.intellij.util.ui.PositionTracker;
@@ -560,6 +561,11 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
}
}
@Override
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
return super.startsOnTheSameElement(handler, element) || getLocalVariable() == element;
}
public V getLocalVariable() {
if (myLocalVariable != null && myLocalVariable.isValid()) {
return myLocalVariable;
@@ -688,11 +688,15 @@ public abstract class InplaceRefactoring {
}
public static boolean canStartAnotherRefactoring(Editor editor, Project project, RefactoringActionHandler handler, PsiElement... element) {
final InplaceRefactoring inplaceRefactoring = editor != null ? editor.getUserData(INPLACE_RENAMER) : null;
final InplaceRefactoring inplaceRefactoring = getActiveInplaceRenamer(editor);
return StartMarkAction.canStart(project) == null ||
(inplaceRefactoring != null && element.length == 1 && inplaceRefactoring.startsOnTheSameElement(handler, element[0]));
}
public static InplaceRefactoring getActiveInplaceRenamer(Editor editor) {
return editor != null ? editor.getUserData(INPLACE_RENAMER) : null;
}
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
return getVariable() == element;
}
@@ -90,7 +90,7 @@ public class ReplacePromptDialog extends DialogWrapper {
}
JLabel label = new JLabel(getMessage());
label.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10));
label.setForeground(Color.black);
label.setForeground(JBColor.foreground);
panel.add(label, BorderLayout.CENTER);
return panel;
}
+1
View File
@@ -30,6 +30,7 @@
<orderEntry type="module" module-name="projectModel-api" exported="" />
<orderEntry type="library" name="Netty" level="project" />
<orderEntry type="library" name="proxy-vole" level="project" />
<orderEntry type="library" name="miglayout-swing" level="project" />
</component>
</module>
@@ -47,9 +47,11 @@ import java.util.Map;
* as required by the underlying platform.
*/
public class GeneralCommandLine implements UserDataHolder {
public static Key<Boolean> DO_NOT_ESCAPE_QUOTES = Key.create("GeneralCommandLine.do.not.escape.quotes");
/** @deprecated use {@linkplain #inescapableQuote(String)} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration") public static Key<Boolean> DO_NOT_ESCAPE_QUOTES = Key.create("GeneralCommandLine.do.not.escape.quotes");
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.configurations.GeneralCommandLine");
private static final char QUOTE = '\uEFEF';
private String myExePath = null;
private File myWorkDirectory = null;
@@ -236,26 +238,29 @@ public class GeneralCommandLine implements UserDataHolder {
private String[] prepareCommands() {
final List<String> parameters = myProgramParams.getList();
final boolean doNotEscape = Boolean.TRUE.equals(getUserData(DO_NOT_ESCAPE_QUOTES));
final String[] result = new String[parameters.size() + 1];
result[0] = myExePath != null ? prepareCommand(FileUtil.toSystemDependentName(myExePath), doNotEscape) : null;
result[0] = myExePath != null ? prepareCommand(FileUtil.toSystemDependentName(myExePath)) : null;
for (int i = 0; i < parameters.size(); i++) {
result[i + 1] = prepareCommand(parameters.get(i), doNotEscape);
result[i + 1] = prepareCommand(parameters.get(i));
}
return result;
}
// please keep in sync with com.intellij.rt.execution.junit.ProcessBuilder.prepareCommand() (besides doNotEscape option)
private static String prepareCommand(String parameter, final boolean doNotEscape) {
// please keep in sync with com.intellij.rt.execution.junit.ProcessBuilder.prepareCommand()
private static String prepareCommand(String parameter) {
if (SystemInfo.isWindows) {
if (!doNotEscape && parameter.contains("\"")) {
if (parameter.contains("\"")) {
parameter = StringUtil.replace(parameter, "\"", "\\\"");
}
else if (parameter.length() == 0) {
parameter = "\"\"";
}
}
if (parameter.length() >= 2 && parameter.charAt(0) == QUOTE && parameter.charAt(parameter.length() - 1) == QUOTE) {
parameter = '"' + parameter.substring(1, parameter.length() - 1) + '"';
}
return parameter;
}
@@ -277,6 +282,18 @@ public class GeneralCommandLine implements UserDataHolder {
}
}
/**
* Normally, double quotes in parameters are escaped so they arrive to a called program as-is.
* But some commands (e.g. {@code 'cmd /c start "title" ...'}) should get they quotes non-escaped.
* Wrapping a parameter by this method (instead of using quotes) will do exactly this.
*
* @see com.intellij.execution.util.ExecUtil#getTerminalCommand(String, String)
*/
@NotNull
public static String inescapableQuote(@NotNull String parameter) {
return QUOTE + parameter + QUOTE;
}
@Override
public String toString() {
return myExePath + " " + myProgramParams;
@@ -47,10 +47,7 @@ public class ParametersList implements Cloneable {
}
public boolean hasProperty(@NonNls final String name) {
for (@NonNls String parameter : myParameters) {
if (parameter.startsWith("-D" + name + '=')) return true;
}
return false;
return getPropertyValue(name) != null;
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -217,9 +217,10 @@ public class ExecUtil {
}
@NotNull
public static List<String> getTerminalCommand(@Nullable final String title, @NotNull final String command) {
public static List<String> getTerminalCommand(@Nullable String title, @NotNull String command) {
if (SystemInfo.isWindows) {
return Arrays.asList("cmd.exe", "/c", "start", '"' + (title != null ? title : "") + '"', command);
title = title != null ? title.replace("\"", "'") : "";
return Arrays.asList("cmd.exe", "/c", "start", GeneralCommandLine.inescapableQuote(title), command);
}
else if (SystemInfo.isMac) {
return Arrays.asList(getOpenCommandPath(), "-a", "Terminal", command); // todo: title?
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -207,7 +207,7 @@ public class BrowserUtil {
@NonNls
private static List<String> getDefaultBrowserCommand() {
if (SystemInfo.isWindows) {
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"");
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""));
}
else if (SystemInfo.isMac) {
return newSmartList(ExecUtil.getOpenCommandPath());
@@ -221,11 +221,8 @@ public class BrowserUtil {
private static void launchBrowserByCommand(@NotNull final URI uri, @NotNull final List<String> command) {
try {
final GeneralCommandLine commandLine = new GeneralCommandLine(command);
commandLine.addParameter(escapeUrl(uri.toString()));
if (SystemInfo.isWindows) {
commandLine.putUserData(GeneralCommandLine.DO_NOT_ESCAPE_QUOTES, true);
}
GeneralCommandLine commandLine = new GeneralCommandLine(command);
commandLine.addParameter(uri.toString());
commandLine.createProcess();
if (LOG.isDebugEnabled()) {
@@ -237,6 +234,7 @@ public class BrowserUtil {
}
}
/** @deprecated unneeded and misleading (to remove in IDEA 13) */
@NotNull
public static String escapeUrl(@NotNull @NonNls String url) {
return SystemInfo.isWindows ? '"' + url + '"' : url;
@@ -251,7 +249,7 @@ public class BrowserUtil {
return newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
}
else if (SystemInfo.isWindows) {
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"", browserPathOrName);
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""), browserPathOrName);
}
else {
return newSmartList(browserPathOrName);

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