mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 10/30/14 5:39 PM */
|
||||
/* The following code was generated by JFlex 1.4.3 on 11/1/14 12:37 PM */
|
||||
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package org.intellij.lang.regexp;
|
||||
@@ -15,7 +15,7 @@ import java.util.EnumSet;
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
|
||||
* on 10/30/14 5:39 PM from the specification file
|
||||
* on 11/1/14 12:37 PM from the specification file
|
||||
* <tt>/Users/bas/Projects/IntelliJ IDEA Ultimate/tools/lexer/../../community/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex</tt>
|
||||
*/
|
||||
class _RegExLexer implements FlexLexer {
|
||||
@@ -28,6 +28,7 @@ class _RegExLexer implements FlexLexer {
|
||||
public static final int PY_NAMED_GROUP_REF = 22;
|
||||
public static final int QUOTED = 2;
|
||||
public static final int OPTIONS = 14;
|
||||
public static final int BRACKET_EXPRESSION = 26;
|
||||
public static final int PY_COND_REF = 24;
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int NAMED_GROUP = 18;
|
||||
@@ -45,81 +46,81 @@ class _RegExLexer implements FlexLexer {
|
||||
*/
|
||||
private static final int ZZ_LEXSTATE[] = {
|
||||
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
|
||||
8, 8, 9, 9, 10, 10, 11, 11, 12, 12
|
||||
8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED =
|
||||
"\10\0\2\61\1\13\1\0\1\61\1\67\22\0\1\53\1\65\1\0"+
|
||||
"\1\66\1\15\1\0\1\60\1\51\1\4\1\5\1\17\1\20\1\57"+
|
||||
"\1\45\1\3\1\0\1\2\7\44\2\1\1\62\1\0\1\50\1\64"+
|
||||
"\1\63\1\16\1\0\1\24\1\24\1\32\1\31\1\41\1\37\1\25"+
|
||||
"\1\46\1\34\2\52\1\54\1\54\1\54\1\52\1\36\1\40\1\52"+
|
||||
"\1\30\2\52\1\27\1\27\1\27\1\52\1\26\1\10\1\12\1\11"+
|
||||
"\1\14\1\55\1\0\1\23\1\24\1\33\1\31\1\23\1\23\1\52"+
|
||||
"\1\46\1\34\1\52\1\47\2\52\1\22\1\52\1\35\1\52\1\22"+
|
||||
"\1\27\1\22\1\43\1\27\1\27\1\42\1\52\1\25\1\6\1\21"+
|
||||
"\1\7\54\0\1\52\12\0\1\52\4\0\1\52\5\0\27\52\1\0"+
|
||||
"\37\52\1\0\u013f\52\31\0\162\52\4\0\14\52\16\0\5\52\11\0"+
|
||||
"\1\52\213\0\1\52\13\0\1\52\1\0\3\52\1\0\1\52\1\0"+
|
||||
"\24\52\1\0\54\52\1\0\46\52\1\0\5\52\4\0\202\52\10\0"+
|
||||
"\105\52\1\0\46\52\2\0\2\52\6\0\20\52\41\0\46\52\2\0"+
|
||||
"\1\52\7\0\47\52\110\0\33\52\5\0\3\52\56\0\32\52\5\0"+
|
||||
"\13\52\25\0\12\56\4\0\2\52\1\0\143\52\1\0\1\52\17\0"+
|
||||
"\2\52\7\0\2\52\12\56\3\52\2\0\1\52\20\0\1\52\1\0"+
|
||||
"\36\52\35\0\3\52\60\0\46\52\13\0\1\52\u0152\0\66\52\3\0"+
|
||||
"\1\52\22\0\1\52\7\0\12\52\4\0\12\56\25\0\10\52\2\0"+
|
||||
"\2\52\2\0\26\52\1\0\7\52\1\0\1\52\3\0\4\52\3\0"+
|
||||
"\1\52\36\0\2\52\1\0\3\52\4\0\12\56\2\52\23\0\6\52"+
|
||||
"\4\0\2\52\2\0\26\52\1\0\7\52\1\0\2\52\1\0\2\52"+
|
||||
"\1\0\2\52\37\0\4\52\1\0\1\52\7\0\12\56\2\0\3\52"+
|
||||
"\20\0\11\52\1\0\3\52\1\0\26\52\1\0\7\52\1\0\2\52"+
|
||||
"\1\0\5\52\3\0\1\52\22\0\1\52\17\0\2\52\4\0\12\56"+
|
||||
"\25\0\10\52\2\0\2\52\2\0\26\52\1\0\7\52\1\0\2\52"+
|
||||
"\1\0\5\52\3\0\1\52\36\0\2\52\1\0\3\52\4\0\12\56"+
|
||||
"\1\0\1\52\21\0\1\52\1\0\6\52\3\0\3\52\1\0\4\52"+
|
||||
"\3\0\2\52\1\0\1\52\1\0\2\52\3\0\2\52\3\0\3\52"+
|
||||
"\3\0\10\52\1\0\3\52\55\0\11\56\25\0\10\52\1\0\3\52"+
|
||||
"\1\0\27\52\1\0\12\52\1\0\5\52\46\0\2\52\4\0\12\56"+
|
||||
"\25\0\10\52\1\0\3\52\1\0\27\52\1\0\12\52\1\0\5\52"+
|
||||
"\3\0\1\52\40\0\1\52\1\0\2\52\4\0\12\56\25\0\10\52"+
|
||||
"\1\0\3\52\1\0\27\52\1\0\20\52\46\0\2\52\4\0\12\56"+
|
||||
"\25\0\22\52\3\0\30\52\1\0\11\52\1\0\1\52\2\0\7\52"+
|
||||
"\72\0\60\52\1\0\2\52\14\0\7\52\11\0\12\56\47\0\2\52"+
|
||||
"\1\0\1\52\2\0\2\52\1\0\1\52\2\0\1\52\6\0\4\52"+
|
||||
"\1\0\7\52\1\0\3\52\1\0\1\52\1\0\1\52\2\0\2\52"+
|
||||
"\1\0\4\52\1\0\2\52\11\0\1\52\2\0\5\52\1\0\1\52"+
|
||||
"\11\0\12\56\2\0\2\52\42\0\1\52\37\0\12\56\26\0\10\52"+
|
||||
"\1\0\42\52\35\0\4\52\164\0\42\52\1\0\5\52\1\0\2\52"+
|
||||
"\25\0\12\56\6\0\6\52\112\0\46\52\12\0\51\52\7\0\132\52"+
|
||||
"\5\0\104\52\5\0\122\52\6\0\7\52\1\0\77\52\1\0\1\52"+
|
||||
"\1\0\4\52\2\0\7\52\1\0\1\52\1\0\4\52\2\0\47\52"+
|
||||
"\1\0\1\52\1\0\4\52\2\0\37\52\1\0\1\52\1\0\4\52"+
|
||||
"\2\0\7\52\1\0\1\52\1\0\4\52\2\0\7\52\1\0\7\52"+
|
||||
"\1\0\27\52\1\0\37\52\1\0\1\52\1\0\4\52\2\0\7\52"+
|
||||
"\1\0\47\52\1\0\23\52\16\0\11\56\56\0\125\52\14\0\u026c\52"+
|
||||
"\2\0\10\52\12\0\32\52\5\0\113\52\25\0\15\52\1\0\4\52"+
|
||||
"\16\0\22\52\16\0\22\52\16\0\15\52\1\0\3\52\17\0\64\52"+
|
||||
"\43\0\1\52\4\0\1\52\3\0\12\56\46\0\12\56\6\0\130\52"+
|
||||
"\10\0\51\52\127\0\35\52\51\0\12\56\36\52\2\0\5\52\u038b\0"+
|
||||
"\154\52\224\0\234\52\4\0\132\52\6\0\26\52\2\0\6\52\2\0"+
|
||||
"\46\52\2\0\6\52\2\0\10\52\1\0\1\52\1\0\1\52\1\0"+
|
||||
"\1\52\1\0\37\52\2\0\65\52\1\0\7\52\1\0\1\52\3\0"+
|
||||
"\3\52\1\0\7\52\3\0\4\52\2\0\6\52\4\0\15\52\5\0"+
|
||||
"\3\52\1\0\7\52\164\0\1\52\15\0\1\52\202\0\1\52\4\0"+
|
||||
"\1\52\2\0\12\52\1\0\1\52\3\0\5\52\6\0\1\52\1\0"+
|
||||
"\1\52\1\0\1\52\1\0\4\52\1\0\3\52\1\0\7\52\3\0"+
|
||||
"\3\52\5\0\5\52\u0ebb\0\2\52\52\0\5\52\5\0\2\52\4\0"+
|
||||
"\126\52\6\0\3\52\1\0\132\52\1\0\4\52\5\0\50\52\4\0"+
|
||||
"\136\52\21\0\30\52\70\0\20\52\u0200\0\u19b6\52\112\0\u51a6\52\132\0"+
|
||||
"\u048d\52\u0773\0\u2ba4\52\u215c\0\u012e\52\2\0\73\52\225\0\7\52\14\0"+
|
||||
"\5\52\5\0\1\52\1\0\12\52\1\0\15\52\1\0\5\52\1\0"+
|
||||
"\1\52\1\0\2\52\1\0\2\52\1\0\154\52\41\0\u016b\52\22\0"+
|
||||
"\100\52\2\0\66\52\50\0\14\52\164\0\5\52\1\0\207\52\23\0"+
|
||||
"\12\56\7\0\32\52\6\0\32\52\13\0\131\52\3\0\6\52\2\0"+
|
||||
"\6\52\2\0\6\52\2\0\3\52\43\0";
|
||||
"\10\0\2\62\1\16\1\0\1\62\1\67\22\0\1\55\1\65\1\0"+
|
||||
"\1\66\1\20\1\0\1\61\1\54\1\4\1\5\1\22\1\23\1\57"+
|
||||
"\1\50\1\3\1\0\1\2\7\47\2\1\1\60\1\0\1\53\1\64"+
|
||||
"\1\63\1\21\1\0\1\27\1\27\1\35\1\34\1\44\1\42\1\30"+
|
||||
"\1\51\1\37\2\13\1\56\1\56\1\56\1\13\1\41\1\43\1\13"+
|
||||
"\1\33\2\13\1\32\1\32\1\32\1\13\1\31\1\10\1\12\1\11"+
|
||||
"\1\17\1\14\1\0\1\26\1\27\1\36\1\34\1\26\1\26\1\13"+
|
||||
"\1\51\1\37\1\13\1\52\2\13\1\25\1\13\1\40\1\13\1\25"+
|
||||
"\1\32\1\25\1\46\1\32\1\32\1\45\1\13\1\30\1\6\1\24"+
|
||||
"\1\7\54\0\1\13\12\0\1\13\4\0\1\13\5\0\27\13\1\0"+
|
||||
"\37\13\1\0\u013f\13\31\0\162\13\4\0\14\13\16\0\5\13\11\0"+
|
||||
"\1\13\213\0\1\13\13\0\1\13\1\0\3\13\1\0\1\13\1\0"+
|
||||
"\24\13\1\0\54\13\1\0\46\13\1\0\5\13\4\0\202\13\10\0"+
|
||||
"\105\13\1\0\46\13\2\0\2\13\6\0\20\13\41\0\46\13\2\0"+
|
||||
"\1\13\7\0\47\13\110\0\33\13\5\0\3\13\56\0\32\13\5\0"+
|
||||
"\13\13\25\0\12\15\4\0\2\13\1\0\143\13\1\0\1\13\17\0"+
|
||||
"\2\13\7\0\2\13\12\15\3\13\2\0\1\13\20\0\1\13\1\0"+
|
||||
"\36\13\35\0\3\13\60\0\46\13\13\0\1\13\u0152\0\66\13\3\0"+
|
||||
"\1\13\22\0\1\13\7\0\12\13\4\0\12\15\25\0\10\13\2\0"+
|
||||
"\2\13\2\0\26\13\1\0\7\13\1\0\1\13\3\0\4\13\3\0"+
|
||||
"\1\13\36\0\2\13\1\0\3\13\4\0\12\15\2\13\23\0\6\13"+
|
||||
"\4\0\2\13\2\0\26\13\1\0\7\13\1\0\2\13\1\0\2\13"+
|
||||
"\1\0\2\13\37\0\4\13\1\0\1\13\7\0\12\15\2\0\3\13"+
|
||||
"\20\0\11\13\1\0\3\13\1\0\26\13\1\0\7\13\1\0\2\13"+
|
||||
"\1\0\5\13\3\0\1\13\22\0\1\13\17\0\2\13\4\0\12\15"+
|
||||
"\25\0\10\13\2\0\2\13\2\0\26\13\1\0\7\13\1\0\2\13"+
|
||||
"\1\0\5\13\3\0\1\13\36\0\2\13\1\0\3\13\4\0\12\15"+
|
||||
"\1\0\1\13\21\0\1\13\1\0\6\13\3\0\3\13\1\0\4\13"+
|
||||
"\3\0\2\13\1\0\1\13\1\0\2\13\3\0\2\13\3\0\3\13"+
|
||||
"\3\0\10\13\1\0\3\13\55\0\11\15\25\0\10\13\1\0\3\13"+
|
||||
"\1\0\27\13\1\0\12\13\1\0\5\13\46\0\2\13\4\0\12\15"+
|
||||
"\25\0\10\13\1\0\3\13\1\0\27\13\1\0\12\13\1\0\5\13"+
|
||||
"\3\0\1\13\40\0\1\13\1\0\2\13\4\0\12\15\25\0\10\13"+
|
||||
"\1\0\3\13\1\0\27\13\1\0\20\13\46\0\2\13\4\0\12\15"+
|
||||
"\25\0\22\13\3\0\30\13\1\0\11\13\1\0\1\13\2\0\7\13"+
|
||||
"\72\0\60\13\1\0\2\13\14\0\7\13\11\0\12\15\47\0\2\13"+
|
||||
"\1\0\1\13\2\0\2\13\1\0\1\13\2\0\1\13\6\0\4\13"+
|
||||
"\1\0\7\13\1\0\3\13\1\0\1\13\1\0\1\13\2\0\2\13"+
|
||||
"\1\0\4\13\1\0\2\13\11\0\1\13\2\0\5\13\1\0\1\13"+
|
||||
"\11\0\12\15\2\0\2\13\42\0\1\13\37\0\12\15\26\0\10\13"+
|
||||
"\1\0\42\13\35\0\4\13\164\0\42\13\1\0\5\13\1\0\2\13"+
|
||||
"\25\0\12\15\6\0\6\13\112\0\46\13\12\0\51\13\7\0\132\13"+
|
||||
"\5\0\104\13\5\0\122\13\6\0\7\13\1\0\77\13\1\0\1\13"+
|
||||
"\1\0\4\13\2\0\7\13\1\0\1\13\1\0\4\13\2\0\47\13"+
|
||||
"\1\0\1\13\1\0\4\13\2\0\37\13\1\0\1\13\1\0\4\13"+
|
||||
"\2\0\7\13\1\0\1\13\1\0\4\13\2\0\7\13\1\0\7\13"+
|
||||
"\1\0\27\13\1\0\37\13\1\0\1\13\1\0\4\13\2\0\7\13"+
|
||||
"\1\0\47\13\1\0\23\13\16\0\11\15\56\0\125\13\14\0\u026c\13"+
|
||||
"\2\0\10\13\12\0\32\13\5\0\113\13\25\0\15\13\1\0\4\13"+
|
||||
"\16\0\22\13\16\0\22\13\16\0\15\13\1\0\3\13\17\0\64\13"+
|
||||
"\43\0\1\13\4\0\1\13\3\0\12\15\46\0\12\15\6\0\130\13"+
|
||||
"\10\0\51\13\127\0\35\13\51\0\12\15\36\13\2\0\5\13\u038b\0"+
|
||||
"\154\13\224\0\234\13\4\0\132\13\6\0\26\13\2\0\6\13\2\0"+
|
||||
"\46\13\2\0\6\13\2\0\10\13\1\0\1\13\1\0\1\13\1\0"+
|
||||
"\1\13\1\0\37\13\2\0\65\13\1\0\7\13\1\0\1\13\3\0"+
|
||||
"\3\13\1\0\7\13\3\0\4\13\2\0\6\13\4\0\15\13\5\0"+
|
||||
"\3\13\1\0\7\13\164\0\1\13\15\0\1\13\202\0\1\13\4\0"+
|
||||
"\1\13\2\0\12\13\1\0\1\13\3\0\5\13\6\0\1\13\1\0"+
|
||||
"\1\13\1\0\1\13\1\0\4\13\1\0\3\13\1\0\7\13\3\0"+
|
||||
"\3\13\5\0\5\13\u0ebb\0\2\13\52\0\5\13\5\0\2\13\4\0"+
|
||||
"\126\13\6\0\3\13\1\0\132\13\1\0\4\13\5\0\50\13\4\0"+
|
||||
"\136\13\21\0\30\13\70\0\20\13\u0200\0\u19b6\13\112\0\u51a6\13\132\0"+
|
||||
"\u048d\13\u0773\0\u2ba4\13\u215c\0\u012e\13\2\0\73\13\225\0\7\13\14\0"+
|
||||
"\5\13\5\0\1\13\1\0\12\13\1\0\15\13\1\0\5\13\1\0"+
|
||||
"\1\13\1\0\2\13\1\0\2\13\1\0\154\13\41\0\u016b\13\22\0"+
|
||||
"\100\13\2\0\66\13\50\0\14\13\164\0\5\13\1\0\207\13\23\0"+
|
||||
"\12\15\7\0\32\13\6\0\32\13\13\0\131\13\3\0\6\13\2\0"+
|
||||
"\6\13\2\0\6\13\2\0\3\13\43\0";
|
||||
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
@@ -132,22 +133,23 @@ class _RegExLexer implements FlexLexer {
|
||||
private static final int [] ZZ_ACTION = zzUnpackAction();
|
||||
|
||||
private static final String ZZ_ACTION_PACKED_0 =
|
||||
"\7\0\1\1\1\2\4\0\1\3\1\4\1\5\1\6"+
|
||||
"\7\0\1\1\1\2\5\0\1\3\1\4\1\5\1\6"+
|
||||
"\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+
|
||||
"\1\17\1\20\1\21\1\22\1\23\1\3\1\24\1\25"+
|
||||
"\1\26\1\27\1\30\1\31\1\32\1\33\1\34\1\35"+
|
||||
"\1\11\1\36\1\3\1\37\1\40\1\37\1\41\1\42"+
|
||||
"\1\43\1\1\1\44\1\45\1\2\1\46\1\47\1\50"+
|
||||
"\1\51\1\0\1\52\1\53\1\54\1\55\1\56\1\57"+
|
||||
"\1\60\1\61\2\62\1\63\1\11\1\64\1\65\1\66"+
|
||||
"\1\53\1\67\1\11\1\70\1\71\1\72\1\73\1\74"+
|
||||
"\1\0\1\75\1\76\1\77\1\100\1\101\1\0\1\102"+
|
||||
"\1\103\1\104\2\65\1\66\1\53\1\105\1\106\1\107"+
|
||||
"\1\110\1\111\1\112\1\0\1\103\1\113\2\65\1\66"+
|
||||
"\1\114\1\115\1\103\1\65\1\66\1\65\1\116\4\65";
|
||||
"\1\43\1\1\1\44\1\45\1\2\1\46\1\47\2\50"+
|
||||
"\1\51\1\52\1\0\1\53\1\54\1\55\1\56\1\11"+
|
||||
"\1\57\1\60\1\61\1\62\2\63\1\64\1\65\1\66"+
|
||||
"\1\67\1\54\1\70\1\11\1\71\1\72\1\73\1\74"+
|
||||
"\1\75\1\76\1\77\1\0\1\100\1\101\1\102\1\103"+
|
||||
"\1\104\1\0\1\105\1\106\1\107\2\66\1\67\1\54"+
|
||||
"\1\110\1\111\1\112\1\113\1\114\1\115\1\0\1\106"+
|
||||
"\1\116\2\66\1\67\1\117\1\120\1\106\1\66\1\67"+
|
||||
"\1\66\1\121\4\66";
|
||||
|
||||
private static int [] zzUnpackAction() {
|
||||
int [] result = new int[119];
|
||||
int [] result = new int[124];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -173,23 +175,24 @@ class _RegExLexer implements FlexLexer {
|
||||
|
||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||
"\0\0\0\70\0\160\0\250\0\340\0\u0118\0\u0150\0\u0188"+
|
||||
"\0\u01c0\0\u01f8\0\u0230\0\u0268\0\u02a0\0\u02d8\0\u02d8\0\u0310"+
|
||||
"\0\u02d8\0\u02d8\0\u0348\0\u0380\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+
|
||||
"\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u03b8\0\u02d8"+
|
||||
"\0\u03f0\0\u02d8\0\u0428\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0460"+
|
||||
"\0\u02d8\0\u0498\0\u02d8\0\u04d0\0\u02d8\0\u02d8\0\u0348\0\u02d8"+
|
||||
"\0\u02d8\0\u02d8\0\u0508\0\u0540\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+
|
||||
"\0\u0578\0\u02d8\0\u05b0\0\u02d8\0\u05e8\0\u0620\0\u02d8\0\u02d8"+
|
||||
"\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0658\0\u02d8\0\u02d8\0\u02d8"+
|
||||
"\0\u0690\0\u06c8\0\u0700\0\u02d8\0\u0738\0\u02d8\0\u02d8\0\u02d8"+
|
||||
"\0\u02d8\0\u02d8\0\u0770\0\u07a8\0\u02d8\0\u02d8\0\u02d8\0\u02d8"+
|
||||
"\0\u07e0\0\u02d8\0\u0818\0\u02d8\0\u0850\0\u0888\0\u08c0\0\u08f8"+
|
||||
"\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u02d8\0\u0930\0\u0968"+
|
||||
"\0\u02d8\0\u09a0\0\u02d8\0\u09d8\0\u05e8\0\u02d8\0\u02d8\0\u0a10"+
|
||||
"\0\u0a48\0\u0a80\0\u02d8\0\u0ab8\0\u0af0\0\u0b28\0\u0b60";
|
||||
"\0\u01c0\0\u01f8\0\u0230\0\u0268\0\u02a0\0\u02d8\0\u0310\0\u0310"+
|
||||
"\0\u0348\0\u0310\0\u0310\0\u0380\0\u03b8\0\u0310\0\u0310\0\u0310"+
|
||||
"\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u03f0"+
|
||||
"\0\u0310\0\u0428\0\u0310\0\u0460\0\u0310\0\u0310\0\u0310\0\u0310"+
|
||||
"\0\u0498\0\u0310\0\u04d0\0\u0310\0\u0508\0\u0310\0\u0310\0\u0380"+
|
||||
"\0\u0310\0\u0310\0\u0310\0\u0540\0\u0578\0\u0310\0\u0310\0\u0310"+
|
||||
"\0\u0310\0\u0310\0\u05b0\0\u05e8\0\u0310\0\u0620\0\u0310\0\u0658"+
|
||||
"\0\u0690\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310"+
|
||||
"\0\u06c8\0\u0310\0\u0310\0\u0700\0\u0738\0\u0770\0\u0310\0\u07a8"+
|
||||
"\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u0310\0\u07e0"+
|
||||
"\0\u0818\0\u0310\0\u0310\0\u0310\0\u0310\0\u0850\0\u0310\0\u0888"+
|
||||
"\0\u0310\0\u08c0\0\u08f8\0\u0930\0\u0968\0\u0310\0\u0310\0\u0310"+
|
||||
"\0\u0310\0\u0310\0\u0310\0\u09a0\0\u09d8\0\u0310\0\u0a10\0\u0310"+
|
||||
"\0\u0a48\0\u0658\0\u0310\0\u0310\0\u0a80\0\u0ab8\0\u0af0\0\u0310"+
|
||||
"\0\u0b28\0\u0b60\0\u0b98\0\u0bd0";
|
||||
|
||||
private static int [] zzUnpackRowMap() {
|
||||
int [] result = new int[119];
|
||||
int [] result = new int[124];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -212,73 +215,76 @@ class _RegExLexer implements FlexLexer {
|
||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\3\16\1\17\1\20\1\21\1\22\1\16\1\23\1\16"+
|
||||
"\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+
|
||||
"\23\16\1\34\5\16\1\35\5\16\1\25\4\16\1\36"+
|
||||
"\1\25\12\16\1\37\55\16\1\40\2\41\4\40\1\42"+
|
||||
"\12\40\22\43\1\41\1\40\2\43\2\40\1\43\1\40"+
|
||||
"\1\43\1\40\1\41\1\44\10\40\11\45\1\46\1\45"+
|
||||
"\1\0\67\45\1\0\1\47\53\45\6\16\1\22\1\16"+
|
||||
"\1\50\1\51\1\52\1\53\1\26\30\16\1\34\12\16"+
|
||||
"\1\54\1\53\5\16\1\53\6\55\1\56\1\55\1\57"+
|
||||
"\1\55\1\24\13\55\1\60\1\55\1\60\1\55\1\60"+
|
||||
"\3\55\1\60\15\55\1\60\13\55\5\61\1\62\14\61"+
|
||||
"\22\63\1\61\1\64\2\63\2\61\1\63\1\61\1\63"+
|
||||
"\5\61\1\65\5\61\13\11\1\66\53\11\1\66\22\61"+
|
||||
"\22\43\2\61\2\43\2\61\1\43\1\61\1\43\6\61"+
|
||||
"\1\67\26\61\22\43\2\61\2\43\1\61\1\70\1\43"+
|
||||
"\1\61\1\43\20\61\1\62\14\61\22\43\2\61\2\43"+
|
||||
"\2\61\1\43\1\61\1\43\14\61\2\41\2\61\1\62"+
|
||||
"\14\61\22\43\1\41\1\61\2\43\2\61\1\43\1\61"+
|
||||
"\1\43\1\61\1\41\11\61\106\0\1\71\62\0\1\72"+
|
||||
"\2\0\1\73\53\0\1\74\1\75\1\76\4\77\1\74"+
|
||||
"\1\77\1\74\1\77\1\100\6\77\2\101\3\102\3\103"+
|
||||
"\1\104\1\105\1\104\2\106\1\107\1\110\1\107\1\111"+
|
||||
"\1\112\1\113\1\77\1\114\1\115\2\74\1\107\1\100"+
|
||||
"\1\107\4\74\1\100\5\74\1\100\41\0\1\116\27\0"+
|
||||
"\2\41\41\0\1\41\11\0\1\41\12\0\2\43\17\0"+
|
||||
"\23\43\1\0\2\43\2\0\1\43\1\0\3\43\22\0"+
|
||||
"\1\117\2\0\1\73\53\0\1\74\1\75\1\76\4\77"+
|
||||
"\1\74\1\77\1\120\1\77\1\100\6\77\2\101\3\102"+
|
||||
"\3\103\1\104\1\105\1\104\2\106\1\107\1\110\1\107"+
|
||||
"\1\111\1\112\1\113\1\77\1\114\1\115\2\74\1\107"+
|
||||
"\1\100\1\107\4\74\1\100\5\74\1\100\60\0\1\121"+
|
||||
"\31\0\22\63\2\0\2\63\2\0\1\63\1\0\1\63"+
|
||||
"\35\0\22\64\2\0\2\64\2\0\1\64\1\0\1\64"+
|
||||
"\17\0\1\122\31\0\1\123\11\0\1\124\1\125\10\0"+
|
||||
"\2\126\1\127\1\130\1\131\12\0\1\132\57\0\2\75"+
|
||||
"\41\0\1\75\25\0\1\133\41\0\1\133\23\0\70\134"+
|
||||
"\1\0\2\135\3\0\1\136\14\0\2\135\4\0\3\135"+
|
||||
"\3\0\1\135\1\0\1\135\2\0\1\135\24\0\2\137"+
|
||||
"\20\0\2\137\4\0\3\137\3\0\1\137\1\0\1\137"+
|
||||
"\2\0\1\137\24\0\1\75\1\140\41\0\1\140\73\0"+
|
||||
"\1\141\1\142\66\0\1\143\13\0\1\144\67\0\1\145"+
|
||||
"\1\146\2\0\5\147\1\0\62\147\2\0\1\150\41\0"+
|
||||
"\1\150\24\0\2\151\20\0\2\151\4\0\3\151\3\0"+
|
||||
"\1\151\1\0\1\151\2\0\1\151\24\0\2\152\4\0"+
|
||||
"\1\153\13\0\2\152\4\0\3\152\3\0\1\152\1\0"+
|
||||
"\1\152\2\0\1\152\24\0\2\154\20\0\2\154\4\0"+
|
||||
"\3\154\3\0\1\154\1\0\1\154\2\0\1\154\24\0"+
|
||||
"\1\75\1\155\41\0\1\155\23\0\5\147\1\156\62\147"+
|
||||
"\2\0\1\157\41\0\1\157\24\0\2\160\4\0\1\151"+
|
||||
"\13\0\2\160\4\0\3\160\3\0\1\160\1\0\1\160"+
|
||||
"\2\0\1\160\24\0\2\161\20\0\2\161\4\0\3\161"+
|
||||
"\3\0\1\161\1\0\1\161\2\0\1\161\24\0\2\162"+
|
||||
"\4\0\1\151\13\0\2\162\4\0\3\162\3\0\1\162"+
|
||||
"\1\0\1\162\2\0\1\162\24\0\2\163\20\0\2\163"+
|
||||
"\4\0\3\163\3\0\1\163\1\0\1\163\2\0\1\163"+
|
||||
"\24\0\2\164\4\0\1\151\13\0\2\164\4\0\3\164"+
|
||||
"\3\0\1\164\1\0\1\164\2\0\1\164\24\0\2\165"+
|
||||
"\4\0\1\151\13\0\2\165\4\0\3\165\3\0\1\165"+
|
||||
"\1\0\1\165\2\0\1\165\24\0\2\166\4\0\1\151"+
|
||||
"\13\0\2\166\4\0\3\166\3\0\1\166\1\0\1\166"+
|
||||
"\2\0\1\166\24\0\2\167\4\0\1\151\13\0\2\167"+
|
||||
"\4\0\3\167\3\0\1\167\1\0\1\167\2\0\1\167"+
|
||||
"\24\0\2\167\4\0\1\153\13\0\2\167\4\0\3\167"+
|
||||
"\3\0\1\167\1\0\1\167\2\0\1\167\23\0";
|
||||
"\3\17\1\20\1\21\1\22\1\23\1\17\1\24\1\17"+
|
||||
"\1\25\3\17\1\26\1\27\1\30\1\31\1\32\1\33"+
|
||||
"\1\34\23\17\1\35\4\17\1\36\4\17\1\26\3\17"+
|
||||
"\1\37\1\26\12\17\1\40\55\17\1\41\2\42\4\41"+
|
||||
"\1\43\3\41\1\44\1\41\1\42\7\41\22\44\1\42"+
|
||||
"\1\41\2\44\3\41\1\44\1\45\10\41\11\46\1\47"+
|
||||
"\4\46\1\0\67\46\1\0\1\50\50\46\6\17\1\23"+
|
||||
"\1\17\1\51\1\52\1\53\3\17\1\54\1\27\30\17"+
|
||||
"\1\35\10\17\1\55\1\54\4\17\1\54\6\56\1\57"+
|
||||
"\1\56\1\60\1\56\1\25\16\56\1\61\1\56\1\61"+
|
||||
"\1\56\1\61\3\56\1\61\14\56\1\61\11\56\5\62"+
|
||||
"\1\63\5\62\1\64\11\62\22\64\1\62\1\65\2\64"+
|
||||
"\3\62\1\64\1\62\1\66\7\62\16\11\1\67\50\11"+
|
||||
"\1\67\13\62\1\44\11\62\22\44\2\62\2\44\3\62"+
|
||||
"\1\44\4\62\1\70\17\62\1\44\11\62\22\44\2\62"+
|
||||
"\2\44\1\62\1\71\1\62\1\44\16\62\1\63\5\62"+
|
||||
"\1\44\11\62\22\44\2\62\2\44\3\62\1\44\12\62"+
|
||||
"\2\42\2\62\1\63\5\62\1\44\1\62\1\42\7\62"+
|
||||
"\22\44\1\42\1\62\2\44\3\62\1\44\11\62\13\72"+
|
||||
"\1\44\11\72\22\44\2\72\2\44\3\72\1\44\1\72"+
|
||||
"\1\73\7\72\111\0\1\74\57\0\1\75\5\0\1\76"+
|
||||
"\50\0\1\77\1\100\1\101\4\102\1\77\1\102\1\77"+
|
||||
"\1\102\1\103\2\77\1\104\6\102\2\105\3\106\3\107"+
|
||||
"\1\110\1\111\1\110\2\112\1\103\1\113\1\103\1\114"+
|
||||
"\1\115\1\116\1\102\1\117\1\120\2\77\1\104\1\103"+
|
||||
"\3\77\1\104\4\77\1\104\44\0\1\121\24\0\2\42"+
|
||||
"\12\0\1\42\31\0\1\42\21\0\2\44\10\0\3\44"+
|
||||
"\7\0\23\44\1\0\2\44\3\0\1\44\22\0\1\122"+
|
||||
"\5\0\1\76\40\0\1\123\7\0\1\77\1\100\1\101"+
|
||||
"\4\102\1\77\1\102\1\124\1\102\1\103\2\77\1\104"+
|
||||
"\6\102\2\105\3\106\3\107\1\110\1\111\1\110\2\112"+
|
||||
"\1\103\1\113\1\103\1\114\1\115\1\116\1\102\1\117"+
|
||||
"\1\120\2\77\1\104\1\103\3\77\1\104\4\77\1\104"+
|
||||
"\61\0\1\125\21\0\1\64\11\0\22\64\2\0\2\64"+
|
||||
"\3\0\1\64\24\0\1\65\11\0\22\65\2\0\2\65"+
|
||||
"\3\0\1\65\22\0\1\126\62\0\1\127\34\0\1\130"+
|
||||
"\11\0\1\131\1\132\3\0\1\133\2\0\1\133\1\134"+
|
||||
"\1\135\1\136\12\0\1\137\57\0\2\100\44\0\1\100"+
|
||||
"\22\0\1\140\44\0\1\140\20\0\70\141\1\0\2\142"+
|
||||
"\3\0\1\143\17\0\2\142\4\0\3\142\3\0\1\142"+
|
||||
"\1\0\1\142\2\0\1\142\21\0\2\144\23\0\2\144"+
|
||||
"\4\0\3\144\3\0\1\144\1\0\1\144\2\0\1\144"+
|
||||
"\21\0\1\100\1\145\44\0\1\145\73\0\1\146\1\147"+
|
||||
"\66\0\1\150\10\0\1\151\67\0\1\152\1\153\2\0"+
|
||||
"\5\154\1\0\62\154\2\0\1\155\44\0\1\155\21\0"+
|
||||
"\2\156\23\0\2\156\4\0\3\156\3\0\1\156\1\0"+
|
||||
"\1\156\2\0\1\156\21\0\2\157\4\0\1\160\16\0"+
|
||||
"\2\157\4\0\3\157\3\0\1\157\1\0\1\157\2\0"+
|
||||
"\1\157\21\0\2\161\23\0\2\161\4\0\3\161\3\0"+
|
||||
"\1\161\1\0\1\161\2\0\1\161\21\0\1\100\1\162"+
|
||||
"\44\0\1\162\20\0\5\154\1\163\62\154\2\0\1\164"+
|
||||
"\44\0\1\164\21\0\2\165\4\0\1\156\16\0\2\165"+
|
||||
"\4\0\3\165\3\0\1\165\1\0\1\165\2\0\1\165"+
|
||||
"\21\0\2\166\23\0\2\166\4\0\3\166\3\0\1\166"+
|
||||
"\1\0\1\166\2\0\1\166\21\0\2\167\4\0\1\156"+
|
||||
"\16\0\2\167\4\0\3\167\3\0\1\167\1\0\1\167"+
|
||||
"\2\0\1\167\21\0\2\170\23\0\2\170\4\0\3\170"+
|
||||
"\3\0\1\170\1\0\1\170\2\0\1\170\21\0\2\171"+
|
||||
"\4\0\1\156\16\0\2\171\4\0\3\171\3\0\1\171"+
|
||||
"\1\0\1\171\2\0\1\171\21\0\2\172\4\0\1\156"+
|
||||
"\16\0\2\172\4\0\3\172\3\0\1\172\1\0\1\172"+
|
||||
"\2\0\1\172\21\0\2\173\4\0\1\156\16\0\2\173"+
|
||||
"\4\0\3\173\3\0\1\173\1\0\1\173\2\0\1\173"+
|
||||
"\21\0\2\174\4\0\1\156\16\0\2\174\4\0\3\174"+
|
||||
"\3\0\1\174\1\0\1\174\2\0\1\174\21\0\2\174"+
|
||||
"\4\0\1\160\16\0\2\174\4\0\3\174\3\0\1\174"+
|
||||
"\1\0\1\174\2\0\1\174\20\0";
|
||||
|
||||
private static int [] zzUnpackTrans() {
|
||||
int [] result = new int[2968];
|
||||
int [] result = new int[3080];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -319,16 +325,16 @@ class _RegExLexer implements FlexLexer {
|
||||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\7\0\2\1\4\0\2\11\1\1\2\11\2\1\12\11"+
|
||||
"\7\0\2\1\5\0\2\11\1\1\2\11\2\1\12\11"+
|
||||
"\1\1\1\11\1\1\1\11\1\1\4\11\1\1\1\11"+
|
||||
"\1\1\1\11\1\1\2\11\1\1\3\11\2\1\4\11"+
|
||||
"\1\1\1\11\1\0\1\11\2\1\6\11\1\1\3\11"+
|
||||
"\3\1\1\11\1\1\5\11\1\0\1\1\4\11\1\0"+
|
||||
"\1\1\1\11\1\1\2\11\1\1\3\11\2\1\5\11"+
|
||||
"\2\1\1\11\1\0\1\11\2\1\7\11\1\1\2\11"+
|
||||
"\3\1\1\11\1\1\7\11\1\0\1\1\4\11\1\0"+
|
||||
"\1\11\1\1\1\11\4\1\6\11\1\0\1\1\1\11"+
|
||||
"\1\1\1\11\2\1\2\11\3\1\1\11\4\1";
|
||||
|
||||
private static int [] zzUnpackAttribute() {
|
||||
int [] result = new int[119];
|
||||
int [] result = new int[124];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -403,6 +409,7 @@ class _RegExLexer implements FlexLexer {
|
||||
private boolean allowEmptyCharacterClass;
|
||||
private boolean allowHorizontalWhitespaceClass;
|
||||
private boolean allowCategoryShorthand;
|
||||
private boolean allowPosixBracketExpressions;
|
||||
|
||||
_RegExLexer(EnumSet<RegExpCapability> capabilities) {
|
||||
this((java.io.Reader)null);
|
||||
@@ -415,6 +422,7 @@ class _RegExLexer implements FlexLexer {
|
||||
this.allowHorizontalWhitespaceClass = capabilities.contains(RegExpCapability.ALLOW_HORIZONTAL_WHITESPACE_CLASS);
|
||||
this.allowEmptyCharacterClass = capabilities.contains(RegExpCapability.ALLOW_EMPTY_CHARACTER_CLASS);
|
||||
this.allowCategoryShorthand = capabilities.contains(RegExpCapability.UNICODE_CATEGORY_SHORTHAND);
|
||||
this.allowPosixBracketExpressions = capabilities.contains(RegExpCapability.POSIX_BRACKET_EXPRESSIONS);
|
||||
}
|
||||
|
||||
private void yypushstate(int state) {
|
||||
@@ -685,137 +693,141 @@ class _RegExLexer implements FlexLexer {
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 78:
|
||||
case 81:
|
||||
{ return RegExpTT.UNICODE_CHAR;
|
||||
}
|
||||
case 79: break;
|
||||
case 82: break;
|
||||
case 7:
|
||||
{ if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE;
|
||||
}
|
||||
case 80: break;
|
||||
case 83: break;
|
||||
case 24:
|
||||
{ return RegExpTT.COMMA;
|
||||
}
|
||||
case 81: break;
|
||||
case 64:
|
||||
case 84: break;
|
||||
case 67:
|
||||
{ return RegExpTT.POS_LOOKAHEAD;
|
||||
}
|
||||
case 82: break;
|
||||
case 62:
|
||||
case 85: break;
|
||||
case 65:
|
||||
{ yybegin(QUOTED_NAMED_GROUP); capturingGroupCount++; return RegExpTT.RUBY_QUOTED_NAMED_GROUP;
|
||||
}
|
||||
case 83: break;
|
||||
case 77:
|
||||
case 86: break;
|
||||
case 80:
|
||||
{ return RegExpTT.COMMENT;
|
||||
}
|
||||
case 84: break;
|
||||
case 87: break;
|
||||
case 14:
|
||||
{ return RegExpTT.STAR;
|
||||
}
|
||||
case 85: break;
|
||||
case 60:
|
||||
case 88: break;
|
||||
case 63:
|
||||
{ yybegin(PY_COND_REF); return RegExpTT.PYTHON_COND_REF;
|
||||
}
|
||||
case 86: break;
|
||||
case 49:
|
||||
case 89: break;
|
||||
case 50:
|
||||
{ return RegExpTT.CHAR_CLASS;
|
||||
}
|
||||
case 87: break;
|
||||
case 90: break;
|
||||
case 36:
|
||||
{ handleOptions(); return RegExpTT.OPTIONS_OFF;
|
||||
}
|
||||
case 88: break;
|
||||
case 56:
|
||||
case 91: break;
|
||||
case 57:
|
||||
{ yypopstate(); return RegExpTT.QUOTE_END;
|
||||
}
|
||||
case 89: break;
|
||||
case 92: break;
|
||||
case 35:
|
||||
{ yybegin(YYINITIAL); return RegExpTT.GROUP_END;
|
||||
}
|
||||
case 90: break;
|
||||
case 41:
|
||||
case 93: break;
|
||||
case 42:
|
||||
// lookahead expression with fixed base length
|
||||
zzMarkedPos = zzStartRead + 1;
|
||||
{ if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1);
|
||||
return RegExpTT.CLASS_BEGIN;
|
||||
}
|
||||
case 91: break;
|
||||
case 94: break;
|
||||
case 37:
|
||||
{ yybegin(YYINITIAL); return RegExpTT.COLON;
|
||||
}
|
||||
case 92: break;
|
||||
case 95: break;
|
||||
case 6:
|
||||
{ return RegExpTT.GROUP_END;
|
||||
}
|
||||
case 93: break;
|
||||
case 96: break;
|
||||
case 25:
|
||||
{ assert false : yytext();
|
||||
}
|
||||
case 94: break;
|
||||
case 97: break;
|
||||
case 18:
|
||||
{ return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER;
|
||||
}
|
||||
case 95: break;
|
||||
case 46:
|
||||
case 98: break;
|
||||
case 47:
|
||||
{ return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE;
|
||||
}
|
||||
case 96: break;
|
||||
case 99: break;
|
||||
case 23:
|
||||
{ return RegExpTT.NAME;
|
||||
}
|
||||
case 97: break;
|
||||
case 100: break;
|
||||
case 29:
|
||||
{ yypopstate(); return RegExpTT.CLASS_END;
|
||||
}
|
||||
case 98: break;
|
||||
case 101: break;
|
||||
case 72:
|
||||
{ yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF;
|
||||
}
|
||||
case 102: break;
|
||||
case 34:
|
||||
{ yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER;
|
||||
}
|
||||
case 99: break;
|
||||
case 52:
|
||||
case 103: break;
|
||||
case 53:
|
||||
{ yypushstate(QUOTED); return RegExpTT.QUOTE_BEGIN;
|
||||
}
|
||||
case 100: break;
|
||||
case 69:
|
||||
{ yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF;
|
||||
case 104: break;
|
||||
case 40:
|
||||
{ return RegExpTT.BAD_CHARACTER;
|
||||
}
|
||||
case 101: break;
|
||||
case 105: break;
|
||||
case 21:
|
||||
{ return RegExpTT.NUMBER;
|
||||
}
|
||||
case 102: break;
|
||||
case 106: break;
|
||||
case 4:
|
||||
{ return RegExpTT.DOT;
|
||||
}
|
||||
case 103: break;
|
||||
case 74:
|
||||
case 107: break;
|
||||
case 77:
|
||||
{ return RegExpTT.NEG_LOOKBEHIND;
|
||||
}
|
||||
case 104: break;
|
||||
case 108: break;
|
||||
case 33:
|
||||
{ yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1);
|
||||
}
|
||||
case 105: break;
|
||||
case 44:
|
||||
case 109: break;
|
||||
case 45:
|
||||
{ return (allowOctalNoLeadingZero ? RegExpTT.OCT_CHAR : RegExpTT.BAD_OCT_VALUE);
|
||||
}
|
||||
case 106: break;
|
||||
case 65:
|
||||
case 110: break;
|
||||
case 68:
|
||||
{ return RegExpTT.NEG_LOOKAHEAD;
|
||||
}
|
||||
case 107: break;
|
||||
case 111: break;
|
||||
case 10:
|
||||
{ return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CTRL_CHARACTER;
|
||||
}
|
||||
case 108: break;
|
||||
case 63:
|
||||
case 112: break;
|
||||
case 66:
|
||||
{ return RegExpTT.NON_CAPT_GROUP;
|
||||
}
|
||||
case 109: break;
|
||||
case 70:
|
||||
case 113: break;
|
||||
case 73:
|
||||
{ yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_REF;
|
||||
}
|
||||
case 110: break;
|
||||
case 114: break;
|
||||
case 28:
|
||||
{ if (allowNestedCharacterClasses) {
|
||||
yypushstate(CLASS2);
|
||||
@@ -823,24 +835,24 @@ class _RegExLexer implements FlexLexer {
|
||||
}
|
||||
return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 111: break;
|
||||
case 115: break;
|
||||
case 19:
|
||||
{ if (commentMode) { yypushstate(COMMENT); return RegExpTT.COMMENT; } else return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 112: break;
|
||||
case 51:
|
||||
case 116: break;
|
||||
case 52:
|
||||
{ yypushstate(PROP); return RegExpTT.PROPERTY;
|
||||
}
|
||||
case 113: break;
|
||||
case 117: break;
|
||||
case 8:
|
||||
{ yypushstate(CLASS2);
|
||||
return RegExpTT.CLASS_BEGIN;
|
||||
}
|
||||
case 114: break;
|
||||
case 73:
|
||||
case 118: break;
|
||||
case 76:
|
||||
{ return RegExpTT.POS_LOOKBEHIND;
|
||||
}
|
||||
case 115: break;
|
||||
case 119: break;
|
||||
case 20:
|
||||
{ if (allowDanglingMetacharacters) {
|
||||
yypopstate(); yypushback(1);
|
||||
@@ -848,72 +860,76 @@ class _RegExLexer implements FlexLexer {
|
||||
return RegExpTT.BAD_CHARACTER;
|
||||
}
|
||||
}
|
||||
case 116: break;
|
||||
case 75:
|
||||
case 120: break;
|
||||
case 78:
|
||||
{ return RegExpTT.HEX_CHAR;
|
||||
}
|
||||
case 117: break;
|
||||
case 121: break;
|
||||
case 1:
|
||||
{ handleOptions(); return RegExpTT.OPTIONS_ON;
|
||||
}
|
||||
case 118: break;
|
||||
case 43:
|
||||
case 122: break;
|
||||
case 44:
|
||||
{ if (yystate() == CLASS2) return RegExpTT.ESC_CHARACTER;
|
||||
while (yylength() > 2 && Integer.parseInt(yytext().toString().substring(1)) > capturingGroupCount) {
|
||||
yypushback(1);
|
||||
}
|
||||
return RegExpTT.BACKREF;
|
||||
}
|
||||
case 119: break;
|
||||
case 123: break;
|
||||
case 62:
|
||||
{ yybegin(CLASS2); return RegExpTT.BRACKET_EXPRESSION_END;
|
||||
}
|
||||
case 124: break;
|
||||
case 2:
|
||||
{ yypopstate(); return RegExpTT.COMMENT;
|
||||
}
|
||||
case 120: break;
|
||||
case 125: break;
|
||||
case 17:
|
||||
{ return RegExpTT.MINUS;
|
||||
}
|
||||
case 121: break;
|
||||
case 47:
|
||||
case 126: break;
|
||||
case 48:
|
||||
{ return RegExpTT.ESC_CTRL_CHARACTER;
|
||||
}
|
||||
case 122: break;
|
||||
case 127: break;
|
||||
case 32:
|
||||
{ yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE;
|
||||
}
|
||||
case 123: break;
|
||||
case 128: break;
|
||||
case 13:
|
||||
{ return RegExpTT.QUEST;
|
||||
}
|
||||
case 124: break;
|
||||
case 71:
|
||||
case 129: break;
|
||||
case 74:
|
||||
{ yybegin(NAMED_GROUP); capturingGroupCount++; return RegExpTT.PYTHON_NAMED_GROUP;
|
||||
}
|
||||
case 125: break;
|
||||
case 130: break;
|
||||
case 5:
|
||||
{ capturingGroupCount++; return RegExpTT.GROUP_BEGIN;
|
||||
}
|
||||
case 126: break;
|
||||
case 131: break;
|
||||
case 15:
|
||||
{ return RegExpTT.PLUS;
|
||||
}
|
||||
case 127: break;
|
||||
case 67:
|
||||
case 132: break;
|
||||
case 70:
|
||||
{ return RegExpTT.OCT_CHAR;
|
||||
}
|
||||
case 128: break;
|
||||
case 133: break;
|
||||
case 39:
|
||||
{ yybegin(YYINITIAL); return RegExpTT.QUOTE;
|
||||
}
|
||||
case 129: break;
|
||||
case 134: break;
|
||||
case 31:
|
||||
{ yypopstate(); yypushback(1);
|
||||
}
|
||||
case 130: break;
|
||||
case 135: break;
|
||||
case 27:
|
||||
{ yybegin(CLASS1); return RegExpTT.CARET;
|
||||
}
|
||||
case 131: break;
|
||||
case 57:
|
||||
case 136: break;
|
||||
case 58:
|
||||
// lookahead expression with fixed base length
|
||||
zzMarkedPos = zzStartRead + 1;
|
||||
{ if (allowNestedCharacterClasses) {
|
||||
@@ -922,104 +938,114 @@ class _RegExLexer implements FlexLexer {
|
||||
}
|
||||
return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 132: break;
|
||||
case 58:
|
||||
case 137: break;
|
||||
case 59:
|
||||
{ if (allowPosixBracketExpressions) {
|
||||
yybegin(BRACKET_EXPRESSION);
|
||||
return RegExpTT.BRACKET_EXPRESSION_BEGIN;
|
||||
} else {
|
||||
yypushback(1);
|
||||
return RegExpTT.CHARACTER;
|
||||
}
|
||||
}
|
||||
case 138: break;
|
||||
case 60:
|
||||
{ if (!allowNestedCharacterClasses) return RegExpTT.CHARACTER;
|
||||
return RegExpTT.REDUNDANT_ESCAPE;
|
||||
}
|
||||
case 133: break;
|
||||
case 139: break;
|
||||
case 38:
|
||||
{ yybegin(YYINITIAL); return RegExpTT.GT;
|
||||
}
|
||||
case 134: break;
|
||||
case 72:
|
||||
case 140: break;
|
||||
case 75:
|
||||
{ yybegin(PY_NAMED_GROUP_REF); return RegExpTT.PYTHON_NAMED_GROUP_REF;
|
||||
}
|
||||
case 135: break;
|
||||
case 141: break;
|
||||
case 16:
|
||||
{ return RegExpTT.UNION;
|
||||
}
|
||||
case 136: break;
|
||||
case 142: break;
|
||||
case 3:
|
||||
{ return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 137: break;
|
||||
case 40:
|
||||
case 143: break;
|
||||
case 41:
|
||||
{ yybegin(OPTIONS); return RegExpTT.SET_OPTIONS;
|
||||
}
|
||||
case 138: break;
|
||||
case 144: break;
|
||||
case 26:
|
||||
{ yybegin(CLASS2); return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 139: break;
|
||||
case 68:
|
||||
case 145: break;
|
||||
case 71:
|
||||
{ if (xmlSchemaMode) { yypushback(1); return RegExpTT.CHAR_CLASS; } else return RegExpTT.CTRL;
|
||||
}
|
||||
case 140: break;
|
||||
case 146: break;
|
||||
case 30:
|
||||
{ return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER;
|
||||
}
|
||||
case 141: break;
|
||||
case 147: break;
|
||||
case 12:
|
||||
{ return RegExpTT.DOLLAR;
|
||||
}
|
||||
case 142: break;
|
||||
case 59:
|
||||
case 148: break;
|
||||
case 61:
|
||||
{ if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER;
|
||||
}
|
||||
case 143: break;
|
||||
case 50:
|
||||
case 149: break;
|
||||
case 51:
|
||||
{ if (xmlSchemaMode) return RegExpTT.CHAR_CLASS; else return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN;
|
||||
}
|
||||
case 144: break;
|
||||
case 42:
|
||||
case 150: break;
|
||||
case 43:
|
||||
{ return RegExpTT.REDUNDANT_ESCAPE;
|
||||
}
|
||||
case 145: break;
|
||||
case 55:
|
||||
case 151: break;
|
||||
case 56:
|
||||
{ return (allowHexDigitClass || allowHorizontalWhitespaceClass ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN);
|
||||
}
|
||||
case 146: break;
|
||||
case 48:
|
||||
case 152: break;
|
||||
case 49:
|
||||
{ return yystate() != CLASS2 ? RegExpTT.BOUNDARY : RegExpTT.ESC_CHARACTER;
|
||||
}
|
||||
case 147: break;
|
||||
case 153: break;
|
||||
case 22:
|
||||
{ yypopstate(); return RegExpTT.RBRACE;
|
||||
}
|
||||
case 148: break;
|
||||
case 66:
|
||||
case 154: break;
|
||||
case 69:
|
||||
// lookahead expression with fixed base length
|
||||
zzMarkedPos = zzStartRead + 1;
|
||||
{ if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1);
|
||||
return RegExpTT.CLASS_BEGIN;
|
||||
}
|
||||
case 149: break;
|
||||
case 61:
|
||||
case 155: break;
|
||||
case 64:
|
||||
{ yybegin(NAMED_GROUP); capturingGroupCount++; return RegExpTT.RUBY_NAMED_GROUP;
|
||||
}
|
||||
case 150: break;
|
||||
case 54:
|
||||
case 156: break;
|
||||
case 55:
|
||||
{ return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
|
||||
}
|
||||
case 151: break;
|
||||
case 53:
|
||||
case 157: break;
|
||||
case 54:
|
||||
{ return RegExpTT.BAD_HEX_VALUE;
|
||||
}
|
||||
case 152: break;
|
||||
case 158: break;
|
||||
case 9:
|
||||
{ return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN;
|
||||
}
|
||||
case 153: break;
|
||||
case 159: break;
|
||||
case 11:
|
||||
{ return RegExpTT.CARET;
|
||||
}
|
||||
case 154: break;
|
||||
case 45:
|
||||
case 160: break;
|
||||
case 46:
|
||||
{ return RegExpTT.ESC_CHARACTER;
|
||||
}
|
||||
case 155: break;
|
||||
case 76:
|
||||
case 161: break;
|
||||
case 79:
|
||||
{ if (allowOctalNoLeadingZero) return RegExpTT.OCT_CHAR;
|
||||
if (yystate() == CLASS2) return RegExpTT.ESC_CHARACTER;
|
||||
while (yylength() > 2 && Integer.parseInt(yytext().toString().substring(1)) > capturingGroupCount) {
|
||||
@@ -1027,7 +1053,7 @@ class _RegExLexer implements FlexLexer {
|
||||
}
|
||||
return RegExpTT.BACKREF;
|
||||
}
|
||||
case 156: break;
|
||||
case 162: break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
|
||||
@@ -113,6 +113,23 @@ public final class DefaultRegExpPropertiesProvider {
|
||||
{"e", "escape character ('\\u001B')"}
|
||||
};
|
||||
|
||||
private final String[][] myPosixCharacterClasses = {
|
||||
{"alnum", "Alphanumeric characters"},
|
||||
{"alpha", "Alphabetic characters"},
|
||||
{"ascii", "ASCII characters"},
|
||||
{"blank", "Space and tab"},
|
||||
{"cntrl", "Control characters"},
|
||||
{"digit", "Digits"},
|
||||
{"graph", "Visible characters"},
|
||||
{"lower", "Lowercase letters"},
|
||||
{"print", "Visible characters and spaces"},
|
||||
{"punct", "Punctuation and symbols"},
|
||||
{"space", "All whitespace characters, including line breaks"},
|
||||
{"upper", "Uppercase letters"},
|
||||
{"word", "Word characters (letters, numbers and underscores)"},
|
||||
{"xdigit","Hexadecimal digits"},
|
||||
};
|
||||
|
||||
private DefaultRegExpPropertiesProvider() {
|
||||
}
|
||||
|
||||
@@ -157,4 +174,9 @@ public final class DefaultRegExpPropertiesProvider {
|
||||
public String[][] getKnownCharacterClasses() {
|
||||
return myCharacterClasses;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[][] getPosixCharacterClasses() {
|
||||
return myPosixCharacterClasses;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,6 @@ public enum RegExpCapability {
|
||||
ALLOW_HEX_DIGIT_CLASS,
|
||||
ALLOW_EMPTY_CHARACTER_CLASS,
|
||||
ALLOW_HORIZONTAL_WHITESPACE_CLASS,
|
||||
UNICODE_CATEGORY_SHORTHAND
|
||||
UNICODE_CATEGORY_SHORTHAND,
|
||||
POSIX_BRACKET_EXPRESSIONS
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,11 +20,15 @@ import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import org.intellij.lang.regexp.psi.RegExpClass;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -47,6 +51,9 @@ public final class RegExpCompletionContributor extends CompletionContributor {
|
||||
|
||||
final ElementPattern<PsiElement> propertyNamePattern = psiElement().afterLeaf(psiElement().withText("{").afterLeaf(propertyPattern));
|
||||
extend(CompletionType.BASIC, propertyNamePattern, new PropertyNameCompletionProvider());
|
||||
|
||||
final ElementPattern<PsiElement> bracketExpressionPattern = psiElement().afterLeaf(psiElement(RegExpTT.BRACKET_EXPRESSION_BEGIN));
|
||||
extend(CompletionType.BASIC, bracketExpressionPattern, new BracketExpressionCompletionProvider());
|
||||
}
|
||||
|
||||
{
|
||||
@@ -85,6 +92,34 @@ public final class RegExpCompletionContributor extends CompletionContributor {
|
||||
return LookupElementBuilder.create(name).withTypeText(type).withIcon(icon);
|
||||
}
|
||||
|
||||
private static class BracketExpressionCompletionProvider extends CompletionProvider<CompletionParameters> {
|
||||
|
||||
@Override
|
||||
protected void addCompletions(@NotNull CompletionParameters parameters,
|
||||
ProcessingContext context,
|
||||
@NotNull CompletionResultSet result) {
|
||||
|
||||
for (String[] completion : RegExpLanguageHosts.getInstance().getPosixCharacterClasses(parameters.getPosition())) {
|
||||
result.addElement(
|
||||
LookupElementBuilder.create(completion[0]).withTypeText((completion.length > 1) ? completion[1] : null).withIcon(emptyIcon)
|
||||
.withInsertHandler(new InsertHandler<LookupElement>() {
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context, LookupElement item) {
|
||||
context.setAddCompletionChar(false);
|
||||
final Editor editor = context.getEditor();
|
||||
final Document document = editor.getDocument();
|
||||
final int tailOffset = context.getTailOffset();
|
||||
if (document.getTextLength() < tailOffset + 2 ||
|
||||
!document.getText(new TextRange(tailOffset, tailOffset + 2)).equals(":]")) {
|
||||
document.insertString(tailOffset, ":]");
|
||||
}
|
||||
editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class PropertyNameCompletionProvider extends CompletionProvider<CompletionParameters> {
|
||||
|
||||
public void addCompletions(@NotNull final CompletionParameters parameters,
|
||||
|
||||
@@ -38,6 +38,7 @@ public interface RegExpElementTypes {
|
||||
IElementType BOUNDARY = new RegExpElementType("BOUNDARY");
|
||||
IElementType NAMED_GROUP_REF = new RegExpElementType("NAMED_GROUP_REF");
|
||||
IElementType PY_COND_REF = new RegExpElementType("PY_COND_REF");
|
||||
IElementType POSIX_BRACKET_EXPRESSION = new RegExpElementType("POSIX_BRACKET_EXPRESSION");
|
||||
|
||||
TokenSet ATOMS = TokenSet.create(CLOSURE, BOUNDARY,
|
||||
SIMPLE_CLASS, CLASS, CHAR, GROUP, PROPERTY, SET_OPTIONS, BACKREF, NAMED_GROUP_REF);
|
||||
|
||||
@@ -143,4 +143,8 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
|
||||
final RegExpLanguageHost host = findRegExpHost(element);
|
||||
return host != null ? host.getKnownCharacterClasses() : myDefaultProvider.getKnownCharacterClasses();
|
||||
}
|
||||
|
||||
String[][] getPosixCharacterClasses(@NotNull final PsiElement element) {
|
||||
return myDefaultProvider.getPosixCharacterClasses();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,8 @@ public class RegExpParser implements PsiParser {
|
||||
if (parseClassIntersection(builder)) {
|
||||
while (RegExpTT.CHARACTERS2.contains(builder.getTokenType()) ||
|
||||
builder.getTokenType() == RegExpTT.CLASS_BEGIN ||
|
||||
builder.getTokenType() == RegExpTT.PROPERTY) {
|
||||
builder.getTokenType() == RegExpTT.PROPERTY ||
|
||||
builder.getTokenType() == RegExpTT.BRACKET_EXPRESSION_BEGIN) {
|
||||
parseClassIntersection(builder);
|
||||
}
|
||||
}
|
||||
@@ -255,6 +256,9 @@ public class RegExpParser implements PsiParser {
|
||||
if (token == RegExpTT.CLASS_BEGIN) {
|
||||
parseClass(builder);
|
||||
}
|
||||
else if (token == RegExpTT.BRACKET_EXPRESSION_BEGIN) {
|
||||
parseBracketExpression(builder);
|
||||
}
|
||||
else if (RegExpTT.CHARACTERS2.contains(token)) {
|
||||
parseSimpleClassdef(builder);
|
||||
}
|
||||
@@ -271,6 +275,14 @@ public class RegExpParser implements PsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void parseBracketExpression(PsiBuilder builder) {
|
||||
final PsiBuilder.Marker marker = builder.mark();
|
||||
builder.advanceLexer();
|
||||
checkMatches(builder, RegExpTT.NAME, "POSIX character class name expected");
|
||||
checkMatches(builder, RegExpTT.BRACKET_EXPRESSION_END, "Unclosed POSIX bracket expression");
|
||||
marker.done(RegExpElementTypes.POSIX_BRACKET_EXPRESSION);
|
||||
}
|
||||
|
||||
private void parseSimpleClassdef(PsiBuilder builder) {
|
||||
assert RegExpTT.CHARACTERS2.contains(builder.getTokenType());
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class RegExpParserDefinition implements ParserDefinition {
|
||||
private static final TokenSet COMMENT_TOKENS = TokenSet.create(RegExpTT.COMMENT);
|
||||
private static final TokenSet COMMENT_TOKENS = TokenSet.create(RegExpTT.COMMENT);
|
||||
|
||||
@NotNull
|
||||
public Lexer createLexer(Project project) {
|
||||
@@ -104,6 +104,8 @@ public class RegExpParserDefinition implements ParserDefinition {
|
||||
return new RegExpNamedGroupRefImpl(node);
|
||||
} else if (type == RegExpElementTypes.PY_COND_REF) {
|
||||
return new RegExpPyCondRefImpl(node);
|
||||
} else if (type == RegExpElementTypes.POSIX_BRACKET_EXPRESSION) {
|
||||
return new RegExpPosixBracketExpressionImpl(node);
|
||||
}
|
||||
|
||||
return new ASTWrapperPsiElement(node);
|
||||
|
||||
@@ -38,6 +38,8 @@ public interface RegExpTT {
|
||||
IElementType CLASS_BEGIN = new RegExpElementType("CLASS_BEGIN");
|
||||
IElementType CLASS_END = new RegExpElementType("CLASS_END");
|
||||
IElementType ANDAND = new RegExpElementType("ANDAND");
|
||||
IElementType BRACKET_EXPRESSION_BEGIN = new RegExpElementType("BRACKET_EXPRESSION_BEGIN");
|
||||
IElementType BRACKET_EXPRESSION_END = new RegExpElementType("BRACKET_EXPRESSION_END");
|
||||
|
||||
IElementType GROUP_BEGIN = new RegExpElementType("GROUP_BEGIN");
|
||||
IElementType GROUP_END = new RegExpElementType("GROUP_END");
|
||||
|
||||
@@ -90,4 +90,8 @@ public class RegExpElementVisitor extends PsiElementVisitor {
|
||||
public void visitRegExpPyCondRef(RegExpPyCondRef condRef) {
|
||||
visitRegExpElement(condRef);
|
||||
}
|
||||
|
||||
public void visitPosixBracketExpression(RegExpPosixBracketExpression posixBracketExpression) {
|
||||
visitRegExpElement(posixBracketExpression);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-9
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2006 Sascha Weinreuter
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test;
|
||||
package org.intellij.lang.regexp.psi;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public interface RegExpPosixBracketExpression extends RegExpClassElement {
|
||||
|
||||
@SuppressWarnings({ "ALL" })
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
final Pattern pattern = Pattern.compile("[\\b]");
|
||||
}
|
||||
String getClassName();
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.intellij.lang.regexp.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.intellij.lang.regexp.RegExpTT;
|
||||
import org.intellij.lang.regexp.psi.RegExpElementVisitor;
|
||||
import org.intellij.lang.regexp.psi.RegExpPosixBracketExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class RegExpPosixBracketExpressionImpl extends RegExpElementImpl implements RegExpPosixBracketExpression {
|
||||
|
||||
public RegExpPosixBracketExpressionImpl(ASTNode astNode) {
|
||||
super(astNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegExpElementVisitor visitor) {
|
||||
visitor.visitPosixBracketExpression(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
final ASTNode nameNode = getNode().findChildByType(RegExpTT.NAME);
|
||||
return nameNode != null ? nameNode.getText() : null; }
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import java.util.EnumSet;
|
||||
private boolean allowEmptyCharacterClass;
|
||||
private boolean allowHorizontalWhitespaceClass;
|
||||
private boolean allowCategoryShorthand;
|
||||
private boolean allowPosixBracketExpressions;
|
||||
|
||||
_RegExLexer(EnumSet<RegExpCapability> capabilities) {
|
||||
this((java.io.Reader)null);
|
||||
@@ -48,6 +49,7 @@ import java.util.EnumSet;
|
||||
this.allowHorizontalWhitespaceClass = capabilities.contains(RegExpCapability.ALLOW_HORIZONTAL_WHITESPACE_CLASS);
|
||||
this.allowEmptyCharacterClass = capabilities.contains(RegExpCapability.ALLOW_EMPTY_CHARACTER_CLASS);
|
||||
this.allowCategoryShorthand = capabilities.contains(RegExpCapability.UNICODE_CATEGORY_SHORTHAND);
|
||||
this.allowPosixBracketExpressions = capabilities.contains(RegExpCapability.POSIX_BRACKET_EXPRESSIONS);
|
||||
}
|
||||
|
||||
private void yypushstate(int state) {
|
||||
@@ -84,6 +86,7 @@ import java.util.EnumSet;
|
||||
%xstate QUOTED_NAMED_GROUP
|
||||
%xstate PY_NAMED_GROUP_REF
|
||||
%xstate PY_COND_REF
|
||||
%xstate BRACKET_EXPRESSION
|
||||
|
||||
DIGITS=[1-9][0-9]*
|
||||
|
||||
@@ -96,6 +99,7 @@ LBRACKET="["
|
||||
RBRACKET="]"
|
||||
|
||||
ESCAPE="\\"
|
||||
NAME=[:letter:]([:letter:]|_|[:digit:])*
|
||||
ANY=.|\n
|
||||
|
||||
META={ESCAPE} | {DOT} |
|
||||
@@ -198,7 +202,7 @@ HEX_CHAR=[0-9a-fA-F]
|
||||
{LBRACE} { if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE; }
|
||||
|
||||
<EMBRACED> {
|
||||
[:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; }
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
[:digit:]+ { return RegExpTT.NUMBER; }
|
||||
"," { return RegExpTT.COMMA; }
|
||||
|
||||
@@ -251,6 +255,14 @@ HEX_CHAR=[0-9a-fA-F]
|
||||
}
|
||||
|
||||
<CLASS2> {
|
||||
{LBRACKET} ":" { if (allowPosixBracketExpressions) {
|
||||
yybegin(BRACKET_EXPRESSION);
|
||||
return RegExpTT.BRACKET_EXPRESSION_BEGIN;
|
||||
} else {
|
||||
yypushback(1);
|
||||
return RegExpTT.CHARACTER;
|
||||
}
|
||||
}
|
||||
{RBRACKET} { yypopstate(); return RegExpTT.CLASS_END; }
|
||||
|
||||
"&&" { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; }
|
||||
@@ -258,6 +270,11 @@ HEX_CHAR=[0-9a-fA-F]
|
||||
{ANY} { return RegExpTT.CHARACTER; }
|
||||
}
|
||||
|
||||
<BRACKET_EXPRESSION> {
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
":" {RBRACKET} { yybegin(CLASS2); return RegExpTT.BRACKET_EXPRESSION_END; }
|
||||
{ANY} { return RegExpTT.BAD_CHARACTER; }
|
||||
}
|
||||
|
||||
<YYINITIAL> {
|
||||
{LPAREN} { capturingGroupCount++; return RegExpTT.GROUP_BEGIN; }
|
||||
@@ -297,26 +314,26 @@ HEX_CHAR=[0-9a-fA-F]
|
||||
}
|
||||
|
||||
<NAMED_GROUP> {
|
||||
[:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; }
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
">" { yybegin(YYINITIAL); return RegExpTT.GT; }
|
||||
{ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; }
|
||||
}
|
||||
|
||||
<QUOTED_NAMED_GROUP> {
|
||||
[:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; }
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
"'" { yybegin(YYINITIAL); return RegExpTT.QUOTE; }
|
||||
{ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; }
|
||||
}
|
||||
|
||||
<PY_NAMED_GROUP_REF> {
|
||||
[:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; }
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
")" { yybegin(YYINITIAL); return RegExpTT.GROUP_END; }
|
||||
{ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; }
|
||||
}
|
||||
|
||||
<PY_COND_REF> {
|
||||
[:letter:]([:letter:]|_|[:digit:])* { return RegExpTT.NAME; }
|
||||
[:digit:]+ { return RegExpTT.NUMBER; }
|
||||
{NAME} { return RegExpTT.NAME; }
|
||||
[:digit:]+ { return RegExpTT.NUMBER; }
|
||||
")" { yybegin(YYINITIAL); return RegExpTT.GROUP_END; }
|
||||
{ANY} { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; }
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.lang.annotation.Annotator;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.intellij.lang.regexp.RegExpLanguageHosts;
|
||||
import org.intellij.lang.regexp.RegExpTT;
|
||||
import org.intellij.lang.regexp.psi.*;
|
||||
@@ -31,8 +32,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public final class RegExpAnnotator extends RegExpElementVisitor implements Annotator {
|
||||
private static final Set<String> POSIX_CHARACTER_CLASSES = ContainerUtil.newHashSet(
|
||||
"alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "word", "xdigit");
|
||||
private AnnotationHolder myHolder;
|
||||
private final RegExpLanguageHosts myLanguageHosts;
|
||||
|
||||
@@ -283,6 +287,17 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPosixBracketExpression(RegExpPosixBracketExpression posixBracketExpression) {
|
||||
final String className = posixBracketExpression.getClassName();
|
||||
if (!POSIX_CHARACTER_CLASSES.contains(className)) {
|
||||
final Annotation annotation = myHolder.createErrorAnnotation(posixBracketExpression, "Unknown POSIX character class");
|
||||
if (annotation != null) {
|
||||
annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerFix(Annotation a, IntentionAction action) {
|
||||
if (a != null) {
|
||||
// IDEA-9381
|
||||
|
||||
+3
-4
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test;
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
@@ -26,15 +26,14 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
|
||||
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
|
||||
import org.intellij.lang.regexp.RegExpFileType;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class BaseParseTestcase extends UsefulTestCase{
|
||||
public abstract class BaseParseTestCase extends UsefulTestCase{
|
||||
protected CodeInsightTestFixture myFixture;
|
||||
|
||||
@SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"})
|
||||
public BaseParseTestcase() {
|
||||
public BaseParseTestCase() {
|
||||
PlatformTestCase.initPlatformLangPrefix();
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test;
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
public class ParseTest extends BaseParseTestcase {
|
||||
public class ParseTest extends BaseParseTestCase {
|
||||
|
||||
//public void test0() throws Throwable {
|
||||
// myFixture.testHighlighting("test0.regexp");
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test;
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.intellij.lang.regexp.DefaultRegExpPropertiesProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.testFramework.LexerTestCase;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class RegExpLexerTest extends LexerTestCase {
|
||||
|
||||
public void testAmpersand() {
|
||||
final RegExpLexer lexer = new RegExpLexer(EnumSet.noneOf(RegExpCapability.class));
|
||||
doTest("[a&&]", "CLASS_BEGIN ('[')\n" +
|
||||
"CHARACTER ('a')\n" +
|
||||
"CHARACTER ('&')\n" +
|
||||
"CHARACTER ('&')\n" +
|
||||
"CLASS_END (']')", lexer);
|
||||
}
|
||||
|
||||
public void testIntersection() {
|
||||
final RegExpLexer lexer = new RegExpLexer(EnumSet.of(RegExpCapability.NESTED_CHARACTER_CLASSES));
|
||||
doTest("[a&&]", "CLASS_BEGIN ('[')\n" +
|
||||
"CHARACTER ('a')\n" +
|
||||
"ANDAND ('&&')\n" +
|
||||
"CLASS_END (']')", lexer);
|
||||
}
|
||||
|
||||
public void testPosixBracketExpression() {
|
||||
final RegExpLexer lexer = new RegExpLexer(EnumSet.of(RegExpCapability.POSIX_BRACKET_EXPRESSIONS));
|
||||
doTest("[[:xdigit:]]", "CLASS_BEGIN ('[')\n" +
|
||||
"BRACKET_EXPRESSION_BEGIN ('[:')\n" +
|
||||
"NAME ('xdigit')\n" +
|
||||
"BRACKET_EXPRESSION_END (':]')\n" +
|
||||
"CLASS_END (']')", lexer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Lexer createLexer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDirPath() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -13,11 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test;
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import org.intellij.lang.regexp.RegExpFileType;
|
||||
import org.intellij.lang.regexp.RegExpLanguageHost;
|
||||
import org.intellij.lang.regexp.RegExpLanguageHosts;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.input.SAXBuilder;
|
||||
@@ -30,7 +27,7 @@ import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
public class MainParseTest extends BaseParseTestcase {
|
||||
public class RegExpParseTest extends BaseParseTestCase {
|
||||
|
||||
private ByteArrayOutputStream myOut;
|
||||
|
||||
@@ -175,16 +172,19 @@ public class MainParseTest extends BaseParseTestcase {
|
||||
System.out.print("filename = " + name);
|
||||
n++;
|
||||
|
||||
final MainParseTest.Test test = myMap.get(name);
|
||||
final RegExpParseTest.Test test = myMap.get(name);
|
||||
try {
|
||||
if (test.regExpHost != null) {
|
||||
final Class<RegExpLanguageHost> aClass = (Class<RegExpLanguageHost>)Class.forName(test.regExpHost);
|
||||
final RegExpLanguageHost host = aClass.newInstance();
|
||||
RegExpLanguageHosts.setRegExpHost(host);
|
||||
}
|
||||
myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern);
|
||||
myFixture.testHighlighting(test.showWarnings, true, test.showInfo);
|
||||
RegExpLanguageHosts.setRegExpHost(null);
|
||||
try {
|
||||
myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern);
|
||||
myFixture.testHighlighting(test.showWarnings, true, test.showInfo);
|
||||
} finally {
|
||||
RegExpLanguageHosts.setRegExpHost(null);
|
||||
}
|
||||
|
||||
if (test.expectedResult == Result.ERR) {
|
||||
System.out.println(" FAILED. Expression incorrectly parsed OK: " + test.pattern);
|
||||
@@ -126,7 +126,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff0000" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="769aa5" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -161,7 +161,7 @@
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="536c46" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -547,7 +547,7 @@
|
||||
<option name="BACKGROUND" value="5e5339" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9373a5" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -749,7 +749,7 @@
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9373a5" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -939,7 +939,7 @@
|
||||
<option name="FOREGROUND" value="cc7832" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -979,13 +979,13 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="908b25" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRO_PARAMETER">
|
||||
<option name="OC.MACRO_PARAMETER">
|
||||
<value>
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
</value>
|
||||
@@ -997,7 +997,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="c4b3a3" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
@@ -1493,7 +1493,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="a74c0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="c7c8f5" />
|
||||
<option name="EFFECT_TYPE" value="-1" />
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<option name="CLASS_NAME_ATTRIBUTES">
|
||||
<value />
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value />
|
||||
</option>
|
||||
<option name="COFFEESCRIPT.BAD_CHARACTER">
|
||||
@@ -247,7 +247,7 @@
|
||||
<option name="FOREGROUND" value="CC7833" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9933CC" />
|
||||
</value>
|
||||
@@ -527,7 +527,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="3387CC" />
|
||||
</value>
|
||||
@@ -802,7 +802,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value />
|
||||
</option>
|
||||
<option name="JAVA_BLOCK_COMMENT">
|
||||
@@ -1013,7 +1013,7 @@
|
||||
<option name="FOREGROUND" value="3387CC" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CC7833" />
|
||||
</value>
|
||||
@@ -1070,10 +1070,10 @@
|
||||
<option name="LOCAL_VARIABLE_ATTRIBUTES">
|
||||
<value />
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value />
|
||||
</option>
|
||||
<option name="MACRO_PARAMETER">
|
||||
<option name="OC.MACRO_PARAMETER">
|
||||
<value />
|
||||
</option>
|
||||
<option name="MATCHED_BRACE_ATTRIBUTES">
|
||||
@@ -1081,7 +1081,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value />
|
||||
</option>
|
||||
<option name="NOT_USED_ELEMENT_ATTRIBUTES">
|
||||
@@ -2102,7 +2102,7 @@
|
||||
<option name="FOREGROUND" value="66CC33" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value />
|
||||
</option>
|
||||
<option name="UNMATCHED_BRACE_ATTRIBUTES">
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<option name="FOREGROUND" value="61CE3C" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FF6400" />
|
||||
</value>
|
||||
@@ -179,7 +179,7 @@
|
||||
<option name="FOREGROUND" value="61CE3C" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="AEAEAE" />
|
||||
</value>
|
||||
@@ -555,7 +555,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="D8FA3C" />
|
||||
</value>
|
||||
@@ -825,12 +825,12 @@
|
||||
<option name="FOREGROUND" value="61CE3C" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FBDE2D" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FF6400" />
|
||||
</value>
|
||||
@@ -840,7 +840,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FF6400" />
|
||||
</value>
|
||||
@@ -1377,7 +1377,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FBDE2D" />
|
||||
</value>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<option name="FOREGROUND" value="3AD900" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFDD00" />
|
||||
</value>
|
||||
@@ -259,7 +259,7 @@
|
||||
<option name="FOREGROUND" value="FF80E1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="0088FF" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
@@ -722,7 +722,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FF628C" />
|
||||
</value>
|
||||
@@ -953,7 +953,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CCCCCC" />
|
||||
</value>
|
||||
@@ -1074,7 +1074,7 @@
|
||||
<option name="FOREGROUND" value="80FFC2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FF9D00" />
|
||||
</value>
|
||||
@@ -1095,7 +1095,7 @@
|
||||
<option name="FOREGROUND" value="CCCCCC" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFDD00" />
|
||||
</value>
|
||||
@@ -1105,7 +1105,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFDD00" />
|
||||
</value>
|
||||
@@ -1883,7 +1883,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFEE80" />
|
||||
</value>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<option name="BACKGROUND" value="ffc8c8" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="445588" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
@@ -63,7 +63,7 @@
|
||||
<option name="FOREGROUND" value="108888" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="DD1144" />
|
||||
</value>
|
||||
@@ -423,7 +423,7 @@
|
||||
<option name="BACKGROUND" value="f5f7f0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="AA2C8C" />
|
||||
</value>
|
||||
@@ -601,7 +601,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="108888" />
|
||||
</value>
|
||||
@@ -695,7 +695,7 @@
|
||||
<option name="FOREGROUND" value="333333" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="000000" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
@@ -750,7 +750,7 @@
|
||||
<option name="FOREGROUND" value="ffa500" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="990000" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
@@ -767,7 +767,7 @@
|
||||
<option name="BACKGROUND" value="99ccff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="990000" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
@@ -1252,7 +1252,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="000000" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="A6E22E" />
|
||||
<option name="EFFECT_TYPE" value="1" />
|
||||
@@ -191,7 +191,7 @@
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="75715E" />
|
||||
</value>
|
||||
@@ -604,7 +604,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="AE81FF" />
|
||||
</value>
|
||||
@@ -882,12 +882,12 @@
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="F92672" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="A6E22E" />
|
||||
</value>
|
||||
@@ -897,7 +897,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="A6E22E" />
|
||||
</value>
|
||||
@@ -1466,7 +1466,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="66D9EF" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<option name="FOREGROUND" value="A5C261" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFFFFF" />
|
||||
</value>
|
||||
@@ -200,7 +200,7 @@
|
||||
<option name="FOREGROUND" value="D0D0FF" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="BC9458" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
@@ -604,7 +604,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="6D9CBE" />
|
||||
</value>
|
||||
@@ -814,7 +814,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="D0D0FF" />
|
||||
</value>
|
||||
@@ -906,7 +906,7 @@
|
||||
<option name="FOREGROUND" value="A5C261" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CC7833" />
|
||||
</value>
|
||||
@@ -926,7 +926,7 @@
|
||||
<option name="FOREGROUND" value="D0D0FF" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFC66D" />
|
||||
</value>
|
||||
@@ -936,7 +936,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FFC66D" />
|
||||
</value>
|
||||
@@ -1563,7 +1563,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CC7833" />
|
||||
</value>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<option name="FOREGROUND" value="8F9D6A" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CLASS_REFERENCE">
|
||||
<option name="OC.CLASS_REFERENCE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9B703F" />
|
||||
</value>
|
||||
@@ -202,7 +202,7 @@
|
||||
<option name="FOREGROUND" value="7587A6" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONDITIONALLY_NOT_COMPILED">
|
||||
<option name="OC.CONDITIONALLY_NOT_COMPILED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="5F5A60" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
@@ -665,7 +665,7 @@
|
||||
<option name="BACKGROUND" value="30322b" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ENUM_CONST">
|
||||
<option name="OC.ENUM_CONST">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CF6A4C" />
|
||||
</value>
|
||||
@@ -871,7 +871,7 @@
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IVAR">
|
||||
<option name="OC.IVAR">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="7587A6" />
|
||||
</value>
|
||||
@@ -962,7 +962,7 @@
|
||||
<option name="FOREGROUND" value="E9C062" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LABEL">
|
||||
<option name="OC.LABEL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CDA869" />
|
||||
</value>
|
||||
@@ -982,7 +982,7 @@
|
||||
<option name="FOREGROUND" value="7587A6" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MACRONAME">
|
||||
<option name="OC.MACRONAME">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9B703F" />
|
||||
</value>
|
||||
@@ -992,7 +992,7 @@
|
||||
<option name="BACKGROUND" value="3a6da0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="MESSAGE_ARGUMENT">
|
||||
<option name="OC.MESSAGE_ARGUMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="9B703F" />
|
||||
</value>
|
||||
@@ -1614,7 +1614,7 @@
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="TYPEDEF">
|
||||
<option name="OC.TYPEDEF">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="F9EE98" />
|
||||
</value>
|
||||
|
||||
@@ -25,7 +25,10 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.PowerSaveMode;
|
||||
import com.intellij.ide.file.BatchFileChangeListener;
|
||||
@@ -101,8 +104,7 @@ import org.jetbrains.jps.cmdline.ClasspathBootstrap;
|
||||
import org.jetbrains.jps.incremental.Utils;
|
||||
import org.jetbrains.jps.model.serialization.JpsGlobalLoader;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.ToolProvider;
|
||||
import javax.tools.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -122,6 +124,7 @@ import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage
|
||||
public class BuildManager implements ApplicationComponent{
|
||||
public static final Key<Boolean> ALLOW_AUTOMAKE = Key.create("_allow_automake_when_process_is_active_");
|
||||
private static final Key<String> FORCE_MODEL_LOADING_PARAMETER = Key.create(BuildParametersKeys.FORCE_MODEL_LOADING);
|
||||
private static final Key<CharSequence> STDERR_OUTPUT = Key.create("_process_launch_errors_");
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.BuildManager");
|
||||
private static final String COMPILER_PROCESS_JDK_PROPERTY = "compiler.process.jdk";
|
||||
@@ -549,13 +552,25 @@ public class BuildManager implements ApplicationComponent{
|
||||
Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler> pair = takePreloadedProcess(projectPath);
|
||||
if (pair != null) {
|
||||
final RequestFuture<PreloadedProcessMessageHandler> future = pair.first;
|
||||
final OSProcessHandler processHandler = pair.second;
|
||||
myMessageDispatcher.cancelSession(future.getRequestID());
|
||||
// waiting for preloaded process from project's task queue guarantees no build is started for this project
|
||||
// until this one gracefully exits and closes all its storages
|
||||
getProjectData(projectPath).taskQueue.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
future.waitFor();
|
||||
Throwable error = null;
|
||||
try {
|
||||
while (!processHandler.waitFor()) {
|
||||
LOG.info("processHandler.waitFor() returned false for session " + future.getRequestID() + ", continue waiting");
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
error = e;
|
||||
}
|
||||
finally {
|
||||
notifySessionTerminationIfNeeded(future.getRequestID(), error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -675,7 +690,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
try {
|
||||
if (project.isDisposed()) {
|
||||
if (usingPreloadedProcess) {
|
||||
future.cancel(true);
|
||||
future.cancel(false);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
@@ -683,77 +698,58 @@ public class BuildManager implements ApplicationComponent{
|
||||
}
|
||||
myBuildsInProgress.put(projectPath, future);
|
||||
final OSProcessHandler processHandler;
|
||||
final StringBuilder errorsOnLaunch = new StringBuilder();
|
||||
CharSequence errorsOnLaunch;
|
||||
if (usingPreloadedProcess) {
|
||||
final boolean paramsSent = myMessageDispatcher.sendBuildParameters(future.getRequestID(), params);
|
||||
if (!paramsSent) {
|
||||
myMessageDispatcher.cancelSession(future.getRequestID());
|
||||
}
|
||||
processHandler = preloaded.second;
|
||||
errorsOnLaunch = STDERR_OUTPUT.get(processHandler);
|
||||
}
|
||||
else {
|
||||
processHandler = launchBuildProcess(project, myListenPort, sessionId, false);
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
if (ProcessOutputTypes.STDERR.equals(outputType)) {
|
||||
if (errorsOnLaunch.length() < 1024) {
|
||||
final String text = event.getText();
|
||||
if (!StringUtil.isEmptyOrSpaces(text)) {
|
||||
errorsOnLaunch.append(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
errorsOnLaunch = new StringBuffer();
|
||||
processHandler.addProcessListener(new StdOutputCollector((StringBuffer)errorsOnLaunch));
|
||||
processHandler.startNotify();
|
||||
}
|
||||
|
||||
final boolean terminated = processHandler.waitFor();
|
||||
if (terminated) {
|
||||
final int exitValue = processHandler.getProcess().exitValue();
|
||||
if (exitValue != 0) {
|
||||
final StringBuilder msg = new StringBuilder();
|
||||
msg.append("Abnormal build process termination: ");
|
||||
if (errorsOnLaunch.length() > 0) {
|
||||
msg.append("\n").append(errorsOnLaunch);
|
||||
}
|
||||
else {
|
||||
msg.append("unknown error");
|
||||
}
|
||||
handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure(msg.toString(), null));
|
||||
while (!processHandler.waitFor()) {
|
||||
LOG.info("processHandler.waitFor() returned false for session " + sessionId + ", continue waiting");
|
||||
}
|
||||
|
||||
final int exitValue = processHandler.getProcess().exitValue();
|
||||
if (exitValue != 0) {
|
||||
final StringBuilder msg = new StringBuilder();
|
||||
msg.append("Abnormal build process termination: ");
|
||||
if (errorsOnLaunch != null && errorsOnLaunch.length() > 0) {
|
||||
msg.append("\n").append(errorsOnLaunch);
|
||||
}
|
||||
else {
|
||||
msg.append("unknown error");
|
||||
}
|
||||
handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure(msg.toString(), null));
|
||||
}
|
||||
else {
|
||||
handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure("Disconnected from build process", null));
|
||||
}
|
||||
|
||||
}
|
||||
catch (Throwable e) {
|
||||
execFailure = e;
|
||||
}
|
||||
finally {
|
||||
myBuildsInProgress.remove(projectPath);
|
||||
if (myMessageDispatcher.getAssociatedChannel(sessionId) == null) {
|
||||
// either the connection has never been established (process not started or execution failed), or no messages were sent from the launched process.
|
||||
// in this case the session cannot be unregistered by the message dispatcher
|
||||
final BuilderMessageHandler unregistered = myMessageDispatcher.unregisterBuildMessageHandler(sessionId);
|
||||
if (unregistered != null) {
|
||||
if (execFailure != null) {
|
||||
unregistered.handleFailure(sessionId, CmdlineProtoUtil.createFailure(execFailure.getMessage(), execFailure));
|
||||
}
|
||||
unregistered.sessionTerminated(sessionId);
|
||||
}
|
||||
}
|
||||
notifySessionTerminationIfNeeded(sessionId, execFailure);
|
||||
|
||||
if (Registry.is("compiler.process.preload") && !project.isDisposed()) {
|
||||
runCommand(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
final Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue);
|
||||
myPreloadedBuilds.put(projectPath, preloadResult);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.info("Error pre-loading build process for project " + projectPath, e);
|
||||
if (!myPreloadedBuilds.containsKey(projectPath)) {
|
||||
try {
|
||||
final Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue);
|
||||
myPreloadedBuilds.put(projectPath, preloadResult);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.info("Error pre-loading build process for project " + projectPath, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -764,11 +760,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
});
|
||||
}
|
||||
catch (Throwable e) {
|
||||
final BuilderMessageHandler unregistered = myMessageDispatcher.unregisterBuildMessageHandler(sessionId);
|
||||
if (unregistered != null) {
|
||||
unregistered.handleFailure(sessionId, CmdlineProtoUtil.createFailure(e.getMessage(), e));
|
||||
unregistered.sessionTerminated(sessionId);
|
||||
}
|
||||
handleProcessExecutionFailure(sessionId, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -776,6 +768,28 @@ public class BuildManager implements ApplicationComponent{
|
||||
return _future;
|
||||
}
|
||||
|
||||
private void notifySessionTerminationIfNeeded(UUID sessionId, @Nullable Throwable execFailure) {
|
||||
if (myMessageDispatcher.getAssociatedChannel(sessionId) == null) {
|
||||
// either the connection has never been established (process not started or execution failed), or no messages were sent from the launched process.
|
||||
// in this case the session cannot be unregistered by the message dispatcher
|
||||
final BuilderMessageHandler unregistered = myMessageDispatcher.unregisterBuildMessageHandler(sessionId);
|
||||
if (unregistered != null) {
|
||||
if (execFailure != null) {
|
||||
unregistered.handleFailure(sessionId, CmdlineProtoUtil.createFailure(execFailure.getMessage(), execFailure));
|
||||
}
|
||||
unregistered.sessionTerminated(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleProcessExecutionFailure(UUID sessionId, Throwable e) {
|
||||
final BuilderMessageHandler unregistered = myMessageDispatcher.unregisterBuildMessageHandler(sessionId);
|
||||
if (unregistered != null) {
|
||||
unregistered.handleFailure(sessionId, CmdlineProtoUtil.createFailure(e.getMessage(), e));
|
||||
unregistered.sessionTerminated(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ProjectData getProjectData(String projectPath) {
|
||||
synchronized (myProjectDataMap) {
|
||||
@@ -828,23 +842,15 @@ public class BuildManager implements ApplicationComponent{
|
||||
try {
|
||||
myMessageDispatcher.registerBuildMessageHandler(future, null);
|
||||
final OSProcessHandler processHandler = launchBuildProcess(project, myListenPort, future.getRequestID(), true);
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
if (ProcessOutputTypes.STDERR.equals(outputType)) {
|
||||
final String text = event.getText();
|
||||
if (!StringUtil.isEmptyOrSpaces(text)) {
|
||||
LOG.info("PRELOADED_BUILD_PROCESS: " + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
final StringBuffer errors = new StringBuffer();
|
||||
processHandler.addProcessListener(new StdOutputCollector(errors));
|
||||
STDERR_OUTPUT.set(processHandler, errors);
|
||||
|
||||
processHandler.startNotify();
|
||||
return Pair.create(future, processHandler);
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
myMessageDispatcher.unregisterBuildMessageHandler(future.getRequestID());
|
||||
handleProcessExecutionFailure(future.getRequestID(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -1236,6 +1242,36 @@ public class BuildManager implements ApplicationComponent{
|
||||
}
|
||||
}
|
||||
|
||||
private static final class StdOutputCollector extends ProcessAdapter {
|
||||
private final Appendable myOutput;
|
||||
private int myStoredLength = 0;
|
||||
public StdOutputCollector(Appendable outputSink) {
|
||||
myOutput = outputSink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
String text;
|
||||
|
||||
synchronized (this) {
|
||||
if (myStoredLength > 2048) {
|
||||
return;
|
||||
}
|
||||
text = event.getText();
|
||||
if (StringUtil.isEmptyOrSpaces(text)) {
|
||||
return;
|
||||
}
|
||||
myStoredLength += text.length();
|
||||
}
|
||||
|
||||
try {
|
||||
myOutput.append(text);
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ProjectWatcher extends ProjectManagerAdapter {
|
||||
private final Map<Project, MessageBusConnection> myConnections = new HashMap<Project, MessageBusConnection>();
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public abstract class SmartStepTarget {
|
||||
return myNeedBreakpointRequest;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Range<Integer> getCallingExpressionLines() {
|
||||
return myExpressionLines;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class BasicStepMethodFilter implements NamedMethodFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Range<Integer> getCallingExpressionLines() {
|
||||
return myCallingExpressionLines;
|
||||
|
||||
@@ -82,6 +82,7 @@ public class LambdaMethodFilter implements BreakpointStepMethodFilter{
|
||||
return method.name().startsWith(LAMBDA_METHOD_PREFIX) && (!vm.canGetSyntheticAttribute() || method.isSynthetic());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Range<Integer> getCallingExpressionLines() {
|
||||
return myCallingExpressionLines;
|
||||
|
||||
@@ -18,8 +18,9 @@ package com.intellij.debugger.engine;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.util.Range;
|
||||
import com.sun.jdi.Location;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface MethodFilter {
|
||||
boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException;
|
||||
Range<Integer> getCallingExpressionLines();
|
||||
@Nullable Range<Integer> getCallingExpressionLines();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.Range;
|
||||
import com.sun.jdi.Location;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
@@ -142,8 +143,8 @@ public class RequestHint {
|
||||
return myPosition.getLine() == locationPosition.getLine();
|
||||
}
|
||||
else {
|
||||
return locationPosition.getLine() >= myMethodFilter.getCallingExpressionLines().getFrom() &&
|
||||
locationPosition.getLine() <= myMethodFilter.getCallingExpressionLines().getTo();
|
||||
Range<Integer> exprLines = myMethodFilter.getCallingExpressionLines();
|
||||
return exprLines != null && locationPosition.getLine() >= exprLines.getFrom() && locationPosition.getLine() <= exprLines.getTo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -582,7 +582,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
|
||||
GenericDebuggerRunnerSettings settings,
|
||||
boolean checkValidity)
|
||||
throws ExecutionException {
|
||||
return createDebugParameters(parameters, settings.LOCAL, settings.getTransport(), settings.DEBUG_PORT, checkValidity);
|
||||
return createDebugParameters(parameters, settings.LOCAL, settings.getTransport(), settings.getDebugPort(), checkValidity);
|
||||
}
|
||||
|
||||
private static class MyDebuggerStateManager extends DebuggerStateManager {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,7 +132,7 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor<
|
||||
}
|
||||
|
||||
private int getTransport() {
|
||||
if(myIsLocal) {
|
||||
if (myIsLocal) {
|
||||
return DebuggerSettings.getInstance().DEBUGGER_TRANSPORT;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -134,7 +134,7 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
|
||||
|
||||
if (debuggerRunnerSettings != null) {
|
||||
remoteConnection.setUseSockets(debuggerRunnerSettings.getTransport() == DebuggerSettings.SOCKET_TRANSPORT);
|
||||
remoteConnection.setAddress(debuggerRunnerSettings.DEBUG_PORT);
|
||||
remoteConnection.setAddress(debuggerRunnerSettings.getDebugPort());
|
||||
}
|
||||
|
||||
return remoteConnection;
|
||||
|
||||
+19
-32
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,23 +17,29 @@ package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.execution.configurations.DebuggingRunnerData;
|
||||
import com.intellij.execution.configurations.RunnerSettings;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jdom.Element;
|
||||
import com.intellij.execution.configurations.RunnerSettingsEx;
|
||||
import com.intellij.util.xmlb.annotations.OptionTag;
|
||||
import com.intellij.util.xmlb.annotations.Transient;
|
||||
|
||||
public class GenericDebuggerRunnerSettings implements RunnerSettings, DebuggingRunnerData {
|
||||
public class GenericDebuggerRunnerSettings extends RunnerSettingsEx implements DebuggingRunnerData {
|
||||
@Transient
|
||||
@Deprecated
|
||||
public String DEBUG_PORT = "";
|
||||
|
||||
public int TRANSPORT = DebuggerSettings.SOCKET_TRANSPORT;
|
||||
public boolean LOCAL = true;
|
||||
|
||||
public GenericDebuggerRunnerSettings() {
|
||||
@Override
|
||||
@OptionTag("DEBUG_PORT")
|
||||
public String getDebugPort() {
|
||||
//noinspection deprecation
|
||||
return DEBUG_PORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDebugPort() {
|
||||
return DEBUG_PORT;
|
||||
public void setDebugPort(String port) {
|
||||
//noinspection deprecation
|
||||
DEBUG_PORT = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,31 +52,12 @@ public class GenericDebuggerRunnerSettings implements RunnerSettings, DebuggingR
|
||||
LOCAL = isLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugPort(String port) {
|
||||
DEBUG_PORT = port;
|
||||
@Transient
|
||||
public int getTransport() {
|
||||
return LOCAL ? DebuggerSettings.getInstance().DEBUGGER_TRANSPORT : TRANSPORT;
|
||||
}
|
||||
|
||||
public void setTransport(int transport) {
|
||||
TRANSPORT = transport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
DefaultJDOMExternalizer.readExternal(this, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
}
|
||||
|
||||
public int getTransport() {
|
||||
if (LOCAL) {
|
||||
return DebuggerSettings.getInstance().DEBUGGER_TRANSPORT;
|
||||
}
|
||||
else {
|
||||
return TRANSPORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
|
||||
public Pair<PsiElement, TextRange> findExpression(PsiElement element, boolean allowMethodCalls) {
|
||||
PsiElement expression = null;
|
||||
PsiElement parent = element.getParent();
|
||||
if (parent instanceof PsiLiteralExpression) {
|
||||
if (parent instanceof PsiLiteralExpression || parent instanceof PsiLambdaExpression) {
|
||||
element = parent;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
|
||||
}
|
||||
else if (parent instanceof PsiReferenceExpression) {
|
||||
final PsiElement pparent = parent.getParent();
|
||||
if (pparent instanceof PsiCallExpression) {
|
||||
if (parent instanceof PsiMethodReferenceExpression || pparent instanceof PsiCallExpression) {
|
||||
parent = pparent;
|
||||
}
|
||||
else if (pparent instanceof PsiReferenceExpression) {
|
||||
@@ -116,11 +116,19 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
|
||||
expression = parent;
|
||||
}
|
||||
}
|
||||
else if (allowMethodCalls) {
|
||||
PsiElement e = PsiTreeUtil.getParentOfType(element, PsiVariable.class, PsiExpression.class, PsiMethod.class);
|
||||
if (e instanceof PsiNewExpression) {
|
||||
if (((PsiNewExpression)e).getAnonymousClass() == null) {
|
||||
expression = e;
|
||||
else {
|
||||
PsiElement castExpr = PsiTreeUtil.getParentOfType(element, PsiTypeCastExpression.class);
|
||||
if (castExpr != null) {
|
||||
if (allowMethodCalls || !DebuggerUtils.hasSideEffects(castExpr)) {
|
||||
expression = castExpr;
|
||||
}
|
||||
}
|
||||
else if (allowMethodCalls) {
|
||||
PsiElement e = PsiTreeUtil.getParentOfType(element, PsiVariable.class, PsiExpression.class, PsiMethod.class);
|
||||
if (e instanceof PsiNewExpression) {
|
||||
if (((PsiNewExpression)e).getAnonymousClass() == null) {
|
||||
expression = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -339,8 +339,8 @@ class CompoundRendererConfigurable extends JPanel {
|
||||
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
|
||||
|
||||
if (rendererSettings.isBase(labelRenderer)) {
|
||||
myRbDefaultLabel.setSelected(true);
|
||||
myLabelEditor.setText(emptyExpressionFragment);
|
||||
myRbDefaultLabel.setSelected(true);
|
||||
}
|
||||
else {
|
||||
myRbExpressionLabel.setSelected(true);
|
||||
@@ -391,6 +391,7 @@ class CompoundRendererConfigurable extends JPanel {
|
||||
for (final Pair<String, TextWithImports> pair : data) {
|
||||
myData.add(new Row(pair.getFirst(), pair.getSecond()));
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.debugger.engine.evaluation;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.sun.jdi.*;
|
||||
|
||||
/**
|
||||
@@ -81,7 +82,12 @@ public class EvaluateExceptionUtil {
|
||||
return th.getMessage();
|
||||
}
|
||||
else {
|
||||
return th.getClass().getName() + " : " + (th.getMessage() != null ? th.getMessage() : "");
|
||||
StringBuilder res = new StringBuilder(th.getClass().getName());
|
||||
String message = th.getMessage();
|
||||
if (!StringUtil.isEmpty(message)) {
|
||||
res.append(" : ").append(message);
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.execution;
|
||||
|
||||
import com.intellij.execution.configuration.RunConfigurationExtensionsManager;
|
||||
import com.intellij.execution.configurations.RunConfigurationBase;
|
||||
import com.intellij.execution.configurations.RuntimeConfigurationException;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
@@ -26,7 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
* Date: 10/4/11
|
||||
*/
|
||||
public class JavaRunConfigurationExtensionManager extends RunConfigurationExtensionsManager<RunConfigurationBase, RunConfigurationExtension> {
|
||||
private static final Logger LOG = Logger.getInstance("#" + RunConfigurationExtension.class.getName());
|
||||
private static final Logger LOG = Logger.getInstance(RunConfigurationExtension.class);
|
||||
|
||||
public JavaRunConfigurationExtensionManager() {
|
||||
super(RunConfigurationExtension.EP_NAME);
|
||||
@@ -36,7 +35,7 @@ public class JavaRunConfigurationExtensionManager extends RunConfigurationExtens
|
||||
return ServiceManager.getService(JavaRunConfigurationExtensionManager.class);
|
||||
}
|
||||
|
||||
public static void checkConfigurationIsValid(RunConfigurationBase configuration) throws RuntimeConfigurationException {
|
||||
public static void checkConfigurationIsValid(RunConfigurationBase configuration) {
|
||||
try {
|
||||
getInstance().validateConfiguration(configuration, false);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,7 +56,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
public boolean ENABLE_SWING_INSPECTOR;
|
||||
|
||||
public String ENV_VARIABLES;
|
||||
private Map<String,String> myEnvs = new LinkedHashMap<String, String>();
|
||||
private final Map<String,String> myEnvs = new LinkedHashMap<String, String>();
|
||||
public boolean PASS_PARENT_ENVS = true;
|
||||
|
||||
public ApplicationConfiguration(final String name, final Project project, ApplicationConfigurationType applicationConfigurationType) {
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,10 +33,9 @@ import javax.swing.*;
|
||||
public class ApplicationConfigurationType implements ConfigurationType {
|
||||
private final ConfigurationFactory myFactory;
|
||||
|
||||
|
||||
/**reflection*/
|
||||
public ApplicationConfigurationType() {
|
||||
myFactory = new ConfigurationFactoryEx(this) {
|
||||
@Override
|
||||
public RunConfiguration createTemplateConfiguration(Project project) {
|
||||
return new ApplicationConfiguration("", project, ApplicationConfigurationType.this);
|
||||
}
|
||||
@@ -48,18 +47,22 @@ public class ApplicationConfigurationType implements ConfigurationType {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return ExecutionBundle.message("application.configuration.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurationTypeDescription() {
|
||||
return ExecutionBundle.message("application.configuration.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.RunConfigurations.Application;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationFactory[] getConfigurationFactories() {
|
||||
return new ConfigurationFactory[]{myFactory};
|
||||
}
|
||||
@@ -87,6 +90,7 @@ public class ApplicationConfigurationType implements ConfigurationType {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public String getId() {
|
||||
@@ -97,5 +101,4 @@ public class ApplicationConfigurationType implements ConfigurationType {
|
||||
public static ApplicationConfigurationType getInstance() {
|
||||
return ConfigurationTypeUtil.findConfigurationType(ApplicationConfigurationType.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
|
||||
PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
|
||||
for (int i = 0; i < overrides.length; i++) {
|
||||
overrides[i] = (PsiMethod)overrides[i].getNavigationElement();
|
||||
final PsiElement navigationElement = overrides[i].getNavigationElement();
|
||||
if (navigationElement instanceof PsiMethod) {
|
||||
overrides[i] = (PsiMethod)navigationElement;
|
||||
}
|
||||
}
|
||||
List<PsiElement> elementsToSearch = new ArrayList<PsiElement>(overrides.length + 1);
|
||||
elementsToSearch.add(parameter);
|
||||
|
||||
+25
-17
@@ -62,9 +62,11 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
|
||||
GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
|
||||
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
|
||||
|
||||
Condition<PsiMember> qualifiedMatcher = getQualifiedNameMatcher(pattern);
|
||||
|
||||
List<PsiMember> result = new ArrayList<PsiMember>();
|
||||
for (PsiMethod method : cache.getMethodsByName(name, scope)) {
|
||||
if (!method.isConstructor() && isOpenable(method) && !hasSuperMethod(method, scope)) {
|
||||
if (!method.isConstructor() && isOpenable(method) && !hasSuperMethod(method, scope, qualifiedMatcher)) {
|
||||
result.add(method);
|
||||
}
|
||||
}
|
||||
@@ -87,13 +89,14 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
|
||||
return member.getContainingFile().getVirtualFile() != null;
|
||||
}
|
||||
|
||||
private static boolean hasSuperMethod(PsiMethod method, GlobalSearchScope scope) {
|
||||
private static boolean hasSuperMethod(PsiMethod method, GlobalSearchScope scope, Condition<PsiMember> qualifiedMatcher) {
|
||||
PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass == null) return false;
|
||||
|
||||
for (PsiMethod candidate : containingClass.findMethodsByName(method.getName(), true)) {
|
||||
if (candidate.getContainingClass() != containingClass &&
|
||||
PsiSearchScopeUtil.isInScope(scope, candidate) &&
|
||||
qualifiedMatcher.value(candidate) &&
|
||||
PsiSuperMethodImplUtil.isSuperMethodSmart(method, candidate)) {
|
||||
return true;
|
||||
}
|
||||
@@ -118,20 +121,7 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
|
||||
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(scope.getProject());
|
||||
|
||||
String completePattern = parameters.getCompletePattern();
|
||||
final Condition<PsiMember> qualifiedMatcher;
|
||||
if (completePattern.contains(".")) {
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher("*" + StringUtil.replace(completePattern, ".", ".*"), NameUtil.MatchingCaseSensitivity.NONE);
|
||||
qualifiedMatcher = new Condition<PsiMember>() {
|
||||
@Override
|
||||
public boolean value(PsiMember member) {
|
||||
String qualifiedName = PsiUtil.getMemberQualifiedName(member);
|
||||
return qualifiedName != null && matcher.matches(qualifiedName);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
//noinspection unchecked
|
||||
qualifiedMatcher = Condition.TRUE;
|
||||
}
|
||||
final Condition<PsiMember> qualifiedMatcher = getQualifiedNameMatcher(completePattern);
|
||||
|
||||
//noinspection UnusedDeclaration
|
||||
final Set<PsiMethod> collectedMethods = new THashSet<PsiMethod>();
|
||||
@@ -163,13 +153,31 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
|
||||
Iterator<PsiMethod> iterator = collectedMethods.iterator();
|
||||
while(iterator.hasNext()) {
|
||||
PsiMethod method = iterator.next();
|
||||
if (!hasSuperMethod(method, scope) && !processor.process(method)) return;
|
||||
if (!hasSuperMethod(method, scope, qualifiedMatcher) && !processor.process(method)) return;
|
||||
ProgressManager.checkCanceled();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Condition<PsiMember> getQualifiedNameMatcher(String completePattern) {
|
||||
final Condition<PsiMember> qualifiedMatcher;
|
||||
if (completePattern.contains(".")) {
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher("*" + StringUtil.replace(completePattern, ".", ".*"), NameUtil.MatchingCaseSensitivity.NONE);
|
||||
qualifiedMatcher = new Condition<PsiMember>() {
|
||||
@Override
|
||||
public boolean value(PsiMember member) {
|
||||
String qualifiedName = PsiUtil.getMemberQualifiedName(member);
|
||||
return qualifiedName != null && matcher.matches(qualifiedName);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
//noinspection unchecked
|
||||
qualifiedMatcher = Condition.TRUE;
|
||||
}
|
||||
return qualifiedMatcher;
|
||||
}
|
||||
|
||||
private static class MyComparator implements Comparator<PsiModifierListOwner>{
|
||||
public static final MyComparator INSTANCE = new MyComparator();
|
||||
|
||||
|
||||
+11
-3
@@ -94,18 +94,26 @@ public class MergeMethodArguments extends FixableUsageInfo {
|
||||
}
|
||||
final List<ParameterInfoImpl> parametersInfo = new ArrayList<ParameterInfoImpl>();
|
||||
final PsiClassType classType = JavaPsiFacade.getElementFactory(getProject()).createType(psiClass, subst);
|
||||
parametersInfo.add(new ParameterInfoImpl(-1, parameterName, classType, null) {
|
||||
|
||||
final ParameterInfoImpl mergedParamInfo = new ParameterInfoImpl(-1, parameterName, classType, null) {
|
||||
@Override
|
||||
public PsiExpression getValue(final PsiCallExpression expr) throws IncorrectOperationException {
|
||||
return (PsiExpression)JavaCodeStyleManager.getInstance(getProject()).shortenClassReferences(psiFacade.getElementFactory().createExpressionFromText(getMergedParam(expr), expr));
|
||||
return (PsiExpression)JavaCodeStyleManager.getInstance(getProject())
|
||||
.shortenClassReferences(psiFacade.getElementFactory().createExpressionFromText(getMergedParam(expr), expr));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
int firstIncludedIdx = -1;
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
if (!isParameterToMerge(i)) {
|
||||
parametersInfo.add(new ParameterInfoImpl(i, parameters[i].getName(), parameters[i].getType()));
|
||||
} else if (firstIncludedIdx == -1) {
|
||||
firstIncludedIdx = i;
|
||||
}
|
||||
}
|
||||
|
||||
parametersInfo.add(firstIncludedIdx == -1 ? 0 : firstIncludedIdx, mergedParamInfo);
|
||||
final SmartPsiElementPointer<PsiMethod> meth = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(method);
|
||||
|
||||
Runnable performChangeSignatureRunnable = new Runnable() {
|
||||
|
||||
@@ -166,10 +166,7 @@ public class PsiTypesUtil {
|
||||
qualifierType = JavaPsiFacade.getInstance(project).getElementFactory().createType((PsiClass)parent.getPsi());
|
||||
}
|
||||
}
|
||||
PsiElement parent = call.getParent();
|
||||
boolean captureTopLevelWildcards = parent instanceof PsiReferenceExpression && parent.getParent() instanceof PsiMethodCallExpression ||
|
||||
parent instanceof PsiExpressionList;
|
||||
return createJavaLangClassType(methodExpression, qualifierType, captureTopLevelWildcards);
|
||||
return createJavaLangClassType(methodExpression, qualifierType, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ public class TypeConversionUtil {
|
||||
return aClass != null &&
|
||||
bClass != null &&
|
||||
aClass.getManager().areElementsEquivalent(aClass, bClass) &&
|
||||
areSameArgumentTypes(aClass, resolveResult1.getSubstitutor(), resolveResult2.getSubstitutor());
|
||||
areSameArgumentTypes(aClass, resolveResult1.getSubstitutor(), resolveResult2.getSubstitutor(), 1);
|
||||
}
|
||||
|
||||
private static boolean areSameArgumentTypes(@NotNull PsiClass aClass, @NotNull PsiSubstitutor substitutor1, @NotNull PsiSubstitutor substitutor2) {
|
||||
|
||||
+7
-1
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.resolve.graphInference.constraints;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -72,7 +73,12 @@ public class TypeCompatibilityConstraint implements ConstraintFormula {
|
||||
final PsiClass sClass = sResult.getElement();
|
||||
if (tClass != null && sClass != null) {
|
||||
final PsiSubstitutor sSubstitutor = TypeConversionUtil.getClassSubstitutor(tClass, sClass, sResult.getSubstitutor());
|
||||
if (sSubstitutor != null && PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {
|
||||
if (sSubstitutor != null) {
|
||||
if (PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (tClass instanceof InferenceVariable && ((PsiClassType)s).isRaw() && tClass.isInheritor(sClass, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -11,3 +11,18 @@ class Example {
|
||||
return getClass() == obj.getClass();
|
||||
}
|
||||
}
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
public static Class<? extends Foo<?>> fFoo(final Foo<?> foo) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Foo>>', required: 'java.lang.Class<? extends Foo<?>>'">Class<? extends Foo<?>> fooClass = foo.getClass();</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Foo>>', required: 'java.lang.Class<? extends Foo<?>>'">fooClass = foo.getClass()</error>;
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<? extends Foo>', required: 'java.lang.Class<? extends Foo<?>>'">return foo.getClass();</error>
|
||||
}
|
||||
|
||||
public static Class<? extends Foo<? extends String>> fFoo1(final Foo<? extends String> foo) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Foo>>', required: 'java.lang.Class<? extends Foo<? extends java.lang.String>>'">Class<? extends Foo<? extends String>> fooClass = foo.getClass();</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Foo>>', required: 'java.lang.Class<? extends Foo<? extends java.lang.String>>'">fooClass = foo.getClass()</error>;
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<? extends Foo>', required: 'java.lang.Class<? extends Foo<? extends java.lang.String>>'">return foo.getClass();</error>
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -60,8 +60,8 @@ abstract class C {
|
||||
try { g(); }
|
||||
catch (IE1 | IE2 e) {
|
||||
Class<? extends E> clazz1 = e.getClass();
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<? extends C.E>', required: 'java.lang.Class<? extends C.IE1>'">Class<? extends IE1> clazz2 = e.getClass();</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<? extends C.E>', required: 'java.lang.Class<? extends C.I>'">Class<? extends I> clazz3 = e.getClass();</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends C.E>>', required: 'java.lang.Class<? extends C.IE1>'">Class<? extends IE1> clazz2 = e.getClass();</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends C.E>>', required: 'java.lang.Class<? extends C.I>'">Class<? extends I> clazz3 = e.getClass();</error>
|
||||
}
|
||||
|
||||
try { f(); }
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class ImmutableSet<E> {
|
||||
void foo(final ImmutableSet<Class<String>> of) {
|
||||
Object types = <error descr="Inconvertible types; cannot cast 'ImmutableSet<java.lang.Class<java.lang.String>>' to 'ImmutableSet<java.lang.Class<?>>'">(ImmutableSet<Class<?>>) of</error>;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Foo<Bazz> {
|
||||
|
||||
public void test(Foo parent) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'Foo'">Foo foo = getElements(parent).get(0);</error>
|
||||
}
|
||||
|
||||
public static <E extends Foo<E>> List<E> getElements(E parent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -430,6 +430,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testNestedLevelsToCheckTypeArguments() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
assertNotNull(collectionsClass);
|
||||
|
||||
+4
@@ -255,6 +255,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUncheckedConversionWithRecursiveTypeParams() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
@@ -239,6 +239,14 @@ class Intf {
|
||||
assert !(sdkRun in noLibs)
|
||||
}
|
||||
|
||||
public void "test super method not matching query qualifier"() {
|
||||
def base = myFixture.addClass("class Base { void xpaint() {} }").methods[0]
|
||||
def sub = myFixture.addClass("class Sub extends Base { void xpaint() {} }").methods[0]
|
||||
|
||||
assert getPopupElements(new GotoSymbolModel2(project), 'Ba.xpai', false) == [base]
|
||||
assert getPopupElements(new GotoSymbolModel2(project), 'Su.xpai', false) == [sub]
|
||||
}
|
||||
|
||||
private List<Object> getPopupElements(ChooseByNameModel model, String text, boolean checkboxState = false) {
|
||||
return calcPopupElements(createPopup(model), text, checkboxState)
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public abstract class CloudModuleBuilderContributionFactory {
|
||||
|
||||
public static CloudModuleBuilderContributionFactory getInstanceByType(ServerType<?> cloudType) {
|
||||
for (CloudModuleBuilderContributionFactory contribution : EP_NAME.getExtensions()) {
|
||||
if (contribution.getCloudType() == cloudType) {
|
||||
if (contribution.getCloudType().equals(cloudType)) {
|
||||
return contribution;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-2
@@ -835,7 +835,14 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
}
|
||||
}
|
||||
final String text = stripTypeParameters(el.getText());
|
||||
final boolean equalsIgnorePackage = MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(el2.getText()));
|
||||
String text2;
|
||||
if (el2 instanceof PsiClass) {
|
||||
text2 = ((PsiClass)el2).getQualifiedName();
|
||||
} else {
|
||||
text2 = el2.getText();
|
||||
}
|
||||
|
||||
final boolean equalsIgnorePackage = MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(text2));
|
||||
if (equalsIgnorePackage || !(el2 instanceof PsiJavaReference)) {
|
||||
return equalsIgnorePackage;
|
||||
}
|
||||
@@ -846,7 +853,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
return text.equals(((PsiClass)element2).getQualifiedName());
|
||||
}
|
||||
else {
|
||||
return MatchUtils.compareWithNoDifferenceToPackage(text, el2.getText());
|
||||
return MatchUtils.compareWithNoDifferenceToPackage(text, text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInsight.highlighting.HighlightUsagesHandler;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
@@ -40,9 +41,11 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -119,6 +122,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String path = files[i];
|
||||
final String fullPath = FileUtil.toSystemIndependentName(getTestDataPath() + path);
|
||||
allowRootAccess(fullPath);
|
||||
VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath);
|
||||
vFiles[i] = vFile;
|
||||
assertNotNull("file " + fullPath + " not found", vFile);
|
||||
@@ -129,8 +133,19 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return configureByFiles(projectFile, vFiles);
|
||||
}
|
||||
|
||||
private void allowRootAccess(final String filePath) {
|
||||
VfsRootAccess.allowRootAccess(filePath);
|
||||
Disposer.register(myTestRootDisposable, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
VfsRootAccess.disallowRootAccess(filePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected VirtualFile configureByFile(@NonNls String filePath, @Nullable String projectRoot) throws Exception {
|
||||
String fullPath = getTestDataPath() + filePath;
|
||||
allowRootAccess(fullPath);
|
||||
|
||||
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
assertNotNull("file " + fullPath + " not found", vFile);
|
||||
@@ -475,6 +490,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
String fullPath = getTestDataPath() + filePath;
|
||||
allowRootAccess(fullPath);
|
||||
|
||||
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
assertNotNull("Cannot find file " + fullPath, vFile);
|
||||
@@ -549,6 +565,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
|
||||
protected VirtualFile getVirtualFile(@NonNls @NotNull String filePath) {
|
||||
String fullPath = getTestDataPath() + filePath;
|
||||
allowRootAccess(fullPath);
|
||||
|
||||
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
assertNotNull("file " + fullPath + " not found", vFile);
|
||||
|
||||
@@ -205,7 +205,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
GenericDebuggerRunnerSettings debuggerRunnerSettings = new GenericDebuggerRunnerSettings();
|
||||
debuggerRunnerSettings.LOCAL = true;
|
||||
debuggerRunnerSettings.DEBUG_PORT = "3456";
|
||||
debuggerRunnerSettings.setDebugPort("3456");
|
||||
|
||||
ExecutionEnvironment environment = new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
|
||||
.runnerSettings(debuggerRunnerSettings)
|
||||
|
||||
@@ -27,6 +27,8 @@ import io.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufEncoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import io.netty.util.internal.logging.Log4JLoggerFactory;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
@@ -329,6 +331,7 @@ public class BuildMain {
|
||||
}
|
||||
|
||||
Logger.setFactory(MyLoggerFactory.class);
|
||||
InternalLoggerFactory.setDefaultFactory(new Log4JLoggerFactory());
|
||||
}
|
||||
|
||||
private static void ensureLogConfigExists(final File logConfig) throws IOException {
|
||||
|
||||
+7
-2
@@ -450,8 +450,13 @@ public class RefManagerImpl extends RefManager {
|
||||
|
||||
@Nullable
|
||||
public RefElement getReference(final PsiElement elem, final boolean ignoreScope) {
|
||||
if (elem == null || !elem.isValid() ||
|
||||
elem instanceof LightElement || !(elem instanceof PsiDirectory) && !belongsToScope(elem, ignoreScope)) {
|
||||
if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return elem == null || !elem.isValid() ||
|
||||
elem instanceof LightElement || !(elem instanceof PsiDirectory) && !belongsToScope(elem, ignoreScope);
|
||||
}
|
||||
})) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Project interface class.
|
||||
* An object representing IntelliJ project.<br/>
|
||||
*
|
||||
* <li/>To get all its modules, use {@link com.intellij.openapi.module.ModuleManager#getModules()}<br/>
|
||||
*
|
||||
* <li/>To iterate over all project source files and directories, use {@code com.intellij.openapi.roots.ProjectFileIndex.SERVICE.getInstance(project).iterateContent(iterator)}<br/>
|
||||
*
|
||||
* <li/>To get the list of all open projects, use {@link com.intellij.openapi.project.ProjectManager#getOpenProjects()}
|
||||
*
|
||||
*/
|
||||
public interface Project extends ComponentManager, AreaInstance {
|
||||
@NonNls String DIRECTORY_STORE_FOLDER = ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR;
|
||||
|
||||
@@ -17,12 +17,45 @@ package com.intellij.psi.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A wrapper object that holds a computation ({@link #getValueProvider()}) and caches the result of the computation.<p/>
|
||||
*
|
||||
* The recommended way of creation is to use one of {@link com.intellij.psi.util.CachedValuesManager} methods, e.g.
|
||||
* {@link com.intellij.psi.util.CachedValuesManager#getCachedValue(com.intellij.psi.PsiElement, CachedValueProvider)}
|
||||
*
|
||||
* When {@link #getValue()} is invoked the first time, the computation is run and its result is returned and remembered internally.
|
||||
* In subsequent invocations, the result will be reused to avoid running the same code again and again.<p/>
|
||||
*
|
||||
* The computation will be re-run in the following circumstances:
|
||||
* <ol>
|
||||
* <li/>Garbage collector collects the result cached internally (it's kept via a {@link java.lang.ref.SoftReference}).
|
||||
* <li/>IDEA determines that cached value is outdated because some its dependencies are changed. See
|
||||
* {@link com.intellij.psi.util.CachedValueProvider.Result#getDependencyItems()}
|
||||
* </ol>
|
||||
*
|
||||
* The implementation is thread-safe but not atomic, i.e. if several threads request the cached value simultaneously, the computation may
|
||||
* be run concurrently on more than one thread.
|
||||
*
|
||||
* @param <T> The type of the computation result.
|
||||
*
|
||||
* @see com.intellij.psi.util.CachedValueProvider
|
||||
* @see com.intellij.psi.util.CachedValuesManager
|
||||
*/
|
||||
public interface CachedValue<T> {
|
||||
|
||||
/**
|
||||
* @return cached value if it's already computed and not outdated, newly computed value otherwise
|
||||
*/
|
||||
T getValue();
|
||||
|
||||
/**
|
||||
* @return the object calculating the value to cache
|
||||
*/
|
||||
@NotNull
|
||||
CachedValueProvider<T> getValueProvider();
|
||||
|
||||
/**
|
||||
* @return whether there is a cached result inside this object and it's not outdated
|
||||
*/
|
||||
boolean hasUpToDateValue();
|
||||
}
|
||||
|
||||
@@ -22,15 +22,31 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A computation (typically an anonymous class) to used in {@link com.intellij.psi.util.CachedValue} to cache some computation result.
|
||||
* @param <T> the type of the cached value
|
||||
*/
|
||||
public interface CachedValueProvider<T> {
|
||||
|
||||
/**
|
||||
* @return result object holding the value to cache and the dependencies indicating when that value will be outdated
|
||||
*/
|
||||
@Nullable
|
||||
Result<T> compute();
|
||||
|
||||
/**
|
||||
* The object holding the value to cache and the dependencies indicating when that value will be outdated
|
||||
* @param <T> the type of the cached value
|
||||
*/
|
||||
class Result<T> {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.util.CachedValueProvider.Result");
|
||||
private final T myValue;
|
||||
private final Object[] myDependencyItems;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @see #getDependencyItems()
|
||||
*/
|
||||
public Result(@Nullable T value, @NotNull Object... dependencyItems) {
|
||||
myValue = value;
|
||||
myDependencyItems = dependencyItems;
|
||||
@@ -50,19 +66,49 @@ public interface CachedValueProvider<T> {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dependency items are used in cached values to remember the state of the environment as it was when the value was computed
|
||||
* and to compare that to the state of the world when querying {@link CachedValue#getValue()}. The state is remembered as
|
||||
* a collection of {@code long} values representing some time stamps. When changes occur, these stamps are incremented.<p/>
|
||||
*
|
||||
* Dependencies can be following:
|
||||
* <ul>
|
||||
* <li/>Instances of {@link com.intellij.openapi.util.ModificationTracker} returning stamps explicitly
|
||||
* <li/>Constant fields of {@link PsiModificationTracker} class, e.g. {@link com.intellij.psi.util.PsiModificationTracker#MODIFICATION_COUNT}
|
||||
* <li/>{@link com.intellij.psi.PsiElement} or {@link com.intellij.openapi.vfs.VirtualFile} objects. Such cache would be dropped
|
||||
* on any change in the corresponding file
|
||||
* </ul>
|
||||
*
|
||||
* @return the dependency items
|
||||
* @see com.intellij.openapi.util.ModificationTracker
|
||||
* @see com.intellij.psi.util.PsiModificationTracker
|
||||
* @see com.intellij.openapi.roots.ProjectRootModificationTracker
|
||||
*/
|
||||
@NotNull
|
||||
public Object[] getDependencyItems() {
|
||||
return myDependencyItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a result
|
||||
* @see #getDependencyItems()
|
||||
*/
|
||||
public static <T> Result<T> createSingleDependency(@Nullable T value, @NotNull Object dependency) {
|
||||
return create(value, dependency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a result
|
||||
* @see #getDependencyItems()
|
||||
*/
|
||||
public static <T> Result<T> create(@Nullable T value, @NotNull Object... dependencies) {
|
||||
return new Result<T>(value, dependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a result
|
||||
* @see #getDependencyItems()
|
||||
*/
|
||||
public static <T> Result<T> create(@Nullable T value, @NotNull Collection<?> dependencies) {
|
||||
return new Result<T>(value, ArrayUtil.toObjectArray(dependencies));
|
||||
}
|
||||
|
||||
@@ -28,6 +28,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* A service used to create and store {@link com.intellij.psi.util.CachedValue} objects.<p/>
|
||||
*
|
||||
* By default cached values are stored in the user data of associated objects implementing {@link com.intellij.openapi.util.UserDataHolder}.
|
||||
*
|
||||
* @see #createCachedValue(CachedValueProvider, boolean)
|
||||
* @see #getCachedValue(com.intellij.psi.PsiElement, CachedValueProvider)
|
||||
* @see #getCachedValue(com.intellij.openapi.util.UserDataHolder, CachedValueProvider)
|
||||
*/
|
||||
public abstract class CachedValuesManager {
|
||||
private static final NotNullLazyKey<CachedValuesManager, Project> INSTANCE_KEY = ServiceManager.createLazyKey(CachedValuesManager.class);
|
||||
|
||||
@@ -36,7 +45,9 @@ public abstract class CachedValuesManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new CachedValue instance with given provider.
|
||||
* Creates new CachedValue instance with given provider. If the return value is marked as trackable, it's treated as
|
||||
* yet another dependency and must comply its specification. See {@link com.intellij.psi.util.CachedValueProvider.Result#getDependencyItems()} for
|
||||
* the details.
|
||||
*
|
||||
* @param provider computes values.
|
||||
* @param trackValue if value tracking required. T should be trackable in this case.
|
||||
@@ -47,6 +58,10 @@ public abstract class CachedValuesManager {
|
||||
@NotNull
|
||||
public abstract <T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue);
|
||||
|
||||
/**
|
||||
* Rarely needed because it tracks the return value as a dependency.
|
||||
* @return a CachedValue like in {@link #createCachedValue(CachedValueProvider, boolean)}, with trackable return value.
|
||||
*/
|
||||
@NotNull
|
||||
public <T> CachedValue<T> createCachedValue(@NotNull CachedValueProvider<T> provider) {
|
||||
return createCachedValue(provider, true);
|
||||
@@ -93,9 +108,18 @@ public abstract class CachedValuesManager {
|
||||
@NotNull CachedValueProvider<T> provider,
|
||||
boolean trackValue);
|
||||
|
||||
/**
|
||||
* Create a cached value with the given provider and non-tracked return value, store it in the first argument's user data. If it's already stored, reuse it.
|
||||
* @return The cached value
|
||||
*/
|
||||
public <T, D extends UserDataHolder> T getCachedValue(@NotNull D dataHolder, @NotNull CachedValueProvider<T> provider) {
|
||||
return getCachedValue(dataHolder, this.<T>getKeyForClass(provider.getClass()), provider, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a cached value with the given provider and non-tracked return value, store it in PSI element's user data. If it's already stored, reuse it.
|
||||
* @return The cached value
|
||||
*/
|
||||
public static <T> T getCachedValue(@NotNull PsiElement psi, @NotNull CachedValueProvider<T> provider) {
|
||||
CachedValuesManager manager = getManager(psi.getProject());
|
||||
return manager.getCachedValue(psi, manager.<T>getKeyForClass(provider.getClass()), provider, false);
|
||||
|
||||
@@ -22,11 +22,37 @@ import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.util.messages.Topic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An interface used to support tracking of common PSI modifications. It has three main usage patterns:
|
||||
* <ol>
|
||||
* <li/> Get a stamp of current PSI state. This stamp is increased when PSI is modified, allowing other subsystems
|
||||
* to check if PSI has changed since they accessed it last time. This can be used to flush and rebuild various internal caches.
|
||||
* See {@link #getModificationCount()}, {@link #getJavaStructureModificationCount()}, {@link #getOutOfCodeBlockModificationCount()}
|
||||
*
|
||||
* <li/> Make a {@link com.intellij.psi.util.CachedValue} instance dependent on a specific PSI modification tracker.
|
||||
* To achieve that, one should can one of the constants in this interface as {@link com.intellij.psi.util.CachedValueProvider.Result}
|
||||
* dependencies.
|
||||
* See {@link #MODIFICATION_COUNT}, {@link #JAVA_STRUCTURE_MODIFICATION_COUNT}, {@link #OUT_OF_CODE_BLOCK_MODIFICATION_COUNT}
|
||||
*
|
||||
* <li/> Subscribe to any PSI change (for example, to drop caches in the listener manually).
|
||||
* See {@link com.intellij.psi.util.PsiModificationTracker.Listener}
|
||||
*
|
||||
* </ol>
|
||||
*/
|
||||
public interface PsiModificationTracker extends ModificationTracker {
|
||||
|
||||
/**
|
||||
* Provides a way to get the instance of {@link com.intellij.psi.util.PsiModificationTracker} corresponding to a given project.
|
||||
* @see #getInstance(com.intellij.openapi.project.Project)
|
||||
*/
|
||||
class SERVICE {
|
||||
private SERVICE() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return The instance of {@link com.intellij.psi.util.PsiModificationTracker} corresponding to the given project.
|
||||
*/
|
||||
public static PsiModificationTracker getInstance(Project project) {
|
||||
return ServiceManager.getService(project, PsiModificationTracker.class);
|
||||
}
|
||||
@@ -34,42 +60,71 @@ public interface PsiModificationTracker extends ModificationTracker {
|
||||
|
||||
/**
|
||||
* This key can be passed as a dependency in a {@link com.intellij.psi.util.CachedValueProvider}.
|
||||
* The corresponding {@link com.intellij.psi.util.CachedValue} will then be flushed on every physical PSI change.
|
||||
* @see #getModificationCount()
|
||||
*/
|
||||
Key MODIFICATION_COUNT = Key.create("MODIFICATION_COUNT");
|
||||
|
||||
/**
|
||||
* This key can be passed as a dependency in a {@link com.intellij.psi.util.CachedValueProvider}.
|
||||
* The corresponding {@link com.intellij.psi.util.CachedValue} will then be flushed on every physical PSI change that doesn't happen inside a Java code block.
|
||||
* @see #getOutOfCodeBlockModificationCount()
|
||||
*/
|
||||
Key OUT_OF_CODE_BLOCK_MODIFICATION_COUNT = Key.create("OUT_OF_CODE_BLOCK_MODIFICATION_COUNT");
|
||||
|
||||
/**
|
||||
* This key can be passed as a dependency in a {@link com.intellij.psi.util.CachedValueProvider}.
|
||||
* The corresponding {@link com.intellij.psi.util.CachedValue} will then be flushed on every physical PSI change that can affect Java structure and resolve.
|
||||
* @see #getJavaStructureModificationCount()
|
||||
*/
|
||||
Key JAVA_STRUCTURE_MODIFICATION_COUNT = Key.create("JAVA_STRUCTURE_MODIFICATION_COUNT");
|
||||
|
||||
/**
|
||||
* A topic to subscribe for all PSI modification count changes.
|
||||
* @see com.intellij.util.messages.MessageBus
|
||||
*/
|
||||
Topic<Listener> TOPIC = new Topic<Listener>("modification tracker", Listener.class, Topic.BroadcastDirection.TO_PARENT);
|
||||
|
||||
/**
|
||||
* Tracks any PSI modification.
|
||||
* @return current counter value.
|
||||
* @return current counter value. Increased whenever any physical PSI is changed.
|
||||
*/
|
||||
@Override
|
||||
long getModificationCount();
|
||||
|
||||
/**
|
||||
* @return Same as {@link #getJavaStructureModificationCount()}, but also includes changes in non-Java files, e.g. XML. Rarely needed.
|
||||
*/
|
||||
long getOutOfCodeBlockModificationCount();
|
||||
|
||||
/**
|
||||
* @return an object returning {@link #getOutOfCodeBlockModificationCount()}
|
||||
*/
|
||||
@NotNull
|
||||
ModificationTracker getOutOfCodeBlockModificationTracker();
|
||||
|
||||
/**
|
||||
* Tracks structural Java modifications, i.e. the ones on class/method/field/file level. Modifications inside method bodies are not tracked.
|
||||
* Useful to work with resolve caches that only depend on Java structure, and not the method code.
|
||||
* @return current counter value. Increased whenever any physical PSI in Java structure is changed.
|
||||
*/
|
||||
long getJavaStructureModificationCount();
|
||||
|
||||
/**
|
||||
* @return an object returning {@link #getJavaStructureModificationCount()}
|
||||
*/
|
||||
@NotNull
|
||||
ModificationTracker getJavaStructureModificationTracker();
|
||||
|
||||
/**
|
||||
* A listener to be notified on any PSI modification count change (which happens on any physical PSI change).
|
||||
* @see #TOPIC
|
||||
*/
|
||||
interface Listener {
|
||||
|
||||
/**
|
||||
* A method invoked on Swing EventDispatchThread each time any physical PSI change is detected
|
||||
*/
|
||||
void modificationCountChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class FileElement extends LazyParseableElement implements FileASTNode, Ge
|
||||
@Override
|
||||
public LighterAST getLighterAST() {
|
||||
final IFileElementType contentType = (IFileElementType)getElementType();
|
||||
assert contentType instanceof ILightStubFileElementType;
|
||||
assert contentType instanceof ILightStubFileElementType:contentType;
|
||||
|
||||
LighterAST tree;
|
||||
if (!isParsed()) {
|
||||
@@ -65,7 +65,7 @@ public class FileElement extends LazyParseableElement implements FileASTNode, Ge
|
||||
if (tree == null) {
|
||||
final ILightStubFileElementType<?> type = (ILightStubFileElementType)contentType;
|
||||
tree = new FCTSBackedLighterAST(getCharTable(), type.parseContentsLight(this));
|
||||
putUserData(ourTreeKey, new SoftReference<LighterAST>(tree));
|
||||
tree = SoftReference.dereference(putUserDataIfAbsent(ourTreeKey, new SoftReference<LighterAST>(tree)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -84,8 +84,6 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup {
|
||||
myBranchLabel.setBackground(getBackground());
|
||||
myBranchLabel.setForeground(JBColor.GRAY); // different foreground than for other elements
|
||||
}
|
||||
|
||||
adjustOpacity(myBranchLabel, isSelected);
|
||||
}
|
||||
else {
|
||||
myBranchLabel.setVisible(false);
|
||||
@@ -111,4 +109,3 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
Binary file not shown.
|
After Width: | Height: | Size: 249 B |
Binary file not shown.
|
After Width: | Height: | Size: 235 B |
+23
-30
@@ -11,12 +11,11 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.StringInterner;
|
||||
import com.intellij.util.containers.WeakStringInterner;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -33,28 +32,25 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
public static final Key<List<Element>> RUN_EXTENSIONS = Key.create("run.extension.elements");
|
||||
private static final String EXT_ID_ATTR = "ID";
|
||||
private static final String EXTENSION_ROOT_ATTR = "EXTENSION";
|
||||
|
||||
protected final ExtensionPointName<T> myExtensionPointName;
|
||||
private final StringInterner myInterner = new WeakStringInterner();
|
||||
|
||||
public RunConfigurationExtensionsManager(ExtensionPointName<T> extensionPointName) {
|
||||
myExtensionPointName = extensionPointName;
|
||||
}
|
||||
|
||||
public void readExternal(@NotNull final U configuration,
|
||||
@NotNull final Element parentNode) throws InvalidDataException {
|
||||
final List<Element> children = parentNode.getChildren(getExtensionRootAttr());
|
||||
final Map<String, T> extensions = ContainerUtil.newHashMap();
|
||||
public void readExternal(@NotNull U configuration, @NotNull Element parentNode) throws InvalidDataException {
|
||||
Map<String, T> extensions = new THashMap<String, T>();
|
||||
for (T extension : getApplicableExtensions(configuration)) {
|
||||
extensions.put(extension.getSerializationId(), extension);
|
||||
}
|
||||
|
||||
List<Element> children = parentNode.getChildren(getExtensionRootAttr());
|
||||
// if some of extensions settings weren't found we should just keep it because some plugin with extension
|
||||
// may be turned off
|
||||
boolean found = true;
|
||||
for (Object o : children) {
|
||||
final Element element = (Element)o;
|
||||
final String extensionName = element.getAttributeValue(getIdAttrName());
|
||||
final T extension = extensions.remove(extensionName);
|
||||
for (Element element : children) {
|
||||
final T extension = extensions.remove(element.getAttributeValue(getIdAttrName()));
|
||||
if (extension != null) {
|
||||
extension.readExternal(configuration, element);
|
||||
}
|
||||
@@ -65,9 +61,7 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
if (!found) {
|
||||
List<Element> copy = new ArrayList<Element>(children.size());
|
||||
for (Element child : children) {
|
||||
Element clone = child.clone();
|
||||
JDOMUtil.internElement(clone, myInterner);
|
||||
copy.add(clone);
|
||||
copy.add(child.clone());
|
||||
}
|
||||
configuration.putCopyableUserData(RUN_EXTENSIONS, copy);
|
||||
}
|
||||
@@ -81,31 +75,30 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
return EXTENSION_ROOT_ATTR;
|
||||
}
|
||||
|
||||
public void writeExternal(@NotNull final U configuration,
|
||||
@NotNull final Element parentNode) throws WriteExternalException {
|
||||
public void writeExternal(@NotNull U configuration, @NotNull Element parentNode) {
|
||||
final TreeMap<String, Element> map = ContainerUtil.newTreeMap();
|
||||
final List<Element> elements = configuration.getCopyableUserData(RUN_EXTENSIONS);
|
||||
if (elements != null) {
|
||||
for (Element el : elements) {
|
||||
map.put(el.getAttributeValue(getIdAttrName()), el.clone());
|
||||
for (Element element : elements) {
|
||||
map.put(element.getAttributeValue(getIdAttrName()), element.clone());
|
||||
}
|
||||
}
|
||||
|
||||
for (T extension : getApplicableExtensions(configuration)) {
|
||||
Element el = new Element(getExtensionRootAttr());
|
||||
el.setAttribute(getIdAttrName(), extension.getSerializationId());
|
||||
Element element = new Element(getExtensionRootAttr());
|
||||
element.setAttribute(getIdAttrName(), extension.getSerializationId());
|
||||
try {
|
||||
extension.writeExternal(configuration, el);
|
||||
extension.writeExternal(configuration, element);
|
||||
}
|
||||
catch (WriteExternalException e) {
|
||||
catch (WriteExternalException ignored) {
|
||||
map.remove(extension.getSerializationId());
|
||||
continue;
|
||||
}
|
||||
map.put(extension.getSerializationId(), el);
|
||||
map.put(extension.getSerializationId(), element);
|
||||
}
|
||||
|
||||
for (Element val : map.values()) {
|
||||
parentNode.addContent(val);
|
||||
for (Element values : map.values()) {
|
||||
parentNode.addContent(values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,8 +153,8 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
}
|
||||
}
|
||||
|
||||
protected List<T> getApplicableExtensions(@NotNull final U configuration) {
|
||||
final List<T> extensions = new ArrayList<T>();
|
||||
protected List<T> getApplicableExtensions(@NotNull U configuration) {
|
||||
List<T> extensions = new SmartList<T>();
|
||||
for (T extension : Extensions.getExtensions(myExtensionPointName)) {
|
||||
if (extension.isApplicableFor(configuration)) {
|
||||
extensions.add(extension);
|
||||
@@ -170,8 +163,8 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
return extensions;
|
||||
}
|
||||
|
||||
protected List<T> getEnabledExtensions(@NotNull final U configuration, @Nullable RunnerSettings runnerSettings) {
|
||||
final List<T> extensions = new ArrayList<T>();
|
||||
protected List<T> getEnabledExtensions(@NotNull U configuration, @Nullable RunnerSettings runnerSettings) {
|
||||
List<T> extensions = new SmartList<T>();
|
||||
for (T extension : Extensions.getExtensions(myExtensionPointName)) {
|
||||
if (extension.isApplicableFor(configuration) && extension.isEnabledFor(configuration, runnerSettings)) {
|
||||
extensions.add(extension);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.SmartHashSet;
|
||||
@@ -204,13 +203,13 @@ public class LogFileOptions implements JDOMExternalizable {
|
||||
try {
|
||||
setCharset(Charset.forName(charsetStr));
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception ignored) {
|
||||
setCharset(Charset.defaultCharset());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
public void writeExternal(Element element) {
|
||||
element.setAttribute(PATH, FileUtil.toSystemIndependentName(getPathPattern()));
|
||||
element.setAttribute(CHECKED, String.valueOf(isEnabled()));
|
||||
element.setAttribute(SKIPPED, String.valueOf(isSkipContent()));
|
||||
|
||||
-9
@@ -64,15 +64,6 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
|
||||
myModule.setModule(module);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException{
|
||||
super.readExternal(element);
|
||||
}
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException{
|
||||
super.writeExternal(element);
|
||||
}
|
||||
|
||||
protected void readModule(final Element element) throws InvalidDataException {
|
||||
myModule.readExternal(element);
|
||||
}
|
||||
|
||||
+2
-2
@@ -236,10 +236,10 @@ public abstract class RunConfigurationBase extends UserDataHolderBase
|
||||
element.addContent(fileOutputPathElement);
|
||||
}
|
||||
if (myShowConsoleOnStdOut) {//default value shouldn't be written
|
||||
element.setAttribute(SHOW_CONSOLE_ON_STD_OUT, String.valueOf(myShowConsoleOnStdOut));
|
||||
element.setAttribute(SHOW_CONSOLE_ON_STD_OUT, String.valueOf(true));
|
||||
}
|
||||
if (myShowConsoleOnStdErr) {//default value shouldn't be written
|
||||
element.setAttribute(SHOW_CONSOLE_ON_STD_ERR, String.valueOf(myShowConsoleOnStdErr));
|
||||
element.setAttribute(SHOW_CONSOLE_ON_STD_ERR, String.valueOf(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.util.xmlb.Accessor;
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class RunnerSettingsEx implements RunnerSettings {
|
||||
private final Set<String> mySerializedAccessorNameTracker = new THashSet<String>();
|
||||
private final SkipDefaultValuesSerializationFilters mySerializationFilter = new SkipDefaultValuesSerializationFilters() {
|
||||
@Override
|
||||
protected boolean accepts(@NotNull Accessor accessor, @NotNull Object bean, @Nullable Object beanValue) {
|
||||
if (mySerializedAccessorNameTracker.contains(accessor.getName())) {
|
||||
return true;
|
||||
}
|
||||
return super.accepts(accessor, bean, beanValue);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public final void readExternal(Element element) {
|
||||
mySerializedAccessorNameTracker.clear();
|
||||
XmlSerializer.deserializeInto(this, element, mySerializedAccessorNameTracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeExternal(Element element) {
|
||||
XmlSerializer.serializeInto(this, element, mySerializationFilter);
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,6 @@ import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
@@ -40,16 +38,17 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
|
||||
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.arrangement.engine.ArrangementEngine;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -59,6 +58,7 @@ import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@@ -170,6 +170,12 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
if (file == null) return;
|
||||
|
||||
if (!showDialog && processChangedTextOnly && isChangeNotTrackedForFile(project, file)) {
|
||||
processChangedTextOnly = false;
|
||||
}
|
||||
|
||||
final TextRange range;
|
||||
final boolean processSelectedText = !processWholeFile && hasSelection;
|
||||
if (processSelectedText) {
|
||||
@@ -186,7 +192,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
new ReformatCodeProcessor(project, file, range, !processSelectedText && processChangedTextOnly).run();
|
||||
}
|
||||
|
||||
if (rearrangeEntries && file != null && editor != null) {
|
||||
if (rearrangeEntries && editor != null) {
|
||||
SelectionModel selectionModel = editor.getSelectionModel();
|
||||
final TextRange rangeToUse = selectionModel.hasSelection()
|
||||
? TextRange.create(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd())
|
||||
@@ -195,6 +201,19 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isChangeNotTrackedForFile(@NotNull Project project, @NotNull PsiFile file) {
|
||||
boolean isUnderVcs = VcsUtil.isFileUnderVcs(project, VcsUtil.getFilePath(file.getVirtualFile()));
|
||||
if (!isUnderVcs) return true;
|
||||
|
||||
ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project);
|
||||
List<VirtualFile> unversionedFiles = changeListManager.getUnversionedFiles();
|
||||
if (unversionedFiles.contains(file.getVirtualFile())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static DirectoryFormattingOptions getDirectoryFormattingOptions(@NotNull Project project, @NotNull PsiDirectory dir) {
|
||||
LayoutDirectoryDialog dialog = new LayoutDirectoryDialog(
|
||||
|
||||
+6
-4
@@ -16,21 +16,18 @@
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.actions.CodeCleanupAction;
|
||||
import com.intellij.codeInspection.ex.InspectionToolWrapper;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.profile.codeInspection.ui.IDEInspectionToolsConfigurable;
|
||||
import com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by anna on 5/13/2014.
|
||||
*/
|
||||
@@ -64,6 +61,11 @@ class EditCleanupProfileIntentionAction implements IntentionAction {
|
||||
protected boolean acceptTool(InspectionToolWrapper entry) {
|
||||
return super.acceptTool(entry) && entry.isCleanupTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
|
||||
}
|
||||
};
|
||||
ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ import com.intellij.profile.codeInspection.ui.IDEInspectionToolsConfigurable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CodeCleanupAction extends CodeInspectionAction {
|
||||
|
||||
public static final String CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME = "Code Cleanup Inspections";
|
||||
|
||||
public CodeCleanupAction() {
|
||||
super("Code Cleanup", "Code Cleanup");
|
||||
}
|
||||
@@ -48,6 +51,11 @@ public class CodeCleanupAction extends CodeInspectionAction {
|
||||
protected boolean acceptTool(InspectionToolWrapper entry) {
|
||||
return super.acceptTool(entry) && entry.isCleanupTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWit
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeExternal(Element element, Map<String, String> envs) {
|
||||
public static void writeExternal(@NotNull Element element, @NotNull Map<String, String> envs) {
|
||||
final Element envsElement = new Element(ENVS);
|
||||
for (String envName : envs.keySet()) {
|
||||
final Element envElement = new Element(ENV);
|
||||
|
||||
+168
-182
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.*;
|
||||
@@ -24,7 +23,8 @@ import com.intellij.openapi.extensions.ExtensionException;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.StringInterner;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -38,12 +38,20 @@ import java.util.*;
|
||||
public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, Cloneable, RunnerAndConfigurationSettings, Comparable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.impl.RunnerAndConfigurationSettings");
|
||||
|
||||
@NonNls
|
||||
private static final String RUNNER_ELEMENT = "RunnerSettings";
|
||||
@NonNls
|
||||
private static final String CONFIGURATION_ELEMENT = "ConfigurationWrapper";
|
||||
@NonNls
|
||||
private static final String RUNNER_ID = "RunnerId";
|
||||
|
||||
private static final Comparator<Element> RUNNER_COMPARATOR = new Comparator<Element>() {
|
||||
@Override
|
||||
public int compare(@NotNull Element o1, @NotNull Element o2) {
|
||||
String attributeValue1 = o1.getAttributeValue(RUNNER_ID);
|
||||
if (attributeValue1 == null) {
|
||||
return 1;
|
||||
}
|
||||
return StringUtil.compare(attributeValue1, o2.getAttributeValue(RUNNER_ID), false);
|
||||
}
|
||||
};
|
||||
|
||||
@NonNls
|
||||
private static final String CONFIGURATION_TYPE_ATTRIBUTE = "type";
|
||||
@NonNls
|
||||
@@ -57,7 +65,7 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
//@NonNls
|
||||
//public static final String UNIQUE_ID = "id";
|
||||
@NonNls
|
||||
protected static final String DUMMY_ELEMENT_NANE = "dummy";
|
||||
protected static final String DUMMY_ELEMENT_NAME = "dummy";
|
||||
@NonNls
|
||||
private static final String TEMPORARY_ATTRIBUTE = "temporary";
|
||||
@NonNls
|
||||
@@ -65,7 +73,6 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
@NonNls
|
||||
public static final String SINGLETON = "singleton";
|
||||
|
||||
|
||||
/** for compatibility */
|
||||
@NonNls
|
||||
private static final String TEMP_CONFIGURATION = "tempConfiguration";
|
||||
@@ -74,11 +81,19 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
private RunConfiguration myConfiguration;
|
||||
private boolean myIsTemplate;
|
||||
|
||||
private final Map<ProgramRunner, RunnerSettings> myRunnerSettings = new HashMap<ProgramRunner, RunnerSettings>();
|
||||
private List<Element> myUnloadedRunnerSettings = null;
|
||||
private final RunnerItem<RunnerSettings> myRunnerSettings = new RunnerItem<RunnerSettings>("RunnerSettings") {
|
||||
@Override
|
||||
protected RunnerSettings createSettings(@NotNull ProgramRunner runner) {
|
||||
return runner.createConfigurationData(new InfoProvider(runner));
|
||||
}
|
||||
};
|
||||
|
||||
private final Map<ProgramRunner, ConfigurationPerRunnerSettings> myConfigurationPerRunnerSettings = new HashMap<ProgramRunner, ConfigurationPerRunnerSettings>();
|
||||
private List<Element> myUnloadedConfigurationPerRunnerSettings = null;
|
||||
private final RunnerItem<ConfigurationPerRunnerSettings> myConfigurationPerRunnerSettings = new RunnerItem<ConfigurationPerRunnerSettings>("ConfigurationWrapper") {
|
||||
@Override
|
||||
protected ConfigurationPerRunnerSettings createSettings(@NotNull ProgramRunner runner) {
|
||||
return myConfiguration.createRunnerSettings(new InfoProvider(runner));
|
||||
}
|
||||
};
|
||||
|
||||
private boolean myTemporary;
|
||||
private boolean myEditBeforeRun;
|
||||
@@ -91,6 +106,100 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
myManager = manager;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private abstract class RunnerItem<T> {
|
||||
private final Map<ProgramRunner, T> settings = new THashMap<ProgramRunner, T>();
|
||||
|
||||
private List<Element> unloadedSettings;
|
||||
// to avoid changed files
|
||||
private final Set<String> loadedIds = new THashSet<String>();
|
||||
|
||||
private final String childTagName;
|
||||
|
||||
RunnerItem(@NotNull String childTagName) {
|
||||
this.childTagName = childTagName;
|
||||
}
|
||||
|
||||
public void loadState(@NotNull Element element) throws InvalidDataException {
|
||||
settings.clear();
|
||||
if (unloadedSettings != null) {
|
||||
unloadedSettings.clear();
|
||||
}
|
||||
loadedIds.clear();
|
||||
|
||||
for (Iterator<Element> iterator = element.getChildren(childTagName).iterator(); iterator.hasNext(); ) {
|
||||
Element state = iterator.next();
|
||||
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(state.getAttributeValue(RUNNER_ID));
|
||||
if (runner == null) {
|
||||
iterator.remove();
|
||||
}
|
||||
add(state, runner, runner == null ? null : createSettings(runner));
|
||||
}
|
||||
}
|
||||
|
||||
public void getState(@NotNull Element element) throws WriteExternalException {
|
||||
List<Element> runnerSettings = new SmartList<Element>();
|
||||
for (ProgramRunner runner : settings.keySet()) {
|
||||
T settings = this.settings.get(runner);
|
||||
boolean wasLoaded = loadedIds.contains(runner.getRunnerId());
|
||||
if (settings == null && !wasLoaded) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Element state = new Element(childTagName);
|
||||
if (settings != null) {
|
||||
((JDOMExternalizable)settings).writeExternal(state);
|
||||
}
|
||||
if (wasLoaded || !JDOMUtil.isEmpty(state)) {
|
||||
state.setAttribute(RUNNER_ID, runner.getRunnerId());
|
||||
runnerSettings.add(state);
|
||||
}
|
||||
}
|
||||
if (unloadedSettings != null) {
|
||||
for (Element unloadedSetting : unloadedSettings) {
|
||||
runnerSettings.add(unloadedSetting.clone());
|
||||
}
|
||||
}
|
||||
Collections.sort(runnerSettings, RUNNER_COMPARATOR);
|
||||
for (Element runnerSetting : runnerSettings) {
|
||||
element.addContent(runnerSetting);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract T createSettings(@NotNull ProgramRunner runner);
|
||||
|
||||
private void add(@NotNull Element state, @Nullable ProgramRunner runner, @Nullable T data) throws InvalidDataException {
|
||||
if (runner == null) {
|
||||
if (unloadedSettings == null) {
|
||||
unloadedSettings = new SmartList<Element>();
|
||||
}
|
||||
unloadedSettings.add(state);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data != null) {
|
||||
((JDOMExternalizable)data).readExternal(state);
|
||||
}
|
||||
|
||||
settings.put(runner, data);
|
||||
loadedIds.add(runner.getRunnerId());
|
||||
}
|
||||
|
||||
public T getOrCreateSettings(@NotNull ProgramRunner runner) {
|
||||
T result = settings.get(runner);
|
||||
if (result == null) {
|
||||
try {
|
||||
result = createSettings(runner);
|
||||
settings.put(runner, result);
|
||||
}
|
||||
catch (AbstractMethodError ignored) {
|
||||
LOG.error("Update failed for: " + myConfiguration.getType().getDisplayName() + ", runner: " + runner.getRunnerId(), new ExtensionException(runner.getClass()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public RunnerAndConfigurationSettingsImpl(RunManagerImpl manager, @NotNull RunConfiguration configuration, boolean isTemplate) {
|
||||
myManager = manager;
|
||||
myConfiguration = configuration;
|
||||
@@ -146,6 +255,7 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
|
||||
@Override
|
||||
public String getUniqueID() {
|
||||
//noinspection deprecation
|
||||
return myConfiguration.getType().getDisplayName() + "." + myConfiguration.getName() +
|
||||
(myConfiguration instanceof UnknownRunConfiguration ? myConfiguration.getUniqueID() : "");
|
||||
//if (myID == null) {
|
||||
@@ -220,58 +330,21 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
|
||||
if (myIsTemplate) {
|
||||
myConfiguration = myManager.getConfigurationTemplate(factory).getConfiguration();
|
||||
} else {
|
||||
final String name = element.getAttributeValue(NAME_ATTR);
|
||||
}
|
||||
else {
|
||||
// shouldn't call createConfiguration since it calls StepBeforeRunProviders that
|
||||
// may not be loaded yet. This creates initialization order issue.
|
||||
myConfiguration = myManager.doCreateConfiguration(name, factory, false);
|
||||
myConfiguration = myManager.doCreateConfiguration(element.getAttributeValue(NAME_ATTR), factory, false);
|
||||
}
|
||||
|
||||
myConfiguration.readExternal(element);
|
||||
List<Element> runners = element.getChildren(RUNNER_ELEMENT);
|
||||
myUnloadedRunnerSettings = null;
|
||||
StringInterner interner = new StringInterner();
|
||||
for (final Element runnerElement : runners) {
|
||||
String id = runnerElement.getAttributeValue(RUNNER_ID);
|
||||
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(id);
|
||||
if (runner != null) {
|
||||
RunnerSettings settings = createRunnerSettings(runner);
|
||||
if (settings != null) {
|
||||
settings.readExternal(runnerElement);
|
||||
}
|
||||
myRunnerSettings.put(runner, settings);
|
||||
}
|
||||
else {
|
||||
if (myUnloadedRunnerSettings == null) myUnloadedRunnerSettings = new SmartList<Element>();
|
||||
JDOMUtil.internElement(runnerElement, interner);
|
||||
myUnloadedRunnerSettings.add(runnerElement);
|
||||
}
|
||||
}
|
||||
|
||||
List configurations = element.getChildren(CONFIGURATION_ELEMENT);
|
||||
myUnloadedConfigurationPerRunnerSettings = null;
|
||||
for (final Object configuration : configurations) {
|
||||
Element configurationElement = (Element) configuration;
|
||||
String id = configurationElement.getAttributeValue(RUNNER_ID);
|
||||
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(id);
|
||||
if (runner != null) {
|
||||
ConfigurationPerRunnerSettings settings = myConfiguration.createRunnerSettings(new InfoProvider(runner));
|
||||
if (settings != null) {
|
||||
settings.readExternal(configurationElement);
|
||||
}
|
||||
myConfigurationPerRunnerSettings.put(runner, settings);
|
||||
} else {
|
||||
if (myUnloadedConfigurationPerRunnerSettings == null)
|
||||
myUnloadedConfigurationPerRunnerSettings = new ArrayList<Element>(1);
|
||||
myUnloadedConfigurationPerRunnerSettings.add(configurationElement);
|
||||
}
|
||||
}
|
||||
myRunnerSettings.loadState(element);
|
||||
myConfigurationPerRunnerSettings.loadState(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
final ConfigurationFactory factory = myConfiguration.getFactory();
|
||||
|
||||
if (!(myConfiguration instanceof UnknownRunConfiguration)) {
|
||||
element.setAttribute(TEMPLATE_FLAG_ATTRIBUTE, String.valueOf(myIsTemplate));
|
||||
if (!myIsTemplate) {
|
||||
@@ -284,66 +357,22 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
}
|
||||
//element.setAttribute(UNIQUE_ID, getUniqueID());
|
||||
|
||||
if (isEditBeforeRun()) element.setAttribute(EDIT_BEFORE_RUN, String.valueOf(true));
|
||||
if (isEditBeforeRun()) {
|
||||
element.setAttribute(EDIT_BEFORE_RUN, String.valueOf(true));
|
||||
}
|
||||
if (myWasSingletonSpecifiedExplicitly || mySingleton != factory.isConfigurationSingletonByDefault()) {
|
||||
element.setAttribute(SINGLETON, String.valueOf(mySingleton));
|
||||
}
|
||||
if (myTemporary) {
|
||||
element.setAttribute(TEMPORARY_ATTRIBUTE, Boolean.toString(myTemporary));
|
||||
element.setAttribute(TEMPORARY_ATTRIBUTE, Boolean.toString(true));
|
||||
}
|
||||
}
|
||||
|
||||
myConfiguration.writeExternal(element);
|
||||
|
||||
if (!(myConfiguration instanceof UnknownRunConfiguration)) {
|
||||
final Comparator<Element> runnerComparator = createRunnerComparator();
|
||||
writeRunnerSettings(runnerComparator, element);
|
||||
writeConfigurationPerRunnerSettings(runnerComparator, element);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeConfigurationPerRunnerSettings(final Comparator<Element> runnerComparator, final Element element)
|
||||
throws WriteExternalException {
|
||||
final ArrayList<Element> configurationPerRunnerSettings = new ArrayList<Element>();
|
||||
for (ProgramRunner runner : myConfigurationPerRunnerSettings.keySet()) {
|
||||
ConfigurationPerRunnerSettings settings = myConfigurationPerRunnerSettings.get(runner);
|
||||
Element runnerElement = new Element(CONFIGURATION_ELEMENT);
|
||||
if (settings != null) {
|
||||
settings.writeExternal(runnerElement);
|
||||
}
|
||||
runnerElement.setAttribute(RUNNER_ID, runner.getRunnerId());
|
||||
configurationPerRunnerSettings.add(runnerElement);
|
||||
}
|
||||
if (myUnloadedConfigurationPerRunnerSettings != null) {
|
||||
for (Element unloadedCRunnerSetting : myUnloadedConfigurationPerRunnerSettings) {
|
||||
configurationPerRunnerSettings.add(unloadedCRunnerSetting.clone());
|
||||
}
|
||||
}
|
||||
Collections.sort(configurationPerRunnerSettings, runnerComparator);
|
||||
for (Element runnerConfigurationSetting : configurationPerRunnerSettings) {
|
||||
element.addContent(runnerConfigurationSetting);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeRunnerSettings(final Comparator<Element> runnerComparator, final Element element) throws WriteExternalException {
|
||||
final ArrayList<Element> runnerSettings = new ArrayList<Element>();
|
||||
for (ProgramRunner runner : myRunnerSettings.keySet()) {
|
||||
RunnerSettings settings = myRunnerSettings.get(runner);
|
||||
Element runnerElement = new Element(RUNNER_ELEMENT);
|
||||
if (settings != null) {
|
||||
settings.writeExternal(runnerElement);
|
||||
}
|
||||
runnerElement.setAttribute(RUNNER_ID, runner.getRunnerId());
|
||||
runnerSettings.add(runnerElement);
|
||||
}
|
||||
if (myUnloadedRunnerSettings != null) {
|
||||
for (Element unloadedRunnerSetting : myUnloadedRunnerSettings) {
|
||||
runnerSettings.add(unloadedRunnerSetting.clone());
|
||||
}
|
||||
}
|
||||
Collections.sort(runnerSettings, runnerComparator);
|
||||
for (Element runnerSetting : runnerSettings) {
|
||||
element.addContent(runnerSetting);
|
||||
myRunnerSettings.getState(element);
|
||||
myConfigurationPerRunnerSettings.getState(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,12 +386,12 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
myConfiguration.checkConfiguration();
|
||||
if (myConfiguration instanceof RunConfigurationBase) {
|
||||
final RunConfigurationBase runConfigurationBase = (RunConfigurationBase) myConfiguration;
|
||||
Set<ProgramRunner> runners = new HashSet<ProgramRunner>();
|
||||
runners.addAll(myRunnerSettings.keySet());
|
||||
runners.addAll(myConfigurationPerRunnerSettings.keySet());
|
||||
Set<ProgramRunner> runners = new THashSet<ProgramRunner>();
|
||||
runners.addAll(myRunnerSettings.settings.keySet());
|
||||
runners.addAll(myConfigurationPerRunnerSettings.settings.keySet());
|
||||
for (ProgramRunner runner : runners) {
|
||||
if (executor == null || runner.canRun(executor.getId(), myConfiguration)) {
|
||||
runConfigurationBase.checkRunnerSettings(runner, myRunnerSettings.get(runner), myConfigurationPerRunnerSettings.get(runner));
|
||||
runConfigurationBase.checkRunnerSettings(runner, myRunnerSettings.settings.get(runner), myConfigurationPerRunnerSettings.settings.get(runner));
|
||||
}
|
||||
}
|
||||
if (executor != null) {
|
||||
@@ -379,48 +408,15 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Comparator<Element> createRunnerComparator() {
|
||||
return new Comparator<Element>() {
|
||||
@Override
|
||||
public int compare(final Element o1, final Element o2) {
|
||||
final String attributeValue1 = o1.getAttributeValue(RUNNER_ID);
|
||||
if (attributeValue1 == null) {
|
||||
return 1;
|
||||
|
||||
}
|
||||
final String attributeValue2 = o2.getAttributeValue(RUNNER_ID);
|
||||
if (attributeValue2 == null) {
|
||||
return -1;
|
||||
}
|
||||
return attributeValue1.compareTo(attributeValue2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunnerSettings getRunnerSettings(@NotNull ProgramRunner runner) {
|
||||
if (!myRunnerSettings.containsKey(runner)) {
|
||||
try {
|
||||
RunnerSettings runnerSettings = createRunnerSettings(runner);
|
||||
myRunnerSettings.put(runner, runnerSettings);
|
||||
return runnerSettings;
|
||||
}
|
||||
catch (AbstractMethodError e) {
|
||||
LOG.error("Update failed for: " + myConfiguration.getType().getDisplayName() + ", runner: " + runner.getRunnerId(), new ExtensionException(runner.getClass()));
|
||||
}
|
||||
}
|
||||
return myRunnerSettings.get(runner);
|
||||
return myRunnerSettings.getOrCreateSettings(runner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ConfigurationPerRunnerSettings getConfigurationSettings(@NotNull ProgramRunner runner) {
|
||||
if (!myConfigurationPerRunnerSettings.containsKey(runner)) {
|
||||
ConfigurationPerRunnerSettings settings = myConfiguration.createRunnerSettings(new InfoProvider(runner));
|
||||
myConfigurationPerRunnerSettings.put(runner, settings);
|
||||
return settings;
|
||||
}
|
||||
return myConfigurationPerRunnerSettings.get(runner);
|
||||
return myConfigurationPerRunnerSettings.getOrCreateSettings(runner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -437,49 +433,39 @@ public class RunnerAndConfigurationSettingsImpl implements JDOMExternalizable, C
|
||||
}
|
||||
|
||||
public void importRunnerAndConfigurationSettings(RunnerAndConfigurationSettingsImpl template) {
|
||||
try {
|
||||
for (ProgramRunner runner : template.myRunnerSettings.keySet()) {
|
||||
RunnerSettings data = createRunnerSettings(runner);
|
||||
myRunnerSettings.put(runner, data);
|
||||
if (data != null) {
|
||||
Element temp = new Element(DUMMY_ELEMENT_NANE);
|
||||
RunnerSettings templateSettings = template.myRunnerSettings.get(runner);
|
||||
if (templateSettings != null) {
|
||||
templateSettings.writeExternal(temp);
|
||||
data.readExternal(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
importFromTemplate(template.myRunnerSettings, myRunnerSettings);
|
||||
importFromTemplate(template.myConfigurationPerRunnerSettings, myConfigurationPerRunnerSettings);
|
||||
|
||||
for (ProgramRunner runner : template.myConfigurationPerRunnerSettings.keySet()) {
|
||||
ConfigurationPerRunnerSettings data = myConfiguration.createRunnerSettings(new InfoProvider(runner));
|
||||
myConfigurationPerRunnerSettings.put(runner, data);
|
||||
if (data != null) {
|
||||
Element temp = new Element(DUMMY_ELEMENT_NANE);
|
||||
ConfigurationPerRunnerSettings templateSettings = template.myConfigurationPerRunnerSettings.get(runner);
|
||||
if (templateSettings != null) {
|
||||
templateSettings.writeExternal(temp);
|
||||
data.readExternal(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
setSingleton(template.isSingleton());
|
||||
setEditBeforeRun(template.isEditBeforeRun());
|
||||
}
|
||||
catch (WriteExternalException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (InvalidDataException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
setSingleton(template.isSingleton());
|
||||
setEditBeforeRun(template.isEditBeforeRun());
|
||||
}
|
||||
|
||||
private RunnerSettings createRunnerSettings(final ProgramRunner runner) {
|
||||
return runner.createConfigurationData(new InfoProvider(runner));
|
||||
@SuppressWarnings("deprecation")
|
||||
private <T> void importFromTemplate(@NotNull RunnerItem<T> templateItem, @NotNull RunnerItem<T> item) {
|
||||
for (ProgramRunner runner : templateItem.settings.keySet()) {
|
||||
T data = item.createSettings(runner);
|
||||
item.settings.put(runner, data);
|
||||
if (data != null) {
|
||||
Element temp = new Element(DUMMY_ELEMENT_NAME);
|
||||
T templateSettings = templateItem.settings.get(runner);
|
||||
if (templateSettings != null) {
|
||||
try {
|
||||
((JDOMExternalizable)templateSettings).writeExternal(temp);
|
||||
((JDOMExternalizable)data).readExternal(temp);
|
||||
}
|
||||
catch (WriteExternalException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (InvalidDataException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final Object o) {
|
||||
public int compareTo(@NotNull final Object o) {
|
||||
if (o instanceof RunnerAndConfigurationSettings) {
|
||||
return getName().compareTo(((RunnerAndConfigurationSettings) o).getName());
|
||||
}
|
||||
|
||||
+1
-1
@@ -327,7 +327,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con
|
||||
});
|
||||
|
||||
myMainPanel = new JPanel(new BorderLayout());
|
||||
Splitter splitter = new Splitter();
|
||||
Splitter splitter = new Splitter(false, 0.3f);
|
||||
JPanel leftPanel = new JPanel(new BorderLayout());
|
||||
leftPanel.add(myToolBar, BorderLayout.NORTH);
|
||||
leftPanel.add(myTabbedPane.getComponent(), BorderLayout.CENTER);
|
||||
|
||||
+7
-1
@@ -42,6 +42,7 @@ import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
|
||||
import com.intellij.openapi.fileTypes.*;
|
||||
import com.intellij.openapi.fileTypes.ex.FileTypeChooser;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -316,9 +317,14 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
myTemplate.setText(myTemplateEditor.getDocument().getText());
|
||||
String name = myNameField.getText();
|
||||
String extension = myExtensionField.getText();
|
||||
if (name.length() == 0 || !isValidFilename(name + "." + extension)) {
|
||||
String filename = name + "." + extension;
|
||||
if (name.length() == 0 || !isValidFilename(filename)) {
|
||||
throw new ConfigurationException(IdeBundle.message("error.invalid.template.file.name.or.extension"));
|
||||
}
|
||||
FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(filename);
|
||||
if (fileType == UnknownFileType.INSTANCE) {
|
||||
FileTypeChooser.associateFileType(filename);
|
||||
}
|
||||
myTemplate.setName(name);
|
||||
myTemplate.setExtension(extension);
|
||||
myTemplate.setReformatCode(myAdjustBox.isSelected());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.packageDependencies.ui;
|
||||
|
||||
import com.intellij.analysis.AnalysisScopeBundle;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.dnd.aware.DnDAwareTree;
|
||||
import com.intellij.ide.projectView.impl.ModuleGroup;
|
||||
import com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper;
|
||||
@@ -73,6 +74,8 @@ public class FileTreeModelBuilder {
|
||||
private final Map<VirtualFile,DirectoryNode> myModuleDirNodes = new HashMap<VirtualFile, DirectoryNode>();
|
||||
private final Map<Module, ModuleNode> myModuleNodes = new HashMap<Module, ModuleNode>();
|
||||
private final Map<String, ModuleGroupNode> myModuleGroupNodes = new HashMap<String, ModuleGroupNode>();
|
||||
private GeneralGroupNode myExternalNode;
|
||||
|
||||
private int myScannedFileCount = 0;
|
||||
private int myTotalFileCount = 0;
|
||||
private int myMarkedFileCount = 0;
|
||||
@@ -540,6 +543,13 @@ public class FileTreeModelBuilder {
|
||||
}
|
||||
if (root != null) {
|
||||
getModuleDirNode(root, module, null).add(directoryNode);
|
||||
} else {
|
||||
if (myExternalNode == null) {
|
||||
myExternalNode = new GeneralGroupNode("External Dependencies", AllIcons.Nodes.PpLibFolder, myProject);
|
||||
myRoot.add(myExternalNode);
|
||||
}
|
||||
|
||||
myExternalNode.add(directoryNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class GeneralGroupNode extends PackageDependenciesNode {
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return 2;
|
||||
return 6;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -24,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PtyCommandLine extends GeneralCommandLine {
|
||||
|
||||
@NotNull
|
||||
public Process startProcessWithPty(@NotNull List<String> commands, boolean console) throws IOException {
|
||||
Map<String, String> env = Maps.newHashMap();
|
||||
Map<String, String> env = new HashMap<String, String>();
|
||||
setupEnvironment(env);
|
||||
|
||||
if (isRedirectErrorStream()) {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.intellij.execution.process;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
public class ColoredProcessHandler extends OSProcessHandler implements AnsiEscapeDecoder.ColoredTextAcceptor {
|
||||
private final AnsiEscapeDecoder myAnsiEscapeDecoder = new AnsiEscapeDecoder();
|
||||
|
||||
private final List<AnsiEscapeDecoder.ColoredTextAcceptor> myColoredTextListeners = Lists.newArrayList();
|
||||
private final List<AnsiEscapeDecoder.ColoredTextAcceptor> myColoredTextListeners = ContainerUtil.newArrayList();
|
||||
|
||||
public ColoredProcessHandler(final GeneralCommandLine commandLine) throws ExecutionException {
|
||||
super(commandLine.createProcess(), commandLine.getCommandLineString(), commandLine.getCharset());
|
||||
|
||||
@@ -73,13 +73,13 @@ public abstract class GroupedElementsRenderer {
|
||||
setDeselected(myTextLabel);
|
||||
}
|
||||
|
||||
adjustOpacity(myTextLabel, isSelected);
|
||||
|
||||
myRendererComponent.setPrefereedWidth(preferredForcedWidth);
|
||||
|
||||
return myRendererComponent;
|
||||
}
|
||||
|
||||
/** @deprecated backgrounds are set uniformly via setSelected() / setDeselected() (to be removed in IDEA 16) */
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
protected static void adjustOpacity(JComponent component, boolean selected) {
|
||||
if (selected) {
|
||||
if (UIUtil.isUnderNimbusLookAndFeel()) {
|
||||
@@ -94,13 +94,12 @@ public abstract class GroupedElementsRenderer {
|
||||
}
|
||||
|
||||
protected final void setSelected(JComponent aComponent) {
|
||||
aComponent.setBackground(getSelectionBackground());
|
||||
UIUtil.setBackgroundRecursively(aComponent, getSelectionBackground());
|
||||
aComponent.setForeground(getSelectionForeground());
|
||||
}
|
||||
|
||||
|
||||
protected final void setDeselected(JComponent aComponent) {
|
||||
aComponent.setBackground(getBackground());
|
||||
UIUtil.setBackgroundRecursively(aComponent, getBackground());
|
||||
aComponent.setForeground(getForeground());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
|
||||
private int myRowHeight = -1;
|
||||
private boolean myRowHeightIsExplicitlySet;
|
||||
private boolean myRowHeightIsComputing;
|
||||
private boolean myUiUpdating = true;
|
||||
|
||||
private Integer myMinRowHeight;
|
||||
private boolean myStriped;
|
||||
@@ -139,6 +140,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
|
||||
|
||||
//noinspection UnusedDeclaration
|
||||
boolean marker = Patches.SUN_BUG_ID_4503845; // Don't remove. It's a marker for find usages
|
||||
|
||||
myUiUpdating = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,16 +187,24 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
|
||||
|
||||
@Override
|
||||
public void setRowHeight(int rowHeight) {
|
||||
myRowHeight = rowHeight;
|
||||
myRowHeightIsExplicitlySet = true;
|
||||
if (!myUiUpdating || !UIUtil.isUnderGTKLookAndFeel()) {
|
||||
myRowHeight = rowHeight;
|
||||
myRowHeightIsExplicitlySet = true;
|
||||
}
|
||||
// call super to clean rowModel
|
||||
super.setRowHeight(rowHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
myMinRowHeight = null;
|
||||
myUiUpdating = true;
|
||||
try {
|
||||
super.updateUI();
|
||||
myMinRowHeight = null;
|
||||
}
|
||||
finally {
|
||||
myUiUpdating = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void repaintViewport() {
|
||||
@@ -808,4 +819,3 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.JBCardLayout;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -33,7 +34,8 @@ import java.util.List;
|
||||
|
||||
public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionListener {
|
||||
private static final String BUTTONS = "BUTTONS";
|
||||
private static final String NOBUTTONS = "NOBUTTONS";
|
||||
private static final String NO_BUTTONS = "NO_BUTTONS";
|
||||
|
||||
private final JButton mySkipButton = new JButton("Skip All and Set Defaults");
|
||||
private final JButton myBackButton = new JButton("Back");
|
||||
private final JButton myNextButton = new JButton("Next");
|
||||
@@ -68,11 +70,11 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
final CustomizeIDEWizardStepsProvider provider;
|
||||
|
||||
try {
|
||||
Class<CustomizeIDEWizardStepsProvider> providerClass = (Class<CustomizeIDEWizardStepsProvider>)Class.forName(stepsProviderName);
|
||||
provider = providerClass.newInstance();
|
||||
Class<?> providerClass = Class.forName(stepsProviderName);
|
||||
provider = (CustomizeIDEWizardStepsProvider)providerClass.newInstance();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
Main.showMessage("Start Failed", e);
|
||||
Main.showMessage("Configuration Wizard Failed", e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,17 +150,17 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
buttonPanel.add(myNextButton, gbc);
|
||||
buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
|
||||
myButtonWrapper.add(buttonPanel, BUTTONS);
|
||||
myButtonWrapper.add(new JLabel(), NOBUTTONS);
|
||||
myButtonWrapper.add(new JLabel(), NO_BUTTONS);
|
||||
myButtonWrapperLayout.show(myButtonWrapper, BUTTONS);
|
||||
return myButtonWrapper;
|
||||
}
|
||||
|
||||
void setButtonsVisible(boolean visible) {
|
||||
myButtonWrapperLayout.show(myButtonWrapper, visible ? BUTTONS : NOBUTTONS);
|
||||
myButtonWrapperLayout.show(myButtonWrapper, visible ? BUTTONS : NO_BUTTONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
if (e.getSource() == mySkipButton) {
|
||||
doOKAction();
|
||||
return;
|
||||
|
||||
@@ -243,7 +243,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
@Override
|
||||
public void run() {
|
||||
fixGtkPopupStyle();
|
||||
patchOptionPaneIcons(UIManager.getLookAndFeelDefaults());
|
||||
patchGtkDefaults(UIManager.getLookAndFeelDefaults());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -535,7 +535,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
|
||||
patchLafFonts(uiDefaults);
|
||||
|
||||
patchOptionPaneIcons(uiDefaults);
|
||||
patchGtkDefaults(uiDefaults);
|
||||
|
||||
fixSeparatorColor(uiDefaults);
|
||||
|
||||
@@ -695,13 +695,12 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
}
|
||||
}
|
||||
|
||||
private static void patchOptionPaneIcons(UIDefaults defaults) {
|
||||
private static void patchGtkDefaults(UIDefaults defaults) {
|
||||
if (!UIUtil.isUnderGTKLookAndFeel()) return;
|
||||
|
||||
Map<String, Icon> map = ContainerUtil.newHashMap(
|
||||
Arrays.asList("OptionPane.errorIcon", "OptionPane.informationIcon", "OptionPane.warningIcon", "OptionPane.questionIcon"),
|
||||
Arrays.asList(AllIcons.General.ErrorDialog, AllIcons.General.InformationDialog, AllIcons.General.WarningDialog, AllIcons.General.QuestionDialog));
|
||||
|
||||
// GTK+ L&F keeps icons hidden in style
|
||||
SynthStyle style = SynthLookAndFeel.getStyle(new JOptionPane(""), Region.DESKTOP_ICON);
|
||||
for (String key : map.keySet()) {
|
||||
@@ -710,6 +709,12 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
Object icon = style == null ? null : style.get(null, key);
|
||||
defaults.put(key, icon instanceof Icon ? icon : map.get(key));
|
||||
}
|
||||
|
||||
Color fg = defaults.getColor("Label.foreground");
|
||||
Color bg = defaults.getColor("Label.background");
|
||||
if (fg != null && bg != null) {
|
||||
defaults.put("Label.disabledForeground", UIUtil.mix(fg, bg, 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
private void patchLafFonts(UIDefaults uiDefaults) {
|
||||
|
||||
@@ -121,7 +121,7 @@ public class IdeaLogger extends Logger {
|
||||
@Override
|
||||
public void error(String message, @Nullable Throwable t, @NotNull String... details) {
|
||||
if (t instanceof ProcessCanceledException) {
|
||||
myLogger.error(new Throwable("Do not log ProcessCanceledException").initCause(t));
|
||||
myLogger.error(message, new Throwable("Do not log ProcessCanceledException").initCause(t));
|
||||
throw (ProcessCanceledException)t;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.intellij.idea;
|
||||
|
||||
import com.intellij.ide.customize.CustomizeIDEWizardDialog;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.ide.startupWizard.StartupWizard;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.ConfigImportHelper;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -30,6 +34,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.AppUIUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EnvironmentUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import com.sun.jna.Native;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -66,14 +71,14 @@ public class StartupUtil {
|
||||
ourLock.setActivateListener(consumer);
|
||||
}
|
||||
|
||||
interface AppStarter {
|
||||
void start(boolean newConfigFolder);
|
||||
}
|
||||
|
||||
public synchronized static int getAcquiredPort() {
|
||||
return ourLock.getAcquiredPort();
|
||||
}
|
||||
|
||||
interface AppStarter {
|
||||
void start(boolean newConfigFolder);
|
||||
}
|
||||
|
||||
static void prepareAndStart(String[] args, AppStarter appStarter) {
|
||||
boolean newConfigFolder = false;
|
||||
|
||||
@@ -294,4 +299,29 @@ public class StartupUtil {
|
||||
log.info("JVM Args: " + StringUtil.join(arguments, " "));
|
||||
}
|
||||
}
|
||||
|
||||
static void runStartupWizard() {
|
||||
ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
|
||||
|
||||
String stepsProvider = appInfo.getCustomizeIDEWizardStepsProvider();
|
||||
if (stepsProvider != null) {
|
||||
CustomizeIDEWizardDialog.showCustomSteps(stepsProvider);
|
||||
PluginManagerCore.invalidatePlugins();
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlatformUtils.isIntelliJ()) {
|
||||
new CustomizeIDEWizardDialog().show();
|
||||
PluginManagerCore.invalidatePlugins();
|
||||
return;
|
||||
}
|
||||
|
||||
List<ApplicationInfoEx.PluginChooserPage> pages = appInfo.getPluginChooserPages();
|
||||
if (!pages.isEmpty()) {
|
||||
StartupWizard startupWizard = new StartupWizard(pages);
|
||||
startupWizard.setCancelText("Skip");
|
||||
startupWizard.show();
|
||||
PluginManagerCore.invalidatePlugins();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@ import com.intellij.openapi.options.ExternalInfo;
|
||||
import com.intellij.openapi.options.ExternalizableScheme;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.text.StringTokenizer;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
@@ -279,12 +280,12 @@ public class AbstractFileType extends UserFileType<AbstractFileType> implements
|
||||
private static Element writeKeywords(Set<String> keywords, String tagName, Element highlightingElement) {
|
||||
if (keywords.size() == 0 && !ELEMENT_KEYWORDS.equals(tagName)) return null;
|
||||
Element keywordsElement = new Element(tagName);
|
||||
String[] strings = keywords.toArray(new String[keywords.size()]);
|
||||
String[] strings = ArrayUtil.toStringArray(keywords);
|
||||
Arrays.sort(strings);
|
||||
StringBuilder keywordsAttribute = new StringBuilder();
|
||||
|
||||
for (final String keyword : strings) {
|
||||
if (keyword.indexOf(SEMICOLON) == -1) {
|
||||
if (!keyword.contains(SEMICOLON)) {
|
||||
if (keywordsAttribute.length() != 0) keywordsAttribute.append(SEMICOLON);
|
||||
keywordsAttribute.append(keyword);
|
||||
} else {
|
||||
|
||||
@@ -271,6 +271,9 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (CommonDataKeys.PROJECT.is(dataId)) {
|
||||
return myProject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.popup.AbstractPopup;
|
||||
import com.intellij.ui.popup.OurHeavyWeightPopup;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.JBHiDPIScaledImage;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -42,7 +42,7 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
|
||||
private final TipComponent myTipComponent;
|
||||
|
||||
private boolean myEnabled = Registry.is("ide.expansion.hints.enabled");
|
||||
private Hint myHint;
|
||||
private Popup myPopup;
|
||||
private KeyType myKey;
|
||||
private Rectangle myKeyItemBounds;
|
||||
private BufferedImage myImage;
|
||||
@@ -293,7 +293,7 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
|
||||
if (location == null) {
|
||||
hideHint();
|
||||
}
|
||||
else if (myHint == null) {
|
||||
else if (myPopup == null) {
|
||||
showHint(location);
|
||||
}
|
||||
else {
|
||||
@@ -320,34 +320,36 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
|
||||
|
||||
private void hideHint() {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
if (myHint != null) {
|
||||
myHint.hide();
|
||||
myHint = null;
|
||||
if (myPopup != null) {
|
||||
myPopup.hide();
|
||||
myPopup = null;
|
||||
repaintKeyItem();
|
||||
}
|
||||
myKey = null;
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return myHint != null && myHint.isVisible();
|
||||
return myPopup != null;
|
||||
}
|
||||
|
||||
private void showHint(Point location) {
|
||||
assert myHint == null;
|
||||
assert myPopup == null;
|
||||
|
||||
if (!myComponent.isShowing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
myHint = new ExpansionHint(myTipComponent);
|
||||
myHint.show(myComponent, location.x, location.y, myComponent, new HintHint(myComponent, location));
|
||||
SwingUtilities.convertPointToScreen(location, myComponent);
|
||||
myPopup = new OurHeavyWeightPopup(myComponent, myTipComponent, location.x, location.y);
|
||||
myPopup.show();
|
||||
|
||||
repaintKeyItem();
|
||||
}
|
||||
|
||||
private void repaintHint(Point location) {
|
||||
if (myHint != null && myKey != null && myComponent.isShowing()) {
|
||||
myHint.setLocation(new RelativePoint(myComponent, location));
|
||||
if (myPopup != null && myKey != null && myComponent.isShowing()) {
|
||||
SwingUtilities.convertPointToScreen(location, myComponent);
|
||||
SwingUtilities.getWindowAncestor(myTipComponent).setLocation(location);
|
||||
myTipComponent.repaint();
|
||||
repaintKeyItem();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.idea;
|
||||
|
||||
import com.intellij.ide.plugins.PluginManager;
|
||||
import com.intellij.openapi.application.ConfigImportHelper;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -32,12 +33,17 @@ public class MainImpl {
|
||||
|
||||
StartupUtil.prepareAndStart(args, new StartupUtil.AppStarter() {
|
||||
@Override
|
||||
public void start(boolean newConfigFolder) {
|
||||
public void start(final boolean newConfigFolder) {
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PluginManager.installExceptionHandler();
|
||||
|
||||
if (newConfigFolder && !Boolean.getBoolean(ConfigImportHelper.CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY)) {
|
||||
StartupUtil.runStartupWizard();
|
||||
}
|
||||
|
||||
final IdeaApplication app = new IdeaApplication(args);
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@@ -239,7 +239,7 @@ todo.in.new.review.button=&Review
|
||||
before.checkin.standard.options.check.smells=Perform code analy&sis
|
||||
before.checkin.new.todo.check=Check TODO ({0})
|
||||
before.checkin.new.todo.check.title=Check TODO
|
||||
before.checkin.cleanup.code=&Cleanup
|
||||
before.checkin.cleanup.code=C&leanup
|
||||
|
||||
# Changes view
|
||||
changes.nodetitle.unversioned.files=Unversioned Files
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user